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
3 // found in the LICENSE file.
5 #include "sync/syncable/syncable_id.h"
9 #include "base/values.h"
17 ostream
& operator<<(ostream
& out
, const Id
& id
) {
22 base::StringValue
* Id::ToValue() const {
23 return new base::StringValue(s_
);
26 string
Id::GetServerId() const {
27 // Currently root is the string "0". We need to decide on a true value.
28 // "" would be convenient here, as the IsRoot call would not be needed.
34 Id
Id::CreateFromServerId(const string
& server_id
) {
39 id
.s_
= string("s") + server_id
;
43 Id
Id::CreateFromClientString(const string
& local_id
) {
48 id
.s_
= string("c") + local_id
;
52 Id
Id::GetLexicographicSuccessor() const {
53 // The successor of a string is given by appending the least
54 // character in the alphabet.
61 Id
Id::GetLeastIdForLexicographicComparison() {
68 return Id(); // Currently == root.
71 } // namespace syncable