Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
Olympe::TemplateManager Class Reference

TemplateManager - Manages blueprint templates Singleton manager for template catalog and operations. More...

#include <TemplateManager.h>

Public Member Functions

void Initialize (const std::string &templatesPath="Blueprints/Templates")
 
void Shutdown ()
 
bool LoadTemplates (const std::string &templatesPath)
 
bool SaveTemplate (const BlueprintTemplate &tpl)
 
bool DeleteTemplate (const std::string &templateId)
 
bool RefreshTemplates ()
 
const std::vector< BlueprintTemplate > & GetAllTemplates () const
 
const BlueprintTemplateFindTemplate (const std::string &id) const
 
std::vector< BlueprintTemplateGetTemplatesByCategory (const std::string &category) const
 
std::vector< std::string > GetAllCategories () const
 
bool ApplyTemplateToBlueprint (const std::string &templateId, json &targetBlueprint)
 
BlueprintTemplate CreateTemplateFromBlueprint (const json &blueprint, const std::string &name, const std::string &description, const std::string &category, const std::string &author="User")
 
bool IsInitialized () const
 
const std::string & GetTemplatesPath () const
 
std::string GetLastError () const
 
bool HasError () const
 
void ClearError ()
 

Static Public Member Functions

static TemplateManagerInstance ()
 
static TemplateManagerGet ()
 

Private Member Functions

 TemplateManager ()
 
 ~TemplateManager ()
 
 TemplateManager (const TemplateManager &)=delete
 
TemplateManageroperator= (const TemplateManager &)=delete
 
std::string GenerateUUID () const
 
void ScanTemplateDirectory ()
 
bool EnsureDirectoryExists (const std::string &path)
 

Private Attributes

bool m_Initialized
 
std::string m_TemplatesPath
 
std::vector< BlueprintTemplatem_Templates
 
std::string m_LastError
 

Detailed Description

TemplateManager - Manages blueprint templates Singleton manager for template catalog and operations.

Definition at line 52 of file TemplateManager.h.

Constructor & Destructor Documentation

◆ TemplateManager() [1/2]

Olympe::TemplateManager::TemplateManager ( )
private

Definition at line 124 of file TemplateManager.cpp.

◆ ~TemplateManager()

Olympe::TemplateManager::~TemplateManager ( )
private

Definition at line 129 of file TemplateManager.cpp.

◆ TemplateManager() [2/2]

Olympe::TemplateManager::TemplateManager ( const TemplateManager )
privatedelete

Member Function Documentation

◆ ApplyTemplateToBlueprint()

bool Olympe::TemplateManager::ApplyTemplateToBlueprint ( const std::string &  templateId,
json targetBlueprint 
)

Definition at line 308 of file TemplateManager.cpp.

References FindTemplate(), GetComponentTypeID_Static(), and m_LastError.

+ Here is the call graph for this function:

◆ ClearError()

void Olympe::TemplateManager::ClearError ( )
inline

Definition at line 91 of file TemplateManager.h.

References m_LastError.

◆ CreateTemplateFromBlueprint()

BlueprintTemplate Olympe::TemplateManager::CreateTemplateFromBlueprint ( const json blueprint,
const std::string &  name,
const std::string &  description,
const std::string &  category,
const std::string &  author = "User" 
)

Definition at line 323 of file TemplateManager.cpp.

References GenerateUUID(), GetComponentTypeID_Static(), and Olympe::BlueprintTemplate::id.

Referenced by Olympe::BlueprintEditor::SaveCurrentAsTemplate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DeleteTemplate()

bool Olympe::TemplateManager::DeleteTemplate ( const std::string &  templateId)

Definition at line 216 of file TemplateManager.cpp.

References GetComponentTypeID_Static(), m_LastError, m_Templates, and m_TemplatesPath.

+ Here is the call graph for this function:

◆ EnsureDirectoryExists()

bool Olympe::TemplateManager::EnsureDirectoryExists ( const std::string &  path)
private

Definition at line 400 of file TemplateManager.cpp.

References GetComponentTypeID_Static().

Referenced by Initialize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FindTemplate()

const BlueprintTemplate * Olympe::TemplateManager::FindTemplate ( const std::string &  id) const

Definition at line 265 of file TemplateManager.cpp.

References GetComponentTypeID_Static(), and m_Templates.

Referenced by ApplyTemplateToBlueprint().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GenerateUUID()

std::string Olympe::TemplateManager::GenerateUUID ( ) const
private

Definition at line 346 of file TemplateManager.cpp.

References gen(), GetComponentTypeID_Static(), and rd.

Referenced by CreateTemplateFromBlueprint().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Get()

