File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -242,6 +242,40 @@ provide the following functions to aide in the serialization process:
242242 }
243243```
244244
245+ - ` native_type("type") ` (on a table): Tables can also be represented with
246+ native types. For example, the following schema:
247+
248+ ``` cpp
249+ table Matrix {
250+ rows: int32;
251+ columns: int32;
252+ values: [float];
253+ }
254+ ```
255+
256+ Could be represented by a user-defined C++ class:
257+
258+ ```cpp
259+ class Matrix { ... }
260+ ```
261+
262+ In this case, the following function declarations are generated by the compiler.
263+ The user must provide and link the matching function definitions:
264+
265+ ``` cpp
266+ struct Matrix FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
267+ // ...
268+ void UnPackTo(
269+ Native::Matrix * _ o,
270+ const ::flatbuffers::resolver_function_t * _ resolver = nullptr) const;
271+ }
272+
273+ ::flatbuffers::Offset<Matrix> CreateMatrix(
274+ ::flatbuffers::FlatBufferBuilder &_fbb,
275+ const NativeMatrixType *_o,
276+ const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
277+ ```
278+
245279Finally, the following top-level attributes:
246280
247281- `native_include("path")` (at file level): Because the `native_type` attribute
You can’t perform that action at this time.
0 commit comments