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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // Gets a string value for |key| and stores it in |value|. Returns true if | 54 // Gets a string value for |key| and stores it in |value|. Returns true if |
55 // the value was found and of the proper type. | 55 // the value was found and of the proper type. |
56 bool GetString(const std::string& key, std::string* value) const; | 56 bool GetString(const std::string& key, std::string* value) const; |
57 | 57 |
58 // Sets the value for |key| to the string |value|. | 58 // Sets the value for |key| to the string |value|. |
59 void SetString(const std::string& key, const std::string& value); | 59 void SetString(const std::string& key, const std::string& value); |
60 | 60 |
| 61 // Gets an int value for |key| and stores it in |value|. Returns true if |
| 62 // the value was found and of the proper type. |
| 63 bool GetInteger(const std::string& key, int* value) const; |
| 64 |
| 65 // Sets the value for |key| to the int |value|. |
| 66 void SetInteger(const std::string& key, const int value); |
| 67 |
61 // Compares this value map against |other| and stores all key names that have | 68 // Compares this value map against |other| and stores all key names that have |
62 // different values in |differing_keys|. This includes keys that are present | 69 // different values in |differing_keys|. This includes keys that are present |
63 // only in one of the maps. | 70 // only in one of the maps. |
64 void GetDifferingKeys(const PrefValueMap* other, | 71 void GetDifferingKeys(const PrefValueMap* other, |
65 std::vector<std::string>* differing_keys) const; | 72 std::vector<std::string>* differing_keys) const; |
66 | 73 |
67 private: | 74 private: |
68 typedef std::map<std::string, base::Value*> Map; | 75 typedef std::map<std::string, base::Value*> Map; |
69 | 76 |
70 Map prefs_; | 77 Map prefs_; |
71 | 78 |
72 DISALLOW_COPY_AND_ASSIGN(PrefValueMap); | 79 DISALLOW_COPY_AND_ASSIGN(PrefValueMap); |
73 }; | 80 }; |
74 | 81 |
75 #endif // CHROME_BROWSER_PREFS_PREF_VALUE_MAP_H_ | 82 #endif // CHROME_BROWSER_PREFS_PREF_VALUE_MAP_H_ |
OLD | NEW |