| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include "chrome/browser/sync/syncable/syncable_id.h" | 5 #include "chrome/browser/sync/syncable/syncable_id.h" |
| 6 | 6 |
| 7 #include <iosfwd> | 7 #include <iosfwd> |
| 8 | 8 |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 Id Id::CreateFromClientString(const string& local_id) { | 39 Id Id::CreateFromClientString(const string& local_id) { |
| 40 Id id; | 40 Id id; |
| 41 if (local_id == "0") | 41 if (local_id == "0") |
| 42 id.s_ = "r"; | 42 id.s_ = "r"; |
| 43 else | 43 else |
| 44 id.s_ = string("c") + local_id; | 44 id.s_ = string("c") + local_id; |
| 45 return id; | 45 return id; |
| 46 } | 46 } |
| 47 | 47 |
| 48 Id Id::GetLexicographicSuccessor() const { |
| 49 // The successor of a string is given by appending the least |
| 50 // character in the alphabet. |
| 51 Id id = *this; |
| 52 id.s_.push_back(std::numeric_limits<std::string::value_type>::min()); |
| 53 return id; |
| 54 } |
| 55 |
| 56 // static |
| 57 Id Id::GetLeastIdForLexicographicComparison() { |
| 58 Id id; |
| 59 id.s_.clear(); |
| 60 return id; |
| 61 } |
| 62 |
| 48 } // namespace syncable | 63 } // namespace syncable |
| OLD | NEW |