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

Side by Side Diff: base/string_tokenizer.h

Issue 7219008: Coverity Fixlet: UNINIT_CTOR (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Revert trace_event changes (CID=16864) Created 9 years, 6 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #pragma once 7 #pragma once
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <string> 10 #include <string>
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 } 210 }
211 211
212 bool IsQuote(char_type c) const { 212 bool IsQuote(char_type c) const {
213 return quotes_.find(c) != str::npos; 213 return quotes_.find(c) != str::npos;
214 } 214 }
215 215
216 struct AdvanceState { 216 struct AdvanceState {
217 bool in_quote; 217 bool in_quote;
218 bool in_escape; 218 bool in_escape;
219 char_type quote_char; 219 char_type quote_char;
220 AdvanceState() : in_quote(false), in_escape(false) {} 220 AdvanceState() : in_quote(false), in_escape(false), quote_char('\0') {}
221 }; 221 };
222 222
223 // Returns true if a delimiter was not hit. 223 // Returns true if a delimiter was not hit.
224 bool AdvanceOne(AdvanceState* state, char_type c) { 224 bool AdvanceOne(AdvanceState* state, char_type c) {
225 if (state->in_quote) { 225 if (state->in_quote) {
226 if (state->in_escape) { 226 if (state->in_escape) {
227 state->in_escape = false; 227 state->in_escape = false;
228 } else if (c == '\\') { 228 } else if (c == '\\') {
229 state->in_escape = true; 229 state->in_escape = true;
230 } else if (c == state->quote_char) { 230 } else if (c == state->quote_char) {
(...skipping 17 matching lines...) Expand all
248 bool token_is_delim_; 248 bool token_is_delim_;
249 }; 249 };
250 250
251 typedef StringTokenizerT<std::string, std::string::const_iterator> 251 typedef StringTokenizerT<std::string, std::string::const_iterator>
252 StringTokenizer; 252 StringTokenizer;
253 typedef StringTokenizerT<std::wstring, std::wstring::const_iterator> 253 typedef StringTokenizerT<std::wstring, std::wstring::const_iterator>
254 WStringTokenizer; 254 WStringTokenizer;
255 typedef StringTokenizerT<std::string, const char*> CStringTokenizer; 255 typedef StringTokenizerT<std::string, const char*> CStringTokenizer;
256 256
257 #endif // BASE_STRING_TOKENIZER_H_ 257 #endif // BASE_STRING_TOKENIZER_H_
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