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

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

Issue 125633003: [rAc - libaddressinput] slay another helper class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months 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 // A wrapper object for Storage that stores data with a checksum and a
16 // timestamp. The existence of checksum and timestamp fields is transparent to
17 // the user of the object.
18
19 #ifndef I18N_ADDRESSINPUT_VALIDATING_STORAGE_H_
20 #define I18N_ADDRESSINPUT_VALIDATING_STORAGE_H_
21
22 #include <libaddressinput/storage.h>
23 #include <libaddressinput/util/basictypes.h>
24 #include <libaddressinput/util/scoped_ptr.h>
25
26 #include <string>
27
28 namespace i18n {
29 namespace addressinput {
30
31 // Wraps Storage to add checksum and timestamp to stored data. Sample usage:
32 // Storage file_storage = ...;
33 // scoped_ptr<Storage> storage(new ValidatingStorage(file_storage.Pass()));
34 // storage->Put("key", "data");
35 // storage->Get("key", BuildCallback(this, &MyClass::OnDataReady));
36 class ValidatingStorage : public Storage {
37 public:
38 explicit ValidatingStorage(scoped_ptr<Storage> storage);
39 virtual ~ValidatingStorage();
40
41 // Storage implementation.
42 virtual void Put(const std::string& key, const std::string& data);
43 virtual void Get(const std::string& key, scoped_ptr<Callback> data_ready)
44 const;
45
46 private:
47 // The storage being wrapped.
48 scoped_ptr<Storage> wrapped_storage_;
49
50 DISALLOW_COPY_AND_ASSIGN(ValidatingStorage);
51 };
52
53 } // namespace addressinput
54 } // namespace i18n
55
56 #endif // I18N_ADDRESSINPUT_VALIDATING_STORAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698