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

Unified Diff: sync/api/string_ordinal.h

Issue 10920017: [Sync] Generalize StringOrdinal to handle ordinal_in_parent field (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix another compile error Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: sync/api/string_ordinal.h
diff --git a/sync/api/string_ordinal.h b/sync/api/string_ordinal.h
new file mode 100644
index 0000000000000000000000000000000000000000..00260ae2ed395a109a2ade035302310f86b97fc7
--- /dev/null
+++ b/sync/api/string_ordinal.h
@@ -0,0 +1,42 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
rlarocque 2012/09/05 21:43:46 Why is this file under sync/api, while other seemi
akalin 2012/09/06 19:25:14 Because this is the only file that users of the "n
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SYNC_API_STRING_ORDINAL_H_
+#define SYNC_API_STRING_ORDINAL_H_
+
+#include "base/basictypes.h"
+#include "sync/internal_api/public/base/ordinal.h"
+
+namespace syncer {
+
+// A StringOrdinal is an Ordinal with range 'a'-'z' (for
+// printability). It should be used for data types that want to
+// maintain one or more orderings for nodes.
+
+struct StringOrdinalTraits {
+ static const uint8 kZeroDigit = 'a';
+ static const uint8 kMaxDigit = 'z';
+ static const size_t kMinLength = 1;
+};
+
+typedef Ordinal<StringOrdinalTraits> StringOrdinal;
+
+COMPILE_ASSERT(StringOrdinal::kZeroDigit == 'a',
+ StringOrdinalHasCorrectZeroDigit);
+COMPILE_ASSERT(StringOrdinal::kOneDigit == 'b',
+ StringOrdinalHasCorrectOneDigit);
+COMPILE_ASSERT(StringOrdinal::kMidDigit == 'n',
+ StringOrdinalHasCorrectMidDigit);
+COMPILE_ASSERT(StringOrdinal::kMaxDigit == 'z',
+ StringOrdinalHasCorrectMaxDigit);
+COMPILE_ASSERT(StringOrdinal::kMidDigitValue == 13,
+ StringOrdinalHasCorrectMidDigitValue);
+COMPILE_ASSERT(StringOrdinal::kMaxDigitValue == 25,
+ StringOrdinalHasCorrectMaxDigitValue);
+COMPILE_ASSERT(StringOrdinal::kRadix == 26,
+ StringOrdinalHasCorrectRadix);
+
+} // namespace syncer
+
+#endif // SYNC_API_STRING_ORDINAL_H_

Powered by Google App Engine
This is Rietveld 408576698