Index: chrome/common/string_index.h |
diff --git a/chrome/common/string_index.h b/chrome/common/string_index.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c1823957532c089e913ecdb636b4aa2fc8f6855d |
--- /dev/null |
+++ b/chrome/common/string_index.h |
@@ -0,0 +1,44 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_COMMON_STRING_INDEX_H_ |
+#define CHROME_COMMON_STRING_INDEX_H_ |
+#pragma once |
+ |
+#include <string> |
+ |
+#include "base/basictypes.h" |
+ |
+namespace StringIndex { |
akalin
2011/10/12 18:50:14
static functions in a namespace isn't a great inte
|
+ |
+// Create a string that is lexigraphically greater than start and |
+// lexigraphically less than end, ideally the string will be a |
+// middle value between the two strings. |
+// Use an empty string to signify no ending or starting limit. |
+// The range of values returns from here are (A..K*). |
+std::string CreateStringBetween(const std::string& start, |
+ const std::string& end); |
+ |
+// Used to add kMidDigitValue to the value at position index because |
+// the previous index values had an odd difference, so their correct |
+// 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?
|
+void AddHalf(size_t position, std::string& value); |
+ |
+// Remove all trailing zeros from a value as they provide no value. |
+std::string RemoveTrailingZeros(const std::string& value); |
akalin
2011/10/12 18:50:14
why is this public?
|
+ |
+// Ensure that given string matches the format with asserts. |
+// The format is [A-Z][B-Z]* |
+void ValidateString(const std::string& value); |
+ |
+static const char kZeroDigit = 'A'; |
akalin
2011/10/12 18:50:14
why are these in the header?
|
+static const char kMinDigit = 'B'; |
+static const char kMidDigit = 'N'; |
+static const char kMaxDigit = 'Z'; |
+ |
+static const int kMaxDigitValue = kMaxDigit - kZeroDigit; |
+static const int kMidDigitValue = kMidDigit - kZeroDigit; |
+static const int kFullDigitValue = (kMaxDigit + 1) - kZeroDigit; |
+} |
+#endif // CHROME_COMMON_STRING_INDEX_H_ |