22 #define LOG_PERSIST LOG_STREAM(info, log_persist)
23 #define ERR_PERSist LOG_STREAM(err, log_persist)
49 std::size_t end = infix.find_first_not_of(
"^");
50 if (!((end >= infix.length()) || (infix[end] ==
'.'))) {
55 infix = infix.substr(0,end);
57 while (!infix.empty())
60 body = body.substr(0,body.find_last_of(
"."));
61 infix = infix.substr(1);
72 operator bool ()
const {
return valid_; }
149 virtual bool clear_var(
const std::string &,
bool immediate =
false) = 0;
151 virtual bool set_var(
const std::string &,
const config &,
bool immediate =
false) = 0;
172 bool clear_var(
const std::string &,
bool immediate =
false);
174 bool set_var(
const std::string &,
const config &,
bool immediate =
false);
A config object defines a single node in a WML file, with access to child nodes.
config & mandatory_child(config_key_type key, int n=0)
Returns the nth child with the given key, or throws an error if there is none.
bool has_child(config_key_type key) const
Determine whether a config has a child or not.
config & child_or_add(config_key_type key)
Returns a reference to the first child with the given key.
virtual config get_var(const std::string &) const =0
const config * get_node(const config &cfg, const name_space &ns) const
persist_context(const std::string &name_space)
virtual bool end_transaction()=0
std::string get_node() const
config * get_node(config &cfg, name_space &ns, bool force=false)
virtual bool set_var(const std::string &, const config &, bool immediate=false)=0
virtual ~persist_context()
virtual bool start_transaction()=0
void set_node(const std::string &)
virtual bool cancel_transaction()=0
virtual bool clear_var(const std::string &, bool immediate=false)=0
config get_var(const std::string &) const
bool set_var(const std::string &, const config &, bool immediate=false)
persist_file_context(const std::string &name_space)
bool clear_var(const std::string &, bool immediate=false)
bool cancel_transaction()
Definitions for the interface to Wesnoth Markup Language (WML).
Standard logging facilities (interface).
static lg::log_domain log_persist("engine/persistence")
config pack_scalar(const std::string &, const t_string &)
name_space(const std::string &ns, bool doParse=false)