ONE - On-device Neural Engine
Loading...
Searching...
No Matches
flatbuffers::Parser Class Reference

#include <idl.h>

Collaboration diagram for flatbuffers::Parser:

Public Member Functions

 Parser (const IDLOptions &options=IDLOptions())
 
 ~Parser ()
 
bool Parse (const char *_source, const char **include_paths=nullptr, const char *source_filename=nullptr)
 
bool ParseJson (const char *json, const char *json_filename=nullptr)
 
bool SetRootType (const char *name)
 
void MarkGenerated ()
 
std::set< std::string > GetIncludedFilesRecursive (const std::string &file_name) const
 
void Serialize ()
 
bool Deserialize (const uint8_t *buf, const size_t size)
 
bool Deserialize (const reflection::Schema *schema)
 
TypeDeserializeType (const reflection::Type *type)
 
std::string ConformTo (const Parser &base)
 
bool ParseFlexBuffer (const char *source, const char *source_filename, flexbuffers::Builder *builder)
 
StructDefLookupStruct (const std::string &id) const
 
StructDefLookupStructThruParentNamespaces (const std::string &id) const
 
std::string UnqualifiedName (const std::string &fullQualifiedName)
 
FLATBUFFERS_CHECKED_ERROR Error (const std::string &msg)
 
- Public Member Functions inherited from flatbuffers::ParserState
 ParserState ()
 

Static Public Member Functions

static bool SupportsOptionalScalars (const flatbuffers::IDLOptions &opts)
 

Data Fields

SymbolTable< Typetypes_
 
SymbolTable< StructDefstructs_
 
SymbolTable< EnumDefenums_
 
SymbolTable< ServiceDefservices_
 
std::vector< Namespace * > namespaces_
 
Namespacecurrent_namespace_
 
Namespaceempty_namespace_
 
std::string error_
 
FlatBufferBuilder builder_
 
flexbuffers::Builder flex_builder_
 
flexbuffers::Reference flex_root_
 
StructDefroot_struct_def_
 
std::string file_identifier_
 
std::string file_extension_
 
std::map< uint64_t, std::string > included_files_
 
std::map< std::string, std::set< std::string > > files_included_per_file_
 
std::vector< std::string > native_included_files_
 
std::map< std::string, bool > known_attributes_
 
IDLOptions opts
 
bool uses_flexbuffers_
 
uint64_t advanced_features_
 

Additional Inherited Members

- Protected Member Functions inherited from flatbuffers::ParserState
void ResetState (const char *source)
 
void MarkNewLine ()
 
int64_t CursorPosition () const
 
- Protected Attributes inherited from flatbuffers::ParserState
const char * cursor_
 
const char * line_start_
 
int line_
 
int token_
 
bool attr_is_trivial_ascii_string_
 
std::string attribute_
 
std::vector< std::string > doc_comment_
 

Detailed Description

Definition at line 750 of file idl.h.

Constructor & Destructor Documentation

◆ Parser()

flatbuffers::Parser::Parser ( const IDLOptions options = IDLOptions())
inlineexplicit

Definition at line 753 of file idl.h.

754 : current_namespace_(nullptr), empty_namespace_(nullptr),
756 opts(options), uses_flexbuffers_(false), advanced_features_(0), source_(nullptr),
757 anonymous_counter_(0), parse_depth_counter_(0)
758 {
760 {
762 }
763 // Start out with the empty namespace being current.
764 empty_namespace_ = new Namespace();
765 namespaces_.push_back(empty_namespace_);
767 known_attributes_["deprecated"] = true;
768 known_attributes_["required"] = true;
769 known_attributes_["key"] = true;
770 known_attributes_["shared"] = true;
771 known_attributes_["hash"] = true;
772 known_attributes_["id"] = true;
773 known_attributes_["force_align"] = true;
774 known_attributes_["bit_flags"] = true;
775 known_attributes_["original_order"] = true;
776 known_attributes_["nested_flatbuffer"] = true;
777 known_attributes_["csharp_partial"] = true;
778 known_attributes_["streaming"] = true;
779 known_attributes_["idempotent"] = true;
780 known_attributes_["cpp_type"] = true;
781 known_attributes_["cpp_ptr_type"] = true;
782 known_attributes_["cpp_ptr_type_get"] = true;
783 known_attributes_["cpp_str_type"] = true;
784 known_attributes_["cpp_str_flex_ctor"] = true;
785 known_attributes_["native_inline"] = true;
786 known_attributes_["native_custom_alloc"] = true;
787 known_attributes_["native_type"] = true;
788 known_attributes_["native_type_pack_name"] = true;
789 known_attributes_["native_default"] = true;
790 known_attributes_["flexbuffer"] = true;
791 known_attributes_["private"] = true;
792 }
void ForceDefaults(bool fd)
In order to save space, fields that are set to their default value don't get serialized into the buff...
Namespace * current_namespace_
Definition idl.h:951
std::vector< Namespace * > namespaces_
Definition idl.h:950
uint64_t advanced_features_
Definition idl.h:971
flexbuffers::Builder flex_builder_
Definition idl.h:956
FlatBufferBuilder builder_
Definition idl.h:955
StructDef * root_struct_def_
Definition idl.h:958
bool uses_flexbuffers_
Definition idl.h:969
std::map< std::string, bool > known_attributes_
Definition idl.h:966
Namespace * empty_namespace_
Definition idl.h:952
IDLOptions opts
Definition idl.h:968

