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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <iosfwd> | 9 #include <iosfwd> |
10 #include <limits> | 10 #include <limits> |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 90 |
91 const std::string& value() const { | 91 const std::string& value() const { |
92 return s_; | 92 return s_; |
93 } | 93 } |
94 | 94 |
95 // Return the next highest ID in the lexicographic ordering. This is | 95 // Return the next highest ID in the lexicographic ordering. This is |
96 // useful for computing upper bounds on std::sets that are ordered | 96 // useful for computing upper bounds on std::sets that are ordered |
97 // by operator<. | 97 // by operator<. |
98 Id GetLexicographicSuccessor() const; | 98 Id GetLexicographicSuccessor() const; |
99 | 99 |
100 // Note: |lowercase_query| should be passed in as lower case. | |
101 bool ContainsStringCaseInsensitive(const std::string& lowercase_query) const; | |
102 | |
103 // Dumps the ID as a value and returns it. Transfers ownership of | 100 // Dumps the ID as a value and returns it. Transfers ownership of |
104 // the StringValue to the caller. | 101 // the StringValue to the caller. |
105 base::StringValue* ToValue() const; | 102 base::StringValue* ToValue() const; |
106 | 103 |
107 // Three functions are used to work with our proto buffers. | 104 // Three functions are used to work with our proto buffers. |
108 std::string GetServerId() const; | 105 std::string GetServerId() const; |
109 static Id CreateFromServerId(const std::string& server_id); | 106 static Id CreateFromServerId(const std::string& server_id); |
110 // This should only be used if you get back a reference to a local | 107 // This should only be used if you get back a reference to a local |
111 // id from the server. Returns a client only opaque id. | 108 // id from the server. Returns a client only opaque id. |
112 static Id CreateFromClientString(const std::string& local_id); | 109 static Id CreateFromClientString(const std::string& local_id); |
(...skipping 12 matching lines...) Expand all Loading... |
125 friend class SyncableIdTest; | 122 friend class SyncableIdTest; |
126 | 123 |
127 std::string s_; | 124 std::string s_; |
128 }; | 125 }; |
129 | 126 |
130 Id GetNullId(); | 127 Id GetNullId(); |
131 | 128 |
132 } // namespace syncable | 129 } // namespace syncable |
133 | 130 |
134 #endif // SYNC_SYNCABLE_SYNCABLE_ID_H_ | 131 #endif // SYNC_SYNCABLE_SYNCABLE_ID_H_ |
OLD | NEW |