41 size_t cmd_len = strlen(this->command_text());
42 const char *base, *ptr;
45 assert(!strncmp(line, command_text(), cmd_len));
56 while (*ptr && isspace(*ptr))
62 if (!parse_string_literal(ptr, key, &ptr))
69 key = string(base, ptr-base);
72 if (!parse_string_literal(base, value, &ptr))
77 for (ptr = base; *ptr && !isspace(*ptr); ptr++)
79 value = string(base, ptr-base);
83 else if (*ptr == 0 || isspace(*ptr)) {
84 key = string(base, ptr-base);
90 m_args.push_back(pair<string, string>(key, value));
97 const char **endptr) {
99 const char *ptr, *base;
105 for (ptr = base; *ptr; ++ptr) {
106 if (*ptr ==
'\"' && lastchar !=
'\\')
112 cerr <<
"Un-terminated string literal." << endl;
116 text = string(base, ptr-base);
Helper class for printing usage banners on the command line.
bool parse_string_literal(const char *str, std::string &text, const char **endptr)
Helper function to parse a string literal.
Po::typed_value< String > * str(String *v=0)
Base class for interactive shell commands.
Compatibility Macros for C/C++.
void parse_command_line(const char *line)
Parses a command line and stores the arguments in m_args.