OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2011 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 CHROME_COMMON_STRING_INDEX_H_ | |
6 #define CHROME_COMMON_STRING_INDEX_H_ | |
7 #pragma once | |
8 | |
9 #include <string> | |
10 | |
11 #include "base/basictypes.h" | |
12 | |
13 namespace StringIndex { | |
akalin
2011/10/12 18:50:14
static functions in a namespace isn't a great inte
| |
14 | |
15 // Create a string that is lexigraphically greater than start and | |
16 // lexigraphically less than end, ideally the string will be a | |
17 // middle value between the two strings. | |
18 // Use an empty string to signify no ending or starting limit. | |
19 // The range of values returns from here are (A..K*). | |
20 std::string CreateStringBetween(const std::string& start, | |
21 const std::string& end); | |
22 | |
23 // Used to add kMidDigitValue to the value at position index because | |
24 // the previous index values had an odd difference, so their correct | |
25 // middle value is x and a half, so we are inserting the half here. | |
akalin
2011/10/12 18:50:14
why is this public?
| |
26 void AddHalf(size_t position, std::string& value); | |
27 | |
28 // Remove all trailing zeros from a value as they provide no value. | |
29 std::string RemoveTrailingZeros(const std::string& value); | |
akalin
2011/10/12 18:50:14
why is this public?
| |
30 | |
31 // Ensure that given string matches the format with asserts. | |
32 // The format is [A-Z][B-Z]* | |
33 void ValidateString(const std::string& value); | |
34 | |
35 static const char kZeroDigit = 'A'; | |
akalin
2011/10/12 18:50:14
why are these in the header?
| |
36 static const char kMinDigit = 'B'; | |
37 static const char kMidDigit = 'N'; | |
38 static const char kMaxDigit = 'Z'; | |
39 | |
40 static const int kMaxDigitValue = kMaxDigit - kZeroDigit; | |
41 static const int kMidDigitValue = kMidDigit - kZeroDigit; | |
42 static const int kFullDigitValue = (kMaxDigit + 1) - kZeroDigit; | |
43 } | |
44 #endif // CHROME_COMMON_STRING_INDEX_H_ | |
OLD | NEW |