41 if (!(file_stream->fail())) {
69 if (active ==
nullptr)
72 bool ret = active->
has_child(
"variables");
79 std::string::const_iterator index_start =
std::find(global.begin(),global.end(),
'[');
80 if (index_start != global.end())
82 const std::string::const_iterator index_end =
std::find(global.begin(),global.end(),
']');
83 const std::string index_str(index_start+1,index_end);
84 size_t index =
static_cast<size_t>(lexical_cast_default<int>(index_str));
114 else if (immediate) {
118 if (active !=
nullptr) {
121 if (!bactive.
empty())
131 if (active !=
nullptr) {
134 if (!bactive.
empty())
149 if (active ==
nullptr) {
166 if (active && (active->
has_child(
"variables"))) {
170 for (
size_t i = 0;
i < arrsize;
i++)
181 bool success =
false;
184 if (!cfg_name.empty()) {
217 if (val[global].empty()) {
220 cfg[global] = val[global];
221 if (immediate) bactive[global] = val[global];
234 else if (immediate) {
249 newspace +=
"." + name;
void remove_attribute(const std::string &key)
void write(const config &cfg)
void append(const config &cfg)
Append data from another config object to this one.
bool delete_file(const std::string &filename)
config & child_or_add(const std::string &key)
Returns a reference to the first child with the given key.
GLuint const GLfloat * val
config pack_scalar(const std::string &name, const t_string &val)
void clear_children(const std::string &key)
bool exists(const image::locator &i_locator)
returns true if the given image actually exists, without loading it.
bool has_child(const std::string &key) const
Determine whether a config has a child or not.
Class for writing a config out to a file in pieces.
std::string get_user_data_dir()
bool set_var(const std::string &, const config &, bool immediate=false)
std::istream * istream_file(const std::string &fname, bool treat_failure_as_error=true)
void remove_child(const std::string &key, unsigned index)
std::ostream * ostream_file(std::string const &fname, bool create_directory=true)
bool is_directory(const std::string &fname)
Returns true if the given file is a directory.
config & add_child(const std::string &key)
static std::string get_persist_cfg_name(const std::string &name_space)
Templates and utility-routines for strings and numbers.
std::string get_dir(const std::string &dir)
std::string get_node() const
persist_file_context(const std::string &name_space)
Declarations for File-IO.
void read(config &cfg, std::istream &in, abstract_validator *validator)
static int writer(lua_State *L, const void *b, size_t size, void *B)
unsigned child_count(const std::string &key) const
GLuint const GLchar * name
void set_node(const std::string &)
bool has_attribute(const std::string &key) const
bool find(E event, F functor)
Tests whether an event handler is available.
config & child(const std::string &key, int n=0)
Returns the nth child with the given key, or a reference to an invalid config if there is none...
Standard logging facilities (interface).
A config object defines a single node in a WML file, with access to child nodes.
config get_var(const std::string &) const
bool file_exists(const std::string &name)
Returns true if a file or directory with such name already exists.
GLsizei const GLcharARB ** string
bool clear_var(const std::string &, bool immediate=false)