| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_PREFS_PREF_VALUE_MAP_H_ | 5 #ifndef CHROME_BROWSER_PREFS_PREF_VALUE_MAP_H_ |
| 6 #define CHROME_BROWSER_PREFS_PREF_VALUE_MAP_H_ | 6 #define CHROME_BROWSER_PREFS_PREF_VALUE_MAP_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 iterator begin(); | 45 iterator begin(); |
| 46 iterator end(); | 46 iterator end(); |
| 47 const_iterator begin() const; | 47 const_iterator begin() const; |
| 48 const_iterator end() const; | 48 const_iterator end() const; |
| 49 | 49 |
| 50 // Gets a boolean value for |key| and stores it in |value|. Returns true if | 50 // Gets a boolean value for |key| and stores it in |value|. Returns true if |
| 51 // the value was found and of the proper type. | 51 // the value was found and of the proper type. |
| 52 bool GetBoolean(const std::string& key, bool* value) const; | 52 bool GetBoolean(const std::string& key, bool* value) const; |
| 53 | 53 |
| 54 // Sets the value for |key| to the boolean |value|. |
| 55 void SetBoolean(const std::string& key, bool value); |
| 56 |
| 54 // Gets a string value for |key| and stores it in |value|. Returns true if | 57 // Gets a string value for |key| and stores it in |value|. Returns true if |
| 55 // the value was found and of the proper type. | 58 // the value was found and of the proper type. |
| 56 bool GetString(const std::string& key, std::string* value) const; | 59 bool GetString(const std::string& key, std::string* value) const; |
| 57 | 60 |
| 58 // Sets the value for |key| to the string |value|. | 61 // Sets the value for |key| to the string |value|. |
| 59 void SetString(const std::string& key, const std::string& value); | 62 void SetString(const std::string& key, const std::string& value); |
| 60 | 63 |
| 61 // Gets an int value for |key| and stores it in |value|. Returns true if | 64 // Gets an int value for |key| and stores it in |value|. Returns true if |
| 62 // the value was found and of the proper type. | 65 // the value was found and of the proper type. |
| 63 bool GetInteger(const std::string& key, int* value) const; | 66 bool GetInteger(const std::string& key, int* value) const; |
| 64 | 67 |
| 65 // Sets the value for |key| to the int |value|. | 68 // Sets the value for |key| to the int |value|. |
| 66 void SetInteger(const std::string& key, const int value); | 69 void SetInteger(const std::string& key, const int value); |
| 67 | 70 |
| 68 // Compares this value map against |other| and stores all key names that have | 71 // Compares this value map against |other| and stores all key names that have |
| 69 // different values in |differing_keys|. This includes keys that are present | 72 // different values in |differing_keys|. This includes keys that are present |
| 70 // only in one of the maps. | 73 // only in one of the maps. |
| 71 void GetDifferingKeys(const PrefValueMap* other, | 74 void GetDifferingKeys(const PrefValueMap* other, |
| 72 std::vector<std::string>* differing_keys) const; | 75 std::vector<std::string>* differing_keys) const; |
| 73 | 76 |
| 74 private: | 77 private: |
| 75 typedef std::map<std::string, base::Value*> Map; | 78 typedef std::map<std::string, base::Value*> Map; |
| 76 | 79 |
| 77 Map prefs_; | 80 Map prefs_; |
| 78 | 81 |
| 79 DISALLOW_COPY_AND_ASSIGN(PrefValueMap); | 82 DISALLOW_COPY_AND_ASSIGN(PrefValueMap); |
| 80 }; | 83 }; |
| 81 | 84 |
| 82 #endif // CHROME_BROWSER_PREFS_PREF_VALUE_MAP_H_ | 85 #endif // CHROME_BROWSER_PREFS_PREF_VALUE_MAP_H_ |
| OLD | NEW |