| // WARNING: This file is machine generated by fidlgen. |
| |
| #include <fidl/test/errorsyntax/cpp/fidl.h> |
| |
| #include "lib/fidl/cpp/internal/implementation.h" |
| |
| // |
| // Domain objects definitions (i.e. "natural types" in unified bindings) |
| // |
| namespace fidl { |
| namespace test { |
| namespace errorsyntax { |
| extern "C" const fidl_type_t |
| fidl_test_errorsyntax_ExampleUseOfErrorSyntax_CallWhichMayFail_ResponseTable; |
| const fidl_type_t* ExampleUseOfErrorSyntax_CallWhichMayFail_Response::FidlType = |
| &fidl_test_errorsyntax_ExampleUseOfErrorSyntax_CallWhichMayFail_ResponseTable; |
| |
| void ExampleUseOfErrorSyntax_CallWhichMayFail_Response::Encode( |
| ::fidl::Encoder* _encoder, size_t _offset, |
| cpp17::optional<::fidl::HandleInformation> maybe_handle_info) { |
| if (::fidl::IsMemcpyCompatible< |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Response>::value) { |
| memcpy(_encoder->template GetPtr< |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Response>(_offset), |
| this, sizeof(ExampleUseOfErrorSyntax_CallWhichMayFail_Response)); |
| } else { |
| if (_encoder->wire_format() == ::fidl::internal::WireFormatVersion::kV1) { |
| ::fidl::Encode(_encoder, &value, _offset + 0); |
| |
| } else { |
| ::fidl::Encode(_encoder, &value, _offset + 0); |
| } |
| } |
| } |
| |
| void ExampleUseOfErrorSyntax_CallWhichMayFail_Response::Decode( |
| ::fidl::Decoder* _decoder, |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Response* _value, size_t _offset) { |
| if (::fidl::IsMemcpyCompatible< |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Response>::value) { |
| memcpy(_value, |
| _decoder->template GetPtr< |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Response>(_offset), |
| sizeof(ExampleUseOfErrorSyntax_CallWhichMayFail_Response)); |
| } else { |
| ::fidl::Decode(_decoder, &_value->value, _offset + 0); |
| } |
| } |
| |
| zx_status_t ExampleUseOfErrorSyntax_CallWhichMayFail_Response::Clone( |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Response* _result) const { |
| zx_status_t _status = ::fidl::Clone(value, &_result->value); |
| if (_status != ZX_OK) return _status; |
| return ZX_OK; |
| } |
| |
| extern "C" const fidl_type_t |
| fidl_test_errorsyntax_ExampleUseOfErrorSyntax_CallWhichMayFail_ResultTable; |
| const fidl_type_t* ExampleUseOfErrorSyntax_CallWhichMayFail_Result::FidlType = |
| &fidl_test_errorsyntax_ExampleUseOfErrorSyntax_CallWhichMayFail_ResultTable; |
| |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result:: |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result() {} |
| |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result:: |
| ~ExampleUseOfErrorSyntax_CallWhichMayFail_Result() { |
| Destroy(); |
| } |
| |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result:: |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result( |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result&& other) |
| : tag_(other.tag_) { |
| switch (tag_) { |
| case ::fidl::test::errorsyntax:: |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result::Tag::kResponse: |
| new (&response_)::fidl::test::errorsyntax:: |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Response(); |
| response_ = std::move(other.response_); |
| break; |
| case ::fidl::test::errorsyntax:: |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result::Tag::kErr: |
| err_ = std::move(other.err_); |
| break; |
| case static_cast<fidl_xunion_tag_t>( |
| ::fidl::test::errorsyntax:: |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result::Tag::Invalid): |
| break; |
| } |
| } |
| |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result& |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result::operator=( |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result&& other) { |
| if (this != &other) { |
| Destroy(); |
| tag_ = other.tag_; |
| switch (tag_) { |
| case ::fidl::test::errorsyntax:: |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result::Tag::kResponse: |
| new (&response_)::fidl::test::errorsyntax:: |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Response(); |
| response_ = std::move(other.response_); |
| break; |
| case ::fidl::test::errorsyntax:: |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result::Tag::kErr: |
| err_ = std::move(other.err_); |
| break; |
| case static_cast<fidl_xunion_tag_t>( |
| ::fidl::test::errorsyntax:: |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result::Tag::Invalid): |
| break; |
| } |
| } |
| return *this; |
| } |
| |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result::WithResponse( |
| ::fidl::test::errorsyntax:: |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Response&& val) { |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result result; |
| result.set_response(std::move(val)); |
| return result; |
| } |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result::WithErr(uint32_t&& val) { |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result result; |
| result.set_err(std::move(val)); |
| return result; |
| } |
| |
| void ExampleUseOfErrorSyntax_CallWhichMayFail_Result::Encode( |
| ::fidl::Encoder* encoder, size_t offset, |
| cpp17::optional<::fidl::HandleInformation> maybe_handle_info) { |
| const size_t length_before = encoder->CurrentLength(); |
| const size_t handles_before = encoder->CurrentHandleCount(); |
| |
| switch (Which()) { |
| case ::fidl::test::errorsyntax:: |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result::Tag::kResponse: { |
| switch (encoder->wire_format()) { |
| case ::fidl::internal::WireFormatVersion::kV1: { |
| ::fidl::Encode( |
| encoder, &response_, |
| encoder->Alloc( |
| ::fidl::EncodingInlineSize< |
| ::fidl::test::errorsyntax:: |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Response, |
| ::fidl::Encoder>(encoder))); |
| |
| fidl_xunion_t* xunion = encoder->GetPtr<fidl_xunion_t>(offset); |
| xunion->tag = tag_; |
| xunion->envelope.num_bytes = |
| static_cast<uint32_t>(encoder->CurrentLength() - length_before); |
| xunion->envelope.num_handles = static_cast<uint32_t>( |
| encoder->CurrentHandleCount() - handles_before); |
| xunion->envelope.presence = FIDL_ALLOC_PRESENT; |
| break; |
| } |
| case ::fidl::internal::WireFormatVersion::kV2: { |
| if (::fidl::EncodingInlineSize< |
| ::fidl::test::errorsyntax:: |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Response>( |
| encoder) <= FIDL_ENVELOPE_INLINING_SIZE_THRESHOLD) { |
| ::fidl::Encode(encoder, &response_, |
| offset + offsetof(fidl_xunion_v2_t, envelope)); |
| |
| fidl_xunion_v2_t* xunion = |
| encoder->GetPtr<fidl_xunion_v2_t>(offset); |
| xunion->tag = tag_; |
| xunion->envelope.num_handles = static_cast<uint16_t>( |
| encoder->CurrentHandleCount() - handles_before); |
| xunion->envelope.flags = FIDL_ENVELOPE_FLAGS_INLINING_MASK; |
| break; |
| } |
| |
| ::fidl::Encode( |
| encoder, &response_, |
| encoder->Alloc( |
| ::fidl::EncodingInlineSize< |
| ::fidl::test::errorsyntax:: |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Response, |
| ::fidl::Encoder>(encoder))); |
| |
| fidl_xunion_v2_t* xunion = encoder->GetPtr<fidl_xunion_v2_t>(offset); |
| xunion->tag = tag_; |
| xunion->envelope.num_bytes = |
| static_cast<uint32_t>(encoder->CurrentLength() - length_before); |
| xunion->envelope.num_handles = static_cast<uint16_t>( |
| encoder->CurrentHandleCount() - handles_before); |
| xunion->envelope.flags = 0; |
| break; |
| } |
| } |
| break; |
| } |
| case ::fidl::test::errorsyntax:: |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result::Tag::kErr: { |
| switch (encoder->wire_format()) { |
| case ::fidl::internal::WireFormatVersion::kV1: { |
| ::fidl::Encode( |
| encoder, &err_, |
| encoder->Alloc( |
| ::fidl::EncodingInlineSize<uint32_t, ::fidl::Encoder>( |
| encoder))); |
| |
| fidl_xunion_t* xunion = encoder->GetPtr<fidl_xunion_t>(offset); |
| xunion->tag = tag_; |
| xunion->envelope.num_bytes = |
| static_cast<uint32_t>(encoder->CurrentLength() - length_before); |
| xunion->envelope.num_handles = static_cast<uint32_t>( |
| encoder->CurrentHandleCount() - handles_before); |
| xunion->envelope.presence = FIDL_ALLOC_PRESENT; |
| break; |
| } |
| case ::fidl::internal::WireFormatVersion::kV2: { |
| if (::fidl::EncodingInlineSize<uint32_t>(encoder) <= |
| FIDL_ENVELOPE_INLINING_SIZE_THRESHOLD) { |
| ::fidl::Encode(encoder, &err_, |
| offset + offsetof(fidl_xunion_v2_t, envelope)); |
| |
| fidl_xunion_v2_t* xunion = |
| encoder->GetPtr<fidl_xunion_v2_t>(offset); |
| xunion->tag = tag_; |
| xunion->envelope.num_handles = static_cast<uint16_t>( |
| encoder->CurrentHandleCount() - handles_before); |
| xunion->envelope.flags = FIDL_ENVELOPE_FLAGS_INLINING_MASK; |
| break; |
| } |
| |
| ::fidl::Encode( |
| encoder, &err_, |
| encoder->Alloc( |
| ::fidl::EncodingInlineSize<uint32_t, ::fidl::Encoder>( |
| encoder))); |
| |
| fidl_xunion_v2_t* xunion = encoder->GetPtr<fidl_xunion_v2_t>(offset); |
| xunion->tag = tag_; |
| xunion->envelope.num_bytes = |
| static_cast<uint32_t>(encoder->CurrentLength() - length_before); |
| xunion->envelope.num_handles = static_cast<uint16_t>( |
| encoder->CurrentHandleCount() - handles_before); |
| xunion->envelope.flags = 0; |
| break; |
| } |
| } |
| break; |
| } |
| default: |
| break; |
| } |
| } |
| |
| void ExampleUseOfErrorSyntax_CallWhichMayFail_Result::Decode( |
| ::fidl::Decoder* _decoder, |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result* value, size_t offset) { |
| fidl_xunion_v2_t* xunion = _decoder->GetPtr<fidl_xunion_v2_t>(offset); |
| |
| if (xunion->envelope.num_bytes == 0 && xunion->envelope.num_handles == 0 && |
| xunion->envelope.flags == 0) { |
| value->EnsureStorageInitialized(static_cast<fidl_xunion_tag_t>( |
| ::fidl::test::errorsyntax:: |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result::Tag::Invalid)); |
| return; |
| } |
| |
| value->EnsureStorageInitialized(xunion->tag); |
| |
| size_t value_offset = _decoder->EnvelopeValueOffset(&xunion->envelope); |
| |
| switch (value->tag_) { |
| case ::fidl::test::errorsyntax:: |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result::Tag::kResponse: { |
| new (&value->response_)::fidl::test::errorsyntax:: |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Response(); |
| ::fidl::Decode(_decoder, &value->response_, value_offset); |
| break; |
| } |
| case ::fidl::test::errorsyntax:: |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result::Tag::kErr: { |
| ::fidl::Decode(_decoder, &value->err_, value_offset); |
| break; |
| } |
| default: { |
| break; |
| } |
| } |
| } |
| |
| zx_status_t ExampleUseOfErrorSyntax_CallWhichMayFail_Result::Clone( |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result* result) const { |
| result->Destroy(); |
| result->tag_ = tag_; |
| switch (tag_) { |
| case ::fidl::test::errorsyntax:: |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result::Tag::Invalid: |
| return ZX_OK; |
| case ::fidl::test::errorsyntax:: |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result::Tag::kResponse: |
| new (&result->response_)::fidl::test::errorsyntax:: |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Response(); |
| return ::fidl::Clone(response_, &result->response_); |
| case ::fidl::test::errorsyntax:: |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result::Tag::kErr: |
| return ::fidl::Clone(err_, &result->err_); |
| default: |
| return ZX_OK; |
| } |
| } |
| |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result& |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result::set_response( |
| ::fidl::test::errorsyntax::ExampleUseOfErrorSyntax_CallWhichMayFail_Response |
| value) { |
| EnsureStorageInitialized( |
| ::fidl::test::errorsyntax:: |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result::Tag::kResponse); |
| response_ = std::move(value); |
| return *this; |
| } |
| |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result& |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result::set_err(uint32_t value) { |
| EnsureStorageInitialized( |
| ::fidl::test::errorsyntax:: |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result::Tag::kErr); |
| err_ = std::move(value); |
| return *this; |
| } |
| |
| void ExampleUseOfErrorSyntax_CallWhichMayFail_Result::Destroy() { |
| switch (tag_) { |
| case ::fidl::test::errorsyntax:: |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result::Tag::kResponse: |
| response_.~decltype(response_)(); |
| break; |
| case ::fidl::test::errorsyntax:: |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result::Tag::kErr: |
| break; |
| |
| default: |
| break; |
| } |
| tag_ = static_cast<fidl_xunion_tag_t>( |
| ::fidl::test::errorsyntax:: |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result::Tag::Invalid); |
| } |
| |
| void ExampleUseOfErrorSyntax_CallWhichMayFail_Result::EnsureStorageInitialized( |
| ::fidl_xunion_tag_t tag) { |
| if (tag_ != tag) { |
| Destroy(); |
| tag_ = tag; |
| switch (tag_) { |
| case static_cast<fidl_xunion_tag_t>( |
| ::fidl::test::errorsyntax:: |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result::Tag::Invalid): |
| break; |
| case ::fidl::test::errorsyntax:: |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result::Tag::kResponse: |
| new (&response_)::fidl::test::errorsyntax:: |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Response(); |
| break; |
| case ::fidl::test::errorsyntax:: |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result::Tag::kErr: |
| new (&err_) uint32_t(); |
| break; |
| default: |
| break; |
| } |
| } |
| } |
| |
| // |
| // Proxies and stubs definitions |
| // |
| #ifdef __Fuchsia__ |
| |
| namespace _internal { |
| __LOCAL extern "C" const fidl_type_t |
| fidl_test_errorsyntax_ExampleUseOfErrorSyntaxComposedCallWhichMayFailRequestMessageTable; |
| |
| __LOCAL extern "C" const fidl_type_t |
| fidl_test_errorsyntax_ExampleUseOfErrorSyntaxComposedCallWhichMayFailResponseMessageTable; |
| |
| __LOCAL extern "C" const fidl_type_t |
| fidl_test_errorsyntax_ExampleUseOfErrorSyntaxCallWhichMayFailRequestMessageTable; |
| |
| __LOCAL extern "C" const fidl_type_t |
| fidl_test_errorsyntax_ExampleUseOfErrorSyntaxCallWhichMayFailResponseMessageTable; |
| |
| } // namespace _internal |
| ExampleUseOfErrorSyntax::~ExampleUseOfErrorSyntax() = default; |
| |
| const fidl_type_t* ::fidl::test::errorsyntax:: |
| ExampleUseOfErrorSyntax_RequestDecoder::GetType(uint64_t ordinal, |
| bool* out_needs_response) { |
| switch (ordinal) { |
| case ::fidl::test::errorsyntax::internal:: |
| kExampleUseOfErrorSyntax_ComposedCallWhichMayFail_Ordinal: |
| *out_needs_response = true; |
| return &::fidl::test::errorsyntax::_internal:: |
| fidl_test_errorsyntax_ExampleUseOfErrorSyntaxComposedCallWhichMayFailRequestMessageTable; |
| case ::fidl::test::errorsyntax::internal:: |
| kExampleUseOfErrorSyntax_CallWhichMayFail_Ordinal: |
| *out_needs_response = true; |
| return &::fidl::test::errorsyntax::_internal:: |
| fidl_test_errorsyntax_ExampleUseOfErrorSyntaxCallWhichMayFailRequestMessageTable; |
| default: |
| *out_needs_response = false; |
| return nullptr; |
| } |
| } |
| |
| const fidl_type_t* ExampleUseOfErrorSyntax_ResponseDecoder::GetType( |
| uint64_t ordinal) { |
| switch (ordinal) { |
| case ::fidl::test::errorsyntax::internal:: |
| kExampleUseOfErrorSyntax_ComposedCallWhichMayFail_Ordinal: |
| return &::fidl::test::errorsyntax::_internal:: |
| fidl_test_errorsyntax_ExampleUseOfErrorSyntaxComposedCallWhichMayFailResponseMessageTable; |
| case ::fidl::test::errorsyntax::internal:: |
| kExampleUseOfErrorSyntax_CallWhichMayFail_Ordinal: |
| return &::fidl::test::errorsyntax::_internal:: |
| fidl_test_errorsyntax_ExampleUseOfErrorSyntaxCallWhichMayFailResponseMessageTable; |
| default: |
| return nullptr; |
| } |
| } |
| |
| ExampleUseOfErrorSyntax_EventSender::~ExampleUseOfErrorSyntax_EventSender() = |
| default; |
| |
| ExampleUseOfErrorSyntax_Sync::~ExampleUseOfErrorSyntax_Sync() = default; |
| |
| ExampleUseOfErrorSyntax_Proxy::ExampleUseOfErrorSyntax_Proxy( |
| ::fidl::internal::ProxyController* controller) |
| : controller_(controller) { |
| (void)controller_; |
| } |
| |
| ExampleUseOfErrorSyntax_Proxy::~ExampleUseOfErrorSyntax_Proxy() = default; |
| |
| zx_status_t ExampleUseOfErrorSyntax_Proxy::Dispatch_( |
| ::fidl::HLCPPIncomingMessage message) { |
| zx_status_t status = ZX_OK; |
| switch (message.ordinal()) { |
| default: { |
| status = ZX_ERR_NOT_SUPPORTED; |
| break; |
| } |
| } |
| return status; |
| } |
| |
| namespace { |
| |
| ::std::unique_ptr<::fidl::internal::SingleUseMessageHandler> |
| ExampleUseOfErrorSyntax_ComposedCallWhichMayFail_ResponseHandler( |
| ExampleUseOfErrorSyntax::ComposedCallWhichMayFailCallback&& callback) { |
| ZX_DEBUG_ASSERT_MSG(callback, |
| "Callback must not be empty for " |
| "ExampleUseOfErrorSyntax::ComposedCallWhichMayFail\n"); |
| return ::std::make_unique<::fidl::internal::SingleUseMessageHandler>( |
| [callback_ = |
| std::move(callback)](::fidl::HLCPPIncomingMessage&& message) { |
| ::fidl::Decoder decoder(std::move(message)); |
| callback_(::fidl::DecodeAs< |
| ::fidl::test::errorsyntax::parent:: |
| ParentUsesErrorSyntax_ComposedCallWhichMayFail_Result>( |
| &decoder, 16)); |
| return ZX_OK; |
| }, |
| &::fidl::test::errorsyntax::_internal:: |
| fidl_test_errorsyntax_ExampleUseOfErrorSyntaxComposedCallWhichMayFailResponseMessageTable); |
| } |
| |
| } // namespace |
| void ExampleUseOfErrorSyntax_Proxy::ComposedCallWhichMayFail( |
| ::std::string s, ComposedCallWhichMayFailCallback callback) { |
| ::fidl::Encoder _encoder( |
| ::fidl::test::errorsyntax::internal:: |
| kExampleUseOfErrorSyntax_ComposedCallWhichMayFail_Ordinal); |
| controller_->Send( |
| &::fidl::test::errorsyntax::_internal:: |
| fidl_test_errorsyntax_ExampleUseOfErrorSyntaxComposedCallWhichMayFailRequestMessageTable, |
| ::fidl::test::errorsyntax::ExampleUseOfErrorSyntax_RequestEncoder:: |
| ComposedCallWhichMayFail(&_encoder, &s), |
| ExampleUseOfErrorSyntax_ComposedCallWhichMayFail_ResponseHandler( |
| std::move(callback))); |
| } |
| namespace { |
| |
| ::std::unique_ptr<::fidl::internal::SingleUseMessageHandler> |
| ExampleUseOfErrorSyntax_CallWhichMayFail_ResponseHandler( |
| ExampleUseOfErrorSyntax::CallWhichMayFailCallback&& callback) { |
| ZX_DEBUG_ASSERT_MSG(callback, |
| "Callback must not be empty for " |
| "ExampleUseOfErrorSyntax::CallWhichMayFail\n"); |
| return ::std::make_unique<::fidl::internal::SingleUseMessageHandler>( |
| [callback_ = |
| std::move(callback)](::fidl::HLCPPIncomingMessage&& message) { |
| ::fidl::Decoder decoder(std::move(message)); |
| callback_(::fidl::DecodeAs< |
| ::fidl::test::errorsyntax:: |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result>(&decoder, |
| 16)); |
| return ZX_OK; |
| }, |
| &::fidl::test::errorsyntax::_internal:: |
| fidl_test_errorsyntax_ExampleUseOfErrorSyntaxCallWhichMayFailResponseMessageTable); |
| } |
| |
| } // namespace |
| void ExampleUseOfErrorSyntax_Proxy::CallWhichMayFail( |
| ::std::string s, CallWhichMayFailCallback callback) { |
| ::fidl::Encoder _encoder( |
| ::fidl::test::errorsyntax::internal:: |
| kExampleUseOfErrorSyntax_CallWhichMayFail_Ordinal); |
| controller_->Send( |
| &::fidl::test::errorsyntax::_internal:: |
| fidl_test_errorsyntax_ExampleUseOfErrorSyntaxCallWhichMayFailRequestMessageTable, |
| ::fidl::test::errorsyntax::ExampleUseOfErrorSyntax_RequestEncoder:: |
| CallWhichMayFail(&_encoder, &s), |
| ExampleUseOfErrorSyntax_CallWhichMayFail_ResponseHandler( |
| std::move(callback))); |
| } |
| |
| ExampleUseOfErrorSyntax_Stub::ExampleUseOfErrorSyntax_Stub( |
| ::fidl::test::errorsyntax::ExampleUseOfErrorSyntax_Stub:: |
| ExampleUseOfErrorSyntax_clazz* impl) |
| : impl_(impl) { |
| (void)impl_; |
| } |
| |
| ExampleUseOfErrorSyntax_Stub::~ExampleUseOfErrorSyntax_Stub() = default; |
| |
| namespace { |
| |
| class ExampleUseOfErrorSyntax_ComposedCallWhichMayFail_Responder final { |
| public: |
| ExampleUseOfErrorSyntax_ComposedCallWhichMayFail_Responder( |
| ::fidl::internal::PendingResponse response) |
| : response_(std::move(response)) {} |
| |
| void operator()( |
| ::fidl::test::errorsyntax::parent:: |
| ParentUsesErrorSyntax_ComposedCallWhichMayFail_Result result) { |
| ::fidl::Encoder _encoder( |
| ::fidl::test::errorsyntax::internal:: |
| kExampleUseOfErrorSyntax_ComposedCallWhichMayFail_Ordinal); |
| response_.Send( |
| &::fidl::test::errorsyntax::_internal:: |
| fidl_test_errorsyntax_ExampleUseOfErrorSyntaxComposedCallWhichMayFailResponseMessageTable, |
| ::fidl::test::errorsyntax::ExampleUseOfErrorSyntax_ResponseEncoder:: |
| ComposedCallWhichMayFail(&_encoder, &result)); |
| } |
| |
| private: |
| ::fidl::internal::PendingResponse response_; |
| }; |
| |
| class ExampleUseOfErrorSyntax_CallWhichMayFail_Responder final { |
| public: |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Responder( |
| ::fidl::internal::PendingResponse response) |
| : response_(std::move(response)) {} |
| |
| void operator()( |
| ::fidl::test::errorsyntax::ExampleUseOfErrorSyntax_CallWhichMayFail_Result |
| result) { |
| ::fidl::Encoder _encoder( |
| ::fidl::test::errorsyntax::internal:: |
| kExampleUseOfErrorSyntax_CallWhichMayFail_Ordinal); |
| response_.Send( |
| &::fidl::test::errorsyntax::_internal:: |
| fidl_test_errorsyntax_ExampleUseOfErrorSyntaxCallWhichMayFailResponseMessageTable, |
| ::fidl::test::errorsyntax::ExampleUseOfErrorSyntax_ResponseEncoder:: |
| CallWhichMayFail(&_encoder, &result)); |
| } |
| |
| private: |
| ::fidl::internal::PendingResponse response_; |
| }; |
| |
| } // namespace |
| |
| zx_status_t ExampleUseOfErrorSyntax_Stub::Dispatch_( |
| ::fidl::HLCPPIncomingMessage message, |
| ::fidl::internal::PendingResponse response) { |
| bool needs_response; |
| const fidl_type_t* request_type = |
| ::fidl::test::errorsyntax::ExampleUseOfErrorSyntax_RequestDecoder:: |
| GetType(message.ordinal(), &needs_response); |
| if (request_type == nullptr) { |
| return ZX_ERR_NOT_SUPPORTED; |
| } |
| if (response.needs_response() != needs_response) { |
| if (needs_response) { |
| FIDL_REPORT_DECODING_ERROR(message, request_type, |
| "Message needing a response with no txid"); |
| } else { |
| FIDL_REPORT_DECODING_ERROR(message, request_type, |
| "Message not needing a response with a txid"); |
| } |
| return ZX_ERR_INVALID_ARGS; |
| } |
| const char* error_msg = nullptr; |
| zx_status_t status = message.Decode(request_type, &error_msg); |
| if (status != ZX_OK) { |
| FIDL_REPORT_DECODING_ERROR(message, request_type, error_msg); |
| return status; |
| } |
| uint64_t ordinal = message.ordinal(); |
| switch (ordinal) { |
| case ::fidl::test::errorsyntax::internal:: |
| kExampleUseOfErrorSyntax_ComposedCallWhichMayFail_Ordinal: { |
| ::fidl::Decoder decoder(std::move(message)); |
| impl_->ComposedCallWhichMayFail( |
| ::fidl::DecodeAs<::std::string>(&decoder, 16), |
| ExampleUseOfErrorSyntax_ComposedCallWhichMayFail_Responder( |
| std::move(response))); |
| break; |
| } |
| case ::fidl::test::errorsyntax::internal:: |
| kExampleUseOfErrorSyntax_CallWhichMayFail_Ordinal: { |
| ::fidl::Decoder decoder(std::move(message)); |
| impl_->CallWhichMayFail( |
| ::fidl::DecodeAs<::std::string>(&decoder, 16), |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Responder( |
| std::move(response))); |
| break; |
| } |
| default: { |
| status = ZX_ERR_NOT_SUPPORTED; |
| break; |
| } |
| } |
| return status; |
| } |
| |
| ExampleUseOfErrorSyntax_SyncProxy::ExampleUseOfErrorSyntax_SyncProxy( |
| ::zx::channel channel) |
| : proxy_(::std::move(channel)) {} |
| |
| ExampleUseOfErrorSyntax_SyncProxy::~ExampleUseOfErrorSyntax_SyncProxy() = |
| default; |
| |
| zx_status_t ExampleUseOfErrorSyntax_SyncProxy::ComposedCallWhichMayFail( |
| ::std::string s, |
| ::fidl::test::errorsyntax::parent:: |
| ParentUsesErrorSyntax_ComposedCallWhichMayFail_Result* out_result) { |
| ::fidl::Encoder _encoder( |
| ::fidl::test::errorsyntax::internal:: |
| kExampleUseOfErrorSyntax_ComposedCallWhichMayFail_Ordinal); |
| ::fidl::IncomingMessageBuffer buffer_; |
| ::fidl::HLCPPIncomingMessage response_ = buffer_.CreateEmptyIncomingMessage(); |
| zx_status_t status_ = proxy_.Call( |
| &::fidl::test::errorsyntax::_internal:: |
| fidl_test_errorsyntax_ExampleUseOfErrorSyntaxComposedCallWhichMayFailRequestMessageTable, |
| &::fidl::test::errorsyntax::_internal:: |
| fidl_test_errorsyntax_ExampleUseOfErrorSyntaxComposedCallWhichMayFailResponseMessageTable, |
| ::fidl::test::errorsyntax::ExampleUseOfErrorSyntax_RequestEncoder:: |
| ComposedCallWhichMayFail(&_encoder, &s), |
| &response_); |
| if (status_ != ZX_OK) return status_; |
| ::fidl::Decoder decoder_(std::move(response_)); |
| *out_result = ::fidl::DecodeAs< |
| ::fidl::test::errorsyntax::parent:: |
| ParentUsesErrorSyntax_ComposedCallWhichMayFail_Result>(&decoder_, 16); |
| return ZX_OK; |
| } |
| |
| zx_status_t ExampleUseOfErrorSyntax_SyncProxy::CallWhichMayFail( |
| ::std::string s, |
| ::fidl::test::errorsyntax::ExampleUseOfErrorSyntax_CallWhichMayFail_Result* |
| out_result) { |
| ::fidl::Encoder _encoder( |
| ::fidl::test::errorsyntax::internal:: |
| kExampleUseOfErrorSyntax_CallWhichMayFail_Ordinal); |
| ::fidl::IncomingMessageBuffer buffer_; |
| ::fidl::HLCPPIncomingMessage response_ = buffer_.CreateEmptyIncomingMessage(); |
| zx_status_t status_ = proxy_.Call( |
| &::fidl::test::errorsyntax::_internal:: |
| fidl_test_errorsyntax_ExampleUseOfErrorSyntaxCallWhichMayFailRequestMessageTable, |
| &::fidl::test::errorsyntax::_internal:: |
| fidl_test_errorsyntax_ExampleUseOfErrorSyntaxCallWhichMayFailResponseMessageTable, |
| ::fidl::test::errorsyntax::ExampleUseOfErrorSyntax_RequestEncoder:: |
| CallWhichMayFail(&_encoder, &s), |
| &response_); |
| if (status_ != ZX_OK) return status_; |
| ::fidl::Decoder decoder_(std::move(response_)); |
| *out_result = |
| ::fidl::DecodeAs<::fidl::test::errorsyntax:: |
| ExampleUseOfErrorSyntax_CallWhichMayFail_Result>( |
| &decoder_, 16); |
| return ZX_OK; |
| } |
| #endif // __Fuchsia__ |
| |
| } // namespace errorsyntax |
| } // namespace test |
| } // namespace fidl |