Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(275)

Side by Side Diff: base/string_tokenizer.h

Issue 21045: Making parameter to set_quote_chars in string_tokenizer.h a template parameter. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_STRING_TOKENIZER_H_ 5 #ifndef BASE_STRING_TOKENIZER_H_
6 #define BASE_STRING_TOKENIZER_H_ 6 #define BASE_STRING_TOKENIZER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 // StringTokenizerT is a simple string tokenizer class. It works like an 10 // StringTokenizerT is a simple string tokenizer class. It works like an
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 } 97 }
98 98
99 // Set the options for this tokenizer. By default, this is 0. 99 // Set the options for this tokenizer. By default, this is 0.
100 void set_options(int options) { options_ = options; } 100 void set_options(int options) { options_ = options; }
101 101
102 // Set the characters to regard as quotes. By default, this is empty. When 102 // Set the characters to regard as quotes. By default, this is empty. When
103 // a quote char is encountered, the tokenizer will switch into a mode where 103 // a quote char is encountered, the tokenizer will switch into a mode where
104 // it ignores delimiters that it finds. It switches out of this mode once it 104 // it ignores delimiters that it finds. It switches out of this mode once it
105 // finds another instance of the quote char. If a backslash is encountered 105 // finds another instance of the quote char. If a backslash is encountered
106 // within a quoted string, then the next character is skipped. 106 // within a quoted string, then the next character is skipped.
107 void set_quote_chars(const std::string& quotes) { quotes_ = quotes; } 107 void set_quote_chars(const str& quotes) { quotes_ = quotes; }
108 108
109 // Call this method to advance the tokenizer to the next delimiter. This 109 // Call this method to advance the tokenizer to the next delimiter. This
110 // returns false if the tokenizer is complete. This method must be called 110 // returns false if the tokenizer is complete. This method must be called
111 // before calling any of the token* methods. 111 // before calling any of the token* methods.
112 bool GetNext() { 112 bool GetNext() {
113 AdvanceState state; 113 AdvanceState state;
114 token_is_delim_ = false; 114 token_is_delim_ = false;
115 for (;;) { 115 for (;;) {
116 token_begin_ = token_end_; 116 token_begin_ = token_end_;
117 if (token_end_ == end_) 117 if (token_end_ == end_)
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 }; 194 };
195 195
196 typedef StringTokenizerT<std::string, std::string::const_iterator> 196 typedef StringTokenizerT<std::string, std::string::const_iterator>
197 StringTokenizer; 197 StringTokenizer;
198 typedef StringTokenizerT<std::wstring, std::wstring::const_iterator> 198 typedef StringTokenizerT<std::wstring, std::wstring::const_iterator>
199 WStringTokenizer; 199 WStringTokenizer;
200 typedef StringTokenizerT<std::string, const char*> CStringTokenizer; 200 typedef StringTokenizerT<std::string, const char*> CStringTokenizer;
201 201
202 #endif // BASE_STRING_TOKENIZER_H_ 202 #endif // BASE_STRING_TOKENIZER_H_
203 203
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698