#include <Serializer.h>
|
std::string | getSeparator () |
| Return the separator of the Serializer.
|
|
void | setSeparator (const std::string &separator) |
| Set the separator of the Serializer.
|
|
void | add (const std::string &ID, const std::string &value) |
| Add to the string (given by its ID) the sanitized version of the value, at the end.
|
|
void | add (const std::string &ID, const std::string &value, size_t idx) |
| Add to the string (given by its ID) the sanitized version of the value at the given index, or at the end.
|
|
void | edit (const std::string &ID, const std::string &value, size_t idx) |
| Edit the string (given by its ID) with the serialized version of the value at the given index.
|
|
std::string | get (const std::string &ID) |
| Return the serialized string of the given ID.
|
|
std::vector< std::string > | split (const std::string &str) |
| Return a vector containing the strings obtained after a split with the separator.
|
|
void | clear (const std::string &ID) |
| Clear the string given by the ID.
|
|
|
static Serializer & | getInstance () |
| Return the current instance of the object or create one if it does not exist.
|
|
|
std::string | separator |
| This string virtually divide the serialized strings.
|
|
std::unordered_map< std::string, std::vector< std::string > > | serializedStrings |
| Unordered map linking the ID of the serialized string and the serialized string.
|
|
◆ add() [1/2]
void Serializer::add |
( |
const std::string & | ID, |
|
|
const std::string & | value ) |
Add to the string (given by its ID) the sanitized version of the value, at the end.
- Parameters
-
ID | Serialized string's ID. |
value | Value to append to the serialized string. |
◆ add() [2/2]
void Serializer::add |
( |
const std::string & | ID, |
|
|
const std::string & | value, |
|
|
size_t | idx ) |
Add to the string (given by its ID) the sanitized version of the value at the given index, or at the end.
Same behaviour as add without index if the given slot is higher than the number of slots in the string.
This method have an higher time complexity than the other one in case of insertion inside the string.
- Parameters
-
ID | Serialized string's ID. |
value | Value to insert in the serialized string. |
idx | Index at which the value should be insert. |
◆ clear()
void Serializer::clear |
( |
const std::string & | ID | ) |
|
Clear the string given by the ID.
- Parameters
-
ID | Serialized string's ID to clear. |
◆ edit()
void Serializer::edit |
( |
const std::string & | ID, |
|
|
const std::string & | value, |
|
|
size_t | idx ) |
Edit the string (given by its ID) with the serialized version of the value at the given index.
If there is no value at this index, insert the value at the end.
- Parameters
-
ID | Serialized string's ID. |
value | Value to insert in the serialized string. |
idx | Index at which the value should be edit. |
◆ get()
std::string Serializer::get |
( |
const std::string & | ID | ) |
|
Return the serialized string of the given ID.
- Warning
- Build the string with the separator at each run.
- Parameters
-
ID | Desired serialized string's ID. |
◆ getInstance()
Return the current instance of the object or create one if it does not exist.
This class is a Singleton.
◆ getSeparator()
std::string Serializer::getSeparator |
( |
| ) |
|
◆ setSeparator()
void Serializer::setSeparator |
( |
const std::string & | separator | ) |
|
Set the separator of the Serializer.
Automatically called by the Server/Client upon creation.
- Parameters
-
separator | The separator that should be used by the Serializer. |
◆ split()
std::vector< std::string > Serializer::split |
( |
const std::string & | str | ) |
|
Return a vector containing the strings obtained after a split with the separator.
- Parameters
-
str | The string to split using the separator. |
◆ separator
std::string Serializer::separator |
|
protected |
This string virtually divide the serialized strings.
E.g.: STR1 = "ABC" STR2 = "CBA" sep = "/" ==> "ABC/CBA" (when STR1 is concatened with STR2)
◆ serializedStrings
std::unordered_map<std::string, std::vector<std::string> > Serializer::serializedStrings |
|
protected |
Unordered map linking the ID of the serialized string and the serialized string.
The documentation for this class was generated from the following file: