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

#include <OslSyntax.h>

+ Inheritance diagram for OslSyntax:

Public Member Functions

 OslSyntax (TypeSystemPtr typeSystem)
 
StructTypeSyntaxPtr createStructSyntax (const string &structTypeName, const string &defaultValue, const string &uniformDefaultValue, const string &typeAlias, const string &typeDefinition) const override
 
const stringgetOutputQualifier () const override
 
const stringgetConstantQualifier () const override
 
const stringgetSourceFileExtension () const override
 Return the file extension used for source code files in this language. More...
 
- Public Member Functions inherited from Syntax
virtual ~Syntax ()
 
void registerTypeSyntax (TypeDesc type, TypeSyntaxPtr 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 (TypeDesc type) const
 
const TypeSyntaxgetTypeSyntax (const TypeDesc *type) const
 
const vector< TypeSyntaxPtr > & getTypeSyntaxes () const
 Returns an array of all registered type syntax objects. More...
 
TypeDesc getType (const string &name) const
 Return a type description for the given type name. More...
 
const stringgetTypeName (TypeDesc type) const
 Returns the name syntax of the given type. More...
 
const stringgetTypeName (const TypeDesc *type) const
 
virtual string getOutputTypeName (TypeDesc type) const
 Returns the type name in an output context. More...
 
string getOutputTypeName (const TypeDesc *type) const
 
const stringgetTypeAlias (TypeDesc type) const
 
const stringgetTypeAlias (const TypeDesc *type) const
 
const stringgetTypeDefinition (TypeDesc type) const
 
const stringgetTypeDefinition (const TypeDesc *type) const
 
const stringgetDefaultValue (TypeDesc type, bool uniform=false) const
 Returns the default value string for the given type. More...
 
const stringgetDefaultValue (const TypeDesc *type, bool uniform=false) const
 
virtual string getValue (TypeDesc type, const Value &value, bool uniform=false) const
 Returns the value string for a given type and value object. More...
 
string getValue (const TypeDesc *type, const Value &value, bool uniform=false) const
 
virtual string getValue (const ShaderPort *port, bool uniform=false) const
 Returns the value string for a given shader port object. More...
 
virtual const stringgetInputQualifier () const
 
virtual const stringgetUniformQualifier () const
 
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 (TypeDesc, const Value &) const
 Return the array suffix to use for declaring an array type. More...
 
string getArrayTypeSuffix (const TypeDesc *type, const Value &value) const
 
virtual string getArrayVariableSuffix (TypeDesc type, const Value &value) const
 Return the array suffix to use for declaring an array variable. More...
 
string getArrayVariableSuffix (const TypeDesc *type, const Value &value) const
 
virtual bool typeSupported (const TypeDesc *type) const
 
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, TypeDesc type, IdentifierMap &identifiers) const
 
string getVariableName (const string &name, const TypeDesc *type, IdentifierMap &identifiers) const
 
virtual bool remapEnumeration (const string &value, TypeDesc type, const string &enumNames, std::pair< TypeDesc, ValuePtr > &result) const
 

Static Public Member Functions

static SyntaxPtr create (TypeSystemPtr typeSystem)
 

Static Public Attributes

static const string OUTPUT_QUALIFIER
 
static const string SOURCE_FILE_EXTENSION
 
static const StringVec VECTOR_MEMBERS
 
static const StringVec VECTOR2_MEMBERS
 
static const StringVec VECTOR4_MEMBERS
 
static const StringVec COLOR4_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 (TypeSystemPtr typeSystem)
 Protected constructor. More...
 
- Protected Attributes inherited from Syntax
TypeSystemPtr _typeSystem
 
vector< TypeSyntaxPtr_typeSyntaxes
 
std::unordered_map< TypeDesc,
size_t, TypeDesc::Hasher
_typeSyntaxIndexByType
 
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 OSL (Open Shading Language)

Definition at line 20 of file OslSyntax.h.

Constructor & Destructor Documentation

OslSyntax::OslSyntax ( TypeSystemPtr  typeSystem)

Member Function Documentation

static SyntaxPtr OslSyntax::create ( TypeSystemPtr  typeSystem)
inlinestatic

Definition at line 25 of file OslSyntax.h.

StructTypeSyntaxPtr OslSyntax::createStructSyntax ( const string structTypeName,
const string defaultValue,
const string uniformDefaultValue,
const string typeAlias,
const string typeDefinition 
) const
overridevirtual

Reimplemented from Syntax.

const string& OslSyntax::getConstantQualifier ( ) const
inlineoverridevirtual

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

Implements Syntax.

Definition at line 32 of file OslSyntax.h.

const string& OslSyntax::getOutputQualifier ( ) const
overridevirtual

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.

const string& OslSyntax::getSourceFileExtension ( ) const
inlineoverridevirtual

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

Implements Syntax.

Definition at line 33 of file OslSyntax.h.

Member Data Documentation

const StringVec OslSyntax::COLOR4_MEMBERS
static

Definition at line 40 of file OslSyntax.h.

const string OslSyntax::OUTPUT_QUALIFIER
static

Definition at line 33 of file OslSyntax.h.

const string OslSyntax::SOURCE_FILE_EXTENSION
static

Definition at line 36 of file OslSyntax.h.

const StringVec OslSyntax::VECTOR2_MEMBERS
static

Definition at line 38 of file OslSyntax.h.

const StringVec OslSyntax::VECTOR4_MEMBERS
static

Definition at line 39 of file OslSyntax.h.

const StringVec OslSyntax::VECTOR_MEMBERS
static

Definition at line 37 of file OslSyntax.h.


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