TianoCore EDK2 master
Loading...
Searching...
No Matches
JsonLib.h
Go to the documentation of this file.
1
12#ifndef JSON_LIB_H_
13#define JSON_LIB_H_
14
15typedef VOID *EDKII_JSON_VALUE;
16typedef VOID *EDKII_JSON_ARRAY;
17typedef VOID *EDKII_JSON_OBJECT;
18
22typedef INT64 EDKII_JSON_INT_T; // #JSON_INTEGER_IS_LONG_LONG is set to 1
23 // in jansson_Config.h
24
30#define EDKII_JSON_MAX_INDENT 0x1F
31#define EDKII_JSON_INDENT(n) ((n) & EDKII_JSON_MAX_INDENT)
32
33#define EDKII_JSON_COMPACT 0x20
34#define EDKII_JSON_ENSURE_ASCII 0x40
35#define EDKII_JSON_SORT_KEYS 0x80
36#define EDKII_JSON_PRESERVE_ORDER 0x100
37#define EDKII_JSON_ENCODE_ANY 0x200
38#define EDKII_JSON_ESCAPE_SLASH 0x400
39#define EDKII_JSON_REAL_PRECISION(n) (((n) & 0x1F) << 11)
40#define EDKII_JSON_EMBED 0x10000
41
47#define EDKII_JSON_REJECT_DUPLICATES 0x1
48#define EDKII_JSON_DISABLE_EOF_CHECK 0x2
49#define EDKII_JSON_DECODE_ANY 0x4
50#define EDKII_JSON_DECODE_INT_AS_REAL 0x8
51#define EDKII_JSON_ALLOW_NUL 0x10
52
53#define EDKII_JSON_ARRAY_FOREACH(Array, Index, Value) \
54 for(Index = 0; \
55 Index < JsonArrayCount(Array) && (Value = JsonArrayGetValue(Array, Index)); \
56 Index++)
57
58#define EDKII_JSON_OBJECT_FOREACH_SAFE(Object, N, Key, Value) \
59 for (Key = JsonObjectIteratorKey(JsonObjectIterator(Object)), \
60 N = JsonObjectIteratorNext(Object, JsonObjectKeyToIterator(Key)); \
61 Key && (Value = JsonObjectIteratorValue(JsonObjectKeyToIterator(Key))); \
62 Key = JsonObjectIteratorKey(N), \
63 N = JsonObjectIteratorNext(Object, JsonObjectKeyToIterator(Key)))
64
68#define EDKII_JSON_ERROR_TEXT_LENGTH 160
69#define EDKII_JSON_ERROR_SOURCE_LENGTH 80
70typedef struct {
71 INTN Line;
72 INTN Column;
73 INTN Position;
74 CHAR8 Source[EDKII_JSON_ERROR_SOURCE_LENGTH];
77
81typedef enum {
82 EdkiiJsonTypeObject,
83 EdkiiJsonTypeArray,
84 EdkiiJsonTypeString,
85 EdkiiJsonTypeInteger,
86 EdkiiJsonTypeReal,
87 EdkiiJsonTypeTrue,
88 EdkiiJsonTypeFalse,
89 EdkiiJsonTypeNull
91
105EDKII_JSON_VALUE
106EFIAPI
108 VOID
109 );
110
124EDKII_JSON_VALUE
125EFIAPI
127 VOID
128 );
129
149EDKII_JSON_VALUE
150EFIAPI
152 IN CONST CHAR8 *String
153 );
154
172EDKII_JSON_VALUE
173EFIAPI
175 IN CHAR16 *String
176 );
177
192EDKII_JSON_VALUE
193EFIAPI
195 IN INT64 Value
196 );
197
209EDKII_JSON_VALUE
210EFIAPI
212 IN BOOLEAN Value
213 );
214
224EDKII_JSON_VALUE
225EFIAPI
227 VOID
228 );
229
239EDKII_JSON_VALUE
240EFIAPI
242 VOID
243 );
244
254EDKII_JSON_VALUE
255EFIAPI
257 VOID
258 );
259
280VOID
281EFIAPI
283 IN EDKII_JSON_VALUE Json
284 );
285
303EDKII_JSON_VALUE
304EFIAPI
306 IN EDKII_JSON_VALUE Json
307 );
308
318BOOLEAN
319EFIAPI
321 IN EDKII_JSON_VALUE Json
322 );
323
333BOOLEAN
334EFIAPI
336 IN EDKII_JSON_VALUE Json
337 );
338
349BOOLEAN
350EFIAPI
352 IN EDKII_JSON_VALUE Json
353 );
354
364BOOLEAN
365EFIAPI
367 IN EDKII_JSON_VALUE Json
368 );
369
379BOOLEAN
380EFIAPI
382 IN EDKII_JSON_VALUE Json
383 );
384
394BOOLEAN
395EFIAPI
397 IN EDKII_JSON_VALUE Json
398 );
399
409BOOLEAN
410EFIAPI
412 IN EDKII_JSON_VALUE Json
413 );
414
424BOOLEAN
425EFIAPI
427 IN EDKII_JSON_VALUE Json
428 );
429
439BOOLEAN
440EFIAPI
442 IN EDKII_JSON_VALUE Json
443 );
444
455EDKII_JSON_ARRAY
456EFIAPI
458 IN EDKII_JSON_VALUE Json
459 );
460
471EDKII_JSON_OBJECT
472EFIAPI
474 IN EDKII_JSON_VALUE Json
475 );
476
487CONST CHAR8 *
488EFIAPI
490 IN EDKII_JSON_VALUE Json
491 );
492
504CHAR16 *
505EFIAPI
507 IN EDKII_JSON_VALUE Json
508 );
509
521INT64
522EFIAPI
524 IN EDKII_JSON_VALUE Json
525 );
526
538BOOLEAN
539EFIAPI
541 IN EDKII_JSON_VALUE Json
542 );
543
554CONST CHAR8 *
555EFIAPI
557 IN EDKII_JSON_VALUE Json
558 );
559
569UINTN
570EFIAPI
572 IN EDKII_JSON_OBJECT JsonObject
573 );
574
586EFIAPI
588 IN EDKII_JSON_OBJECT JsonObject
589 );
590
604CHAR8 **
606 IN EDKII_JSON_OBJECT JsonObj,
607 OUT UINTN *KeyCount
608 );
609
626EDKII_JSON_VALUE
627EFIAPI
629 IN CONST EDKII_JSON_OBJECT JsonObj,
630 IN CONST CHAR8 *Key
631 );
632
652EFIAPI
654 IN EDKII_JSON_OBJECT JsonObj,
655 IN CONST CHAR8 *Key,
656 IN EDKII_JSON_VALUE Json
657 );
658
670EFIAPI
672 IN EDKII_JSON_OBJECT JsonObj,
673 IN CONST CHAR8 *Key
674 );
675
685UINTN
686EFIAPI
688 IN EDKII_JSON_ARRAY JsonArray
689 );
690
707EDKII_JSON_VALUE
708EFIAPI
710 IN EDKII_JSON_ARRAY JsonArray,
711 IN UINTN Index
712 );
713
728EFIAPI
730 IN EDKII_JSON_ARRAY JsonArray,
731 IN EDKII_JSON_VALUE Json
732 );
733
749EFIAPI
751 IN EDKII_JSON_ARRAY JsonArray,
752 IN UINTN Index
753 );
754
777CHAR8 *
778EFIAPI
780 IN EDKII_JSON_VALUE JsonValue,
781 IN UINTN Flags
782 );
783
801EDKII_JSON_VALUE
802EFIAPI
804 IN CONST CHAR8 *String,
805 IN UINT64 Flags,
806 IN EDKII_JSON_ERROR *Error
807 );
808
828EDKII_JSON_VALUE
829EFIAPI
831 IN CONST CHAR8 *Buffer,
832 IN UINTN BufferLen,
833 IN UINTN Flags,
834 IN OUT EDKII_JSON_ERROR *Error
835 );
836
850VOID
851EFIAPI
853 IN EDKII_JSON_VALUE JsonValue
854 );
855
868EDKII_JSON_VALUE
869EFIAPI
871 IN EDKII_JSON_VALUE JsonValue
872 );
873
880VOID *
881EFIAPI
883 IN EDKII_JSON_VALUE JsonValue
884 );
885
891EDKII_JSON_VALUE
892EFIAPI
894 IN VOID *Iterator
895 );
896
905VOID *
906EFIAPI
908 IN EDKII_JSON_VALUE JsonValue,
909 IN VOID *Iterator
910 );
911
918CHAR8 *
919EFIAPI
921 IN VOID *Iterator
922 );
923
930VOID *
931EFIAPI
933 IN CHAR8 *Key
934 );
935
943EFIAPI
945 IN EDKII_JSON_VALUE JsonValue
946 );
947
948#endif
UINT64 UINTN
INT64 INTN
VOID *EFIAPI JsonObjectKeyToIterator(IN CHAR8 *Key)
Definition: JsonLib.c:1146
BOOLEAN EFIAPI JsonValueGetBoolean(IN EDKII_JSON_VALUE Json)
Definition: JsonLib.c:628
EDKII_JSON_VALUE EFIAPI JsonValueInitUnicodeString(IN CHAR16 *String)
Definition: JsonLib.c:130
BOOLEAN EFIAPI JsonValueIsString(IN EDKII_JSON_VALUE Json)
Definition: JsonLib.c:350
EDKII_JSON_VALUE EFIAPI JsonLoadBuffer(IN CONST CHAR8 *Buffer, IN UINTN BufferLen, IN UINTN Flags, IN OUT EDKII_JSON_ERROR *Error)
Definition: JsonLib.c:1021
BOOLEAN EFIAPI JsonValueIsNull(IN EDKII_JSON_VALUE Json)
Definition: JsonLib.c:466
UINTN EFIAPI JsonObjectSize(IN EDKII_JSON_OBJECT JsonObject)
Definition: JsonLib.c:670
CONST CHAR8 *EFIAPI JsonValueGetString(IN EDKII_JSON_VALUE Json)
Definition: JsonLib.c:652
VOID EFIAPI JsonValueFree(IN EDKII_JSON_VALUE Json)
Definition: JsonLib.c:269
EDKII_JSON_VALUE EFIAPI JsonValueInitFalse(VOID)
Definition: JsonLib.c:222
EFI_STATUS EFIAPI JsonArrayAppendValue(IN EDKII_JSON_ARRAY JsonArray, IN EDKII_JSON_VALUE Json)
Definition: JsonLib.c:896
EDKII_JSON_ARRAY EFIAPI JsonValueGetArray(IN EDKII_JSON_VALUE Json)
Definition: JsonLib.c:485
BOOLEAN EFIAPI JsonValueIsFalse(IN EDKII_JSON_VALUE Json)
Definition: JsonLib.c:444
BOOLEAN EFIAPI JsonValueIsInteger(IN EDKII_JSON_VALUE Json)
Definition: JsonLib.c:368
EDKII_JSON_VALUE EFIAPI JsonLoadString(IN CONST CHAR8 *String, IN UINT64 Flags, IN EDKII_JSON_ERROR *Error)
Definition: JsonLib.c:991
EDKII_JSON_VALUE EFIAPI JsonValueInitObject(VOID)
Definition: JsonLib.c:61
CHAR8 *EFIAPI JsonDumpString(IN EDKII_JSON_VALUE JsonValue, IN UINTN Flags)
Definition: JsonLib.c:960
EFI_STATUS EFIAPI JsonObjectClear(IN EDKII_JSON_OBJECT JsonObject)
Definition: JsonLib.c:689
BOOLEAN EFIAPI JsonValueIsNumber(IN EDKII_JSON_VALUE Json)
Definition: JsonLib.c:386
CHAR8 ** JsonObjectGetKeys(IN EDKII_JSON_OBJECT JsonObj, OUT UINTN *KeyCount)
Definition: JsonLib.c:714
VOID EFIAPI JsonDecreaseReference(IN EDKII_JSON_VALUE JsonValue)
Definition: JsonLib.c:1046
EFI_STATUS EFIAPI JsonObjectDelete(IN EDKII_JSON_OBJECT JsonObj, IN CONST CHAR8 *Key)
Definition: JsonLib.c:825
EDKII_JSON_VALUE EFIAPI JsonValueInitNull(VOID)
Definition: JsonLib.c:240
EDKII_JSON_OBJECT EFIAPI JsonValueGetObject(IN EDKII_JSON_VALUE Json)
Definition: JsonLib.c:508
EDKII_JSON_VALUE EFIAPI JsonArrayGetValue(IN EDKII_JSON_ARRAY JsonArray, IN UINTN Index)
Definition: JsonLib.c:873
BOOLEAN EFIAPI JsonValueIsBoolean(IN EDKII_JSON_VALUE Json)
Definition: JsonLib.c:404
EDKII_JSON_VALUE EFIAPI JsonValueClone(IN EDKII_JSON_VALUE Json)
Definition: JsonLib.c:295
EDKII_JSON_VALUE EFIAPI JsonValueInitBoolean(IN BOOLEAN Value)
Definition: JsonLib.c:186
CONST CHAR8 *EFIAPI JsonValueGetAsciiString(IN EDKII_JSON_VALUE Json)
Definition: JsonLib.c:531
CHAR8 *EFIAPI JsonObjectIteratorKey(IN VOID *Iterator)
Definition: JsonLib.c:1131
VOID *EFIAPI JsonObjectIteratorNext(IN EDKII_JSON_VALUE JsonValue, IN VOID *Iterator)
Definition: JsonLib.c:1115
BOOLEAN EFIAPI JsonValueIsArray(IN EDKII_JSON_VALUE Json)
Definition: JsonLib.c:313
EDKII_JSON_VALUE EFIAPI JsonObjectGetValue(IN CONST EDKII_JSON_OBJECT JsonObj, IN CONST CHAR8 *Key)
Definition: JsonLib.c:772
EFI_STATUS EFIAPI JsonArrayRemoveValue(IN EDKII_JSON_ARRAY JsonArray, IN UINTN Index)
Definition: JsonLib.c:924
EDKII_JSON_VALUE EFIAPI JsonValueInitTrue(VOID)
Definition: JsonLib.c:204
EDKII_JSON_TYPE EFIAPI JsonGetType(IN EDKII_JSON_VALUE JsonValue)
Definition: JsonLib.c:1161
INT64 EDKII_JSON_INT_T
Definition: JsonLib.h:22
UINTN EFIAPI JsonArrayCount(IN EDKII_JSON_ARRAY JsonArray)
Definition: JsonLib.c:848
EDKII_JSON_VALUE EFIAPI JsonIncreaseReference(IN EDKII_JSON_VALUE JsonValue)
Definition: JsonLib.c:1067
EDKII_JSON_TYPE
Definition: JsonLib.h:81
#define EDKII_JSON_ERROR_TEXT_LENGTH
Definition: JsonLib.h:68
INT64 EFIAPI JsonValueGetInteger(IN EDKII_JSON_VALUE Json)
Definition: JsonLib.c:603
EDKII_JSON_VALUE EFIAPI JsonValueInitArray(VOID)
Definition: JsonLib.c:39
EDKII_JSON_VALUE EFIAPI JsonValueInitAsciiString(IN CONST CHAR8 *String)
Definition: JsonLib.c:89
EFI_STATUS EFIAPI JsonObjectSetValue(IN EDKII_JSON_OBJECT JsonObj, IN CONST CHAR8 *Key, IN EDKII_JSON_VALUE Json)
Definition: JsonLib.c:800
EDKII_JSON_VALUE EFIAPI JsonObjectIteratorValue(IN VOID *Iterator)
Definition: JsonLib.c:1098
VOID *EFIAPI JsonObjectIterator(IN EDKII_JSON_VALUE JsonValue)
Definition: JsonLib.c:1083
CHAR16 *EFIAPI JsonValueGetUnicodeString(IN EDKII_JSON_VALUE Json)
Definition: JsonLib.c:568
EDKII_JSON_VALUE EFIAPI JsonValueInitInteger(IN INT64 Value)
Definition: JsonLib.c:166
BOOLEAN EFIAPI JsonValueIsTrue(IN EDKII_JSON_VALUE Json)
Definition: JsonLib.c:422
BOOLEAN EFIAPI JsonValueIsObject(IN EDKII_JSON_VALUE Json)
Definition: JsonLib.c:331
#define CONST
Definition: Base.h:259
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29