| OLD | NEW |
| (Empty) | |
| 1 // Copyright (C) 2013 Google Inc. |
| 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (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 |
| 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 // See the License for the specific language governing permissions and |
| 13 // limitations under the License. |
| 14 |
| 15 #ifndef I18N_ADDRESSINPUT_COUNTRY_RULES_RETRIEVER_H_ |
| 16 #define I18N_ADDRESSINPUT_COUNTRY_RULES_RETRIEVER_H_ |
| 17 |
| 18 #include <libaddressinput/callback.h> |
| 19 #include <libaddressinput/util/basictypes.h> |
| 20 #include <libaddressinput/util/scoped_ptr.h> |
| 21 |
| 22 #include <string> |
| 23 |
| 24 namespace i18n { |
| 25 namespace addressinput { |
| 26 |
| 27 class LookupKey; |
| 28 class RuleRetriever; |
| 29 |
| 30 class CountryRulesRetriever { |
| 31 public: |
| 32 typedef i18n::addressinput::Callback<std::string, LookupKey> Callback; |
| 33 |
| 34 // Takes ownership of |rule_retriever|. |
| 35 explicit CountryRulesRetriever(const RuleRetriever* rule_retriever); |
| 36 ~CountryRulesRetriever(); |
| 37 |
| 38 // Recursively retrieves all of the rules for |country_code| and its |
| 39 // administrative areas, localities, and dependent localities. Places the |
| 40 // rules in the tree rooted at |lookup_ready|. Invokes the |rules_ready| |
| 41 // callback when finished. |
| 42 void RetrieveRules(const std::string& country_code, |
| 43 const Callback& rules_ready, |
| 44 LookupKey* lookup_key) const; |
| 45 |
| 46 private: |
| 47 scoped_ptr<const RuleRetriever> rule_retriever_; |
| 48 |
| 49 DISALLOW_COPY_AND_ASSIGN(CountryRulesRetriever); |
| 50 }; |
| 51 |
| 52 } // namespace addressinput |
| 53 } // namespace i18n |
| 54 |
| 55 #endif // I18N_ADDRESSINPUT_COUNTRY_RULES_RETRIEVER_H_ |
| OLD | NEW |