static TemplateManager & Olympe::TemplateManager::Get ( )
inlinestatic

◆ GetAllCategories()

std::vector< std::string > Olympe::TemplateManager::GetAllCategories ( ) const

Definition at line 292 of file TemplateManager.cpp.

References GetComponentTypeID_Static(), and m_Templates.

+ Here is the call graph for this function:

◆ GetAllTemplates()

const std::vector< BlueprintTemplate > & Olympe::TemplateManager::GetAllTemplates ( ) const
inline

Definition at line 69 of file TemplateManager.h.

References m_Templates.

◆ GetLastError()

std::string Olympe::TemplateManager::GetLastError ( ) const
inline

Definition at line 89 of file TemplateManager.h.

References m_LastError.

Referenced by Olympe::BlueprintEditor::ApplyTemplate(), Olympe::BlueprintEditor::DeleteTemplate(), and Olympe::BlueprintEditor::SaveCurrentAsTemplate().

+ Here is the caller graph for this function:

◆ GetTemplatesByCategory()

std::vector< BlueprintTemplate > Olympe::TemplateManager::GetTemplatesByCategory ( const std::string &  category) const

Definition at line 277 of file TemplateManager.cpp.

References GetComponentTypeID_Static(), and m_Templates.

+ Here is the call graph for this function:

◆ GetTemplatesPath()

const std::string & Olympe::TemplateManager::GetTemplatesPath ( ) const
inline

Definition at line 88 of file TemplateManager.h.

References m_TemplatesPath.

◆ HasError()

bool Olympe::TemplateManager::HasError ( ) const
inline

Definition at line 90 of file TemplateManager.h.

References m_LastError.

◆ Initialize()

void Olympe::TemplateManager::Initialize ( const std::string &  templatesPath = "Blueprints/Templates")

Definition at line 133 of file TemplateManager.cpp.

References EnsureDirectoryExists(), GetComponentTypeID_Static(), LoadTemplates(), m_Initialized, m_LastError, m_Templates, and m_TemplatesPath.

Referenced by Olympe::BlueprintEditor::Initialize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Instance()

TemplateManager & Olympe::TemplateManager::Instance ( )
static

Definition at line 118 of file TemplateManager.cpp.

References GetComponentTypeID_Static().

Referenced by Get().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsInitialized()

bool Olympe::TemplateManager::IsInitialized ( ) const
inline

Definition at line 87 of file TemplateManager.h.

References m_Initialized.

◆ LoadTemplates()

bool Olympe::TemplateManager::LoadTemplates ( const std::string &  templatesPath)

Definition at line 158 of file TemplateManager.cpp.

References GetComponentTypeID_Static(), m_LastError, m_Templates, m_TemplatesPath, and ScanTemplateDirectory().

Referenced by Initialize(), and RefreshTemplates().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator=()

TemplateManager & Olympe::TemplateManager::operator= ( const TemplateManager )
privatedelete

◆ RefreshTemplates()

bool Olympe::TemplateManager::RefreshTemplates ( )

Definition at line 260 of file TemplateManager.cpp.

References LoadTemplates(), and m_TemplatesPath.

Referenced by Olympe::BlueprintEditor::ReloadTemplates().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SaveTemplate()

bool Olympe::TemplateManager::SaveTemplate ( const BlueprintTemplate tpl)

Definition at line 175 of file TemplateManager.cpp.

References GetComponentTypeID_Static(), m_LastError, m_Templates, and m_TemplatesPath.

+ Here is the call graph for this function:

◆ ScanTemplateDirectory()

void Olympe::TemplateManager::ScanTemplateDirectory ( )
private

Definition at line 369 of file TemplateManager.cpp.

References GetComponentTypeID_Static(), Olympe::BlueprintTemplate::LoadFromFile(), m_LastError, m_Templates, and m_TemplatesPath.

Referenced by LoadTemplates().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Shutdown()

void Olympe::TemplateManager::Shutdown ( )

Definition at line 152 of file TemplateManager.cpp.

References m_Initialized, and m_Templates.

Referenced by Olympe::BlueprintEditor::Shutdown().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_Initialized

bool Olympe::TemplateManager::m_Initialized
private

Definition at line 108 of file TemplateManager.h.

Referenced by Initialize(), IsInitialized(), and Shutdown().

◆ m_LastError

std::string Olympe::TemplateManager::m_LastError
private

◆ m_Templates

std::vector<BlueprintTemplate> Olympe::TemplateManager::m_Templates
private

◆ m_TemplatesPath

std::string Olympe::TemplateManager::m_TemplatesPath
private

The documentation for this class was generated from the following files: