chromium/third_party/flatbuffers/src/src/reflection.cpp

/*
 * Copyright 2015 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 "flatbuffers/reflection.h"

#include "flatbuffers/util.h"

// Helper functionality for reflection.

namespace flatbuffers {

namespace {

static void CopyInline(FlatBufferBuilder &fbb,
                       const reflection::Field &fielddef, const Table &table,
                       size_t align, size_t size) {}

static bool VerifyStruct(flatbuffers::Verifier &v,
                         const flatbuffers::Table &parent_table,
                         voffset_t field_offset, const reflection::Object &obj,
                         bool required) {}

static bool VerifyVectorOfStructs(flatbuffers::Verifier &v,
                                  const flatbuffers::Table &parent_table,
                                  voffset_t field_offset,
                                  const reflection::Object &obj,
                                  bool required) {}

// forward declare to resolve cyclic deps between VerifyObject and VerifyVector
static bool VerifyObject(flatbuffers::Verifier &v,
                         const reflection::Schema &schema,
                         const reflection::Object &obj,
                         const flatbuffers::Table *table, bool required);

static bool VerifyUnion(flatbuffers::Verifier &v,
                        const reflection::Schema &schema, uint8_t utype,
                        const uint8_t *elem,
                        const reflection::Field &union_field) {}

static bool VerifyVector(flatbuffers::Verifier &v,
                         const reflection::Schema &schema,
                         const flatbuffers::Table &table,
                         const reflection::Field &vec_field) {}

static bool VerifyObject(flatbuffers::Verifier &v,
                         const reflection::Schema &schema,
                         const reflection::Object &obj,
                         const flatbuffers::Table *table, bool required) {}

}  // namespace

int64_t GetAnyValueI(reflection::BaseType type, const uint8_t *data) {}

double GetAnyValueF(reflection::BaseType type, const uint8_t *data) {}

std::string GetAnyValueS(reflection::BaseType type, const uint8_t *data,
                         const reflection::Schema *schema, int type_index) {}

void ForAllFields(const reflection::Object *object, bool reverse,
                  std::function<void(const reflection::Field *)> func) {}

void SetAnyValueI(reflection::BaseType type, uint8_t *data, int64_t val) {}

void SetAnyValueF(reflection::BaseType type, uint8_t *data, double val) {}

void SetAnyValueS(reflection::BaseType type, uint8_t *data, const char *val) {}

// Resize a FlatBuffer in-place by iterating through all offsets in the buffer
// and adjusting them by "delta" if they straddle the start offset.
// Once that is done, bytes can now be inserted/deleted safely.
// "delta" may be negative (shrinking).
// Unless "delta" is a multiple of the largest alignment, you'll create a small
// amount of garbage space in the buffer (usually 0..7 bytes).
// If your FlatBuffer's root table is not the schema's root table, you should
// pass in your root_table type as well.
class ResizeContext {};

void SetString(const reflection::Schema &schema, const std::string &val,
               const String *str, std::vector<uint8_t> *flatbuf,
               const reflection::Object *root_table) {}

uint8_t *ResizeAnyVector(const reflection::Schema &schema, uoffset_t newsize,
                         const VectorOfAny *vec, uoffset_t num_elems,
                         uoffset_t elem_size, std::vector<uint8_t> *flatbuf,
                         const reflection::Object *root_table) {}

const uint8_t *AddFlatBuffer(std::vector<uint8_t> &flatbuf,
                             const uint8_t *newbuf, size_t newlen) {}

Offset<const Table *> CopyTable(FlatBufferBuilder &fbb,
                                const reflection::Schema &schema,
                                const reflection::Object &objectdef,
                                const Table &table, bool use_string_pooling) {}

bool Verify(const reflection::Schema &schema, const reflection::Object &root,
            const uint8_t *const buf, const size_t length,
            const uoffset_t max_depth, const uoffset_t max_tables) {}

bool VerifySizePrefixed(const reflection::Schema &schema,
                        const reflection::Object &root,
                        const uint8_t *const buf, const size_t length,
                        const uoffset_t max_depth, const uoffset_t max_tables) {}

}  // namespace flatbuffers