X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/blobdiff_plain/f7a78d4e11841dea09a3c0cb60f55a689856a22f..e41f399c89624041ca0cfc03c592c4f9e6902a45:/options.cpp diff --git a/options.cpp b/options.cpp index 2cf607c..76bc997 100644 --- a/options.cpp +++ b/options.cpp @@ -78,6 +78,29 @@ namespace opt { namespace { + // some helper functions for opt::print() + + const char* on_off(bool b) + { + return b ? "on" : "off"; + } + + template + const char* val_or_string(const T& val, const char* str, const T& deflt = 0) + { + static std::string res; + if (val != deflt) { + std::ostringstream oss; + oss << val; + res = oss.str(); + } else { + res = str; + } + return res.c_str(); + } + + // helper function for opt::parse_args() + template bool nol_find_prefix(const T& nol, const char* descr, std::string& name) { @@ -198,31 +221,6 @@ bool opt::parse_args(int* argc, char* argv[]) return result; } -namespace { - - // some helper functions for opt::print() - - const char* on_off(bool b) - { - return b ? "on" : "off"; - } - - template - const char* val_or_string(const T& val, const char* str, const T& deflt = 0) - { - static std::string res; - if (val != deflt) { - std::ostringstream oss; - oss << val; - res = oss.str(); - } else { - res = str; - } - return res.c_str(); - } - -} // namespace - void opt::print() { INFO0(",----[ Simulation parameters ]");