References builder_, current_namespace_, empty_namespace_, flatbuffers::IDLOptions::force_defaults, flatbuffers::FlatBufferBuilder::ForceDefaults(), known_attributes_, namespaces_, and opts.

◆ ~Parser()

flatbuffers::Parser::~Parser ( )
inline

Definition at line 794 of file idl.h.

795 {
796 for (auto it = namespaces_.begin(); it != namespaces_.end(); ++it)
797 {
798 delete *it;
799 }
800 }

References namespaces_.

Member Function Documentation

◆ ConformTo()

std::string flatbuffers::Parser::ConformTo ( const Parser base)

◆ Deserialize() [1/2]

bool flatbuffers::Parser::Deserialize ( const reflection::Schema *  schema)

◆ Deserialize() [2/2]

bool flatbuffers::Parser::Deserialize ( const uint8_t *  buf,
const size_t  size 
)

◆ DeserializeType()

Type * flatbuffers::Parser::DeserializeType ( const reflection::Type *  type)

◆ Error()

FLATBUFFERS_CHECKED_ERROR flatbuffers::Parser::Error ( const std::string &  msg)

◆ GetIncludedFilesRecursive()

std::set< std::string > flatbuffers::Parser::GetIncludedFilesRecursive ( const std::string &  file_name) const

◆ LookupStruct()

StructDef * flatbuffers::Parser::LookupStruct ( const std::string &  id) const

◆ LookupStructThruParentNamespaces()

StructDef * flatbuffers::Parser::LookupStructThruParentNamespaces ( const std::string &  id) const

◆ MarkGenerated()

void flatbuffers::Parser::MarkGenerated ( )

◆ Parse()

bool flatbuffers::Parser::Parse ( const char *  _source,
const char **  include_paths = nullptr,
const char *  source_filename = nullptr 
)

◆ ParseFlexBuffer()

bool flatbuffers::Parser::ParseFlexBuffer ( const char *  source,
const char *  source_filename,
flexbuffers::Builder *  builder 
)

◆ ParseJson()

bool flatbuffers::Parser::ParseJson ( const char *  json,
const char *  json_filename = nullptr 
)

◆ Serialize()

void flatbuffers::Parser::Serialize ( )

◆ SetRootType()

bool flatbuffers::Parser::SetRootType ( const char *  name)

◆ SupportsOptionalScalars()

static bool flatbuffers::Parser::SupportsOptionalScalars ( const flatbuffers::IDLOptions opts)
static

◆ UnqualifiedName()

std::string flatbuffers::Parser::UnqualifiedName ( const std::string &  fullQualifiedName)

Field Documentation

◆ advanced_features_

uint64_t flatbuffers::Parser::advanced_features_

Definition at line 971 of file idl.h.

◆ builder_

FlatBufferBuilder flatbuffers::Parser::builder_

Definition at line 955 of file idl.h.

Referenced by Parser().

◆ current_namespace_

Namespace* flatbuffers::Parser::current_namespace_

Definition at line 951 of file idl.h.

Referenced by Parser().

◆ empty_namespace_

Namespace* flatbuffers::Parser::empty_namespace_

Definition at line 952 of file idl.h.

Referenced by Parser().

◆ enums_

SymbolTable<EnumDef> flatbuffers::Parser::enums_

Definition at line 948 of file idl.h.

◆ error_

std::string flatbuffers::Parser::error_

Definition at line 953 of file idl.h.

◆ file_extension_

std::string flatbuffers::Parser::file_extension_

Definition at line 960 of file idl.h.

◆ file_identifier_

std::string flatbuffers::Parser::file_identifier_

Definition at line 959 of file idl.h.

◆ files_included_per_file_

std::map<std::string, std::set<std::string> > flatbuffers::Parser::files_included_per_file_

Definition at line 963 of file idl.h.

◆ flex_builder_

flexbuffers::Builder flatbuffers::Parser::flex_builder_

Definition at line 956 of file idl.h.

◆ flex_root_

flexbuffers::Reference flatbuffers::Parser::flex_root_

Definition at line 957 of file idl.h.

◆ included_files_

std::map<uint64_t, std::string> flatbuffers::Parser::included_files_

Definition at line 962 of file idl.h.

◆ known_attributes_

std::map<std::string, bool> flatbuffers::Parser::known_attributes_

Definition at line 966 of file idl.h.

Referenced by Parser().

◆ namespaces_

std::vector<Namespace *> flatbuffers::Parser::namespaces_

Definition at line 950 of file idl.h.

Referenced by Parser(), and ~Parser().

◆ native_included_files_

std::vector<std::string> flatbuffers::Parser::native_included_files_

Definition at line 964 of file idl.h.

◆ opts

IDLOptions flatbuffers::Parser::opts

Definition at line 968 of file idl.h.

Referenced by Parser().

◆ root_struct_def_

StructDef* flatbuffers::Parser::root_struct_def_

Definition at line 958 of file idl.h.

◆ services_

SymbolTable<ServiceDef> flatbuffers::Parser::services_

Definition at line 949 of file idl.h.

◆ structs_

SymbolTable<StructDef> flatbuffers::Parser::structs_

Definition at line 947 of file idl.h.

◆ types_

SymbolTable<Type> flatbuffers::Parser::types_

Definition at line 946 of file idl.h.

◆ uses_flexbuffers_

bool flatbuffers::Parser::uses_flexbuffers_

Definition at line 969 of file idl.h.


The documentation for this class was generated from the following file: