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 : namespace detail
25 : {
26 : class CustomICommand
27 : {
28 : public:
29 2 : CustomICommand() {}
30 : uint128_t commandID;
31 : };
32 : }
33 :
34 2 : CustomICommand::CustomICommand(const ICommand& command)
35 : : ICommand(command)
36 2 : , _impl(new detail::CustomICommand)
37 : {
38 2 : _init();
39 2 : }
40 :
41 0 : CustomICommand::CustomICommand(const CustomICommand& rhs)
42 : : ICommand(rhs)
43 0 : , _impl(new detail::CustomICommand)
44 : {
45 0 : _init();
46 0 : }
47 :
48 2 : void CustomICommand::_init()
49 : {
50 2 : if (isValid())
51 2 : *this >> _impl->commandID;
52 2 : }
53 :
54 4 : CustomICommand::~CustomICommand()
55 : {
56 2 : delete _impl;
57 2 : }
58 :
59 2 : const uint128_t& CustomICommand::getCommandID() const
60 : {
61 2 : return _impl->commandID;
62 : }
63 :
64 0 : std::ostream& operator<<(std::ostream& os, const CustomICommand& command)
65 : {
66 0 : os << static_cast<const ICommand&>(command);
67 0 : if (command.isValid())
68 0 : os << " custom command " << command.getCommandID();
69 0 : return os;
70 : }
71 63 : }
|