chromium/third_party/flatbuffers/src/tests/test_builder.cpp

#include "test_builder.h"

#include "flatbuffers/flatbuffer_builder.h"
#include "flatbuffers/stl_emulation.h"
#include "monster_test_generated.h"

usingnamespaceMyGame::Example;
usingnamespaceflatbuffers;

struct OwnedAllocator : public DefaultAllocator {};

class TestHeapBuilder : public FlatBufferBuilder {};

// This class simulates flatbuffers::grpc::detail::SliceAllocatorMember
struct AllocatorMember {};

struct GrpcLikeMessageBuilder : private AllocatorMember,
                                public FlatBufferBuilder {};

flatbuffers::Offset<Monster> populate1(
    flatbuffers::FlatBufferBuilder &builder) {}

flatbuffers::Offset<Monster> populate2(
    flatbuffers::FlatBufferBuilder &builder) {}

uint8_t *release_raw_base(flatbuffers::FlatBufferBuilder &fbb, size_t &size,
                          size_t &offset) {}

void free_raw(flatbuffers::grpc::MessageBuilder &, uint8_t *) {}

void free_raw(flatbuffers::FlatBufferBuilder &, uint8_t *buf) {}

bool verify(const flatbuffers::DetachedBuffer &buf,
            const std::string &expected_name, Color color) {}

bool verify(const uint8_t *buf, size_t offset, const std::string &expected_name,
            Color color) {}

bool release_n_verify(flatbuffers::FlatBufferBuilder &fbb,
                      const std::string &expected_name, Color color) {}

// forward-declared in test.cpp
void FlatBufferBuilderTest();

void FlatBufferBuilderTest() {}

// forward-declared in test_builder.h
void CheckTestGeneratedIsValid(const MyGame::Example::Color &);

// Link-time check using pointer type.
void CheckTestGeneratedIsValid(const MyGame::Example::Color &) {}