diff options
Diffstat (limited to 'src/libs/dutil/WixToolset.DUtil/inc/jsonutil.h')
-rw-r--r-- | src/libs/dutil/WixToolset.DUtil/inc/jsonutil.h | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/src/libs/dutil/WixToolset.DUtil/inc/jsonutil.h b/src/libs/dutil/WixToolset.DUtil/inc/jsonutil.h new file mode 100644 index 00000000..b05e9970 --- /dev/null +++ b/src/libs/dutil/WixToolset.DUtil/inc/jsonutil.h | |||
@@ -0,0 +1,112 @@ | |||
1 | #pragma once | ||
2 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
3 | |||
4 | |||
5 | #ifdef __cplusplus | ||
6 | extern "C" { | ||
7 | #endif | ||
8 | |||
9 | typedef enum JSON_TOKEN | ||
10 | { | ||
11 | JSON_TOKEN_NONE, | ||
12 | JSON_TOKEN_ARRAY_START, | ||
13 | JSON_TOKEN_ARRAY_VALUE, | ||
14 | JSON_TOKEN_ARRAY_END, | ||
15 | JSON_TOKEN_OBJECT_START, | ||
16 | JSON_TOKEN_OBJECT_KEY, | ||
17 | JSON_TOKEN_OBJECT_VALUE, | ||
18 | JSON_TOKEN_OBJECT_END, | ||
19 | JSON_TOKEN_VALUE, | ||
20 | } JSON_TOKEN; | ||
21 | |||
22 | typedef struct _JSON_VALUE | ||
23 | { | ||
24 | } JSON_VALUE; | ||
25 | |||
26 | typedef struct _JSON_READER | ||
27 | { | ||
28 | CRITICAL_SECTION cs; | ||
29 | LPWSTR sczJson; | ||
30 | |||
31 | LPWSTR pwz; | ||
32 | JSON_TOKEN token; | ||
33 | } JSON_READER; | ||
34 | |||
35 | typedef struct _JSON_WRITER | ||
36 | { | ||
37 | CRITICAL_SECTION cs; | ||
38 | LPWSTR sczJson; | ||
39 | |||
40 | JSON_TOKEN* rgTokenStack; | ||
41 | DWORD cTokens; | ||
42 | DWORD cMaxTokens; | ||
43 | } JSON_WRITER; | ||
44 | |||
45 | |||
46 | DAPI_(HRESULT) JsonInitializeReader( | ||
47 | __in_z LPCWSTR wzJson, | ||
48 | __in JSON_READER* pReader | ||
49 | ); | ||
50 | |||
51 | DAPI_(void) JsonUninitializeReader( | ||
52 | __in JSON_READER* pReader | ||
53 | ); | ||
54 | |||
55 | DAPI_(HRESULT) JsonReadNext( | ||
56 | __in JSON_READER* pReader, | ||
57 | __out JSON_TOKEN* pToken, | ||
58 | __out JSON_VALUE* pValue | ||
59 | ); | ||
60 | |||
61 | DAPI_(HRESULT) JsonReadValue( | ||
62 | __in JSON_READER* pReader, | ||
63 | __in JSON_VALUE* pValue | ||
64 | ); | ||
65 | |||
66 | DAPI_(HRESULT) JsonInitializeWriter( | ||
67 | __in JSON_WRITER* pWriter | ||
68 | ); | ||
69 | |||
70 | DAPI_(void) JsonUninitializeWriter( | ||
71 | __in JSON_WRITER* pWriter | ||
72 | ); | ||
73 | |||
74 | DAPI_(HRESULT) JsonWriteBool( | ||
75 | __in JSON_WRITER* pWriter, | ||
76 | __in BOOL fValue | ||
77 | ); | ||
78 | |||
79 | DAPI_(HRESULT) JsonWriteNumber( | ||
80 | __in JSON_WRITER* pWriter, | ||
81 | __in DWORD dwValue | ||
82 | ); | ||
83 | |||
84 | DAPI_(HRESULT) JsonWriteString( | ||
85 | __in JSON_WRITER* pWriter, | ||
86 | __in_z LPCWSTR wzValue | ||
87 | ); | ||
88 | |||
89 | DAPI_(HRESULT) JsonWriteArrayStart( | ||
90 | __in JSON_WRITER* pWriter | ||
91 | ); | ||
92 | |||
93 | DAPI_(HRESULT) JsonWriteArrayEnd( | ||
94 | __in JSON_WRITER* pWriter | ||
95 | ); | ||
96 | |||
97 | DAPI_(HRESULT) JsonWriteObjectStart( | ||
98 | __in JSON_WRITER* pWriter | ||
99 | ); | ||
100 | |||
101 | DAPI_(HRESULT) JsonWriteObjectKey( | ||
102 | __in JSON_WRITER* pWriter, | ||
103 | __in_z LPCWSTR wzKey | ||
104 | ); | ||
105 | |||
106 | DAPI_(HRESULT) JsonWriteObjectEnd( | ||
107 | __in JSON_WRITER* pWriter | ||
108 | ); | ||
109 | |||
110 | #ifdef __cplusplus | ||
111 | } | ||
112 | #endif | ||