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

Unified Diff: source/common/simplepatternformatter.h

Issue 1621943002: ICU 56 step 4: Apply post-56 fixes for measure/date format (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@56goog
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/common/resource.cpp ('k') | source/common/simplepatternformatter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/common/simplepatternformatter.h
diff --git a/source/common/simplepatternformatter.h b/source/common/simplepatternformatter.h
index 6740dc9f47b27c0da747d09762b476ddf011200c..782a29c09e48dd10185eb5b44bf2dc58b7c71946 100644
--- a/source/common/simplepatternformatter.h
+++ b/source/common/simplepatternformatter.h
@@ -1,6 +1,6 @@
/*
******************************************************************************
-* Copyright (C) 2014, International Business Machines
+* Copyright (C) 2014-2015, International Business Machines
* Corporation and others. All Rights Reserved.
******************************************************************************
* simplepatternformatter.h
@@ -52,12 +52,22 @@ public:
SimplePatternFormatter();
/**
- * Construct from a pattern. Will never fail if pattern has three or
+ * Constructs from a pattern. Will never fail if pattern has three or
* fewer placeholders in it.
*/
explicit SimplePatternFormatter(const UnicodeString& pattern);
/**
+ * Constructs from a pattern. Will never fail if pattern has three or
+ * fewer placeholders in it.
+ *
+ * @param min The pattern must have at least this many placeholders.
+ * @param max The pattern must have at most this many placeholders.
+ */
+ SimplePatternFormatter(const UnicodeString& pattern, int32_t min, int32_t max,
+ UErrorCode &errorCode);
+
+ /**
* Copy constructor.
*/
SimplePatternFormatter(const SimplePatternFormatter& other);
@@ -79,7 +89,22 @@ public:
* there are three or fewer placeholders in pattern. May fail with
* U_MEMORY_ALLOCATION_ERROR if there are more than three placeholders.
*/
- UBool compile(const UnicodeString &pattern, UErrorCode &status);
+ UBool compile(const UnicodeString &pattern, UErrorCode &status) {
+ return compileMinMaxPlaceholders(pattern, 0, INT32_MAX, status);
+ }
+
+ /**
+ * Compiles pattern and makes this object represent pattern.
+ *
+ * Returns TRUE on success; FALSE on failure. Will not fail if
+ * there are three or fewer placeholders in pattern. May fail with
+ * U_MEMORY_ALLOCATION_ERROR if there are more than three placeholders.
+ *
+ * @param min The pattern must have at least this many placeholders.
+ * @param max The pattern must have at most this many placeholders.
+ */
+ UBool compileMinMaxPlaceholders(const UnicodeString &pattern,
+ int32_t min, int32_t max, UErrorCode &status);
/**
* Returns (maxPlaceholderId + 1). For example
« no previous file with comments | « source/common/resource.cpp ('k') | source/common/simplepatternformatter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698