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
fx_date_helpers.h
Go to the documentation of this file.
1// Copyright 2018 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_FX_DATE_HELPERS_H_
8#define FXJS_FX_DATE_HELPERS_H_
9
10#include <stddef.h>
11
12#include <array>
13
14#include "core/fxcrt/widestring.h"
15
16namespace fxjs {
17
19
20extern const std::array<const char*, 12> kMonths;
21extern const std::array<const char*, 12> kFullMonths;
22
23double FX_GetDateTime();
24int FX_GetYearFromTime(double dt);
25int FX_GetMonthFromTime(double dt);
26int FX_GetDayFromTime(double dt);
27int FX_GetHourFromTime(double dt);
28int FX_GetMinFromTime(double dt);
29int FX_GetSecFromTime(double dt);
30bool FX_IsValidMonth(int m);
31bool FX_IsValidDay(int d);
32bool FX_IsValid24Hour(int h);
33bool FX_IsValidMinute(int m);
34bool FX_IsValidSecond(int s);
35double FX_LocalTime(double d);
36double FX_MakeDay(int nYear, int nMonth, int nDay);
37double FX_MakeTime(int nHour, int nMin, int nSec, int nMs);
38double FX_MakeDate(double day, double time);
39
41 size_t nStart,
42 size_t* pSkip,
43 size_t nMaxStep);
44
46 const WideString& format,
47 double* result);
48
49} // namespace fxjs
50
51using fxjs::FX_GetDateTime;
52using fxjs::FX_GetDayFromTime;
53using fxjs::FX_GetHourFromTime;
54using fxjs::FX_GetMinFromTime;
55using fxjs::FX_GetMonthFromTime;
56using fxjs::FX_GetSecFromTime;
57using fxjs::FX_GetYearFromTime;
58using fxjs::FX_IsValid24Hour;
59using fxjs::FX_IsValidDay;
60using fxjs::FX_IsValidMinute;
61using fxjs::FX_IsValidMonth;
62using fxjs::FX_IsValidSecond;
63using fxjs::FX_LocalTime;
64using fxjs::FX_MakeDate;
65using fxjs::FX_MakeDay;
66using fxjs::FX_MakeTime;
67using fxjs::FX_ParseDateUsingFormat;
68using fxjs::FX_ParseStringInteger;
69
70#endif // FXJS_FX_DATE_HELPERS_H_
fxcrt::ByteString ByteString
Definition bytestring.h:180
#define DCHECK
Definition check.h:33
#define JS_STATIC_GLOBAL_FUN(fun_name)
void Error(const WideString &message)
WideString & Value()
bool WillCommit() const
CPDFSDK_FormFillEnvironment * GetFormFillEnv() const
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:45
static CJS_Result Success()
Definition cjs_result.h:28
bool HasError() const
Definition cjs_result.h:42
static CJS_Result Failure(JSMessage id)
Definition cjs_result.h:35
const WideString & Error() const
Definition cjs_result.h:43
static CJS_Result Failure(const WideString &str)
Definition cjs_result.h:32
CJS_EventContext * GetCurrentEventContext() const
CPDFSDK_FormFillEnvironment * GetFormFillEnv() const override
CJS_Util(v8::Local< v8::Object > pObject, CJS_Runtime *pRuntime)
Definition cjs_util.cpp:97
~CJS_Util() override
static uint32_t GetObjDefnID()
Definition cjs_util.cpp:86
static void DefineJSObjects(CFXJS_Engine *pEngine)
Definition cjs_util.cpp:91
static DataType ParseDataType(WideString *sFormat)
Definition cjs_util.cpp:404
static WideString StringPrintx(const WideString &cFormat, const WideString &cSource)
Definition cjs_util.cpp:284
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
WideString & operator+=(const WideString &str)
ByteString ToUTF8() const
static WideString Format(const wchar_t *pFormat,...)
WideString & operator=(WideString &&that) noexcept
WideString & operator+=(wchar_t ch)
bool EqualsASCIINoCase(ByteStringView that) const
Definition widestring.h:114
WideString & operator=(const WideString &that)
static WideString FromASCII(ByteStringView str)
WideString & operator=(const wchar_t *str)
static WideString FormatInteger(int i)
bool EqualsASCII(ByteStringView that) const
Definition widestring.h:111
#define UNSAFE_TODO(...)
FormFieldType
#define JSPLATFORM_ALERT_BUTTON_OK
#define JSPLATFORM_ALERT_ICON_STATUS
bool FXSYS_IsDecimalDigit(wchar_t c)
#define JS_STATIC_METHOD(method_name, class_name)
Definition js_define.h:159
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:156
int FX_GetMonthFromTime(double dt)
int FX_ParseStringInteger(const WideString &str, size_t nStart, size_t *pSkip, size_t nMaxStep)
int FX_GetYearFromTime(double dt)
ConversionStatus FX_ParseDateUsingFormat(const WideString &value, const WideString &format, double *result)
double FX_MakeDate(double day, double time)
const std::array< const char *, 12 > kMonths
bool FX_IsValidMinute(int m)
double FX_GetDateTime()
int FX_GetDayFromTime(double dt)
int FX_GetSecFromTime(double dt)
bool FX_IsValidMonth(int m)
int FX_GetHourFromTime(double dt)
const std::array< const char *, 12 > kFullMonths
double FX_MakeDay(int nYear, int nMonth, int nDay)
bool FX_IsValidDay(int d)
bool FX_IsValidSecond(int s)
int FX_GetMinFromTime(double dt)
double FX_MakeTime(int nHour, int nMin, int nSec, int nMs)
double FX_LocalTime(double d)
bool FX_IsValid24Hour(int h)
fxcrt::WideString WideString
Definition widestring.h:207