HowTos/NewPacket: Remove old code from example
[senf.git] / Console / OverloadedCommand.cci
1 // $Id$
2 //
3 // Copyright (C) 2008 
4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 //     Stefan Bund <g0dil@berlios.de>
7 //
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 // GNU General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22
23 /** \file
24     \brief OverloadedCommand inline non-template implementation */
25
26 //#include "OverloadedCommand.ih"
27
28 // Custom includes
29
30 #define prefix_ inline
31 ///////////////////////////////cci.p///////////////////////////////////////
32
33 ///////////////////////////////////////////////////////////////////////////
34 // senf::console::CommandOverload
35
36 prefix_ senf::console::CommandOverload::~CommandOverload()
37 {}
38
39 prefix_ void senf::console::CommandOverload::operator()(std::ostream & os,
40                                                         Arguments const & arguments)
41 {
42     v_execute(os, arguments);
43 }
44
45 prefix_ void senf::console::CommandOverload::help(std::ostream & os)
46 {
47     v_help(os);
48 }
49
50 prefix_ senf::console::OverloadedCommandNode & senf::console::CommandOverload::node()
51 {
52     SENF_ASSERT( node_ );
53     return *node_;
54 }
55
56 prefix_ senf::console::CommandOverload::CommandOverload()
57     : node_(0)
58 {}
59
60 ///////////////////////////////////////////////////////////////////////////
61 // senf::console::OverloadedCommandNode
62
63 prefix_ senf::console::OverloadedCommandNode::ptr senf::console::OverloadedCommandNode::create()
64 {
65     return ptr(new OverloadedCommandNode());
66 }
67
68 prefix_ void senf::console::OverloadedCommandNode::add(CommandOverload::ptr overload)
69 {
70     overloads_.push_back(overload);
71 }
72
73 prefix_ senf::console::OverloadedCommandNode::ptr senf::console::OverloadedCommandNode::thisptr()
74 {
75     return boost::static_pointer_cast<OverloadedCommandNode>(shared_from_this());
76 }
77
78 prefix_ senf::console::OverloadedCommandNode::cptr senf::console::OverloadedCommandNode::thisptr()
79     const
80 {
81     return boost::static_pointer_cast<OverloadedCommandNode const>(shared_from_this());
82 }
83
84 prefix_ senf::console::OverloadedCommandNode &
85 senf::console::OverloadedCommandNode::doc(std::string const & doc)
86 {
87     doc_ = doc;
88     return *this;
89 }
90
91 prefix_ senf::console::OverloadedCommandNode::OverloadedCommandNode()
92 {}
93
94 ///////////////////////////////////////////////////////////////////////////
95 // senf::console::SimpleCommandOverload
96
97 prefix_ senf::console::SimpleCommandOverload::ptr
98 senf::console::SimpleCommandOverload::create(Function fn)
99 {
100     return ptr(new SimpleCommandOverload(fn));
101 }
102
103 prefix_ senf::console::SimpleCommandOverload &
104 senf::console::SimpleCommandOverload::doc(std::string const & doc)
105 {
106     doc_ = doc;
107     return *this;
108 }
109
110 prefix_ senf::console::SimpleCommandOverload::SimpleCommandOverload(Function fn)
111     : fn_ (fn)
112 {}
113
114 ///////////////////////////////cci.e///////////////////////////////////////
115 #undef prefix_
116
117 \f
118 // Local Variables:
119 // mode: c++
120 // fill-column: 100
121 // comment-column: 40
122 // c-file-style: "senf"
123 // indent-tabs-mode: nil
124 // ispell-local-dictionary: "american"
125 // compile-command: "scons -u test"
126 // End: