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

Side by Side 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 comment location Created 8 years, 3 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 | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #ifndef SYNC_API_STRING_ORDINAL_H_
6 #define SYNC_API_STRING_ORDINAL_H_
7
8 #include "base/basictypes.h"
9 #include "sync/internal_api/public/base/ordinal.h"
10
11 namespace syncer {
12
13 // A StringOrdinal is an Ordinal with range 'a'-'z' for printability
14 // of its internal byte string representation. (Think of
15 // StringOrdinal as being short for PrintableStringOrdinal.) It
16 // should be used for data types that want to maintain one or more
17 // orderings for nodes.
18
19 struct StringOrdinalTraits {
20 static const uint8 kZeroDigit = 'a';
21 static const uint8 kMaxDigit = 'z';
22 static const size_t kMinLength = 1;
23 };
24
25 typedef Ordinal<StringOrdinalTraits> StringOrdinal;
26
27 COMPILE_ASSERT(StringOrdinal::kZeroDigit == 'a',
28 StringOrdinalHasCorrectZeroDigit);
29 COMPILE_ASSERT(StringOrdinal::kOneDigit == 'b',
30 StringOrdinalHasCorrectOneDigit);
31 COMPILE_ASSERT(StringOrdinal::kMidDigit == 'n',
32 StringOrdinalHasCorrectMidDigit);
33 COMPILE_ASSERT(StringOrdinal::kMaxDigit == 'z',
34 StringOrdinalHasCorrectMaxDigit);
35 COMPILE_ASSERT(StringOrdinal::kMidDigitValue == 13,
36 StringOrdinalHasCorrectMidDigitValue);
37 COMPILE_ASSERT(StringOrdinal::kMaxDigitValue == 25,
38 StringOrdinalHasCorrectMaxDigitValue);
39 COMPILE_ASSERT(StringOrdinal::kRadix == 26,
40 StringOrdinalHasCorrectRadix);
41
42 } // namespace syncer
43
44 #endif // SYNC_API_STRING_ORDINAL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698