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_SYNCABLE_ID_H_ | 5 #ifndef SYNC_SYNCABLE_SYNCABLE_ID_H_ |
6 #define SYNC_SYNCABLE_SYNCABLE_ID_H_ | 6 #define SYNC_SYNCABLE_SYNCABLE_ID_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 #include <limits> | 9 #include <limits> |
10 #include <sstream> | 10 #include <sstream> |
11 #include <string> | 11 #include <string> |
12 | 12 |
| 13 #include "base/memory/scoped_ptr.h" |
13 #include "base/hash_tables.h" | 14 #include "base/hash_tables.h" |
14 | 15 |
15 class MockConnectionManager; | 16 class MockConnectionManager; |
16 | 17 |
17 namespace base { | 18 namespace base { |
18 class StringValue; | 19 class StringValue; |
19 } | 20 } |
20 | 21 |
21 namespace sql { | 22 namespace sql { |
22 class Statement; | 23 class Statement; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 // This should only be used if you get back a reference to a local | 105 // This should only be used if you get back a reference to a local |
105 // id from the server. Returns a client only opaque id. | 106 // id from the server. Returns a client only opaque id. |
106 static Id CreateFromClientString(const std::string& local_id); | 107 static Id CreateFromClientString(const std::string& local_id); |
107 | 108 |
108 // This method returns an ID that will compare less than any valid ID. | 109 // This method returns an ID that will compare less than any valid ID. |
109 // The returned ID is not a valid ID itself. This is useful for | 110 // The returned ID is not a valid ID itself. This is useful for |
110 // computing lower bounds on std::sets that are ordered by operator<. | 111 // computing lower bounds on std::sets that are ordered by operator<. |
111 static Id GetLeastIdForLexicographicComparison(); | 112 static Id GetLeastIdForLexicographicComparison(); |
112 | 113 |
113 private: | 114 private: |
114 friend EntryKernel* UnpackEntry(sql::Statement* statement); | 115 friend scoped_ptr<EntryKernel> UnpackEntry(sql::Statement* statement); |
115 friend void BindFields(const EntryKernel& entry, | 116 friend void BindFields(const EntryKernel& entry, |
116 sql::Statement* statement); | 117 sql::Statement* statement); |
117 friend std::ostream& operator<<(std::ostream& out, const Id& id); | 118 friend std::ostream& operator<<(std::ostream& out, const Id& id); |
118 friend class MockConnectionManager; | 119 friend class MockConnectionManager; |
119 friend class SyncableIdTest; | 120 friend class SyncableIdTest; |
120 | 121 |
121 std::string s_; | 122 std::string s_; |
122 }; | 123 }; |
123 | 124 |
124 Id GetNullId(); | 125 Id GetNullId(); |
125 | 126 |
126 } // namespace syncable | 127 } // namespace syncable |
127 } // namespace syncer | 128 } // namespace syncer |
128 | 129 |
129 #endif // SYNC_SYNCABLE_SYNCABLE_ID_H_ | 130 #endif // SYNC_SYNCABLE_SYNCABLE_ID_H_ |
OLD | NEW |