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_INTERNAL_API_PUBLIC_BASE_UNIQUE_POSITION_H_ | 5 #ifndef SYNC_INTERNAL_API_PUBLIC_BASE_UNIQUE_POSITION_H_ |
6 #define SYNC_INTERNAL_API_PUBLIC_BASE_UNIQUE_POSITION_H_ | 6 #define SYNC_INTERNAL_API_PUBLIC_BASE_UNIQUE_POSITION_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 88 |
89 // Serializes the protobuf representation of this object as a string. | 89 // Serializes the protobuf representation of this object as a string. |
90 void SerializeToString(std::string* blob) const; | 90 void SerializeToString(std::string* blob) const; |
91 | 91 |
92 // Returns a human-readable representation of this item's internal state. | 92 // Returns a human-readable representation of this item's internal state. |
93 std::string ToDebugString() const; | 93 std::string ToDebugString() const; |
94 | 94 |
95 // Returns the suffix. | 95 // Returns the suffix. |
96 std::string GetSuffixForTest() const; | 96 std::string GetSuffixForTest() const; |
97 | 97 |
| 98 size_t compressed_byte_size() const { return compressed_.capacity() + 1; } |
| 99 |
98 // Performs a lossy conversion to an int64_t position. Positions converted to | 100 // Performs a lossy conversion to an int64_t position. Positions converted to |
99 // and from int64_ts using this and the FromInt64 function should maintain | 101 // and from int64_ts using this and the FromInt64 function should maintain |
100 // their | 102 // their |
101 // relative orderings unless the int64_t values conflict. | 103 // relative orderings unless the int64_t values conflict. |
102 int64_t ToInt64() const; | 104 int64_t ToInt64() const; |
103 | 105 |
104 bool IsValid() const; | 106 bool IsValid() const; |
105 | 107 |
106 private: | 108 private: |
107 friend class UniquePositionTest; | 109 friend class UniquePositionTest; |
(...skipping 30 matching lines...) Expand all Loading... |
138 | 140 |
139 // The position value after it has been run through the custom compression | 141 // The position value after it has been run through the custom compression |
140 // algorithm. See Compress() and Uncompress() functions above. | 142 // algorithm. See Compress() and Uncompress() functions above. |
141 std::string compressed_; | 143 std::string compressed_; |
142 bool is_valid_; | 144 bool is_valid_; |
143 }; | 145 }; |
144 | 146 |
145 } // namespace syncer | 147 } // namespace syncer |
146 | 148 |
147 #endif // SYNC_INTERNAL_API_PUBLIC_BASE_UNIQUE_POSITION_H_ | 149 #endif // SYNC_INTERNAL_API_PUBLIC_BASE_UNIQUE_POSITION_H_ |
OLD | NEW |