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 #ifndef FPDFSDK_JAVASCRIPT_UTIL_H_ | 7 #ifndef FPDFSDK_JAVASCRIPT_UTIL_H_ |
8 #define FPDFSDK_JAVASCRIPT_UTIL_H_ | 8 #define FPDFSDK_JAVASCRIPT_UTIL_H_ |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "fpdfsdk/javascript/JS_Define.h" | 13 #include "fpdfsdk/javascript/JS_Define.h" |
14 | 14 |
15 class util : public CJS_EmbedObj { | 15 class util : public CJS_EmbedObj { |
16 public: | 16 public: |
17 util(CJS_Object* pJSObject); | 17 util(CJS_Object* pJSObject); |
18 ~util() override; | 18 ~util() override; |
19 | 19 |
20 public: | |
21 FX_BOOL printd(IJS_Context* cc, | 20 FX_BOOL printd(IJS_Context* cc, |
22 const std::vector<CJS_Value>& params, | 21 const std::vector<CJS_Value>& params, |
23 CJS_Value& vRet, | 22 CJS_Value& vRet, |
24 CFX_WideString& sError); | 23 CFX_WideString& sError); |
25 FX_BOOL printf(IJS_Context* cc, | 24 FX_BOOL printf(IJS_Context* cc, |
26 const std::vector<CJS_Value>& params, | 25 const std::vector<CJS_Value>& params, |
27 CJS_Value& vRet, | 26 CJS_Value& vRet, |
28 CFX_WideString& sError); | 27 CFX_WideString& sError); |
29 FX_BOOL printx(IJS_Context* cc, | 28 FX_BOOL printx(IJS_Context* cc, |
30 const std::vector<CJS_Value>& params, | 29 const std::vector<CJS_Value>& params, |
31 CJS_Value& vRet, | 30 CJS_Value& vRet, |
32 CFX_WideString& sError); | 31 CFX_WideString& sError); |
33 FX_BOOL scand(IJS_Context* cc, | 32 FX_BOOL scand(IJS_Context* cc, |
34 const std::vector<CJS_Value>& params, | 33 const std::vector<CJS_Value>& params, |
35 CJS_Value& vRet, | 34 CJS_Value& vRet, |
36 CFX_WideString& sError); | 35 CFX_WideString& sError); |
37 FX_BOOL byteToChar(IJS_Context* cc, | 36 FX_BOOL byteToChar(IJS_Context* cc, |
38 const std::vector<CJS_Value>& params, | 37 const std::vector<CJS_Value>& params, |
39 CJS_Value& vRet, | 38 CJS_Value& vRet, |
40 CFX_WideString& sError); | 39 CFX_WideString& sError); |
41 | 40 |
42 public: | |
43 static void printd(const std::wstring& cFormat, | |
44 CJS_Date Date, | |
45 bool bXFAPicture, | |
46 std::wstring& cPurpose); | |
47 static void printx(const std::string& cFormat, | 41 static void printx(const std::string& cFormat, |
48 const std::string& cSource, | 42 const std::string& cSource, |
49 std::string& cPurpose); | 43 std::string& cPurpose); |
50 static int ParstDataType(std::wstring* sFormat); | |
51 }; | 44 }; |
52 | 45 |
53 class CJS_Util : public CJS_Object { | 46 class CJS_Util : public CJS_Object { |
54 public: | 47 public: |
55 CJS_Util(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {} | 48 CJS_Util(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {} |
56 ~CJS_Util() override {} | 49 ~CJS_Util() override {} |
57 | 50 |
58 DECLARE_JS_CLASS(); | 51 DECLARE_JS_CLASS(); |
59 | 52 |
60 JS_STATIC_METHOD(printd, util); | 53 JS_STATIC_METHOD(printd, util); |
61 JS_STATIC_METHOD(printf, util); | 54 JS_STATIC_METHOD(printf, util); |
62 JS_STATIC_METHOD(printx, util); | 55 JS_STATIC_METHOD(printx, util); |
63 JS_STATIC_METHOD(scand, util); | 56 JS_STATIC_METHOD(scand, util); |
64 JS_STATIC_METHOD(byteToChar, util); | 57 JS_STATIC_METHOD(byteToChar, util); |
65 }; | 58 }; |
66 | 59 |
67 #endif // FPDFSDK_JAVASCRIPT_UTIL_H_ | 60 #endif // FPDFSDK_JAVASCRIPT_UTIL_H_ |
OLD | NEW |