mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-11 07:27:27 +00:00
C++ Feature: Mutable union getters (#8852)
* generate mutable union accessors
* add test
* Revert "add test"
This reverts commit 45e352b18f.
* update file
* formatter got in the way
* merge conflicts
* updated genned code
* manually fix code gen bc I can't figure out why this file won't code gen
---------
Co-authored-by: Wouter van Oortmerssen <aardappel@gmail.com>
This commit is contained in:
@@ -117,6 +117,10 @@ struct TableInFirstNS FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
const NamespaceA::NamespaceB::TableInNestedNS *foo_union_as_TableInNestedNS() const {
|
||||
return foo_union_type() == NamespaceA::NamespaceB::UnionInNestedNS_TableInNestedNS ? static_cast<const NamespaceA::NamespaceB::TableInNestedNS *>(foo_union()) : nullptr;
|
||||
}
|
||||
template<typename T> T *mutable_foo_union_as();
|
||||
NamespaceA::NamespaceB::TableInNestedNS *mutable_foo_union_as_TableInNestedNS() {
|
||||
return foo_union_type() == NamespaceA::NamespaceB::UnionInNestedNS_TableInNestedNS ? static_cast<NamespaceA::NamespaceB::TableInNestedNS *>(mutable_foo_union()) : nullptr;
|
||||
}
|
||||
void *mutable_foo_union() {
|
||||
return GetPointer<void *>(VT_FOO_UNION);
|
||||
}
|
||||
@@ -147,6 +151,10 @@ template<> inline const NamespaceA::NamespaceB::TableInNestedNS *TableInFirstNS:
|
||||
return foo_union_as_TableInNestedNS();
|
||||
}
|
||||
|
||||
template<> inline NamespaceA::NamespaceB::TableInNestedNS *TableInFirstNS::mutable_foo_union_as<NamespaceA::NamespaceB::TableInNestedNS>() {
|
||||
return mutable_foo_union_as_TableInNestedNS();
|
||||
}
|
||||
|
||||
struct TableInFirstNSBuilder {
|
||||
typedef TableInFirstNS Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
|
||||
Reference in New Issue
Block a user