cgv
|
the pre header processor parses a pre header file and converts it to a header file or uses the information from parsing to transform a template file to a header file. More...
#include <ph_processor.h>
Public Member Functions | |
std::string | find_include_file (const std::string &fn, bool local) const |
ph_processor (const std::string &_additional_include_path="", bool _search_recursive=false, char _special='@') | |
void | swap_output (ph_processor &pp) |
char | get_special () const |
void | configure_insert_to_shader (std::vector< std::string > *_inserted_shader_file_names) |
void | set_error_stream (std::ostream &error_stream) |
bool | parse_string (const std::string &text) |
bool | parse_file (const std::string &file_name) |
bool | process_to_string (std::string &output) |
int | process_to_file (const std::string &_file_name, long long last_write_time=0) |
bool | process_without_output () |
void | close () |
Static Public Member Functions | |
static std::string | my_getenv (const char *name) |
Public Attributes | |
int | exit_code |
Protected Types | |
enum | ReflectionParenthesis { RP_COMPOUND , RP_NAMESPACE } |
Protected Member Functions | |
unsigned int | get_line_number (const token &loc) const |
void | error (const std::string &text, const token &loc, unsigned int error_number=0) |
bool | check_evaluation_error (unsigned int i, unsigned int ei) |
bool | process (unsigned int i, unsigned int j) |
bool | parse () |
bool | parse_without_special (unsigned nr_skip=0) |
bool | process_include (unsigned int i, bool is_cinclude=false, bool insert=false) |
bool | process_list (unsigned int i) |
variant | construct_namespace_list () const |
std::string | construct_namespace_sequence () const |
void | ensure_reflect_info () |
bool | reflect (const token &code, const token &comment) |
bool | recursive_dir (std::string rel_directory, std::string actual_directory, std::string filter, bool rel_path, variant &desc_list, bool recursive) |
Protected Attributes | |
bool | found_error |
unsigned | nr_functions |
char | special |
bool | generate_output |
bool | content_is_external |
std::ostream * | os |
std::ostream * | es |
const std::string * | content |
std::string | file_name |
std::vector< cgv::utils::line > | lines |
std::vector< command_token > | commands |
int | recursion_depth |
std::vector< std::string > * | inserted_shader_file_names |
bool | debug_reflection |
variant * | reflect_info |
std::vector< ReflectionParenthesis > | rp_stack |
std::vector< std::string > | namespace_stack |
std::vector< variant * > | compound_stack |
std::vector< std::string > | compound_access_type_stack |
std::string | additional_include_path |
bool | search_recursive |
Friends | |
class | expression_processor |
the pre header processor parses a pre header file and converts it to a header file or uses the information from parsing to transform a template file to a header file.
Support for type reflection:
< ... generates type reflection info from the code on this line before the < token > ... generates type reflection info starting with the code on the next line up to and not including the next ; or { symbol
the to be reflected code is parsed and the following code fragments detected:
#include ... adds an include to the list of include files namespace name ... enters the given namespace class / struct / union name ... begins a compound definition protected / private / public : ... switches the member access type type name ... declares a member typedef type name ... declares a type inside or outside a class definition type name(parameter list) [const] ... declares a method } ... leaves a namespace or ends a compound definition
the extracted information is stored in the variable reflect_info in the following structure of nested lists:
reflect_info = {includes:[string], typedefs:[typedef], enums:[enum], compounds:[compound], variables:[variable], functions:[function] } typedef = {namespaces:[string], namespace_prefix:string, name:string, type:string, comment:string} enum = {namespaces:[string], namespace_prefix:string, name:string, entries:[enum_entries], comment:string} enum_entry = {name:string, value:int, comment:string} compound = {namespaces:[string], namespace_prefix:string, type_name:string, typedefs:[typedef], enums:[enum], compounds:[compound], members:[member], methods:[method] bases:[base], kind:string [class|struct|union], comment:string} base = {type_name:string, is_virtual:bool, access_type:string [private,protected,public] } member = {name:string, type:string, access_type:string [private,protected,public], is_static:bool, comment:string} method = {name:string, type:string, -> return type) parameters:[parameter], access_type:string [private,protected,public] is_virtual:bool, is_const:bool, comment:string} variable = {namespaces:[string], namespace_prefix:string, name:string, type:string, comment:string} function = [namespaces:[string], namespace_prefix:string, name:string, type:string, parameters:[parameter], comment:string] parameter = {name:string, type:string, has_default_value:bool, default_value:string}
Definition at line 100 of file ph_processor.h.
|
protected |
Definition at line 137 of file ph_processor.h.
cgv::ppp::ph_processor::ph_processor | ( | const std::string & | _additional_include_path = "" , |
bool | _search_recursive = false , |
||
char | _special = '@' |
||
) |
Definition at line 23 of file ph_processor.cxx.
cgv::ppp::ph_processor::~ph_processor | ( | ) |
Definition at line 43 of file ph_processor.cxx.
|
protected |
Definition at line 342 of file ph_processor.cxx.
void cgv::ppp::ph_processor::close | ( | ) |
Definition at line 53 of file ph_processor.cxx.
void cgv::ppp::ph_processor::configure_insert_to_shader | ( | std::vector< std::string > * | _inserted_shader_file_names | ) |
Definition at line 48 of file ph_processor.cxx.
|
protected |
Definition at line 493 of file ph_processor.cxx.
|
protected |
Definition at line 503 of file ph_processor.cxx.
|
protected |
Definition at line 475 of file ph_processor.cxx.
|
protected |
Definition at line 211 of file ph_processor.cxx.
std::string cgv::ppp::ph_processor::find_include_file | ( | const std::string & | fn, |
bool | local | ||
) | const |
Definition at line 259 of file ph_processor.cxx.
|
protected |
Definition at line 202 of file ph_processor.cxx.
|
inline |
Definition at line 157 of file ph_processor.h.
|
static |
Definition at line 236 of file ph_processor.cxx.
|
protected |
Definition at line 1840 of file ph_processor.cxx.
bool cgv::ppp::ph_processor::parse_file | ( | const std::string & | file_name | ) |
Definition at line 70 of file ph_processor.cxx.
bool cgv::ppp::ph_processor::parse_string | ( | const std::string & | text | ) |
Definition at line 62 of file ph_processor.cxx.
|
protected |
Definition at line 1935 of file ph_processor.cxx.
|
protected |
Definition at line 1160 of file ph_processor.cxx.
|
protected |
Definition at line 289 of file ph_processor.cxx.
|
protected |
Definition at line 379 of file ph_processor.cxx.
int cgv::ppp::ph_processor::process_to_file | ( | const std::string & | _file_name, |
long long | last_write_time = 0 |
||
) |
Definition at line 150 of file ph_processor.cxx.
bool cgv::ppp::ph_processor::process_to_string | ( | std::string & | output | ) |
Definition at line 133 of file ph_processor.cxx.
bool cgv::ppp::ph_processor::process_without_output | ( | ) |
Definition at line 114 of file ph_processor.cxx.
|
protected |
Definition at line 1761 of file ph_processor.cxx.
Definition at line 514 of file ph_processor.cxx.
void cgv::ppp::ph_processor::set_error_stream | ( | std::ostream & | error_stream | ) |
Definition at line 197 of file ph_processor.cxx.
void cgv::ppp::ph_processor::swap_output | ( | ph_processor & | pp | ) |
Definition at line 127 of file ph_processor.cxx.
|
friend |
Definition at line 105 of file ph_processor.h.
|
protected |
Definition at line 150 of file ph_processor.h.
|
protected |
Definition at line 116 of file ph_processor.h.
|
protected |
Definition at line 141 of file ph_processor.h.
|
protected |
Definition at line 140 of file ph_processor.h.
|
protected |
Definition at line 113 of file ph_processor.h.
|
protected |
Definition at line 110 of file ph_processor.h.
|
protected |
Definition at line 135 of file ph_processor.h.
|
protected |
Definition at line 112 of file ph_processor.h.
int cgv::ppp::ph_processor::exit_code |
Definition at line 155 of file ph_processor.h.
|
protected |
Definition at line 114 of file ph_processor.h.
|
protected |
Definition at line 106 of file ph_processor.h.
|
protected |
Definition at line 109 of file ph_processor.h.
|
protected |
Definition at line 119 of file ph_processor.h.
|
protected |
Definition at line 115 of file ph_processor.h.
|
protected |
Definition at line 139 of file ph_processor.h.
|
protected |
Definition at line 107 of file ph_processor.h.
|
protected |
Definition at line 111 of file ph_processor.h.
|
protected |
Definition at line 117 of file ph_processor.h.
|
protected |
Definition at line 136 of file ph_processor.h.
|
protected |
Definition at line 138 of file ph_processor.h.
|
protected |
Definition at line 151 of file ph_processor.h.
|
protected |
Definition at line 108 of file ph_processor.h.