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 ProgramOptions inline non-template implementation */
17 #include "ProgramOptions.ih"
21 #define prefix_ inline
22 //-/////////////////////////////////////////////////////////////////////////////////////////////////
24 //-/////////////////////////////////////////////////////////////////////////////////////////////////
25 // senf::console::detail::ProgramOptionsSource
27 prefix_ senf::console::detail::ProgramOptionsSource::ptr
28 senf::console::detail::ProgramOptionsSource::create(int argc, char const ** argv)
30 return ptr(new ProgramOptionsSource(argc,argv));
33 prefix_ senf::console::detail::ProgramOptionsSource::ProgramOptionsSource(int argc,
35 : argc_ (argc), argv_ (argv)
38 prefix_ senf::console::detail::ProgramOptionsSource &
39 senf::console::detail::ProgramOptionsSource::alias(char letter, std::string const & longOpt,
42 shortOptions_.insert(std::make_pair(letter, ShortOption(withArg, longOpt)));
46 //-/////////////////////////////////////////////////////////////////////////////////////////////////
47 // senf::console::detail::ProgramOptionsSource::ShortOption
49 prefix_ senf::console::detail::ProgramOptionsSource::ShortOption::
50 ShortOption(bool withArg_, std::string const & longOpt_)
51 : withArg (withArg_), longOpt (longOpt_)
54 //-/////////////////////////////////////////////////////////////////////////////////////////////////
55 // senf::console::ProgramOptions
57 prefix_ senf::console::ProgramOptions::ProgramOptions(int argc, char const ** argv,
59 : detail::BundleMixin (root), config_ (add(detail::ProgramOptionsSource::create(argc, argv)))
62 prefix_ senf::console::ProgramOptions &
63 senf::console::ProgramOptions::alias(char letter, std::string const & longOpt, bool withArg)
65 config_.alias(letter, longOpt, withArg);
69 //-/////////////////////////////////////////////////////////////////////////////////////////////////
71 prefix_ senf::console::detail::ProgramOptionsSource::ptr
72 senf::console::OptionsConfig(int argc, char const ** argv)
74 return detail::ProgramOptionsSource::create(argc, argv);
77 //-/////////////////////////////////////////////////////////////////////////////////////////////////
85 // c-file-style: "senf"
86 // indent-tabs-mode: nil
87 // ispell-local-dictionary: "american"
88 // compile-command: "scons -u test"