39 filelock(std::make_unique<std::mutex>()),
65 if (user_data->Find(key) != user_data->end())
83 return (*user_data)[key];
101 if (it->second == value)
119 return (*user_data)[key];
136 user_data->Remove(key);
148 user_data.reset(
new Map());
149 user_data->Set(key, value);
173 filelock(std::make_unique<std::mutex>()),
190 std::lock_guard<std::mutex> lock(*
filelock);
195 fn = completeFilename(fname);
210 std::lock_guard<std::mutex> lock(*
filelock);
215 fn = completeFilename(fname);
241 Path Savable::completeFilename(
const Path &fn)
const
258 void Savable::load(
const Path &fname)
271 void Savable::save(
const Path &fname)
296 user_data.reset(
new Map());
303 user_data->Deserialize(udel);
306 udel = udel.GetNextSiblingElement(
"Map");
complex base abstract class
bool IsUserData(const String &key) const
Tests if a user data key exists.
const char * CStr() const
Conversion to UTF8 cstring.
Unintialized object error.
std::unique_ptr< std::mutex > filelock
const StringUTF8 USERDATA_NAME("userdata")
void serialize_internal_data(xml::Element &el) const
Dumps some internal data to an XML element.
void Load(const Path &fname)
Loads the object from an XML file (Safe)
virtual ~Savable()
Destructor.
A UTF32 character string class.
bool IsAbsolute() const
Is the path absolute?
A protocol is not implemented.
void SetUserData(const String &key, SObject value)
Adds or replaces a user data.
Element GetFirstChildElement(const StringUTF8 &name="")
Gets the first child element.
bool IsEmpty() const noexcept
Checks if the string is empty.
A convenience class for file paths.
String GetUserDataKey(const SObject &value) const
Gets a user data key by value.
void ClearUserData()
Deletes all user data entries.
void SetAttribute(const StringUTF8 &name, const StringUTF8 &value)
Sets the value of an attribute.
std::map< String, SObject >::const_iterator const_iterator
const_iterator on the contents of the container
void Save()
Saves the object to an already set XML file.
SObject GetUserData(const String &key)
Gets a user data by key.
T GetAttribute(const StringUTF8 &name, bool silent=true) const
Gets an attribute.
void DeleteUserData(const String &key)
Deletes a user data entry and frees the value.
A character string class.
void deserialize_internal_data(xml::Element &el)
Initializes some internal data from an XML element.
Savable(const String &s=U"")
Default constructor.
An item was not found in a container.