|
OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_DB_H_ | |
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_DB_H_ | |
7 #pragma once | |
8 | |
9 #include <string> | |
10 | |
11 #include "base/file_path.h" | |
12 #include "base/memory/scoped_ptr.h" | |
13 | |
14 namespace gdata { | |
15 | |
16 class GDataEntry; | |
17 class GDataDBIter; | |
18 | |
19 class GDataDB { | |
satorux1
2012/04/23 17:40:41
class comment is missing.
| |
20 public: | |
21 enum Status { | |
22 DB_OK = 0, | |
23 DB_NOT_FOUND, | |
24 DB_ERR, | |
25 }; | |
26 | |
27 virtual ~GDataDB() {} | |
28 | |
29 // Factory method to create a GDataDB instance at |db_path| | |
satorux1
2012/04/23 17:40:41
period is missing.
achuithb
2012/04/24 08:09:36
Done.
| |
30 static scoped_ptr<GDataDB> Create(const FilePath& db_path); | |
satorux1
2012/04/23 17:40:41
You might want to move this factory function out o
achuithb
2012/04/24 08:09:36
Done.
| |
31 | |
32 // Add |entry| to the database. | |
33 virtual Status Put(const GDataEntry& entry) = 0; | |
34 | |
35 // Delete a database entry with key |resource_id| or |path| respectively. | |
36 virtual Status DeleteByResourceId(const std::string& resource_id) = 0; | |
37 virtual Status DeleteByPath(const std::string& path) = 0; | |
38 | |
39 // Fetch a GDataEntry* by key |resource_id| or |path| respectively. | |
40 virtual Status GetByResourceId(const std::string& resource_id, | |
41 scoped_ptr<GDataEntry>* entry) = 0; | |
42 virtual Status GetByPath(const std::string& path, | |
43 scoped_ptr<GDataEntry>* entry) = 0; | |
44 | |
45 // An iterator to fetch all GDataEntry's under |path|. | |
46 virtual scoped_ptr<GDataDBIter> NewIterator(const std::string& path) = 0; | |
47 | |
48 protected: | |
49 GDataDB() {} | |
50 | |
51 DISALLOW_COPY_AND_ASSIGN(GDataDB); | |
52 }; | |
53 | |
54 class GDataDBIter { | |
satorux1
2012/04/23 17:40:41
class comment is missing.
achuithb
2012/04/24 08:09:36
Done.
| |
55 public: | |
56 virtual ~GDataDBIter() {} | |
57 virtual scoped_ptr<GDataEntry> GetNext() = 0; | |
satorux1
2012/04/23 17:40:41
put a blank line?
achuithb
2012/04/24 08:09:36
Done.
| |
58 protected: | |
59 GDataDBIter() {} | |
60 }; | |
61 | |
62 } // namespace gdata | |
63 | |
64 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_DB_H_ | |
OLD | NEW |