| 1 |
/* |
| 2 |
* Copyright (C) 2024 Mohamad Al-Jaf |
| 3 |
* |
| 4 |
* This library is free software; you can redistribute it and/or |
| 5 |
* modify it under the terms of the GNU Lesser General Public |
| 6 |
* License as published by the Free Software Foundation; either |
| 7 |
* version 2.1 of the License, or (at your option) any later version. |
| 8 |
* |
| 9 |
* This library is distributed in the hope that it will be useful, |
| 10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 |
* Lesser General Public License for more details. |
| 13 |
* |
| 14 |
* You should have received a copy of the GNU Lesser General Public |
| 15 |
* License along with this library; if not, write to the Free Software |
| 16 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA |
| 17 |
*/ |
| 18 |
|
| 19 |
#ifdef __WIDL__ |
| 20 |
#pragma winrt ns_prefix |
| 21 |
#endif |
| 22 |
|
| 23 |
import "inspectable.idl"; |
| 24 |
import "asyncinfo.idl"; |
| 25 |
import "eventtoken.idl"; |
| 26 |
import "windowscontracts.idl"; |
| 27 |
import "windows.foundation.idl"; |
| 28 |
|
| 29 |
namespace Windows.Data.Json { |
| 30 |
typedef enum JsonValueType JsonValueType; |
| 31 |
|
| 32 |
interface IJsonArray; |
| 33 |
interface IJsonArrayStatics; |
| 34 |
interface IJsonObject; |
| 35 |
interface IJsonObjectStatics; |
| 36 |
interface IJsonObjectWithDefaultValues; |
| 37 |
interface IJsonValue; |
| 38 |
interface IJsonValueStatics; |
| 39 |
interface IJsonValueStatics2; |
| 40 |
|
| 41 |
runtimeclass JsonArray; |
| 42 |
runtimeclass JsonObject; |
| 43 |
runtimeclass JsonValue; |
| 44 |
|
| 45 |
declare { |
| 46 |
interface Windows.Foundation.Collections.IKeyValuePair<HSTRING, Windows.Data.Json.IJsonValue *>; |
| 47 |
interface Windows.Foundation.Collections.IIterable<Windows.Data.Json.IJsonValue *>; |
| 48 |
interface Windows.Foundation.Collections.IIterable<Windows.Foundation.Collections.IKeyValuePair<HSTRING, Windows.Data.Json.IJsonValue *> *>; |
| 49 |
interface Windows.Foundation.Collections.IIterator<Windows.Data.Json.IJsonValue *>; |
| 50 |
interface Windows.Foundation.Collections.IIterator<Windows.Foundation.Collections.IKeyValuePair<HSTRING, Windows.Data.Json.IJsonValue *> *>; |
| 51 |
interface Windows.Foundation.Collections.IMapView<HSTRING, Windows.Data.Json.IJsonValue *>; |
| 52 |
interface Windows.Foundation.Collections.IMap<HSTRING, Windows.Data.Json.IJsonValue *>; |
| 53 |
interface Windows.Foundation.Collections.IVectorView<Windows.Data.Json.IJsonValue *>; |
| 54 |
interface Windows.Foundation.Collections.IVector<Windows.Data.Json.IJsonValue *>; |
| 55 |
} |
| 56 |
|
| 57 |
[ |
| 58 |
contract(Windows.Foundation.UniversalApiContract, 1.0) |
| 59 |
] |
| 60 |
enum JsonValueType |
| 61 |
{ |
| 62 |
Null = 0, |
| 63 |
Boolean = 1, |
| 64 |
Number = 2, |
| 65 |
String = 3, |
| 66 |
Array = 4, |
| 67 |
Object = 5, |
| 68 |
}; |
| 69 |
|
| 70 |
[ |
| 71 |
contract(Windows.Foundation.UniversalApiContract, 1.0), |
| 72 |
exclusiveto(Windows.Data.Json.JsonArray), |
| 73 |
uuid(08c1ddb6-0cbd-4a9a-b5d3-2f852dc37e81) |
| 74 |
] |
| 75 |
interface IJsonArray : IInspectable |
| 76 |
requires Windows.Data.Json.IJsonValue |
| 77 |
{ |
| 78 |
HRESULT GetObjectAt([in] UINT32 index, [out, retval] Windows.Data.Json.JsonObject **value); |
| 79 |
HRESULT GetArrayAt([in] UINT32 index, [out, retval] Windows.Data.Json.JsonArray **value); |
| 80 |
HRESULT GetStringAt([in] UINT32 index, [out, retval] HSTRING *value); |
| 81 |
HRESULT GetNumberAt([in] UINT32 index, [out, retval] DOUBLE *value); |
| 82 |
HRESULT GetBooleanAt([in] UINT32 index, [out, retval] boolean *value); |
| 83 |
} |
| 84 |
|
| 85 |
[ |
| 86 |
contract(Windows.Foundation.UniversalApiContract, 1.0), |
| 87 |
exclusiveto(Windows.Data.Json.JsonObject), |
| 88 |
uuid(064e24dd-29c2-4f83-9ac1-9ee11578beb3) |
| 89 |
] |
| 90 |
interface IJsonObject : IInspectable |
| 91 |
requires Windows.Data.Json.IJsonValue |
| 92 |
{ |
| 93 |
HRESULT GetNamedValue([in] HSTRING name, [out, retval] Windows.Data.Json.JsonValue **value); |
| 94 |
HRESULT SetNamedValue([in] HSTRING name, [in] Windows.Data.Json.IJsonValue *value); |
| 95 |
HRESULT GetNamedObject([in] HSTRING name, [out, retval] Windows.Data.Json.JsonObject **value); |
| 96 |
HRESULT GetNamedArray([in] HSTRING name, [out, retval] Windows.Data.Json.JsonArray **value); |
| 97 |
HRESULT GetNamedString([in] HSTRING name, [out, retval] HSTRING *value); |
| 98 |
HRESULT GetNamedNumber([in] HSTRING name, [out, retval] DOUBLE *value); |
| 99 |
HRESULT GetNamedBoolean([in] HSTRING name, [out, retval] boolean *value); |
| 100 |
} |
| 101 |
|
| 102 |
[ |
| 103 |
contract(Windows.Foundation.UniversalApiContract, 1.0), |
| 104 |
uuid(a3219ecb-f0b3-4dcd-beee-19d48cd3ed1e) |
| 105 |
] |
| 106 |
interface IJsonValue : IInspectable |
| 107 |
{ |
| 108 |
[propget] HRESULT ValueType([out, retval] Windows.Data.Json.JsonValueType *value); |
| 109 |
HRESULT Stringify([out, retval] HSTRING *value); |
| 110 |
HRESULT GetString([out, retval] HSTRING *value); |
| 111 |
HRESULT GetNumber([out, retval] DOUBLE *value); |
| 112 |
HRESULT GetBoolean([out, retval] boolean *value); |
| 113 |
HRESULT GetArray([out, retval] Windows.Data.Json.JsonArray **value); |
| 114 |
HRESULT GetObject([out, retval] Windows.Data.Json.JsonObject **value); |
| 115 |
} |
| 116 |
|
| 117 |
[ |
| 118 |
contract(Windows.Foundation.UniversalApiContract, 1.0), |
| 119 |
exclusiveto(Windows.Data.Json.JsonValue), |
| 120 |
uuid(5f6b544a-2f53-48e1-91a3-f78b50a6345c) |
| 121 |
] |
| 122 |
interface IJsonValueStatics : IInspectable |
| 123 |
{ |
| 124 |
HRESULT Parse([in] HSTRING input, [out, retval] Windows.Data.Json.JsonValue **value); |
| 125 |
HRESULT TryParse([in] HSTRING input, [out] Windows.Data.Json.JsonValue **result, [out, retval] boolean *succeeded); |
| 126 |
HRESULT CreateBooleanValue([in] boolean input, [out, retval] Windows.Data.Json.JsonValue **value); |
| 127 |
HRESULT CreateNumberValue([in] DOUBLE input, [out, retval] Windows.Data.Json.JsonValue **value); |
| 128 |
HRESULT CreateStringValue([in] HSTRING input, [out, retval] Windows.Data.Json.JsonValue **value); |
| 129 |
} |
| 130 |
|
| 131 |
[ |
| 132 |
activatable(Windows.Foundation.UniversalApiContract, 1.0), |
| 133 |
contract(Windows.Foundation.UniversalApiContract, 1.0), |
| 134 |
marshaling_behavior(agile), |
| 135 |
/* static(Windows.Data.Json.IJsonArrayStatics, Windows.Foundation.UniversalApiContract, 1.0), */ |
| 136 |
threading(both) |
| 137 |
] |
| 138 |
runtimeclass JsonArray |
| 139 |
{ |
| 140 |
[default] interface Windows.Data.Json.IJsonArray; |
| 141 |
interface Windows.Data.Json.IJsonValue; |
| 142 |
interface Windows.Foundation.Collections.IVector<Windows.Data.Json.IJsonValue *>; |
| 143 |
interface Windows.Foundation.Collections.IIterable<Windows.Data.Json.IJsonValue *>; |
| 144 |
[contract(Windows.Foundation.UniversalApiContract, 1.0)] interface Windows.Foundation.IStringable; |
| 145 |
} |
| 146 |
|
| 147 |
[ |
| 148 |
activatable(Windows.Foundation.UniversalApiContract, 1.0), |
| 149 |
contract(Windows.Foundation.UniversalApiContract, 1.0), |
| 150 |
marshaling_behavior(agile), |
| 151 |
/* static(Windows.Data.Json.IJsonObjectStatics, Windows.Foundation.UniversalApiContract, 1.0), */ |
| 152 |
threading(both) |
| 153 |
] |
| 154 |
runtimeclass JsonObject |
| 155 |
{ |
| 156 |
[default] interface Windows.Data.Json.IJsonObject; |
| 157 |
interface Windows.Data.Json.IJsonValue; |
| 158 |
interface Windows.Foundation.Collections.IMap<HSTRING, Windows.Data.Json.IJsonValue *>; |
| 159 |
interface Windows.Foundation.Collections.IIterable<Windows.Foundation.Collections.IKeyValuePair<HSTRING, Windows.Data.Json.IJsonValue *> *>; |
| 160 |
/* [contract(Windows.Foundation.UniversalApiContract, 1.0)] interface Windows.Data.Json.IJsonObjectWithDefaultValues; */ |
| 161 |
[contract(Windows.Foundation.UniversalApiContract, 1.0)] interface Windows.Foundation.IStringable; |
| 162 |
} |
| 163 |
|
| 164 |
[ |
| 165 |
contract(Windows.Foundation.UniversalApiContract, 1.0), |
| 166 |
marshaling_behavior(agile), |
| 167 |
static(Windows.Data.Json.IJsonValueStatics, Windows.Foundation.UniversalApiContract, 1.0), |
| 168 |
/* static(Windows.Data.Json.IJsonValueStatics2, Windows.Foundation.UniversalApiContract, 1.0), */ |
| 169 |
threading(both) |
| 170 |
] |
| 171 |
runtimeclass JsonValue |
| 172 |
{ |
| 173 |
[default] interface Windows.Data.Json.IJsonValue; |
| 174 |
[contract(Windows.Foundation.UniversalApiContract, 1.0)] interface Windows.Foundation.IStringable; |
| 175 |
} |
| 176 |
} |