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 13 matching lines...) Expand all Loading... |
24 #include <map> | 24 #include <map> |
25 #include <string> | 25 #include <string> |
26 | 26 |
27 namespace i18n { | 27 namespace i18n { |
28 namespace addressinput { | 28 namespace addressinput { |
29 | 29 |
30 class Downloader; | 30 class Downloader; |
31 class Storage; | 31 class Storage; |
32 | 32 |
33 // Manages downloading data and caching it locally. Sample usage: | 33 // Manages downloading data and caching it locally. Sample usage: |
34 // Storage* storage = ...; | 34 // scoped_ptr<Downloader> downloader(new Downloader); |
35 // Downloader* downloader = ...; | 35 // scoped_ptr<Storage> storage(new Storage); |
36 // Retriever retriever("https://i18napis.appspot.com/ssl-aggregate-address/", | 36 // Retriever retriever("https://i18napis.appspot.com/ssl-aggregate-address/", |
37 // downloader, storage); | 37 // downloader.Pass(), storage.Pass()); |
38 // retriever.Retrieve("data/CA/AB--fr", | 38 // retriever.Retrieve("data/CA/AB--fr", |
39 // BuildCallback(this, &MyClass::OnDataRetrieved)); | 39 // BuildCallback(this, &MyClass::OnDataRetrieved)); |
40 class Retriever { | 40 class Retriever { |
41 public: | 41 public: |
42 typedef i18n::addressinput::Callback<std::string, std::string> Callback; | 42 typedef i18n::addressinput::Callback<std::string, std::string> Callback; |
43 | 43 |
44 Retriever(const std::string& validation_data_url, | 44 Retriever(const std::string& validation_data_url, |
45 scoped_ptr<Downloader> downloader, | 45 scoped_ptr<Downloader> downloader, |
46 scoped_ptr<Storage> storage); | 46 scoped_ptr<Storage> storage); |
47 ~Retriever(); | 47 ~Retriever(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 // then this data is used as fallback. | 97 // then this data is used as fallback. |
98 std::map<std::string, std::string> stale_data_; | 98 std::map<std::string, std::string> stale_data_; |
99 | 99 |
100 DISALLOW_COPY_AND_ASSIGN(Retriever); | 100 DISALLOW_COPY_AND_ASSIGN(Retriever); |
101 }; | 101 }; |
102 | 102 |
103 } // namespace addressinput | 103 } // namespace addressinput |
104 } // namespace i18n | 104 } // namespace i18n |
105 | 105 |
106 #endif // I18N_ADDRESSINPUT_RETRIEVER_H_ | 106 #endif // I18N_ADDRESSINPUT_RETRIEVER_H_ |
OLD | NEW |