1 // Copyright 2016 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 XFA_FXFA_PARSER_XFA_BASIC_DATA_H_ 8 #define XFA_FXFA_PARSER_XFA_BASIC_DATA_H_ 9 10 #include <stddef.h> 11 12 #include "core/fxcrt/widestring.h" 13 #include "fxjs/xfa/cjx_object.h" 14 #include "third_party/abseil-cpp/absl/types/optional.h" 15 #include "xfa/fxfa/fxfa_basic.h" 16 17 using XFA_ATTRIBUTE_CALLBACK = void (*)(v8::Isolate* pIsolate, 18 CJX_Object* pNode, 19 v8::Local<v8::Value>* pValue, 20 bool bSetting, 21 XFA_Attribute eAttribute); 22 23 enum class XFA_PacketMatch : uint8_t { 24 kCompleteMatch = 1, 25 kPrefixMatch, 26 kNoMatch, 27 }; 28 29 enum class XFA_PacketSupport : uint8_t { 30 kSupportOne = 1, 31 kSupportMany, 32 }; 33 34 struct XFA_PACKETINFO { 35 XFA_PacketType packet_type; 36 XFA_PacketMatch match; 37 XFA_PacketSupport support; 38 const char* name; 39 const char* uri; 40 }; 41 42 struct XFA_ATTRIBUTEINFO { 43 XFA_Attribute attribute; 44 XFA_ScriptType eValueType; 45 }; 46 47 struct XFA_SCRIPTATTRIBUTEINFO { 48 XFA_Attribute attribute; 49 XFA_ScriptType eValueType; 50 XFA_ATTRIBUTE_CALLBACK callback = nullptr; 51 }; 52 53 XFA_PACKETINFO XFA_GetPacketByIndex(XFA_PacketType ePacket); 54 absl::optional<XFA_PACKETINFO> XFA_GetPacketByName(WideStringView wsName); 55 56 ByteStringView XFA_ElementToName(XFA_Element elem); 57 XFA_Element XFA_GetElementByName(WideStringView name); 58 59 ByteStringView XFA_AttributeToName(XFA_Attribute attr); 60 absl::optional<XFA_ATTRIBUTEINFO> XFA_GetAttributeByName(WideStringView name); 61 62 ByteStringView XFA_AttributeValueToName(XFA_AttributeValue item); 63 absl::optional<XFA_AttributeValue> XFA_GetAttributeValueByName( 64 WideStringView name); 65 66 absl::optional<XFA_SCRIPTATTRIBUTEINFO> XFA_GetScriptAttributeByName( 67 XFA_Element eElement, 68 WideStringView wsAttributeName); 69 70 #endif // XFA_FXFA_PARSER_XFA_BASIC_DATA_H_ 71