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

Unified Diff: chrome/browser/common/ini_parser.h

Issue 16982004: Move Firefox importer's INI parser to c/browser/common. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
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.
+ 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_
« no previous file with comments | « no previous file | chrome/browser/common/ini_parser.cc » ('j') | chrome/browser/importer/firefox_importer_utils.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698