Brunot
Loading...
Searching...
No Matches
th::Factory Class Reference

#include <Factory.h>

Public Member Functions

template<>
auto make (const std::string &name) -> std::unique_ptr< GameObject >
 full specialization of Factory::make() where you request a gameobject, so you don't need to know what type it actually is
 Factory ()=delete
 ~Factory ()=delete
 Factory (const Factory &other)=delete
 Factory (Factory &&other) noexcept=delete
auto operator= (const Factory &other) -> Factory &=delete
auto operator= (Factory &&other) noexcept -> Factory &=delete

Static Public Member Functions

template<typename T>
static auto make (const std::string &name) -> std::unique_ptr< T >
 create an object and heap allocate it.

Static Private Member Functions

static auto create (const std::string &name) -> std::unique_ptr< AnySerializable >
 create an object and heap allocate it.
static auto makePath (const std::string &name) -> std::string
 prepends "Data/" and appends ".json" to a string maybe in the future we will allow this to handle subfolders for datatypes

Private Attributes

friend Library

Constructor & Destructor Documentation

◆ Factory() [1/3]

th::Factory::Factory ( )
delete
Here is the caller graph for this function:

◆ ~Factory()

th::Factory::~Factory ( )
delete

◆ Factory() [2/3]

th::Factory::Factory ( const Factory & other)
delete
Here is the call graph for this function:

◆ Factory() [3/3]

th::Factory::Factory ( Factory && other)
deletenoexcept
Here is the call graph for this function:

Member Function Documentation

◆ create()

auto th::Factory::create ( const std::string & name) ->std::unique_ptr< AnySerializable >
staticprivate

create an object and heap allocate it.

Does not check if it exists in library

Parameters
namethe name of the object to create
Returns
a unique pointer to the object to create
Here is the call graph for this function:
Here is the caller graph for this function:

◆ make() [1/2]

template<>
auto th::Factory::make ( const std::string & name) ->std::unique_ptr< GameObject >
inline

full specialization of Factory::make() where you request a gameobject, so you don't need to know what type it actually is

Parameters
name
Returns
Here is the call graph for this function:

◆ make() [2/2]

template<typename T>
auto th::Factory::make ( const std::string & name) ->std::unique_ptr< T >
inlinestatic

create an object and heap allocate it.

checks if it exists in library, and if it does, copies that instead of constructing a new object

Template Parameters
Tthe type to turn the object into, just a normal anycast
Parameters
namethe name of the object to create
Returns
a unique pointer to the object to create
Here is the call graph for this function:
Here is the caller graph for this function:

◆ makePath()

auto th::Factory::makePath ( const std::string & name) ->std::string
staticprivate

prepends "Data/" and appends ".json" to a string maybe in the future we will allow this to handle subfolders for datatypes

Parameters
namethe name of the object to load
Returns
the path to the json of the object
Here is the caller graph for this function:

◆ operator=() [1/2]

auto th::Factory::operator= ( const Factory & other) ->Factory &=delete
delete
Here is the call graph for this function:

◆ operator=() [2/2]

auto th::Factory::operator= ( Factory && other) ->Factory &=delete
deletenoexcept
Here is the call graph for this function:

Member Data Documentation

◆ Library

friend th::Factory::Library
private

The documentation for this class was generated from the following files:
  • /home/egrazil/sites/Brunot/The House/source/Framework/Factory.h
  • /home/egrazil/sites/Brunot/The House/source/Framework/Factory.cpp