Lines Matching refs:std
81 toLocalString(std::string s)
83 return icu::UnicodeString::fromUTF8(std::move(s));
87 std::iterator<std::forward_iterator_tag, int32_t>
137 return s.append(std::move(a));
173 std::string
176 std::string result;
190 namespace std
212 typedef std::string String;
218 return std::forward<T>(t);
232 return s.append(std::move(a));
250 std::string
253 return std::forward<T>(t);
258 empty(const std::string& s)
272 const std::string LQUOTE("\'");
273 const std::string RQUOTE("\'");
275 const std::string LQUOTE("‘");
276 const std::string RQUOTE("’");
280 class Value : public std::enable_shared_from_this<Value>
287 std::shared_ptr<Value>
291 parse(const std::string& text) const = 0;
305 virtual std::string
308 virtual std::string
311 virtual std::shared_ptr<Value>
312 default_value(const std::string& value) = 0;
314 virtual std::shared_ptr<Value>
315 implicit_value(const std::string& value) = 0;
317 virtual std::shared_ptr<Value>
324 class OptionException : public std::exception
327 OptionException(const std::string& message)
339 std::string m_message;
346 OptionSpecException(const std::string& message)
355 OptionParseException(const std::string& message)
364 option_exists_error(const std::string& option)
373 invalid_option_format_error(const std::string& format)
381 option_syntax_exception(const std::string& text)
391 option_not_exists_exception(const std::string& option)
400 missing_argument_exception(const std::string& option)
411 option_requires_argument_exception(const std::string& option)
424 const std::string& option,
425 const std::string& arg
439 option_not_present_exception(const std::string& option)
450 const std::string& arg
462 option_required_exception(const std::string& option)
474 std::basic_regex<char> integer_pattern
476 std::basic_regex<char> truthy_pattern
478 std::basic_regex<char> falsy_pattern
492 operator()(bool negative, U u, const std::string& text)
496 if (u > static_cast<U>((std::numeric_limits<T>::min)()))
503 if (u > static_cast<U>((std::numeric_limits<T>::max)()))
516 operator()(bool, U, const std::string&) {}
521 check_signed_range(bool negative, U value, const std::string& text)
523 SignedCheck<T, std::numeric_limits<T>::is_signed>()(negative, value, text);
529 checked_negate(T&& t, const std::string&, std::true_type)
539 checked_negate(T&&, const std::string& text, std::false_type)
546 integer_parser(const std::string& text, T& value)
548 std::smatch match;
549 std::regex_match(text, match, integer_pattern);
562 using US = typename std::make_unsigned<T>::type;
564 constexpr bool is_signed = std::numeric_limits<T>::is_signed;
608 std::integral_constant<bool, is_signed>());
617 void stringstream_parser(const std::string& text, T& value)
619 std::stringstream in(text);
628 parse_value(const std::string& text, uint8_t& value)
635 parse_value(const std::string& text, int8_t& value)
642 parse_value(const std::string& text, uint16_t& value)
649 parse_value(const std::string& text, int16_t& value)
656 parse_value(const std::string& text, uint32_t& value)
663 parse_value(const std::string& text, int32_t& value)
670 parse_value(const std::string& text, uint64_t& value)
677 parse_value(const std::string& text, int64_t& value)
684 parse_value(const std::string& text, bool& value)
686 std::smatch result;
687 std::regex_match(text, result, truthy_pattern);
695 std::regex_match(text, result, falsy_pattern);
707 parse_value(const std::string& text, std::string& value)
717 parse_value(const std::string& text, T& value) {
723 parse_value(const std::string& text, std::vector<T>& value)
725 std::stringstream in(text);
726 std::string token;
727 while(in.eof() == false && std::getline(in, token, CXXOPTS_VECTOR_DELIMITER)) {
730 value.emplace_back(std::move(v));
737 parse_value(const std::string& text, std::optional<T>& value)
741 value = std::move(result);
752 struct type_is_container<std::vector<T>>
764 : m_result(std::make_shared<T>())
780 m_result = std::make_shared<T>();
795 parse(const std::string& text) const
824 std::shared_ptr<Value>
825 default_value(const std::string& value)
832 std::shared_ptr<Value>
833 implicit_value(const std::string& value)
840 std::shared_ptr<Value>
847 std::string
853 std::string
862 return std::is_same<T, bool>::value;
879 std::shared_ptr<T> m_result;
885 std::string m_default_value;
886 std::string m_implicit_value;
895 std::shared_ptr<Value>
898 return std::make_shared<standard_value<T>>(*this);
919 std::shared_ptr<Value>
922 return std::make_shared<standard_value<bool>>(*this);
939 std::shared_ptr<Value>
942 return std::make_shared<values::standard_value<T>>();
946 std::shared_ptr<Value>
949 return std::make_shared<values::standard_value<T>>(&t);
959 const std::string& short_,
960 const std::string& long_,
962 std::shared_ptr<const Value> val
991 std::shared_ptr<Value>
997 const std::string&
1003 const std::string&
1010 std::string m_short;
1011 std::string m_long;
1013 std::shared_ptr<const Value> m_value;
1019 std::string s;
1020 std::string l;
1023 std::string default_value;
1025 std::string implicit_value;
1026 std::string arg_help;
1033 std::string name;
1034 std::string description;
1035 std::vector<HelpOptionDetails> options;
1044 std::shared_ptr<const OptionDetails> details,
1045 const std::string& text
1054 parse_default(std::shared_ptr<const OptionDetails> details)
1079 throw std::domain_error("No value");
1091 ensure_value(std::shared_ptr<const OptionDetails> details)
1099 std::shared_ptr<Value> m_value;
1107 KeyValue(std::string key_, std::string value_)
1108 : m_key(std::move(key_))
1109 , m_value(std::move(value_))
1114 std::string&
1121 std::string&
1137 std::string m_key;
1138 std::string m_value;
1146 const std::shared_ptr<
1147 std::unordered_map<std::string, std::shared_ptr<OptionDetails>>
1149 std::vector<std::string>,
1154 count(const std::string& o) const
1168 operator[](const std::string& option) const
1182 const std::vector<KeyValue>&
1194 add_to_option(const std::string& option, const std::string& arg);
1197 consume_positional(std::string a);
1202 std::shared_ptr<OptionDetails> value,
1203 const std::string& name,
1204 const std::string& arg = ""
1208 parse_default(std::shared_ptr<OptionDetails> details);
1216 std::shared_ptr<OptionDetails> value,
1217 const std::string& name
1220 const std::shared_ptr<
1221 std::unordered_map<std::string, std::shared_ptr<OptionDetails>>
1223 std::vector<std::string> m_positional;
1224 std::vector<std::string>::iterator m_next_positional;
1225 std::unordered_set<std::string> m_positional_set;
1226 std::unordered_map<std::shared_ptr<OptionDetails>, OptionValue> m_results;
1230 std::vector<KeyValue> m_sequential;
1235 typedef std::unordered_map<std::string, std::shared_ptr<OptionDetails>>
1239 Options(std::string program, std::string help_string = "")
1240 : m_program(std::move(program))
1241 , m_help_string(toLocalString(std::move(help_string)))
1246 , m_options(std::make_shared<OptionMap>())
1252 positional_help(std::string help_text)
1254 m_positional_help = std::move(help_text);
1259 custom_help(std::string help_text)
1261 m_custom_help = std::move(help_text);
1283 add_options(std::string group = "");
1288 const std::string& group,
1289 const std::string& s,
1290 const std::string& l,
1291 std::string desc,
1292 std::shared_ptr<const Value> value,
1293 std::string arg_help
1298 parse_positional(std::string option);
1301 parse_positional(std::vector<std::string> options);
1304 parse_positional(std::initializer_list<std::string> options);
1309 parse_positional(std::vector<std::string>{begin, end});
1312 std::string
1313 help(const std::vector<std::string>& groups = {}) const;
1315 const std::vector<std::string>
1319 group_help(const std::string& group) const;
1326 const std::string& option,
1327 std::shared_ptr<OptionDetails> details
1331 help_one_group(const std::string& group) const;
1337 const std::vector<std::string>& groups
1343 std::string m_program;
1345 std::string m_custom_help;
1346 std::string m_positional_help;
1350 std::shared_ptr<OptionMap> m_options;
1351 std::vector<std::string> m_positional;
1352 std::vector<std::string>::iterator m_next_positional;
1353 std::unordered_set<std::string> m_positional_set;
1356 std::map<std::string, HelpGroupDetails> m_help;
1363 OptionAdder(Options& options, std::string group)
1364 : m_options(options), m_group(std::move(group))
1371 const std::string& opts,
1372 const std::string& desc,
1373 std::shared_ptr<const Value> value
1375 std::string arg_help = ""
1380 std::string m_group;
1388 std::basic_regex<char> option_matcher
1391 std::basic_regex<char> option_specifier
1453 auto current = std::begin(desc);
1459 while (current != std::end(desc))
1509 const std::shared_ptr<
1510 std::unordered_map<std::string, std::shared_ptr<OptionDetails>>
1512 std::vector<std::string> positional,
1517 , m_positional(std::move(positional))
1526 Options::add_options(std::string group)
1528 return OptionAdder(*this, std::move(group));
1535 const std::string& opts,
1536 const std::string& desc,
1537 std::shared_ptr<const Value> value,
1538 std::string arg_help
1541 std::match_results<const char*> result;
1542 std::regex_match(opts.c_str(), result, option_specifier);
1562 const std::sub_match<const char*>& short_,
1563 const std::sub_match<const char*>& long_
1568 return std::make_tuple(long_.str(), short_.str());
1572 return std::make_tuple(short_.str(), long_.str());
1579 std::get<0>(option_names),
1580 std::get<1>(option_names),
1583 std::move(arg_help)
1591 ParseResult::parse_default(std::shared_ptr<OptionDetails> details)
1600 std::shared_ptr<OptionDetails> value,
1601 const std::string& /*name*/,
1602 const std::string& arg
1618 std::shared_ptr<OptionDetails> value,
1619 const std::string& name
1649 ParseResult::add_to_option(const std::string& option, const std::string& arg)
1663 ParseResult::consume_positional(std::string a)
1702 Options::parse_positional(std::string option)
1704 parse_positional(std::vector<std::string>{std::move(option)});
1709 Options::parse_positional(std::vector<std::string> options)
1711 m_positional = std::move(options);
1719 Options::parse_positional(std::initializer_list<std::string> options)
1721 parse_positional(std::vector<std::string>(std::move(options)));
1751 std::match_results<const char*> result;
1752 std::regex_match(argv[current], result, option_matcher);
1782 const std::string& s = result[4];
1784 for (std::size_t i = 0; i != s.size(); ++i)
1786 std::string name(1, s[i]);
1822 const std::string& name = result[1];
1902 const std::string& group,
1903 const std::string& s,
1904 const std::string& l,
1905 std::string desc,
1906 std::shared_ptr<const Value> value,
1907 std::string arg_help
1910 auto stringDesc = toLocalString(std::move(desc));
1911 auto option = std::make_shared<OptionDetails>(s, l, stringDesc, value);
1929 std::move(arg_help),
1938 const std::string& option,
1939 std::shared_ptr<OptionDetails> details
1952 Options::help_one_group(const std::string& g) const
1954 typedef std::vector<std::pair<String, String>> OptionHelp;
1982 longest = (std::max)(longest, stringLength(s));
1983 format.push_back(std::make_pair(s, String()));
1986 longest = (std::min)(longest, static_cast<size_t>(OPTION_LONGEST));
2006 result += toLocalString(std::string(longest + OPTION_DESC_GAP, ' '));
2010 result += toLocalString(std::string(longest + OPTION_DESC_GAP -
2028 const std::vector<std::string>& print_groups
2050 std::vector<std::string> all_groups;
2062 std::string
2063 Options::help(const std::vector<std::string>& help_groups) const
2087 const std::vector<std::string>
2090 std::vector<std::string> g;
2092 std::transform(
2095 std::back_inserter(g),
2096 [] (const std::map<std::string, HelpGroupDetails>::value_type& pair)
2107 Options::group_help(const std::string& group) const