Chromium Code Reviews| Index: chrome/browser/common/ini_parser.h |
| diff --git a/chrome/browser/common/ini_parser.h b/chrome/browser/common/ini_parser.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..afa09275eaf47ccc9d7ec633785926e1553cc92b |
| --- /dev/null |
| +++ b/chrome/browser/common/ini_parser.h |
| @@ -0,0 +1,43 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_COMMON_INI_PARSER_H_ |
| +#define CHROME_BROWSER_COMMON_INI_PARSER_H_ |
| + |
| +#include <string> |
| + |
| +#include "base/values.h" |
| + |
| +// A simple class to parse INI files in a string. Users should inherit from this |
| +// class and override the HandlePair method. |
| +class INIParser { |
| + public: |
| + INIParser(); |
| + virtual ~INIParser(); |
| + |
| + // 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.
|
| + void Parse(const std::string& content); |
| + private: |
| + virtual void HandlePair(const std::string& section, const std::string& key, |
| + const std::string& value) = 0; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(INIParser); |
| +}; |
| + |
| +class DictionaryValueINIParser : public INIParser { |
| + public: |
| + DictionaryValueINIParser(); |
| + virtual ~DictionaryValueINIParser(); |
| + |
| + const DictionaryValue& root() const { return root_; } |
| + private: |
| + virtual void HandlePair(const std::string& section, const std::string& key, |
| + const std::string& value) OVERRIDE; |
| + |
| + DictionaryValue root_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(DictionaryValueINIParser); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_COMMON_INI_PARSER_H_ |