5#include <unordered_map>
6#include <unordered_set>
62 void AddData(
const std::string& key,
const T& data)
noexcept
79 template <
class T,
class F>
80 void AddData(
const std::string& key,
const T& data, F&& deleteFunc)
noexcept
106 void SetData(
const std::string& key,
const T& data)
noexcept
123 template <
class T,
class F>
124 void SetData(
const std::string& key,
const T& data, F&& deleteFunc)
noexcept
131 AddData(key, data, deleteFunc);
133 findResIt->second.SetData(data, deleteFunc);
153 findResIt->second = dataSaver;
171 return findResIt->second.SetDataFromString(str);
188 bool GetData(
const std::string& key, T& data)
const noexcept
194 findResIt->second.GetData(data);
213 dataSaver = findResIt->second;
232 str = findResIt->second.Str();
243 bool IsData(
const std::string& key)
const noexcept
260 findResIt->second.ResetData();
280 std::size_t
Size() const noexcept
302 std::pair<DataContainer::const_iterator, DataContainer::const_iterator>
GetAllData(
const std::string& key)
const noexcept
324 std::pair<DataContainer::const_iterator, DataContainer::const_iterator>
GetAllData(
const std::string& key)
const noexcept
Template prototype of a container for storing different types of data.
Definition DataContainer.h:29
C Container
Container to store all data inside C container.
Definition DataContainer.h:32
bool GetDataAsString(const std::string &key, std::string &str) const noexcept
Method for getting data converted to string from a container using a key.
Definition DataContainer.h:226
void AddData(const std::string &key, const T &data) noexcept
Template method for adding a new data to the container.
Definition DataContainer.h:62
void EraseData(const std::string &key) noexcept
Function for erasing data from a container.
Definition DataContainer.h:255
void AddData(const std::string &key, const T &data, F &&deleteFunc) noexcept
Template method for adding a new data to the container and a function to delete this data.
Definition DataContainer.h:80
std::size_t Size() const noexcept
Method for getting the container size.
Definition DataContainer.h:280
bool GetDataSaver(const std::string &key, DataSaver &dataSaver) const noexcept
Method for getting dataSaver from a container using a key.
Definition DataContainer.h:207
bool GetData(const std::string &key, T &data) const noexcept
Method for getting data from a container using a key.
Definition DataContainer.h:188
bool IsData(const std::string &key) const noexcept
A method for checking whether data with such a key is in the container.
Definition DataContainer.h:243
C::const_iterator const_iterator
Redefine const_iterator from C container.
Definition DataContainer.h:39
iterator begin() noexcept
Begin provides access to the Data iterator.
Definition DataContainer.h:42
const_iterator cbegin() const noexcept
Cbegin provides access to the Data const_iterator.
Definition DataContainer.h:44
iterator end() noexcept
End provides access to the Data iterator.
Definition DataContainer.h:47
void SetDataFromDataSaver(const std::string &key, const DataSaver &dataSaver) noexcept
Method for changing the value of a data inside a container using a key.
Definition DataContainer.h:144
void AddDataFromDataSaver(const std::string &key, const DataSaver &dataSaver) noexcept
Method for adding a new data to the container.
Definition DataContainer.h:91
C::iterator iterator
Redefine iterator from C container.
Definition DataContainer.h:36
void SetData(const std::string &key, const T &data, F &&deleteFunc) noexcept
Method for changing the value of a data inside a container using a key.
Definition DataContainer.h:124
void Clear() noexcept
Method for clear all data inside container.
Definition DataContainer.h:270
const_iterator cend() const noexcept
Cend provides access to the Data const_iterator.
Definition DataContainer.h:49
void SetData(const std::string &key, const T &data) noexcept
Method for changing the value of a data inside a container using a key.
Definition DataContainer.h:106
bool SetDataFromString(const std::string &key, const std::string &str) noexcept
Method for setting data by key.
Definition DataContainer.h:164
Specialization of class DataContainer, used as a type std::unordered_map<std::string,...
Definition DataContainer.h:287
Specialization of class DataContainer, used as a type std::map<std::string, DataSaver>
Definition DataContainer.h:309
Specialization of class DataContainer, used as a type std::unordered_multimap<std::string,...
Definition DataContainer.h:291
std::pair< DataContainer::const_iterator, DataContainer::const_iterator > GetAllData(const std::string &key) const noexcept
A function for searching for multiple elements with the same keys.
Definition DataContainer.h:302
Specialization of class DataContainer, used as a type std::multimap<std::string, DataSaver>
Definition DataContainer.h:313
std::pair< DataContainer::const_iterator, DataContainer::const_iterator > GetAllData(const std::string &key) const noexcept
A function for searching for multiple elements with the same keys.
Definition DataContainer.h:324
A class for storing any type of data.
Definition DataSaver.h:21