116                                              std::string 
const & filename
 
  123                                              std::string 
const & filename
 
  148    mutable std::string         
f_url = std::string();
 
 
  162                                operator std::string () 
const;
 
  164    void                        set_value(std::string 
const & value);
 
  170    std::string                 
get_comment(
bool ensure_newline = 
false) 
const;
 
 
  183    : 
public std::enable_shared_from_this<conf_file>
 
  189    typedef std::function<void(
 
  192                , std::string 
const & parameter_name
 
  200                                      std::string backup_extension = std::string(
".bak")
 
  201                                    , 
bool replace_backup = 
false 
  202                                    , 
bool prepend_warning = 
true 
  203                                    , std::string output_filename = std::string());
 
  208                                    , std::string 
const & parameter_name = std::string());
 
  215                                      std::string 
const & section_name
 
  226                                    , std::string 
const & value
 
  228                                    , std::string 
const & comment = std::string());
 
  242                  , std::string 
const & name)
 
 
 
  253    typedef std::vector<callback_entry_t>
 
  258    int                         getc(std::ifstream & stream);
 
  260    bool                        get_line(std::ifstream & stream, std::string & line);
 
  264                                    , std::string 
const & parameter_name
 
  265                                    , std::string 
const & value);
 
 
name_separator_t f_name_separator
std::shared_ptr< conf_file_setup > pointer_t
std::string const & get_section_to_ignore() const
Retrieve the name to be ignore.
comment_t get_comment() const
std::string f_section_to_ignore
line_continuation_t f_line_continuation
std::string const & get_original_filename() const
Get the original filename.
section_operator_t f_section_operator
std::string const & get_filename() const
Get the filename.
line_continuation_t get_line_continuation() const
Get the line continuation setting.
assignment_operator_t get_assignment_operator() const
Get the accepted assignment operators.
bool is_valid() const
Check whether the setup is considered valid.
std::string f_original_filename
name_separator_t get_name_separator() const
Retrieve the separator to use within names.
void set_section_to_ignore(std::string const §ion_name)
Set a section name to ignore.
std::string get_config_url() const
Transform the setup in a URL.
section_operator_t get_section_operator() const
Get the accepted section operators.
assignment_operator_t f_assignment_operator
callback_id_t f_next_callback_id
int section_to_variables(std::string const §ion_name, variables::pointer_t var)
Look for a section to convert in a list of variables.
conf_file_setup const & get_setup() const
Get the configuration file setup.
bool set_parameter(std::string section, std::string name, std::string const &value, assignment_t op=assignment_t::ASSIGNMENT_NONE, std::string const &comment=std::string())
Set a parameter.
callback_id_t add_callback(callback_t const &c, std::string const ¶meter_name=std::string())
Add a callback to detect when changes happen.
void erase_all_parameters()
Clear the list of all existing parameters from this file.
static void reset_conf_files()
Forget all the cached configuration files.
variables::pointer_t get_variables() const
Retrieve the currently attached variables.
bool exists() const
Whether an input file was found.
std::map< std::string, parameter_value > parameters_t
conf_file_setup const f_setup
variables::pointer_t f_variables
bool save_configuration(std::string backup_extension=std::string(".bak"), bool replace_backup=false, bool prepend_warning=true, std::string output_filename=std::string())
Save the configuration file.
callback_vector_t f_callbacks
parameters_t f_parameters
void read_configuration()
Read a configuration file.
void value_changed(callback_action_t action, std::string const ¶meter_name, std::string const &value)
Call whenever the value changed so we can handle callbacks.
std::string get_parameter(std::string name) const
Get the named parameter.
assignment_t is_assignment_operator(char const *&s, bool skip) const
Check whether c is an assignment operator.
bool was_modified() const
Check whether this configuration file was modified.
bool has_parameter(std::string name) const
Check whether a parameter is defined.
void ungetc(int c)
Restore one character.
std::shared_ptr< conf_file > pointer_t
std::vector< callback_entry_t > callback_vector_t
bool is_comment(char const *s) const
Check whether the string starts with a comment introducer.
parameters_t get_parameters() const
Get a list of parameters.
sections_t get_sections() const
Get a list of sections.
void set_variables(variables::pointer_t variables)
Attach a variables object to the configuration file.
bool erase_parameter(std::string name)
Erase the named parameter from this configuration file.
void remove_callback(callback_id_t id)
Remove a callback.
int get_errno() const
Get the error number opening/reading the configuration file.
std::function< void(pointer_t conf_file, callback_action_t action, std::string const ¶meter_name, std::string const &value)> callback_t
static pointer_t get_conf_file(conf_file_setup const &setup)
Create and read a conf_file.
bool get_line(std::ifstream &stream, std::string &line)
Get one line.
int getc(std::ifstream &stream)
Read one characte from the input stream.
std::string const & get_value() const
parameter_value & operator=(parameter_value const &rhs)
assignment_t get_assignment_operator() const
assignment_t f_assignment_operator
void set_assignment_operator(assignment_t a)
void set_value(std::string const &value)
void set_comment(std::string const &comment)
std::string get_comment(bool ensure_newline=false) const
std::shared_ptr< variables > pointer_t
The advgetopt environment to parse command line options.
constexpr comment_t COMMENT_SAVE
constexpr section_operator_t SECTION_OPERATOR_INI_FILE
constexpr comment_t COMMENT_CPP
constexpr comment_t COMMENT_MASK
std::uint_fast16_t assignment_operator_t
std::uint_fast16_t section_operator_t
constexpr section_operator_t SECTION_OPERATOR_CPP
constexpr comment_t COMMENT_NONE
constexpr section_operator_t SECTION_OPERATOR_ONE_SECTION
constexpr comment_t COMMENT_SHELL
@ line_continuation_fortran
@ line_continuation_semicolon
@ line_continuation_rfc_822
@ line_continuation_single_line
@ line_continuation_msdos
constexpr assignment_operator_t ASSIGNMENT_OPERATOR_EQUAL
constexpr section_operator_t SECTION_OPERATOR_C
constexpr name_separator_t NAME_SEPARATOR_DASHES
constexpr section_operator_t SECTION_OPERATOR_BLOCK
constexpr assignment_operator_t ASSIGNMENT_OPERATOR_SPACE
constexpr name_separator_t NAME_SEPARATOR_UNDERSCORES
std::uint_fast16_t comment_t
std::set< std::string > string_set_t
constexpr comment_t COMMENT_INI
constexpr assignment_operator_t ASSIGNMENT_OPERATOR_EXTENDED
bool iswspace(int c)
Returns true if c is considered to be a whitespace.
constexpr section_operator_t SECTION_OPERATOR_MASK
constexpr assignment_operator_t ASSIGNMENT_OPERATOR_MASK
std::uint_fast16_t name_separator_t
constexpr section_operator_t SECTION_OPERATOR_NONE
constexpr assignment_operator_t ASSIGNMENT_OPERATOR_COLON
callback_entry_t(callback_id_t id, callback_t const &c, std::string const &name)
std::string f_parameter_name
Declaration of the variable class.