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 BASE_PREFS_PREF_VALUE_MAP_H_ | 5 #ifndef BASE_PREFS_PREF_VALUE_MAP_H_ |
6 #define BASE_PREFS_PREF_VALUE_MAP_H_ | 6 #define BASE_PREFS_PREF_VALUE_MAP_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // Sets the value for |key| to the string |value|. | 64 // Sets the value for |key| to the string |value|. |
65 void SetString(const std::string& key, const std::string& value); | 65 void SetString(const std::string& key, const std::string& value); |
66 | 66 |
67 // Gets an int value for |key| and stores it in |value|. Returns true if | 67 // Gets an int value for |key| and stores it in |value|. Returns true if |
68 // the value was found and of the proper type. | 68 // the value was found and of the proper type. |
69 bool GetInteger(const std::string& key, int* value) const; | 69 bool GetInteger(const std::string& key, int* value) const; |
70 | 70 |
71 // Sets the value for |key| to the int |value|. | 71 // Sets the value for |key| to the int |value|. |
72 void SetInteger(const std::string& key, const int value); | 72 void SetInteger(const std::string& key, const int value); |
73 | 73 |
| 74 // Sets the value for |key| to the double |value|. |
| 75 void SetDouble(const std::string& key, const double value); |
| 76 |
74 // Compares this value map against |other| and stores all key names that have | 77 // Compares this value map against |other| and stores all key names that have |
75 // different values in |differing_keys|. This includes keys that are present | 78 // different values in |differing_keys|. This includes keys that are present |
76 // only in one of the maps. | 79 // only in one of the maps. |
77 void GetDifferingKeys(const PrefValueMap* other, | 80 void GetDifferingKeys(const PrefValueMap* other, |
78 std::vector<std::string>* differing_keys) const; | 81 std::vector<std::string>* differing_keys) const; |
79 | 82 |
80 private: | 83 private: |
81 typedef std::map<std::string, base::Value*> Map; | 84 typedef std::map<std::string, base::Value*> Map; |
82 | 85 |
83 Map prefs_; | 86 Map prefs_; |
84 | 87 |
85 DISALLOW_COPY_AND_ASSIGN(PrefValueMap); | 88 DISALLOW_COPY_AND_ASSIGN(PrefValueMap); |
86 }; | 89 }; |
87 | 90 |
88 #endif // BASE_PREFS_PREF_VALUE_MAP_H_ | 91 #endif // BASE_PREFS_PREF_VALUE_MAP_H_ |
OLD | NEW |