mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-21 19:28:27 +00:00
[Swift] Adds GRPC to Swift (#5758)
* Adds the basic structure for required to add grpc support Added the message implementation Updated the code to confirm to the protocol flatbuffersobject Adds an example for Swift flatbuffers GRPC Started implementing the swift GRPC code Gen Generator generates protocols now Fixing ci issues Migrated the logic to use grpc_generator::File instead of string Refactored swift project Implemented GRPC in swift Finished implementing GRPC in swift Fixes issues Adds contiguousBytes initializer to swift Adds documentation + fixes buffer nameing in tables + structs Adds documentation + fixes buffer nameing in tables + structs Updated tests * Updated version
This commit is contained in:
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2020 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.
|
||||
*/
|
||||
|
||||
#include <unordered_set>
|
||||
|
||||
#include "flatbuffers/code_generators.h"
|
||||
@@ -244,6 +260,7 @@ class SwiftGenerator : public BaseGenerator {
|
||||
code_.SetValue("OBJECTTYPE", struct_def.fixed ? "Struct" : "Table");
|
||||
code_ += "public struct {{STRUCTNAME}}: {{PROTOCOL}} {\n";
|
||||
code_ += ValidateFunc();
|
||||
code_ += "\tpublic var __buffer: ByteBuffer! { return {{ACCESS}}.bb }";
|
||||
code_ += "\n\tprivate var {{ACCESS}}: {{OBJECTTYPE}}";
|
||||
if (struct_def.fixed) {
|
||||
code_.SetValue("BYTESIZE", NumToString(struct_def.bytesize));
|
||||
|
||||
Reference in New Issue
Block a user