"L. Spiro Engine"
Classes | Public Types | Public Member Functions | Protected Attributes

lsg::CShaderScope Class Reference

A single scope within a stack of scopes. More...

#include <LSGShaderScope.h>

List of all members.

Classes

struct  LSG_FUNCTION
struct  LSG_STRUCT
struct  LSG_TYPE_AND_INDEX
struct  LSG_VARIABLE

Public Types

enum  LSG_TYPE { LSG_T_VARIABLE, LSG_T_FUNCTION, LSG_T_STRUCT, LSG_T_UNDEFINED }
typedef struct
lsg::CShaderScope::LSG_VARIABLE
LPLSG_VARIABLE
typedef struct
lsg::CShaderScope::LSG_VARIABLE 
LPCLSG_VARIABLE
typedef struct
lsg::CShaderScope::LSG_FUNCTION
LPLSG_FUNCTION
typedef struct
lsg::CShaderScope::LSG_FUNCTION 
LPCLSG_FUNCTION
typedef struct
lsg::CShaderScope::LSG_STRUCT
LPLSG_STRUCT
typedef struct
lsg::CShaderScope::LSG_STRUCT 
LPCLSG_STRUCT
typedef struct
lsg::CShaderScope::LSG_TYPE_AND_INDEX
LPLSG_TYPE_AND_INDEX
typedef struct
lsg::CShaderScope::LSG_TYPE_AND_INDEX 
LPCLSG_TYPE_AND_INDEX

Public Member Functions

CShaderScope &LSE_CALL operator= (const CShaderScope &_ssOther)
LSBOOL LSE_CALL AddVariable (const CString &_sName, const LSG_VARIABLE &_vVar)
LSBOOL LSE_CALL AddFunction (const CString &_sName, const LSG_FUNCTION &_fFunc)
LSBOOL LSE_CALL AddStruct (const CString &_sName, const LSG_STRUCT &_sStruct)
const LSG_VARIABLE &LSE_CALL GetVariable (LSUINT32 _ui32Index) const
const LSG_FUNCTION &LSE_CALL GetFunction (LSUINT32 _ui32Index) const
const LSG_STRUCT &LSE_CALL GetStruct (LSUINT32 _ui32Index) const
LSBOOL LSE_CALL IdentifierExistsAs (LSG_TYPE _tType, const CString &_sName) const
LSBOOL LSE_CALL GetIdentifiersAs (LSG_TYPE _tType, const CString &_sName, CVectorPoD< LSG_TYPE_AND_INDEX > &_vRet) const
LSBOOL LSE_CALL CreateNameAssociation (const CString &_sOldName, const LSCHAR *_pcNewName)
LSBOOL LSE_CALL GetNameAssociation (const CString &_sName, const LSCHAR *&_pcNew) const

Protected Attributes

CVectorPoD< LSG_VARIABLEm_vVariables
CVectorPoD< LSG_FUNCTIONm_vFuncs
CVectorPoD< LSG_STRUCTm_vStructs
CMultiMap< CString,
LSG_TYPE_AND_INDEX
m_mmTypeMap
CMap< CString, CString > m_mNameAssociations

Detailed Description

A single scope within a stack of scopes.

Class CShaderScope Description: A single scope within a stack of scopes. When a new scope is created, it is pushed to the top of a stack of scopes. The top of the stack is always the current scope.


Member Typedef Documentation

A function. Includes its return type and number of parameters.

A structure. Inclues its name and its declaration node index.

A structure for use with maps that associates a name with a type and index combination. This is the type/index combination.

A variable. Includes type information and name.


Member Enumeration Documentation

Types of things.


Member Function Documentation

LSBOOL LSE_CALL lsg::CShaderScope::AddFunction ( const CString &  _sName,
const LSG_FUNCTION _fFunc 
)

Add a function to this scope.

Parameters:
_sNameThe name of the function.
_fFuncThe function data to add.
Returns:
Returns true if the function was added. A return of false indicates a memory failure.
LSBOOL LSE_CALL lsg::CShaderScope::AddStruct ( const CString &  _sName,
const LSG_STRUCT _sStruct 
)

