ProgramOptions.hh
Go to the documentation of this file.
1 //
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
6 //
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
11 //
12 
13 
17 #ifndef HH_SENF_Utils_Console_ProgramOptions_
18 #define HH_SENF_Utils_Console_ProgramOptions_ 1
19 
20 // Custom includes
21 #include "Config.hh"
22 
23 
24 //#include "ProgramOptions.mpp"
25 #include "ProgramOptions.ih"
26 //-/////////////////////////////////////////////////////////////////////////////////////////////////
27 
28 namespace senf {
29 namespace console {
30 
59  : public detail::BundleMixin
60  {
61  public:
62  //-////////////////////////////////////////////////////////////////////////
64  //\{
65 
66  ProgramOptions(int argc, char const ** argv, DirectoryNode & root = senf::console::root());
68 
72  //\}
73  //-////////////////////////////////////////////////////////////////////////
74 
75  template <class Container>
76  ProgramOptions & nonOptions(Container & container);
78 
82  ProgramOptions & alias(char letter, std::string const & longOpt, bool withArg=false);
84 
96  private:
97  detail::ProgramOptionsSource & config_;
98  };
99 
107  void parseOptions(int argc, char const ** argv, DirectoryNode & root = senf::console::root());
108 
116  detail::ProgramOptionsSource::ptr OptionsConfig(int argc, char const ** argv);
117 }}
118 
119 //-/////////////////////////////////////////////////////////////////////////////////////////////////
120 #include "ProgramOptions.cci"
121 //#include "ProgramOptions.ct"
122 #include "ProgramOptions.cti"
123 #endif
124 
125 
126 // Local Variables:
127 // mode: c++
128 // fill-column: 100
129 // comment-column: 40
130 // c-file-style: "senf"
131 // indent-tabs-mode: nil
132 // ispell-local-dictionary: "american"
133 // compile-command: "scons -u test"
134 // End:
ProgramOptions(int argc, char const **argv, DirectoryNode &root=senf::console::root())
Create ProgramOptions parser for given options.
Config public header.
Config/console tree directory node.
Definition: Node.hh:406
ProgramOptions & nonOptions(Container &container)
Set container to add non-option arguments to.
Definition: Config.hh:28
detail::ProgramOptionsSource::ptr OptionsConfig(int argc, char const **argv)
ConfigBundle source reading command line options.
DirectoryNode & root()
Get console root node.
Definition: Node.cc:26
void parseOptions(int argc, char const **argv, DirectoryNode &root=senf::console::root())
Parse command line options.
Internal: Provide ConfigBundle facade for a single-source config.
Definition: Config.hh:105
ProgramOptions & alias(char letter, std::string const &longOpt, bool withArg=false)
Set short option alias.
Console node tree based command line option parser.