|
MVault 1.0.0
Simple c++ database
|
Template prototype of a container for storing different types of data. More...
#include <DataContainer.h>
Public Types | |
| typedef C::iterator | iterator |
| Redefine iterator from C container. | |
| typedef C::const_iterator | const_iterator |
| Redefine const_iterator from C container. | |
Public Member Functions | |
| iterator | begin () noexcept |
| Begin provides access to the Data iterator. | |
| const_iterator | cbegin () const noexcept |
| Cbegin provides access to the Data const_iterator. | |
| iterator | end () noexcept |
| End provides access to the Data iterator. | |
| const_iterator | cend () const noexcept |
| Cend provides access to the Data const_iterator. | |
| template<class T > | |
| void | AddData (const std::string &key, const T &data) noexcept |
| Template method for adding a new data to the container. | |
| template<class T , class F > | |
| 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. | |
| void | AddDataFromDataSaver (const std::string &key, const DataSaver &dataSaver) noexcept |
| Method for adding a new data to the container. | |
| template<class T > | |
| void | SetData (const std::string &key, const T &data) noexcept |
| Method for changing the value of a data inside a container using a key. | |
| template<class T , class F > | |
| 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. | |
| void | SetDataFromDataSaver (const std::string &key, const DataSaver &dataSaver) noexcept |
| Method for changing the value of a data inside a container using a key. | |
| bool | SetDataFromString (const std::string &key, const std::string &str) noexcept |
| Method for setting data by key. | |
| template<class T > | |
| bool | GetData (const std::string &key, T &data) const noexcept |
| Method for getting data from a container using a key. | |
| bool | GetDataSaver (const std::string &key, DataSaver &dataSaver) const noexcept |
| Method for getting dataSaver from a container using a key. | |
| bool | GetDataAsString (const std::string &key, std::string &str) const noexcept |
| Method for getting data converted to string from a container using a key. | |
| bool | IsData (const std::string &key) const noexcept |
| A method for checking whether data with such a key is in the container. | |
| void | EraseData (const std::string &key) noexcept |
| Function for erasing data from a container. | |
| void | Clear () noexcept |
| Method for clear all data inside container. | |
| std::size_t | Size () const noexcept |
| Method for getting the container size. | |
Protected Attributes | |
| C | Container |
| Container to store all data inside C container. | |
Template prototype of a container for storing different types of data.
| <C> | The container class for which this class will be the wrapper. Container have to support find(), begin(), end(), emplace(), erase(). Types that are used in inheritors: |
| <std::set> | A container built on an avl tree. |
| <std::map> | A container built on an avl tree. Stores a pair of key and value. |
| <std::unordered_set> | A container built on a hash table. |
| <std::unordered_map> | A container built on a hash table. Stores a pair of key and value. |
The container should work according to the std::map type, i.e. store a key and value pair in itself. Using class specialization, you can define an internal container. If a pointer is written to one of the elements, then you can set a custom data deletion function.
Template method for adding a new data to the container.
Wrapper over emplace std container
| <T> | Any type of data except for c arrays |
| [in] | key | key for storing the data |
| [in] | data | data to store in container |
|
inlinenoexcept |
Template method for adding a new data to the container and a function to delete this data.
Wrapper over emplace std container
| <T> | Any type of data except for c arrays |
| <F> | Function pointer or lambda function |
| [in] | key | key for storing the data |
| [in] | data | data to store in container |
| [in] | deleteFunc | function to delete data |
|
inlinenoexcept |
Method for adding a new data to the container.
| [in] | key | the key whose value needs to be changed |
| [in] | dataSaver | dataSaver with any type, the value from which will be copied to the container |
|
inlinenoexcept |
Method for clear all data inside container.
Note that if pointers were stored in the container, they must be cleaned manually
|
inlinenoexcept |
Function for erasing data from a container.
If a custom deletion function has been set for the data, it will be called
| [in] | key | key to find in container |
|
inlinenoexcept |
Method for getting data from a container using a key.
| <T> | Any type of data except for c arrays |
| [in] | key | key for getting data |
| [out] | data | a reference to data of type T to write data from the container there. If the data was not found, then nothing will be written to the data |
|
inlinenoexcept |
Method for getting data converted to string from a container using a key.
| [in] | key | key for getting data |
| [out] | str | a reference to string to write data from the container there. If the data was not found, then nothing will be written to the str |
|
inlinenoexcept |
Method for getting dataSaver from a container using a key.
| [in] | key | key for getting data |
| [out] | dataSaver | a reference to dataSaver to write data from the container there. If the data was not found, then nothing will be written to the dataSaver |
|
inlinenoexcept |
A method for checking whether data with such a key is in the container.
| [in] | key | key to find in container |
Method for changing the value of a data inside a container using a key.
If there was no data with such a key, it will be created
| <T> | Any type of data except for c arrays |
| [in] | key | the key whose value needs to be changed |
| [in] | data | new key value |
|
inlinenoexcept |
Method for changing the value of a data inside a container using a key.
If there was no data with such a key, it will be created
| <T> | Any type of data except for c arrays |
| <F> | Function pointer or lambda function |
| [in] | key | the key whose value needs to be changed |
| [in] | data | new key value |
| [in] | deleteFunc | function to delete data |
|
inlinenoexcept |
Method for changing the value of a data inside a container using a key.
If there was no data with such a key, it will be created
| [in] | key | the key whose value needs to be changed |
| [in] | dataSaver | dataSaver with any type, the value from which will be copied to the container |
|
inlinenoexcept |
Method for setting data by key.
| [in] | key | the key to set the data on |
| [in] | str | the string that will be converted to data |
|
inlinenoexcept |
Method for getting the container size.