HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MslSyntax Class Reference

Syntax class for MSL (OpenGL Shading Language) More...

#include <MslSyntax.h>

+ Inheritance diagram for MslSyntax:

Public Member Functions

 MslSyntax ()
 
const stringgetInputQualifier () const override
 
const stringgetOutputQualifier () const override
 
const stringgetConstantQualifier () const override
 
const stringgetUniformQualifier () const override
 
const stringgetSourceFileExtension () const override
 Return the file extension used for source code files in this language. More...
 
const stringgetStructKeyword () const
 
string getOutputTypeName (const TypeDesc *type) const override
 Returns the type name in an output context. More...
 
bool typeSupported (const TypeDesc *type) const override
 
bool remapEnumeration (const string &value, const TypeDesc *type, const string &enumNames, std::pair< const TypeDesc *, ValuePtr > &result) const override
 
- Public Member Functions inherited from Syntax
virtual ~Syntax ()
 
void registerTypeSyntax (const TypeDesc *type, TypeSyntaxPtr syntax)
 
void registerReservedWords (const StringSet &names)
 
void registerInvalidTokens (const StringMap &tokens)
 
const StringSetgetReservedWords () const
 Returns a set of names that are reserved words for this language syntax. More...
 
const StringMapgetInvalidTokens () const
 Returns a mapping from disallowed tokens to replacement strings for this language syntax. More...
 
const TypeSyntaxgetTypeSyntax (const TypeDesc *type) const
 
const vector< TypeSyntaxPtr > & getTypeSyntaxes () const
 Returns an array of all registered type syntax objects. More...
 
const TypeDescgetTypeDescription (const TypeSyntaxPtr &typeSyntax) const
 
const stringgetTypeName (const TypeDesc *type) const
 Returns the name syntax of the given type. More...
 
const stringgetTypeAlias (const TypeDesc *type) const
 
const stringgetTypeDefinition (const TypeDesc *type) const
 
const stringgetDefaultValue (const TypeDesc *type, bool uniform=false) const
 Returns the default value string for the given type. More...
 
virtual string getValue (const TypeDesc *type, const Value &value, bool uniform=false) const
 Returns the value string for a given type and value object. More...
 
virtual string getValue (const ShaderPort *port, bool uniform=false) const
 Returns the value string for a given shader port object. More...
 
virtual string getSwizzledVariable (const string &srcName, const TypeDesc *srcType, const string &channels, const TypeDesc *dstType) const
 Get syntax for a swizzled variable. More...
 
virtual ValuePtr getSwizzledValue (ValuePtr value, const TypeDesc *srcType, const string &channels, const TypeDesc *dstType) const
 Get swizzled value. More...
 
virtual const stringgetNewline () const
 Return the characters used for a newline. More...
 
virtual const stringgetIndentation () const
 Return the characters used for a single indentation level. More...
 
virtual const stringgetStringQuote () const
 Return the characters used to begin/end a string definition. More...
 
virtual const stringgetIncludeStatement () const
 Return the string pattern used for a file include statement. More...
 
virtual const stringgetSingleLineComment () const
 Return the characters used for single line comment. More...
 
virtual const stringgetBeginMultiLineComment () const
 Return the characters used to begin a multi line comments block. More...
 
virtual const stringgetEndMultiLineComment () const
 Return the characters used to end a multi line comments block. More...
 
virtual string getArrayTypeSuffix (const TypeDesc *, const Value &) const
 Return the array suffix to use for declaring an array type. More...
 
virtual string getArrayVariableSuffix (const TypeDesc *type, const Value &value) const
 Return the array suffix to use for declaring an array variable. More...
 
virtual void makeValidName (string &name) const
 Modify the given name string to remove any invalid characters or tokens. More...
 
virtual void makeIdentifier (string &name, IdentifierMap &identifiers) const
 
virtual string getVariableName (const string &name, const TypeDesc *type, IdentifierMap &identifiers) const
 

Static Public Member Functions

static SyntaxPtr create ()
 

Static Public Attributes

static const string INPUT_QUALIFIER
 
static const string OUTPUT_QUALIFIER
 
static const string UNIFORM_QUALIFIER
 
static const string CONSTANT_QUALIFIER
 
static const string FLAT_QUALIFIER
 
static const string SOURCE_FILE_EXTENSION
 
static const string STRUCT_KEYWORD
 
static const StringVec VEC2_MEMBERS
 
static const StringVec VEC3_MEMBERS
 
static const StringVec VEC4_MEMBERS
 
- Static Public Attributes inherited from Syntax
static const string NEWLINE
 Constants with commonly used strings. More...
 
static const string SEMICOLON
 
static const string COMMA
 

