Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_COMMON_INI_PARSER_H_ | |
| 6 #define CHROME_BROWSER_COMMON_INI_PARSER_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/values.h" | |
| 11 | |
| 12 // A simple class to parse INI files in a string. Users should inherit from this | |
| 13 // class and override the HandlePair method. | |
| 14 class INIParser { | |
| 15 public: | |
| 16 INIParser(); | |
| 17 virtual ~INIParser(); | |
| 18 | |
| 19 // Pass by value because we will be sanitizing the string before parsing. | |
|
vandebo (ex-Chrome)
2013/06/17 15:00:48
This comment doesn't match the code. If you want
tommycli
2013/06/17 18:01:56
Done. Out of date comment.
| |
| 20 void Parse(const std::string& content); | |
| 21 private: | |
| 22 virtual void HandlePair(const std::string& section, const std::string& key, | |
| 23 const std::string& value) = 0; | |
| 24 | |
| 25 DISALLOW_COPY_AND_ASSIGN(INIParser); | |
| 26 }; | |
| 27 | |
| 28 class DictionaryValueINIParser : public INIParser { | |
| 29 public: | |
| 30 DictionaryValueINIParser(); | |
| 31 virtual ~DictionaryValueINIParser(); | |
| 32 | |
| 33 const DictionaryValue& root() const { return root_; } | |
| 34 private: | |
| 35 virtual void HandlePair(const std::string& section, const std::string& key, | |
| 36 const std::string& value) OVERRIDE; | |
| 37 | |
| 38 DictionaryValue root_; | |
| 39 | |
| 40 DISALLOW_COPY_AND_ASSIGN(DictionaryValueINIParser); | |
| 41 }; | |
| 42 | |
| 43 #endif // CHROME_BROWSER_COMMON_INI_PARSER_H_ | |
| OLD | NEW |