OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef SYNC_SYNCABLE_ENTRY_H_ | 5 #ifndef SYNC_SYNCABLE_ENTRY_H_ |
6 #define SYNC_SYNCABLE_ENTRY_H_ | 6 #define SYNC_SYNCABLE_ENTRY_H_ |
7 | 7 |
| 8 #include <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
8 #include <string> | 11 #include <string> |
9 #include <vector> | 12 #include <vector> |
10 | 13 |
| 14 #include "base/macros.h" |
11 #include "sync/base/sync_export.h" | 15 #include "sync/base/sync_export.h" |
12 #include "sync/syncable/entry_kernel.h" | 16 #include "sync/syncable/entry_kernel.h" |
13 | 17 |
14 namespace syncer { | 18 namespace syncer { |
15 class Cryptographer; | 19 class Cryptographer; |
16 class ReadNode; | 20 class ReadNode; |
17 | 21 |
18 namespace syncable { | 22 namespace syncable { |
19 | 23 |
20 class Directory; | 24 class Directory; |
(...skipping 26 matching lines...) Expand all Loading... |
47 }; | 51 }; |
48 | 52 |
49 enum GetByHandle { | 53 enum GetByHandle { |
50 GET_BY_HANDLE | 54 GET_BY_HANDLE |
51 }; | 55 }; |
52 | 56 |
53 class SYNC_EXPORT Entry { | 57 class SYNC_EXPORT Entry { |
54 public: | 58 public: |
55 // After constructing, you must check good() to test whether the Get | 59 // After constructing, you must check good() to test whether the Get |
56 // succeeded. | 60 // succeeded. |
57 Entry(BaseTransaction* trans, GetByHandle, int64 handle); | 61 Entry(BaseTransaction* trans, GetByHandle, int64_t handle); |
58 Entry(BaseTransaction* trans, GetById, const Id& id); | 62 Entry(BaseTransaction* trans, GetById, const Id& id); |
59 Entry(BaseTransaction* trans, GetTypeRoot, ModelType type); | 63 Entry(BaseTransaction* trans, GetTypeRoot, ModelType type); |
60 Entry(BaseTransaction* trans, GetByClientTag, const std::string& tag); | 64 Entry(BaseTransaction* trans, GetByClientTag, const std::string& tag); |
61 | 65 |
62 // This lookup function is deprecated. All types except bookmarks can use | 66 // This lookup function is deprecated. All types except bookmarks can use |
63 // the GetTypeRoot variant instead. | 67 // the GetTypeRoot variant instead. |
64 Entry(BaseTransaction* trans, GetByServerTag, const std::string& tag); | 68 Entry(BaseTransaction* trans, GetByServerTag, const std::string& tag); |
65 | 69 |
66 bool good() const { return 0 != kernel_; } | 70 bool good() const { return 0 != kernel_; } |
67 | 71 |
68 BaseTransaction* trans() const { return basetrans_; } | 72 BaseTransaction* trans() const { return basetrans_; } |
69 | 73 |
70 // Field accessors. | 74 // Field accessors. |
71 int64 GetMetahandle() const { | 75 int64_t GetMetahandle() const { |
72 DCHECK(kernel_); | 76 DCHECK(kernel_); |
73 return kernel_->ref(META_HANDLE); | 77 return kernel_->ref(META_HANDLE); |
74 } | 78 } |
75 | 79 |
76 int64 GetBaseVersion() const { | 80 int64_t GetBaseVersion() const { |
77 DCHECK(kernel_); | 81 DCHECK(kernel_); |
78 return kernel_->ref(BASE_VERSION); | 82 return kernel_->ref(BASE_VERSION); |
79 } | 83 } |
80 | 84 |
81 int64 GetServerVersion() const { | 85 int64_t GetServerVersion() const { |
82 DCHECK(kernel_); | 86 DCHECK(kernel_); |
83 return kernel_->ref(SERVER_VERSION); | 87 return kernel_->ref(SERVER_VERSION); |
84 } | 88 } |
85 | 89 |
86 int64 GetLocalExternalId() const { | 90 int64_t GetLocalExternalId() const { |
87 DCHECK(kernel_); | 91 DCHECK(kernel_); |
88 return kernel_->ref(LOCAL_EXTERNAL_ID); | 92 return kernel_->ref(LOCAL_EXTERNAL_ID); |
89 } | 93 } |
90 | 94 |
91 int64 GetTransactionVersion() const { | 95 int64_t GetTransactionVersion() const { |
92 DCHECK(kernel_); | 96 DCHECK(kernel_); |
93 return kernel_->ref(TRANSACTION_VERSION); | 97 return kernel_->ref(TRANSACTION_VERSION); |
94 } | 98 } |
95 | 99 |
96 const base::Time& GetMtime() const { | 100 const base::Time& GetMtime() const { |
97 DCHECK(kernel_); | 101 DCHECK(kernel_); |
98 return kernel_->ref(MTIME); | 102 return kernel_->ref(MTIME); |
99 } | 103 } |
100 | 104 |
101 const base::Time& GetServerMtime() const { | 105 const base::Time& GetServerMtime() const { |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 Id GetSuccessorId() const; | 232 Id GetSuccessorId() const; |
229 Id GetFirstChildId() const; | 233 Id GetFirstChildId() const; |
230 int GetTotalNodeCount() const; | 234 int GetTotalNodeCount() const; |
231 | 235 |
232 int GetPositionIndex() const; | 236 int GetPositionIndex() const; |
233 | 237 |
234 // Returns a vector of this node's children's handles. | 238 // Returns a vector of this node's children's handles. |
235 // Clears |result| if there are no children. If this node is of a type that | 239 // Clears |result| if there are no children. If this node is of a type that |
236 // supports user-defined ordering then the resulting vector will be in the | 240 // supports user-defined ordering then the resulting vector will be in the |
237 // proper order. | 241 // proper order. |
238 void GetChildHandles(std::vector<int64>* result) const; | 242 void GetChildHandles(std::vector<int64_t>* result) const; |
239 | 243 |
240 inline bool ExistsOnClientBecauseNameIsNonEmpty() const { | 244 inline bool ExistsOnClientBecauseNameIsNonEmpty() const { |
241 DCHECK(kernel_); | 245 DCHECK(kernel_); |
242 return !kernel_->ref(NON_UNIQUE_NAME).empty(); | 246 return !kernel_->ref(NON_UNIQUE_NAME).empty(); |
243 } | 247 } |
244 | 248 |
245 inline bool IsRoot() const { | 249 inline bool IsRoot() const { |
246 DCHECK(kernel_); | 250 DCHECK(kernel_); |
247 return kernel_->ref(ID).IsRoot(); | 251 return kernel_->ref(ID).IsRoot(); |
248 } | 252 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 | 288 |
285 DISALLOW_COPY_AND_ASSIGN(Entry); | 289 DISALLOW_COPY_AND_ASSIGN(Entry); |
286 }; | 290 }; |
287 | 291 |
288 std::ostream& operator<<(std::ostream& os, const Entry& entry); | 292 std::ostream& operator<<(std::ostream& os, const Entry& entry); |
289 | 293 |
290 } // namespace syncable | 294 } // namespace syncable |
291 } // namespace syncer | 295 } // namespace syncer |
292 | 296 |
293 #endif // SYNC_SYNCABLE_ENTRY_H_ | 297 #endif // SYNC_SYNCABLE_ENTRY_H_ |
OLD | NEW |