Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (C) 2013 Google Inc. | 1 // Copyright (C) 2013 Google Inc. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 39 // Parses the |json| string and returns true if |json| is valid and it is an | 39 // Parses the |json| string and returns true if |json| is valid and it is an |
| 40 // object. | 40 // object. |
| 41 virtual bool ParseObject(const std::string& json) = 0; | 41 virtual bool ParseObject(const std::string& json) = 0; |
| 42 | 42 |
| 43 // Sets |value| to the string for |key| if it exists, or false if the key | 43 // Sets |value| to the string for |key| if it exists, or false if the key |
| 44 // doesn't exist or doesn't correspond to a string. The JSON object must be | 44 // doesn't exist or doesn't correspond to a string. The JSON object must be |
| 45 // parsed successfully in ParseObject() before invoking this method. | 45 // parsed successfully in ParseObject() before invoking this method. |
| 46 virtual bool GetStringValueForKey(const std::string& key, | 46 virtual bool GetStringValueForKey(const std::string& key, |
| 47 std::string* value) const = 0; | 47 std::string* value) const = 0; |
| 48 | 48 |
| 49 // Sets |value| to the dictionary for |key| if it exists, or false if the key | |
| 50 // doesn't exist or doesn't correspond to a dictionary. The JSON object must | |
| 51 // be parsed successfully in ParseObject() before invoking this method. | |
| 52 // | |
| 53 // The old |value| is discarded, but not deleted. The caller owns the | |
| 54 // resulting |value|. | |
| 55 virtual bool GetJsonValueForKey(const std::string& key, | |
|
Evan Stade
2014/01/18 19:14:32
return a scoped_ptr<Json>
or if you want to stick
please use gerrit instead
2014/01/21 18:43:54
Great idea! Done.
| |
| 56 Json** value) const = 0; | |
| 57 | |
| 49 protected: | 58 protected: |
| 50 Json(); | 59 Json(); |
| 51 }; | 60 }; |
| 52 | 61 |
| 53 } // namespace addressinput | 62 } // namespace addressinput |
| 54 } // namespace i18n | 63 } // namespace i18n |
| 55 | 64 |
| 56 #endif // I18N_ADDRESSINPUT_UTIL_JSON_H_ | 65 #endif // I18N_ADDRESSINPUT_UTIL_JSON_H_ |
| OLD | NEW |