Lines Matching refs:std
42 dest_type& string_to(std::string const& s, dest_type& result) { in string_to()
43 std::stringstream stream(s); in string_to()
46 throw std::invalid_argument("error converting string '" + std::string(s) + "'"); in string_to()
52 dest_type string_to(std::string const& s) { in string_to()
74 const std::string name;
75 const std::string description;
77 type_base(std::string a_name, std::string a_description) in type_base()
80 virtual void parse_and_store(const std::string& s) = 0;
81 virtual std::string value() const = 0;
82 virtual std::unique_ptr<type_base> clone() const = 0;
98 type_impl(std::string a_name, in type_impl()
99 std::string a_description, in type_impl()
105 void parse_and_store(const std::string& s) /*override*/ { in parse_and_store()
118 catch (std::invalid_argument& e) { in parse_and_store()
119 std::stringstream str; in parse_and_store()
122 throw std::invalid_argument(str.str()); in parse_and_store()
126 std::stringstream str; in parse_and_store()
128 throw std::invalid_argument(str.str()); in parse_and_store()
139 std::string value() const /*override*/ { in value()
140 std::stringstream str; in value()
145 std::unique_ptr<type_base> clone() const /*override*/ { in clone()
146 return std::unique_ptr<type_base>(new type_impl(*this)); in clone()
152 std::unique_ptr<type_base> p_type;
164 std::swap(p_type, other.p_type); in swap()
165 std::swap(matched_, other.matched_); in swap()
168 argument(std::string a_name, in argument()
169 std::string a_description, in argument()
174 std::string value() const { in value()
177 std::string name() const { in name()
180 std::string description() const { in description()
183 void parse_and_store(const std::string& s) { in parse_and_store()
194 typedef std::map<std::string, internal::argument> args_map_type;
195 typedef std::vector<std::string> args_display_order_type;
196 typedef std::vector<std::string> positional_arg_names_type;
202 std::set<std::string> bool_args_names;
206 std::pair<args_map_type::iterator, bool> result = in add_arg()
207 args_map.insert(std::make_pair(a.name(), a)); in add_arg()
209 throw std::invalid_argument("argument with name: '" + a.name() + in add_arg()
218 std::string const& name, in arg()
219 std::string const& description, in arg()
233 std::string const& name, in positional_arg()
234 std::string const& description, in positional_arg()
245 void parse(std::size_t argc, char const* argv[]) { in parse()
247 std::size_t current_positional_index = 0; in parse()
248 for (std::size_t j = 1; j < argc; j++) { in parse()
250 std::string argument_value; in parse()
253 const char* const end = begin + std::strlen(argv[j]); in parse()
255 const char* const assign_sign = std::find(begin, end, '='); in parse()
258 static void _(std::string const& location) { in parse()
259 throw std::invalid_argument(std::string("unknown parameter starting at:'") + in parse()
265 std::string name_found = std::string(begin, assign_sign); in parse()
270 argument_value = std::string(assign_sign + 1, end); in parse()
285 std::stringstream str(argv[j]); in parse()
294 throw std::logic_error( in parse()
309 throw std::invalid_argument(std::string("several values specified for: '") + in parse()
316 std::string usage_string(const std::string& binary_name) const { in usage_string()
317 std::string command_line_params; in usage_string()
318 std::string summary_description; in usage_string()
329 throw std::logic_error("args_display_order and args_map are out of sync"); in usage_string()
337 std::string positional_arg_cl; in usage_string()
343 for (std::size_t i = 0; i < positional_arg_names.size(); ++i) { in usage_string()
347 std::stringstream str; in usage_string()
362 std::size_t intval = std::size_t(val); in is_power_of_2()
363 return (intval & (intval - 1)) == std::size_t(0); in is_power_of_2()
414 template <typename T, std::size_t N>
415 inline std::size_t array_length(const T (&)[N]) { in array_length()
427 throw std::invalid_argument( in thread_range_step()
436 friend std::istream& operator>>(std::istream& input_stream, thread_range_step& step) { in operator >>()
440 std::size_t i = 0; in operator >>()
445 throw std::invalid_argument("unknown step function mnemonic: " + in operator >>()
446 std::string(1, function_char)); in operator >>()
449 throw std::invalid_argument("the argument of # should be a power of 2"); in operator >>()
477 throw std::invalid_argument("negative value not allowed"); in thread_number_range()
480 throw std::invalid_argument("decreasing sequence not allowed"); in thread_number_range()
483 friend std::istream& operator>>(std::istream& i, thread_number_range& range) { in operator >>()
485 std::string s; in operator >>()
490 int operator()(const std::string& value) const { in operator >>()
496 std::size_t colon = s.find(':'); in operator >>()
497 if (colon == std::string::npos) { in operator >>()
502 std::size_t second_colon = s.find(':', colon + 1); in operator >>()
504 low = string_to_number_of_threads(std::string(s, 0, colon)); //not copying the colon in operator >>()
506 std::string(s, colon + 1, second_colon - (colon + 1))); //not copying the colons in operator >>()
507 if (second_colon != std::string::npos) { in operator >>()
508 internal::string_to(std::string(s, second_colon + 1), range.step); in operator >>()
513 catch (std::invalid_argument&) { in operator >>()
514 i.setstate(std::ios::failbit); in operator >>()
519 friend std::ostream& operator<<(std::ostream& o, thread_number_range const& range) { in operator <<()
521 std::size_t i = 0; in operator <<()
527 throw std::invalid_argument("unknown step function for thread range"); in operator <<()
541 std::cout << "elapsed time : " << seconds << " seconds" in report_elapsed_time()
546 std::cout << "skip" in report_skipped()
558 catch (std::exception& e) { in parse_cli_arguments()
559 std::cerr << "error occurred while parsing command line." in parse_cli_arguments()
562 << std::flush; in parse_cli_arguments()
566 std::cout << cli_pack.usage_string(argv[0]) << std::flush; in parse_cli_arguments()
567 std::exit(0); in parse_cli_arguments()