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

Side by Side Diff: chrome/common/ini_parser.cc

Issue 453703002: Move ini_parser from base to chrome/common (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: base:: Created 6 years, 4 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 | « chrome/common/ini_parser.h ('k') | chrome/common/ini_parser_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "base/ini_parser.h" 5 #include "chrome/common/ini_parser.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_tokenizer.h" 8 #include "base/strings/string_tokenizer.h"
9 9
10 namespace base {
11
12 INIParser::INIParser() : used_(false) {} 10 INIParser::INIParser() : used_(false) {}
13 11
14 INIParser::~INIParser() {} 12 INIParser::~INIParser() {}
15 13
16 void INIParser::Parse(const std::string& content) { 14 void INIParser::Parse(const std::string& content) {
17 DCHECK(!used_); 15 DCHECK(!used_);
18 used_ = true; 16 used_ = true;
19 base::StringTokenizer tokenizer(content, "\r\n"); 17 base::StringTokenizer tokenizer(content, "\r\n");
20 18
21 std::string current_section; 19 std::string current_section;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 const std::string& key, 53 const std::string& key,
56 const std::string& value) { 54 const std::string& value) {
57 55
58 // Checks whether the section and key contain a '.' character. 56 // Checks whether the section and key contain a '.' character.
59 // Those sections and keys break DictionaryValue's path format when not 57 // Those sections and keys break DictionaryValue's path format when not
60 // using the *WithoutPathExpansion methods. 58 // using the *WithoutPathExpansion methods.
61 if (section.find('.') == std::string::npos && 59 if (section.find('.') == std::string::npos &&
62 key.find('.') == std::string::npos) 60 key.find('.') == std::string::npos)
63 root_.SetString(section + "." + key, value); 61 root_.SetString(section + "." + key, value);
64 } 62 }
65
66 } // namespace base
OLDNEW
« no previous file with comments | « chrome/common/ini_parser.h ('k') | chrome/common/ini_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698