OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "sync/syncable/entry_kernel.h" | 8 #include "sync/syncable/entry_kernel.h" |
9 | 9 |
10 namespace syncer { | 10 namespace syncer { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 } | 85 } |
86 inline bool Get(BitField field) const { | 86 inline bool Get(BitField field) const { |
87 DCHECK(kernel_); | 87 DCHECK(kernel_); |
88 return kernel_->ref(field); | 88 return kernel_->ref(field); |
89 } | 89 } |
90 const std::string& Get(StringField field) const; | 90 const std::string& Get(StringField field) const; |
91 inline const sync_pb::EntitySpecifics& Get(ProtoField field) const { | 91 inline const sync_pb::EntitySpecifics& Get(ProtoField field) const { |
92 DCHECK(kernel_); | 92 DCHECK(kernel_); |
93 return kernel_->ref(field); | 93 return kernel_->ref(field); |
94 } | 94 } |
95 inline const NodeOrdinal& Get(OrdinalField field) const { | 95 inline const UniquePosition& Get(UniquePositionField field) const { |
96 DCHECK(kernel_); | 96 DCHECK(kernel_); |
97 return kernel_->ref(field); | 97 return kernel_->ref(field); |
98 } | 98 } |
| 99 const std::string& Get(BytesField field) const; |
99 inline bool Get(BitTemp field) const { | 100 inline bool Get(BitTemp field) const { |
100 DCHECK(kernel_); | 101 DCHECK(kernel_); |
101 return kernel_->ref(field); | 102 return kernel_->ref(field); |
102 } | 103 } |
103 | 104 |
104 ModelType GetServerModelType() const; | 105 ModelType GetServerModelType() const; |
105 ModelType GetModelType() const; | 106 ModelType GetModelType() const; |
106 | 107 |
| 108 Id GetPredecessorId() const; |
| 109 Id GetSuccessorId() const; |
| 110 Id GetFirstChildId() const; |
| 111 |
107 inline bool ExistsOnClientBecauseNameIsNonEmpty() const { | 112 inline bool ExistsOnClientBecauseNameIsNonEmpty() const { |
108 DCHECK(kernel_); | 113 DCHECK(kernel_); |
109 return !kernel_->ref(NON_UNIQUE_NAME).empty(); | 114 return !kernel_->ref(NON_UNIQUE_NAME).empty(); |
110 } | 115 } |
111 | 116 |
112 inline bool IsRoot() const { | 117 inline bool IsRoot() const { |
113 DCHECK(kernel_); | 118 DCHECK(kernel_); |
114 return kernel_->ref(ID).IsRoot(); | 119 return kernel_->ref(ID).IsRoot(); |
115 } | 120 } |
116 | 121 |
117 Directory* dir() const; | 122 Directory* dir() const; |
118 | 123 |
119 const EntryKernel GetKernelCopy() const { | 124 const EntryKernel GetKernelCopy() const { |
120 return *kernel_; | 125 return *kernel_; |
121 } | 126 } |
122 | 127 |
123 // Compute a local predecessor position for |update_item|, based on its | |
124 // absolute server position. The returned ID will be a valid predecessor | |
125 // under SERVER_PARENT_ID that is consistent with the | |
126 // SERVER_POSITION_IN_PARENT ordering. | |
127 Id ComputePrevIdFromServerPosition(const Id& parent_id) const; | |
128 | |
129 // Dumps all entry info into a DictionaryValue and returns it. | 128 // Dumps all entry info into a DictionaryValue and returns it. |
130 // Transfers ownership of the DictionaryValue to the caller. | 129 // Transfers ownership of the DictionaryValue to the caller. |
131 base::DictionaryValue* ToValue(Cryptographer* cryptographer) const; | 130 base::DictionaryValue* ToValue(Cryptographer* cryptographer) const; |
132 | 131 |
133 protected: // Don't allow creation on heap, except by sync API wrappers. | 132 protected: // Don't allow creation on heap, except by sync API wrappers. |
134 void* operator new(size_t size) { return (::operator new)(size); } | 133 void* operator new(size_t size) { return (::operator new)(size); } |
135 | 134 |
136 inline explicit Entry(BaseTransaction* trans) | 135 inline explicit Entry(BaseTransaction* trans) |
137 : basetrans_(trans), | 136 : basetrans_(trans), |
138 kernel_(NULL) { } | 137 kernel_(NULL) { } |
(...skipping 10 matching lines...) Expand all Loading... |
149 | 148 |
150 DISALLOW_COPY_AND_ASSIGN(Entry); | 149 DISALLOW_COPY_AND_ASSIGN(Entry); |
151 }; | 150 }; |
152 | 151 |
153 std::ostream& operator<<(std::ostream& os, const Entry& entry); | 152 std::ostream& operator<<(std::ostream& os, const Entry& entry); |
154 | 153 |
155 } // namespace syncable | 154 } // namespace syncable |
156 } // namespace syncer | 155 } // namespace syncer |
157 | 156 |
158 #endif // SYNC_SYNCABLE_ENTRY_H_ | 157 #endif // SYNC_SYNCABLE_ENTRY_H_ |
OLD | NEW |