Additional Inherited Members

- Public Types inherited from Syntax
enum  Punctuation { PARENTHESES, CURLY_BRACKETS, SQUARE_BRACKETS, DOUBLE_SQUARE_BRACKETS }
 Punctuation types. More...
 
- Protected Member Functions inherited from Syntax
 Syntax ()
 Protected constructor. More...
 
- Protected Attributes inherited from Syntax
vector< TypeSyntaxPtr_typeSyntaxes
 
std::unordered_map< const
TypeDesc *, size_t > 
_typeSyntaxByType
 
StringSet _reservedWords
 
StringMap _invalidTokens
 
- Static Protected Attributes inherited from Syntax
static const string INDENTATION
 
static const string STRING_QUOTE
 
static const string INCLUDE_STATEMENT
 
static const string SINGLE_LINE_COMMENT
 
static const string BEGIN_MULTI_LINE_COMMENT
 
static const string END_MULTI_LINE_COMMENT
 
static const
std::unordered_map< char,
size_t > 
CHANNELS_MAPPING
 

Detailed Description

Syntax class for MSL (OpenGL Shading Language)

Definition at line 19 of file MslSyntax.h.

Constructor & Destructor Documentation

MslSyntax::MslSyntax ( )

Member Function Documentation

static SyntaxPtr MslSyntax::create ( )
inlinestatic

Definition at line 24 of file MslSyntax.h.

const string& MslSyntax::getConstantQualifier ( ) const
inlineoverridevirtual

Get the qualifier used when declaring constant variables. Derived classes must define this method.

Implements Syntax.

Definition at line 28 of file MslSyntax.h.

const string& MslSyntax::getInputQualifier ( ) const
inlineoverridevirtual

Returns a type qualifier to be used when declaring types for input variables. Default implementation returns empty string and derived syntax classes should override this method.

Reimplemented from Syntax.

Definition at line 26 of file MslSyntax.h.

const string& MslSyntax::getOutputQualifier ( ) const
inlineoverridevirtual

Returns a type qualifier to be used when declaring types for output variables. Default implementation returns empty string and derived syntax classes should override this method.

Reimplemented from Syntax.

Definition at line 27 of file MslSyntax.h.

string MslSyntax::getOutputTypeName ( const TypeDesc type) const
overridevirtual

Returns the type name in an output context.

Reimplemented from Syntax.

const string& MslSyntax::getSourceFileExtension ( ) const
inlineoverridevirtual

Return the file extension used for source code files in this language.

Implements Syntax.

Definition at line 30 of file MslSyntax.h.

const string& MslSyntax::getStructKeyword ( ) const
inline

Definition at line 31 of file MslSyntax.h.

const string& MslSyntax::getUniformQualifier ( ) const
inlineoverridevirtual

Get the qualifier used when declaring uniform variables. Default implementation returns empty string and derived syntax classes should override this method.

Reimplemented from Syntax.

Definition at line 29 of file MslSyntax.h.

bool MslSyntax::remapEnumeration ( const string value,
const TypeDesc type,
const string enumNames,
std::pair< const TypeDesc *, ValuePtr > &  result 
) const
overridevirtual

Given an input specification attempt to remap this to an enumeration which is accepted by the shader generator. The enumeration may be converted to a different type than the input.

Reimplemented from Syntax.

bool MslSyntax::typeSupported ( const TypeDesc type) const
overridevirtual

Query if given type is suppored in the syntax. By default all types are assumed to be supported.

Reimplemented from Syntax.

Member Data Documentation

const string MslSyntax::CONSTANT_QUALIFIER
static

Definition at line 44 of file MslSyntax.h.

const string MslSyntax::FLAT_QUALIFIER
static

Definition at line 45 of file MslSyntax.h.

const string MslSyntax::INPUT_QUALIFIER
static

Definition at line 41 of file MslSyntax.h.

const string MslSyntax::OUTPUT_QUALIFIER
static

Definition at line 42 of file MslSyntax.h.

const string MslSyntax::SOURCE_FILE_EXTENSION
static

Definition at line 46 of file MslSyntax.h.

const string MslSyntax::STRUCT_KEYWORD
static

Definition at line 47 of file MslSyntax.h.

const string MslSyntax::UNIFORM_QUALIFIER
static

Definition at line 43 of file MslSyntax.h.

const StringVec MslSyntax::VEC2_MEMBERS
static

Definition at line 49 of file MslSyntax.h.

const StringVec MslSyntax::VEC3_MEMBERS
static

Definition at line 50 of file MslSyntax.h.

const StringVec MslSyntax::VEC4_MEMBERS
static

Definition at line 51 of file MslSyntax.h.


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