Project TailorMade.
More...
#include <variant>
#include <json.hpp>
#include <vector>
#include <unordered_map>
#include <mutex>
#include <fstream>
#include <iostream>
#include <string>
#include <filesystem>
#include <sstream>
#include <cctype>
Go to the source code of this file.
|
typedef struct Vector2 | Vector2 |
| Vector2 structure and operators.
|
|
typedef struct Vector3 | Vector3 |
| Vector3 structure and operators.
|
|
using | dataUnMap = std::unordered_map<std::string, std::pair<std::string, std::variant<ECS_Types>>> |
| Map of dataName -> {dataType, value}.
|
|
using | dataVector = std::vector<std::pair<std::string, std::variant<ECS_Types>>> |
| Vector of {dataType, value}.
|
|
|
std::ostream & | operator<< (std::ostream &os, const Vector2 &v) |
| Print a Vector2.
|
|
std::ostream & | operator<< (std::ostream &os, const Vector3 &v) |
| Print a Vector3.
|
|
std::variant< ECS_Types > | strToType (std::string type) |
| Return a variant<ECS_Types> with the default value of the given type.
|
|
std::variant< ECS_Types > | valueToType (const nlohmann::json &value, std::string type) |
| Return a variant<ECS_Types> with the given value of the given type.
|
|
nlohmann::ordered_json | serializeType (const dataUnMap &data) |
| Serialize the data in an ordered_json.
|
|
void | valueToStream (std::ostream &stream, std::variant< ECS_Types > value) |
| Will append in the given stream, the serialized version of the given variant value.
|
|
std::vector< std::string > | getAllFilesFromDirectory (const std::string &directory) |
| Return every files from the given directory, includes all subfolders.
|
|
Project TailorMade.
- Author
- Thomas K/BIDI
- Version
- 2.0
◆ ECS_Types
Definitions of the types in TailorMade.
◆ dataUnMap
using dataUnMap = std::unordered_map<std::string, std::pair<std::string, std::variant<ECS_Types>>> |
Map of dataName -> {dataType, value}.
◆ dataVector
Vector of {dataType, value}.
◆ Vector2
typedef struct Vector2 Vector2 |
◆ Vector3
typedef struct Vector3 Vector3 |
◆ getAllFilesFromDirectory()
std::vector< std::string > getAllFilesFromDirectory |
( |
const std::string & | directory | ) |
|
|
inline |
Return every files from the given directory, includes all subfolders.
- Parameters
-
directory | The directory in which the research starts. |
◆ operator<<() [1/2]
std::ostream & operator<< |
( |
std::ostream & | os, |
|
|
const Vector2 & | v ) |
|
inline |
◆ operator<<() [2/2]
std::ostream & operator<< |
( |
std::ostream & | os, |
|
|
const Vector3 & | v ) |
|
inline |
◆ serializeType()
nlohmann::ordered_json serializeType |
( |
const dataUnMap & | data | ) |
|
|
inline |
Serialize the data in an ordered_json.
- See also
- dataUnMap
- Parameters
-
data | The unordered_map with the data from a component in it. |
◆ strToType()
std::variant< ECS_Types > strToType |
( |
std::string | type | ) |
|
|
inline |
Return a variant<ECS_Types> with the default value of the given type.
You can give a string of one of the supported types of TailorMade and it will return the associated variant with its default value.
- Warning
- If the type is unknown an error is thrown. You can checked the currently available types of this version on the project's github page.
- Parameters
-
type | The string version of the desired type. (e.g.: "Integer") |
◆ valueToStream()
void valueToStream |
( |
std::ostream & | stream, |
|
|
std::variant< ECS_Types > | value ) |
|
inline |
Will append in the given stream, the serialized version of the given variant value.
- Parameters
-
stream | The stream on which the value should be append. |
value | The variant you want to serialize and append to the stream. |
◆ valueToType()
std::variant< ECS_Types > valueToType |
( |
const nlohmann::json & | value, |
|
|
std::string | type ) |
|
inline |
Return a variant<ECS_Types> with the given value of the given type.
Works the same way as TM_Tools::strToType but with the given value.
- Warning
- If the type is unknown an error is thrown. You can checked the currently available types of this version on the project's github page.
- Parameters
-
value | A JSON object with the desired value in it. |
type | The string version of the desired type. (e.g.: "Integer") |