Flow123d
release_3.0.0-1124-g41e620f
|
Class for create JSON machine readable documentation. More...
#include <type_output.hh>
Public Member Functions | |
OutputJSONMachine (RevNumData rev_num_data) | |
Simple constructor. More... | |
OutputJSONMachine (const Record &root_type, RevNumData rev_num_data) | |
Constructor allowing to set root_type_. More... | |
ostream & | print (ostream &stream) override |
Performs output of the documentation into given stream . More... | |
Protected Member Functions | |
std::string | escape_description (std::string desc) |
Replace slashes, quotes and special chars with escaped format of these chars. More... | |
void | print_type_header (ostream &stream, const TypeBase *type) |
Print header of a JSON object describing single TypeBase instance. More... | |
void | print_impl (ostream &stream, const Record *type) |
Implements printout of Record type . More... | |
void | print_impl (ostream &stream, const Array *type) |
Implements printout of Array type . More... | |
void | print_impl (ostream &stream, const Abstract *type) |
Implements printout of Abstract type . More... | |
void | print_impl (ostream &stream, const AdHocAbstract *type) |
Implements printout of AdHocAbstract type . More... | |
void | print_impl (ostream &stream, const Selection *type) |
Implements printout of Selection type . More... | |
void | print_impl (ostream &stream, const Integer *type) |
Implements printout of Integer type . More... | |
void | print_impl (ostream &stream, const Double *type) |
Implements printout of Double type . More... | |
void | print_impl (ostream &stream, const Bool *type) |
Implements printout of Bool type . More... | |
void | print_impl (ostream &stream, const String *type) |
Implements printout of String type . More... | |
void | print_impl (ostream &stream, const FileName *type) |
Implements printout of FileName type . More... | |
void | print_impl (ostream &stream, const Parameter *type) |
Implements printout of FileName type . More... | |
void | print_abstract_record_keys (ostream &stream, const Abstract *type) |
Print all keys of Abstract type or AdHocAbstract type. More... | |
void | print_program_info (ostream &stream) |
Print actual version of program. More... | |
void | print_full_hash (ostream &stream) |
Print full_hash_ key. More... | |
Protected Member Functions inherited from Input::Type::OutputBase | |
OutputBase () | |
Constructor. More... | |
virtual | ~OutputBase () |
Destructor. More... | |
void | get_array_sizes (Array array, unsigned int &lower, unsigned int &upper) |
Gets range of array. More... | |
const string & | get_record_description (const Record *rec) |
Gets description of the given record type. More... | |
const string & | get_abstract_description (const Abstract *a_rec) |
Gets description of the given abstract type. More... | |
void | get_integer_bounds (Integer integer, int &lower, int &upper) |
Gets range of integer. More... | |
void | get_double_bounds (Double dbl, double &lower, double &upper) |
Gets range of double. More... | |
void | get_parent_vec (Record rec, std::vector< std::shared_ptr< Abstract > > &parent_vec) |
Gets pointer of parent Abstract for given Record. More... | |
void | get_array_type (Array array, std::shared_ptr< TypeBase > &arr_type) |
Gets pointer of inner type for given Array. More... | |
void | get_default (Record::KeyIter it, string &type, string &value) |
Gets values of default for given record key. More... | |
const string & | get_selection_description (const Selection *sel) |
Gets description of the given selection type. More... | |
void | get_adhoc_parent_name (const AdHocAbstract *a_rec, string &parent_name) |
Gets ancestor_.type_name of the given AdHocAbstract type. More... | |
Abstract::ChildDataIter | get_adhoc_parent_data (const AdHocAbstract *a_rec) |
Gets iterator to begin of ancestor_.child_data_ of the given AdHocAbstract type. More... | |
void | get_attr_and_param_data (const TypeBase *type, TypeBase::attribute_map &attr_map, TypeBase::TypeHash &generic_type_hash, TypeBase::json_string ¶meter_map_to_json) |
Gets data of attributes and parameters of the given type. More... | |
template<class T > | |
void | print_generic (ostream &stream, const TypeBase *type) |
void | print_base (ostream &stream, const TypeBase *type) |
Perform resolution according to actual type (using typeid) and call particular print_impl method. More... | |
void | write_description (std::ostream &stream, const string &str, unsigned int padding, unsigned int hash_count=1) |
Write out a string with given padding of every new line. More... | |
void | write_default_value (std::ostream &stream, Default dft) |
Write value stored in dft . More... | |
void | clear_processed_types () |
Clear all data of processed types. More... | |
bool | was_written (std::size_t hash) |
Returns true if the type was printed out. More... | |
Protected Attributes | |
std::string | format_head |
Header of the format, printed before call of version print. More... | |
std::string | format_inner |
Inner part of the format, printed before first call of recursive print. More... | |
std::string | format_full_hash |
Tail of the format, printed after all recursive prints are finished and before full hash prints. More... | |
std::string | format_tail |
Tail of the format, printed after all recursive prints are finished. More... | |
RevNumData | rev_num_data_ |
Contains version of program and other base data. More... | |
Record | root_type_ |
Root type for output. More... | |
Protected Attributes inherited from Input::Type::OutputBase | |
DocumentationType | doc_type_ |
Type of documentation output. More... | |
unsigned int | size_setw_ |
temporary value for printout of description (used in std::setw function) More... | |
std::set< std::size_t > | processed_types_hash_ |
Set of hashes of outputed types. Should replace keys. More... | |
TypeBase::TypeHash | full_hash_ |
Content hash of full IST, value is used for key IST_hash. More... | |
Additional Inherited Members | |
Protected Types inherited from Input::Type::OutputBase | |
enum | DocumentationType { key_record, full_record } |
Types of documentation output. More... | |
Static Protected Attributes inherited from Input::Type::OutputBase | |
static const unsigned int | padding_size = 4 |
Padding of new level of printout, used where we use indentation. More... | |
Class for create JSON machine readable documentation.
Every type is represented by one JSON object, for Selection e.g.: "name" : (string), "full_name" : (string), "type" : "Selection", "values" : [ { "value" : (int), "name": (string), "description" : (string) } ]
Definition at line 252 of file type_output.hh.
Input::Type::OutputJSONMachine::OutputJSONMachine | ( | RevNumData | rev_num_data | ) |
Simple constructor.
Definition at line 459 of file type_output.cc.
Input::Type::OutputJSONMachine::OutputJSONMachine | ( | const Record & | root_type, |
RevNumData | rev_num_data | ||
) |
Constructor allowing to set root_type_.
Definition at line 472 of file type_output.cc.
|
protected |
Replace slashes, quotes and special chars with escaped format of these chars.
Definition at line 480 of file type_output.cc.
|
overridevirtual |
Performs output of the documentation into given stream
.
The same effect has the reloaded operator '<<'. Returns reference to the same stream.
Implements Input::Type::OutputBase.
Definition at line 503 of file type_output.cc.
|
protected |
Print all keys of Abstract type or AdHocAbstract type.
Definition at line 710 of file type_output.cc.
|
protected |
Print full_hash_
key.
Definition at line 863 of file type_output.cc.
|
protectedvirtual |
Implements printout of Record type
.
Implements Input::Type::OutputBase.
Definition at line 572 of file type_output.cc.
|
protectedvirtual |
Implements printout of Array type
.
Implements Input::Type::OutputBase.
Definition at line 643 of file type_output.cc.
|
protectedvirtual |
Implements printout of Abstract type
.
Implements Input::Type::OutputBase.
Definition at line 666 of file type_output.cc.
|
protectedvirtual |
Implements printout of AdHocAbstract type
.
Implements Input::Type::OutputBase.
Definition at line 688 of file type_output.cc.
|
protectedvirtual |
Implements printout of Selection type
.
Implements Input::Type::OutputBase.
Definition at line 733 of file type_output.cc.
|
protectedvirtual |
Implements printout of Integer type
.
Implements Input::Type::OutputBase.
Definition at line 762 of file type_output.cc.
|
protectedvirtual |
Implements printout of Double type
.
Implements Input::Type::OutputBase.
Definition at line 778 of file type_output.cc.
|
protectedvirtual |
Implements printout of Bool type
.
Implements Input::Type::OutputBase.
Definition at line 794 of file type_output.cc.
|
protectedvirtual |
Implements printout of String type
.
Implements Input::Type::OutputBase.
Definition at line 805 of file type_output.cc.
|
protectedvirtual |
Implements printout of FileName type
.
Implements Input::Type::OutputBase.
Definition at line 816 of file type_output.cc.
|
protectedvirtual |
Implements printout of FileName type
.
Implements Input::Type::OutputBase.
Definition at line 839 of file type_output.cc.
|
protected |
Print actual version of program.
Definition at line 851 of file type_output.cc.
|
protected |
Print header of a JSON object describing single TypeBase instance.
type | - type to print |
input_type | - name of TypeBase descendant. |
Definition at line 550 of file type_output.cc.
|
protected |
Tail of the format, printed after all recursive prints are finished and before full hash prints.
see print(stream)
method
Definition at line 314 of file type_output.hh.
|
protected |
Header of the format, printed before call of version print.
See print(stream)
method
Definition at line 302 of file type_output.hh.
|
protected |
Inner part of the format, printed before first call of recursive print.
see print(stream)
method
Definition at line 308 of file type_output.hh.
|
protected |
Tail of the format, printed after all recursive prints are finished.
see print(stream)
method
Definition at line 320 of file type_output.hh.
|
protected |
Contains version of program and other base data.
Definition at line 322 of file type_output.hh.
|
protected |
Root type for output.
Have to be printed as first, then we pass through the individual type lists to output everything.
Definition at line 329 of file type_output.hh.