OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "xfa/fxfa/parser/xfa_localemgr.h" | 7 #include "xfa/fxfa/parser/xfa_localemgr.h" |
8 | 8 |
9 #include "core/fxcrt/include/fx_xml.h" | 9 #include "core/fxcrt/include/fx_xml.h" |
10 #include "core/include/fxcodec/fx_codec.h" | 10 #include "core/include/fxcodec/fx_codec.h" |
(...skipping 1251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1262 pCommon ? pCommon->GetFirstChildByClass(XFA_ELEMENT_Locale) : NULL; | 1262 pCommon ? pCommon->GetFirstChildByClass(XFA_ELEMENT_Locale) : NULL; |
1263 if (pLocale) { | 1263 if (pLocale) { |
1264 pLocale->TryCData(XFA_ATTRIBUTE_Value, m_wsConfigLocale, FALSE); | 1264 pLocale->TryCData(XFA_ATTRIBUTE_Value, m_wsConfigLocale, FALSE); |
1265 } | 1265 } |
1266 } | 1266 } |
1267 m_dwLocaleFlags |= 0x01; | 1267 m_dwLocaleFlags |= 0x01; |
1268 } | 1268 } |
1269 return m_wsConfigLocale; | 1269 return m_wsConfigLocale; |
1270 } | 1270 } |
1271 static CXFA_TimeZoneProvider* g_pProvider = NULL; | 1271 static CXFA_TimeZoneProvider* g_pProvider = NULL; |
1272 IXFA_TimeZoneProvider* IXFA_TimeZoneProvider::Create() { | 1272 |
| 1273 // Static. |
| 1274 CXFA_TimeZoneProvider* CXFA_TimeZoneProvider::Create() { |
1273 FXSYS_assert(!g_pProvider); | 1275 FXSYS_assert(!g_pProvider); |
1274 g_pProvider = new CXFA_TimeZoneProvider(); | 1276 g_pProvider = new CXFA_TimeZoneProvider(); |
1275 return g_pProvider; | 1277 return g_pProvider; |
1276 } | 1278 } |
1277 IXFA_TimeZoneProvider* IXFA_TimeZoneProvider::Get() { | 1279 |
| 1280 // Static. |
| 1281 CXFA_TimeZoneProvider* CXFA_TimeZoneProvider::Get() { |
1278 if (!g_pProvider) { | 1282 if (!g_pProvider) { |
1279 g_pProvider = new CXFA_TimeZoneProvider(); | 1283 g_pProvider = new CXFA_TimeZoneProvider(); |
1280 } | 1284 } |
1281 return g_pProvider; | 1285 return g_pProvider; |
1282 } | 1286 } |
1283 void IXFA_TimeZoneProvider::Destroy() { | 1287 |
| 1288 // Static. |
| 1289 void CXFA_TimeZoneProvider::Destroy() { |
1284 delete g_pProvider; | 1290 delete g_pProvider; |
1285 g_pProvider = NULL; | 1291 g_pProvider = NULL; |
1286 } | 1292 } |
| 1293 |
1287 #include <time.h> | 1294 #include <time.h> |
1288 CXFA_TimeZoneProvider::CXFA_TimeZoneProvider() { | 1295 CXFA_TimeZoneProvider::CXFA_TimeZoneProvider() { |
1289 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 1296 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
1290 _tzset(); | 1297 _tzset(); |
1291 m_tz.tzHour = (int8_t)(_timezone / 3600 * -1); | 1298 m_tz.tzHour = (int8_t)(_timezone / 3600 * -1); |
1292 m_tz.tzMinute = (int8_t)((FXSYS_abs(_timezone) % 3600) / 60); | 1299 m_tz.tzMinute = (int8_t)((FXSYS_abs(_timezone) % 3600) / 60); |
1293 #else | 1300 #else |
1294 tzset(); | 1301 tzset(); |
1295 m_tz.tzHour = (int8_t)(timezone / 3600 * -1); | 1302 m_tz.tzHour = (int8_t)(timezone / 3600 * -1); |
1296 m_tz.tzMinute = (int8_t)((FXSYS_abs((int)timezone) % 3600) / 60); | 1303 m_tz.tzMinute = (int8_t)((FXSYS_abs((int)timezone) % 3600) / 60); |
1297 #endif | 1304 #endif |
1298 } | 1305 } |
1299 CXFA_TimeZoneProvider::~CXFA_TimeZoneProvider() {} | 1306 CXFA_TimeZoneProvider::~CXFA_TimeZoneProvider() {} |
1300 void CXFA_TimeZoneProvider::SetTimeZone(FX_TIMEZONE& tz) { | 1307 void CXFA_TimeZoneProvider::SetTimeZone(FX_TIMEZONE& tz) { |
1301 m_tz = tz; | 1308 m_tz = tz; |
1302 } | 1309 } |
1303 void CXFA_TimeZoneProvider::GetTimeZone(FX_TIMEZONE& tz) { | 1310 void CXFA_TimeZoneProvider::GetTimeZone(FX_TIMEZONE& tz) { |
1304 tz = m_tz; | 1311 tz = m_tz; |
1305 } | 1312 } |
OLD | NEW |