Add a structure to this scope.

Parameters:
_sNameThe name of the structure.
_sStructThe structure data to add.
Returns:
Returns true if the structure was added. A return of false indicates a memory failure.
LSBOOL LSE_CALL lsg::CShaderScope::AddVariable ( const CString &  _sName,
const LSG_VARIABLE _vVar 
)

Add a variable to this scope.

Parameters:
_sNameThe name of the variable.
_vVarThe variable data to add.
Returns:
Returns true if the variable was added. A return of false indicates a memory failure.
LSBOOL LSE_CALL lsg::CShaderScope::CreateNameAssociation ( const CString &  _sOldName,
const LSCHAR *  _pcNewName 
)

Add a name association.

Parameters:
_sOldNameThe name of the original identifier.
_pcNewNameThe new name of the identifier.
Returns:
Returns false if there is not enough memory to perform the operation.
const LSG_FUNCTION& LSE_CALL lsg::CShaderScope::GetFunction ( LSUINT32  _ui32Index) const

Get a function by index.

Parameters:
_ui32IndexIndex of the function to get.
Returns:
Returns a constant reference to the function at the given index.
LSBOOL LSE_CALL lsg::CShaderScope::GetIdentifiersAs ( LSG_TYPE  _tType,
const CString &  _sName,
CVectorPoD< LSG_TYPE_AND_INDEX > &  _vRet 
) const

Get all forms of the given identifier as the given type. For example, if an identifier exists as both a structure name and a function, this allows to get only the function or only the structure form.

Parameters:
_tTypeType of the identifier.
_sNameThe identifier to locate.
_vRetHolds the returned list of variables, structures, or functions, all of which will match the type given in _tType.
Returns:
Returns true if the given identifier exists in this scope with the given form.
LSBOOL LSE_CALL lsg::CShaderScope::GetNameAssociation ( const CString &  _sName,
const LSCHAR *&  _pcNew 
) const

Get a name association.

Parameters:
_sNameThe name for which to find an association.
_pcNewThe replacement name, if any. Filled on successful return.
Returns:
Returns true if there is a replacement name for the given name.
const LSG_STRUCT& LSE_CALL lsg::CShaderScope::GetStruct ( LSUINT32  _ui32Index) const

Get a structure by index.

Parameters:
_ui32IndexIndex of the structure to get.
Returns:
Returns a constant reference to the structure at the given index.
const LSG_VARIABLE& LSE_CALL lsg::CShaderScope::GetVariable ( LSUINT32  _ui32Index) const

Get a variable by index.

Parameters:
_ui32IndexIndex of the variable to get.
Returns:
Returns a constant reference to the variable at the given index.
LSBOOL LSE_CALL lsg::CShaderScope::IdentifierExistsAs ( LSG_TYPE  _tType,
const CString &  _sName 
) const

Does the given type-identifier name exist within this scope?

Parameters:
_tTypeType of the identifier.
_sNameThe identifier to locate.
Returns:
Returns true if the given identifier exists in this scope with the given form.
CShaderScope& LSE_CALL lsg::CShaderScope::operator= ( const CShaderScope _ssOther)

Copy operator.

Parameters:
_ssOtherThe object to copy.
Returns:
Returns this object after the copy.

Member Data Documentation

CMultiMap<CString, LSG_TYPE_AND_INDEX> lsg::CShaderScope::m_mmTypeMap [protected]

Mapping between names and types. Since functions can be overloaded, a CMultiMap has to be used instead of a CMap.

CMap<CString, CString> lsg::CShaderScope::m_mNameAssociations [protected]

Name associations.

CVectorPoD<LSG_FUNCTION> lsg::CShaderScope::m_vFuncs [protected]

Functions in this scope.

CVectorPoD<LSG_STRUCT> lsg::CShaderScope::m_vStructs [protected]

Structures in this scope.

Variables in this scope.


The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator