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_localevalue.h" | 7 #include "xfa/fxfa/parser/xfa_localevalue.h" |
8 | 8 |
9 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" | 9 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" |
10 #include "xfa/fxfa/parser/xfa_docdata.h" | 10 #include "xfa/fxfa/parser/xfa_docdata.h" |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 CFX_Unitime dt; | 362 CFX_Unitime dt; |
363 FX_DateFromCanonical(m_wsValue, dt); | 363 FX_DateFromCanonical(m_wsValue, dt); |
364 return dt; | 364 return dt; |
365 } | 365 } |
366 return CFX_Unitime(); | 366 return CFX_Unitime(); |
367 } | 367 } |
368 CFX_Unitime CXFA_LocaleValue::GetTime() const { | 368 CFX_Unitime CXFA_LocaleValue::GetTime() const { |
369 if (m_bValid && m_dwType == XFA_VT_TIME) { | 369 if (m_bValid && m_dwType == XFA_VT_TIME) { |
370 CFX_Unitime dt(0); | 370 CFX_Unitime dt(0); |
371 FXSYS_assert(m_pLocaleMgr); | 371 FXSYS_assert(m_pLocaleMgr); |
372 FX_TimeFromCanonical(m_wsValue, dt, m_pLocaleMgr->GetDefLocale()); | 372 FX_TimeFromCanonical(m_wsValue.AsWideStringC(), dt, |
| 373 m_pLocaleMgr->GetDefLocale()); |
373 return dt; | 374 return dt; |
374 } | 375 } |
375 return CFX_Unitime(); | 376 return CFX_Unitime(); |
376 } | 377 } |
377 CFX_Unitime CXFA_LocaleValue::GetDateTime() const { | 378 CFX_Unitime CXFA_LocaleValue::GetDateTime() const { |
378 if (m_bValid && m_dwType == XFA_VT_DATETIME) { | 379 if (m_bValid && m_dwType == XFA_VT_DATETIME) { |
379 int32_t index = m_wsValue.Find('T'); | 380 int32_t index = m_wsValue.Find('T'); |
380 CFX_Unitime dt; | 381 CFX_Unitime dt; |
381 FX_DateFromCanonical(m_wsValue.Left(index), dt); | 382 FX_DateFromCanonical(m_wsValue.Left(index), dt); |
382 FXSYS_assert(m_pLocaleMgr); | 383 FXSYS_assert(m_pLocaleMgr); |
383 FX_TimeFromCanonical(m_wsValue.Right(m_wsValue.GetLength() - index - 1), dt, | 384 FX_TimeFromCanonical( |
384 m_pLocaleMgr->GetDefLocale()); | 385 m_wsValue.Right(m_wsValue.GetLength() - index - 1).AsWideStringC(), dt, |
| 386 m_pLocaleMgr->GetDefLocale()); |
385 return dt; | 387 return dt; |
386 } | 388 } |
387 return CFX_Unitime(); | 389 return CFX_Unitime(); |
388 } | 390 } |
389 FX_BOOL CXFA_LocaleValue::SetText(const CFX_WideString& wsText) { | 391 FX_BOOL CXFA_LocaleValue::SetText(const CFX_WideString& wsText) { |
390 m_dwType = XFA_VT_TEXT; | 392 m_dwType = XFA_VT_TEXT; |
391 m_wsValue = wsText; | 393 m_wsValue = wsText; |
392 return TRUE; | 394 return TRUE; |
393 } | 395 } |
394 FX_BOOL CXFA_LocaleValue::SetText(const CFX_WideString& wsText, | 396 FX_BOOL CXFA_LocaleValue::SetText(const CFX_WideString& wsText, |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
972 } else if (cf == L'z') { | 974 } else if (cf == L'z') { |
973 nf++; | 975 nf++; |
974 } else { | 976 } else { |
975 return FALSE; | 977 return FALSE; |
976 } | 978 } |
977 } | 979 } |
978 n++; | 980 n++; |
979 } | 981 } |
980 return n == nCount; | 982 return n == nCount; |
981 } | 983 } |
OLD | NEW |