mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-01 19:58:15 +00:00
Removes Dead code & regenerate code (#7744)
Formats the swift project Update Sample files Update docc documentation Updates swift docs in the website Updates code for Wasm
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2021 Google Inc. All rights reserved.
|
||||
* Copyright 2023 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.
|
||||
@@ -429,13 +429,13 @@ public struct ByteBuffer {
|
||||
}
|
||||
|
||||
/// Returns the written bytes into the ``ByteBuffer``
|
||||
public var underlyingBytes: [UInt8] {
|
||||
let cp = capacity &- writerIndex
|
||||
let start = memory.advanced(by: writerIndex)
|
||||
.bindMemory(to: UInt8.self, capacity: cp)
|
||||
public var underlyingBytes: [UInt8] {
|
||||
let cp = capacity &- writerIndex
|
||||
let start = memory.advanced(by: writerIndex)
|
||||
.bindMemory(to: UInt8.self, capacity: cp)
|
||||
|
||||
let ptr = UnsafeBufferPointer<UInt8>(start: start, count: cp)
|
||||
return Array(ptr)
|
||||
let ptr = UnsafeBufferPointer<UInt8>(start: start, count: cp)
|
||||
return Array(ptr)
|
||||
}
|
||||
|
||||
/// SkipPrefix Skips the first 4 bytes in case one of the following
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2021 Google Inc. All rights reserved.
|
||||
* Copyright 2023 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.
|
||||
@@ -15,11 +15,11 @@
|
||||
*/
|
||||
|
||||
#if !os(WASI)
|
||||
#if os(Linux)
|
||||
import CoreFoundation
|
||||
#else
|
||||
import Foundation
|
||||
#endif
|
||||
#if os(Linux)
|
||||
import CoreFoundation
|
||||
#else
|
||||
import Foundation
|
||||
#endif
|
||||
#else
|
||||
import SwiftOverlayShims
|
||||
#endif
|
||||
|
||||
@@ -4,8 +4,8 @@ import Foundation
|
||||
func run() {
|
||||
// create a ByteBuffer(:) from an [UInt8] or Data()
|
||||
let buf = [] // Get your data
|
||||
|
||||
var byteBuffer = ByteBuffer(bytes: buf)
|
||||
// Get an accessor to the root object inside the buffer.
|
||||
let monster: Monster = try! getCheckedRoot(byteBuffer: ByteBuffer(bytes: buf))
|
||||
// let monster: Monster = getRoot(byteBuffer: ByteBuffer(bytes: buf))
|
||||
let monster: Monster = try! getCheckedRoot(byteBuffer: &byteBuffer)
|
||||
// let monster: Monster = getRoot(byteBuffer: &byteBuffer)
|
||||
}
|
||||
|
||||
@@ -4,10 +4,10 @@ import Foundation
|
||||
func run() {
|
||||
// create a ByteBuffer(:) from an [UInt8] or Data()
|
||||
let buf = [] // Get your data
|
||||
|
||||
var byteBuffer = ByteBuffer(bytes: buf)
|
||||
// Get an accessor to the root object inside the buffer.
|
||||
let monster: Monster = try! getCheckedRoot(byteBuffer: ByteBuffer(bytes: buf))
|
||||
// let monster: Monster = getRoot(byteBuffer: ByteBuffer(bytes: buf))
|
||||
let monster: Monster = try! getCheckedRoot(byteBuffer: &byteBuffer)
|
||||
// let monster: Monster = getRoot(byteBuffer: &byteBuffer)
|
||||
|
||||
let hp = monster.hp
|
||||
let mana = monster.mana
|
||||
|
||||
@@ -4,10 +4,10 @@ import Foundation
|
||||
func run() {
|
||||
// create a ByteBuffer(:) from an [UInt8] or Data()
|
||||
let buf = [] // Get your data
|
||||
|
||||
var byteBuffer = ByteBuffer(bytes: buf)
|
||||
// Get an accessor to the root object inside the buffer.
|
||||
let monster: Monster = try! getCheckedRoot(byteBuffer: ByteBuffer(bytes: buf))
|
||||
// let monster: Monster = getRoot(byteBuffer: ByteBuffer(bytes: buf))
|
||||
let monster: Monster = try! getCheckedRoot(byteBuffer: &byteBuffer)
|
||||
// let monster: Monster = getRoot(byteBuffer: &byteBuffer)
|
||||
|
||||
let hp = monster.hp
|
||||
let mana = monster.mana
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2021 Google Inc. All rights reserved.
|
||||
* Copyright 2023 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2021 Google Inc. All rights reserved.
|
||||
* Copyright 2023 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2021 Google Inc. All rights reserved.
|
||||
* Copyright 2023 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2021 Google Inc. All rights reserved.
|
||||
* Copyright 2023 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2021 Google Inc. All rights reserved.
|
||||
* Copyright 2023 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.
|
||||
@@ -66,12 +66,12 @@ public enum FlatbuffersErrors: Error, Equatable {
|
||||
#if !os(WASI)
|
||||
|
||||
extension FlatbuffersErrors {
|
||||
public static func == (
|
||||
lhs: FlatbuffersErrors,
|
||||
rhs: FlatbuffersErrors) -> Bool
|
||||
{
|
||||
lhs.localizedDescription == rhs.localizedDescription
|
||||
}
|
||||
public static func == (
|
||||
lhs: FlatbuffersErrors,
|
||||
rhs: FlatbuffersErrors) -> Bool
|
||||
{
|
||||
lhs.localizedDescription == rhs.localizedDescription
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2021 Google Inc. All rights reserved.
|
||||
* Copyright 2023 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2021 Google Inc. All rights reserved.
|
||||
* Copyright 2023 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2021 Google Inc. All rights reserved.
|
||||
* Copyright 2023 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2021 Google Inc. All rights reserved.
|
||||
* Copyright 2023 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2021 Google Inc. All rights reserved.
|
||||
* Copyright 2023 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2021 Google Inc. All rights reserved.
|
||||
* Copyright 2023 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2021 Google Inc. All rights reserved.
|
||||
* Copyright 2023 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2021 Google Inc. All rights reserved.
|
||||
* Copyright 2023 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2021 Google Inc. All rights reserved.
|
||||
* Copyright 2023 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2021 Google Inc. All rights reserved.
|
||||
* Copyright 2023 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2021 Google Inc. All rights reserved.
|
||||
* Copyright 2023 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2021 Google Inc. All rights reserved.
|
||||
* Copyright 2023 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2021 Google Inc. All rights reserved.
|
||||
* Copyright 2023 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.
|
||||
|
||||
Reference in New Issue
Block a user