Chromium Code Reviews
|
| 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/memory/scoped_ptr.h" | |
| 12 | |
| 13 class FilePath; | |
| 14 | |
| 15 namespace gdata { | |
| 16 | |
| 17 class GDataEntry; | |
| 18 class GDataDBIter; | |
| 19 | |
| 20 // GData Database interface class. | |
| 21 class GDataDB { | |
| 22 public: | |
| 23 enum Status { | |
| 24 DB_OK = 0, | |
| 25 DB_NOT_FOUND, | |
|
satorux1
2012/04/24 18:26:44
does this mean the db file is not found? or key is
achuithb
2012/04/24 19:43:58
Done.
| |
| 26 DB_ERR, | |
|
satorux1
2012/04/24 18:26:44
DB_ERROR or DB_FAILED? in favor of less abbreviati
achuithb
2012/04/24 19:43:58
Done.
| |
| 27 }; | |
| 28 | |
| 29 virtual ~GDataDB() {} | |
| 30 | |
| 31 // Add |entry| to the database. | |
| 32 virtual Status Put(const GDataEntry& entry) = 0; | |
| 33 | |
| 34 // Delete a database entry with key |resource_id| or |path| respectively. | |
| 35 virtual Status DeleteByResourceId(const std::string& resource_id) = 0; | |
| 36 virtual Status DeleteByPath(const FilePath& path) = 0; | |
| 37 | |
| 38 // Fetch a GDataEntry* by key |resource_id| or |path| respectively. | |
| 39 virtual Status GetByResourceId(const std::string& resource_id, | |
| 40 scoped_ptr<GDataEntry>* entry) = 0; | |
| 41 virtual Status GetByPath(const FilePath& path, | |
| 42 scoped_ptr<GDataEntry>* entry) = 0; | |
| 43 | |
| 44 // An iterator to fetch all GDataEntry's under |path|. | |
| 45 virtual scoped_ptr<GDataDBIter> NewIterator(const FilePath& path) = 0; | |
| 46 | |
| 47 protected: | |
| 48 GDataDB() {} | |
| 49 | |
| 50 DISALLOW_COPY_AND_ASSIGN(GDataDB); | |
|
satorux1
2012/04/24 18:26:44
nit: In interface class with pure virtual methods,
achuithb
2012/04/24 19:43:58
Done.
| |
| 51 }; | |
| 52 | |
| 53 // GData Database Iterator interface class. | |
| 54 class GDataDBIter { | |
| 55 public: | |
| 56 virtual ~GDataDBIter() {} | |
| 57 virtual scoped_ptr<GDataEntry> GetNext() = 0; | |
|
satorux1
2012/04/24 18:26:44
function comment is missing. I expect it'll return
achuithb
2012/04/24 19:43:58
Done.
| |
| 58 | |
| 59 protected: | |
| 60 GDataDBIter() {} | |
| 61 }; | |
| 62 | |
| 63 } // namespace gdata | |
| 64 | |
| 65 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_DB_H_ | |
| OLD | NEW |