// C++/WinRT v2.0.250303.1 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. #pragma once #ifndef WINRT_Windows_Data_Json_H #define WINRT_Windows_Data_Json_H #include "winrt/base.h" static_assert(winrt::check_version(CPPWINRT_VERSION, "2.0.250303.1"), "Mismatched C++/WinRT headers."); #define CPPWINRT_VERSION "2.0.250303.1" #include "winrt/impl/Windows.Foundation.2.h" #include "winrt/impl/Windows.Foundation.Collections.2.h" #include "winrt/impl/Windows.Data.Json.2.h" namespace winrt::impl { template auto consume_Windows_Data_Json_IJsonArray::GetObjectAt(uint32_t index) const { void* returnValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetObjectAt(index, &returnValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetObjectAt(index, &returnValue)); } return winrt::Windows::Data::Json::JsonObject{ returnValue, take_ownership_from_abi }; } template auto consume_Windows_Data_Json_IJsonArray::GetArrayAt(uint32_t index) const { void* returnValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetArrayAt(index, &returnValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetArrayAt(index, &returnValue)); } return winrt::Windows::Data::Json::JsonArray{ returnValue, take_ownership_from_abi }; } template auto consume_Windows_Data_Json_IJsonArray::GetStringAt(uint32_t index) const { void* returnValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetStringAt(index, &returnValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetStringAt(index, &returnValue)); } return hstring{ returnValue, take_ownership_from_abi }; } template auto consume_Windows_Data_Json_IJsonArray::GetNumberAt(uint32_t index) const { double returnValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetNumberAt(index, &returnValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetNumberAt(index, &returnValue)); } return returnValue; } template auto consume_Windows_Data_Json_IJsonArray::GetBooleanAt(uint32_t index) const { bool returnValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetBooleanAt(index, &returnValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetBooleanAt(index, &returnValue)); } return returnValue; } template auto consume_Windows_Data_Json_IJsonArrayStatics::Parse(param::hstring const& input) const { void* jsonArray{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->Parse(*(void**)(&input), &jsonArray)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->Parse(*(void**)(&input), &jsonArray)); } return winrt::Windows::Data::Json::JsonArray{ jsonArray, take_ownership_from_abi }; } template auto consume_Windows_Data_Json_IJsonArrayStatics::TryParse(param::hstring const& input, winrt::Windows::Data::Json::JsonArray& result) const { bool succeeded{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->TryParse(*(void**)(&input), impl::bind_out(result), &succeeded)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->TryParse(*(void**)(&input), impl::bind_out(result), &succeeded)); } return succeeded; } template auto consume_Windows_Data_Json_IJsonErrorStatics2::GetJsonStatus(int32_t hresult) const { winrt::Windows::Data::Json::JsonErrorStatus status{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetJsonStatus(hresult, reinterpret_cast(&status))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetJsonStatus(hresult, reinterpret_cast(&status))); } return status; } template auto consume_Windows_Data_Json_IJsonObject::GetNamedValue(param::hstring const& name) const { void* returnValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetNamedValue(*(void**)(&name), &returnValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetNamedValue(*(void**)(&name), &returnValue)); } return winrt::Windows::Data::Json::JsonValue{ returnValue, take_ownership_from_abi }; } template auto consume_Windows_Data_Json_IJsonObject::SetNamedValue(param::hstring const& name, winrt::Windows::Data::Json::IJsonValue const& value) const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->SetNamedValue(*(void**)(&name), *(void**)(&value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->SetNamedValue(*(void**)(&name), *(void**)(&value))); } } template auto consume_Windows_Data_Json_IJsonObject::GetNamedObject(param::hstring const& name) const { void* returnValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetNamedObject(*(void**)(&name), &returnValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetNamedObject(*(void**)(&name), &returnValue)); } return winrt::Windows::Data::Json::JsonObject{ returnValue, take_ownership_from_abi }; } template auto consume_Windows_Data_Json_IJsonObject::GetNamedArray(param::hstring const& name) const { void* returnValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetNamedArray(*(void**)(&name), &returnValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetNamedArray(*(void**)(&name), &returnValue)); } return winrt::Windows::Data::Json::JsonArray{ returnValue, take_ownership_from_abi }; } template auto consume_Windows_Data_Json_IJsonObject::GetNamedString(param::hstring const& name) const { void* returnValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetNamedString(*(void**)(&name), &returnValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetNamedString(*(void**)(&name), &returnValue)); } return hstring{ returnValue, take_ownership_from_abi }; } template auto consume_Windows_Data_Json_IJsonObject::GetNamedNumber(param::hstring const& name) const { double returnValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetNamedNumber(*(void**)(&name), &returnValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetNamedNumber(*(void**)(&name), &returnValue)); } return returnValue; } template auto consume_Windows_Data_Json_IJsonObject::GetNamedBoolean(param::hstring const& name) const { bool returnValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetNamedBoolean(*(void**)(&name), &returnValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetNamedBoolean(*(void**)(&name), &returnValue)); } return returnValue; } template auto consume_Windows_Data_Json_IJsonObjectStatics::Parse(param::hstring const& input) const { void* jsonObject{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->Parse(*(void**)(&input), &jsonObject)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->Parse(*(void**)(&input), &jsonObject)); } return winrt::Windows::Data::Json::JsonObject{ jsonObject, take_ownership_from_abi }; } template auto consume_Windows_Data_Json_IJsonObjectStatics::TryParse(param::hstring const& input, winrt::Windows::Data::Json::JsonObject& result) const { bool succeeded{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->TryParse(*(void**)(&input), impl::bind_out(result), &succeeded)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->TryParse(*(void**)(&input), impl::bind_out(result), &succeeded)); } return succeeded; } template auto consume_Windows_Data_Json_IJsonObjectWithDefaultValues::GetNamedValue(param::hstring const& name, winrt::Windows::Data::Json::JsonValue const& defaultValue) const { void* returnValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetNamedValueOrDefault(*(void**)(&name), *(void**)(&defaultValue), &returnValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetNamedValueOrDefault(*(void**)(&name), *(void**)(&defaultValue), &returnValue)); } return winrt::Windows::Data::Json::JsonValue{ returnValue, take_ownership_from_abi }; } template auto consume_Windows_Data_Json_IJsonObjectWithDefaultValues::GetNamedObject(param::hstring const& name, winrt::Windows::Data::Json::JsonObject const& defaultValue) const { void* returnValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetNamedObjectOrDefault(*(void**)(&name), *(void**)(&defaultValue), &returnValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetNamedObjectOrDefault(*(void**)(&name), *(void**)(&defaultValue), &returnValue)); } return winrt::Windows::Data::Json::JsonObject{ returnValue, take_ownership_from_abi }; } template auto consume_Windows_Data_Json_IJsonObjectWithDefaultValues::GetNamedString(param::hstring const& name, param::hstring const& defaultValue) const { void* returnValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetNamedStringOrDefault(*(void**)(&name), *(void**)(&defaultValue), &returnValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetNamedStringOrDefault(*(void**)(&name), *(void**)(&defaultValue), &returnValue)); } return hstring{ returnValue, take_ownership_from_abi }; } template auto consume_Windows_Data_Json_IJsonObjectWithDefaultValues::GetNamedArray(param::hstring const& name, winrt::Windows::Data::Json::JsonArray const& defaultValue) const { void* returnValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetNamedArrayOrDefault(*(void**)(&name), *(void**)(&defaultValue), &returnValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetNamedArrayOrDefault(*(void**)(&name), *(void**)(&defaultValue), &returnValue)); } return winrt::Windows::Data::Json::JsonArray{ returnValue, take_ownership_from_abi }; } template auto consume_Windows_Data_Json_IJsonObjectWithDefaultValues::GetNamedNumber(param::hstring const& name, double defaultValue) const { double returnValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetNamedNumberOrDefault(*(void**)(&name), defaultValue, &returnValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetNamedNumberOrDefault(*(void**)(&name), defaultValue, &returnValue)); } return returnValue; } template auto consume_Windows_Data_Json_IJsonObjectWithDefaultValues::GetNamedBoolean(param::hstring const& name, bool defaultValue) const { bool returnValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetNamedBooleanOrDefault(*(void**)(&name), defaultValue, &returnValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetNamedBooleanOrDefault(*(void**)(&name), defaultValue, &returnValue)); } return returnValue; } template auto consume_Windows_Data_Json_IJsonValue::ValueType() const { winrt::Windows::Data::Json::JsonValueType value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_ValueType(reinterpret_cast(&value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_ValueType(reinterpret_cast(&value))); } return value; } template auto consume_Windows_Data_Json_IJsonValue::Stringify() const { void* returnValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->Stringify(&returnValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->Stringify(&returnValue)); } return hstring{ returnValue, take_ownership_from_abi }; } template auto consume_Windows_Data_Json_IJsonValue::GetString() const { void* returnValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetString(&returnValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetString(&returnValue)); } return hstring{ returnValue, take_ownership_from_abi }; } template auto consume_Windows_Data_Json_IJsonValue::GetNumber() const { double returnValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetNumber(&returnValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetNumber(&returnValue)); } return returnValue; } template auto consume_Windows_Data_Json_IJsonValue::GetBoolean() const { bool returnValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetBoolean(&returnValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetBoolean(&returnValue)); } return returnValue; } template auto consume_Windows_Data_Json_IJsonValue::GetArray() const { void* returnValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetArray(&returnValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetArray(&returnValue)); } return winrt::Windows::Data::Json::JsonArray{ returnValue, take_ownership_from_abi }; } template auto consume_Windows_Data_Json_IJsonValue::GetObject() const { void* returnValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetObject(&returnValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetObject(&returnValue)); } return winrt::Windows::Data::Json::JsonObject{ returnValue, take_ownership_from_abi }; } template auto consume_Windows_Data_Json_IJsonValueStatics::Parse(param::hstring const& input) const { void* jsonValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->Parse(*(void**)(&input), &jsonValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->Parse(*(void**)(&input), &jsonValue)); } return winrt::Windows::Data::Json::JsonValue{ jsonValue, take_ownership_from_abi }; } template auto consume_Windows_Data_Json_IJsonValueStatics::TryParse(param::hstring const& input, winrt::Windows::Data::Json::JsonValue& result) const { bool succeeded{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->TryParse(*(void**)(&input), impl::bind_out(result), &succeeded)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->TryParse(*(void**)(&input), impl::bind_out(result), &succeeded)); } return succeeded; } template auto consume_Windows_Data_Json_IJsonValueStatics::CreateBooleanValue(bool input) const { void* jsonValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateBooleanValue(input, &jsonValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateBooleanValue(input, &jsonValue)); } return winrt::Windows::Data::Json::JsonValue{ jsonValue, take_ownership_from_abi }; } template auto consume_Windows_Data_Json_IJsonValueStatics::CreateNumberValue(double input) const { void* jsonValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateNumberValue(input, &jsonValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateNumberValue(input, &jsonValue)); } return winrt::Windows::Data::Json::JsonValue{ jsonValue, take_ownership_from_abi }; } template auto consume_Windows_Data_Json_IJsonValueStatics::CreateStringValue(param::hstring const& input) const { void* jsonValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateStringValue(*(void**)(&input), &jsonValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateStringValue(*(void**)(&input), &jsonValue)); } return winrt::Windows::Data::Json::JsonValue{ jsonValue, take_ownership_from_abi }; } template auto consume_Windows_Data_Json_IJsonValueStatics2::CreateNullValue() const { void* jsonValue{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->CreateNullValue(&jsonValue)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->CreateNullValue(&jsonValue)); } return winrt::Windows::Data::Json::JsonValue{ jsonValue, take_ownership_from_abi }; } #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall GetObjectAt(uint32_t index, void** returnValue) noexcept final try { clear_abi(returnValue); typename D::abi_guard guard(this->shim()); *returnValue = detach_from(this->shim().GetObjectAt(index)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetArrayAt(uint32_t index, void** returnValue) noexcept final try { clear_abi(returnValue); typename D::abi_guard guard(this->shim()); *returnValue = detach_from(this->shim().GetArrayAt(index)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetStringAt(uint32_t index, void** returnValue) noexcept final try { clear_abi(returnValue); typename D::abi_guard guard(this->shim()); *returnValue = detach_from(this->shim().GetStringAt(index)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetNumberAt(uint32_t index, double* returnValue) noexcept final try { typename D::abi_guard guard(this->shim()); *returnValue = detach_from(this->shim().GetNumberAt(index)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetBooleanAt(uint32_t index, bool* returnValue) noexcept final try { typename D::abi_guard guard(this->shim()); *returnValue = detach_from(this->shim().GetBooleanAt(index)); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall Parse(void* input, void** jsonArray) noexcept final try { clear_abi(jsonArray); typename D::abi_guard guard(this->shim()); *jsonArray = detach_from(this->shim().Parse(*reinterpret_cast(&input))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall TryParse(void* input, void** result, bool* succeeded) noexcept final try { clear_abi(result); typename D::abi_guard guard(this->shim()); *succeeded = detach_from(this->shim().TryParse(*reinterpret_cast(&input), *reinterpret_cast(result))); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall GetJsonStatus(int32_t hresult, int32_t* status) noexcept final try { typename D::abi_guard guard(this->shim()); *status = detach_from(this->shim().GetJsonStatus(hresult)); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall GetNamedValue(void* name, void** returnValue) noexcept final try { clear_abi(returnValue); typename D::abi_guard guard(this->shim()); *returnValue = detach_from(this->shim().GetNamedValue(*reinterpret_cast(&name))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall SetNamedValue(void* name, void* value) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().SetNamedValue(*reinterpret_cast(&name), *reinterpret_cast(&value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetNamedObject(void* name, void** returnValue) noexcept final try { clear_abi(returnValue); typename D::abi_guard guard(this->shim()); *returnValue = detach_from(this->shim().GetNamedObject(*reinterpret_cast(&name))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetNamedArray(void* name, void** returnValue) noexcept final try { clear_abi(returnValue); typename D::abi_guard guard(this->shim()); *returnValue = detach_from(this->shim().GetNamedArray(*reinterpret_cast(&name))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetNamedString(void* name, void** returnValue) noexcept final try { clear_abi(returnValue); typename D::abi_guard guard(this->shim()); *returnValue = detach_from(this->shim().GetNamedString(*reinterpret_cast(&name))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetNamedNumber(void* name, double* returnValue) noexcept final try { typename D::abi_guard guard(this->shim()); *returnValue = detach_from(this->shim().GetNamedNumber(*reinterpret_cast(&name))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetNamedBoolean(void* name, bool* returnValue) noexcept final try { typename D::abi_guard guard(this->shim()); *returnValue = detach_from(this->shim().GetNamedBoolean(*reinterpret_cast(&name))); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall Parse(void* input, void** jsonObject) noexcept final try { clear_abi(jsonObject); typename D::abi_guard guard(this->shim()); *jsonObject = detach_from(this->shim().Parse(*reinterpret_cast(&input))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall TryParse(void* input, void** result, bool* succeeded) noexcept final try { clear_abi(result); typename D::abi_guard guard(this->shim()); *succeeded = detach_from(this->shim().TryParse(*reinterpret_cast(&input), *reinterpret_cast(result))); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall GetNamedValueOrDefault(void* name, void* defaultValue, void** returnValue) noexcept final try { clear_abi(returnValue); typename D::abi_guard guard(this->shim()); *returnValue = detach_from(this->shim().GetNamedValue(*reinterpret_cast(&name), *reinterpret_cast(&defaultValue))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetNamedObjectOrDefault(void* name, void* defaultValue, void** returnValue) noexcept final try { clear_abi(returnValue); typename D::abi_guard guard(this->shim()); *returnValue = detach_from(this->shim().GetNamedObject(*reinterpret_cast(&name), *reinterpret_cast(&defaultValue))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetNamedStringOrDefault(void* name, void* defaultValue, void** returnValue) noexcept final try { clear_abi(returnValue); typename D::abi_guard guard(this->shim()); *returnValue = detach_from(this->shim().GetNamedString(*reinterpret_cast(&name), *reinterpret_cast(&defaultValue))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetNamedArrayOrDefault(void* name, void* defaultValue, void** returnValue) noexcept final try { clear_abi(returnValue); typename D::abi_guard guard(this->shim()); *returnValue = detach_from(this->shim().GetNamedArray(*reinterpret_cast(&name), *reinterpret_cast(&defaultValue))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetNamedNumberOrDefault(void* name, double defaultValue, double* returnValue) noexcept final try { typename D::abi_guard guard(this->shim()); *returnValue = detach_from(this->shim().GetNamedNumber(*reinterpret_cast(&name), defaultValue)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetNamedBooleanOrDefault(void* name, bool defaultValue, bool* returnValue) noexcept final try { typename D::abi_guard guard(this->shim()); *returnValue = detach_from(this->shim().GetNamedBoolean(*reinterpret_cast(&name), defaultValue)); return 0; } catch (...) { return to_hresult(); } }; #endif template struct produce : produce_base { int32_t __stdcall get_ValueType(int32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().ValueType()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall Stringify(void** returnValue) noexcept final try { clear_abi(returnValue); typename D::abi_guard guard(this->shim()); *returnValue = detach_from(this->shim().Stringify()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetString(void** returnValue) noexcept final try { clear_abi(returnValue); typename D::abi_guard guard(this->shim()); *returnValue = detach_from(this->shim().GetString()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetNumber(double* returnValue) noexcept final try { typename D::abi_guard guard(this->shim()); *returnValue = detach_from(this->shim().GetNumber()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetBoolean(bool* returnValue) noexcept final try { typename D::abi_guard guard(this->shim()); *returnValue = detach_from(this->shim().GetBoolean()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetArray(void** returnValue) noexcept final try { clear_abi(returnValue); typename D::abi_guard guard(this->shim()); *returnValue = detach_from(this->shim().GetArray()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetObject(void** returnValue) noexcept final try { clear_abi(returnValue); typename D::abi_guard guard(this->shim()); *returnValue = detach_from(this->shim().GetObject()); return 0; } catch (...) { return to_hresult(); } }; #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall Parse(void* input, void** jsonValue) noexcept final try { clear_abi(jsonValue); typename D::abi_guard guard(this->shim()); *jsonValue = detach_from(this->shim().Parse(*reinterpret_cast(&input))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall TryParse(void* input, void** result, bool* succeeded) noexcept final try { clear_abi(result); typename D::abi_guard guard(this->shim()); *succeeded = detach_from(this->shim().TryParse(*reinterpret_cast(&input), *reinterpret_cast(result))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateBooleanValue(bool input, void** jsonValue) noexcept final try { clear_abi(jsonValue); typename D::abi_guard guard(this->shim()); *jsonValue = detach_from(this->shim().CreateBooleanValue(input)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateNumberValue(double input, void** jsonValue) noexcept final try { clear_abi(jsonValue); typename D::abi_guard guard(this->shim()); *jsonValue = detach_from(this->shim().CreateNumberValue(input)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateStringValue(void* input, void** jsonValue) noexcept final try { clear_abi(jsonValue); typename D::abi_guard guard(this->shim()); *jsonValue = detach_from(this->shim().CreateStringValue(*reinterpret_cast(&input))); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall CreateNullValue(void** jsonValue) noexcept final try { clear_abi(jsonValue); typename D::abi_guard guard(this->shim()); *jsonValue = detach_from(this->shim().CreateNullValue()); return 0; } catch (...) { return to_hresult(); } }; #endif } WINRT_EXPORT namespace winrt::Windows::Data::Json { inline JsonArray::JsonArray() : JsonArray(impl::call_factory_cast([](winrt::Windows::Foundation::IActivationFactory const& f) { return f.template ActivateInstance(); })) { } inline auto JsonArray::Parse(param::hstring const& input) { return impl::call_factory([&](IJsonArrayStatics const& f) { return f.Parse(input); }); } inline auto JsonArray::TryParse(param::hstring const& input, winrt::Windows::Data::Json::JsonArray& result) { return impl::call_factory([&](IJsonArrayStatics const& f) { return f.TryParse(input, result); }); } inline auto JsonError::GetJsonStatus(int32_t hresult) { return impl::call_factory([&](IJsonErrorStatics2 const& f) { return f.GetJsonStatus(hresult); }); } inline JsonObject::JsonObject() : JsonObject(impl::call_factory_cast([](winrt::Windows::Foundation::IActivationFactory const& f) { return f.template ActivateInstance(); })) { } inline auto JsonObject::Parse(param::hstring const& input) { return impl::call_factory([&](IJsonObjectStatics const& f) { return f.Parse(input); }); } inline auto JsonObject::TryParse(param::hstring const& input, winrt::Windows::Data::Json::JsonObject& result) { return impl::call_factory([&](IJsonObjectStatics const& f) { return f.TryParse(input, result); }); } inline auto JsonValue::Parse(param::hstring const& input) { return impl::call_factory([&](IJsonValueStatics const& f) { return f.Parse(input); }); } inline auto JsonValue::TryParse(param::hstring const& input, winrt::Windows::Data::Json::JsonValue& result) { return impl::call_factory([&](IJsonValueStatics const& f) { return f.TryParse(input, result); }); } inline auto JsonValue::CreateBooleanValue(bool input) { return impl::call_factory([&](IJsonValueStatics const& f) { return f.CreateBooleanValue(input); }); } inline auto JsonValue::CreateNumberValue(double input) { return impl::call_factory([&](IJsonValueStatics const& f) { return f.CreateNumberValue(input); }); } inline auto JsonValue::CreateStringValue(param::hstring const& input) { return impl::call_factory([&](IJsonValueStatics const& f) { return f.CreateStringValue(input); }); } inline auto JsonValue::CreateNullValue() { return impl::call_factory_cast([](IJsonValueStatics2 const& f) { return f.CreateNullValue(); }); } } namespace std { #ifndef WINRT_LEAN_AND_MEAN template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; #endif #ifdef __cpp_lib_format template<> struct formatter : formatter {}; template<> struct formatter : formatter {}; template<> struct formatter : formatter {}; #endif } #endif