Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cjs_publicmethods.h
Go to the documentation of this file.
1// Copyright 2014 The PDFium Authors
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 FXJS_CJS_PUBLICMETHODS_H_
8#define FXJS_CJS_PUBLICMETHODS_H_
9
10#include <vector>
11
12#include "fxjs/cjs_object.h"
13#include "fxjs/cjs_result.h"
14#include "third_party/base/containers/span.h"
15
16class CJS_PublicMethods final : public CJS_Object {
17 public:
19
20 static void DefineJSObjects(CFXJS_Engine* pEngine);
21
22 static double ParseDate(v8::Isolate* isolate,
23 const WideString& value,
24 bool* bWrongFormat);
25 static double ParseDateAsGMT(v8::Isolate* isolate, const WideString& value);
26 static double ParseDateUsingFormat(v8::Isolate* isolate,
27 const WideString& value,
28 const WideString& format,
29 bool* bWrongFormat);
30
31 // Exposed for testing.
32 static WideString PrintDateUsingFormat(double dDate,
33 const WideString& format);
34 static bool IsNumber(const WideString& str);
35
36 static CJS_Result AFNumber_Format(CJS_Runtime* pRuntime,
39 CJS_Runtime* pRuntime,
41 static CJS_Result AFPercent_Format(CJS_Runtime* pRuntime,
44 CJS_Runtime* pRuntime,
46 static CJS_Result AFDate_FormatEx(CJS_Runtime* pRuntime,
49 CJS_Runtime* pRuntime,
51 static CJS_Result AFDate_Format(CJS_Runtime* pRuntime,
53 static CJS_Result AFDate_Keystroke(CJS_Runtime* pRuntime,
55 static CJS_Result AFTime_FormatEx(CJS_Runtime* pRuntime,
58 CJS_Runtime* pRuntime,
60 static CJS_Result AFTime_Format(CJS_Runtime* pRuntime,
62 static CJS_Result AFTime_Keystroke(CJS_Runtime* pRuntime,
64 static CJS_Result AFSpecial_Format(CJS_Runtime* pRuntime,
67 CJS_Runtime* pRuntime,
70 CJS_Runtime* pRuntime,
72 static CJS_Result AFSimple(CJS_Runtime* pRuntime,
74 static CJS_Result AFMakeNumber(CJS_Runtime* pRuntime,
77 CJS_Runtime* pRuntime,
79 static CJS_Result AFRange_Validate(CJS_Runtime* pRuntime,
81 static CJS_Result AFMergeChange(CJS_Runtime* pRuntime,
83 static CJS_Result AFParseDateEx(CJS_Runtime* pRuntime,
85 static CJS_Result AFExtractNums(CJS_Runtime* pRuntime,
87
89 const v8::FunctionCallbackInfo<v8::Value>& info);
91 const v8::FunctionCallbackInfo<v8::Value>& info);
93 const v8::FunctionCallbackInfo<v8::Value>& info);
95 const v8::FunctionCallbackInfo<v8::Value>& info);
97 const v8::FunctionCallbackInfo<v8::Value>& info);
99 const v8::FunctionCallbackInfo<v8::Value>& info);
101 const v8::FunctionCallbackInfo<v8::Value>& info);
103 const v8::FunctionCallbackInfo<v8::Value>& info);
105 const v8::FunctionCallbackInfo<v8::Value>& info);
107 const v8::FunctionCallbackInfo<v8::Value>& info);
109 const v8::FunctionCallbackInfo<v8::Value>& info);
111 const v8::FunctionCallbackInfo<v8::Value>& info);
113 const v8::FunctionCallbackInfo<v8::Value>& info);
115 const v8::FunctionCallbackInfo<v8::Value>& info);
117 const v8::FunctionCallbackInfo<v8::Value>& info);
118 static void AFSimple_static(const v8::FunctionCallbackInfo<v8::Value>& info);
120 const v8::FunctionCallbackInfo<v8::Value>& info);
122 const v8::FunctionCallbackInfo<v8::Value>& info);
124 const v8::FunctionCallbackInfo<v8::Value>& info);
126 const v8::FunctionCallbackInfo<v8::Value>& info);
128 const v8::FunctionCallbackInfo<v8::Value>& info);
130 const v8::FunctionCallbackInfo<v8::Value>& info);
131
132 static bool MaskSatisfied(wchar_t c_Change, wchar_t c_Mask);
133 static bool IsReservedMaskChar(wchar_t ch);
134 static v8::Local<v8::Array> AF_MakeArrayFromList(CJS_Runtime* pRuntime,
135 v8::Local<v8::Value> val);
136
137 private:
138 static const JSMethodSpec GlobalFunctionSpecs[];
139};
140
141#endif // FXJS_CJS_PUBLICMETHODS_H_
#define JS_STATIC_GLOBAL_FUN(fun_name)
void Error(const WideString &message)
WideString & Value()
bool WillCommit() const
CPDFSDK_FormFillEnvironment * GetFormFillEnv() const
CJS_Runtime * GetRuntime() const
Definition cjs_object.h:54
static void AFNumber_Keystroke_static(const v8::FunctionCallbackInfo< v8::Value > &info)
static CJS_Result AFRange_Validate(CJS_Runtime *pRuntime, pdfium::span< v8::Local< v8::Value > > params)
static CJS_Result AFPercent_Keystroke(CJS_Runtime *pRuntime, pdfium::span< v8::Local< v8::Value > > params)
static void AFPercent_Format_static(const v8::FunctionCallbackInfo< v8::Value > &info)
static void AFTime_FormatEx_static(const v8::FunctionCallbackInfo< v8::Value > &info)
static double ParseDate(v8::Isolate *isolate, const WideString &value, bool *bWrongFormat)
static WideString PrintDateUsingFormat(double dDate, const WideString &format)
static void DefineJSObjects(CFXJS_Engine *pEngine)
static void AFDate_KeystrokeEx_static(const v8::FunctionCallbackInfo< v8::Value > &info)
static void AFTime_KeystrokeEx_static(const v8::FunctionCallbackInfo< v8::Value > &info)
static CJS_Result AFDate_Keystroke(CJS_Runtime *pRuntime, pdfium::span< v8::Local< v8::Value > > params)
static void AFRange_Validate_static(const v8::FunctionCallbackInfo< v8::Value > &info)
static void AFPercent_Keystroke_static(const v8::FunctionCallbackInfo< v8::Value > &info)
static double ParseDateAsGMT(v8::Isolate *isolate, const WideString &value)
static CJS_Result AFMakeNumber(CJS_Runtime *pRuntime, pdfium::span< v8::Local< v8::Value > > params)
static void AFTime_Format_static(const v8::FunctionCallbackInfo< v8::Value > &info)
static CJS_Result AFNumber_Keystroke(CJS_Runtime *pRuntime, pdfium::span< v8::Local< v8::Value > > params)
static CJS_Result AFDate_KeystrokeEx(CJS_Runtime *pRuntime, pdfium::span< v8::Local< v8::Value > > params)
static void AFMergeChange_static(const v8::FunctionCallbackInfo< v8::Value > &info)
static CJS_Result AFTime_Keystroke(CJS_Runtime *pRuntime, pdfium::span< v8::Local< v8::Value > > params)
static CJS_Result AFParseDateEx(CJS_Runtime *pRuntime, pdfium::span< v8::Local< v8::Value > > params)
static void AFSpecial_Keystroke_static(const v8::FunctionCallbackInfo< v8::Value > &info)
static void AFSpecial_KeystrokeEx_static(const v8::FunctionCallbackInfo< v8::Value > &info)
static CJS_Result AFTime_FormatEx(CJS_Runtime *pRuntime, pdfium::span< v8::Local< v8::Value > > params)
static CJS_Result AFSimple_Calculate(CJS_Runtime *pRuntime, pdfium::span< v8::Local< v8::Value > > params)
static CJS_Result AFSpecial_KeystrokeEx(CJS_Runtime *pRuntime, pdfium::span< v8::Local< v8::Value > > params)
static CJS_Result AFSpecial_Format(CJS_Runtime *pRuntime, pdfium::span< v8::Local< v8::Value > > params)
static CJS_Result AFPercent_Format(CJS_Runtime *pRuntime, pdfium::span< v8::Local< v8::Value > > params)
static bool IsReservedMaskChar(wchar_t ch)
static CJS_Result AFMergeChange(CJS_Runtime *pRuntime, pdfium::span< v8::Local< v8::Value > > params)
static v8::Local< v8::Array > AF_MakeArrayFromList(CJS_Runtime *pRuntime, v8::Local< v8::Value > val)
static void AFParseDateEx_static(const v8::FunctionCallbackInfo< v8::Value > &info)
static CJS_Result AFSpecial_Keystroke(CJS_Runtime *pRuntime, pdfium::span< v8::Local< v8::Value > > params)
static void AFMakeNumber_static(const v8::FunctionCallbackInfo< v8::Value > &info)
static bool IsNumber(const WideString &str)
static CJS_Result AFDate_Format(CJS_Runtime *pRuntime, pdfium::span< v8::Local< v8::Value > > params)
static void AFSimple_Calculate_static(const v8::FunctionCallbackInfo< v8::Value > &info)
static void AFTime_Keystroke_static(const v8::FunctionCallbackInfo< v8::Value > &info)
static void AFExtractNums_static(const v8::FunctionCallbackInfo< v8::Value > &info)
static void AFSimple_static(const v8::FunctionCallbackInfo< v8::Value > &info)
static bool MaskSatisfied(wchar_t c_Change, wchar_t c_Mask)
static void AFDate_FormatEx_static(const v8::FunctionCallbackInfo< v8::Value > &info)
static CJS_Result AFNumber_Format(CJS_Runtime *pRuntime, pdfium::span< v8::Local< v8::Value > > params)
static CJS_Result AFTime_KeystrokeEx(CJS_Runtime *pRuntime, pdfium::span< v8::Local< v8::Value > > params)
static void AFSpecial_Format_static(const v8::FunctionCallbackInfo< v8::Value > &info)
static CJS_Result AFExtractNums(CJS_Runtime *pRuntime, pdfium::span< v8::Local< v8::Value > > params)
static CJS_Result AFDate_FormatEx(CJS_Runtime *pRuntime, pdfium::span< v8::Local< v8::Value > > params)
CJS_PublicMethods()=delete
static void AFDate_Format_static(const v8::FunctionCallbackInfo< v8::Value > &info)
static double ParseDateUsingFormat(v8::Isolate *isolate, const WideString &value, const WideString &format, bool *bWrongFormat)
static CJS_Result AFTime_Format(CJS_Runtime *pRuntime, pdfium::span< v8::Local< v8::Value > > params)
static void AFDate_Keystroke_static(const v8::FunctionCallbackInfo< v8::Value > &info)
static CJS_Result AFSimple(CJS_Runtime *pRuntime, pdfium::span< v8::Local< v8::Value > > params)
static void AFNumber_Format_static(const v8::FunctionCallbackInfo< v8::Value > &info)
bool HasReturn() const
Definition cjs_result.h:44
static CJS_Result Success()
Definition cjs_result.h:27
bool HasError() const
Definition cjs_result.h:41
static CJS_Result Failure(JSMessage id)
Definition cjs_result.h:34
const WideString & Error() const
Definition cjs_result.h:42
static CJS_Result Failure(const WideString &str)
Definition cjs_result.h:31
CJS_EventContext * GetCurrentEventContext() const
CPDFSDK_FormFillEnvironment * GetFormFillEnv() const override
static WideString StringPrintx(const WideString &cFormat, const WideString &cSource)
Definition cjs_util.cpp:283
CPDFSDK_InteractiveForm * GetInteractiveForm()
CPDF_InteractiveForm * GetInteractiveForm() const
WideString GetExportValue() const
WideString GetValue() const
int CountControls() const
int CountSelectedItems() const
CPDF_FormControl * GetControl(int index) const
FormFieldType GetFieldType() const
const char * c_str() const
Definition bytestring.h:76
WideString & operator+=(const WideString &str)
ByteString ToUTF8() const
static WideString Format(const wchar_t *pFormat,...)
WideString & operator=(WideString &&that) noexcept
WideString & operator+=(const wchar_t *str)
WideString & operator+=(wchar_t ch)
bool EqualsASCIINoCase(ByteStringView that) const
Definition widestring.h:219
CharType operator[](const size_t index) const
Definition widestring.h:146
bool IsEmpty() const
Definition widestring.h:118
const wchar_t * c_str() const
Definition widestring.h:81
WideString & operator=(const WideString &that)
static WideString FromASCII(ByteStringView str)
WideString & operator=(const wchar_t *str)
static WideString FormatInteger(int i)
FormFieldType
#define JSPLATFORM_ALERT_BUTTON_OK
#define JSPLATFORM_ALERT_ICON_STATUS
bool FXSYS_IsDecimalDigit(wchar_t c)
JSMessage
@ kParamTooLongError
@ kInvalidInputError
WideString JSFormatErrorString(const char *class_name, const char *property_name, const WideString &details)
WideString JSGetStringFromID(JSMessage msg)
WideString operator+(const WideString &str1, const WideString &str2)
Definition widestring.h:269
int FX_GetMonthFromTime(double dt)
const wchar_t *const kMonths[12]
int FX_GetYearFromTime(double dt)
const wchar_t *const kFullMonths[12]
ConversionStatus FX_ParseDateUsingFormat(const WideString &value, const WideString &format, double *result)
double FX_MakeDate(double day, double time)
double FX_GetDateTime()
int FX_GetDayFromTime(double dt)
int FX_GetSecFromTime(double dt)
bool FX_IsValidMonth(int m)
int FX_GetHourFromTime(double dt)
double FX_MakeDay(int nYear, int nMonth, int nDay)
bool FX_IsValidDay(int d)
int FX_GetMinFromTime(double dt)
double FX_MakeTime(int nHour, int nMin, int nSec, int nMs)