Lines Matching refs:string
51 #include <string.h> // for strlen
54 #include <string>
64 using std::string;
92 const string &cursor_word,
93 string *canonical_search_token,
96 static bool RemoveTrailingChar(string *str, char c);
103 const string &match_token,
105 string *longest_common_prefix);
110 const string &match_token);
116 const string &search_token,
117 const string &module,
118 const string &package_dir,
123 string *module,
124 string *package_dir);
132 vector<string> *completions);
143 const string &line_indentation,
144 const string &header,
145 const string &footer,
149 vector<string> *completions);
152 static string GetShortFlagLine(
153 const string &line_indentation,
156 static string GetLongFlagLine(
157 const string &line_indentation,
203 string cursor_word = FLAGS_tab_completion_word;
204 string canonical_token;
218 string longest_common_prefix;
242 string module;
243 string package_dir;
262 vector<string> completions;
275 for (vector<string>::const_iterator it = completions.begin();
286 const string &cursor_word,
287 string *canonical_search_token,
334 static bool RemoveTrailingChar(string *str, char c) {
348 const string &match_token,
350 string *longest_common_prefix) {
366 string::size_type pos = 0;
383 const string &match_token) {
385 string::size_type pos = flag.name.find(match_token);
390 pos != string::npos)
395 flag.filename.find(match_token) != string::npos)
401 flag.description.find(match_token) != string::npos)
413 const string &search_token,
414 const string &module, // empty if we couldn't find any
415 const string &package_dir, // empty if we couldn't find any
429 string::size_type pos = string::npos;
432 string::size_type slash = string::npos;
433 if (pos != string::npos) // candidate for package or subpackage match
447 pos != string::npos && slash == string::npos) {
456 pos != string::npos && slash != string::npos) {
466 static void PushNameWithSuffix(vector<string>* suffixes, const char* suffix) {
473 string *module,
474 string *package_dir) {
478 vector<string> suffixes;
495 for (vector<string>::const_iterator suffix = suffixes.begin();
498 // TODO(user): Make sure the match is near the end of the string
499 if (it->filename.find(*suffix) != string::npos) {
501 string::size_type sep = it->filename.rfind(PATH_SEPARATOR);
502 *package_dir = it->filename.substr(0, (sep == string::npos) ? 0 : sep);
532 vector<string> *completions) {
619 string(indent, ' '), // line indentation
620 string(it->header), // header
621 string(it->footer), // footer
661 const string &line_indentation,
662 const string &header,
663 const string &footer,
667 vector<string> *completions) {
673 completions->push_back(line_indentation + string(header.size(), '-'));
692 static string GetShortFlagLine(
693 const string &line_indentation,
695 string prefix;
696 bool is_string = (info.type == "string");
705 string suffix;
714 static string GetLongFlagLine(
715 const string &line_indentation,
718 string output = DescribeOneFlag(info);
722 string old_flagname = "-" + info.name;
730 output.replace(output.find(" type:"), 1, string(kNewlineWithIndent));
731 output.replace(output.find(" default:"), 1, string(kNewlineWithIndent));
742 static const string line_of_spaces(FLAGS_tab_completion_columns, ' ');
744 for (string::size_type newlines = output.find(kDoubledNewlines);
745 newlines != string::npos;
748 output.replace(newlines, sizeof(kDoubledNewlines) - 1, string("\n"));
750 for (string::size_type newline = output.find('\n');
751 newline != string::npos;