diff --git a/source/apta.cpp b/source/apta.cpp index e266ce29..13ef239f 100755 --- a/source/apta.cpp +++ b/source/apta.cpp @@ -13,6 +13,7 @@ #include "utility/loguru.hpp" #include "input/abbadingoreader.h" #include "input/inputdatalocator.h" +#include "input/parsers/abbadingoparser.h" using namespace std; @@ -40,11 +41,9 @@ apta::apta(){ } void apta::print_dot(iostream& output){ - int ncounter = 0; // needed for the correct printing of intermediate models after undoing merges - for(APTA_iterator Ait = APTA_iterator(root); *Ait != 0; ++Ait){ - (*Ait)->number = ncounter++; - } + // Hielke: Fix numbering of states properly with suggestion in #23. + merger->renumber_states(); output << "digraph DFA {\n"; output << "\t" << root->find()->number << " [label=\"root\" shape=box];\n"; @@ -70,23 +69,19 @@ void apta::print_dot(iostream& output){ output << "\t" << n->number << " [ label=\""; if(DEBUGGING){ - output << n << ":#" << "\n"; - output << "rep#" << n->representative << "\n"; + output << n << ":#" << "\\n"; + output << "rep#" << n->representative << "\\n"; } - - output << n->number << ":#" << n->size << "\n"; + output << n->number << " #" << n->size << " "; n->data->print_state_label(output); - output << "\" "; n->data->print_state_style(output); - if (!n->red) output << " style=dotted"; - - //output << n->number << " #" << n->size << "\" "; - //if (n->is_red()) output << ", style=filled, fillcolor=\"firebrick1\""; - //else if (n->is_blue()) output << ", style=filled, fillcolor=\"dodgerblue1\""; - //else if (n->is_white()) output << ", style=filled, fillcolor=\"ghostwhite\""; - //output << ", width=" << log(1 + log(1 + n->size)); - //output << ", height=" << log(1 + log(1 + n->size)); + output << "\" "; + if (n->is_red()) output << ", style=filled, fillcolor=\"firebrick1\""; + else if (n->is_blue()) output << ", style=filled, fillcolor=\"dodgerblue1\""; + else if (n->is_white()) output << ", style=filled, fillcolor=\"ghostwhite\""; + output << ", width=" << log(1 + log(1 + n->size)); + output << ", height=" << log(1 + log(1 + n->size)); output << ", penwidth=" << log(1 + n->size); output << "];\n"; @@ -108,18 +103,14 @@ void apta::print_dot(iostream& output){ output << "\t\t" << n->number << " -> " << child->number << " [label=\""; - output << inputdata_locator::get()->get_symbol(it->first) << endl; - - //n->data->print_transition_label(output, it->first); - - + output << inputdata_locator::get()->get_symbol(it->first) << " "; + n->data->print_transition_label(output, it->first); for(auto & min_attribute_value : g->min_attribute_values){ - output << " " << inputdata_locator::get()->get_attribute(min_attribute_value.first) << " >= " << min_attribute_value.second; + output << "\\n" << inputdata_locator::get()->get_attribute(min_attribute_value.first) << " >= " << min_attribute_value.second; } for(auto & max_attribute_value : g->max_attribute_values){ - output << " " << inputdata_locator::get()->get_attribute(max_attribute_value.first) << " < " << max_attribute_value.second; + output << "\\n" << inputdata_locator::get()->get_attribute(max_attribute_value.first) << " < " << max_attribute_value.second; } - output << "\" "; output << ", penwidth=" << log(1 + n->size); output << " ];\n"; @@ -176,12 +167,10 @@ void apta_node::print_json_transitions(iostream& output){ void apta::print_json(iostream& output){ set_json_depths(); - int count = 0; root->depth = 0; - for(merged_APTA_iterator Ait = merged_APTA_iterator(root); *Ait != nullptr; ++Ait){ - apta_node* n = *Ait; - n->number = count++; - } + // needed for the correct printing of intermediate models after undoing merges + // Hielke: Fix numbering of states properly with suggestion in #23. + merger->renumber_states(); output << "{\n"; output << "\t\"types\" : [\n"; @@ -330,8 +319,13 @@ void apta::read_json(istream& input_stream){ string trace = n["trace"]; istringstream trace_stream(trace); node->access_trace = mem_store::create_trace(); - // TODO: verify this with Sicco (robert) - // idat.read_abbadingo_sequence(trace_stream,node->access_trace); + + auto parser = abbadingoparser::single_trace(trace_stream); + auto strategy = read_all(); + auto trace_maybe = inputdata_locator::get()->read_trace(parser, strategy); + if (trace_maybe.has_value()) { + node->access_trace = trace_maybe.value(); + } } for (int i = 1; i < read_apta["nodes"].size(); ++i) { json n = read_apta["nodes"][i]; @@ -447,7 +441,8 @@ void apta_node::initialize(apta_node* n){ representative_of = nullptr; tails_head = nullptr; access_trace = nullptr; - number = -1; + // keep the old node number + // number = -1; size = 0; final = 0; depth = 0; @@ -821,4 +816,4 @@ void apta::set_json_depths() const { it++; } } -} \ No newline at end of file +} diff --git a/source/evaluation/mealy.cpp b/source/evaluation/mealy.cpp index 85caf619..f72413e4 100755 --- a/source/evaluation/mealy.cpp +++ b/source/evaluation/mealy.cpp @@ -99,7 +99,7 @@ void mealy::reset(state_merger* merger){ void mealy_data::print_transition_label(iostream& output, int symbol){ - output << int_output[outputs[symbol]]; + output << "/" << int_output[outputs[symbol]]; }; string mealy_data::predict_data(tail* t){ diff --git a/source/input/parsers/abbadingoparser.cpp b/source/input/parsers/abbadingoparser.cpp index 045f756d..83f429e3 100644 --- a/source/input/parsers/abbadingoparser.cpp +++ b/source/input/parsers/abbadingoparser.cpp @@ -18,7 +18,7 @@ #include #include -void abbadingoparser::parse_header() { +void abbadingoparser::parse_header(std::istream &inputstream) { std::string line; std::getline(inputstream, line); @@ -166,3 +166,21 @@ std::optional abbadingoparser::next() { symbols.pop_front(); return cur_symbol; } + +/** + * Helper method to read a single abbadingo formatted trace + * Currently does not support trace or symbol attributes + * + * @param trace an input stream containing an abbadingo formatted trace. + * @return a parser for the trace. + */ +abbadingoparser abbadingoparser::single_trace(std::istream &trace) { + + abbadingoparser parser(trace, false); + + std::stringstream header; + header << "1 0\n"; + parser.parse_header(header); + + return parser; +} diff --git a/source/input/parsers/abbadingoparser.h b/source/input/parsers/abbadingoparser.h index 8d206b17..918868de 100644 --- a/source/input/parsers/abbadingoparser.h +++ b/source/input/parsers/abbadingoparser.h @@ -22,18 +22,24 @@ class abbadingoparser: public parser { std::vector trace_attr_prototypes; std::vector symbol_attr_prototypes; + + public: - abbadingoparser(std::istream &input) + explicit abbadingoparser(std::istream &input, bool header = true) : inputstream(input) { - parse_header(); + if (header) { + parse_header(inputstream); + } } - void parse_header(); + void parse_header(std::istream &inputstream); bool read_abbadingo_trace(); std::optional next(); + + static abbadingoparser single_trace(std::istream &input); }; diff --git a/source/input/parsers/grammar/abbadingoheader.h b/source/input/parsers/grammar/abbadingoheader.h index bfd6b46d..9a15184b 100644 --- a/source/input/parsers/grammar/abbadingoheader.h +++ b/source/input/parsers/grammar/abbadingoheader.h @@ -137,7 +137,7 @@ namespace { // The complete abbadingo header: number:dsft/name1,... number:dsft/name2,... struct abbadingo_header_p { - static constexpr auto rule = dsl::twice(dsl::p, dsl::trailing_sep(dsl::ascii::space)); + static constexpr auto rule = dsl::twice(dsl::p, dsl::trailing_sep(dsl::ascii::space)) + (dsl::newline | dsl::eof); static constexpr auto value = lexy::construct; }; } diff --git a/source/state_merger.cpp b/source/state_merger.cpp index 8c1fbb43..efeea074 100755 --- a/source/state_merger.cpp +++ b/source/state_merger.cpp @@ -1081,6 +1081,12 @@ void state_merger::print_dot(const string& file_name) output1.close(); } +void state_merger::print_dot(ostream& output) +{ + todot(); + output << dot_output; +} + void state_merger::print_json(const string& file_name) { tojson(); diff --git a/source/state_merger.h b/source/state_merger.h index 66b200c1..e55270c5 100755 --- a/source/state_merger.h +++ b/source/state_merger.h @@ -127,6 +127,7 @@ class state_merger{ bool split_init(apta_node *red, tail *t, int attr, int depth, bool evaluate, bool perform, bool test); void print_dot(const string& file_name); + void print_dot(ostream& output); void print_json(const string& file_name); diff --git a/source/utility/CLI11.hpp b/source/utility/CLI11.hpp old mode 100755 new mode 100644 index 8f958076..68244d38 --- a/source/utility/CLI11.hpp +++ b/source/utility/CLI11.hpp @@ -1,11 +1,11 @@ #pragma once -// CLI11: Version 1.9.0 +// CLI11: Version 1.9.1 // Originally designed by Henry Schreiner // https://github.com/CLIUtils/CLI11 // // This is a standalone header file generated by MakeSingleHeader.py in CLI11/scripts -// from: v1.9.0 +// from: v1.9.1 // // From LICENSE: // @@ -62,18 +62,18 @@ #include -// Verbatim copy from CLI/Version.hpp: +// Verbatim copy from Version.hpp: #define CLI11_VERSION_MAJOR 1 #define CLI11_VERSION_MINOR 9 -#define CLI11_VERSION_PATCH 0 -#define CLI11_VERSION "1.9.0" +#define CLI11_VERSION_PATCH 1 +#define CLI11_VERSION "1.9.1" -// Verbatim copy from CLI/Macros.hpp: +// Verbatim copy from Macros.hpp: // The following version macro is very similar to the one in PyBind11 @@ -112,7 +112,7 @@ -// Verbatim copy from CLI/Validators.hpp: +// Verbatim copy from Validators.hpp: // C standard library @@ -125,7 +125,14 @@ #else #include #if defined __cpp_lib_filesystem && __cpp_lib_filesystem >= 201703 +#if defined _GLIBCXX_RELEASE && _GLIBCXX_RELEASE >= 9 #define CLI11_HAS_FILESYSTEM 1 +#elif defined(__GLIBCXX__) +// if we are using gcc and Version <9 default to no filesystem +#define CLI11_HAS_FILESYSTEM 0 +#else +#define CLI11_HAS_FILESYSTEM 1 +#endif #else #define CLI11_HAS_FILESYSTEM 0 #endif @@ -134,7 +141,7 @@ #endif #if defined CLI11_HAS_FILESYSTEM && CLI11_HAS_FILESYSTEM > 0 -#include // NOLINT(build/include) +#include // NOLINT(build/include) #else #include #include @@ -142,15 +149,15 @@ -// From CLI/Version.hpp: +// From Version.hpp: -// From CLI/Macros.hpp: +// From Macros.hpp: -// From CLI/StringTools.hpp: +// From StringTools.hpp: namespace CLI { @@ -165,7 +172,7 @@ std::ostream &operator<<(std::ostream &in, const T &item) { return in << static_cast::type>(item); } -} // namespace enums +} // namespace enums /// Export to CLI namespace using enums::operator<<; @@ -179,9 +186,9 @@ constexpr int expected_max_vector_size{1 << 29}; inline std::vector split(const std::string &s, char delim) { std::vector elems; // Check to see if empty string, give consistent result - if(s.empty()) + if(s.empty()) { elems.emplace_back(); - else { + } else { std::stringstream ss; ss.str(s); std::string item; @@ -401,8 +408,9 @@ inline std::ptrdiff_t find_member(std::string name, it = std::find_if(std::begin(names), std::end(names), [&name](std::string local_name) { return detail::remove_underscore(local_name) == name; }); - } else + } else { it = std::find(std::begin(names), std::end(names), name); + } return (it != std::end(names)) ? (it - std::begin(names)) : (-1); } @@ -434,7 +442,7 @@ inline std::vector split_up(std::string str, char delimiter = '\0') if(delims.find_first_of(str[0]) != std::string::npos) { keyChar = str[0]; auto end = str.find_first_of(keyChar, 1); - while((end != std::string::npos) && (str[end - 1] == '\\')) { // deal with escaped quotes + while((end != std::string::npos) && (str[end - 1] == '\\')) { // deal with escaped quotes end = str.find_first_of(keyChar, end + 1); embeddedQuote = true; } @@ -492,7 +500,7 @@ inline std::size_t escape_detect(std::string &str, std::size_t offset) { auto astart = str.find_last_of("-/ \"\'`", offset - 1); if(astart != std::string::npos) { if(str[astart] == ((str[offset] == '=') ? '-' : '/')) - str[offset] = ' '; // interpret this as a space so the split_up works properly + str[offset] = ' '; // interpret this as a space so the split_up works properly } } return offset + 1; @@ -510,11 +518,11 @@ inline std::string &add_quotes_if_needed(std::string &str) { return str; } -} // namespace detail +} // namespace detail -} // namespace CLI +} // namespace CLI -// From CLI/Error.hpp: +// From Error.hpp: namespace CLI { @@ -747,11 +755,11 @@ class RequiredError : public ParseError { class ArgumentMismatch : public ParseError { CLI11_ERROR_DEF(ParseError, ArgumentMismatch) CLI11_ERROR_SIMPLE(ArgumentMismatch) - ArgumentMismatch(std::string name, int expected, std::size_t recieved) + ArgumentMismatch(std::string name, int expected, std::size_t received) : ArgumentMismatch(expected > 0 ? ("Expected exactly " + std::to_string(expected) + " arguments to " + name + - ", got " + std::to_string(recieved)) + ", got " + std::to_string(received)) : ("Expected at least " + std::to_string(-expected) + " arguments to " + name + - ", got " + std::to_string(recieved)), + ", got " + std::to_string(received)), ExitCodes::ArgumentMismatch) {} static ArgumentMismatch AtLeast(std::string name, int num, std::size_t received) { @@ -838,9 +846,9 @@ class OptionNotFound : public Error { /// @} -} // namespace CLI +} // namespace CLI -// From CLI/TypeTools.hpp: +// From TypeTools.hpp: namespace CLI { @@ -854,7 +862,7 @@ enum class enabler {}; /// An instance to use in EnableIf constexpr enabler dummy = {}; -} // namespace detail +} // namespace detail /// A copy of enable_if_t from C++14, compatible with C++11. /// @@ -1049,15 +1057,24 @@ template class is_tuple_like { }; /// Convert an object to a string (directly forward if this can become a string) -template ::value, detail::enabler> = detail::dummy> +template ::value, detail::enabler> = detail::dummy> auto to_string(T &&value) -> decltype(std::forward(value)) { return std::forward(value); } +/// Construct a string from the object +template ::value && !std::is_convertible::value, + detail::enabler> = detail::dummy> +std::string to_string(const T &value) { + return std::string(value); +} + /// Convert an object to a string (streaming must be supported for that type) template ::value && is_ostreamable::value, detail::enabler> = - detail::dummy> + enable_if_t::value && !std::is_constructible::value && + is_ostreamable::value, + detail::enabler> = detail::dummy> std::string to_string(T &&value) { std::stringstream stream; stream << value; @@ -1379,7 +1396,7 @@ inline std::string type_name() { // Lexical cast /// Convert a flag into an integer value typically binary flags -inline int64_t to_flag_value(std::string val) { +inline std::int64_t to_flag_value(std::string val) { static const std::string trueString("true"); static const std::string falseString("false"); if(val == trueString) { @@ -1389,10 +1406,10 @@ inline int64_t to_flag_value(std::string val) { return -1; } val = detail::to_lower(val); - int64_t ret; + std::int64_t ret; if(val.size() == 1) { if(val[0] >= '1' && val[0] <= '9') { - return (static_cast(val[0]) - '0'); + return (static_cast(val[0]) - '0'); } switch(val[0]) { case '0': @@ -1442,7 +1459,7 @@ template ::value == object_category::unsigned_integral, detail::enabler> = detail::dummy> bool lexical_cast(const std::string &input, T &output) { if(!input.empty() && input.front() == '-') - return false; // std::stoull happily converts negative values to junk without any errors. + return false; // std::stoull happily converts negative values to junk without any errors. try { std::size_t n = 0; @@ -1622,7 +1639,7 @@ bool lexical_assign(const std::string &input, T &output) { XC val{}; bool parse_result = input.empty() ? true : lexical_cast(input, val); if(parse_result) { - output = T(val); // use () form of constructor to allow some implicit conversions + output = T(val); // use () form of constructor to allow some implicit conversions } return parse_result; } @@ -1803,7 +1820,7 @@ bool lexical_conversion(const std::vector &strings, T &output) { template ::value && std::is_unsigned::value, detail::enabler> = detail::dummy> void sum_flag_vector(const std::vector &flags, T &output) { - int64_t count{0}; + std::int64_t count{0}; for(auto &flag : flags) { count += detail::to_flag_value(flag); } @@ -1818,17 +1835,17 @@ void sum_flag_vector(const std::vector &flags, T &output) { template ::value && std::is_signed::value, detail::enabler> = detail::dummy> void sum_flag_vector(const std::vector &flags, T &output) { - int64_t count{0}; + std::int64_t count{0}; for(auto &flag : flags) { count += detail::to_flag_value(flag); } output = static_cast(count); } -} // namespace detail -} // namespace CLI +} // namespace detail +} // namespace CLI -// From CLI/Split.hpp: +// From Split.hpp: namespace CLI { namespace detail { @@ -1950,10 +1967,10 @@ get_names(const std::vector &input) { short_names, long_names, pos_name); } -} // namespace detail -} // namespace CLI +} // namespace detail +} // namespace CLI -// From CLI/ConfigFwd.hpp: +// From ConfigFwd.hpp: namespace CLI { @@ -2068,9 +2085,9 @@ class ConfigTOML : public ConfigINI { valueDelimiter = '='; } }; -} // namespace CLI +} // namespace CLI -// From CLI/Validators.hpp: +// From Validators.hpp: namespace CLI { @@ -2129,14 +2146,14 @@ class Validator { } } return retstring; - }; + } /// This is the required operator for a Validator - provided to help /// users (CLI11 uses the member `func` directly) std::string operator()(const std::string &str) const { std::string value = str; return (active_) ? func_(value) : std::string{}; - }; + } /// Specify the type string Validator &description(std::string validator_desc) { @@ -2190,13 +2207,13 @@ class Validator { Validator &application_index(int app_index) { application_index_ = app_index; return *this; - }; + } /// Specify the application index of a validator Validator application_index(int app_index) const { Validator newval(*this); newval.application_index_ = app_index; return newval; - }; + } /// Get the current value of the application index int get_application_index() const { return application_index_; } /// Get a boolean if the validator is active @@ -2292,7 +2309,7 @@ class Validator { return std::string(1, '(') + f1 + ')' + merger + '(' + f2 + ')'; }; } -}; // namespace CLI +}; // namespace CLI /// Class wrapping some of the accessors of Validator class CustomValidator : public Validator { @@ -2304,7 +2321,7 @@ class CustomValidator : public Validator { namespace detail { /// CLI enumeration of different file types -enum class path_type { nonexistant, file, directory }; +enum class path_type { nonexistent, file, directory }; #if defined CLI11_HAS_FILESYSTEM && CLI11_HAS_FILESYSTEM > 0 /// get the type of the path from a file name @@ -2312,12 +2329,12 @@ inline path_type check_path(const char *file) noexcept { std::error_code ec; auto stat = std::filesystem::status(file, ec); if(ec) { - return path_type::nonexistant; + return path_type::nonexistent; } switch(stat.type()) { case std::filesystem::file_type::none: case std::filesystem::file_type::not_found: - return path_type::nonexistant; + return path_type::nonexistent; case std::filesystem::file_type::directory: return path_type::directory; case std::filesystem::file_type::symlink: @@ -2345,7 +2362,7 @@ inline path_type check_path(const char *file) noexcept { return ((buffer.st_mode & S_IFDIR) != 0) ? path_type::directory : path_type::file; } #endif - return path_type::nonexistant; + return path_type::nonexistent; } #endif /// Check for an existing file (returns error message if check fails) @@ -2354,7 +2371,7 @@ class ExistingFileValidator : public Validator { ExistingFileValidator() : Validator("FILE") { func_ = [](std::string &filename) { auto path_result = check_path(filename.c_str()); - if(path_result == path_type::nonexistant) { + if(path_result == path_type::nonexistent) { return "File does not exist: " + filename; } if(path_result == path_type::directory) { @@ -2371,7 +2388,7 @@ class ExistingDirectoryValidator : public Validator { ExistingDirectoryValidator() : Validator("DIR") { func_ = [](std::string &filename) { auto path_result = check_path(filename.c_str()); - if(path_result == path_type::nonexistant) { + if(path_result == path_type::nonexistent) { return "Directory does not exist: " + filename; } if(path_result == path_type::file) { @@ -2388,7 +2405,7 @@ class ExistingPathValidator : public Validator { ExistingPathValidator() : Validator("PATH(existing)") { func_ = [](std::string &filename) { auto path_result = check_path(filename.c_str()); - if(path_result == path_type::nonexistant) { + if(path_result == path_type::nonexistent) { return "Path does not exist: " + filename; } return std::string(); @@ -2402,7 +2419,7 @@ class NonexistentPathValidator : public Validator { NonexistentPathValidator() : Validator("PATH(non-existing)") { func_ = [](std::string &filename) { auto path_result = check_path(filename.c_str()); - if(path_result != path_type::nonexistant) { + if(path_result != path_type::nonexistent) { return "Path already exists: " + filename; } return std::string(); @@ -2481,7 +2498,7 @@ class Number : public Validator { } }; -} // namespace detail +} // namespace detail // Static is not needed here, because global const implies static. @@ -2583,7 +2600,7 @@ typename std::remove_reference::type &smart_deref(T &value) { /// Generate a string representation of a set template std::string generate_set(const T &set) { using element_t = typename detail::element_type::type; - using iteration_type_t = typename detail::pair_adaptor::value_type; // the type of the object pair + using iteration_type_t = typename detail::pair_adaptor::value_type; // the type of the object pair std::string out(1, '{'); out.append(detail::join( detail::smart_deref(set), @@ -2596,7 +2613,7 @@ template std::string generate_set(const T &set) { /// Generate a string representation of a map template std::string generate_map(const T &map, bool key_only = false) { using element_t = typename detail::element_type::type; - using iteration_type_t = typename detail::pair_adaptor::value_type; // the type of the object pair + using iteration_type_t = typename detail::pair_adaptor::value_type; // the type of the object pair std::string out(1, '{'); out.append(detail::join( detail::smart_deref(map), @@ -2707,7 +2724,7 @@ typename std::enable_if::value, bool>::type checked_mu return true; } -} // namespace detail +} // namespace detail /// Verify items are in a set class IsMember : public Validator { public: @@ -2727,11 +2744,11 @@ class IsMember : public Validator { // Get the type of the contained item - requires a container have ::value_type // if the type does not have first_type and second_type, these are both value_type - using element_t = typename detail::element_type::type; // Removes (smart) pointers if needed - using item_t = typename detail::pair_adaptor::first_type; // Is value_type if not a map + using element_t = typename detail::element_type::type; // Removes (smart) pointers if needed + using item_t = typename detail::pair_adaptor::first_type; // Is value_type if not a map - using local_item_t = typename IsMemberType::type; // This will convert bad types to good ones - // (const char * to std::string) + using local_item_t = typename IsMemberType::type; // This will convert bad types to good ones + // (const char * to std::string) // Make a local copy of the filter function, using a std::function if not one already std::function filter_fn = filter_function; @@ -2744,7 +2761,7 @@ class IsMember : public Validator { func_ = [set, filter_fn](std::string &input) { local_item_t b; if(!detail::lexical_cast(input, b)) { - throw ValidationError(input); // name is added later + throw ValidationError(input); // name is added later } if(filter_fn) { b = filter_fn(b); @@ -2800,10 +2817,10 @@ class Transformer : public Validator { "mapping must produce value pairs"); // Get the type of the contained item - requires a container have ::value_type // if the type does not have first_type and second_type, these are both value_type - using element_t = typename detail::element_type::type; // Removes (smart) pointers if needed - using item_t = typename detail::pair_adaptor::first_type; // Is value_type if not a map - using local_item_t = typename IsMemberType::type; // This will convert bad types to good ones - // (const char * to std::string) + using element_t = typename detail::element_type::type; // Removes (smart) pointers if needed + using item_t = typename detail::pair_adaptor::first_type; // Is value_type if not a map + using local_item_t = typename IsMemberType::type; // Will convert bad types to good ones + // (const char * to std::string) // Make a local copy of the filter function, using a std::function if not one already std::function filter_fn = filter_function; @@ -2858,12 +2875,11 @@ class CheckedTransformer : public Validator { "mapping must produce value pairs"); // Get the type of the contained item - requires a container have ::value_type // if the type does not have first_type and second_type, these are both value_type - using element_t = typename detail::element_type::type; // Removes (smart) pointers if needed - using item_t = typename detail::pair_adaptor::first_type; // Is value_type if not a map - using local_item_t = typename IsMemberType::type; // This will convert bad types to good ones - // (const char * to std::string) - using iteration_type_t = typename detail::pair_adaptor::value_type; // the type of the object pair // - // the type of the object pair + using element_t = typename detail::element_type::type; // Removes (smart) pointers if needed + using item_t = typename detail::pair_adaptor::first_type; // Is value_type if not a map + using local_item_t = typename IsMemberType::type; // Will convert bad types to good ones + // (const char * to std::string) + using iteration_type_t = typename detail::pair_adaptor::value_type; // the type of the object pair // Make a local copy of the filter function, using a std::function if not one already std::function filter_fn = filter_function; @@ -3071,7 +3087,7 @@ class AsNumberWithUnit : public Validator { /// "2 EiB" => 2^61 // Units up to exibyte are supported class AsSizeValue : public AsNumberWithUnit { public: - using result_t = uint64_t; + using result_t = std::uint64_t; /// If kb_is_1000 is true, /// interpret 'kb', 'k' as 1000 and 'kib', 'ki' as 1024 @@ -3147,12 +3163,12 @@ inline std::pair split_program_name(std::string comman return vals; } -} // namespace detail +} // namespace detail /// @} -} // namespace CLI +} // namespace CLI -// From CLI/FormatterFwd.hpp: +// From FormatterFwd.hpp: namespace CLI { @@ -3165,9 +3181,9 @@ class App; /// the second argument. enum class AppFormatMode { - Normal, //< The normal, detailed help - All, //< A fully expanded help - Sub, //< Used when printed as part of expanded subcommand + Normal, ///< The normal, detailed help + All, ///< A fully expanded help + Sub, ///< Used when printed as part of expanded subcommand }; /// This is the minimum requirements to run a formatter. @@ -3196,7 +3212,7 @@ class FormatterBase { FormatterBase(FormatterBase &&) = default; /// Adding a destructor in this form to work around bug in GCC 4.7 - virtual ~FormatterBase() noexcept {} // NOLINT(modernize-use-equals-default) + virtual ~FormatterBase() noexcept {} // NOLINT(modernize-use-equals-default) /// This is the key method that puts together help virtual std::string make_help(const App *, std::string, AppFormatMode) const = 0; @@ -3241,7 +3257,7 @@ class FormatterLambda final : public FormatterBase { explicit FormatterLambda(funct_t funct) : lambda_(std::move(funct)) {} /// Adding a destructor (mostly to make GCC 4.7 happy) - ~FormatterLambda() noexcept override {} // NOLINT(modernize-use-equals-default) + ~FormatterLambda() noexcept override {} // NOLINT(modernize-use-equals-default) /// This will simply call the lambda function std::string make_help(const App *app, std::string name, AppFormatMode mode) const override { @@ -3318,9 +3334,9 @@ class Formatter : public FormatterBase { ///@} }; -} // namespace CLI +} // namespace CLI -// From CLI/Option.hpp: +// From Option.hpp: namespace CLI { @@ -3334,11 +3350,11 @@ class App; using Option_p = std::unique_ptr