MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / IcuCalendarWrapper

Class IcuCalendarWrapper

src/common/TimeZoneUtil.h:144–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142};
143
144class IcuCalendarWrapper
145{
146public:
147 IcuCalendarWrapper(UCalendar* aWrapped, std::atomic<UCalendar*>* aCachePtr)
148 : wrapped(aWrapped),
149 cachePtr(aCachePtr)
150 {}
151
152 IcuCalendarWrapper(IcuCalendarWrapper&& o)
153 : wrapped(o.wrapped),
154 cachePtr(o.cachePtr)
155 {
156 o.wrapped = nullptr;
157 }
158
159 ~IcuCalendarWrapper()
160 {
161 if (wrapped)
162 {
163 auto newCached = cachePtr->exchange(wrapped);
164
165 if (newCached)
166 {
167 auto& icuLib = Jrd::UnicodeUtil::getConversionICU();
168 icuLib.ucalClose(newCached);
169 }
170 }
171 }
172
173 IcuCalendarWrapper(const IcuCalendarWrapper&) = delete;
174 IcuCalendarWrapper& operator=(const IcuCalendarWrapper&) = delete;
175
176public:
177 UCalendar* operator->()
178 {
179 return wrapped;
180 }
181
182 operator UCalendar*()
183 {
184 return wrapped;
185 }
186
187 bool operator!() const
188 {
189 return !wrapped;
190 }
191
192private:
193 UCalendar* wrapped;
194 std::atomic<UCalendar*>* cachePtr;
195};
196
197class TimeZoneRuleIterator
198{

Callers 1

getCalendarMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected