2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
15 \brief OverloadedCommand inline non-template implementation */
17 //#include "OverloadedCommand.ih"
22 #define prefix_ inline
23 //-/////////////////////////////////////////////////////////////////////////////////////////////////
25 //-/////////////////////////////////////////////////////////////////////////////////////////////////
26 // senf::console::OverloadedCommandNode
28 prefix_ senf::console::OverloadedCommandNode::ptr senf::console::OverloadedCommandNode::create()
30 return ptr(new OverloadedCommandNode());
33 prefix_ senf::console::OverloadedCommandNode::ptr senf::console::OverloadedCommandNode::thisptr()
35 return boost::static_pointer_cast<OverloadedCommandNode>(shared_from_this());
38 prefix_ senf::console::OverloadedCommandNode::cptr senf::console::OverloadedCommandNode::thisptr()
41 return boost::static_pointer_cast<OverloadedCommandNode const>(shared_from_this());
44 prefix_ senf::console::OverloadedCommandNode &
45 senf::console::OverloadedCommandNode::doc(std::string const & doc)
51 prefix_ senf::console::OverloadedCommandNode &
52 senf::console::OverloadedCommandNode::shortdoc(std::string const & doc)
59 senf::console::OverloadedCommandNode::overloadIndex(CommandOverload const & overload)
61 return find(overloads_.begin(), overloads_.end(), CommandOverload::cptr(&overload))
62 - overloads_.begin() + 1;
65 prefix_ senf::console::OverloadedCommandNode::OverloadsRange
66 senf::console::OverloadedCommandNode::overloads()
69 return boost::make_iterator_range(overloads_.begin(), overloads_.end());
72 prefix_ senf::console::OverloadedCommandNode::OverloadedCommandNode()
75 //-/////////////////////////////////////////////////////////////////////////////////////////////////
76 // senf::console::SimpleCommandOverload
78 prefix_ senf::console::SimpleCommandOverload::ptr
79 senf::console::SimpleCommandOverload::create(Function fn)
81 return ptr(new SimpleCommandOverload(fn));
84 prefix_ senf::console::SimpleCommandOverload &
85 senf::console::SimpleCommandOverload::doc(std::string const & doc)
91 prefix_ senf::console::SimpleCommandOverload::SimpleCommandOverload(Function fn)
95 //-/////////////////////////////////////////////////////////////////////////////////////////////////
96 // senf::console::SimpleOverloadAttributor
98 prefix_ senf::console::SimpleOverloadAttributor::
99 SimpleOverloadAttributor(SimpleCommandOverload::Function fn)
100 : overload_ (SimpleCommandOverload::create(fn))
103 prefix_ senf::console::SimpleOverloadAttributor const &
104 senf::console::SimpleOverloadAttributor::doc(std::string const & doc)
111 prefix_ senf::console::SimpleOverloadAttributor const &
112 senf::console::SimpleOverloadAttributor::shortdoc(std::string const & doc)
119 prefix_ senf::console::SimpleOverloadAttributor const &
120 senf::console::SimpleOverloadAttributor::overloadDoc(std::string const & doc)
127 prefix_ senf::console::OverloadedCommandNode &
128 senf::console::SimpleOverloadAttributor::create(DirectoryNode & dir, std::string const & name)
131 OverloadedCommandNode & node (OverloadedCommandNode::insertOverload(dir, name, overload_));
132 if (doc_) node.doc(*doc_);
133 if (shortdoc_) node.shortdoc(*shortdoc_);
137 //-/////////////////////////////////////////////////////////////////////////////////////////////////
144 // comment-column: 40
145 // c-file-style: "senf"
146 // indent-tabs-mode: nil
147 // ispell-local-dictionary: "american"
148 // compile-command: "scons -u test"