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
cfxjse_resolveprocessor.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_XFA_CFXJSE_RESOLVEPROCESSOR_H_
8#define FXJS_XFA_CFXJSE_RESOLVEPROCESSOR_H_
9
10#include <memory>
11
12#include "core/fxcrt/unowned_ptr.h"
13#include "core/fxcrt/widestring.h"
14#include "fxjs/xfa/cfxjse_engine.h"
15#include "v8/include/cppgc/macros.h"
16#include "xfa/fxfa/fxfa_basic.h"
17#include "xfa/fxfa/parser/xfa_basic_data.h"
18
20
22 public:
23 class NodeData {
24 CPPGC_STACK_ALLOCATED(); // Allows Raw/Unowned pointers.
25
26 public:
29
30 UnownedPtr<CXFA_Object> m_CurObject; // Ok, stack-only.
31 WideString m_wsName;
32 WideString m_wsCondition;
34 int32_t m_nLevel = 0;
37 };
38
41
42 bool Resolve(v8::Isolate* pIsolate, NodeData& rnd);
43 int32_t GetFilter(WideStringView wsExpression, int32_t nStart, NodeData& rnd);
44 int32_t IndexForDataBind(const WideString& wsNextCondition, int32_t iCount);
45 void SetCurStart(int32_t start) { m_iCurStart = start; }
46
47 private:
48 bool ResolveForAttributeRs(CXFA_Object* curNode,
50 WideStringView strAttr);
51 bool ResolveAnyChild(v8::Isolate* pIsolate, NodeData& rnd);
52 bool ResolveDollar(v8::Isolate* pIsolate, NodeData& rnd);
53 bool ResolveExcalmatory(v8::Isolate* pIsolate, NodeData& rnd);
54 bool ResolveNumberSign(v8::Isolate* pIsolate, NodeData& rnd);
55 bool ResolveAsterisk(NodeData& rnd);
56 bool ResolveNormal(v8::Isolate* pIsolate, NodeData& rnd);
57 void SetStylesForChild(Mask<XFA_ResolveFlag> dwParentStyles, NodeData& rnd);
58
59 void ConditionArray(size_t iCurIndex,
60 WideString wsCondition,
61 size_t iFoundCount,
62 NodeData* pRnd);
63 void FilterCondition(v8::Isolate* pIsolate,
64 WideString wsCondition,
65 NodeData* pRnd);
66 void DoPredicateFilter(v8::Isolate* pIsolate,
67 WideString wsCondition,
68 size_t iFoundCount,
69 NodeData* pRnd);
70
71 int32_t m_iCurStart = 0;
72 UnownedPtr<CFXJSE_Engine> const m_pEngine;
73 UnownedPtr<CFXJSE_NodeHelper> const m_pNodeHelper;
74};
75
76#endif // FXJS_XFA_CFXJSE_RESOLVEPROCESSOR_H_
const FXJSE_CLASS_DESCRIPTOR kNormalClassDescriptor
const FXJSE_CLASS_DESCRIPTOR kGlobalClassDescriptor
const FXJSE_CLASS_DESCRIPTOR kVariablesClassDescriptor
XFA_ResolveFlag
EventParamScope(CFXJSE_Engine *pEngine, CXFA_Node *pTarget, CXFA_EventParam *pEventParam)
ResolveResult & operator=(const ResolveResult &that)
XFA_SCRIPTATTRIBUTEINFO script_attribute
ResolveResult(const ResolveResult &that)
void SetRunAtType(XFA_AttributeValue eRunAt)
static CJS_Result NormalMethodCall(const v8::FunctionCallbackInfo< v8::Value > &info, const WideString &functionName)
bool IsResolvingNodes() const
CXFA_Object * ToXFAObject(v8::Local< v8::Value > obj)
CXFA_Node * GetEventTarget() const
static v8::Local< v8::Value > NormalPropertyGetter(v8::Isolate *pIsolate, v8::Local< v8::Object > pObject, ByteStringView szPropName)
static void GlobalPropertySetter(v8::Isolate *pIsolate, v8::Local< v8::Object > pObject, ByteStringView szPropName, v8::Local< v8::Value > pValue)
CFXJSE_Engine(CXFA_Document *pDocument, CJS_Runtime *fxjs_runtime)
static FXJSE_ClassPropType GlobalPropTypeGetter(v8::Isolate *pIsolate, v8::Local< v8::Object > pObject, ByteStringView szPropName, bool bQueryIn)
CXFA_EventParam * GetEventParam() const
static CXFA_Object * ToObject(const v8::FunctionCallbackInfo< v8::Value > &info)
CXFA_Object * GetThisObject() const
CXFA_Script::Type GetType()
CFXJSE_Class * GetJseNormalClass() const
void AddNodesOfRunScript(CXFA_Node *pNode)
void SetNodesOfRunScript(std::vector< cppgc::Persistent< CXFA_Node > > *pArray)
static v8::Local< v8::Value > GlobalPropertyGetter(v8::Isolate *pIsolate, v8::Local< v8::Object > pObject, ByteStringView szPropName)
friend class EventParamScope
static FXJSE_ClassPropType NormalPropTypeGetter(v8::Isolate *pIsolate, v8::Local< v8::Object > pObject, ByteStringView szPropName, bool bQueryIn)
static CXFA_Object * ToObject(v8::Isolate *pIsolate, CFXJSE_Value *pValue)
absl::optional< ResolveResult > ResolveObjectsWithBindNode(CXFA_Object *refObject, WideStringView wsExpression, Mask< XFA_ResolveFlag > dwStyles, CXFA_Node *bindNode)
CFXJSE_Context * GetJseContextForTest() const
v8::Local< v8::Object > NewNormalXFAObject(CXFA_Object *obj)
CFXJSE_Context::ExecutionResult RunScript(CXFA_Script::Type eScriptType, WideStringView wsScript, CXFA_Object *pThisObject)
static void NormalPropertySetter(v8::Isolate *pIsolate, v8::Local< v8::Object > pObject, ByteStringView szPropName, v8::Local< v8::Value > pValue)
CXFA_Node * LastObjectFromUpArray()
~CFXJSE_Engine() override
absl::optional< ResolveResult > ResolveObjects(CXFA_Object *refObject, WideStringView wsExpression, Mask< XFA_ResolveFlag > dwStyles)
static CXFA_Object * ToObject(v8::Isolate *pIsolate, v8::Local< v8::Value > value)
static CXFA_Object * ToObject(CFXJSE_HostObject *pHostObj)
CXFA_Document * GetDocument() const
void AddObjectToUpArray(CXFA_Node *pNode)
v8::Local< v8::Object > GetOrCreateJSBindingFromMap(CXFA_Object *pObject)
v8::Local< v8::Value > GlobalPropertyGetter()
static void Space(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void CTerm(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Put(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void get_fm_value(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Pmt(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static ByteString Local2IsoDate(CFXJSE_HostObject *pThis, ByteStringView bsDate, ByteStringView bsFormat, ByteStringView bsLocale)
static void IPmt(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void UnitValue(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void TimeFmt(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void greater_operator(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Uuid(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Lower(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Len(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void LocalDateFmt(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Encode(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static ByteString Num2AllTime(CFXJSE_HostObject *pThis, int32_t iTime, ByteStringView bsFormat, ByteStringView bsLocale, bool bGM)
CXFA_Document * GetDocument() const
static void At(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static ByteString GetStandardTimeFormat(CFXJSE_HostObject *pThis, int32_t iStyle, ByteStringView bsLocale)
static bool fm_ref_equal(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Round(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Num2Time(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void less_operator(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
v8::Isolate * GetIsolate() const
static void Time2Num(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Mod(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Concat(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void is_fm_array(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Rate(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Sum(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void is_fm_object(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Replace(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static ByteString GetStandardDateFormat(CFXJSE_HostObject *pThis, int32_t iStyle, ByteStringView bsLocale)
static void logical_or_operator(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
CFXJSE_FormCalcContext * AsFormCalcContext() override
static void Decode(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void equality_operator(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void concat_fm_object(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void NPV(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void positive_operator(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void UnitType(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void DateFmt(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Format(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Num2GMTime(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Rtrim(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void greaterequal_operator(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Max(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void PV(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void multiple_operator(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void negative_operator(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static ByteString GetLocalDateFormat(CFXJSE_HostObject *pThis, int32_t iStyle, ByteStringView bsLocale, bool bStandard)
static void Within(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void lessequal_operator(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
~CFXJSE_FormCalcContext() override
static void Exists(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Ceil(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Right(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void logical_not_operator(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Get(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void IsoTime2Num(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Apr(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Ref(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Ltrim(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Eval(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void divide_operator(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Abs(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Date2Num(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void HasValue(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void If(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Date(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void WordNum(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void FV(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Stuff(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void assign_value_operator(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void fm_var_filter(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void logical_and_operator(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void notequality_operator(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Str(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void minus_operator(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void dotdot_accessor(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Choose(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Oneof(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Post(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Count(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static absl::optional< WideTextBuffer > Translate(cppgc::Heap *pHeap, WideStringView wsFormcalc)
static void get_fm_jsobj(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
CFXJSE_FormCalcContext(v8::Isolate *pIsolate, CFXJSE_Context *pScriptContext, CXFA_Document *pDoc)
static void Time(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Avg(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void dot_accessor(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static ByteString GetLocalTimeFormat(CFXJSE_HostObject *pThis, int32_t iStyle, ByteStringView bsLocale, bool bStandard)
static void IsoDate2Num(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Num2Date(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Parse(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static ByteString IsoDate2Local(CFXJSE_HostObject *pThis, ByteStringView bsDate, ByteStringView bsFormat, ByteStringView bsLocale)
static void Left(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void plus_operator(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Upper(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Substr(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static ByteString IsoTime2Local(CFXJSE_HostObject *pThis, ByteStringView bsTime, ByteStringView bsFormat, ByteStringView bsLocale)
static void PPmt(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void LocalTimeFmt(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Min(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void eval_translation(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Term(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
static void Floor(CFXJSE_HostObject *pThis, const v8::FunctionCallbackInfo< v8::Value > &info)
virtual CJX_Object * AsCJXObject()
Definition fxjse.cpp:38
bool CreateNode(const WideString &wsName, const WideString &wsCondition, bool bLastNode, CFXJSE_Engine *pScriptContext)
cppgc::Persistent< CXFA_Node > m_pCreateParent
XFA_Element m_eLastCreateType
bool CreateNodeForCondition(const WideString &wsCondition)
void SetCreateNodeType(CXFA_Node *refNode)
cppgc::Persistent< CXFA_Node > m_pAllStartParent
CFXJSE_Engine::ResolveResult::Type m_iCreateFlag
CFXJSE_Engine::ResolveResult m_Result
bool Resolve(v8::Isolate *pIsolate, NodeData &rnd)
int32_t GetFilter(WideStringView wsExpression, int32_t nStart, NodeData &rnd)
int32_t IndexForDataBind(const WideString &wsNextCondition, int32_t iCount)
CFXJSE_ResolveProcessor(CFXJSE_Engine *pEngine, CFXJSE_NodeHelper *pHelper)
CFXJSE_ScopeUtil_IsolateHandleContext(CFXJSE_Context *pContext)
static CJS_Result Failure(const WideString &str)
Definition cjs_result.h:31
bool HasMethod(const WideString &func) const
CXFA_Object * GetXFAObject() const
Definition cjx_object.h:113
CXFA_FFNotify * GetNotify() const
CFXJSE_Engine * GetScriptContext() const
CXFA_Object * GetXFAObject(XFA_HashCode wsNodeNameHash)
CXFA_Node * GetRoot() const
IJS_Runtime * GetIJSRuntime() const
CXFA_FFDoc * GetFFDoc() const
XFA_Element GetElementType() const
Definition cxfa_object.h:91
bool IsThisProxy() const
Definition cxfa_object.h:74
CXFA_Node * AsNode()
CJX_Object * JSObject()
Definition cxfa_object.h:81
CXFA_Document * GetDocument() const
Definition cxfa_object.h:48
bool IsNode() const
Definition cxfa_object.h:55
static CXFA_Script * FromNode(CXFA_Node *pNode)
XFA_AttributeValue GetRunAt()
Type GetContentType()
~CXFA_Script() override
WideString GetExpression()
CXFA_Script * GetScriptNode() const
CXFA_Node * GetThisNode() const
static CXFA_Variables * FromNode(CXFA_Node *pNode)
static WideString FromUTF8(ByteStringView str)
bool EqualsASCII(ByteStringView that) const
Definition widestring.h:216
CXFA_ThisProxy * ToThisProxy(CXFA_Object *pObj)
CXFA_Node * ToNode(CXFA_Object *pObj)
XFA_Attribute
Definition fxfa_basic.h:67
XFA_HashCode
Definition fxfa_basic.h:12
@ XFA_HASHCODE_None
Definition fxfa_basic.h:13
@ XFA_HASHCODE_Layout
Definition fxfa_basic.h:25
XFA_Element
Definition fxfa_basic.h:75
XFA_AttributeValue
Definition fxfa_basic.h:60
XFA_PacketType
Definition fxfa_basic.h:44
XFA_ScriptType
Definition fxfa_basic.h:104
FXJSE_ClassPropType
Definition fxjse.h:31
#define CONSTRUCT_VIA_MAKE_GARBAGE_COLLECTED
Definition heap.h:32
Definition heap.h:12
Definition fxv8.h:22
bool IsUndefined(v8::Local< v8::Value > value)
Definition fxv8.cpp:19
const char kClassTag[]
Definition fxjse.cpp:18
XFA_ScriptType eValueType
XFA_Attribute attribute
XFA_PacketMatch match
const char * uri
XFA_PacketSupport support
const char * name
XFA_PacketType packet_type
XFA_ScriptType eValueType
XFA_ATTRIBUTE_CALLBACK callback
XFA_Element XFA_GetElementByName(WideStringView name)
ByteStringView XFA_AttributeValueToName(XFA_AttributeValue item)
absl::optional< XFA_AttributeValue > XFA_GetAttributeValueByName(WideStringView name)
XFA_PacketSupport
XFA_PacketMatch
ByteStringView XFA_ElementToName(XFA_Element elem)
absl::optional< XFA_SCRIPTATTRIBUTEINFO > XFA_GetScriptAttributeByName(XFA_Element eElement, WideStringView wsAttributeName)
absl::optional< XFA_PACKETINFO > XFA_GetPacketByName(WideStringView wsName)
absl::optional< XFA_ATTRIBUTEINFO > XFA_GetAttributeByName(WideStringView name)
XFA_PACKETINFO XFA_GetPacketByIndex(XFA_PacketType ePacket)
ByteStringView XFA_AttributeToName(XFA_Attribute attr)