Update V8 to version 4.5.80.
[chromium-blink-merge.git] / sync / api / string_ordinal.h
blob8fe998641133978bc4e1ec5c76329c6a1448ffb6
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 #ifndef SYNC_API_STRING_ORDINAL_H_
6 #define SYNC_API_STRING_ORDINAL_H_
8 #include "base/basictypes.h"
9 #include "sync/internal_api/public/base/ordinal.h"
11 namespace syncer {
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.
19 // Since StringOrdinals contain only printable characters, it is safe
20 // to store as a string in a protobuf.
22 struct StringOrdinalTraits {
23 static const uint8 kZeroDigit = 'a';
24 static const uint8 kMaxDigit = 'z';
25 static const size_t kMinLength = 1;
28 typedef Ordinal<StringOrdinalTraits> StringOrdinal;
30 static_assert(StringOrdinal::kZeroDigit == 'a',
31 "StringOrdinal has incorrect zero digit");
32 static_assert(StringOrdinal::kOneDigit == 'b',
33 "StringOrdinal has incorrect one digit");
34 static_assert(StringOrdinal::kMidDigit == 'n',
35 "StringOrdinal has incorrect mid digit");
36 static_assert(StringOrdinal::kMaxDigit == 'z',
37 "StringOrdinal has incorrect max digit");
38 static_assert(StringOrdinal::kMidDigitValue == 13,
39 "StringOrdinal has incorrect mid digit value");
40 static_assert(StringOrdinal::kMaxDigitValue == 25,
41 "StringOrdinal has incorrect max digit value");
42 static_assert(StringOrdinal::kRadix == 26,
43 "StringOrdinal has incorrect radix");
45 } // namespace syncer
47 #endif // SYNC_API_STRING_ORDINAL_H_