| // WARNING: This file is machine generated by fidlgen. |
| |
| #include <fidl/test.handlesintypes/cpp/wire_types.h> |
| |
| #ifdef __Fuchsia__ |
| void ::test_handlesintypes::wire::HandlesInTypes::_CloseHandles() { |
| normal_handle.reset(); |
| { |
| ::zx::vmo* handle_in_vec_element = handle_in_vec.mutable_data(); |
| for (uint64_t i = 0; i < handle_in_vec.count(); |
| ++i, ++handle_in_vec_element) { |
| handle_in_vec_element->reset(); |
| } |
| } |
| { |
| ::zx::vmo* handle_in_array_element = handle_in_array.data(); |
| for (size_t i = 0; i < handle_in_array.size(); |
| ++i, ++handle_in_array_element) { |
| handle_in_array_element->reset(); |
| } |
| } |
| { |
| ::fidl::Array<::zx::vmo, 5>* handle_in_mixed_vec_array_element = |
| handle_in_mixed_vec_array.mutable_data(); |
| for (uint64_t i = 0; i < handle_in_mixed_vec_array.count(); |
| ++i, ++handle_in_mixed_vec_array_element) { |
| { |
| ::zx::vmo* handle_in_mixed_vec_array_element_element = |
| (*handle_in_mixed_vec_array_element).data(); |
| for (size_t i = 0; i < (*handle_in_mixed_vec_array_element).size(); |
| ++i, ++handle_in_mixed_vec_array_element_element) { |
| handle_in_mixed_vec_array_element_element->reset(); |
| } |
| } |
| } |
| } |
| table_with_handle._CloseHandles(); |
| union_with_handle._CloseHandles(); |
| } |
| #endif // __Fuchsia__ |
| |
| #ifdef __Fuchsia__ |
| |
| auto ::test_handlesintypes::wire::UnionWithHandle::Which() const |
| -> ::test_handlesintypes::wire::UnionWithHandle::Tag { |
| ZX_ASSERT(!has_invalid_tag()); |
| switch (ordinal_) { |
| case ::test_handlesintypes::wire::UnionWithHandle::Ordinal::kH: |
| return static_cast<::test_handlesintypes::wire::UnionWithHandle::Tag>( |
| ordinal_); |
| default: |
| return ::test_handlesintypes::wire::UnionWithHandle::Tag::kUnknown; |
| } |
| } |
| |
| void ::test_handlesintypes::wire::UnionWithHandle:: |
| SizeAndOffsetAssertionHelper() { |
| static_assert(sizeof(UnionWithHandle) == sizeof(fidl_xunion_v2_t)); |
| static_assert(offsetof(UnionWithHandle, ordinal_) == |
| offsetof(fidl_xunion_v2_t, tag)); |
| static_assert(offsetof(UnionWithHandle, envelope_) == |
| offsetof(fidl_xunion_v2_t, envelope)); |
| } |
| ::test_handlesintypes::wire::UnionWithHandle::~UnionWithHandle() { |
| switch (ordinal_) { |
| case ::test_handlesintypes::wire::UnionWithHandle::Ordinal::kH: |
| envelope_.As<::zx::vmo>().clear_data(); |
| break; |
| default: |
| break; |
| } |
| } |
| |
| void ::test_handlesintypes::wire::UnionWithHandle::_Move( |
| UnionWithHandle&& other) { |
| ordinal_ = other.ordinal_; |
| switch (ordinal_) { |
| case ::test_handlesintypes::wire::UnionWithHandle::Ordinal::kH: |
| envelope_.As<::zx::vmo>() = std::move(other.envelope_.As<::zx::vmo>()); |
| break; |
| default: |
| break; |
| } |
| } |
| |
| void ::test_handlesintypes::wire::UnionWithHandle::_CloseHandles() { |
| switch (ordinal_) { |
| case ::test_handlesintypes::wire::UnionWithHandle::Ordinal::kH: { |
| h().reset(); |
| break; |
| } |
| default: |
| break; |
| } |
| } |
| #endif // __Fuchsia__ |
| |
| #ifdef __Fuchsia__ |
| |
| bool ::fidl::WireTableFrame< |
| ::test_handlesintypes::wire::TableWithHandle>::HasUnknownData() const { |
| return false; |
| } |
| |
| bool ::test_handlesintypes::wire::TableWithHandle::HasUnknownData() const { |
| if (max_ordinal_ > 1) { |
| return true; |
| } |
| if (frame_ptr_ == nullptr) { |
| return false; |
| } |
| return frame_ptr_->HasUnknownData(); |
| } |
| |
| void ::test_handlesintypes::wire::TableWithHandle::_CloseHandles() { |
| if (has_h()) { |
| h().reset(); |
| } |
| } |
| |
| #endif // __Fuchsia__ |