summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/flatbuffers/idl.h79
-rw-r--r--samples/monster_generated.h3
-rw-r--r--src/idl_gen_cpp.cpp2
-rw-r--r--src/idl_gen_general.cpp2
-rw-r--r--src/idl_gen_js_ts.cpp2
-rw-r--r--tests/FlatBuffers.Test/FlatBuffersExampleTests.cs6
-rw-r--r--tests/JavaTest.java37
-rw-r--r--tests/MyGame/Example/Monster.cs3
-rw-r--r--tests/MyGame/Example/Monster.java3
-rw-r--r--tests/monster_test_generated.h9
-rw-r--r--tests/monster_test_generated.js45
-rw-r--r--tests/monster_test_generated.ts45
-rw-r--r--tests/union_vector/Movie.cs2
-rw-r--r--tests/union_vector/Movie.java2
-rw-r--r--tests/union_vector/union_vector_generated.h3
-rw-r--r--tests/union_vector/union_vector_generated.js15
-rw-r--r--tests/union_vector/union_vector_generated.ts15
17 files changed, 64 insertions, 209 deletions
diff --git a/include/flatbuffers/idl.h b/include/flatbuffers/idl.h
index 5dce91a7..f7707df2 100644
--- a/include/flatbuffers/idl.h
+++ b/include/flatbuffers/idl.h
@@ -338,44 +338,7 @@ struct StructDef : public Definition {
flatbuffers::unique_ptr<std::string> original_location;
};
-inline bool IsStruct(const Type &type) {
- return type.base_type == BASE_TYPE_STRUCT && type.struct_def->fixed;
-}
-
-inline bool IsVector(const Type &type) {
- return type.base_type == BASE_TYPE_VECTOR;
-}
-
-inline bool IsArray(const Type &type) {
- return type.base_type == BASE_TYPE_ARRAY;
-}
-
-inline bool IsSeries(const Type &type) {
- return IsVector(type) || IsArray(type);
-}
-
-inline bool IsEnum(const Type &type) {
- return type.enum_def != nullptr && IsInteger(type.base_type);
-}
-
-inline size_t InlineSize(const Type &type) {
- return IsStruct(type)
- ? type.struct_def->bytesize
- : (IsArray(type)
- ? InlineSize(type.VectorType()) * type.fixed_length
- : SizeOf(type.base_type));
-}
-inline size_t InlineAlignment(const Type &type) {
- if (IsStruct(type)) {
- return type.struct_def->minalign;
- } else if (IsArray(type)) {
- return IsStruct(type.VectorType()) ? type.struct_def->minalign
- : SizeOf(type.element);
- } else {
- return SizeOf(type.base_type);
- }
-}
struct EnumDef;
struct EnumValBuilder;
@@ -460,6 +423,48 @@ struct EnumDef : public Definition {
SymbolTable<EnumVal> vals;
};
+inline bool IsStruct(const Type &type) {
+ return type.base_type == BASE_TYPE_STRUCT && type.struct_def->fixed;
+}
+
+inline bool IsUnion(const Type &type) {
+ return type.enum_def != nullptr && type.enum_def->is_union;
+}
+
+inline bool IsVector(const Type &type) {
+ return type.base_type == BASE_TYPE_VECTOR;
+}
+
+inline bool IsArray(const Type &type) {
+ return type.base_type == BASE_TYPE_ARRAY;
+}
+
+inline bool IsSeries(const Type &type) {
+ return IsVector(type) || IsArray(type);
+}
+
+inline bool IsEnum(const Type &type) {
+ return type.enum_def != nullptr && IsInteger(type.base_type);
+}
+
+inline size_t InlineSize(const Type &type) {
+ return IsStruct(type)
+ ? type.struct_def->bytesize
+ : (IsArray(type)
+ ? InlineSize(type.VectorType()) * type.fixed_length
+ : SizeOf(type.base_type));
+}
+
+inline size_t InlineAlignment(const Type &type) {
+ if (IsStruct(type)) {
+ return type.struct_def->minalign;
+ } else if (IsArray(type)) {
+ return IsStruct(type.VectorType()) ? type.struct_def->minalign
+ : SizeOf(type.element);
+ } else {
+ return SizeOf(type.base_type);
+ }
+}
inline bool operator==(const EnumVal &lhs, const EnumVal &rhs) {
return lhs.value == rhs.value;
}
diff --git a/samples/monster_generated.h b/samples/monster_generated.h
index ec2c24ce..fefd7c13 100644
--- a/samples/monster_generated.h
+++ b/samples/monster_generated.h
@@ -316,9 +316,6 @@ struct Monster FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
MyGame::Sample::Equipment equipped_type() const {
return static_cast<MyGame::Sample::Equipment>(GetField<uint8_t>(VT_EQUIPPED_TYPE, 0));
}
- bool mutate_equipped_type(MyGame::Sample::Equipment _equipped_type) {
- return SetField<uint8_t>(VT_EQUIPPED_TYPE, static_cast<uint8_t>(_equipped_type), 0);
- }
const void *equipped() const {
return GetPointer<const void *>(VT_EQUIPPED);
}
diff --git a/src/idl_gen_cpp.cpp b/src/idl_gen_cpp.cpp
index 826f6468..d7b3abb5 100644
--- a/src/idl_gen_cpp.cpp
+++ b/src/idl_gen_cpp.cpp
@@ -1925,7 +1925,7 @@ class CppGenerator : public BaseGenerator {
}
}
- if (parser_.opts.mutable_buffer) {
+ if (parser_.opts.mutable_buffer && !(is_scalar && IsUnion(field.value.type))) {
if (is_scalar) {
const auto type = GenTypeWire(field.value.type, "", false);
code_.SetValue("SET_FN", "SetField<" + type + ">");
diff --git a/src/idl_gen_general.cpp b/src/idl_gen_general.cpp
index 03ffb881..bb2920f5 100644
--- a/src/idl_gen_general.cpp
+++ b/src/idl_gen_general.cpp
@@ -1367,7 +1367,7 @@ class GeneralGenerator : public BaseGenerator {
? lang_.accessor_prefix + "bb_pos + " +
NumToString(field.value.offset)
: "o + " + lang_.accessor_prefix + "bb_pos");
- if (IsScalar(underlying_type.base_type)) {
+ if (IsScalar(underlying_type.base_type) && !IsUnion(field.value.type)) {
code += " public ";
code += struct_def.fixed ? "void " : lang_.bool_type;
code += mutator_prefix + MakeCamel(field.name, true);
diff --git a/src/idl_gen_js_ts.cpp b/src/idl_gen_js_ts.cpp
index 9c4c149c..84dc7374 100644
--- a/src/idl_gen_js_ts.cpp
+++ b/src/idl_gen_js_ts.cpp
@@ -1015,7 +1015,7 @@ class JsTsGenerator : public BaseGenerator {
}
// Adds the mutable scalar value to the output
- if (IsScalar(field.value.type.base_type) && parser.opts.mutable_buffer) {
+ if (IsScalar(field.value.type.base_type) && parser.opts.mutable_buffer && !IsUnion(field.value.type)) {
std::string annotations = GenTypeAnnotation(
kParam, GenTypeName(field.value.type, true), "value");
GenDocComment(
diff --git a/tests/FlatBuffers.Test/FlatBuffersExampleTests.cs b/tests/FlatBuffers.Test/FlatBuffersExampleTests.cs
index 434b2a18..bbd69f79 100644
--- a/tests/FlatBuffers.Test/FlatBuffersExampleTests.cs
+++ b/tests/FlatBuffers.Test/FlatBuffersExampleTests.cs
@@ -156,11 +156,7 @@ namespace FlatBuffers.Test
Assert.IsTrue(monster.TestarrayoftablesByKey("Barney") != null);
Assert.IsTrue(monster.TestarrayoftablesByKey("Wilma") != null);
- // testType is an existing field and mutating it should succeed
- Assert.AreEqual(monster.TestType, Any.Monster);
- Assert.AreEqual(monster.MutateTestType(Any.NONE), true);
- Assert.AreEqual(monster.TestType, Any.NONE);
- Assert.AreEqual(monster.MutateTestType(Any.Monster), true);
+ // testType is an existing field
Assert.AreEqual(monster.TestType, Any.Monster);
//mutate the inventory vector
diff --git a/tests/JavaTest.java b/tests/JavaTest.java
index 9c11910d..1443b779 100644
--- a/tests/JavaTest.java
+++ b/tests/JavaTest.java
@@ -1,18 +1,3 @@
-/*
- * Copyright 2014 Google Inc. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
import static com.google.flatbuffers.Constants.*;
@@ -36,6 +21,24 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
+/*
+ * Copyright 2014 Google Inc. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
class JavaTest {
public static void main(String[] args) {
@@ -438,10 +441,6 @@ class JavaTest {
// testType is an existing field and mutating it should succeed
TestEq(monster.testType(), (byte)Any.Monster);
- TestEq(monster.mutateTestType(Any.NONE), true);
- TestEq(monster.testType(), (byte)Any.NONE);
- TestEq(monster.mutateTestType(Any.Monster), true);
- TestEq(monster.testType(), (byte)Any.Monster);
//mutate the inventory vector
TestEq(monster.mutateInventory(0, 1), true);
diff --git a/tests/MyGame/Example/Monster.cs b/tests/MyGame/Example/Monster.cs
index 36d6c2dd..4aa0c240 100644
--- a/tests/MyGame/Example/Monster.cs
+++ b/tests/MyGame/Example/Monster.cs
@@ -44,7 +44,6 @@ public struct Monster : IFlatbufferObject
public MyGame.Example.Color Color { get { int o = __p.__offset(16); return o != 0 ? (MyGame.Example.Color)__p.bb.Get(o + __p.bb_pos) : MyGame.Example.Color.Blue; } }
public bool MutateColor(MyGame.Example.Color color) { int o = __p.__offset(16); if (o != 0) { __p.bb.Put(o + __p.bb_pos, (byte)color); return true; } else { return false; } }
public MyGame.Example.Any TestType { get { int o = __p.__offset(18); return o != 0 ? (MyGame.Example.Any)__p.bb.Get(o + __p.bb_pos) : MyGame.Example.Any.NONE; } }
- public bool MutateTestType(MyGame.Example.Any test_type) { int o = __p.__offset(18); if (o != 0) { __p.bb.Put(o + __p.bb_pos, (byte)test_type); return true; } else { return false; } }
public TTable? Test<TTable>() where TTable : struct, IFlatbufferObject { int o = __p.__offset(20); return o != 0 ? (TTable?)__p.__union<TTable>(o + __p.bb_pos) : null; }
public MyGame.Example.Test? Test4(int j) { int o = __p.__offset(22); return o != 0 ? (MyGame.Example.Test?)(new MyGame.Example.Test()).__assign(__p.__vector(o) + j * 4, __p.bb) : null; }
public int Test4Length { get { int o = __p.__offset(22); return o != 0 ? __p.__vector_len(o) : 0; } }
@@ -174,10 +173,8 @@ public struct Monster : IFlatbufferObject
public ulong[] GetVectorOfNonOwningReferencesArray() { return __p.__vector_as_array<ulong>(88); }
public bool MutateVectorOfNonOwningReferences(int j, ulong vector_of_non_owning_references) { int o = __p.__offset(88); if (o != 0) { __p.bb.PutUlong(__p.__vector(o) + j * 8, vector_of_non_owning_references); return true; } else { return false; } }
public MyGame.Example.AnyUniqueAliases AnyUniqueType { get { int o = __p.__offset(90); return o != 0 ? (MyGame.Example.AnyUniqueAliases)__p.bb.Get(o + __p.bb_pos) : MyGame.Example.AnyUniqueAliases.NONE; } }
- public bool MutateAnyUniqueType(MyGame.Example.AnyUniqueAliases any_unique_type) { int o = __p.__offset(90); if (o != 0) { __p.bb.Put(o + __p.bb_pos, (byte)any_unique_type); return true; } else { return false; } }
public TTable? AnyUnique<TTable>() where TTable : struct, IFlatbufferObject { int o = __p.__offset(92); return o != 0 ? (TTable?)__p.__union<TTable>(o + __p.bb_pos) : null; }
public MyGame.Example.AnyAmbiguousAliases AnyAmbiguousType { get { int o = __p.__offset(94); return o != 0 ? (MyGame.Example.AnyAmbiguousAliases)__p.bb.Get(o + __p.bb_pos) : MyGame.Example.AnyAmbiguousAliases.NONE; } }
- public bool MutateAnyAmbiguousType(MyGame.Example.AnyAmbiguousAliases any_ambiguous_type) { int o = __p.__offset(94); if (o != 0) { __p.bb.Put(o + __p.bb_pos, (byte)any_ambiguous_type); return true; } else { return false; } }
public TTable? AnyAmbiguous<TTable>() where TTable : struct, IFlatbufferObject { int o = __p.__offset(96); return o != 0 ? (TTable?)__p.__union<TTable>(o + __p.bb_pos) : null; }
public MyGame.Example.Color VectorOfEnums(int j) { int o = __p.__offset(98); return o != 0 ? (MyGame.Example.Color)__p.bb.Get(__p.__vector(o) + j * 1) : (MyGame.Example.Color)0; }
public int VectorOfEnumsLength { get { int o = __p.__offset(98); return o != 0 ? __p.__vector_len(o) : 0; } }
diff --git a/tests/MyGame/Example/Monster.java b/tests/MyGame/Example/Monster.java
index 07c4e41b..c9ef6ae9 100644
--- a/tests/MyGame/Example/Monster.java
+++ b/tests/MyGame/Example/Monster.java
@@ -38,7 +38,6 @@ public final class Monster extends Table {
public int color() { int o = __offset(16); return o != 0 ? bb.get(o + bb_pos) & 0xFF : 8; }
public boolean mutateColor(int color) { int o = __offset(16); if (o != 0) { bb.put(o + bb_pos, (byte)color); return true; } else { return false; } }
public byte testType() { int o = __offset(18); return o != 0 ? bb.get(o + bb_pos) : 0; }
- public boolean mutateTestType(byte test_type) { int o = __offset(18); if (o != 0) { bb.put(o + bb_pos, test_type); return true; } else { return false; } }
public Table test(Table obj) { int o = __offset(20); return o != 0 ? __union(obj, o + bb_pos) : null; }
public MyGame.Example.Test test4(int j) { return test4(new MyGame.Example.Test(), j); }
public MyGame.Example.Test test4(MyGame.Example.Test obj, int j) { int o = __offset(22); return o != 0 ? obj.__assign(__vector(o) + j * 4, bb) : null; }
@@ -183,10 +182,8 @@ public final class Monster extends Table {
public ByteBuffer vectorOfNonOwningReferencesInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 88, 8); }
public boolean mutateVectorOfNonOwningReferences(int j, long vector_of_non_owning_references) { int o = __offset(88); if (o != 0) { bb.putLong(__vector(o) + j * 8, vector_of_non_owning_references); return true; } else { return false; } }
public byte anyUniqueType() { int o = __offset(90); return o != 0 ? bb.get(o + bb_pos) : 0; }
- public boolean mutateAnyUniqueType(byte any_unique_type) { int o = __offset(90); if (o != 0) { bb.put(o + bb_pos, any_unique_type); return true; } else { return false; } }
public Table anyUnique(Table obj) { int o = __offset(92); return o != 0 ? __union(obj, o + bb_pos) : null; }
public byte anyAmbiguousType() { int o = __offset(94); return o != 0 ? bb.get(o + bb_pos) : 0; }
- public boolean mutateAnyAmbiguousType(byte any_ambiguous_type) { int o = __offset(94); if (o != 0) { bb.put(o + bb_pos, any_ambiguous_type); return true; } else { return false; } }
public Table anyAmbiguous(Table obj) { int o = __offset(96); return o != 0 ? __union(obj, o + bb_pos) : null; }
public int vectorOfEnums(int j) { int o = __offset(98); return o != 0 ? bb.get(__vector(o) + j * 1) & 0xFF : 0; }
public int vectorOfEnumsLength() { int o = __offset(98); return o != 0 ? __vector_len(o) : 0; }
diff --git a/tests/monster_test_generated.h b/tests/monster_test_generated.h
index c802a680..40dd1203 100644
--- a/tests/monster_test_generated.h
+++ b/tests/monster_test_generated.h
@@ -1353,9 +1353,6 @@ struct Monster FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
MyGame::Example::Any test_type() const {
return static_cast<MyGame::Example::Any>(GetField<uint8_t>(VT_TEST_TYPE, 0));
}
- bool mutate_test_type(MyGame::Example::Any _test_type) {
- return SetField<uint8_t>(VT_TEST_TYPE, static_cast<uint8_t>(_test_type), 0);
- }
const void *test() const {
return GetPointer<const void *>(VT_TEST);
}
@@ -1587,9 +1584,6 @@ struct Monster FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
MyGame::Example::AnyUniqueAliases any_unique_type() const {
return static_cast<MyGame::Example::AnyUniqueAliases>(GetField<uint8_t>(VT_ANY_UNIQUE_TYPE, 0));
}
- bool mutate_any_unique_type(MyGame::Example::AnyUniqueAliases _any_unique_type) {
- return SetField<uint8_t>(VT_ANY_UNIQUE_TYPE, static_cast<uint8_t>(_any_unique_type), 0);
- }
const void *any_unique() const {
return GetPointer<const void *>(VT_ANY_UNIQUE);
}
@@ -1609,9 +1603,6 @@ struct Monster FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
MyGame::Example::AnyAmbiguousAliases any_ambiguous_type() const {
return static_cast<MyGame::Example::AnyAmbiguousAliases>(GetField<uint8_t>(VT_ANY_AMBIGUOUS_TYPE, 0));
}
- bool mutate_any_ambiguous_type(MyGame::Example::AnyAmbiguousAliases _any_ambiguous_type) {
- return SetField<uint8_t>(VT_ANY_AMBIGUOUS_TYPE, static_cast<uint8_t>(_any_ambiguous_type), 0);
- }
const void *any_ambiguous() const {
return GetPointer<const void *>(VT_ANY_AMBIGUOUS);
}
diff --git a/tests/monster_test_generated.js b/tests/monster_test_generated.js
index 1a4f42b3..44eb9eba 100644
--- a/tests/monster_test_generated.js
+++ b/tests/monster_test_generated.js
@@ -1154,21 +1154,6 @@ MyGame.Example.Monster.prototype.testType = function() {
};
/**
- * @param {MyGame.Example.Any} value
- * @returns {boolean}
- */
-MyGame.Example.Monster.prototype.mutate_test_type = function(value) {
- var offset = this.bb.__offset(this.bb_pos, 18);
-
- if (offset === 0) {
- return false;
- }
-
- this.bb.writeUint8(this.bb_pos + offset, value);
- return true;
-};
-
-/**
* @param {flatbuffers.Table} obj
* @returns {?flatbuffers.Table}
*/
@@ -1873,21 +1858,6 @@ MyGame.Example.Monster.prototype.anyUniqueType = function() {
};
/**
- * @param {MyGame.Example.AnyUniqueAliases} value
- * @returns {boolean}
- */
-MyGame.Example.Monster.prototype.mutate_any_unique_type = function(value) {
- var offset = this.bb.__offset(this.bb_pos, 90);
-
- if (offset === 0) {
- return false;
- }
-
- this.bb.writeUint8(this.bb_pos + offset, value);
- return true;
-};
-
-/**
* @param {flatbuffers.Table} obj
* @returns {?flatbuffers.Table}
*/
@@ -1905,21 +1875,6 @@ MyGame.Example.Monster.prototype.anyAmbiguousType = function() {
};
/**
- * @param {MyGame.Example.AnyAmbiguousAliases} value
- * @returns {boolean}
- */
-MyGame.Example.Monster.prototype.mutate_any_ambiguous_type = function(value) {
- var offset = this.bb.__offset(this.bb_pos, 94);
-
- if (offset === 0) {
- return false;
- }
-
- this.bb.writeUint8(this.bb_pos + offset, value);
- return true;
-};
-
-/**
* @param {flatbuffers.Table} obj
* @returns {?flatbuffers.Table}
*/
diff --git a/tests/monster_test_generated.ts b/tests/monster_test_generated.ts
index 617300aa..a6385171 100644
--- a/tests/monster_test_generated.ts
+++ b/tests/monster_test_generated.ts
@@ -1002,21 +1002,6 @@ testType():MyGame.Example.Any {
};
/**
- * @param MyGame.Example.Any value
- * @returns boolean
- */
-mutate_test_type(value:MyGame.Example.Any):boolean {
- var offset = this.bb!.__offset(this.bb_pos, 18);
-
- if (offset === 0) {
- return false;
- }
-
- this.bb!.writeUint8(this.bb_pos + offset, value);
- return true;
-};
-
-/**
* @param flatbuffers.Table obj
* @returns ?flatbuffers.Table
*/
@@ -1725,21 +1710,6 @@ anyUniqueType():MyGame.Example.AnyUniqueAliases {
};
/**
- * @param MyGame.Example.AnyUniqueAliases value
- * @returns boolean
- */
-mutate_any_unique_type(value:MyGame.Example.AnyUniqueAliases):boolean {
- var offset = this.bb!.__offset(this.bb_pos, 90);
-
- if (offset === 0) {
- return false;
- }
-
- this.bb!.writeUint8(this.bb_pos + offset, value);
- return true;
-};
-
-/**
* @param flatbuffers.Table obj
* @returns ?flatbuffers.Table
*/
@@ -1757,21 +1727,6 @@ anyAmbiguousType():MyGame.Example.AnyAmbiguousAliases {
};
/**
- * @param MyGame.Example.AnyAmbiguousAliases value
- * @returns boolean
- */
-mutate_any_ambiguous_type(value:MyGame.Example.AnyAmbiguousAliases):boolean {
- var offset = this.bb!.__offset(this.bb_pos, 94);
-
- if (offset === 0) {
- return false;
- }
-
- this.bb!.writeUint8(this.bb_pos + offset, value);
- return true;
-};
-
-/**
* @param flatbuffers.Table obj
* @returns ?flatbuffers.Table
*/
diff --git a/tests/union_vector/Movie.cs b/tests/union_vector/Movie.cs
index d300b44b..29f680e7 100644
--- a/tests/union_vector/Movie.cs
+++ b/tests/union_vector/Movie.cs
@@ -17,7 +17,6 @@ public struct Movie : IFlatbufferObject
public Movie __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
public Character MainCharacterType { get { int o = __p.__offset(4); return o != 0 ? (Character)__p.bb.Get(o + __p.bb_pos) : Character.NONE; } }
- public bool MutateMainCharacterType(Character main_character_type) { int o = __p.__offset(4); if (o != 0) { __p.bb.Put(o + __p.bb_pos, (byte)main_character_type); return true; } else { return false; } }
public TTable? MainCharacter<TTable>() where TTable : struct, IFlatbufferObject { int o = __p.__offset(6); return o != 0 ? (TTable?)__p.__union<TTable>(o + __p.bb_pos) : null; }
public Character CharactersType(int j) { int o = __p.__offset(8); return o != 0 ? (Character)__p.bb.Get(__p.__vector(o) + j * 1) : (Character)0; }
public int CharactersTypeLength { get { int o = __p.__offset(8); return o != 0 ? __p.__vector_len(o) : 0; } }
@@ -27,7 +26,6 @@ public struct Movie : IFlatbufferObject
public ArraySegment<byte>? GetCharactersTypeBytes() { return __p.__vector_as_arraysegment(8); }
#endif
public Character[] GetCharactersTypeArray() { int o = __p.__offset(8); if (o == 0) return null; int p = __p.__vector(o); int l = __p.__vector_len(o); Character[] a = new Character[l]; for (int i = 0; i < l; i++) { a[i] = (Character)__p.bb.Get(p + i * 1); } return a; }
- public bool MutateCharactersType(int j, Character characters_type) { int o = __p.__offset(8); if (o != 0) { __p.bb.Put(__p.__vector(o) + j * 1, (byte)characters_type); return true; } else { return false; } }
public TTable? Characters<TTable>(int j) where TTable : struct, IFlatbufferObject { int o = __p.__offset(10); return o != 0 ? (TTable?)__p.__union<TTable>(__p.__vector(o) + j * 4) : null; }
public int CharactersLength { get { int o = __p.__offset(10); return o != 0 ? __p.__vector_len(o) : 0; } }
diff --git a/tests/union_vector/Movie.java b/tests/union_vector/Movie.java
index c22cae31..5c6c1da0 100644
--- a/tests/union_vector/Movie.java
+++ b/tests/union_vector/Movie.java
@@ -15,7 +15,6 @@ public final class Movie extends Table {
public Movie __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
public byte mainCharacterType() { int o = __offset(4); return o != 0 ? bb.get(o + bb_pos) : 0; }
- public boolean mutateMainCharacterType(byte main_character_type) { int o = __offset(4); if (o != 0) { bb.put(o + bb_pos, main_character_type); return true; } else { return false; } }
public Table mainCharacter(Table obj) { int o = __offset(6); return o != 0 ? __union(obj, o + bb_pos) : null; }
public byte charactersType(int j) { int o = __offset(8); return o != 0 ? bb.get(__vector(o) + j * 1) : 0; }
public int charactersTypeLength() { int o = __offset(8); return o != 0 ? __vector_len(o) : 0; }
@@ -23,7 +22,6 @@ public final class Movie extends Table {
public ByteVector charactersTypeVector(ByteVector obj) { int o = __offset(8); return o != 0 ? obj.__assign(__vector(o), bb) : null; }
public ByteBuffer charactersTypeAsByteBuffer() { return __vector_as_bytebuffer(8, 1); }
public ByteBuffer charactersTypeInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 8, 1); }
- public boolean mutateCharactersType(int j, byte characters_type) { int o = __offset(8); if (o != 0) { bb.put(__vector(o) + j * 1, characters_type); return true; } else { return false; } }
public Table characters(Table obj, int j) { int o = __offset(10); return o != 0 ? __union(obj, __vector(o) + j * 4) : null; }
public int charactersLength() { int o = __offset(10); return o != 0 ? __vector_len(o) : 0; }
public UnionVector charactersVector() { return charactersVector(new UnionVector()); }
diff --git a/tests/union_vector/union_vector_generated.h b/tests/union_vector/union_vector_generated.h
index fcb1d8c8..40fa6186 100644
--- a/tests/union_vector/union_vector_generated.h
+++ b/tests/union_vector/union_vector_generated.h
@@ -361,9 +361,6 @@ struct Movie FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
Character main_character_type() const {
return static_cast<Character>(GetField<uint8_t>(VT_MAIN_CHARACTER_TYPE, 0));
}
- bool mutate_main_character_type(Character _main_character_type) {
- return SetField<uint8_t>(VT_MAIN_CHARACTER_TYPE, static_cast<uint8_t>(_main_character_type), 0);
- }
const void *main_character() const {
return GetPointer<const void *>(VT_MAIN_CHARACTER);
}
diff --git a/tests/union_vector/union_vector_generated.js b/tests/union_vector/union_vector_generated.js
index c9c071c4..f65206ed 100644
--- a/tests/union_vector/union_vector_generated.js
+++ b/tests/union_vector/union_vector_generated.js
@@ -307,21 +307,6 @@ Movie.prototype.mainCharacterType = function() {
};
/**
- * @param {Character} value
- * @returns {boolean}
- */
-Movie.prototype.mutate_main_character_type = function(value) {
- var offset = this.bb.__offset(this.bb_pos, 4);
-
- if (offset === 0) {
- return false;
- }
-
- this.bb.writeUint8(this.bb_pos + offset, value);
- return true;
-};
-
-/**
* @param {flatbuffers.Table} obj
* @returns {?flatbuffers.Table}
*/
diff --git a/tests/union_vector/union_vector_generated.ts b/tests/union_vector/union_vector_generated.ts
index 642f6728..d0b1c301 100644
--- a/tests/union_vector/union_vector_generated.ts
+++ b/tests/union_vector/union_vector_generated.ts
@@ -259,21 +259,6 @@ mainCharacterType():Character {
};
/**
- * @param Character value
- * @returns boolean
- */
-mutate_main_character_type(value:Character):boolean {
- var offset = this.bb!.__offset(this.bb_pos, 4);
-
- if (offset === 0) {
- return false;
- }
-
- this.bb!.writeUint8(this.bb_pos + offset, value);
- return true;
-};
-
-/**
* @param flatbuffers.Table obj
* @returns ?flatbuffers.Table
*/