forked from BigfootDev/flatbuffers
Adds bool support in structs + updates grpc support + CI upgrades (#5943)
This commit is contained in:
@@ -178,10 +178,7 @@ grpc::string GenerateServerExtensionBody(const grpc_generator::Method *method) {
|
||||
"return ClientStreamingCallHandler(callHandlerContext: "
|
||||
"callHandlerContext) { context in"
|
||||
"\n\t\t\t"
|
||||
"return { request in"
|
||||
"\n\t\t\t\t"
|
||||
"self.$MethodName$(request: request, context: context)"
|
||||
"\n\t\t\t}"
|
||||
"self.$MethodName$(context: context)"
|
||||
"\n\t\t}";
|
||||
}
|
||||
if (method->ServerStreaming()) {
|
||||
@@ -200,10 +197,7 @@ grpc::string GenerateServerExtensionBody(const grpc_generator::Method *method) {
|
||||
"return BidirectionalStreamingCallHandler(callHandlerContext: "
|
||||
"callHandlerContext) { context in"
|
||||
"\n\t\t\t"
|
||||
"return { request in"
|
||||
"\n\t\t\t\t"
|
||||
"self.$MethodName$(request: request, context: context)"
|
||||
"\n\t\t\t}"
|
||||
"self.$MethodName$(context: context)"
|
||||
"\n\t\t}";
|
||||
}
|
||||
return "";
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <cctype>
|
||||
#include <unordered_set>
|
||||
|
||||
#include "flatbuffers/code_generators.h"
|
||||
@@ -262,6 +263,14 @@ class SwiftGenerator : public BaseGenerator {
|
||||
auto type = GenType(field.value.type);
|
||||
if (!is_obj_api) {
|
||||
code += nameprefix + name + ": " + type;
|
||||
if (!IsEnum(field.value.type)) {
|
||||
code += " = ";
|
||||
auto is_bool = IsBool(field.value.type.base_type);
|
||||
auto constant =
|
||||
is_bool ? ("0" == field.value.constant ? "false" : "true")
|
||||
: field.value.constant;
|
||||
code += constant;
|
||||
}
|
||||
code += ", ";
|
||||
continue;
|
||||
}
|
||||
@@ -347,14 +356,16 @@ class SwiftGenerator : public BaseGenerator {
|
||||
|
||||
void GenerateObjectAPIExtensionHeader() {
|
||||
code_ += "\n";
|
||||
code_ += "public mutating func unpack() -> {{STRUCTNAME}}T {";
|
||||
code_ += "public mutating func unpack() -> " +
|
||||
ObjectAPIName("{{STRUCTNAME}}") + " {";
|
||||
Indent();
|
||||
code_ += "return {{STRUCTNAME}}T(&self)";
|
||||
code_ += "return " + ObjectAPIName("{{STRUCTNAME}}") + "(&self)";
|
||||
Outdent();
|
||||
code_ += "}";
|
||||
code_ +=
|
||||
"public static func pack(_ builder: inout FlatBufferBuilder, obj: "
|
||||
"inout {{STRUCTNAME}}T?) -> Offset<UOffset> {";
|
||||
"inout " +
|
||||
ObjectAPIName("{{STRUCTNAME}}") + "?) -> Offset<UOffset> {";
|
||||
Indent();
|
||||
code_ += "guard let obj = obj else { return Offset<UOffset>() }";
|
||||
code_ += "";
|
||||
@@ -504,7 +515,7 @@ class SwiftGenerator : public BaseGenerator {
|
||||
code_.SetValue("VALUETYPE", "Bool");
|
||||
code_.SetValue("CONSTANT", default_value);
|
||||
code_ += "{{VALUETYPE}}" + builder_string +
|
||||
"condition: {{VALUENAME}}, def: {{CONSTANT}}, at: "
|
||||
"element: {{VALUENAME}}, def: {{CONSTANT}}, at: "
|
||||
"{{TABLEOFFSET}}.{{OFFSET}}.p) }";
|
||||
create_func_header.push_back(name + ": " + type + " = " + default_value);
|
||||
return;
|
||||
@@ -754,7 +765,6 @@ class SwiftGenerator : public BaseGenerator {
|
||||
for (auto it = enum_def.Vals().begin(); it != enum_def.Vals().end(); ++it) {
|
||||
const auto &ev = **it;
|
||||
auto name = Name(ev);
|
||||
std::transform(name.begin(), name.end(), name.begin(), LowerCase);
|
||||
code_.SetValue("KEY", name);
|
||||
code_.SetValue("VALUE", enum_def.ToString(ev));
|
||||
GenComment(ev.doc_comment);
|
||||
@@ -788,7 +798,8 @@ class SwiftGenerator : public BaseGenerator {
|
||||
}
|
||||
|
||||
void GenObjectAPI(const StructDef &struct_def) {
|
||||
code_ += "public class {{STRUCTNAME}}T: NativeTable {\n";
|
||||
code_ +=
|
||||
"public class " + ObjectAPIName("{{STRUCTNAME}}") + ": NativeTable {\n";
|
||||
std::vector<std::string> buffer_constructor;
|
||||
std::vector<std::string> base_constructor;
|
||||
Indent();
|
||||
@@ -978,7 +989,8 @@ class SwiftGenerator : public BaseGenerator {
|
||||
|
||||
switch (field.value.type.base_type) {
|
||||
case BASE_TYPE_STRUCT: {
|
||||
code_.SetValue("VALUETYPE", type + "T");
|
||||
type = GenType(field.value.type, true);
|
||||
code_.SetValue("VALUETYPE", type);
|
||||
buffer_constructor.push_back("var __" + name + " = _t." + name);
|
||||
auto optional =
|
||||
(field.value.type.struct_def && field.value.type.struct_def->fixed);
|
||||
@@ -986,7 +998,7 @@ class SwiftGenerator : public BaseGenerator {
|
||||
code_ += "var {{VALUENAME}}: {{VALUETYPE}}" + question_mark;
|
||||
buffer_constructor.push_back("" + name + " = __" + name +
|
||||
question_mark + ".unpack()");
|
||||
base_constructor.push_back("" + name + " = " + type + "T()");
|
||||
base_constructor.push_back("" + name + " = " + type + "()");
|
||||
break;
|
||||
}
|
||||
case BASE_TYPE_ARRAY: FLATBUFFERS_FALLTHROUGH();
|
||||
@@ -1050,7 +1062,7 @@ class SwiftGenerator : public BaseGenerator {
|
||||
|
||||
switch (vectortype.base_type) {
|
||||
case BASE_TYPE_STRUCT: {
|
||||
code_.SetValue("VALUETYPE", GenType(vectortype) + "T");
|
||||
code_.SetValue("VALUETYPE", GenType(vectortype, true));
|
||||
code_ += "var {{VALUENAME}}: [{{VALUETYPE}}?]";
|
||||
buffer_constructor.push_back(indentation + "var __v_ = _t." + name +
|
||||
"(at: index)");
|
||||
@@ -1092,22 +1104,21 @@ class SwiftGenerator : public BaseGenerator {
|
||||
}
|
||||
|
||||
void BuildUnionEnumSwitchCaseWritter(const EnumDef &ev) {
|
||||
auto field_name = EscapeKeyword(ev.name);
|
||||
auto field_name = Name(ev);
|
||||
code_.SetValue("VALUETYPE", field_name);
|
||||
code_ += "switch type {";
|
||||
for (auto it = ev.Vals().begin(); it < ev.Vals().end(); ++it) {
|
||||
auto field = **it;
|
||||
auto ev_name = Name(field);
|
||||
auto type = GenType(field.union_type);
|
||||
std::transform(ev_name.begin(), ev_name.end(), ev_name.begin(),
|
||||
LowerCase);
|
||||
|
||||
if (field.union_type.base_type == BASE_TYPE_NONE ||
|
||||
field.union_type.base_type == BASE_TYPE_STRING) {
|
||||
continue;
|
||||
}
|
||||
code_ += "case ." + ev_name + ":";
|
||||
Indent();
|
||||
code_ += "var __obj = value as? " + type + "T";
|
||||
code_ += "var __obj = value as? " + GenType(field.union_type, true);
|
||||
code_ += "return " + type + ".pack(&builder, obj: &__obj)";
|
||||
Outdent();
|
||||
}
|
||||
@@ -1119,7 +1130,7 @@ class SwiftGenerator : public BaseGenerator {
|
||||
std::vector<std::string> &buffer_constructor,
|
||||
const std::string &indentation = "",
|
||||
const bool is_vector = false) {
|
||||
auto field_name = EscapeKeyword(ev.name);
|
||||
auto field_name = Name(ev);
|
||||
code_.SetValue("VALUETYPE", field_name);
|
||||
code_ += "var {{VALUENAME}}: \\";
|
||||
code_ += is_vector ? "[{{VALUETYPE}}Union?]" : "{{VALUETYPE}}Union?";
|
||||
@@ -1131,8 +1142,6 @@ class SwiftGenerator : public BaseGenerator {
|
||||
for (auto it = ev.Vals().begin(); it < ev.Vals().end(); ++it) {
|
||||
auto field = **it;
|
||||
auto ev_name = Name(field);
|
||||
std::transform(ev_name.begin(), ev_name.end(), ev_name.begin(),
|
||||
LowerCase);
|
||||
if (field.union_type.base_type == BASE_TYPE_NONE ||
|
||||
field.union_type.base_type == BASE_TYPE_STRING) {
|
||||
continue;
|
||||
@@ -1156,7 +1165,7 @@ class SwiftGenerator : public BaseGenerator {
|
||||
auto current_value = str;
|
||||
std::transform(current_value.begin(), current_value.end(),
|
||||
current_value.begin(), LowerCase);
|
||||
code_.SetValue(type, current_value);
|
||||
code_.SetValue(type, EscapeKeyword(MakeCamel(current_value, false)));
|
||||
code_ += "public static var " + type + ": {{ENUM_NAME}} { return .{{" +
|
||||
type + "}} }";
|
||||
}
|
||||
@@ -1238,7 +1247,8 @@ class SwiftGenerator : public BaseGenerator {
|
||||
|
||||
std::string GenMutate(const std::string &offset,
|
||||
const std::string &get_offset, bool isRaw = false) {
|
||||
return "public func mutate({{VALUENAME}}: {{VALUETYPE}}) -> Bool {" +
|
||||
return "@discardableResult public func mutate({{VALUENAME}}: "
|
||||
"{{VALUETYPE}}) -> Bool {" +
|
||||
get_offset + " return {{ACCESS}}.mutate({{VALUENAME}}" +
|
||||
(isRaw ? ".rawValue" : "") + ", index: " + offset + ") }";
|
||||
}
|
||||
@@ -1258,10 +1268,10 @@ class SwiftGenerator : public BaseGenerator {
|
||||
auto enum_val = enum_def.FindByValue(value.constant);
|
||||
std::string name;
|
||||
if (enum_val) {
|
||||
name = enum_val->name;
|
||||
name = Name(*enum_val);
|
||||
} else {
|
||||
const auto &ev = **enum_def.Vals().begin();
|
||||
name = ev.name;
|
||||
name = Name(ev);
|
||||
}
|
||||
std::transform(name.begin(), name.end(), name.begin(), LowerCase);
|
||||
return "." + name;
|
||||
@@ -1275,18 +1285,27 @@ class SwiftGenerator : public BaseGenerator {
|
||||
return "static func validateVersion() { FlatBuffersVersion_1_12_0() }";
|
||||
}
|
||||
|
||||
std::string GenType(const Type &type) const {
|
||||
std::string GenType(const Type &type,
|
||||
bool should_consider_prefix = false) const {
|
||||
return IsScalar(type.base_type)
|
||||
? GenTypeBasic(type)
|
||||
: (IsArray(type) ? GenType(type.VectorType())
|
||||
: GenTypePointer(type));
|
||||
: GenTypePointer(type, should_consider_prefix));
|
||||
}
|
||||
|
||||
std::string GenTypePointer(const Type &type) const {
|
||||
std::string GenTypePointer(const Type &type,
|
||||
bool should_consider_prefix) const {
|
||||
switch (type.base_type) {
|
||||
case BASE_TYPE_STRING: return "String";
|
||||
case BASE_TYPE_VECTOR: return GenType(type.VectorType());
|
||||
case BASE_TYPE_STRUCT: return WrapInNameSpace(*type.struct_def);
|
||||
case BASE_TYPE_STRUCT: {
|
||||
if (should_consider_prefix) {
|
||||
auto &struct_ = *type.struct_def;
|
||||
return WrapInNameSpace(struct_.defined_namespace,
|
||||
ObjectAPIName(struct_.name));
|
||||
}
|
||||
return WrapInNameSpace(*type.struct_def);
|
||||
}
|
||||
case BASE_TYPE_UNION:
|
||||
default: return "FlatBufferObject";
|
||||
}
|
||||
@@ -1296,6 +1315,10 @@ class SwiftGenerator : public BaseGenerator {
|
||||
return GenTypeBasic(type, true);
|
||||
}
|
||||
|
||||
std::string ObjectAPIName(const std::string &name) const {
|
||||
return parser_.opts.object_prefix + name + parser_.opts.object_suffix;
|
||||
}
|
||||
|
||||
void Indent() { code_.IncrementIdentLevel(); }
|
||||
|
||||
void Outdent() { code_.DecrementIdentLevel(); }
|
||||
@@ -1323,7 +1346,13 @@ class SwiftGenerator : public BaseGenerator {
|
||||
return keywords_.find(name) == keywords_.end() ? name : name + "_";
|
||||
}
|
||||
|
||||
std::string Name(const EnumVal &ev) const { return EscapeKeyword(ev.name); }
|
||||
std::string Name(const EnumVal &ev) const {
|
||||
auto name = ev.name;
|
||||
if (isupper(name.front())) {
|
||||
std::transform(name.begin(), name.end(), name.begin(), LowerCase);
|
||||
}
|
||||
return EscapeKeyword(MakeCamel(name, false));
|
||||
}
|
||||
|
||||
std::string Name(const Definition &def) const {
|
||||
return EscapeKeyword(MakeCamel(def.name, false));
|
||||
|
||||
@@ -52,6 +52,14 @@ extension Float32: Scalar {
|
||||
}
|
||||
}
|
||||
|
||||
extension Bool: Scalar {
|
||||
public var convertedEndian: UInt8 {
|
||||
return self == true ? 1 : 0
|
||||
}
|
||||
|
||||
public typealias NumericValue = UInt8
|
||||
}
|
||||
|
||||
extension Int: Scalar {
|
||||
public typealias NumericValue = Int
|
||||
}
|
||||
|
||||
@@ -270,24 +270,6 @@ public struct FlatBufferBuilder {
|
||||
return push(element: Int32(len))
|
||||
}
|
||||
|
||||
/// Creates a vector of type Bool in the buffer
|
||||
/// - Parameter elements: elements to be written into the buffer
|
||||
/// - returns: Offset of the vector
|
||||
mutating public func createVector(_ elements: [Bool]) -> Offset<UOffset> {
|
||||
return createVector(elements, size: elements.count)
|
||||
}
|
||||
|
||||
/// Creates a vector of type Bool in the buffer
|
||||
/// - Parameter elements: Elements to be written into the buffer
|
||||
/// - Parameter size: Count of elements
|
||||
/// - returns: Offset of the vector
|
||||
mutating public func createVector(_ elements: [Bool], size: Int) -> Offset<UOffset> {
|
||||
let size = size
|
||||
startVector(size, elementSize: MemoryLayout<Bool>.size)
|
||||
_bb.push(elements: elements)
|
||||
return Offset(offset: endVector(len: size))
|
||||
}
|
||||
|
||||
/// Creates a vector of type Scalar in the buffer
|
||||
/// - Parameter elements: elements to be written into the buffer
|
||||
/// - returns: Offset of the vector
|
||||
@@ -469,6 +451,7 @@ public struct FlatBufferBuilder {
|
||||
/// - condition: Condition to insert
|
||||
/// - def: Default condition
|
||||
/// - position: The predefined position of the element
|
||||
@available(*, deprecated, message: "Deprecated, function will be removed in Flatbuffers v0.6.0. Regenerate code")
|
||||
mutating public func add(condition: Bool, def: Bool, at position: VOffset) {
|
||||
if (condition == def && !serializeDefaults) {
|
||||
track(offset: 0, at: position)
|
||||
|
||||
@@ -28,69 +28,3 @@ public protocol Enum {
|
||||
static var byteSize: Int { get }
|
||||
var value: T { get }
|
||||
}
|
||||
|
||||
/// Mutable is a protocol that allows us to mutate Scalar values within the buffer
|
||||
public protocol Mutable {
|
||||
/// makes Flatbuffer accessed within the Protocol
|
||||
var bb: ByteBuffer { get }
|
||||
/// makes position of the table/struct accessed within the Protocol
|
||||
var postion: Int32 { get }
|
||||
}
|
||||
|
||||
extension Mutable {
|
||||
|
||||
/// Mutates the memory in the buffer, this is only called from the access function of table and structs
|
||||
/// - Parameters:
|
||||
/// - value: New value to be inserted to the buffer
|
||||
/// - index: index of the Element
|
||||
func mutate<T: Scalar>(value: T, o: Int32) -> Bool {
|
||||
guard o != 0 else { return false }
|
||||
bb.write(value: value, index: Int(o), direct: true)
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension Mutable where Self == Table {
|
||||
|
||||
/// Mutates a value by calling mutate with respect to the position in the table
|
||||
/// - Parameters:
|
||||
/// - value: New value to be inserted to the buffer
|
||||
/// - index: index of the Element
|
||||
public func mutate<T: Scalar>(_ value: T, index: Int32) -> Bool {
|
||||
guard index != 0 else { return false }
|
||||
return mutate(value: value, o: index + postion)
|
||||
}
|
||||
|
||||
/// Directly mutates the element by calling mutate
|
||||
///
|
||||
/// Mutates the Element at index ignoring the current position by calling mutate
|
||||
/// - Parameters:
|
||||
/// - value: New value to be inserted to the buffer
|
||||
/// - index: index of the Element
|
||||
public func directMutate<T: Scalar>(_ value: T, index: Int32) -> Bool {
|
||||
return mutate(value: value, o: index)
|
||||
}
|
||||
}
|
||||
|
||||
extension Mutable where Self == Struct {
|
||||
|
||||
/// Mutates a value by calling mutate with respect to the position in the struct
|
||||
/// - Parameters:
|
||||
/// - value: New value to be inserted to the buffer
|
||||
/// - index: index of the Element
|
||||
public func mutate<T: Scalar>(_ value: T, index: Int32) -> Bool {
|
||||
return mutate(value: value, o: index + postion)
|
||||
}
|
||||
|
||||
/// Directly mutates the element by calling mutate
|
||||
///
|
||||
/// Mutates the Element at index ignoring the current position by calling mutate
|
||||
/// - Parameters:
|
||||
/// - value: New value to be inserted to the buffer
|
||||
/// - index: index of the Element
|
||||
public func directMutate<T: Scalar>(_ value: T, index: Int32) -> Bool {
|
||||
return mutate(value: value, o: index)
|
||||
}
|
||||
}
|
||||
extension Struct: Mutable {}
|
||||
extension Table: Mutable {}
|
||||
|
||||
68
swift/Sources/FlatBuffers/Mutable.swift
Normal file
68
swift/Sources/FlatBuffers/Mutable.swift
Normal file
@@ -0,0 +1,68 @@
|
||||
import Foundation
|
||||
|
||||
/// Mutable is a protocol that allows us to mutate Scalar values within the buffer
|
||||
public protocol Mutable {
|
||||
/// makes Flatbuffer accessed within the Protocol
|
||||
var bb: ByteBuffer { get }
|
||||
/// makes position of the table/struct accessed within the Protocol
|
||||
var postion: Int32 { get }
|
||||
}
|
||||
|
||||
extension Mutable {
|
||||
|
||||
/// Mutates the memory in the buffer, this is only called from the access function of table and structs
|
||||
/// - Parameters:
|
||||
/// - value: New value to be inserted to the buffer
|
||||
/// - index: index of the Element
|
||||
func mutate<T: Scalar>(value: T, o: Int32) -> Bool {
|
||||
guard o != 0 else { return false }
|
||||
bb.write(value: value, index: Int(o), direct: true)
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension Mutable where Self == Table {
|
||||
|
||||
/// Mutates a value by calling mutate with respect to the position in the table
|
||||
/// - Parameters:
|
||||
/// - value: New value to be inserted to the buffer
|
||||
/// - index: index of the Element
|
||||
public func mutate<T: Scalar>(_ value: T, index: Int32) -> Bool {
|
||||
guard index != 0 else { return false }
|
||||
return mutate(value: value, o: index + postion)
|
||||
}
|
||||
|
||||
/// Directly mutates the element by calling mutate
|
||||
///
|
||||
/// Mutates the Element at index ignoring the current position by calling mutate
|
||||
/// - Parameters:
|
||||
/// - value: New value to be inserted to the buffer
|
||||
/// - index: index of the Element
|
||||
public func directMutate<T: Scalar>(_ value: T, index: Int32) -> Bool {
|
||||
return mutate(value: value, o: index)
|
||||
}
|
||||
}
|
||||
|
||||
extension Mutable where Self == Struct {
|
||||
|
||||
/// Mutates a value by calling mutate with respect to the position in the struct
|
||||
/// - Parameters:
|
||||
/// - value: New value to be inserted to the buffer
|
||||
/// - index: index of the Element
|
||||
public func mutate<T: Scalar>(_ value: T, index: Int32) -> Bool {
|
||||
return mutate(value: value, o: index + postion)
|
||||
}
|
||||
|
||||
/// Directly mutates the element by calling mutate
|
||||
///
|
||||
/// Mutates the Element at index ignoring the current position by calling mutate
|
||||
/// - Parameters:
|
||||
/// - value: New value to be inserted to the buffer
|
||||
/// - index: index of the Element
|
||||
public func directMutate<T: Scalar>(_ value: T, index: Int32) -> Bool {
|
||||
return mutate(value: value, o: index)
|
||||
}
|
||||
}
|
||||
|
||||
extension Struct: Mutable {}
|
||||
extension Table: Mutable {}
|
||||
@@ -10,12 +10,13 @@ let package = Package(
|
||||
.macOS(.v10_14),
|
||||
],
|
||||
dependencies: [
|
||||
.package(path: "../../swift/")
|
||||
.package(path: "../../swift/"),
|
||||
.package(url: "https://github.com/grpc/grpc-swift.git", from: "1.0.0-alpha.12")
|
||||
],
|
||||
targets: [
|
||||
.target(name: "SwiftFlatBuffers"),
|
||||
.testTarget(
|
||||
name: "FlatBuffers.Test.SwiftTests",
|
||||
dependencies: ["FlatBuffers"]),
|
||||
dependencies: ["FlatBuffers", "GRPC"]),
|
||||
]
|
||||
)
|
||||
|
||||
@@ -2,9 +2,8 @@ swift_dir=`pwd`
|
||||
cd ..
|
||||
test_dir=`pwd`
|
||||
|
||||
${test_dir}/../flatc --swift --gen-mutable --gen-object-api -I ${test_dir}/include_test ${test_dir}/monster_test.fbs ${test_dir}/union_vector/union_vector.fbs
|
||||
cd ${test_dir}
|
||||
mv *_generated.swift ${swift_dir}/Tests/FlatBuffers.Test.SwiftTests
|
||||
cd ${swift_dir}/Tests/FlatBuffers.Test.SwiftTests
|
||||
${test_dir}/../flatc --swift --gen-mutable --grpc --gen-object-api -I ${test_dir}/include_test ${test_dir}/monster_test.fbs ${test_dir}/union_vector/union_vector.fbs
|
||||
cd ${swift_dir}
|
||||
swift build --build-tests
|
||||
swift test
|
||||
|
||||
@@ -2,9 +2,10 @@ import XCTest
|
||||
import Foundation
|
||||
@testable import FlatBuffers
|
||||
|
||||
typealias Test1 = MyGame.Example.Test
|
||||
typealias Monster1 = MyGame.Example.Monster
|
||||
typealias Vec3 = MyGame.Example.Vec3
|
||||
public typealias Test = MyGame.Example.Test
|
||||
public typealias Monster = MyGame.Example.Monster
|
||||
public typealias Vec3 = MyGame.Example.Vec3
|
||||
public typealias Stat = MyGame.Example.Stat
|
||||
|
||||
class FlatBuffersMonsterWriterTests: XCTestCase {
|
||||
|
||||
@@ -45,14 +46,14 @@ class FlatBuffersMonsterWriterTests: XCTestCase {
|
||||
}
|
||||
|
||||
func readMonster(fb: ByteBuffer) {
|
||||
var monster = Monster1.getRootAsMonster(bb: fb)
|
||||
var monster = Monster.getRootAsMonster(bb: fb)
|
||||
readFlatbufferMonster(monster: &monster)
|
||||
var unpacked: MyGame.Example.MonsterT? = monster.unpack()
|
||||
readObjectApi(monster: unpacked!)
|
||||
var builder = FlatBufferBuilder()
|
||||
let root = Monster1.pack(&builder, obj: &unpacked)
|
||||
let root = Monster.pack(&builder, obj: &unpacked)
|
||||
builder.finish(offset: root)
|
||||
var newMonster = Monster1.getRootAsMonster(bb: builder.sizedBuffer)
|
||||
var newMonster = Monster.getRootAsMonster(bb: builder.sizedBuffer)
|
||||
readFlatbufferMonster(monster: &newMonster)
|
||||
}
|
||||
|
||||
@@ -60,17 +61,17 @@ class FlatBuffersMonsterWriterTests: XCTestCase {
|
||||
var fbb = FlatBufferBuilder(initialSize: 1)
|
||||
let names = [fbb.create(string: "Frodo"), fbb.create(string: "Barney"), fbb.create(string: "Wilma")]
|
||||
var offsets: [Offset<UOffset>] = []
|
||||
let start1 = Monster1.startMonster(&fbb)
|
||||
Monster1.add(name: names[0], &fbb)
|
||||
offsets.append(Monster1.endMonster(&fbb, start: start1))
|
||||
let start2 = Monster1.startMonster(&fbb)
|
||||
Monster1.add(name: names[1], &fbb)
|
||||
offsets.append(Monster1.endMonster(&fbb, start: start2))
|
||||
let start3 = Monster1.startMonster(&fbb)
|
||||
Monster1.add(name: names[2], &fbb)
|
||||
offsets.append(Monster1.endMonster(&fbb, start: start3))
|
||||
let start1 = Monster.startMonster(&fbb)
|
||||
Monster.add(name: names[0], &fbb)
|
||||
offsets.append(Monster.endMonster(&fbb, start: start1))
|
||||
let start2 = Monster.startMonster(&fbb)
|
||||
Monster.add(name: names[1], &fbb)
|
||||
offsets.append(Monster.endMonster(&fbb, start: start2))
|
||||
let start3 = Monster.startMonster(&fbb)
|
||||
Monster.add(name: names[2], &fbb)
|
||||
offsets.append(Monster.endMonster(&fbb, start: start3))
|
||||
|
||||
let sortedArray = Monster1.sortVectorOfMonster(offsets: offsets, &fbb)
|
||||
let sortedArray = Monster.sortVectorOfMonster(offsets: offsets, &fbb)
|
||||
|
||||
let str = fbb.create(string: "MyMonster")
|
||||
let test1 = fbb.create(string: "test1")
|
||||
@@ -79,34 +80,34 @@ class FlatBuffersMonsterWriterTests: XCTestCase {
|
||||
let inv = fbb.createVector(_inv)
|
||||
|
||||
let fred = fbb.create(string: "Fred")
|
||||
let mon1Start = Monster1.startMonster(&fbb)
|
||||
Monster1.add(name: fred, &fbb)
|
||||
let mon2 = Monster1.endMonster(&fbb, start: mon1Start)
|
||||
let mon1Start = Monster.startMonster(&fbb)
|
||||
Monster.add(name: fred, &fbb)
|
||||
let mon2 = Monster.endMonster(&fbb, start: mon1Start)
|
||||
let test4 = fbb.createVector(structs: [MyGame.Example.createTest(a: 30, b: 40),
|
||||
MyGame.Example.createTest(a: 10, b: 20)],
|
||||
type: Test1.self)
|
||||
type: Test.self)
|
||||
|
||||
let stringTestVector = fbb.createVector(ofOffsets: [test1, test2])
|
||||
|
||||
let mStart = Monster1.startMonster(&fbb)
|
||||
let mStart = Monster.startMonster(&fbb)
|
||||
let posOffset = fbb.create(struct: MyGame.Example.createVec3(x: 1, y: 2, z: 3, test1: 3, test2: .green, test3a: 5, test3b: 6), type: Vec3.self)
|
||||
Monster1.add(pos: posOffset, &fbb)
|
||||
Monster1.add(hp: 80, &fbb)
|
||||
Monster1.add(name: str, &fbb)
|
||||
Monster1.addVectorOf(inventory: inv, &fbb)
|
||||
Monster1.add(testType: .monster, &fbb)
|
||||
Monster1.add(test: mon2, &fbb)
|
||||
Monster1.addVectorOf(test4: test4, &fbb)
|
||||
Monster1.addVectorOf(testarrayofstring: stringTestVector, &fbb)
|
||||
Monster1.add(testbool: true, &fbb)
|
||||
Monster1.addVectorOf(testarrayoftables: sortedArray, &fbb)
|
||||
let end = Monster1.endMonster(&fbb, start: mStart)
|
||||
Monster1.finish(&fbb, end: end, prefix: prefix)
|
||||
Monster.add(pos: posOffset, &fbb)
|
||||
Monster.add(hp: 80, &fbb)
|
||||
Monster.add(name: str, &fbb)
|
||||
Monster.addVectorOf(inventory: inv, &fbb)
|
||||
Monster.add(testType: .monster, &fbb)
|
||||
Monster.add(test: mon2, &fbb)
|
||||
Monster.addVectorOf(test4: test4, &fbb)
|
||||
Monster.addVectorOf(testarrayofstring: stringTestVector, &fbb)
|
||||
Monster.add(testbool: true, &fbb)
|
||||
Monster.addVectorOf(testarrayoftables: sortedArray, &fbb)
|
||||
let end = Monster.endMonster(&fbb, start: mStart)
|
||||
Monster.finish(&fbb, end: end, prefix: prefix)
|
||||
return fbb
|
||||
}
|
||||
|
||||
func mutateMonster(fb: ByteBuffer) {
|
||||
let monster = Monster1.getRootAsMonster(bb: fb)
|
||||
let monster = Monster.getRootAsMonster(bb: fb)
|
||||
XCTAssertFalse(monster.mutate(mana: 10))
|
||||
XCTAssertEqual(monster.testarrayoftables(at: 0)?.name, "Barney")
|
||||
XCTAssertEqual(monster.testarrayoftables(at: 1)?.name, "Frodo")
|
||||
@@ -160,7 +161,7 @@ class FlatBuffersMonsterWriterTests: XCTestCase {
|
||||
XCTAssertEqual(test?.a, 5)
|
||||
XCTAssertEqual(test?.b, 6)
|
||||
XCTAssertEqual(monster.testType, .monster)
|
||||
let monster2 = monster.test(type: Monster1.self)
|
||||
let monster2 = monster.test(type: Monster.self)
|
||||
XCTAssertEqual(monster2?.name, "Fred")
|
||||
|
||||
XCTAssertEqual(monster.mutate(mana: 10), false)
|
||||
|
||||
@@ -61,7 +61,22 @@ final class FlatBuffersStructsTests: XCTestCase {
|
||||
XCTAssertEqual(point.vec?.x, 1.0)
|
||||
XCTAssertEqual(point.vec?.y, 2.0)
|
||||
XCTAssertEqual(point.vec?.z, 3.0)
|
||||
XCTAssertEqual(point.UType, Test.vec)
|
||||
XCTAssertEqual(point.UType, Test1.vec)
|
||||
}
|
||||
|
||||
func testWritingAndMutatingBools() {
|
||||
var b = FlatBufferBuilder()
|
||||
let offset = b.create(struct: createProperty(), type: Property.self)
|
||||
let root = TestMutatingBool.createTestMutatingBool(&b, offsetOfB: offset)
|
||||
b.finish(offset: root)
|
||||
|
||||
let testMutatingBool = TestMutatingBool.getRootAsTestMutatingBool(bb: b.sizedBuffer)
|
||||
let property = testMutatingBool.b
|
||||
XCTAssertEqual(property?.property, false)
|
||||
property?.mutate(property: false)
|
||||
XCTAssertEqual(property?.property, false)
|
||||
property?.mutate(property: true)
|
||||
XCTAssertEqual(property?.property, true)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -134,7 +149,7 @@ struct VPointerVectorVec {
|
||||
}
|
||||
|
||||
enum Color2: Int32 { case red = 0, green = 1, blue = 2 }
|
||||
enum Test: Byte { case none = 0, vec = 1 }
|
||||
enum Test1: Byte { case none = 0, vec = 1 }
|
||||
|
||||
func createVec2(x: Float32 = 0, y: Float32 = 0, z: Float32 = 0, color: Color2) -> UnsafeMutableRawPointer {
|
||||
let memory = UnsafeMutableRawPointer.allocate(byteCount: Vec2.size, alignment: Vec2.alignment)
|
||||
@@ -168,7 +183,7 @@ struct VPointerVec2 {
|
||||
}
|
||||
|
||||
var vec: Vec2? { let o = __t.offset(4); return o == 0 ? nil : Vec2( __t.bb, o: o + __t.postion) }
|
||||
var UType: Test? { let o = __t.offset(6); return o == 0 ? Test.none : Test(rawValue: __t.readBuffer(of: Byte.self, at: o)) }
|
||||
var UType: Test1? { let o = __t.offset(6); return o == 0 ? Test1.none : Test1(rawValue: __t.readBuffer(of: Byte.self, at: o)) }
|
||||
|
||||
@inlinable static func getRootAsCountry(_ bb: ByteBuffer) -> VPointerVec2 {
|
||||
return VPointerVec2(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: 0))))
|
||||
@@ -177,10 +192,10 @@ struct VPointerVec2 {
|
||||
static func startVPointer(b: inout FlatBufferBuilder) -> UOffset { b.startTable(with: 3) }
|
||||
static func finish(b: inout FlatBufferBuilder, s: UOffset) -> Offset<UOffset> { return Offset(offset: b.endTable(at: s)) }
|
||||
|
||||
static func createVPointer(b: inout FlatBufferBuilder, o: Offset<UOffset>, type: Test) -> Offset<UOffset> {
|
||||
static func createVPointer(b: inout FlatBufferBuilder, o: Offset<UOffset>, type: Test1) -> Offset<UOffset> {
|
||||
let s = VPointerVec2.startVPointer(b: &b)
|
||||
b.add(structOffset: 4)
|
||||
b.add(element: type.rawValue, def: Test.none.rawValue, at: 6)
|
||||
b.add(element: type.rawValue, def: Test1.none.rawValue, at: 6)
|
||||
b.add(offset: o, at: 8)
|
||||
return VPointerVec2.finish(b: &b, s: s)
|
||||
}
|
||||
|
||||
@@ -11,14 +11,14 @@ final class FlatBuffersUnionTests: XCTestCase {
|
||||
let axe = b.create(string: str)
|
||||
let weapon = Weapon.createWeapon(builder: &b, offset: axe, dmg: dmg)
|
||||
let weapons = b.createVector(ofOffsets: [weapon])
|
||||
let root = Monster.createMonster(builder: &b,
|
||||
let root = LocalMonster.createMonster(builder: &b,
|
||||
offset: weapons,
|
||||
equipment: .Weapon,
|
||||
equippedOffset: weapon.o)
|
||||
b.finish(offset: root)
|
||||
let buffer = b.sizedByteArray
|
||||
XCTAssertEqual(buffer, [16, 0, 0, 0, 0, 0, 10, 0, 16, 0, 8, 0, 7, 0, 12, 0, 10, 0, 0, 0, 0, 0, 0, 1, 8, 0, 0, 0, 20, 0, 0, 0, 1, 0, 0, 0, 12, 0, 0, 0, 8, 0, 12, 0, 8, 0, 6, 0, 8, 0, 0, 0, 0, 0, 5, 0, 4, 0, 0, 0, 3, 0, 0, 0, 65, 120, 101, 0])
|
||||
let monster = Monster.getRootAsMonster(bb: ByteBuffer(bytes: buffer))
|
||||
let monster = LocalMonster.getRootAsMonster(bb: ByteBuffer(bytes: buffer))
|
||||
XCTAssertEqual(monster.weapon(at: 0)?.dmg, dmg)
|
||||
XCTAssertEqual(monster.weapon(at: 0)?.name, str)
|
||||
XCTAssertEqual(monster.weapon(at: 0)?.nameVector, [65, 120, 101])
|
||||
@@ -160,7 +160,7 @@ struct FinalMonster {
|
||||
weapons: Offset<UOffset>,
|
||||
equipment: Equipment = .none,
|
||||
equippedOffset: Offset<Weapon>,
|
||||
path: Offset<UOffset>) -> Offset<Monster> {
|
||||
path: Offset<UOffset>) -> Offset<LocalMonster> {
|
||||
let start = builder.startTable(with: 11)
|
||||
builder.add(structOffset: 4)
|
||||
builder.add(element: hp, def: 100, at: 8)
|
||||
@@ -175,7 +175,7 @@ struct FinalMonster {
|
||||
}
|
||||
}
|
||||
|
||||
struct Monster {
|
||||
struct LocalMonster {
|
||||
|
||||
private var __t: Table
|
||||
|
||||
@@ -188,14 +188,14 @@ struct Monster {
|
||||
let o = __t.offset(8); return o == 0 ? nil : __t.union(o)
|
||||
}
|
||||
|
||||
static func getRootAsMonster(bb: ByteBuffer) -> Monster {
|
||||
return Monster(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: 0))))
|
||||
static func getRootAsMonster(bb: ByteBuffer) -> LocalMonster {
|
||||
return LocalMonster(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: 0))))
|
||||
}
|
||||
|
||||
@inlinable static func createMonster(builder: inout FlatBufferBuilder,
|
||||
offset: Offset<UOffset>,
|
||||
equipment: Equipment = .none,
|
||||
equippedOffset: UOffset) -> Offset<Monster> {
|
||||
equippedOffset: UOffset) -> Offset<LocalMonster> {
|
||||
let start = builder.startTable(with: 3)
|
||||
builder.add(element: equippedOffset, def: 0, at: 8)
|
||||
builder.add(offset: offset, at: 4)
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
import FlatBuffers
|
||||
|
||||
public struct Property: Readable {
|
||||
|
||||
static func validateVersion() { FlatBuffersVersion_1_12_0() }
|
||||
public var __buffer: ByteBuffer! { return _accessor.bb }
|
||||
private var _accessor: Struct
|
||||
|
||||
public static var size = 1
|
||||
public static var alignment = 1
|
||||
public init(_ bb: ByteBuffer, o: Int32) { _accessor = Struct(bb: bb, position: o) }
|
||||
|
||||
public var property: Bool { return _accessor.readBuffer(of: Bool.self, at: 0) }
|
||||
@discardableResult public func mutate(property: Bool) -> Bool { return _accessor.mutate(property, index: 0) }
|
||||
}
|
||||
|
||||
public func createProperty(property: Bool = false) -> UnsafeMutableRawPointer {
|
||||
let memory = UnsafeMutableRawPointer.allocate(byteCount: Property.size, alignment: Property.alignment)
|
||||
memory.initializeMemory(as: UInt8.self, repeating: 0, count: Property.size)
|
||||
memory.storeBytes(of: property, toByteOffset: 0, as: Bool.self)
|
||||
return memory
|
||||
}
|
||||
|
||||
public struct TestMutatingBool: FlatBufferObject {
|
||||
|
||||
static func validateVersion() { FlatBuffersVersion_1_12_0() }
|
||||
public var __buffer: ByteBuffer! { return _accessor.bb }
|
||||
private var _accessor: Table
|
||||
|
||||
public static func getRootAsTestMutatingBool(bb: ByteBuffer) -> TestMutatingBool { return TestMutatingBool(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) }
|
||||
|
||||
private init(_ t: Table) { _accessor = t }
|
||||
public init(_ bb: ByteBuffer, o: Int32) { _accessor = Table(bb: bb, position: o) }
|
||||
|
||||
enum VTOFFSET: VOffset {
|
||||
case b = 4
|
||||
var v: Int32 { Int32(self.rawValue) }
|
||||
var p: VOffset { self.rawValue }
|
||||
}
|
||||
|
||||
public var b: Property? { let o = _accessor.offset(VTOFFSET.b.v); return o == 0 ? nil : Property(_accessor.bb, o: o + _accessor.postion) }
|
||||
public static func startTestMutatingBool(_ fbb: inout FlatBufferBuilder) -> UOffset { fbb.startTable(with: 1) }
|
||||
public static func add(b: Offset<UOffset>, _ fbb: inout FlatBufferBuilder) { fbb.add(structOffset: VTOFFSET.b.p) }
|
||||
public static func endTestMutatingBool(_ fbb: inout FlatBufferBuilder, start: UOffset) -> Offset<UOffset> { let end = Offset<UOffset>(offset: fbb.endTable(at: start)); return end }
|
||||
public static func createTestMutatingBool(_ fbb: inout FlatBufferBuilder,
|
||||
offsetOfB b: Offset<UOffset> = Offset()) -> Offset<UOffset> {
|
||||
let __start = TestMutatingBool.startTestMutatingBool(&fbb)
|
||||
TestMutatingBool.add(b: b, &fbb)
|
||||
return TestMutatingBool.endTestMutatingBool(&fbb, start: __start)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,15 +78,11 @@ public extension MonsterStorageProvider {
|
||||
}
|
||||
case "GetMaxHitPoint":
|
||||
return ClientStreamingCallHandler(callHandlerContext: callHandlerContext) { context in
|
||||
return { request in
|
||||
self.GetMaxHitPoint(request: request, context: context)
|
||||
}
|
||||
self.GetMaxHitPoint(context: context)
|
||||
}
|
||||
case "GetMinMaxHitPoints":
|
||||
return BidirectionalStreamingCallHandler(callHandlerContext: callHandlerContext) { context in
|
||||
return { request in
|
||||
self.GetMinMaxHitPoints(request: request, context: context)
|
||||
}
|
||||
self.GetMinMaxHitPoints(context: context)
|
||||
}
|
||||
default: return nil;
|
||||
}
|
||||
@@ -26,28 +26,28 @@ public enum Race: Int8, Enum {
|
||||
public typealias T = Int8
|
||||
public static var byteSize: Int { return MemoryLayout<Int8>.size }
|
||||
public var value: Int8 { return self.rawValue }
|
||||
case none = -1
|
||||
case none_ = -1
|
||||
case human = 0
|
||||
case dwarf = 1
|
||||
case elf = 2
|
||||
|
||||
|
||||
public static var max: Race { return .elf }
|
||||
public static var min: Race { return .none }
|
||||
public static var min: Race { return .none_ }
|
||||
}
|
||||
|
||||
public enum Any_: UInt8, Enum {
|
||||
public typealias T = UInt8
|
||||
public static var byteSize: Int { return MemoryLayout<UInt8>.size }
|
||||
public var value: UInt8 { return self.rawValue }
|
||||
case none = 0
|
||||
case none_ = 0
|
||||
case monster = 1
|
||||
case testsimpletablewithenum = 2
|
||||
case mygame_example2_monster = 3
|
||||
case mygameExample2Monster = 3
|
||||
|
||||
|
||||
public static var max: Any_ { return .mygame_example2_monster }
|
||||
public static var min: Any_ { return .none }
|
||||
public static var max: Any_ { return .mygameExample2Monster }
|
||||
public static var min: Any_ { return .none_ }
|
||||
}
|
||||
|
||||
struct Any_Union {
|
||||
@@ -65,7 +65,7 @@ struct Any_Union {
|
||||
case .testsimpletablewithenum:
|
||||
var __obj = value as? MyGame.Example.TestSimpleTableWithEnumT
|
||||
return MyGame.Example.TestSimpleTableWithEnum.pack(&builder, obj: &__obj)
|
||||
case .mygame_example2_monster:
|
||||
case .mygameExample2Monster:
|
||||
var __obj = value as? MyGame.Example2.MonsterT
|
||||
return MyGame.Example2.Monster.pack(&builder, obj: &__obj)
|
||||
default: return Offset()
|
||||
@@ -76,14 +76,14 @@ public enum AnyUniqueAliases: UInt8, Enum {
|
||||
public typealias T = UInt8
|
||||
public static var byteSize: Int { return MemoryLayout<UInt8>.size }
|
||||
public var value: UInt8 { return self.rawValue }
|
||||
case none = 0
|
||||
case none_ = 0
|
||||
case m = 1
|
||||
case ts = 2
|
||||
case m2 = 3
|
||||
|
||||
|
||||
public static var max: AnyUniqueAliases { return .m2 }
|
||||
public static var min: AnyUniqueAliases { return .none }
|
||||
public static var min: AnyUniqueAliases { return .none_ }
|
||||
}
|
||||
|
||||
struct AnyUniqueAliasesUnion {
|
||||
@@ -112,14 +112,14 @@ public enum AnyAmbiguousAliases: UInt8, Enum {
|
||||
public typealias T = UInt8
|
||||
public static var byteSize: Int { return MemoryLayout<UInt8>.size }
|
||||
public var value: UInt8 { return self.rawValue }
|
||||
case none = 0
|
||||
case none_ = 0
|
||||
case m1 = 1
|
||||
case m2 = 2
|
||||
case m3 = 3
|
||||
|
||||
|
||||
public static var max: AnyAmbiguousAliases { return .m3 }
|
||||
public static var min: AnyAmbiguousAliases { return .none }
|
||||
public static var min: AnyAmbiguousAliases { return .none_ }
|
||||
}
|
||||
|
||||
struct AnyAmbiguousAliasesUnion {
|
||||
@@ -155,9 +155,9 @@ public struct Test: Readable {
|
||||
public init(_ bb: ByteBuffer, o: Int32) { _accessor = Struct(bb: bb, position: o) }
|
||||
|
||||
public var a: Int16 { return _accessor.readBuffer(of: Int16.self, at: 0) }
|
||||
public func mutate(a: Int16) -> Bool { return _accessor.mutate(a, index: 0) }
|
||||
@discardableResult public func mutate(a: Int16) -> Bool { return _accessor.mutate(a, index: 0) }
|
||||
public var b: Int8 { return _accessor.readBuffer(of: Int8.self, at: 2) }
|
||||
public func mutate(b: Int8) -> Bool { return _accessor.mutate(b, index: 2) }
|
||||
@discardableResult public func mutate(b: Int8) -> Bool { return _accessor.mutate(b, index: 2) }
|
||||
|
||||
|
||||
public mutating func unpack() -> TestT {
|
||||
@@ -197,13 +197,13 @@ public struct Vec3: Readable {
|
||||
public init(_ bb: ByteBuffer, o: Int32) { _accessor = Struct(bb: bb, position: o) }
|
||||
|
||||
public var x: Float32 { return _accessor.readBuffer(of: Float32.self, at: 0) }
|
||||
public func mutate(x: Float32) -> Bool { return _accessor.mutate(x, index: 0) }
|
||||
@discardableResult public func mutate(x: Float32) -> Bool { return _accessor.mutate(x, index: 0) }
|
||||
public var y: Float32 { return _accessor.readBuffer(of: Float32.self, at: 4) }
|
||||
public func mutate(y: Float32) -> Bool { return _accessor.mutate(y, index: 4) }
|
||||
@discardableResult public func mutate(y: Float32) -> Bool { return _accessor.mutate(y, index: 4) }
|
||||
public var z: Float32 { return _accessor.readBuffer(of: Float32.self, at: 8) }
|
||||
public func mutate(z: Float32) -> Bool { return _accessor.mutate(z, index: 8) }
|
||||
@discardableResult public func mutate(z: Float32) -> Bool { return _accessor.mutate(z, index: 8) }
|
||||
public var test1: Double { return _accessor.readBuffer(of: Double.self, at: 16) }
|
||||
public func mutate(test1: Double) -> Bool { return _accessor.mutate(test1, index: 16) }
|
||||
@discardableResult public func mutate(test1: Double) -> Bool { return _accessor.mutate(test1, index: 16) }
|
||||
public var test2: MyGame.Example.Color { return MyGame.Example.Color(rawValue: _accessor.readBuffer(of: UInt8.self, at: 24)) ?? .red }
|
||||
public var test3: MyGame.Example.Test { return MyGame.Example.Test(_accessor.bb, o: _accessor.postion + 26) }
|
||||
|
||||
@@ -258,9 +258,9 @@ public struct Ability: Readable {
|
||||
public init(_ bb: ByteBuffer, o: Int32) { _accessor = Struct(bb: bb, position: o) }
|
||||
|
||||
public var id: UInt32 { return _accessor.readBuffer(of: UInt32.self, at: 0) }
|
||||
public func mutate(id: UInt32) -> Bool { return _accessor.mutate(id, index: 0) }
|
||||
@discardableResult public func mutate(id: UInt32) -> Bool { return _accessor.mutate(id, index: 0) }
|
||||
public var distance: UInt32 { return _accessor.readBuffer(of: UInt32.self, at: 4) }
|
||||
public func mutate(distance: UInt32) -> Bool { return _accessor.mutate(distance, index: 4) }
|
||||
@discardableResult public func mutate(distance: UInt32) -> Bool { return _accessor.mutate(distance, index: 4) }
|
||||
|
||||
|
||||
public mutating func unpack() -> AbilityT {
|
||||
@@ -289,7 +289,7 @@ public class AbilityT: NativeTable {
|
||||
}
|
||||
|
||||
}
|
||||
public static func createTest(a: Int16, b: Int8) -> UnsafeMutableRawPointer {
|
||||
public static func createTest(a: Int16 = 0, b: Int8 = 0) -> UnsafeMutableRawPointer {
|
||||
let memory = UnsafeMutableRawPointer.allocate(byteCount: Test.size, alignment: Test.alignment)
|
||||
memory.initializeMemory(as: UInt8.self, repeating: 0, count: Test.size)
|
||||
memory.storeBytes(of: a, toByteOffset: 0, as: Int16.self)
|
||||
@@ -297,7 +297,7 @@ public static func createTest(a: Int16, b: Int8) -> UnsafeMutableRawPointer {
|
||||
return memory
|
||||
}
|
||||
|
||||
public static func createVec3(x: Float32, y: Float32, z: Float32, test1: Double, test2: MyGame.Example.Color, test3a: Int16, test3b: Int8) -> UnsafeMutableRawPointer {
|
||||
public static func createVec3(x: Float32 = 0.0, y: Float32 = 0.0, z: Float32 = 0.0, test1: Double = 0.0, test2: MyGame.Example.Color, test3a: Int16 = 0, test3b: Int8 = 0) -> UnsafeMutableRawPointer {
|
||||
let memory = UnsafeMutableRawPointer.allocate(byteCount: Vec3.size, alignment: Vec3.alignment)
|
||||
memory.initializeMemory(as: UInt8.self, repeating: 0, count: Vec3.size)
|
||||
memory.storeBytes(of: x, toByteOffset: 0, as: Float32.self)
|
||||
@@ -310,7 +310,7 @@ public static func createVec3(x: Float32, y: Float32, z: Float32, test1: Double,
|
||||
return memory
|
||||
}
|
||||
|
||||
public static func createAbility(id: UInt32, distance: UInt32) -> UnsafeMutableRawPointer {
|
||||
public static func createAbility(id: UInt32 = 0, distance: UInt32 = 0) -> UnsafeMutableRawPointer {
|
||||
let memory = UnsafeMutableRawPointer.allocate(byteCount: Ability.size, alignment: Ability.alignment)
|
||||
memory.initializeMemory(as: UInt8.self, repeating: 0, count: Ability.size)
|
||||
memory.storeBytes(of: id, toByteOffset: 0, as: UInt32.self)
|
||||
@@ -426,7 +426,7 @@ public struct TestSimpleTableWithEnum: FlatBufferObject {
|
||||
}
|
||||
|
||||
public var color: MyGame.Example.Color { let o = _accessor.offset(VTOFFSET.color.v); return o == 0 ? .green : MyGame.Example.Color(rawValue: _accessor.readBuffer(of: UInt8.self, at: o)) ?? .green }
|
||||
public func mutate(color: MyGame.Example.Color) -> Bool {let o = _accessor.offset(VTOFFSET.color.v); return _accessor.mutate(color.rawValue, index: o) }
|
||||
@discardableResult public func mutate(color: MyGame.Example.Color) -> Bool {let o = _accessor.offset(VTOFFSET.color.v); return _accessor.mutate(color.rawValue, index: o) }
|
||||
public static func startTestSimpleTableWithEnum(_ fbb: inout FlatBufferBuilder) -> UOffset { fbb.startTable(with: 1) }
|
||||
public static func add(color: MyGame.Example.Color, _ fbb: inout FlatBufferBuilder) { fbb.add(element: color.rawValue, def: 2, at: VTOFFSET.color.p) }
|
||||
public static func endTestSimpleTableWithEnum(_ fbb: inout FlatBufferBuilder, start: UOffset) -> Offset<UOffset> { let end = Offset<UOffset>(offset: fbb.endTable(at: start)); return end }
|
||||
@@ -486,9 +486,9 @@ public struct Stat: FlatBufferObject {
|
||||
public var id: String? { let o = _accessor.offset(VTOFFSET.id.v); return o == 0 ? nil : _accessor.string(at: o) }
|
||||
public var idSegmentArray: [UInt8]? { return _accessor.getVector(at: VTOFFSET.id.v) }
|
||||
public var val: Int64 { let o = _accessor.offset(VTOFFSET.val.v); return o == 0 ? 0 : _accessor.readBuffer(of: Int64.self, at: o) }
|
||||
public func mutate(val: Int64) -> Bool {let o = _accessor.offset(VTOFFSET.val.v); return _accessor.mutate(val, index: o) }
|
||||
@discardableResult public func mutate(val: Int64) -> Bool {let o = _accessor.offset(VTOFFSET.val.v); return _accessor.mutate(val, index: o) }
|
||||
public var count: UInt16 { let o = _accessor.offset(VTOFFSET.count.v); return o == 0 ? 0 : _accessor.readBuffer(of: UInt16.self, at: o) }
|
||||
public func mutate(count: UInt16) -> Bool {let o = _accessor.offset(VTOFFSET.count.v); return _accessor.mutate(count, index: o) }
|
||||
@discardableResult public func mutate(count: UInt16) -> Bool {let o = _accessor.offset(VTOFFSET.count.v); return _accessor.mutate(count, index: o) }
|
||||
public static func startStat(_ fbb: inout FlatBufferBuilder) -> UOffset { fbb.startTable(with: 3) }
|
||||
public static func add(id: Offset<String>, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: id, at: VTOFFSET.id.p) }
|
||||
public static func add(val: Int64, _ fbb: inout FlatBufferBuilder) { fbb.add(element: val, def: 0, at: VTOFFSET.val.p) }
|
||||
@@ -564,7 +564,7 @@ public struct Referrable: FlatBufferObject {
|
||||
}
|
||||
|
||||
public var id: UInt64 { let o = _accessor.offset(VTOFFSET.id.v); return o == 0 ? 0 : _accessor.readBuffer(of: UInt64.self, at: o) }
|
||||
public func mutate(id: UInt64) -> Bool {let o = _accessor.offset(VTOFFSET.id.v); return _accessor.mutate(id, index: o) }
|
||||
@discardableResult public func mutate(id: UInt64) -> Bool {let o = _accessor.offset(VTOFFSET.id.v); return _accessor.mutate(id, index: o) }
|
||||
public static func startReferrable(_ fbb: inout FlatBufferBuilder) -> UOffset { fbb.startTable(with: 1) }
|
||||
public static func add(id: UInt64, _ fbb: inout FlatBufferBuilder) { fbb.add(element: id, def: 0, at: VTOFFSET.id.p) }
|
||||
public static func endReferrable(_ fbb: inout FlatBufferBuilder, start: UOffset) -> Offset<UOffset> { let end = Offset<UOffset>(offset: fbb.endTable(at: start)); return end }
|
||||
@@ -693,9 +693,9 @@ public struct Monster: FlatBufferObject {
|
||||
|
||||
public var pos: MyGame.Example.Vec3? { let o = _accessor.offset(VTOFFSET.pos.v); return o == 0 ? nil : MyGame.Example.Vec3(_accessor.bb, o: o + _accessor.postion) }
|
||||
public var mana: Int16 { let o = _accessor.offset(VTOFFSET.mana.v); return o == 0 ? 150 : _accessor.readBuffer(of: Int16.self, at: o) }
|
||||
public func mutate(mana: Int16) -> Bool {let o = _accessor.offset(VTOFFSET.mana.v); return _accessor.mutate(mana, index: o) }
|
||||
@discardableResult public func mutate(mana: Int16) -> Bool {let o = _accessor.offset(VTOFFSET.mana.v); return _accessor.mutate(mana, index: o) }
|
||||
public var hp: Int16 { let o = _accessor.offset(VTOFFSET.hp.v); return o == 0 ? 100 : _accessor.readBuffer(of: Int16.self, at: o) }
|
||||
public func mutate(hp: Int16) -> Bool {let o = _accessor.offset(VTOFFSET.hp.v); return _accessor.mutate(hp, index: o) }
|
||||
@discardableResult public func mutate(hp: Int16) -> Bool {let o = _accessor.offset(VTOFFSET.hp.v); return _accessor.mutate(hp, index: o) }
|
||||
public var name: String? { let o = _accessor.offset(VTOFFSET.name.v); return o == 0 ? nil : _accessor.string(at: o) }
|
||||
public var nameSegmentArray: [UInt8]? { return _accessor.getVector(at: VTOFFSET.name.v) }
|
||||
public var inventoryCount: Int32 { let o = _accessor.offset(VTOFFSET.inventory.v); return o == 0 ? 0 : _accessor.vector(count: o) }
|
||||
@@ -703,8 +703,8 @@ public struct Monster: FlatBufferObject {
|
||||
public var inventory: [UInt8] { return _accessor.getVector(at: VTOFFSET.inventory.v) ?? [] }
|
||||
public func mutate(inventory: UInt8, at index: Int32) -> Bool { let o = _accessor.offset(VTOFFSET.inventory.v); return _accessor.directMutate(inventory, index: _accessor.vector(at: o) + index * 1) }
|
||||
public var color: MyGame.Example.Color { let o = _accessor.offset(VTOFFSET.color.v); return o == 0 ? .blue : MyGame.Example.Color(rawValue: _accessor.readBuffer(of: UInt8.self, at: o)) ?? .blue }
|
||||
public func mutate(color: MyGame.Example.Color) -> Bool {let o = _accessor.offset(VTOFFSET.color.v); return _accessor.mutate(color.rawValue, index: o) }
|
||||
public var testType: MyGame.Example.Any_ { let o = _accessor.offset(VTOFFSET.testType.v); return o == 0 ? .none : MyGame.Example.Any_(rawValue: _accessor.readBuffer(of: UInt8.self, at: o)) ?? .none }
|
||||
@discardableResult public func mutate(color: MyGame.Example.Color) -> Bool {let o = _accessor.offset(VTOFFSET.color.v); return _accessor.mutate(color.rawValue, index: o) }
|
||||
public var testType: MyGame.Example.Any_ { let o = _accessor.offset(VTOFFSET.testType.v); return o == 0 ? .none_ : MyGame.Example.Any_(rawValue: _accessor.readBuffer(of: UInt8.self, at: o)) ?? .none_ }
|
||||
public func test<T: FlatBufferObject>(type: T.Type) -> T? { let o = _accessor.offset(VTOFFSET.test.v); return o == 0 ? nil : _accessor.union(o) }
|
||||
public var test4Count: Int32 { let o = _accessor.offset(VTOFFSET.test4.v); return o == 0 ? 0 : _accessor.vector(count: o) }
|
||||
public func test4(at index: Int32) -> MyGame.Example.Test? { let o = _accessor.offset(VTOFFSET.test4.v); return o == 0 ? nil : MyGame.Example.Test(_accessor.bb, o: _accessor.vector(at: o) + index * 4) }
|
||||
@@ -722,33 +722,33 @@ public struct Monster: FlatBufferObject {
|
||||
public func mutate(testnestedflatbuffer: UInt8, at index: Int32) -> Bool { let o = _accessor.offset(VTOFFSET.testnestedflatbuffer.v); return _accessor.directMutate(testnestedflatbuffer, index: _accessor.vector(at: o) + index * 1) }
|
||||
public var testempty: MyGame.Example.Stat? { let o = _accessor.offset(VTOFFSET.testempty.v); return o == 0 ? nil : MyGame.Example.Stat(_accessor.bb, o: _accessor.indirect(o + _accessor.postion)) }
|
||||
public var testbool: Bool { let o = _accessor.offset(VTOFFSET.testbool.v); return o == 0 ? false : 0 != _accessor.readBuffer(of: Byte.self, at: o) }
|
||||
public func mutate(testbool: Byte) -> Bool {let o = _accessor.offset(VTOFFSET.testbool.v); return _accessor.mutate(testbool, index: o) }
|
||||
@discardableResult public func mutate(testbool: Byte) -> Bool {let o = _accessor.offset(VTOFFSET.testbool.v); return _accessor.mutate(testbool, index: o) }
|
||||
public var testhashs32Fnv1: Int32 { let o = _accessor.offset(VTOFFSET.testhashs32Fnv1.v); return o == 0 ? 0 : _accessor.readBuffer(of: Int32.self, at: o) }
|
||||
public func mutate(testhashs32Fnv1: Int32) -> Bool {let o = _accessor.offset(VTOFFSET.testhashs32Fnv1.v); return _accessor.mutate(testhashs32Fnv1, index: o) }
|
||||
@discardableResult public func mutate(testhashs32Fnv1: Int32) -> Bool {let o = _accessor.offset(VTOFFSET.testhashs32Fnv1.v); return _accessor.mutate(testhashs32Fnv1, index: o) }
|
||||
public var testhashu32Fnv1: UInt32 { let o = _accessor.offset(VTOFFSET.testhashu32Fnv1.v); return o == 0 ? 0 : _accessor.readBuffer(of: UInt32.self, at: o) }
|
||||
public func mutate(testhashu32Fnv1: UInt32) -> Bool {let o = _accessor.offset(VTOFFSET.testhashu32Fnv1.v); return _accessor.mutate(testhashu32Fnv1, index: o) }
|
||||
@discardableResult public func mutate(testhashu32Fnv1: UInt32) -> Bool {let o = _accessor.offset(VTOFFSET.testhashu32Fnv1.v); return _accessor.mutate(testhashu32Fnv1, index: o) }
|
||||
public var testhashs64Fnv1: Int64 { let o = _accessor.offset(VTOFFSET.testhashs64Fnv1.v); return o == 0 ? 0 : _accessor.readBuffer(of: Int64.self, at: o) }
|
||||
public func mutate(testhashs64Fnv1: Int64) -> Bool {let o = _accessor.offset(VTOFFSET.testhashs64Fnv1.v); return _accessor.mutate(testhashs64Fnv1, index: o) }
|
||||
@discardableResult public func mutate(testhashs64Fnv1: Int64) -> Bool {let o = _accessor.offset(VTOFFSET.testhashs64Fnv1.v); return _accessor.mutate(testhashs64Fnv1, index: o) }
|
||||
public var testhashu64Fnv1: UInt64 { let o = _accessor.offset(VTOFFSET.testhashu64Fnv1.v); return o == 0 ? 0 : _accessor.readBuffer(of: UInt64.self, at: o) }
|
||||
public func mutate(testhashu64Fnv1: UInt64) -> Bool {let o = _accessor.offset(VTOFFSET.testhashu64Fnv1.v); return _accessor.mutate(testhashu64Fnv1, index: o) }
|
||||
@discardableResult public func mutate(testhashu64Fnv1: UInt64) -> Bool {let o = _accessor.offset(VTOFFSET.testhashu64Fnv1.v); return _accessor.mutate(testhashu64Fnv1, index: o) }
|
||||
public var testhashs32Fnv1a: Int32 { let o = _accessor.offset(VTOFFSET.testhashs32Fnv1a.v); return o == 0 ? 0 : _accessor.readBuffer(of: Int32.self, at: o) }
|
||||
public func mutate(testhashs32Fnv1a: Int32) -> Bool {let o = _accessor.offset(VTOFFSET.testhashs32Fnv1a.v); return _accessor.mutate(testhashs32Fnv1a, index: o) }
|
||||
@discardableResult public func mutate(testhashs32Fnv1a: Int32) -> Bool {let o = _accessor.offset(VTOFFSET.testhashs32Fnv1a.v); return _accessor.mutate(testhashs32Fnv1a, index: o) }
|
||||
public var testhashu32Fnv1a: UInt32 { let o = _accessor.offset(VTOFFSET.testhashu32Fnv1a.v); return o == 0 ? 0 : _accessor.readBuffer(of: UInt32.self, at: o) }
|
||||
public func mutate(testhashu32Fnv1a: UInt32) -> Bool {let o = _accessor.offset(VTOFFSET.testhashu32Fnv1a.v); return _accessor.mutate(testhashu32Fnv1a, index: o) }
|
||||
@discardableResult public func mutate(testhashu32Fnv1a: UInt32) -> Bool {let o = _accessor.offset(VTOFFSET.testhashu32Fnv1a.v); return _accessor.mutate(testhashu32Fnv1a, index: o) }
|
||||
public var testhashs64Fnv1a: Int64 { let o = _accessor.offset(VTOFFSET.testhashs64Fnv1a.v); return o == 0 ? 0 : _accessor.readBuffer(of: Int64.self, at: o) }
|
||||
public func mutate(testhashs64Fnv1a: Int64) -> Bool {let o = _accessor.offset(VTOFFSET.testhashs64Fnv1a.v); return _accessor.mutate(testhashs64Fnv1a, index: o) }
|
||||
@discardableResult public func mutate(testhashs64Fnv1a: Int64) -> Bool {let o = _accessor.offset(VTOFFSET.testhashs64Fnv1a.v); return _accessor.mutate(testhashs64Fnv1a, index: o) }
|
||||
public var testhashu64Fnv1a: UInt64 { let o = _accessor.offset(VTOFFSET.testhashu64Fnv1a.v); return o == 0 ? 0 : _accessor.readBuffer(of: UInt64.self, at: o) }
|
||||
public func mutate(testhashu64Fnv1a: UInt64) -> Bool {let o = _accessor.offset(VTOFFSET.testhashu64Fnv1a.v); return _accessor.mutate(testhashu64Fnv1a, index: o) }
|
||||
@discardableResult public func mutate(testhashu64Fnv1a: UInt64) -> Bool {let o = _accessor.offset(VTOFFSET.testhashu64Fnv1a.v); return _accessor.mutate(testhashu64Fnv1a, index: o) }
|
||||
public var testarrayofboolsCount: Int32 { let o = _accessor.offset(VTOFFSET.testarrayofbools.v); return o == 0 ? 0 : _accessor.vector(count: o) }
|
||||
public func testarrayofbools(at index: Int32) -> Bool { let o = _accessor.offset(VTOFFSET.testarrayofbools.v); return o == 0 ? true : 0 != _accessor.directRead(of: Byte.self, offset: _accessor.vector(at: o) + index * 1) }
|
||||
public var testarrayofbools: [Byte] { return _accessor.getVector(at: VTOFFSET.testarrayofbools.v) ?? [] }
|
||||
public func mutate(testarrayofbools: Byte, at index: Int32) -> Bool { let o = _accessor.offset(VTOFFSET.testarrayofbools.v); return _accessor.directMutate(testarrayofbools, index: _accessor.vector(at: o) + index * 1) }
|
||||
public var testf: Float32 { let o = _accessor.offset(VTOFFSET.testf.v); return o == 0 ? 3.14159 : _accessor.readBuffer(of: Float32.self, at: o) }
|
||||
public func mutate(testf: Float32) -> Bool {let o = _accessor.offset(VTOFFSET.testf.v); return _accessor.mutate(testf, index: o) }
|
||||
@discardableResult public func mutate(testf: Float32) -> Bool {let o = _accessor.offset(VTOFFSET.testf.v); return _accessor.mutate(testf, index: o) }
|
||||
public var testf2: Float32 { let o = _accessor.offset(VTOFFSET.testf2.v); return o == 0 ? 3.0 : _accessor.readBuffer(of: Float32.self, at: o) }
|
||||
public func mutate(testf2: Float32) -> Bool {let o = _accessor.offset(VTOFFSET.testf2.v); return _accessor.mutate(testf2, index: o) }
|
||||
@discardableResult public func mutate(testf2: Float32) -> Bool {let o = _accessor.offset(VTOFFSET.testf2.v); return _accessor.mutate(testf2, index: o) }
|
||||
public var testf3: Float32 { let o = _accessor.offset(VTOFFSET.testf3.v); return o == 0 ? 0.0 : _accessor.readBuffer(of: Float32.self, at: o) }
|
||||
public func mutate(testf3: Float32) -> Bool {let o = _accessor.offset(VTOFFSET.testf3.v); return _accessor.mutate(testf3, index: o) }
|
||||
@discardableResult public func mutate(testf3: Float32) -> Bool {let o = _accessor.offset(VTOFFSET.testf3.v); return _accessor.mutate(testf3, index: o) }
|
||||
public var testarrayofstring2Count: Int32 { let o = _accessor.offset(VTOFFSET.testarrayofstring2.v); return o == 0 ? 0 : _accessor.vector(count: o) }
|
||||
public func testarrayofstring2(at index: Int32) -> String? { let o = _accessor.offset(VTOFFSET.testarrayofstring2.v); return o == 0 ? nil : _accessor.directString(at: _accessor.vector(at: o) + index * 4) }
|
||||
public var testarrayofsortedstructCount: Int32 { let o = _accessor.offset(VTOFFSET.testarrayofsortedstruct.v); return o == 0 ? 0 : _accessor.vector(count: o) }
|
||||
@@ -772,7 +772,7 @@ public struct Monster: FlatBufferObject {
|
||||
public func vectorOfReferrables(at index: Int32) -> MyGame.Example.Referrable? { let o = _accessor.offset(VTOFFSET.vectorOfReferrables.v); return o == 0 ? nil : MyGame.Example.Referrable(_accessor.bb, o: _accessor.indirect(_accessor.vector(at: o) + index * 4)) }
|
||||
public func vectorOfReferrablesBy(key: UInt64) -> MyGame.Example.Referrable? { let o = _accessor.offset(VTOFFSET.vectorOfReferrables.v); return o == 0 ? nil : MyGame.Example.Referrable.lookupByKey(vector: _accessor.vector(at: o), key: key, fbb: _accessor.bb) }
|
||||
public var singleWeakReference: UInt64 { let o = _accessor.offset(VTOFFSET.singleWeakReference.v); return o == 0 ? 0 : _accessor.readBuffer(of: UInt64.self, at: o) }
|
||||
public func mutate(singleWeakReference: UInt64) -> Bool {let o = _accessor.offset(VTOFFSET.singleWeakReference.v); return _accessor.mutate(singleWeakReference, index: o) }
|
||||
@discardableResult public func mutate(singleWeakReference: UInt64) -> Bool {let o = _accessor.offset(VTOFFSET.singleWeakReference.v); return _accessor.mutate(singleWeakReference, index: o) }
|
||||
public var vectorOfWeakReferencesCount: Int32 { let o = _accessor.offset(VTOFFSET.vectorOfWeakReferences.v); return o == 0 ? 0 : _accessor.vector(count: o) }
|
||||
public func vectorOfWeakReferences(at index: Int32) -> UInt64 { let o = _accessor.offset(VTOFFSET.vectorOfWeakReferences.v); return o == 0 ? 0 : _accessor.directRead(of: UInt64.self, offset: _accessor.vector(at: o) + index * 8) }
|
||||
public var vectorOfWeakReferences: [UInt64] { return _accessor.getVector(at: VTOFFSET.vectorOfWeakReferences.v) ?? [] }
|
||||
@@ -781,25 +781,25 @@ public struct Monster: FlatBufferObject {
|
||||
public func vectorOfStrongReferrables(at index: Int32) -> MyGame.Example.Referrable? { let o = _accessor.offset(VTOFFSET.vectorOfStrongReferrables.v); return o == 0 ? nil : MyGame.Example.Referrable(_accessor.bb, o: _accessor.indirect(_accessor.vector(at: o) + index * 4)) }
|
||||
public func vectorOfStrongReferrablesBy(key: UInt64) -> MyGame.Example.Referrable? { let o = _accessor.offset(VTOFFSET.vectorOfStrongReferrables.v); return o == 0 ? nil : MyGame.Example.Referrable.lookupByKey(vector: _accessor.vector(at: o), key: key, fbb: _accessor.bb) }
|
||||
public var coOwningReference: UInt64 { let o = _accessor.offset(VTOFFSET.coOwningReference.v); return o == 0 ? 0 : _accessor.readBuffer(of: UInt64.self, at: o) }
|
||||
public func mutate(coOwningReference: UInt64) -> Bool {let o = _accessor.offset(VTOFFSET.coOwningReference.v); return _accessor.mutate(coOwningReference, index: o) }
|
||||
@discardableResult public func mutate(coOwningReference: UInt64) -> Bool {let o = _accessor.offset(VTOFFSET.coOwningReference.v); return _accessor.mutate(coOwningReference, index: o) }
|
||||
public var vectorOfCoOwningReferencesCount: Int32 { let o = _accessor.offset(VTOFFSET.vectorOfCoOwningReferences.v); return o == 0 ? 0 : _accessor.vector(count: o) }
|
||||
public func vectorOfCoOwningReferences(at index: Int32) -> UInt64 { let o = _accessor.offset(VTOFFSET.vectorOfCoOwningReferences.v); return o == 0 ? 0 : _accessor.directRead(of: UInt64.self, offset: _accessor.vector(at: o) + index * 8) }
|
||||
public var vectorOfCoOwningReferences: [UInt64] { return _accessor.getVector(at: VTOFFSET.vectorOfCoOwningReferences.v) ?? [] }
|
||||
public func mutate(vectorOfCoOwningReferences: UInt64, at index: Int32) -> Bool { let o = _accessor.offset(VTOFFSET.vectorOfCoOwningReferences.v); return _accessor.directMutate(vectorOfCoOwningReferences, index: _accessor.vector(at: o) + index * 8) }
|
||||
public var nonOwningReference: UInt64 { let o = _accessor.offset(VTOFFSET.nonOwningReference.v); return o == 0 ? 0 : _accessor.readBuffer(of: UInt64.self, at: o) }
|
||||
public func mutate(nonOwningReference: UInt64) -> Bool {let o = _accessor.offset(VTOFFSET.nonOwningReference.v); return _accessor.mutate(nonOwningReference, index: o) }
|
||||
@discardableResult public func mutate(nonOwningReference: UInt64) -> Bool {let o = _accessor.offset(VTOFFSET.nonOwningReference.v); return _accessor.mutate(nonOwningReference, index: o) }
|
||||
public var vectorOfNonOwningReferencesCount: Int32 { let o = _accessor.offset(VTOFFSET.vectorOfNonOwningReferences.v); return o == 0 ? 0 : _accessor.vector(count: o) }
|
||||
public func vectorOfNonOwningReferences(at index: Int32) -> UInt64 { let o = _accessor.offset(VTOFFSET.vectorOfNonOwningReferences.v); return o == 0 ? 0 : _accessor.directRead(of: UInt64.self, offset: _accessor.vector(at: o) + index * 8) }
|
||||
public var vectorOfNonOwningReferences: [UInt64] { return _accessor.getVector(at: VTOFFSET.vectorOfNonOwningReferences.v) ?? [] }
|
||||
public func mutate(vectorOfNonOwningReferences: UInt64, at index: Int32) -> Bool { let o = _accessor.offset(VTOFFSET.vectorOfNonOwningReferences.v); return _accessor.directMutate(vectorOfNonOwningReferences, index: _accessor.vector(at: o) + index * 8) }
|
||||
public var anyUniqueType: MyGame.Example.AnyUniqueAliases { let o = _accessor.offset(VTOFFSET.anyUniqueType.v); return o == 0 ? .none : MyGame.Example.AnyUniqueAliases(rawValue: _accessor.readBuffer(of: UInt8.self, at: o)) ?? .none }
|
||||
public var anyUniqueType: MyGame.Example.AnyUniqueAliases { let o = _accessor.offset(VTOFFSET.anyUniqueType.v); return o == 0 ? .none_ : MyGame.Example.AnyUniqueAliases(rawValue: _accessor.readBuffer(of: UInt8.self, at: o)) ?? .none_ }
|
||||
public func anyUnique<T: FlatBufferObject>(type: T.Type) -> T? { let o = _accessor.offset(VTOFFSET.anyUnique.v); return o == 0 ? nil : _accessor.union(o) }
|
||||
public var anyAmbiguousType: MyGame.Example.AnyAmbiguousAliases { let o = _accessor.offset(VTOFFSET.anyAmbiguousType.v); return o == 0 ? .none : MyGame.Example.AnyAmbiguousAliases(rawValue: _accessor.readBuffer(of: UInt8.self, at: o)) ?? .none }
|
||||
public var anyAmbiguousType: MyGame.Example.AnyAmbiguousAliases { let o = _accessor.offset(VTOFFSET.anyAmbiguousType.v); return o == 0 ? .none_ : MyGame.Example.AnyAmbiguousAliases(rawValue: _accessor.readBuffer(of: UInt8.self, at: o)) ?? .none_ }
|
||||
public func anyAmbiguous<T: FlatBufferObject>(type: T.Type) -> T? { let o = _accessor.offset(VTOFFSET.anyAmbiguous.v); return o == 0 ? nil : _accessor.union(o) }
|
||||
public var vectorOfEnumsCount: Int32 { let o = _accessor.offset(VTOFFSET.vectorOfEnums.v); return o == 0 ? 0 : _accessor.vector(count: o) }
|
||||
public func vectorOfEnums(at index: Int32) -> MyGame.Example.Color? { let o = _accessor.offset(VTOFFSET.vectorOfEnums.v); return o == 0 ? MyGame.Example.Color.red : MyGame.Example.Color(rawValue: _accessor.directRead(of: UInt8.self, offset: _accessor.vector(at: o) + index * 1)) }
|
||||
public var signedEnum: MyGame.Example.Race { let o = _accessor.offset(VTOFFSET.signedEnum.v); return o == 0 ? .none : MyGame.Example.Race(rawValue: _accessor.readBuffer(of: Int8.self, at: o)) ?? .none }
|
||||
public func mutate(signedEnum: MyGame.Example.Race) -> Bool {let o = _accessor.offset(VTOFFSET.signedEnum.v); return _accessor.mutate(signedEnum.rawValue, index: o) }
|
||||
public var signedEnum: MyGame.Example.Race { let o = _accessor.offset(VTOFFSET.signedEnum.v); return o == 0 ? .none_ : MyGame.Example.Race(rawValue: _accessor.readBuffer(of: Int8.self, at: o)) ?? .none_ }
|
||||
@discardableResult public func mutate(signedEnum: MyGame.Example.Race) -> Bool {let o = _accessor.offset(VTOFFSET.signedEnum.v); return _accessor.mutate(signedEnum.rawValue, index: o) }
|
||||
public static func startMonster(_ fbb: inout FlatBufferBuilder) -> UOffset { fbb.startTable(with: 49) }
|
||||
public static func add(pos: Offset<UOffset>, _ fbb: inout FlatBufferBuilder) { fbb.add(structOffset: VTOFFSET.pos.p) }
|
||||
public static func add(mana: Int16, _ fbb: inout FlatBufferBuilder) { fbb.add(element: mana, def: 150, at: VTOFFSET.mana.p) }
|
||||
@@ -815,7 +815,7 @@ public struct Monster: FlatBufferObject {
|
||||
public static func add(enemy: Offset<UOffset>, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: enemy, at: VTOFFSET.enemy.p) }
|
||||
public static func addVectorOf(testnestedflatbuffer: Offset<UOffset>, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: testnestedflatbuffer, at: VTOFFSET.testnestedflatbuffer.p) }
|
||||
public static func add(testempty: Offset<UOffset>, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: testempty, at: VTOFFSET.testempty.p) }
|
||||
public static func add(testbool: Bool, _ fbb: inout FlatBufferBuilder) { fbb.add(condition: testbool, def: false, at: VTOFFSET.testbool.p) }
|
||||
public static func add(testbool: Bool, _ fbb: inout FlatBufferBuilder) { fbb.add(element: testbool, def: false, at: VTOFFSET.testbool.p) }
|
||||
public static func add(testhashs32Fnv1: Int32, _ fbb: inout FlatBufferBuilder) { fbb.add(element: testhashs32Fnv1, def: 0, at: VTOFFSET.testhashs32Fnv1.p) }
|
||||
public static func add(testhashu32Fnv1: UInt32, _ fbb: inout FlatBufferBuilder) { fbb.add(element: testhashu32Fnv1, def: 0, at: VTOFFSET.testhashu32Fnv1.p) }
|
||||
public static func add(testhashs64Fnv1: Int64, _ fbb: inout FlatBufferBuilder) { fbb.add(element: testhashs64Fnv1, def: 0, at: VTOFFSET.testhashs64Fnv1.p) }
|
||||
@@ -857,7 +857,7 @@ public struct Monster: FlatBufferObject {
|
||||
offsetOfName name: Offset<String> = Offset(),
|
||||
vectorOfInventory inventory: Offset<UOffset> = Offset(),
|
||||
color: MyGame.Example.Color = .blue,
|
||||
testType: MyGame.Example.Any_ = .none,
|
||||
testType: MyGame.Example.Any_ = .none_,
|
||||
offsetOfTest test: Offset<UOffset> = Offset(),
|
||||
vectorOfTest4 test4: Offset<UOffset> = Offset(),
|
||||
vectorOfTestarrayofstring testarrayofstring: Offset<UOffset> = Offset(),
|
||||
@@ -893,12 +893,12 @@ public struct Monster: FlatBufferObject {
|
||||
vectorOfVectorOfCoOwningReferences vectorOfCoOwningReferences: Offset<UOffset> = Offset(),
|
||||
nonOwningReference: UInt64 = 0,
|
||||
vectorOfVectorOfNonOwningReferences vectorOfNonOwningReferences: Offset<UOffset> = Offset(),
|
||||
anyUniqueType: MyGame.Example.AnyUniqueAliases = .none,
|
||||
anyUniqueType: MyGame.Example.AnyUniqueAliases = .none_,
|
||||
offsetOfAnyUnique anyUnique: Offset<UOffset> = Offset(),
|
||||
anyAmbiguousType: MyGame.Example.AnyAmbiguousAliases = .none,
|
||||
anyAmbiguousType: MyGame.Example.AnyAmbiguousAliases = .none_,
|
||||
offsetOfAnyAmbiguous anyAmbiguous: Offset<UOffset> = Offset(),
|
||||
vectorOfVectorOfEnums vectorOfEnums: Offset<UOffset> = Offset(),
|
||||
signedEnum: MyGame.Example.Race = .none) -> Offset<UOffset> {
|
||||
signedEnum: MyGame.Example.Race = .none_) -> Offset<UOffset> {
|
||||
let __start = Monster.startMonster(&fbb)
|
||||
Monster.add(pos: pos, &fbb)
|
||||
Monster.add(mana: mana, &fbb)
|
||||
@@ -1169,9 +1169,9 @@ public class MonsterT: NativeTable {
|
||||
case .testsimpletablewithenum:
|
||||
var _v = _t.test(type: MyGame.Example.TestSimpleTableWithEnum.self)
|
||||
test = Any_Union(_v?.unpack(), type: .testsimpletablewithenum)
|
||||
case .mygame_example2_monster:
|
||||
case .mygameExample2Monster:
|
||||
var _v = _t.test(type: MyGame.Example2.Monster.self)
|
||||
test = Any_Union(_v?.unpack(), type: .mygame_example2_monster)
|
||||
test = Any_Union(_v?.unpack(), type: .mygameExample2Monster)
|
||||
default: break
|
||||
}
|
||||
test4 = []
|
||||
@@ -1337,7 +1337,7 @@ public class MonsterT: NativeTable {
|
||||
nonOwningReference = 0
|
||||
vectorOfNonOwningReferences = []
|
||||
vectorOfEnums = []
|
||||
signedEnum = .none
|
||||
signedEnum = .none_
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1371,25 +1371,25 @@ public struct TypeAliases: FlatBufferObject {
|
||||
}
|
||||
|
||||
public var i8: Int8 { let o = _accessor.offset(VTOFFSET.i8.v); return o == 0 ? 0 : _accessor.readBuffer(of: Int8.self, at: o) }
|
||||
public func mutate(i8: Int8) -> Bool {let o = _accessor.offset(VTOFFSET.i8.v); return _accessor.mutate(i8, index: o) }
|
||||
@discardableResult public func mutate(i8: Int8) -> Bool {let o = _accessor.offset(VTOFFSET.i8.v); return _accessor.mutate(i8, index: o) }
|
||||
public var u8: UInt8 { let o = _accessor.offset(VTOFFSET.u8.v); return o == 0 ? 0 : _accessor.readBuffer(of: UInt8.self, at: o) }
|
||||
public func mutate(u8: UInt8) -> Bool {let o = _accessor.offset(VTOFFSET.u8.v); return _accessor.mutate(u8, index: o) }
|
||||
@discardableResult public func mutate(u8: UInt8) -> Bool {let o = _accessor.offset(VTOFFSET.u8.v); return _accessor.mutate(u8, index: o) }
|
||||
public var i16: Int16 { let o = _accessor.offset(VTOFFSET.i16.v); return o == 0 ? 0 : _accessor.readBuffer(of: Int16.self, at: o) }
|
||||
public func mutate(i16: Int16) -> Bool {let o = _accessor.offset(VTOFFSET.i16.v); return _accessor.mutate(i16, index: o) }
|
||||
@discardableResult public func mutate(i16: Int16) -> Bool {let o = _accessor.offset(VTOFFSET.i16.v); return _accessor.mutate(i16, index: o) }
|
||||
public var u16: UInt16 { let o = _accessor.offset(VTOFFSET.u16.v); return o == 0 ? 0 : _accessor.readBuffer(of: UInt16.self, at: o) }
|
||||
public func mutate(u16: UInt16) -> Bool {let o = _accessor.offset(VTOFFSET.u16.v); return _accessor.mutate(u16, index: o) }
|
||||
@discardableResult public func mutate(u16: UInt16) -> Bool {let o = _accessor.offset(VTOFFSET.u16.v); return _accessor.mutate(u16, index: o) }
|
||||
public var i32: Int32 { let o = _accessor.offset(VTOFFSET.i32.v); return o == 0 ? 0 : _accessor.readBuffer(of: Int32.self, at: o) }
|
||||
public func mutate(i32: Int32) -> Bool {let o = _accessor.offset(VTOFFSET.i32.v); return _accessor.mutate(i32, index: o) }
|
||||
@discardableResult public func mutate(i32: Int32) -> Bool {let o = _accessor.offset(VTOFFSET.i32.v); return _accessor.mutate(i32, index: o) }
|
||||
public var u32: UInt32 { let o = _accessor.offset(VTOFFSET.u32.v); return o == 0 ? 0 : _accessor.readBuffer(of: UInt32.self, at: o) }
|
||||
public func mutate(u32: UInt32) -> Bool {let o = _accessor.offset(VTOFFSET.u32.v); return _accessor.mutate(u32, index: o) }
|
||||
@discardableResult public func mutate(u32: UInt32) -> Bool {let o = _accessor.offset(VTOFFSET.u32.v); return _accessor.mutate(u32, index: o) }
|
||||
public var i64: Int64 { let o = _accessor.offset(VTOFFSET.i64.v); return o == 0 ? 0 : _accessor.readBuffer(of: Int64.self, at: o) }
|
||||
public func mutate(i64: Int64) -> Bool {let o = _accessor.offset(VTOFFSET.i64.v); return _accessor.mutate(i64, index: o) }
|
||||
@discardableResult public func mutate(i64: Int64) -> Bool {let o = _accessor.offset(VTOFFSET.i64.v); return _accessor.mutate(i64, index: o) }
|
||||
public var u64: UInt64 { let o = _accessor.offset(VTOFFSET.u64.v); return o == 0 ? 0 : _accessor.readBuffer(of: UInt64.self, at: o) }
|
||||
public func mutate(u64: UInt64) -> Bool {let o = _accessor.offset(VTOFFSET.u64.v); return _accessor.mutate(u64, index: o) }
|
||||
@discardableResult public func mutate(u64: UInt64) -> Bool {let o = _accessor.offset(VTOFFSET.u64.v); return _accessor.mutate(u64, index: o) }
|
||||
public var f32: Float32 { let o = _accessor.offset(VTOFFSET.f32.v); return o == 0 ? 0.0 : _accessor.readBuffer(of: Float32.self, at: o) }
|
||||
public func mutate(f32: Float32) -> Bool {let o = _accessor.offset(VTOFFSET.f32.v); return _accessor.mutate(f32, index: o) }
|
||||
@discardableResult public func mutate(f32: Float32) -> Bool {let o = _accessor.offset(VTOFFSET.f32.v); return _accessor.mutate(f32, index: o) }
|
||||
public var f64: Double { let o = _accessor.offset(VTOFFSET.f64.v); return o == 0 ? 0.0 : _accessor.readBuffer(of: Double.self, at: o) }
|
||||
public func mutate(f64: Double) -> Bool {let o = _accessor.offset(VTOFFSET.f64.v); return _accessor.mutate(f64, index: o) }
|
||||
@discardableResult public func mutate(f64: Double) -> Bool {let o = _accessor.offset(VTOFFSET.f64.v); return _accessor.mutate(f64, index: o) }
|
||||
public var v8Count: Int32 { let o = _accessor.offset(VTOFFSET.v8.v); return o == 0 ? 0 : _accessor.vector(count: o) }
|
||||
public func v8(at index: Int32) -> Int8 { let o = _accessor.offset(VTOFFSET.v8.v); return o == 0 ? 0 : _accessor.directRead(of: Int8.self, offset: _accessor.vector(at: o) + index * 1) }
|
||||
public var v8: [Int8] { return _accessor.getVector(at: VTOFFSET.v8.v) ?? [] }
|
||||
|
||||
@@ -6,7 +6,7 @@ public enum Character: UInt8, Enum {
|
||||
public typealias T = UInt8
|
||||
public static var byteSize: Int { return MemoryLayout<UInt8>.size }
|
||||
public var value: UInt8 { return self.rawValue }
|
||||
case none = 0
|
||||
case none_ = 0
|
||||
case mulan = 1
|
||||
case rapunzel = 2
|
||||
case belle = 3
|
||||
@@ -16,7 +16,7 @@ public enum Character: UInt8, Enum {
|
||||
|
||||
|
||||
public static var max: Character { return .unused }
|
||||
public static var min: Character { return .none }
|
||||
public static var min: Character { return .none_ }
|
||||
}
|
||||
|
||||
struct CharacterUnion {
|
||||
@@ -55,7 +55,7 @@ public struct Rapunzel: Readable {
|
||||
public init(_ bb: ByteBuffer, o: Int32) { _accessor = Struct(bb: bb, position: o) }
|
||||
|
||||
public var hairLength: Int32 { return _accessor.readBuffer(of: Int32.self, at: 0) }
|
||||
public func mutate(hairLength: Int32) -> Bool { return _accessor.mutate(hairLength, index: 0) }
|
||||
@discardableResult public func mutate(hairLength: Int32) -> Bool { return _accessor.mutate(hairLength, index: 0) }
|
||||
|
||||
|
||||
public mutating func unpack() -> RapunzelT {
|
||||
@@ -92,7 +92,7 @@ public struct BookReader: Readable {
|
||||
public init(_ bb: ByteBuffer, o: Int32) { _accessor = Struct(bb: bb, position: o) }
|
||||
|
||||
public var booksRead: Int32 { return _accessor.readBuffer(of: Int32.self, at: 0) }
|
||||
public func mutate(booksRead: Int32) -> Bool { return _accessor.mutate(booksRead, index: 0) }
|
||||
@discardableResult public func mutate(booksRead: Int32) -> Bool { return _accessor.mutate(booksRead, index: 0) }
|
||||
|
||||
|
||||
public mutating func unpack() -> BookReaderT {
|
||||
@@ -118,14 +118,14 @@ public class BookReaderT: NativeTable {
|
||||
}
|
||||
|
||||
}
|
||||
public func createRapunzel(hairLength: Int32) -> UnsafeMutableRawPointer {
|
||||
public func createRapunzel(hairLength: Int32 = 0) -> UnsafeMutableRawPointer {
|
||||
let memory = UnsafeMutableRawPointer.allocate(byteCount: Rapunzel.size, alignment: Rapunzel.alignment)
|
||||
memory.initializeMemory(as: UInt8.self, repeating: 0, count: Rapunzel.size)
|
||||
memory.storeBytes(of: hairLength, toByteOffset: 0, as: Int32.self)
|
||||
return memory
|
||||
}
|
||||
|
||||
public func createBookReader(booksRead: Int32) -> UnsafeMutableRawPointer {
|
||||
public func createBookReader(booksRead: Int32 = 0) -> UnsafeMutableRawPointer {
|
||||
let memory = UnsafeMutableRawPointer.allocate(byteCount: BookReader.size, alignment: BookReader.alignment)
|
||||
memory.initializeMemory(as: UInt8.self, repeating: 0, count: BookReader.size)
|
||||
memory.storeBytes(of: booksRead, toByteOffset: 0, as: Int32.self)
|
||||
@@ -151,7 +151,7 @@ public struct Attacker: FlatBufferObject {
|
||||
}
|
||||
|
||||
public var swordAttackDamage: Int32 { let o = _accessor.offset(VTOFFSET.swordAttackDamage.v); return o == 0 ? 0 : _accessor.readBuffer(of: Int32.self, at: o) }
|
||||
public func mutate(swordAttackDamage: Int32) -> Bool {let o = _accessor.offset(VTOFFSET.swordAttackDamage.v); return _accessor.mutate(swordAttackDamage, index: o) }
|
||||
@discardableResult public func mutate(swordAttackDamage: Int32) -> Bool {let o = _accessor.offset(VTOFFSET.swordAttackDamage.v); return _accessor.mutate(swordAttackDamage, index: o) }
|
||||
public static func startAttacker(_ fbb: inout FlatBufferBuilder) -> UOffset { fbb.startTable(with: 1) }
|
||||
public static func add(swordAttackDamage: Int32, _ fbb: inout FlatBufferBuilder) { fbb.add(element: swordAttackDamage, def: 0, at: VTOFFSET.swordAttackDamage.p) }
|
||||
public static func endAttacker(_ fbb: inout FlatBufferBuilder, start: UOffset) -> Offset<UOffset> { let end = Offset<UOffset>(offset: fbb.endTable(at: start)); return end }
|
||||
@@ -209,10 +209,10 @@ public struct Movie: FlatBufferObject {
|
||||
var p: VOffset { self.rawValue }
|
||||
}
|
||||
|
||||
public var mainCharacterType: Character { let o = _accessor.offset(VTOFFSET.mainCharacterType.v); return o == 0 ? .none : Character(rawValue: _accessor.readBuffer(of: UInt8.self, at: o)) ?? .none }
|
||||
public var mainCharacterType: Character { let o = _accessor.offset(VTOFFSET.mainCharacterType.v); return o == 0 ? .none_ : Character(rawValue: _accessor.readBuffer(of: UInt8.self, at: o)) ?? .none_ }
|
||||
public func mainCharacter<T: FlatBufferObject>(type: T.Type) -> T? { let o = _accessor.offset(VTOFFSET.mainCharacter.v); return o == 0 ? nil : _accessor.union(o) }
|
||||
public var charactersTypeCount: Int32 { let o = _accessor.offset(VTOFFSET.charactersType.v); return o == 0 ? 0 : _accessor.vector(count: o) }
|
||||
public func charactersType(at index: Int32) -> Character? { let o = _accessor.offset(VTOFFSET.charactersType.v); return o == 0 ? Character.none : Character(rawValue: _accessor.directRead(of: UInt8.self, offset: _accessor.vector(at: o) + index * 1)) }
|
||||
public func charactersType(at index: Int32) -> Character? { let o = _accessor.offset(VTOFFSET.charactersType.v); return o == 0 ? Character.none_ : Character(rawValue: _accessor.directRead(of: UInt8.self, offset: _accessor.vector(at: o) + index * 1)) }
|
||||
public var charactersCount: Int32 { let o = _accessor.offset(VTOFFSET.characters.v); return o == 0 ? 0 : _accessor.vector(count: o) }
|
||||
public func characters<T: FlatBufferObject>(at index: Int32, type: T.Type) -> T? { let o = _accessor.offset(VTOFFSET.characters.v); return o == 0 ? nil : _accessor.directUnion(_accessor.vector(at: o) + index * 4) }
|
||||
public static func startMovie(_ fbb: inout FlatBufferBuilder) -> UOffset { fbb.startTable(with: 4) }
|
||||
@@ -222,7 +222,7 @@ public struct Movie: FlatBufferObject {
|
||||
public static func addVectorOf(characters: Offset<UOffset>, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: characters, at: VTOFFSET.characters.p) }
|
||||
public static func endMovie(_ fbb: inout FlatBufferBuilder, start: UOffset) -> Offset<UOffset> { let end = Offset<UOffset>(offset: fbb.endTable(at: start)); return end }
|
||||
public static func createMovie(_ fbb: inout FlatBufferBuilder,
|
||||
mainCharacterType: Character = .none,
|
||||
mainCharacterType: Character = .none_,
|
||||
offsetOfMainCharacter mainCharacter: Offset<UOffset> = Offset(),
|
||||
vectorOfCharactersType charactersType: Offset<UOffset> = Offset(),
|
||||
vectorOfCharacters characters: Offset<UOffset> = Offset()) -> Offset<UOffset> {
|
||||
|
||||
@@ -30,7 +30,7 @@ TEST_BASE_FLAGS="--reflect-names --gen-mutable --gen-object-api"
|
||||
TEST_RUST_FLAGS="$TEST_BASE_FLAGS --gen-name-strings"
|
||||
TEST_NOINCL_FLAGS="$TEST_BASE_FLAGS --no-includes --no-fb-import"
|
||||
|
||||
../flatc --binary --cpp --java --kotlin --csharp --dart --go --lobster --lua --js --ts --php --swift --grpc \
|
||||
../flatc --binary --cpp --java --kotlin --csharp --dart --go --lobster --lua --js --ts --php --grpc \
|
||||
$TEST_NOINCL_FLAGS $TEST_CPP_FLAGS $TEST_CS_FLAGS -I include_test monster_test.fbs monsterdata_test.json
|
||||
../flatc --rust $TEST_RUST_FLAGS -I include_test monster_test.fbs monsterdata_test.json
|
||||
|
||||
@@ -39,7 +39,7 @@ $TEST_NOINCL_FLAGS $TEST_CPP_FLAGS $TEST_CS_FLAGS -I include_test monster_test.f
|
||||
../flatc --cpp --java --kotlin --csharp --dart --go --binary --lobster --lua --js --ts --php --python --rust \
|
||||
$TEST_NOINCL_FLAGS $TEST_CPP_FLAGS $TEST_CS_FLAGS -o namespace_test namespace_test/namespace_test1.fbs namespace_test/namespace_test2.fbs
|
||||
|
||||
../flatc --cpp --java --kotlin --csharp --js --ts --php --swift $TEST_BASE_FLAGS $TEST_CPP_FLAGS $TEST_CS_FLAGS -o union_vector ./union_vector/union_vector.fbs
|
||||
../flatc --cpp --java --kotlin --csharp --js --ts --php $TEST_BASE_FLAGS $TEST_CPP_FLAGS $TEST_CS_FLAGS -o union_vector ./union_vector/union_vector.fbs
|
||||
../flatc --rust -I include_test -o include_test include_test/include_test1.fbs
|
||||
../flatc --rust -I include_test -o include_test/sub include_test/sub/include_test2.fbs
|
||||
../flatc -b --schema --bfbs-comments --bfbs-builtins -I include_test monster_test.fbs
|
||||
@@ -51,11 +51,12 @@ $TEST_NOINCL_FLAGS $TEST_CPP_FLAGS $TEST_CS_FLAGS -o namespace_test namespace_te
|
||||
../flatc --python $TEST_BASE_FLAGS arrays_test.fbs
|
||||
../flatc --dart monster_extra.fbs
|
||||
|
||||
# Moves the swift generated code into the swift directory
|
||||
mv *generated.swift FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests
|
||||
mv ./union_vector/*_generated.swift FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests
|
||||
|
||||
working_dir=`pwd`
|
||||
cd FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests
|
||||
$working_dir/../flatc --swift --grpc $TEST_NOINCL_FLAGS $TEST_CPP_FLAGS $TEST_CS_FLAGS -I ../../../include_test ../../../monster_test.fbs
|
||||
$working_dir/../flatc --swift $TEST_BASE_FLAGS $TEST_CPP_FLAGS $TEST_CS_FLAGS ../../../union_vector/union_vector.fbs
|
||||
cd $working_dir
|
||||
|
||||
cd FlatBuffers.GRPC.Swift/Sources/Model
|
||||
$working_dir/../flatc --swift --grpc greeter.fbs
|
||||
cd $working_dir
|
||||
|
||||
Reference in New Issue
Block a user