Bayeux
3.4.1
Core Foundation library for SuperNEMO
|
Class for ASCII file I/O operations with properties objects. More...
#include <bayeux/datatools/properties.h>
Public Types | |
enum | decoration_mode_type { MODE_BARE = 0, MODE_HEADER_FOOTER = 1, MODE_DEFAULT = MODE_BARE, mode_bare = MODE_BARE, mode_header_footer = MODE_HEADER_FOOTER } |
Decoration mode. More... | |
enum | options_flag { SKIP_PRIVATE = bit_mask::bit00, FORBID_VARIANTS = bit_mask::bit01, LOG_MUTE = bit_mask::bit02, LOG_DEBUG = bit_mask::bit03, LOG_TRACE = bit_mask::bit04, SMART_MODULO = bit_mask::bit05, HEADER_FOOTER = bit_mask::bit06, REQUESTED_TOPIC = bit_mask::bit07, FORBID_INCLUDES = bit_mask::bit08, DONT_CLEAR = bit_mask::bit09, RESOLVE_PATH = bit_mask::bit10, ALLOW_KEY_OVERRIDE = bit_mask::bit11, LOG_WARNING = bit_mask::bit12 } |
Option flags used at construction. More... | |
Public Member Functions | |
config (uint32_t options_=0, const std::string &topic_="", const std::string §ion_name_="", int section_start_line_number_=-1) | |
Constructor. More... | |
virtual | ~config () |
Destructor. More... | |
datatools::logger::priority | get_logging () const |
Return the logging priority threshold. More... | |
void | set_logging (datatools::logger::priority) |
Set the logging priority threshold. More... | |
void | read (std::istream &in_, properties &prop_) |
void | read (const std::string &in_, properties &prop_) |
Read a properties container from an input file. More... | |
void | write (std::ostream &out_, const properties &prop_) |
Write a properties container to an output stream. More... | |
void | write (const std::string &filename_, const properties &prop_) |
Write a properties container to an output file. More... | |
int | get_current_line_number () const |
Return the current value of the line counter. More... | |
void | set_reader_input (const std::string &filename_, int line_count_=-1) |
Set the filename and the line counter before parsing. More... | |
bool | has_topic () const |
Check if topic is set. More... | |
void | set_topic (const std::string &topic_) |
Set the topic that should be matched. More... | |
const std::string & | get_topic () const |
Return the topic. More... | |
bool | has_section_info () const |
Check if section info is set. More... | |
void | set_section_info (const std::string §ion_name_, int section_start_line_number_) |
Set the section info. More... | |
void | reset_section_info () |
Reset the section info. More... | |
const std::string & | get_section_name () const |
Return the section. More... | |
int | get_section_start_line_number () const |
Return the section start line. More... | |
void | reset () |
Reset. More... | |
void | write_metacomment (std::ostream &out_, const std::string &tag_, const std::string &value_="", const std::string &comment_="") |
Write metacomment. More... | |
void | write_data (std::ostream &out_, const std::string &data_key_, const properties::data &prop_data_, const std::string &unit_symbol_="", const std::string &unit_label_="", const std::string &comment_="") |
Write a property data. More... | |
Static Public Member Functions | |
static const std::string & | lock_decorator () |
static const std::string & | as_directive () |
static const std::string & | in_directive () |
static const std::string & | path_decorator () |
static const std::string & | metacomment_prefix () |
Class for ASCII file I/O operations with properties objects.
Decoration mode.
Enumerator | |
---|---|
MODE_BARE | No decoration. |
MODE_HEADER_FOOTER | Header/footer decoration. |
MODE_DEFAULT | Default decoration mode. |
mode_bare | |
mode_header_footer |
Option flags used at construction.
datatools::properties::config::config | ( | uint32_t | options_ = 0 , |
const std::string & | topic_ = "" , |
||
const std::string & | section_name_ = "" , |
||
int | section_start_line_number_ = -1 |
||
) |
Constructor.
|
virtual |
Destructor.
|
static |
int datatools::properties::config::get_current_line_number | ( | ) | const |
Return the current value of the line counter.
datatools::logger::priority datatools::properties::config::get_logging | ( | ) | const |
Return the logging priority threshold.
const std::string& datatools::properties::config::get_section_name | ( | ) | const |
Return the section.
int datatools::properties::config::get_section_start_line_number | ( | ) | const |
Return the section start line.
const std::string& datatools::properties::config::get_topic | ( | ) | const |
Return the topic.
bool datatools::properties::config::has_section_info | ( | ) | const |
Check if section info is set.
bool datatools::properties::config::has_topic | ( | ) | const |
Check if topic is set.
|
static |
|
static |
|
static |
|
static |
void datatools::properties::config::read | ( | std::istream & | in_, |
properties & | prop_ | ||
) |
Read a properties container from an input stream
This method is the base of configuration file parsing.
Example of usage which loads a configuration file to store the configuration parameters of an algorithm in a properties object:
Example of input file to be parsed:
void datatools::properties::config::read | ( | const std::string & | in_, |
properties & | prop_ | ||
) |
Read a properties container from an input file.
void datatools::properties::config::reset | ( | ) |
Reset.
void datatools::properties::config::reset_section_info | ( | ) |
Reset the section info.
void datatools::properties::config::set_logging | ( | datatools::logger::priority | ) |
Set the logging priority threshold.
void datatools::properties::config::set_reader_input | ( | const std::string & | filename_, |
int | line_count_ = -1 |
||
) |
Set the filename and the line counter before parsing.
void datatools::properties::config::set_section_info | ( | const std::string & | section_name_, |
int | section_start_line_number_ | ||
) |
Set the section info.
void datatools::properties::config::set_topic | ( | const std::string & | topic_ | ) |
Set the topic that should be matched.
void datatools::properties::config::write | ( | std::ostream & | out_, |
const properties & | prop_ | ||
) |
Write a properties container to an output stream.
void datatools::properties::config::write | ( | const std::string & | filename_, |
const properties & | prop_ | ||
) |
Write a properties container to an output file.
void datatools::properties::config::write_data | ( | std::ostream & | out_, |
const std::string & | data_key_, | ||
const properties::data & | prop_data_, | ||
const std::string & | unit_symbol_ = "" , |
||
const std::string & | unit_label_ = "" , |
||
const std::string & | comment_ = "" |
||
) |
Write a property data.
void datatools::properties::config::write_metacomment | ( | std::ostream & | out_, |
const std::string & | tag_, | ||
const std::string & | value_ = "" , |
||
const std::string & | comment_ = "" |
||
) |
Write metacomment.