| 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 GOOGLE_APIS_DRIVE_GDATA_WAPI_PARSER_H_ | |
| 6 #define GOOGLE_APIS_DRIVE_GDATA_WAPI_PARSER_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 | |
| 12 // Defines data elements of Google Documents API as described in | |
| 13 // http://code.google.com/apis/documents/. | |
| 14 namespace google_apis { | |
| 15 | |
| 16 // This class represents a resource entry. A resource is a generic term which | |
| 17 // refers to a file and a directory. | |
| 18 class ResourceEntry { | |
| 19 public: | |
| 20 enum ResourceEntryKind { | |
| 21 ENTRY_KIND_UNKNOWN, | |
| 22 ENTRY_KIND_FOLDER, | |
| 23 ENTRY_KIND_FILE | |
| 24 }; | |
| 25 ResourceEntry(); | |
| 26 ~ResourceEntry(); | |
| 27 | |
| 28 // The resource ID is used to identify a resource, which looks like: | |
| 29 // file:d41d8cd98f00b204e9800998ecf8 | |
| 30 const std::string& resource_id() const { return resource_id_; } | |
| 31 | |
| 32 ResourceEntryKind kind() const { return kind_; } | |
| 33 const std::string& title() const { return title_; } | |
| 34 | |
| 35 // True if the file or directory is deleted (applicable to change list only). | |
| 36 bool deleted() const { return deleted_; } | |
| 37 | |
| 38 // True if resource entry is a folder (collection). | |
| 39 bool is_folder() const { | |
| 40 return kind_ == ENTRY_KIND_FOLDER; | |
| 41 } | |
| 42 // True if resource entry is regular file. | |
| 43 bool is_file() const { | |
| 44 return kind_ == ENTRY_KIND_FILE; | |
| 45 } | |
| 46 | |
| 47 void set_resource_id(const std::string& resource_id) { | |
| 48 resource_id_ = resource_id; | |
| 49 } | |
| 50 void set_kind(ResourceEntryKind kind) { kind_ = kind; } | |
| 51 void set_title(const std::string& title) { title_ = title; } | |
| 52 void set_deleted(bool deleted) { deleted_ = deleted; } | |
| 53 | |
| 54 private: | |
| 55 std::string resource_id_; | |
| 56 ResourceEntryKind kind_; | |
| 57 std::string title_; | |
| 58 bool deleted_; | |
| 59 | |
| 60 DISALLOW_COPY_AND_ASSIGN(ResourceEntry); | |
| 61 }; | |
| 62 | |
| 63 } // namespace google_apis | |
| 64 | |
| 65 #endif // GOOGLE_APIS_DRIVE_GDATA_WAPI_PARSER_H_ | |
| OLD | NEW |