#include <EntityManager.h>
|
| EntityManager () |
| Default constructor of the EntityManager.
|
|
| EntityManager (const std::string &directory) |
| Constructor of the EntityManager, take the root directory with the entities as a parameter.
|
|
int | getEntity (const std::string &name) |
| Return the ID of an Entity based on its name.
|
|
std::vector< int > | getEntities (const std::string &prefixOrTag, bool isPrefix=true) |
| Return every entities with a name which start by the given prefix or all the entities of a tag.
|
|
std::vector< std::string > | getNames () |
| Return a vector with the names of all the entities.
|
|
const std::string & | getName (int entity) |
| Return the name of an entity based on its ID.
|
|
int | createEntity (const std::string &name, bool createFile=false) |
| Create a new entity and return its ID.
|
|
void | removeEntity (const std::string &name) |
| Remove an entity from the EntityManager.
|
|
void | toString (std::ostream &stream) |
| Append a serialized version of the EntityManager to the given stream.
|
|
bool | hasTag (int entity, const std::string &tag) |
| Return true if the entity have the given tag, false otherwise.
|
|
void | addTag (int entity, const std::string &tag) |
| Add a tag to an entity.
|
|
◆ EntityManager() [1/2]
EntityManager::EntityManager |
( |
| ) |
|
◆ EntityManager() [2/2]
EntityManager::EntityManager |
( |
const std::string & | directory | ) |
|
Constructor of the EntityManager, take the root directory with the entities as a parameter.
- Parameters
-
directory | The root directory with all the entities, files in subfolders are include. |
◆ addTag()
void EntityManager::addTag |
( |
int | entity, |
|
|
const std::string & | tag ) |
Add a tag to an entity.
- Parameters
-
entity | The ID of the entity. |
tag | The tag to add. |
◆ createEntity()
int EntityManager::createEntity |
( |
const std::string & | name, |
|
|
bool | createFile = false ) |
Create a new entity and return its ID.
If createFile is true, the entity's file will be create in the root directory.
- Parameters
-
name | Entity's name. |
createFile | If true, an entity's file is created in the root directory. |
◆ getEntities()
std::vector< int > EntityManager::getEntities |
( |
const std::string & | prefixOrTag, |
|
|
bool | isPrefix = true ) |
Return every entities with a name which start by the given prefix or all the entities of a tag.
You can generate multiple entities in the JSON file and manage them from their common prefix.
If isPrefix is false, prefixOrTag is considered a tag and all entities with the given tag will be returned.
- Parameters
-
prefixOrTag | Prefix or tag for the research. |
isPrefix | Tells if the precedent parameter should be considered as a prefix or a tag. |
◆ getEntity()
int EntityManager::getEntity |
( |
const std::string & | name | ) |
|
Return the ID of an Entity based on its name.
- Parameters
-
◆ getName()
const std::string & EntityManager::getName |
( |
int | entity | ) |
|
Return the name of an entity based on its ID.
- Parameters
-
entity | The ID of the entity. |
◆ getNames()
std::vector< std::string > EntityManager::getNames |
( |
| ) |
|
Return a vector with the names of all the entities.
◆ hasTag()
bool EntityManager::hasTag |
( |
int | entity, |
|
|
const std::string & | tag ) |
Return true if the entity have the given tag, false otherwise.
- Parameters
-
entity | The ID of the entity. |
tag | The tag to search for. |
◆ removeEntity()
void EntityManager::removeEntity |
( |
const std::string & | name | ) |
|
Remove an entity from the EntityManager.
- Warning
- The removed entity's ID will be reused.
- Parameters
-
◆ toString()
void EntityManager::toString |
( |
std::ostream & | stream | ) |
|
Append a serialized version of the EntityManager to the given stream.
Consist of the name of the entities and their ID.
- Parameters
-
stream | The stream on which the serialized version of the EntityManager is append to. |
The documentation for this class was generated from the following file:
- C:/Users/thoma/OneDrive/Programmation/C++/TailorMade/TailorMade/headers/EntityManager.h