OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
StdMeshMaterialShaderParameters Class Reference

#include <StdMeshMaterial.h>

Public Member Functions

 StdMeshMaterialShaderParameters ()
 
void Load (StdMeshMaterialParserCtx &ctx)
 
StdMeshMaterialShaderParameterAddParameter (const char *name, StdMeshMaterialShaderParameter::Type type)
 

Public Attributes

std::vector< std::pair
< StdCopyStrBuf,
StdMeshMaterialShaderParameter > > 
NamedParameters
 

Detailed Description

Definition at line 101 of file StdMeshMaterial.h.

Constructor & Destructor Documentation

StdMeshMaterialShaderParameters::StdMeshMaterialShaderParameters ( )
default

Member Function Documentation

StdMeshMaterialShaderParameter & StdMeshMaterialShaderParameters::AddParameter ( const char *  name,
StdMeshMaterialShaderParameter::Type  type 
)

Definition at line 807 of file StdMeshMaterial.cpp.

References NamedParameters.

808 {
809  NamedParameters.push_back(std::make_pair(StdCopyStrBuf(name), StdMeshMaterialShaderParameter(type)));
810  return NamedParameters.back().second;
811 }
std::vector< std::pair< StdCopyStrBuf, StdMeshMaterialShaderParameter > > NamedParameters
void StdMeshMaterialShaderParameters::Load ( StdMeshMaterialParserCtx ctx)

Definition at line 777 of file StdMeshMaterial.cpp.

References StdMeshMaterialParserCtx::AdvanceNonEOF(), StdMeshMaterialParserCtx::AdvanceRequired(), StdMeshMaterialParserCtx::Error(), StdMeshMaterialParserCtx::ErrorUnexpectedIdentifier(), StdStrBuf::getData(), NamedParameters, TOKEN_BRACE_CLOSE, TOKEN_BRACE_OPEN, and TOKEN_IDTF.

778 {
779  StdStrBuf token_name;
780  ctx.AdvanceRequired(token_name, TOKEN_BRACE_OPEN);
781 
782  Token token;
783  while ((token = ctx.AdvanceNonEOF(token_name)) == TOKEN_IDTF)
784  {
785  if(token_name == "param_named")
786  {
787  StdStrBuf param_name;
788  ctx.AdvanceRequired(param_name, TOKEN_IDTF);
789  NamedParameters.push_back(std::make_pair(StdCopyStrBuf(param_name), LoadConstParameter(ctx)));
790  }
791  else if(token_name == "param_named_auto")
792  {
793  StdStrBuf param_name;
794  ctx.AdvanceRequired(param_name, TOKEN_IDTF);
795  NamedParameters.push_back(std::make_pair(StdCopyStrBuf(param_name), LoadAutoParameter(ctx)));
796  }
797  else
798  {
799  ctx.ErrorUnexpectedIdentifier(token_name);
800  }
801  }
802 
803  if (token != TOKEN_BRACE_CLOSE)
804  ctx.Error(StdCopyStrBuf("'") + token_name.getData() + "' unexpected");
805 }
const char * getData() const
Definition: StdBuf.h:442
Token AdvanceRequired(StdStrBuf &name, Token expect)
void ErrorUnexpectedIdentifier(const StdStrBuf &identifier)
void Error(const StdStrBuf &message)
Token AdvanceNonEOF(StdStrBuf &name)
std::vector< std::pair< StdCopyStrBuf, StdMeshMaterialShaderParameter > > NamedParameters

Here is the call graph for this function:

Member Data Documentation

std::vector<std::pair<StdCopyStrBuf, StdMeshMaterialShaderParameter> > StdMeshMaterialShaderParameters::NamedParameters

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