Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: chrome/browser/sync/syncable/syncable_id.h

Issue 2844037: Fix handling of undeletion within the syncer. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Whitespace. Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/sync/syncable/syncable.cc ('k') | chrome/browser/sync/syncable/syncable_id.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef CHROME_BROWSER_SYNC_SYNCABLE_SYNCABLE_ID_H_ 5 #ifndef CHROME_BROWSER_SYNC_SYNCABLE_SYNCABLE_ID_H_
6 #define CHROME_BROWSER_SYNC_SYNCABLE_SYNCABLE_ID_H_ 6 #define CHROME_BROWSER_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>
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 } 77 }
78 78
79 // TODO(sync): We could use null here, but to ease conversion we use "r". 79 // TODO(sync): We could use null here, but to ease conversion we use "r".
80 // fix this, this is madness :) 80 // fix this, this is madness :)
81 inline bool IsNull() const { 81 inline bool IsNull() const {
82 return IsRoot(); 82 return IsRoot();
83 } 83 }
84 inline void Clear() { 84 inline void Clear() {
85 s_ = "r"; 85 s_ = "r";
86 } 86 }
87 std::string AsQueryParam() const;
88 // Must never allow id == 0 or id < 0 to compile. 87 // Must never allow id == 0 or id < 0 to compile.
89 inline bool operator == (const Id& that) const { 88 inline bool operator == (const Id& that) const {
90 return s_ == that.s_; 89 return s_ == that.s_;
91 } 90 }
92 inline bool operator != (const Id& that) const { 91 inline bool operator != (const Id& that) const {
93 return s_ != that.s_; 92 return s_ != that.s_;
94 } 93 }
95 inline bool operator < (const Id& that) const { 94 inline bool operator < (const Id& that) const {
96 return s_ < that.s_; 95 return s_ < that.s_;
97 } 96 }
98 inline bool operator > (const Id& that) const { 97 inline bool operator > (const Id& that) const {
99 return s_ > that.s_; 98 return s_ > that.s_;
100 } 99 }
101 100
102 public: 101 // Three functions are used to work with our proto buffers.
103 // Three functions used to work with our proto buffers.
104 std::string GetServerId() const; 102 std::string GetServerId() const;
105 static Id CreateFromServerId(const std::string& server_id); 103 static Id CreateFromServerId(const std::string& server_id);
106 // This should only be used if you get back a reference to a local 104 // This should only be used if you get back a reference to a local
107 // id from the server. Returns a client only opaque id. 105 // id from the server. Returns a client only opaque id.
108 static Id CreateFromClientString(const std::string& local_id); 106 static Id CreateFromClientString(const std::string& local_id);
107
109 protected: 108 protected:
110 std::string s_; 109 std::string s_;
111 }; 110 };
112 111
113 extern const Id kNullId; 112 extern const Id kNullId;
114 113
115 } // namespace syncable 114 } // namespace syncable
116 115
117 #endif // CHROME_BROWSER_SYNC_SYNCABLE_SYNCABLE_ID_H_ 116 #endif // CHROME_BROWSER_SYNC_SYNCABLE_SYNCABLE_ID_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/syncable/syncable.cc ('k') | chrome/browser/sync/syncable/syncable_id.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698