| OLD | NEW |
| 1 /* | 1 /* |
| 2 ******************************************************************************* | 2 ******************************************************************************* |
| 3 * | 3 * |
| 4 * Copyright (C) 2009-2012, International Business Machines | 4 * Copyright (C) 2009-2015, International Business Machines |
| 5 * Corporation and others. All Rights Reserved. | 5 * Corporation and others. All Rights Reserved. |
| 6 * | 6 * |
| 7 ******************************************************************************* | 7 ******************************************************************************* |
| 8 * file name: udatpg.cpp | 8 * file name: udatpg.cpp |
| 9 * encoding: US-ASCII | 9 * encoding: US-ASCII |
| 10 * tab size: 8 (not used) | 10 * tab size: 8 (not used) |
| 11 * indentation:4 | 11 * indentation:4 |
| 12 * | 12 * |
| 13 * created on: 2007jul30 | 13 * created on: 2007jul30 |
| 14 * created by: Markus W. Scherer | 14 * created by: Markus W. Scherer |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 if(skeleton==NULL && length!=0) { | 75 if(skeleton==NULL && length!=0) { |
| 76 *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; | 76 *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; |
| 77 return 0; | 77 return 0; |
| 78 } | 78 } |
| 79 UnicodeString skeletonString((UBool)(length<0), skeleton, length); | 79 UnicodeString skeletonString((UBool)(length<0), skeleton, length); |
| 80 UnicodeString result=((DateTimePatternGenerator *)dtpg)->getBestPattern(skel
etonString, options, *pErrorCode); | 80 UnicodeString result=((DateTimePatternGenerator *)dtpg)->getBestPattern(skel
etonString, options, *pErrorCode); |
| 81 return result.extract(bestPattern, capacity, *pErrorCode); | 81 return result.extract(bestPattern, capacity, *pErrorCode); |
| 82 } | 82 } |
| 83 | 83 |
| 84 U_CAPI int32_t U_EXPORT2 | 84 U_CAPI int32_t U_EXPORT2 |
| 85 udatpg_getSkeleton(UDateTimePatternGenerator *dtpg, | 85 udatpg_getSkeleton(UDateTimePatternGenerator * /* dtpg */, |
| 86 const UChar *pattern, int32_t length, | 86 const UChar *pattern, int32_t length, |
| 87 UChar *skeleton, int32_t capacity, | 87 UChar *skeleton, int32_t capacity, |
| 88 UErrorCode *pErrorCode) { | 88 UErrorCode *pErrorCode) { |
| 89 if(U_FAILURE(*pErrorCode)) { | 89 if(U_FAILURE(*pErrorCode)) { |
| 90 return 0; | 90 return 0; |
| 91 } | 91 } |
| 92 if(pattern==NULL && length!=0) { | 92 if(pattern==NULL && length!=0) { |
| 93 *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; | 93 *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; |
| 94 return 0; | 94 return 0; |
| 95 } | 95 } |
| 96 UnicodeString patternString((UBool)(length<0), pattern, length); | 96 UnicodeString patternString((UBool)(length<0), pattern, length); |
| 97 UnicodeString result=((DateTimePatternGenerator *)dtpg)->getSkeleton(pattern
String, *pErrorCode); | 97 UnicodeString result=DateTimePatternGenerator::staticGetSkeleton( |
| 98 patternString, *pErrorCode); |
| 98 return result.extract(skeleton, capacity, *pErrorCode); | 99 return result.extract(skeleton, capacity, *pErrorCode); |
| 99 } | 100 } |
| 100 | 101 |
| 101 U_CAPI int32_t U_EXPORT2 | 102 U_CAPI int32_t U_EXPORT2 |
| 102 udatpg_getBaseSkeleton(UDateTimePatternGenerator *dtpg, | 103 udatpg_getBaseSkeleton(UDateTimePatternGenerator * /* dtpg */, |
| 103 const UChar *pattern, int32_t length, | 104 const UChar *pattern, int32_t length, |
| 104 UChar *skeleton, int32_t capacity, | 105 UChar *skeleton, int32_t capacity, |
| 105 UErrorCode *pErrorCode) { | 106 UErrorCode *pErrorCode) { |
| 106 if(U_FAILURE(*pErrorCode)) { | 107 if(U_FAILURE(*pErrorCode)) { |
| 107 return 0; | 108 return 0; |
| 108 } | 109 } |
| 109 if(pattern==NULL && length!=0) { | 110 if(pattern==NULL && length!=0) { |
| 110 *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; | 111 *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; |
| 111 return 0; | 112 return 0; |
| 112 } | 113 } |
| 113 UnicodeString patternString((UBool)(length<0), pattern, length); | 114 UnicodeString patternString((UBool)(length<0), pattern, length); |
| 114 UnicodeString result=((DateTimePatternGenerator *)dtpg)->getBaseSkeleton(pat
ternString, *pErrorCode); | 115 UnicodeString result=DateTimePatternGenerator::staticGetBaseSkeleton( |
| 116 patternString, *pErrorCode); |
| 115 return result.extract(skeleton, capacity, *pErrorCode); | 117 return result.extract(skeleton, capacity, *pErrorCode); |
| 116 } | 118 } |
| 117 | 119 |
| 118 U_CAPI UDateTimePatternConflict U_EXPORT2 | 120 U_CAPI UDateTimePatternConflict U_EXPORT2 |
| 119 udatpg_addPattern(UDateTimePatternGenerator *dtpg, | 121 udatpg_addPattern(UDateTimePatternGenerator *dtpg, |
| 120 const UChar *pattern, int32_t patternLength, | 122 const UChar *pattern, int32_t patternLength, |
| 121 UBool override, | 123 UBool override, |
| 122 UChar *conflictingPattern, int32_t capacity, int32_t *pLength, | 124 UChar *conflictingPattern, int32_t capacity, int32_t *pLength, |
| 123 UErrorCode *pErrorCode) { | 125 UErrorCode *pErrorCode) { |
| 124 if(U_FAILURE(*pErrorCode)) { | 126 if(U_FAILURE(*pErrorCode)) { |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 int32_t *pLength) { | 264 int32_t *pLength) { |
| 263 UnicodeString skeletonString((UBool)(skeletonLength<0), skeleton, skeletonLe
ngth); | 265 UnicodeString skeletonString((UBool)(skeletonLength<0), skeleton, skeletonLe
ngth); |
| 264 const UnicodeString &result=((const DateTimePatternGenerator *)dtpg)->getPat
ternForSkeleton(skeletonString); | 266 const UnicodeString &result=((const DateTimePatternGenerator *)dtpg)->getPat
ternForSkeleton(skeletonString); |
| 265 if(pLength!=NULL) { | 267 if(pLength!=NULL) { |
| 266 *pLength=result.length(); | 268 *pLength=result.length(); |
| 267 } | 269 } |
| 268 return result.getBuffer(); | 270 return result.getBuffer(); |
| 269 } | 271 } |
| 270 | 272 |
| 271 #endif | 273 #endif |
| OLD | NEW |