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

Unified Diff: source/i18n/unicode/dtptngen.h

Issue 2440913002: Update ICU to 58.1
Patch Set: Created 4 years, 2 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/i18n/unicode/dtitvinf.h ('k') | source/i18n/unicode/dtrule.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/i18n/unicode/dtptngen.h
diff --git a/source/i18n/unicode/dtptngen.h b/source/i18n/unicode/dtptngen.h
index 4a14377a256d75f584cc3999a05d1c86071e9413..fd617ce3cdcbfb2944ba2f64a320ca7a9bbc74ff 100644
--- a/source/i18n/unicode/dtptngen.h
+++ b/source/i18n/unicode/dtptngen.h
@@ -1,6 +1,8 @@
+// Copyright (C) 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
-* Copyright (C) 2007-2015, International Business Machines Corporation and
+* Copyright (C) 2007-2016, International Business Machines Corporation and
* others. All Rights Reserved.
*******************************************************************************
*
@@ -34,15 +36,15 @@ class PtnSkeleton;
class SharedDateTimePatternGenerator;
/**
- * This class provides flexible generation of date format patterns, like "yy-MM-dd".
- * The user can build up the generator by adding successive patterns. Once that
+ * This class provides flexible generation of date format patterns, like "yy-MM-dd".
+ * The user can build up the generator by adding successive patterns. Once that
* is done, a query can be made using a "skeleton", which is a pattern which just
- * includes the desired fields and lengths. The generator will return the "best fit"
+ * includes the desired fields and lengths. The generator will return the "best fit"
* pattern corresponding to that skeleton.
* <p>The main method people will use is getBestPattern(String skeleton),
- * since normally this class is pre-built with data from a particular locale.
+ * since normally this class is pre-built with data from a particular locale.
* However, generators can be built directly from other data as well.
- * <p><i>Issue: may be useful to also have a function that returns the list of
+ * <p><i>Issue: may be useful to also have a function that returns the list of
* fields in a pattern, in order, since we have that internally.
* That would be useful for getting the UI order of field elements.</i>
* @stable ICU 3.8
@@ -84,7 +86,7 @@ public:
* @stable ICU 3.8
*/
static DateTimePatternGenerator* U_EXPORT2 createEmptyInstance(UErrorCode& status);
-
+
/**
* Destructor.
* @stable ICU 3.8
@@ -92,7 +94,7 @@ public:
virtual ~DateTimePatternGenerator();
/**
- * Clone DateTimePatternGenerator object. Clients are responsible for
+ * Clone DateTimePatternGenerator object. Clients are responsible for
* deleting the DateTimePatternGenerator object cloned.
* @stable ICU 3.8
*/
@@ -106,7 +108,7 @@ public:
* @stable ICU 3.8
*/
UBool operator==(const DateTimePatternGenerator& other) const;
-
+
/**
* Return true if another object is semantically unequal to this one.
*
@@ -116,7 +118,6 @@ public:
*/
UBool operator!=(const DateTimePatternGenerator& other) const;
-#ifndef U_HIDE_DRAFT_API
/**
* Utility to return a unique skeleton from a given pattern. For example,
* both "MMM-dd" and "dd/MMM" produce the skeleton "MMMdd".
@@ -125,10 +126,9 @@ public:
* @param status Output param set to success/failure code on exit,
* which must not indicate a failure before the function call.
* @return skeleton such as "MMMdd"
- * @draft ICU 56
+ * @stable ICU 56
*/
static UnicodeString staticGetSkeleton(const UnicodeString& pattern, UErrorCode& status);
-#endif /* U_HIDE_DRAFT_API */
/**
* Utility to return a unique skeleton from a given pattern. For example,
@@ -142,11 +142,13 @@ public:
* @return skeleton such as "MMMdd"
* @stable ICU 3.8
*/
- UnicodeString getSkeleton(const UnicodeString& pattern, UErrorCode& status) {
+ UnicodeString getSkeleton(const UnicodeString& pattern, UErrorCode& status); /* {
+ The function is commented out because it is a stable API calling a draft API.
+ After staticGetSkeleton becomes stable, staticGetSkeleton can be used and
+ these comments and the definition of getSkeleton in dtptngen.cpp should be removed.
return staticGetSkeleton(pattern, status);
- }
+ }*/
-#ifndef U_HIDE_DRAFT_API
/**
* Utility to return a unique base skeleton from a given pattern. This is
* the same as the skeleton, except that differences in length are minimized
@@ -158,10 +160,9 @@ public:
* @param status Output param set to success/failure code on exit,
* which must not indicate a failure before the function call.
* @return base skeleton, such as "MMMd"
- * @draft ICU 56
+ * @stable ICU 56
*/
static UnicodeString staticGetBaseSkeleton(const UnicodeString& pattern, UErrorCode& status);
-#endif /* U_HIDE_DRAFT_API */
/**
* Utility to return a unique base skeleton from a given pattern. This is
@@ -178,27 +179,30 @@ public:
* @return base skeleton, such as "MMMd"
* @stable ICU 3.8
*/
- UnicodeString getBaseSkeleton(const UnicodeString& pattern, UErrorCode& status) {
+ UnicodeString getBaseSkeleton(const UnicodeString& pattern, UErrorCode& status); /* {
+ The function is commented out because it is a stable API calling a draft API.
+ After staticGetBaseSkeleton becomes stable, staticGetBaseSkeleton can be used and
+ these comments and the definition of getBaseSkeleton in dtptngen.cpp should be removed.
return staticGetBaseSkeleton(pattern, status);
- }
+ }*/
/**
* Adds a pattern to the generator. If the pattern has the same skeleton as
* an existing pattern, and the override parameter is set, then the previous
* value is overriden. Otherwise, the previous value is retained. In either
- * case, the conflicting status is set and previous vale is stored in
+ * case, the conflicting status is set and previous vale is stored in
* conflicting pattern.
* <p>
* Note that single-field patterns (like "MMM") are automatically added, and
* don't need to be added explicitly!
*
* @param pattern Input pattern, such as "dd/MMM"
- * @param override When existing values are to be overridden use true,
+ * @param override When existing values are to be overridden use true,
* otherwise use false.
* @param conflictingPattern Previous pattern with the same skeleton.
* @param status Output param set to success/failure code on exit,
* which must not indicate a failure before the function call.
- * @return conflicting status. The value could be UDATPG_NO_CONFLICT,
+ * @return conflicting status. The value could be UDATPG_NO_CONFLICT,
* UDATPG_BASE_CONFLICT or UDATPG_CONFLICT.
* @stable ICU 3.8
* <p>
@@ -207,8 +211,8 @@ public:
* \snippet samples/dtptngsample/dtptngsample.cpp addPatternExample
* <p>
*/
- UDateTimePatternConflict addPattern(const UnicodeString& pattern,
- UBool override,
+ UDateTimePatternConflict addPattern(const UnicodeString& pattern,
+ UBool override,
UnicodeString& conflictingPattern,
UErrorCode& status);
@@ -361,8 +365,8 @@ public:
* \snippet samples/dtptngsample/dtptngsample.cpp replaceFieldTypesExample
* <p>
*/
- UnicodeString replaceFieldTypes(const UnicodeString& pattern,
- const UnicodeString& skeleton,
+ UnicodeString replaceFieldTypes(const UnicodeString& pattern,
+ const UnicodeString& skeleton,
UErrorCode& status);
/**
@@ -387,8 +391,8 @@ public:
* @return pattern adjusted to match the skeleton fields widths and subtypes.
* @stable ICU 4.4
*/
- UnicodeString replaceFieldTypes(const UnicodeString& pattern,
- const UnicodeString& skeleton,
+ UnicodeString replaceFieldTypes(const UnicodeString& pattern,
+ const UnicodeString& skeleton,
UDateTimePatternMatchOptions options,
UErrorCode& status);
@@ -407,12 +411,12 @@ public:
/**
* Get the pattern corresponding to a given skeleton.
- * @param skeleton
+ * @param skeleton
* @return pattern corresponding to a given skeleton.
* @stable ICU 3.8
*/
const UnicodeString& getPatternForSkeleton(const UnicodeString& skeleton) const;
-
+
/**
* Return a list of all the base skeletons (in canonical form) from this class.
*
@@ -426,11 +430,11 @@ public:
#ifndef U_HIDE_INTERNAL_API
/**
- * Return a list of redundant patterns are those which if removed, make no
- * difference in the resulting getBestPattern values. This method returns a
- * list of them, to help check the consistency of the patterns used to build
+ * Return a list of redundant patterns are those which if removed, make no
+ * difference in the resulting getBestPattern values. This method returns a
+ * list of them, to help check the consistency of the patterns used to build
* this generator.
- *
+ *
* @param status Output param set to success/failure code on exit,
* which must not indicate a failure before the function call.
* @return a StringEnumeration with the redundant pattern.
@@ -448,7 +452,7 @@ public:
* the decimal string is ",". Then the resulting pattern is modified to be
* "H:mm:ss,SSSS"
*
- * @param decimal
+ * @param decimal
* @stable ICU 3.8
*/
void setDecimal(const UnicodeString& decimal);
@@ -512,21 +516,26 @@ private:
UnicodeString decimal;
DateTimeMatcher *skipMatcher;
Hashtable *fAvailableFormatKeyHash;
- UnicodeString hackPattern;
UnicodeString emptyString;
UChar fDefaultHourFormatChar;
-
+
+ int32_t fAllowedHourFormats[7]; // Actually an array of AllowedHourFormat enum type, ending with UNKNOWN.
+
/* internal flags masks for adjustFieldTypes etc. */
enum {
kDTPGNoFlags = 0,
kDTPGFixFractionalSeconds = 1,
- kDTPGSkeletonUsesCapJ = 2
+ kDTPGSkeletonUsesCapJ = 2,
+ kDTPGSkeletonUsesLowB = 3,
+ kDTPGSkeletonUsesCapB = 4
};
void initData(const Locale &locale, UErrorCode &status);
- void addCanonicalItems();
+ void addCanonicalItems(UErrorCode &status);
void addICUPatterns(const Locale& locale, UErrorCode& status);
void hackTimes(const UnicodeString& hackPattern, UErrorCode& status);
+ void getCalendarTypeToUse(const Locale& locale, CharString& destination, UErrorCode& err);
+ void consumeShortTimePattern(const UnicodeString& shortTimePattern, UErrorCode& status);
void addCLDRData(const Locale& locale, UErrorCode& status);
UDateTimePatternConflict addPatternWithSkeleton(const UnicodeString& pattern, const UnicodeString * skeletonToUse, UBool override, UnicodeString& conflictingPattern, UErrorCode& status);
void initHashtable(UErrorCode& status);
@@ -534,6 +543,7 @@ private:
void setDecimalSymbols(const Locale& locale, UErrorCode& status);
UDateTimePatternField getAppendFormatNumber(const char* field) const;
UDateTimePatternField getAppendNameNumber(const char* field) const;
+ UnicodeString& getMutableAppendItemName(UDateTimePatternField field);
void getAppendName(UDateTimePatternField field, UnicodeString& value);
int32_t getCanonicalIndex(const UnicodeString& field);
const UnicodeString* getBestRaw(DateTimeMatcher& source, int32_t includeMask, DistanceInfo* missingFields, const PtnSkeleton** specifiedSkeletonPtr = 0);
@@ -544,6 +554,12 @@ private:
UBool isAvailableFormatSet(const UnicodeString &key) const;
void copyHashtable(Hashtable *other, UErrorCode &status);
UBool isCanonicalItem(const UnicodeString& item) const;
+ static void U_CALLCONV loadAllowedHourFormatsData(UErrorCode &status);
+ void getAllowedHourFormats(const Locale &locale, UErrorCode &status);
+
+ struct AppendItemFormatsSink;
+ struct AppendItemNamesSink;
+ struct AvailableFormatsSink;
} ;// end class DateTimePatternGenerator
U_NAMESPACE_END
« no previous file with comments | « source/i18n/unicode/dtitvinf.h ('k') | source/i18n/unicode/dtrule.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698