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

Unified Diff: source/tools/toolutil/collationinfo.cpp

Issue 1621843002: ICU 56 update step 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@561
Patch Set: Created 4 years, 11 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « source/tools/toolutil/collationinfo.h ('k') | source/tools/toolutil/flagparser.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/tools/toolutil/collationinfo.cpp
diff --git a/source/tools/toolutil/collationinfo.cpp b/source/tools/toolutil/collationinfo.cpp
index 7bf38614e5ed1d9d0622d304a1faf1b78b1b0f02..fef1cdf1051cc9ddd6d1ef7782b9186aca5aafa7 100644
--- a/source/tools/toolutil/collationinfo.cpp
+++ b/source/tools/toolutil/collationinfo.cpp
@@ -1,6 +1,6 @@
/*
*******************************************************************************
-* Copyright (C) 2013-2014, International Business Machines
+* Copyright (C) 2013-2015, International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
* collationinfo.cpp
@@ -16,9 +16,11 @@
#if !UCONFIG_NO_COLLATION
+#include "collationdata.h"
#include "collationdatareader.h"
#include "collationinfo.h"
#include "uassert.h"
+#include "uvectr32.h"
U_NAMESPACE_BEGIN
@@ -112,6 +114,37 @@ CollationInfo::getDataLength(const int32_t indexes[], int32_t startIndex) {
return indexes[startIndex + 1] - indexes[startIndex];
}
+void
+CollationInfo::printReorderRanges(const CollationData &data, const int32_t *codes, int32_t length) {
+ UErrorCode errorCode = U_ZERO_ERROR;
+ UVector32 ranges(errorCode);
+ data.makeReorderRanges(codes, length, ranges, errorCode);
+ if(U_FAILURE(errorCode)) {
+ printf(" error building reorder ranges: %s\n", u_errorName(errorCode));
+ return;
+ }
+
+ int32_t start = 0;
+ for(int32_t i = 0; i < ranges.size(); ++i) {
+ int32_t pair = ranges.elementAti(i);
+ int32_t limit = (pair >> 16) & 0xffff;
+ int16_t offset = (int16_t)pair;
+ if(offset == 0) {
+ // [inclusive-start, exclusive-limit[
+ printf(" [%04x, %04x[\n", start, limit);
+ } else if(offset > 0) {
+ printf(" reorder [%04x, %04x[ by offset %02x to [%04x, %04x[\n",
+ start, limit, offset,
+ start + (offset << 8), limit + (offset << 8));
+ } else /* offset < 0 */ {
+ printf(" reorder [%04x, %04x[ by offset -%02x to [%04x, %04x[\n",
+ start, limit, -offset,
+ start + (offset << 8), limit + (offset << 8));
+ }
+ start = limit;
+ }
+}
+
U_NAMESPACE_END
#endif // !UCONFIG_NO_COLLATION
« no previous file with comments | « source/tools/toolutil/collationinfo.h ('k') | source/tools/toolutil/flagparser.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698