| 1 | /* |
| 2 | * Copyright 2021 Google Inc. All rights reserved. |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef FLATBUFFERS_BUFFER_REF_H_ |
| 18 | #define FLATBUFFERS_BUFFER_REF_H_cxx . . $ `ogr/ogrsf_frmts/flatgeobuf/flatbuffers/buffer_ref.h:18:9`! |
| 19 | |
| 20 | #include "flatbuffers/base.h"cxx . . $ `<file>/ogr/ogrsf_frmts/flatgeobuf/flatbuffers/base.h`/ |
| 21 | #include "flatbuffers/verifier.h"cxx . . $ `<file>/ogr/ogrsf_frmts/flatgeobuf/flatbuffers/verifier.h`/ |
| 22 | |
| 23 | namespace flatbufferscxx . . $ `<built-in>:487:9`! { |
| 24 | |
| 25 | // Convenient way to bundle a buffer and its length, to pass it around |
| 26 | // typed by its root. |
| 27 | // A BufferRef does not own its buffer. |
| 28 | struct BufferRefBasecxx . . $ gdal_flatbuffers/BufferRefBase# {}; // for std::is_base_of |
| 29 | |
| 30 | template<typename T> struct BufferRefcxx . . $ gdal_flatbuffers/BufferRef# : BufferRefBasecxx . . $ gdal_flatbuffers/BufferRefBase# { |
| 31 | BufferRefcxx . . $ gdal_flatbuffers/BufferRef#`BufferRef<T>`(49f6e7a06ebc5aa8).() : bufcxx . . $ gdal_flatbuffers/BufferRef#buf.(nullptr), lencxx . . $ gdal_flatbuffers/BufferRef#len.(0), must_freecxx . . $ gdal_flatbuffers/BufferRef#must_free.(false) {} |
| 32 | BufferRefcxx . . $ gdal_flatbuffers/BufferRef#`BufferRef<T>`(e1e8b00c42c42532).(uint8_tcxx . . $ uint8_t# *_buf, uoffset_tcxx . . $ gdal_flatbuffers/uoffset_t# _len) |
| 33 | : bufcxx . . $ gdal_flatbuffers/BufferRef#buf.(_buf), lencxx . . $ gdal_flatbuffers/BufferRef#len.(_len), must_freecxx . . $ gdal_flatbuffers/BufferRef#must_free.(false) {} |
| 34 | |
| 35 | ~cxx . . $ gdal_flatbuffers/BufferRef#`~BufferRef<T>`(49f6e7a06ebc5aa8).BufferRef() { |
| 36 | if (must_freecxx . . $ gdal_flatbuffers/BufferRef#must_free.) freecxx . . $ free(bd21765a0afc8e3c).(bufcxx . . $ gdal_flatbuffers/BufferRef#buf.); |
| 37 | } |
| 38 | |
| 39 | const T *GetRootcxx . . $ gdal_flatbuffers/BufferRef#GetRoot(1016ee5406d91ab9).() const { return flatbufferscxx . . $ `<built-in>:487:9`!::GetRootcxx . . $ gdal_flatbuffers/GetRoot(576a5644c01690fc).<T>(bufcxx . . $ gdal_flatbuffers/BufferRef#buf.); } |
| 40 | |
| 41 | bool Verifycxx . . $ gdal_flatbuffers/BufferRef#Verify(c9857a73d68e59ba).() { |
| 42 | Verifiercxx . . $ gdal_flatbuffers/Verifier# verifiercxx . . $ gdal_flatbuffers/Verifier#Verifier(d694bde51c52b27b).(bufcxx . . $ gdal_flatbuffers/BufferRef#buf., lencxx . . $ gdal_flatbuffers/BufferRef#len.); |
| 43 | return verifier.VerifyBuffercxx . . $ gdal_flatbuffers/Verifier#VerifyBuffer(c9857a73d68e59ba).<T>(nullptr); |
| 44 | } |
| 45 | |
| 46 | uint8_tcxx . . $ uint8_t# *bufcxx . . $ gdal_flatbuffers/BufferRef#buf.; |
| 47 | uoffset_tcxx . . $ gdal_flatbuffers/uoffset_t# lencxx . . $ gdal_flatbuffers/BufferRef#len.; |
| 48 | bool must_freecxx . . $ gdal_flatbuffers/BufferRef#must_free.; |
| 49 | }; |
| 50 | |
| 51 | } // namespace flatbuffers |
| 52 | |
| 53 | #endif // FLATBUFFERS_BUFFER_REF_H_ |