Leviathan  0.8.0.0
Leviathan game engine
Leviathan::ObjectFileTemplateInstance Class Reference

Represents a template instantiation. More...

#include <ObjectFile.h>

Public Member Functions

DLLEXPORT ObjectFileTemplateInstance (const std::string &mastertmplname, std::vector< std::unique_ptr< std::string >> &templateargs)
 
DLLEXPORT const std::string & GetNameOfParentTemplate () const
 
DLLEXPORT std::string Serialize (size_t indentspaces=0) const
 

Protected Attributes

std::string TemplatesName
 The name of the master template from which the instances are generated. More...
 
std::vector< std::unique_ptr< std::string > > Arguments
 Template arguments. More...
 

Detailed Description

Represents a template instantiation.

Definition at line 281 of file ObjectFile.h.

Constructor & Destructor Documentation

◆ ObjectFileTemplateInstance()

DLLEXPORT Leviathan::ObjectFileTemplateInstance::ObjectFileTemplateInstance ( const std::string &  mastertmplname,
std::vector< std::unique_ptr< std::string >> &  templateargs 
)

Definition at line 785 of file ObjectFile.cpp.

786  :
787  TemplatesName(mastertmplname), Arguments(move(templateargs)) {
788 
789 }
std::vector< std::unique_ptr< std::string > > Arguments
Template arguments.
Definition: ObjectFile.h:302
std::string TemplatesName
The name of the master template from which the instances are generated.
Definition: ObjectFile.h:299

Member Function Documentation

◆ GetNameOfParentTemplate()

DLLEXPORT const std::string& Leviathan::ObjectFileTemplateInstance::GetNameOfParentTemplate ( ) const
inline

Definition at line 289 of file ObjectFile.h.

289  {
290 
291  return TemplatesName;
292  }
std::string TemplatesName
The name of the master template from which the instances are generated.
Definition: ObjectFile.h:299

◆ Serialize()

DLLEXPORT std::string Leviathan::ObjectFileTemplateInstance::Serialize ( size_t  indentspaces = 0) const

Definition at line 790 of file ObjectFile.cpp.

790  {
791 
792  constexpr auto BlockIndent = 4;
793 
794  const std::string indentation = StringOperations::Indent<std::string>(indentspaces);
795  const std::string contentindentation = StringOperations::Indent<std::string>(BlockIndent);
796 
797  std::string result = indentation + "template<> " + TemplatesName + "<";
798 
799  bool first = true;
800 
801  for (const auto& argument : Arguments) {
802 
803  if (!first)
804  result += ", ";
805 
806  result += *argument;
807  first = false;
808  }
809 
810  result += ">\n";
811  return result;
812 }
std::vector< std::unique_ptr< std::string > > Arguments
Template arguments.
Definition: ObjectFile.h:302
std::string TemplatesName
The name of the master template from which the instances are generated.
Definition: ObjectFile.h:299

Member Data Documentation

◆ Arguments

std::vector<std::unique_ptr<std::string> > Leviathan::ObjectFileTemplateInstance::Arguments
protected

Template arguments.

Definition at line 302 of file ObjectFile.h.

◆ TemplatesName

std::string Leviathan::ObjectFileTemplateInstance::TemplatesName
protected

The name of the master template from which the instances are generated.

Definition at line 299 of file ObjectFile.h.


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