Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(351)

Side by Side Diff: third_party/libaddressinput/chromium/cpp/src/rule_retriever.h

Issue 110533002: [rac] Temporarily copy libaddressinput to Chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Avoid redefinition of basictypes.h Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 // An object to retrieve validation rules.
16
17 #ifndef I18N_ADDRESSINPUT_RULE_RETRIEVER_H_
18 #define I18N_ADDRESSINPUT_RULE_RETRIEVER_H_
19
20 #include <libaddressinput/callback.h>
21 #include <libaddressinput/util/basictypes.h>
22 #include <libaddressinput/util/scoped_ptr.h>
23
24 #include <string>
25
26 namespace i18n {
27 namespace addressinput {
28
29 class Retriever;
30 class Rule;
31
32 // Retrieves validation rules. Sample usage:
33 // const Retriever* retriever = ...
34 // RuleRetriever rules(retriever);
35 // scoped_ptr<RuleRetriever::Callback> rule_ready(BuildCallback(
36 // this, &MyClass::OnRuleReady));
37 // rules.RetrieveRule("data/CA/AB--fr", *rule_ready);
38 class RuleRetriever {
39 public:
40 typedef i18n::addressinput::Callback<std::string, Rule> Callback;
41
42 // Takes ownership of |retriever|.
43 explicit RuleRetriever(const Retriever* retriever);
44 ~RuleRetriever();
45
46 // Retrieves the rule for |key| and invokes the |rule_ready| callback.
47 void RetrieveRule(const std::string& key, const Callback& rule_ready) const;
48
49 private:
50 scoped_ptr<const Retriever> data_retriever_;
51
52 DISALLOW_COPY_AND_ASSIGN(RuleRetriever);
53 };
54
55 } // namespace addressinput
56 } // namespace i18n
57
58 #endif // I18N_ADDRESSINPUT_RULE_RETRIEVER_H_
OLDNEW
« no previous file with comments | « third_party/libaddressinput/chromium/cpp/src/rule.cc ('k') | third_party/libaddressinput/chromium/cpp/src/rule_retriever.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698