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 "fpdfsdk/src/javascript/util.h" | 7 #include "fpdfsdk/javascript/util.h" |
8 | 8 |
9 #include <time.h> | 9 #include <time.h> |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "core/include/fxcrt/fx_ext.h" | 14 #include "core/include/fxcrt/fx_ext.h" |
15 #include "fpdfsdk/include/javascript/IJavaScript.h" | 15 #include "fpdfsdk/include/javascript/IJavaScript.h" |
16 #include "fpdfsdk/src/javascript/JS_Context.h" | 16 #include "fpdfsdk/javascript/JS_Context.h" |
17 #include "fpdfsdk/src/javascript/JS_Define.h" | 17 #include "fpdfsdk/javascript/JS_Define.h" |
18 #include "fpdfsdk/src/javascript/JS_EventHandler.h" | 18 #include "fpdfsdk/javascript/JS_EventHandler.h" |
19 #include "fpdfsdk/src/javascript/JS_Object.h" | 19 #include "fpdfsdk/javascript/JS_Object.h" |
20 #include "fpdfsdk/src/javascript/JS_Runtime.h" | 20 #include "fpdfsdk/javascript/JS_Runtime.h" |
21 #include "fpdfsdk/src/javascript/JS_Value.h" | 21 #include "fpdfsdk/javascript/JS_Value.h" |
22 #include "fpdfsdk/src/javascript/PublicMethods.h" | 22 #include "fpdfsdk/javascript/PublicMethods.h" |
23 #include "fpdfsdk/src/javascript/resource.h" | 23 #include "fpdfsdk/javascript/resource.h" |
24 | 24 |
25 #if _FX_OS_ == _FX_ANDROID_ | 25 #if _FX_OS_ == _FX_ANDROID_ |
26 #include <ctype.h> | 26 #include <ctype.h> |
27 #endif | 27 #endif |
28 | 28 |
29 BEGIN_JS_STATIC_CONST(CJS_Util) | 29 BEGIN_JS_STATIC_CONST(CJS_Util) |
30 END_JS_STATIC_CONST() | 30 END_JS_STATIC_CONST() |
31 | 31 |
32 BEGIN_JS_STATIC_PROP(CJS_Util) | 32 BEGIN_JS_STATIC_PROP(CJS_Util) |
33 END_JS_STATIC_PROP() | 33 END_JS_STATIC_PROP() |
34 | 34 |
35 BEGIN_JS_STATIC_METHOD(CJS_Util) | 35 BEGIN_JS_STATIC_METHOD(CJS_Util) |
36 JS_STATIC_METHOD_ENTRY(printd) | 36 JS_STATIC_METHOD_ENTRY(printd) |
37 JS_STATIC_METHOD_ENTRY(printf) | 37 JS_STATIC_METHOD_ENTRY(printf) |
38 JS_STATIC_METHOD_ENTRY(printx) | 38 JS_STATIC_METHOD_ENTRY(printx) |
39 JS_STATIC_METHOD_ENTRY(scand) | 39 JS_STATIC_METHOD_ENTRY(scand) |
40 JS_STATIC_METHOD_ENTRY(byteToChar) | 40 JS_STATIC_METHOD_ENTRY(byteToChar) |
41 END_JS_STATIC_METHOD() | 41 END_JS_STATIC_METHOD() |
42 | 42 |
43 IMPLEMENT_JS_CLASS(CJS_Util, util) | 43 IMPLEMENT_JS_CLASS(CJS_Util, util) |
44 | 44 |
45 util::util(CJS_Object* pJSObject) : CJS_EmbedObj(pJSObject) {} | 45 util::util(CJS_Object* pJSObject) : CJS_EmbedObj(pJSObject) {} |
46 | 46 |
47 util::~util() { | 47 util::~util() {} |
48 } | |
49 | 48 |
50 struct stru_TbConvert { | 49 struct stru_TbConvert { |
51 const FX_WCHAR* lpszJSMark; | 50 const FX_WCHAR* lpszJSMark; |
52 const FX_WCHAR* lpszCppMark; | 51 const FX_WCHAR* lpszCppMark; |
53 }; | 52 }; |
54 | 53 |
55 const stru_TbConvert fcTable[] = { | 54 const stru_TbConvert fcTable[] = { |
56 {L"mmmm", L"%B"}, | 55 {L"mmmm", L"%B"}, |
57 {L"mmm", L"%b"}, | 56 {L"mmm", L"%b"}, |
58 {L"mm", L"%m"}, | 57 {L"mm", L"%m"}, |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 int iSize = params.size(); | 521 int iSize = params.size(); |
523 if (iSize == 0) | 522 if (iSize == 0) |
524 return FALSE; | 523 return FALSE; |
525 int nByte = params[0].ToInt(); | 524 int nByte = params[0].ToInt(); |
526 unsigned char cByte = (unsigned char)nByte; | 525 unsigned char cByte = (unsigned char)nByte; |
527 CFX_WideString csValue; | 526 CFX_WideString csValue; |
528 csValue.Format(L"%c", cByte); | 527 csValue.Format(L"%c", cByte); |
529 vRet = csValue.c_str(); | 528 vRet = csValue.c_str(); |
530 return TRUE; | 529 return TRUE; |
531 } | 530 } |
OLD | NEW |