CloverBootloader/rEFIt_UEFI/Platform/plist.h
2020-08-17 22:40:52 +03:00

147 lines
2.2 KiB
C++

/*
* plist.h
*
* Created on: 31 Mar 2020
* Author: jief
*/
#ifndef PLATFORM_PLIST_H_
#define PLATFORM_PLIST_H_
/* XML Tags */
#define kXMLTagPList "plist"
#define kXMLTagDict "dict"
#define kXMLTagKey "key"
#define kXMLTagString "string"
#define kXMLTagInteger "integer"
#define kXMLTagData "data"
#define kXMLTagDate "date"
#define kXMLTagFalse "false/"
#define kXMLTagTrue "true/"
#define kXMLTagArray "array"
#define kXMLTagReference "reference"
#define kXMLTagID "ID="
#define kXMLTagIDREF "IDREF="
#define kXMLTagFloat "real"
typedef enum {
kTagTypeNone,
kTagTypeDict,
kTagTypeKey,
kTagTypeString,
kTagTypeInteger,
kTagTypeData,
kTagTypeDate,
kTagTypeFalse,
kTagTypeTrue,
kTagTypeArray,
kTagTypeFloat
} TAG_TYPE;
class TagStruct
{
public:
UINTN type;
XString8 string;
INTN intValue;
float floatValue;
UINT8 *data;
UINTN dataLen;
UINTN offset;
TagStruct *tag;
TagStruct *tagNext;
TagStruct() : type(kTagTypeNone), string(), intValue(0), floatValue(0), data(0), dataLen(0), offset(0), tag(NULL), tagNext(NULL) {}
TagStruct(const TagStruct& other) = delete; // Can be defined if needed
const TagStruct& operator = ( const TagStruct & ) = delete; // Can be defined if needed
~TagStruct() {}
};
typedef TagStruct* TagPtr;
typedef union {
struct {
float fNum; //4 bytes
UINT32 pad; // else 4
} B;
CHAR8 *string;
} FlMix;
CHAR8*
XMLDecode (
CHAR8 *src
);
EFI_STATUS
ParseXML(
CONST CHAR8 *buffer,
TagPtr *dict,
UINT32 bufSize
);
//VOID RenderSVGfont(NSVGfont *fontSVG);
TagPtr
GetProperty(
TagPtr dict,
CONST CHAR8* key
);
EFI_STATUS
XMLParseNextTag (
CHAR8 *buffer,
TagPtr *tag,
UINT32 *lenPtr
);
VOID
FreeTag (
TagPtr tag
);
EFI_STATUS
GetNextTag (
UINT8 *buffer,
CHAR8 **tag,
UINT32 *start,
UINT32 *length
);
INTN
GetTagCount (
TagPtr dict
);
EFI_STATUS
GetElement(
TagPtr dict,
INTN id,
TagPtr *dict1
);
BOOLEAN
IsPropertyTrue(
TagPtr Prop
);
BOOLEAN
IsPropertyFalse(
TagPtr Prop
);
INTN
GetPropertyInteger(
TagPtr Prop,
INTN Default
);
float GetPropertyFloat (TagPtr Prop, float Default);
#endif /* PLATFORM_PLIST_H_ */