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

Side by Side Diff: third_party/libaddressinput/chromium/cpp/src/validating_storage.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 // 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));
34 // storage->Put("key", "data");
35 // scoped_ptr<Storage::Callback> data_ready(BuildCallback(
36 // this, &MyClass::OnDataReady));
37 // storage->Get("key", *data_ready);
38 class ValidatingStorage : public Storage {
39 public:
40 // Takes ownership of |storage|.
41 explicit ValidatingStorage(Storage* storage);
42 virtual ~ValidatingStorage();
43
44 // Storage implementation.
45 virtual void Put(const std::string& key, const std::string& data);
46 virtual void Get(const std::string& key, const Callback& data_ready) const;
47
48 private:
49 // The storage being wrapped.
50 scoped_ptr<Storage> wrapped_storage_;
51
52 DISALLOW_COPY_AND_ASSIGN(ValidatingStorage);
53 };
54
55 } // namespace addressinput
56 } // namespace i18n
57
58 #endif // I18N_ADDRESSINPUT_VALIDATING_STORAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698