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 BASE_INI_PARSER_H_ | |
| 6 #define BASE_INI_PARSER_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/base_export.h" | |
| 11 #include "base/values.h" | |
| 12 | |
| 13 namespace base { | |
| 14 | |
| 15 // A simple class to parse INI files in a string. Users should inherit from this | |
|
Mark Mentovai
2013/06/17 18:52:37
Is there a textual reference to the ini format som
tommycli
2013/06/17 19:49:24
Done.
erikwright (departed)
2013/06/17 20:30:47
Use the descriptive in the opening sentence.
// P
tommycli
2013/06/17 21:23:25
Done.
| |
| 16 // class and override the HandlePair method. | |
| 17 class BASE_EXPORT INIParser { | |
| 18 public: | |
| 19 INIParser(); | |
| 20 virtual ~INIParser(); | |
| 21 | |
| 22 void Parse(const std::string& content); | |
|
erikwright (departed)
2013/06/17 20:30:47
Is it correct to call this method more than once?
tommycli
2013/06/17 21:23:25
Yes, it's correct to call multiple times. I added
erikwright (departed)
2013/06/18 00:56:14
The benefit is that it's a stateless class. It doe
tommycli
2013/06/18 16:29:47
Well in some cases, such as the DictionaryValue bu
| |
| 23 private: | |
|
Mark Mentovai
2013/06/17 18:52:37
Blank line before this one to break up the section
tommycli
2013/06/17 19:49:24
Done.
erikwright (departed)
2013/06/17 20:30:47
NL before private: here and below.
tommycli
2013/06/17 21:23:25
Done.
| |
| 24 virtual void HandlePair(const std::string& section, const std::string& key, | |
|
Mark Mentovai
2013/06/17 18:52:37
This method is misnamed. It’s not really handling
tommycli
2013/06/17 19:49:24
Done.
erikwright (departed)
2013/06/17 20:30:47
nit, styleguide would have each on its own line if
tommycli
2013/06/17 21:23:25
Done.
| |
| 25 const std::string& value) = 0; | |
| 26 | |
| 27 DISALLOW_COPY_AND_ASSIGN(INIParser); | |
|
Mark Mentovai
2013/06/17 18:52:37
Include What You Use: #include "base/basictypes.h"
tommycli
2013/06/17 19:49:24
Done.
erikwright (departed)
2013/06/17 20:30:47
Not required for this abstract class.
tommycli
2013/06/17 21:23:25
Done.
| |
| 28 }; | |
| 29 | |
| 30 class BASE_EXPORT DictionaryValueINIParser : public INIParser { | |
|
erikwright (departed)
2013/06/17 20:30:47
Add a class comment. It should, at a minimum, expl
erikwright (departed)
2013/06/17 20:30:47
Will your new client of this code use INIParser di
tommycli
2013/06/17 21:23:25
Done.
tommycli
2013/06/17 21:23:25
Will use INIParser directly.
| |
| 31 public: | |
| 32 DictionaryValueINIParser(); | |
| 33 virtual ~DictionaryValueINIParser(); | |
| 34 | |
| 35 const DictionaryValue& root() const { return root_; } | |
| 36 private: | |
| 37 virtual void HandlePair(const std::string& section, const std::string& key, | |
|
erikwright (departed)
2013/06/17 20:30:47
Add a comment:
// INIParser implementation.
tommycli
2013/06/17 21:23:25
Done.
| |
| 38 const std::string& value) OVERRIDE; | |
| 39 | |
| 40 DictionaryValue root_; | |
| 41 | |
| 42 DISALLOW_COPY_AND_ASSIGN(DictionaryValueINIParser); | |
| 43 }; | |
| 44 | |
| 45 } // namespace base | |
| 46 | |
| 47 #endif // BASE_INI_PARSER_H_ | |
| OLD | NEW |