OLD | NEW |
---|---|
(Empty) | |
1 // 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
| |
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 | |
14 // printability). It should be used for data types that want to | |
15 // maintain one or more orderings for nodes. | |
16 | |
17 struct StringOrdinalTraits { | |
18 static const uint8 kZeroDigit = 'a'; | |
19 static const uint8 kMaxDigit = 'z'; | |
20 static const size_t kMinLength = 1; | |
21 }; | |
22 | |
23 typedef Ordinal<StringOrdinalTraits> StringOrdinal; | |
24 | |
25 COMPILE_ASSERT(StringOrdinal::kZeroDigit == 'a', | |
26 StringOrdinalHasCorrectZeroDigit); | |
27 COMPILE_ASSERT(StringOrdinal::kOneDigit == 'b', | |
28 StringOrdinalHasCorrectOneDigit); | |
29 COMPILE_ASSERT(StringOrdinal::kMidDigit == 'n', | |
30 StringOrdinalHasCorrectMidDigit); | |
31 COMPILE_ASSERT(StringOrdinal::kMaxDigit == 'z', | |
32 StringOrdinalHasCorrectMaxDigit); | |
33 COMPILE_ASSERT(StringOrdinal::kMidDigitValue == 13, | |
34 StringOrdinalHasCorrectMidDigitValue); | |
35 COMPILE_ASSERT(StringOrdinal::kMaxDigitValue == 25, | |
36 StringOrdinalHasCorrectMaxDigitValue); | |
37 COMPILE_ASSERT(StringOrdinal::kRadix == 26, | |
38 StringOrdinalHasCorrectRadix); | |
39 | |
40 } // namespace syncer | |
41 | |
42 #endif // SYNC_API_STRING_ORDINAL_H_ | |
OLD | NEW |