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 ParsedCommand inline non-template implementation */
17 #include "ParsedCommand.ih"
21 #define prefix_ inline
22 //-/////////////////////////////////////////////////////////////////////////////////////////////////
24 //-/////////////////////////////////////////////////////////////////////////////////////////////////
25 // senf::console::detail::ArgumentInfoBase
27 prefix_ senf::console::detail::ArgumentInfoBase::ArgumentInfoBase(std::string const & type_,
29 : type (type_), name (), hasDefault (false), singleToken (singleToken_)
32 //-/////////////////////////////////////////////////////////////////////////////////////////////////
33 // senf::console::ParsedCommandOverloadBase
35 prefix_ senf::console::ParsedCommandOverloadBase::ParsedCommandOverloadBase()
38 prefix_ senf::console::detail::ArgumentInfoBase &
39 senf::console::ParsedCommandOverloadBase::arg(unsigned n)
42 BOOST_ASSERT(n < parameters_.size());
43 return * parameters_[n];
46 prefix_ void senf::console::ParsedCommandOverloadBase::doc(std::string const & d)
51 //-/////////////////////////////////////////////////////////////////////////////////////////////////
52 // senf::console::ParsedCommandAttributorBase
54 prefix_ senf::console::OverloadedCommandNode &
55 senf::console::ParsedCommandAttributorBase::create(DirectoryNode & dir,
56 std::string const & name)
59 OverloadedCommandNode & node (OverloadedCommandNode::insertOverload(dir, name, overload_));
60 if (doc_) node.doc(*doc_);
61 if (shortdoc_) node.shortdoc(*shortdoc_);
65 prefix_ senf::console::ParsedCommandAttributorBase::
66 ParsedCommandAttributorBase(ParsedCommandOverloadBase::ptr overload, unsigned index)
67 : overload_ (overload), index_ (index)
70 prefix_ senf::console::ParsedCommandAttributorBase::
71 ParsedCommandAttributorBase(ParsedCommandAttributorBase const & other, unsigned index)
72 : overload_ (other.overload_), index_ (index), doc_ (other.doc_), shortdoc_ (other.shortdoc_)
75 prefix_ senf::console::ParsedCommandOverloadBase &
76 senf::console::ParsedCommandAttributorBase::overload()
82 prefix_ void senf::console::ParsedCommandAttributorBase::argName(std::string const & name)
84 overload().arg(index_).name = name;
87 prefix_ void senf::console::ParsedCommandAttributorBase::argDoc(std::string const & doc)
89 overload().arg(index_).doc = doc;
92 prefix_ void senf::console::ParsedCommandAttributorBase::typeName(std::string const & doc)
94 overload().arg(index_).type = doc;
97 prefix_ void senf::console::ParsedCommandAttributorBase::defaultDoc(std::string const & doc)
99 overload().arg(index_).defaultDoc = doc;
102 prefix_ void senf::console::ParsedCommandAttributorBase::overloadDoc(std::string const & doc)
107 prefix_ void senf::console::ParsedCommandAttributorBase::nodeDoc(std::string const & doc)
112 prefix_ void senf::console::ParsedCommandAttributorBase::shortDoc(std::string const & doc)
117 //-/////////////////////////////////////////////////////////////////////////////////////////////////
124 // comment-column: 40
125 // c-file-style: "senf"
126 // indent-tabs-mode: nil
127 // ispell-local-dictionary: "american"
128 // compile-command: "scons -u test"