| Index: third_party/libaddressinput/chromium/cpp/src/country_rules_retriever.h
|
| diff --git a/third_party/libaddressinput/chromium/cpp/src/country_rules_retriever.h b/third_party/libaddressinput/chromium/cpp/src/country_rules_retriever.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..8be0baa2d9ba388db9c7395bc7ecd8385852d9f5
|
| --- /dev/null
|
| +++ b/third_party/libaddressinput/chromium/cpp/src/country_rules_retriever.h
|
| @@ -0,0 +1,77 @@
|
| +// Copyright (C) 2013 Google Inc.
|
| +//
|
| +// Licensed under the Apache License, Version 2.0 (the "License");
|
| +// you may not use this file except in compliance with the License.
|
| +// You may obtain a copy of the License at
|
| +//
|
| +// http://www.apache.org/licenses/LICENSE-2.0
|
| +//
|
| +// Unless required by applicable law or agreed to in writing, software
|
| +// distributed under the License is distributed on an "AS IS" BASIS,
|
| +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| +// See the License for the specific language governing permissions and
|
| +// limitations under the License.
|
| +
|
| +#ifndef I18N_ADDRESSINPUT_COUNTRY_RULES_RETRIEVER_H_
|
| +#define I18N_ADDRESSINPUT_COUNTRY_RULES_RETRIEVER_H_
|
| +
|
| +#include <libaddressinput/callback.h>
|
| +#include <libaddressinput/util/basictypes.h>
|
| +#include <libaddressinput/util/scoped_ptr.h>
|
| +
|
| +#include <string>
|
| +
|
| +namespace i18n {
|
| +namespace addressinput {
|
| +
|
| +class Retriever;
|
| +class Ruleset;
|
| +
|
| +// Retrieves a ruleset for a country. Sample usage:
|
| +// class MyClass {
|
| +// public:
|
| +// MyClass() : retriever_(scoped_ptr<const Retriever>(...)) {}
|
| +//
|
| +// ~MyClass() {}
|
| +//
|
| +// void GetRuleset(const std::string& country_code) {
|
| +// retriever_.RetrieveRules(
|
| +// country_code,
|
| +// BuildScopedPtrCallback(this, &MyClass::OnRulesetReady));
|
| +// }
|
| +//
|
| +// void OnRulesetReady(bool success,
|
| +// const std::string& country_code,
|
| +// scoped_ptr<Ruleset> ruleset) {
|
| +// ...
|
| +// }
|
| +//
|
| +// private:
|
| +// CountryRulesRetriever retriever_;
|
| +//
|
| +// DISALLOW_COPY_AND_ASSIGN(CountryRulesRetriever);
|
| +// };
|
| +class CountryRulesRetriever {
|
| + public:
|
| + typedef i18n::addressinput::ScopedPtrCallback<Ruleset> Callback;
|
| +
|
| + explicit CountryRulesRetriever(scoped_ptr<const Retriever> retriever);
|
| +
|
| + ~CountryRulesRetriever();
|
| +
|
| + // Recursively retrieves all of the rules for |country_code| and its
|
| + // administrative areas, localities, and dependent localities. Invokes the
|
| + // |rules_ready| callback when finished.
|
| + void RetrieveRules(const std::string& country_code,
|
| + scoped_ptr<Callback> rules_ready) const;
|
| +
|
| + private:
|
| + scoped_ptr<const Retriever> retriever_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(CountryRulesRetriever);
|
| +};
|
| +
|
| +} // namespace addressinput
|
| +} // namespace i18n
|
| +
|
| +#endif // I18N_ADDRESSINPUT_COUNTRY_RULES_RETRIEVER_H_
|
|
|