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

Side by Side Diff: icu46/source/i18n/zrule.cpp

Issue 5516007: Check in the pristine copy of ICU 4.6... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/
Patch Set: Created 10 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « icu46/source/i18n/zrule.h ('k') | icu46/source/i18n/zstrfmt.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 /*
2 *******************************************************************************
3 * Copyright (C) 2009-2010, International Business Machines Corporation and *
4 * others. All Rights Reserved. *
5 *******************************************************************************
6 */
7
8 /**
9 * \file
10 * \brief C API: Time zone rule classes
11 */
12
13 #include "unicode/utypes.h"
14
15 #if !UCONFIG_NO_FORMATTING
16
17 #include "unicode/uobject.h"
18 #include "zrule.h"
19 #include "unicode/tzrule.h"
20 #include "cmemory.h"
21 #include "unicode/ustring.h"
22 #include "unicode/parsepos.h"
23
24 U_NAMESPACE_USE
25
26 /*********************************************************************
27 * ZRule API
28 *********************************************************************/
29
30 U_CAPI void U_EXPORT2
31 zrule_close(ZRule* rule) {
32 delete (TimeZoneRule*)rule;
33 }
34
35 U_CAPI UBool U_EXPORT2
36 zrule_equals(const ZRule* rule1, const ZRule* rule2) {
37 return *(const TimeZoneRule*)rule1 == *(const TimeZoneRule*)rule2;
38 }
39
40 U_CAPI void U_EXPORT2
41 zrule_getName(ZRule* rule, UChar* name, int32_t nameLength) {
42 UnicodeString s(nameLength==-1, name, nameLength);
43 s = ((TimeZoneRule*)rule)->TimeZoneRule::getName(s);
44 nameLength = s.length();
45 memcpy(name, s.getBuffer(), nameLength);
46 return;
47 }
48
49 U_CAPI int32_t U_EXPORT2
50 zrule_getRawOffset(ZRule* rule) {
51 return ((TimeZoneRule*)rule)->TimeZoneRule::getRawOffset();
52 }
53
54 U_CAPI int32_t U_EXPORT2
55 zrule_getDSTSavings(ZRule* rule) {
56 return ((TimeZoneRule*)rule)->TimeZoneRule::getDSTSavings();
57 }
58
59 U_CAPI UBool U_EXPORT2
60 zrule_isEquivalentTo(ZRule* rule1, ZRule* rule2) {
61 return ((TimeZoneRule*)rule1)->TimeZoneRule::isEquivalentTo(*(TimeZoneRule*) rule2);
62 }
63
64 /*********************************************************************
65 * IZRule API
66 *********************************************************************/
67
68 U_CAPI IZRule* U_EXPORT2
69 izrule_open(const UChar* name, int32_t nameLength, int32_t rawOffset, int32_t ds tSavings) {
70 UnicodeString s(nameLength==-1, name, nameLength);
71 return (IZRule*) new InitialTimeZoneRule(name, rawOffset, dstSavings);
72 }
73
74 U_CAPI void U_EXPORT2
75 izrule_close(IZRule* rule) {
76 delete (InitialTimeZoneRule*)rule;
77 }
78
79 U_CAPI IZRule* U_EXPORT2
80 izrule_clone(IZRule *rule) {
81 return (IZRule*) (((InitialTimeZoneRule*)rule)->InitialTimeZoneRule::clone() );
82 }
83
84 U_CAPI UBool U_EXPORT2
85 izrule_equals(const IZRule* rule1, const IZRule* rule2) {
86 return *(const InitialTimeZoneRule*)rule1 == *(const InitialTimeZoneRule*)ru le2;
87 }
88
89 U_CAPI void U_EXPORT2
90 izrule_getName(IZRule* rule, UChar* & name, int32_t & nameLength) {
91 // UnicodeString s(nameLength==-1, name, nameLength);
92 UnicodeString s;
93 ((InitialTimeZoneRule*)rule)->InitialTimeZoneRule::getName(s);
94 nameLength = s.length();
95 name = (UChar*)uprv_malloc(nameLength);
96 memcpy(name, s.getBuffer(), nameLength);
97 return;
98 }
99
100 U_CAPI int32_t U_EXPORT2
101 izrule_getRawOffset(IZRule* rule) {
102 return ((InitialTimeZoneRule*)rule)->InitialTimeZoneRule::getRawOffset();
103 }
104
105 U_CAPI int32_t U_EXPORT2
106 izrule_getDSTSavings(IZRule* rule) {
107 return ((InitialTimeZoneRule*)rule)->InitialTimeZoneRule::getDSTSavings();
108 }
109
110 U_CAPI UBool U_EXPORT2
111 izrule_isEquivalentTo(IZRule* rule1, IZRule* rule2) {
112 return ((InitialTimeZoneRule*)rule1)->InitialTimeZoneRule::isEquivalentTo(*( InitialTimeZoneRule*)rule2);
113 }
114
115 U_CAPI UBool U_EXPORT2
116 izrule_getFirstStart(IZRule* rule, int32_t prevRawOffset, int32_t prevDSTSavings ,
117 UDate& result) {
118 return ((const InitialTimeZoneRule*)rule)->InitialTimeZoneRule::getFirstStar t(prevRawOffset, prevDSTSavings, result);
119 }
120
121 U_CAPI UBool U_EXPORT2
122 izrule_getFinalStart(IZRule* rule, int32_t prevRawOffset, int32_t prevDSTSavings ,
123 UDate& result) {
124 return ((InitialTimeZoneRule*)rule)->InitialTimeZoneRule::getFinalStart(prev RawOffset, prevDSTSavings, result);
125 }
126
127 U_CAPI UBool U_EXPORT2
128 izrule_getNextStart(IZRule* rule, UDate base, int32_t prevRawOffset,
129 int32_t prevDSTSavings, UBool inclusive, UDate& result) {
130 return ((InitialTimeZoneRule*)rule)->InitialTimeZoneRule::getNextStart(base, prevRawOffset, prevDSTSavings, inclusive, result);
131 }
132
133 U_CAPI UBool U_EXPORT2
134 izrule_getPreviousStart(IZRule* rule, UDate base, int32_t prevRawOffset,
135 int32_t prevDSTSavings, UBool inclusive, UDate& result) {
136 return ((InitialTimeZoneRule*)rule)->InitialTimeZoneRule::getPreviousStart(b ase, prevRawOffset, prevDSTSavings, inclusive, result);
137 }
138
139 U_CAPI UClassID U_EXPORT2
140 izrule_getStaticClassID(IZRule* rule) {
141 return ((InitialTimeZoneRule*)rule)->InitialTimeZoneRule::getStaticClassID() ;
142 }
143
144 U_CAPI UClassID U_EXPORT2
145 izrule_getDynamicClassID(IZRule* rule) {
146 return ((InitialTimeZoneRule*)rule)->InitialTimeZoneRule::getDynamicClassID( );
147 }
148
149 #endif
OLDNEW
« no previous file with comments | « icu46/source/i18n/zrule.h ('k') | icu46/source/i18n/zstrfmt.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698