Line data Source code
1 :
2 : /* Copyright (c) 2012, Daniel Nachbaur <danielnachbaur@gmail.com>
3 : *
4 : * This file is part of Collage <https://github.com/Eyescale/Collage>
5 : *
6 : * This library is free software; you can redistribute it and/or modify it under
7 : * the terms of the GNU Lesser General Public License version 2.1 as published
8 : * by the Free Software Foundation.
9 : *
10 : * This library is distributed in the hope that it will be useful, but WITHOUT
11 : * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 : * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 : * details.
14 : *
15 : * You should have received a copy of the GNU Lesser General Public License
16 : * along with this library; if not, write to the Free Software Foundation, Inc.,
17 : * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 : */
19 :
20 : #include "customICommand.h"
21 :
22 : namespace co
23 : {
24 :
25 : namespace detail
26 : {
27 :
28 : class CustomICommand
29 : {
30 : public:
31 2 : CustomICommand() {}
32 :
33 : uint128_t commandID;
34 : };
35 :
36 : }
37 :
38 2 : CustomICommand::CustomICommand( const ICommand& command )
39 : : ICommand( command )
40 2 : , _impl( new detail::CustomICommand )
41 : {
42 2 : _init();
43 2 : }
44 :
45 0 : CustomICommand::CustomICommand( const CustomICommand& rhs )
46 : : ICommand( rhs )
47 0 : , _impl( new detail::CustomICommand )
48 : {
49 0 : _init();
50 0 : }
51 :
52 2 : void CustomICommand::_init()
53 : {
54 2 : if( isValid( ))
55 2 : *this >> _impl->commandID;
56 2 : }
57 :
58 4 : CustomICommand::~CustomICommand()
59 : {
60 2 : delete _impl;
61 2 : }
62 :
63 2 : const uint128_t& CustomICommand::getCommandID() const
64 : {
65 2 : return _impl->commandID;
66 : }
67 :
68 0 : std::ostream& operator << ( std::ostream& os, const CustomICommand& command )
69 : {
70 0 : os << static_cast< const ICommand& >( command );
71 0 : if( command.isValid( ))
72 0 : os << " custom command " << command.getCommandID();
73 0 : return os;
74 : }
75 :
76 66 : }
|