| OLD | NEW |
| 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 Loading... |
| 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 | |
| OLD | NEW |