John Abd-El-Malek | 5110c47 | 2014-05-17 22:33:34 -0700 | [diff] [blame] | 1 | // Copyright 2014 PDFium Authors. All rights reserved.
|
| 2 | // Use of this source code is governed by a BSD-style license that can be
|
| 3 | // found in the LICENSE file.
|
| 4 |
|
| 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
|
| 6 |
|
| 7 | #ifndef _PUBLICMETHODS_H_
|
| 8 | #define _PUBLICMETHODS_H_
|
| 9 |
|
| 10 | class CJS_PublicMethods : public CJS_Object
|
| 11 | {
|
| 12 | public:
|
| 13 | CJS_PublicMethods(JSFXObject pObject) : CJS_Object(pObject) {};
|
| 14 | virtual ~CJS_PublicMethods(void){};
|
| 15 |
|
| 16 | public:
|
| 17 | static FX_BOOL AFNumber_Format(OBJ_METHOD_PARAMS);
|
| 18 | static FX_BOOL AFNumber_Keystroke(OBJ_METHOD_PARAMS);
|
| 19 | static FX_BOOL AFPercent_Format(OBJ_METHOD_PARAMS);
|
| 20 | static FX_BOOL AFPercent_Keystroke(OBJ_METHOD_PARAMS);
|
| 21 | static FX_BOOL AFDate_FormatEx(OBJ_METHOD_PARAMS);
|
| 22 | static FX_BOOL AFDate_KeystrokeEx(OBJ_METHOD_PARAMS);
|
| 23 | static FX_BOOL AFDate_Format(OBJ_METHOD_PARAMS);
|
| 24 | static FX_BOOL AFDate_Keystroke(OBJ_METHOD_PARAMS);
|
| 25 | static FX_BOOL AFTime_FormatEx(OBJ_METHOD_PARAMS); //
|
| 26 | static FX_BOOL AFTime_KeystrokeEx(OBJ_METHOD_PARAMS);
|
| 27 | static FX_BOOL AFTime_Format(OBJ_METHOD_PARAMS);
|
| 28 | static FX_BOOL AFTime_Keystroke(OBJ_METHOD_PARAMS);
|
| 29 | static FX_BOOL AFSpecial_Format(OBJ_METHOD_PARAMS);
|
| 30 | static FX_BOOL AFSpecial_Keystroke(OBJ_METHOD_PARAMS);
|
| 31 | static FX_BOOL AFSpecial_KeystrokeEx(OBJ_METHOD_PARAMS);//
|
| 32 | static FX_BOOL AFSimple(OBJ_METHOD_PARAMS);
|
| 33 | static FX_BOOL AFMakeNumber(OBJ_METHOD_PARAMS);
|
| 34 | static FX_BOOL AFSimple_Calculate(OBJ_METHOD_PARAMS);
|
| 35 | static FX_BOOL AFRange_Validate(OBJ_METHOD_PARAMS);
|
| 36 | static FX_BOOL AFMergeChange(OBJ_METHOD_PARAMS);
|
| 37 | static FX_BOOL AFParseDateEx(OBJ_METHOD_PARAMS);
|
| 38 | static FX_BOOL AFExtractNums(OBJ_METHOD_PARAMS);
|
| 39 |
|
| 40 | public:
|
| 41 | JS_STATIC_GLOBAL_FUN(AFNumber_Format);
|
| 42 | JS_STATIC_GLOBAL_FUN(AFNumber_Keystroke);
|
| 43 | JS_STATIC_GLOBAL_FUN(AFPercent_Format);
|
| 44 | JS_STATIC_GLOBAL_FUN(AFPercent_Keystroke);
|
| 45 | JS_STATIC_GLOBAL_FUN(AFDate_FormatEx);
|
| 46 | JS_STATIC_GLOBAL_FUN(AFDate_KeystrokeEx);
|
| 47 | JS_STATIC_GLOBAL_FUN(AFDate_Format);
|
| 48 | JS_STATIC_GLOBAL_FUN(AFDate_Keystroke);
|
| 49 | JS_STATIC_GLOBAL_FUN(AFTime_FormatEx);
|
| 50 | JS_STATIC_GLOBAL_FUN(AFTime_KeystrokeEx);
|
| 51 | JS_STATIC_GLOBAL_FUN(AFTime_Format);
|
| 52 | JS_STATIC_GLOBAL_FUN(AFTime_Keystroke);
|
| 53 | JS_STATIC_GLOBAL_FUN(AFSpecial_Format);
|
| 54 | JS_STATIC_GLOBAL_FUN(AFSpecial_Keystroke);
|
| 55 | JS_STATIC_GLOBAL_FUN(AFSpecial_KeystrokeEx);
|
| 56 | JS_STATIC_GLOBAL_FUN(AFSimple);
|
| 57 | JS_STATIC_GLOBAL_FUN(AFMakeNumber);
|
| 58 | JS_STATIC_GLOBAL_FUN(AFSimple_Calculate);
|
| 59 | JS_STATIC_GLOBAL_FUN(AFRange_Validate);
|
| 60 | JS_STATIC_GLOBAL_FUN(AFMergeChange);
|
| 61 | JS_STATIC_GLOBAL_FUN(AFParseDateEx);
|
| 62 | JS_STATIC_GLOBAL_FUN(AFExtractNums);
|
| 63 |
|
| 64 | JS_STATIC_DECLARE_GLOBAL_FUN();
|
| 65 |
|
| 66 | public:
|
| 67 | static int ParseStringInteger(const CFX_WideString & string,int nStart,int & nSkip, int nMaxStep);
|
| 68 | static CFX_WideString ParseStringString(const CFX_WideString& string, int nStart, int& nSkip);
|
| 69 | static double MakeRegularDate(const CFX_WideString & value,const CFX_WideString & format, FX_BOOL& bWrongFormat);
|
| 70 | static CFX_WideString MakeFormatDate(double dDate,const CFX_WideString & format);
|
| 71 | static FX_BOOL ConvertStringToNumber(FX_LPCWSTR swSource, double & dRet, FX_BOOL & bDot);
|
| 72 | static double ParseStringToNumber(FX_LPCWSTR swSource);
|
| 73 | static double ParseNormalDate(const CFX_WideString & value, FX_BOOL& bWrongFormat);
|
| 74 | static double MakeInterDate(CFX_WideString strValue);
|
| 75 | static double ParseNumber(FX_LPCWSTR swSource, FX_BOOL& bAllDigits, FX_BOOL& bDot, FX_BOOL& bSign, FX_BOOL& bKXJS);
|
| 76 |
|
| 77 | public:
|
| 78 | static CFX_WideString StrLTrim(FX_LPCWSTR pStr);
|
| 79 | static CFX_WideString StrRTrim(FX_LPCWSTR pStr);
|
| 80 | static CFX_WideString StrTrim(FX_LPCWSTR pStr);
|
| 81 |
|
| 82 | static CFX_ByteString StrLTrim(FX_LPCSTR pStr);
|
| 83 | static CFX_ByteString StrRTrim(FX_LPCSTR pStr);
|
| 84 | static CFX_ByteString StrTrim(FX_LPCSTR pStr);
|
| 85 |
|
| 86 | static FX_BOOL IsNumber(FX_LPCSTR string);
|
| 87 | static FX_BOOL IsNumber(FX_LPCWSTR string);
|
| 88 |
|
| 89 | static FX_BOOL IsDigit(char ch);
|
| 90 | static FX_BOOL IsDigit(wchar_t ch);
|
| 91 | static FX_BOOL IsAlphabetic(wchar_t ch);
|
| 92 | static FX_BOOL IsAlphaNumeric(wchar_t ch);
|
| 93 |
|
| 94 | static FX_BOOL maskSatisfied(wchar_t c_Change,wchar_t c_Mask);
|
| 95 | static FX_BOOL isReservedMaskChar(wchar_t ch);
|
| 96 |
|
| 97 | static double AF_Simple(FX_LPCWSTR sFuction, double dValue1, double dValue2);
|
| 98 | static CJS_Array AF_MakeArrayFromList(v8::Isolate* isolate, CJS_Value val);
|
| 99 | };
|
| 100 |
|
| 101 | #endif //_PUBLICMETHODS_H_
|