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 (const Parser &)=delete
 
Parseroperator= (const Parser &)=delete
 
 Parser (Parser &&)=default
 
Parseroperator= (Parser &&)=default
 
 ~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)
 
std::ptrdiff_t BytesConsumed () const
 
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)
 
std::vector< IncludedFileGetIncludedFiles () const
 
- 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< IncludedFile > > files_included_per_file_
 
std::vector< std::string > native_included_files_
 
std::map< std::string, bool > known_attributes_
 
IDLOptions opts
 
bool uses_flexbuffers_
 
bool has_warning_
 
uint64_t advanced_features_
 
std::string file_being_parsed_
 

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 * prev_cursor_
 
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 915 of file idl.h.

Constructor & Destructor Documentation

◆ Parser() [1/3]

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

Definition at line 917 of file idl.h.

918 : current_namespace_(nullptr),
919 empty_namespace_(nullptr),
921 root_struct_def_(nullptr),
922 opts(options),
923 uses_flexbuffers_(false),
924 has_warning_(false),
926 source_(nullptr),
927 anonymous_counter_(0),
928 parse_depth_counter_(0) {
930 // Start out with the empty namespace being current.
931 empty_namespace_ = new Namespace();
932 namespaces_.push_back(empty_namespace_);
934 known_attributes_["deprecated"] = true;
935 known_attributes_["required"] = true;
936 known_attributes_["key"] = true;
937 known_attributes_["shared"] = true;
938 known_attributes_["hash"] = true;
939 known_attributes_["id"] = true;
940 known_attributes_["force_align"] = true;
941 known_attributes_["bit_flags"] = true;
942 known_attributes_["original_order"] = true;
943 known_attributes_["nested_flatbuffer"] = true;
944 known_attributes_["csharp_partial"] = true;
945 known_attributes_["streaming"] = true;
946 known_attributes_["idempotent"] = true;
947 known_attributes_["cpp_type"] = true;
948 known_attributes_["cpp_ptr_type"] = true;
949 known_attributes_["cpp_ptr_type_get"] = true;
950 known_attributes_["cpp_str_type"] = true;
951 known_attributes_["cpp_str_flex_ctor"] = true;
952 known_attributes_["native_inline"] = true;
953 known_attributes_["native_custom_alloc"] = true;
954 known_attributes_["native_type"] = true;
955 known_attributes_["native_type_pack_name"] = true;
956 known_attributes_["native_default"] = true;
957 known_attributes_["flexbuffer"] = true;
958 known_attributes_["private"] = true;
959
960 // An attribute added to a field to indicate that is uses 64-bit addressing.
961 known_attributes_["offset64"] = true;
962
963 // An attribute added to a vector field to indicate that it uses 64-bit
964 // addressing and it has a 64-bit length.
965 known_attributes_["vector64"] = true;
966 }
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:1168
std::vector< Namespace * > namespaces_
Definition idl.h:1167
uint64_t advanced_features_
Definition idl.h:1189
flexbuffers::Builder flex_builder_
Definition idl.h:1173
FlatBufferBuilder builder_
Definition idl.h:1172
StructDef * root_struct_def_
Definition idl.h:1175
bool uses_flexbuffers_
Definition idl.h:1186
std::map< std::string, bool > known_attributes_
Definition idl.h:1183
Namespace * empty_namespace_
Definition idl.h:1169
IDLOptions opts
Definition idl.h:1185
@ BUILDER_FLAG_SHARE_ALL

References builder_, current_namespace_, empty_namespace_, flatbuffers::IDLOptions::force_defaults, flatbuffers::FlatBufferBuilderImpl< Is64Aware >::ForceDefaults(), known_attributes_, namespaces_, and opts.

◆ Parser() [2/3]

flatbuffers::Parser::Parser ( const Parser )
delete

◆ Parser() [3/3]

flatbuffers::Parser::Parser ( Parser &&  )
default

◆ ~Parser()

flatbuffers::Parser::~Parser ( )
inline

Definition at line 975 of file idl.h.

975 {
976 for (auto it = namespaces_.begin(); it != namespaces_.end(); ++it) {
977 delete *it;
978 }
979 }

References namespaces_.

Member Function Documentation

◆ BytesConsumed()

std::ptrdiff_t flatbuffers::Parser::BytesConsumed ( ) const

◆ 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)

◆ GetIncludedFiles()

std::vector< IncludedFile > flatbuffers::Parser::GetIncludedFiles ( ) const

◆ 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 ( )

◆ operator=() [1/2]

Parser & flatbuffers::Parser::operator= ( const Parser )
delete

◆ operator=() [2/2]

Parser & flatbuffers::Parser::operator= ( Parser &&  )
default

◆ 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

Referenced by GetIncludedFiles().

◆ UnqualifiedName()

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

Field Documentation

◆ advanced_features_

uint64_t flatbuffers::Parser::advanced_features_

Definition at line 1189 of file idl.h.

◆ builder_

FlatBufferBuilder flatbuffers::Parser::builder_

Definition at line 1172 of file idl.h.

Referenced by Parser().

◆ current_namespace_

Namespace* flatbuffers::Parser::current_namespace_

Definition at line 1168 of file idl.h.

Referenced by Parser().

◆ empty_namespace_

Namespace* flatbuffers::Parser::empty_namespace_

Definition at line 1169 of file idl.h.

Referenced by Parser().

◆ enums_

SymbolTable<EnumDef> flatbuffers::Parser::enums_

Definition at line 1165 of file idl.h.

◆ error_

std::string flatbuffers::Parser::error_

Definition at line 1170 of file idl.h.

◆ file_being_parsed_

std::string flatbuffers::Parser::file_being_parsed_

Definition at line 1191 of file idl.h.

◆ file_extension_

std::string flatbuffers::Parser::file_extension_

Definition at line 1177 of file idl.h.

◆ file_identifier_

std::string flatbuffers::Parser::file_identifier_

Definition at line 1176 of file idl.h.

◆ files_included_per_file_

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

Definition at line 1180 of file idl.h.

◆ flex_builder_

flexbuffers::Builder flatbuffers::Parser::flex_builder_

Definition at line 1173 of file idl.h.

◆ flex_root_

flexbuffers::Reference flatbuffers::Parser::flex_root_

Definition at line 1174 of file idl.h.

◆ has_warning_

bool flatbuffers::Parser::has_warning_

Definition at line 1187 of file idl.h.

◆ included_files_

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

Definition at line 1179 of file idl.h.

◆ known_attributes_

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

Definition at line 1183 of file idl.h.

Referenced by Parser().

◆ namespaces_

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

Definition at line 1167 of file idl.h.

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

◆ native_included_files_

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

Definition at line 1181 of file idl.h.

◆ opts

IDLOptions flatbuffers::Parser::opts

Definition at line 1185 of file idl.h.

Referenced by Parser().

◆ root_struct_def_

StructDef* flatbuffers::Parser::root_struct_def_

Definition at line 1175 of file idl.h.

◆ services_

SymbolTable<ServiceDef> flatbuffers::Parser::services_

Definition at line 1166 of file idl.h.

◆ structs_

SymbolTable<StructDef> flatbuffers::Parser::structs_

Definition at line 1164 of file idl.h.

◆ types_

SymbolTable<Type> flatbuffers::Parser::types_

Definition at line 1163 of file idl.h.

◆ uses_flexbuffers_

bool flatbuffers::Parser::uses_flexbuffers_

Definition at line 1186 of file idl.h.


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