1 // Copyright 2016 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 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/base/optional.h"
15 #include "xfa/fxfa/fxfa_basic.h"
16 
17 struct XFA_PACKETINFO {
18   const wchar_t* name;
19   XFA_PacketType packet_type;
20   const wchar_t* uri;
21   uint32_t flags;
22 };
23 
24 struct XFA_ATTRIBUTEINFO {
25   XFA_Attribute attribute;
26   XFA_ScriptType eValueType;
27 };
28 
29 struct XFA_SCRIPTATTRIBUTEINFO {
30   XFA_Attribute attribute;
31   XFA_ScriptType eValueType;
32   XFA_ATTRIBUTE_CALLBACK callback = nullptr;
33 };
34 
35 XFA_PACKETINFO XFA_GetPacketByIndex(XFA_PacketType ePacket);
36 Optional<XFA_PACKETINFO> XFA_GetPacketByName(WideStringView wsName);
37 
38 ByteStringView XFA_ElementToName(XFA_Element elem);
39 XFA_Element XFA_GetElementByName(WideStringView name);
40 
41 ByteStringView XFA_AttributeToName(XFA_Attribute attr);
42 Optional<XFA_ATTRIBUTEINFO> XFA_GetAttributeByName(WideStringView name);
43 
44 ByteStringView XFA_AttributeValueToName(XFA_AttributeValue item);
45 Optional<XFA_AttributeValue> XFA_GetAttributeValueByName(WideStringView name);
46 
47 Optional<XFA_SCRIPTATTRIBUTEINFO> XFA_GetScriptAttributeByName(
48     XFA_Element eElement,
49     WideStringView wsAttributeName);
50 
51 #endif  // XFA_FXFA_PARSER_XFA_BASIC_DATA_H_
52