Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/intl/icu/source/i18n/vzone.cpp
Line
Count
Source (jump to first uncovered line)
1
// © 2016 and later: Unicode, Inc. and others.
2
// License & terms of use: http://www.unicode.org/copyright.html
3
/*
4
*******************************************************************************
5
* Copyright (C) 2009-2011, International Business Machines Corporation and
6
* others. All Rights Reserved.
7
*******************************************************************************
8
*/
9
10
/**
11
 * \file 
12
 * \brief C API: VTimeZone classes
13
 */
14
15
#include "unicode/utypes.h"
16
17
#if !UCONFIG_NO_FORMATTING
18
19
#include "unicode/uobject.h"
20
#include "vzone.h"
21
#include "unicode/vtzone.h"
22
#include "cmemory.h"
23
#include "unicode/ustring.h"
24
#include "unicode/parsepos.h"
25
26
U_NAMESPACE_USE
27
28
U_CAPI VZone* U_EXPORT2
29
0
vzone_openID(const UChar* ID, int32_t idLength){
30
0
    UnicodeString s(idLength==-1, ID, idLength);
31
0
    return (VZone*) (VTimeZone::createVTimeZoneByID(s));
32
0
}
33
    
34
U_CAPI VZone* U_EXPORT2
35
0
vzone_openData(const UChar* vtzdata, int32_t vtzdataLength, UErrorCode& status) {
36
0
    UnicodeString s(vtzdataLength==-1, vtzdata, vtzdataLength);
37
0
    return (VZone*) (VTimeZone::createVTimeZone(s,status));
38
0
}
39
40
U_CAPI void U_EXPORT2
41
0
vzone_close(VZone* zone) {
42
0
    delete (VTimeZone*)zone;
43
0
}
44
45
U_CAPI VZone* U_EXPORT2
46
0
vzone_clone(const VZone *zone) {
47
0
    return (VZone*) (((VTimeZone*)zone)->VTimeZone::clone());
48
0
}
49
50
U_CAPI UBool U_EXPORT2
51
0
vzone_equals(const VZone* zone1, const VZone* zone2) {
52
0
    return *(const VTimeZone*)zone1 == *(const VTimeZone*)zone2;
53
0
}
54
55
U_CAPI UBool U_EXPORT2
56
0
vzone_getTZURL(VZone* zone, UChar* & url, int32_t & urlLength) {
57
0
    UnicodeString s;
58
0
    UBool b = ((VTimeZone*)zone)->VTimeZone::getTZURL(s);
59
0
60
0
    urlLength = s.length();
61
0
    memcpy(url,s.getBuffer(),urlLength);
62
0
    
63
0
    return b;
64
0
}
65
66
U_CAPI void U_EXPORT2
67
0
vzone_setTZURL(VZone* zone, UChar* url, int32_t urlLength) {
68
0
    UnicodeString s(urlLength==-1, url, urlLength);
69
0
    ((VTimeZone*)zone)->VTimeZone::setTZURL(s);
70
0
}
71
72
U_CAPI UBool U_EXPORT2
73
0
vzone_getLastModified(VZone* zone, UDate& lastModified) {
74
0
    return ((VTimeZone*)zone)->VTimeZone::getLastModified(lastModified);
75
0
}
76
77
U_CAPI void U_EXPORT2
78
0
vzone_setLastModified(VZone* zone, UDate lastModified) {
79
0
    return ((VTimeZone*)zone)->VTimeZone::setLastModified(lastModified);
80
0
}
81
82
U_CAPI void U_EXPORT2
83
0
vzone_write(VZone* zone, UChar* & result, int32_t & resultLength, UErrorCode& status) {
84
0
    UnicodeString s;
85
0
    ((VTimeZone*)zone)->VTimeZone::write(s, status);
86
0
87
0
    resultLength = s.length();
88
0
    result = (UChar*)uprv_malloc(resultLength);
89
0
    memcpy(result,s.getBuffer(),resultLength);
90
0
91
0
    return;
92
0
}
93
94
U_CAPI void U_EXPORT2
95
0
vzone_writeFromStart(VZone* zone, UDate start, UChar* & result, int32_t & resultLength, UErrorCode& status) {
96
0
    UnicodeString s;
97
0
    ((VTimeZone*)zone)->VTimeZone::write(start, s, status);
98
0
99
0
    resultLength = s.length();
100
0
    result = (UChar*)uprv_malloc(resultLength);
101
0
    memcpy(result,s.getBuffer(),resultLength);
102
0
103
0
    return;
104
0
}
105
106
U_CAPI void U_EXPORT2
107
0
vzone_writeSimple(VZone* zone, UDate time, UChar* & result, int32_t & resultLength, UErrorCode& status) {
108
0
    UnicodeString s;
109
0
    ((VTimeZone*)zone)->VTimeZone::writeSimple(time, s, status);
110
0
111
0
    resultLength = s.length();
112
0
    result = (UChar*)uprv_malloc(resultLength);
113
0
    memcpy(result,s.getBuffer(),resultLength);
114
0
115
0
    return;
116
0
}
117
118
U_CAPI int32_t U_EXPORT2
119
vzone_getOffset(VZone* zone, uint8_t era, int32_t year, int32_t month, int32_t day,
120
0
                uint8_t dayOfWeek, int32_t millis, UErrorCode& status) {
121
0
    return ((VTimeZone*)zone)->VTimeZone::getOffset(era, year, month, day, dayOfWeek, millis, status);
122
0
}
123
124
U_CAPI int32_t U_EXPORT2
125
vzone_getOffset2(VZone* zone, uint8_t era, int32_t year, int32_t month, int32_t day,
126
                uint8_t dayOfWeek, int32_t millis,
127
0
                int32_t monthLength, UErrorCode& status) {
128
0
    return ((VTimeZone*)zone)->VTimeZone::getOffset(era, year, month, day, dayOfWeek, millis, monthLength, status);
129
0
}
130
131
U_CAPI void U_EXPORT2
132
vzone_getOffset3(VZone* zone, UDate date, UBool local, int32_t& rawOffset,
133
0
                int32_t& dstOffset, UErrorCode& ec) {
134
0
    return ((VTimeZone*)zone)->VTimeZone::getOffset(date, local, rawOffset, dstOffset, ec);
135
0
}
136
137
U_CAPI void U_EXPORT2
138
0
vzone_setRawOffset(VZone* zone, int32_t offsetMillis) {
139
0
    return ((VTimeZone*)zone)->VTimeZone::setRawOffset(offsetMillis);
140
0
}
141
142
U_CAPI int32_t U_EXPORT2
143
0
vzone_getRawOffset(VZone* zone) {
144
0
    return ((VTimeZone*)zone)->VTimeZone::getRawOffset();
145
0
}
146
147
U_CAPI UBool U_EXPORT2
148
0
vzone_useDaylightTime(VZone* zone) {
149
0
    return ((VTimeZone*)zone)->VTimeZone::useDaylightTime();
150
0
}
151
152
U_CAPI UBool U_EXPORT2
153
0
vzone_inDaylightTime(VZone* zone, UDate date, UErrorCode& status) {
154
0
    return ((VTimeZone*)zone)->VTimeZone::inDaylightTime(date, status);
155
0
}
156
157
U_CAPI UBool U_EXPORT2
158
0
vzone_hasSameRules(VZone* zone, const VZone* other) {
159
0
    return ((VTimeZone*)zone)->VTimeZone::hasSameRules(*(VTimeZone*)other);
160
0
}
161
162
U_CAPI UBool U_EXPORT2
163
0
vzone_getNextTransition(VZone* zone, UDate base, UBool inclusive, ZTrans* result) {
164
0
    return ((VTimeZone*)zone)->VTimeZone::getNextTransition(base, inclusive, *(TimeZoneTransition*)result);
165
0
}
166
167
U_CAPI UBool U_EXPORT2
168
0
vzone_getPreviousTransition(VZone* zone, UDate base, UBool inclusive, ZTrans* result) {
169
0
    return ((VTimeZone*)zone)->VTimeZone::getPreviousTransition(base, inclusive, *(TimeZoneTransition*)result);
170
0
}
171
172
U_CAPI int32_t U_EXPORT2
173
0
vzone_countTransitionRules(VZone* zone, UErrorCode& status) {
174
0
    return ((VTimeZone*)zone)->VTimeZone::countTransitionRules(status);
175
0
}
176
177
U_CAPI UClassID U_EXPORT2
178
0
vzone_getStaticClassID(VZone* zone) {
179
0
    return ((VTimeZone*)zone)->VTimeZone::getStaticClassID();
180
0
}
181
182
U_CAPI UClassID U_EXPORT2
183
0
vzone_getDynamicClassID(VZone* zone) {
184
0
    return ((VTimeZone*)zone)->VTimeZone::getDynamicClassID();
185
0
}
186
187
#endif