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

Side by Side Diff: sync/api/string_ordinal.h

Issue 1545553003: Switch to standard integer types in sync/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 SYNC_API_STRING_ORDINAL_H_ 5 #ifndef SYNC_API_STRING_ORDINAL_H_
6 #define SYNC_API_STRING_ORDINAL_H_ 6 #define SYNC_API_STRING_ORDINAL_H_
7 7
8 #include "base/basictypes.h" 8 #include <stddef.h>
9 #include <stdint.h>
10
9 #include "sync/internal_api/public/base/ordinal.h" 11 #include "sync/internal_api/public/base/ordinal.h"
10 12
11 namespace syncer { 13 namespace syncer {
12 14
13 // A StringOrdinal is an Ordinal with range 'a'-'z' for printability 15 // A StringOrdinal is an Ordinal with range 'a'-'z' for printability
14 // of its internal byte string representation. (Think of 16 // of its internal byte string representation. (Think of
15 // StringOrdinal as being short for PrintableStringOrdinal.) It 17 // StringOrdinal as being short for PrintableStringOrdinal.) It
16 // should be used for data types that want to maintain one or more 18 // should be used for data types that want to maintain one or more
17 // orderings for nodes. 19 // orderings for nodes.
18 // 20 //
19 // Since StringOrdinals contain only printable characters, it is safe 21 // Since StringOrdinals contain only printable characters, it is safe
20 // to store as a string in a protobuf. 22 // to store as a string in a protobuf.
21 23
22 struct StringOrdinalTraits { 24 struct StringOrdinalTraits {
23 static const uint8 kZeroDigit = 'a'; 25 static const uint8_t kZeroDigit = 'a';
24 static const uint8 kMaxDigit = 'z'; 26 static const uint8_t kMaxDigit = 'z';
25 static const size_t kMinLength = 1; 27 static const size_t kMinLength = 1;
26 }; 28 };
27 29
28 typedef Ordinal<StringOrdinalTraits> StringOrdinal; 30 typedef Ordinal<StringOrdinalTraits> StringOrdinal;
29 31
30 static_assert(StringOrdinal::kZeroDigit == 'a', 32 static_assert(StringOrdinal::kZeroDigit == 'a',
31 "StringOrdinal has incorrect zero digit"); 33 "StringOrdinal has incorrect zero digit");
32 static_assert(StringOrdinal::kOneDigit == 'b', 34 static_assert(StringOrdinal::kOneDigit == 'b',
33 "StringOrdinal has incorrect one digit"); 35 "StringOrdinal has incorrect one digit");
34 static_assert(StringOrdinal::kMidDigit == 'n', 36 static_assert(StringOrdinal::kMidDigit == 'n',
35 "StringOrdinal has incorrect mid digit"); 37 "StringOrdinal has incorrect mid digit");
36 static_assert(StringOrdinal::kMaxDigit == 'z', 38 static_assert(StringOrdinal::kMaxDigit == 'z',
37 "StringOrdinal has incorrect max digit"); 39 "StringOrdinal has incorrect max digit");
38 static_assert(StringOrdinal::kMidDigitValue == 13, 40 static_assert(StringOrdinal::kMidDigitValue == 13,
39 "StringOrdinal has incorrect mid digit value"); 41 "StringOrdinal has incorrect mid digit value");
40 static_assert(StringOrdinal::kMaxDigitValue == 25, 42 static_assert(StringOrdinal::kMaxDigitValue == 25,
41 "StringOrdinal has incorrect max digit value"); 43 "StringOrdinal has incorrect max digit value");
42 static_assert(StringOrdinal::kRadix == 26, 44 static_assert(StringOrdinal::kRadix == 26,
43 "StringOrdinal has incorrect radix"); 45 "StringOrdinal has incorrect radix");
44 46
45 } // namespace syncer 47 } // namespace syncer
46 48
47 #endif // SYNC_API_STRING_ORDINAL_H_ 49 #endif // SYNC_API_STRING_ORDINAL_H_
OLDNEW
« no previous file with comments | « sync/api/fake_sync_change_processor.h ('k') | sync/api/sync_change_processor_wrapper_for_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698