GL Studio C++ Runtime API
gls_metadata_attributes.h File Reference

Defines templated metadata classes for DisplayObjects and other uses. More...

#include "display.h"
#include "disti_metadata.h"
#include "dynamic_array.h"
#include "gls_include.h"
#include "list.h"
#include "material.h"
#include "util.h"
#include "vertex.h"
#include <cassert>
#include <climits>
#include <cstdarg>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <cctype>
#include <functional>

Go to the source code of this file.

Classes

class  DistiAttributeUCharOrBool
 
class  DistiAttributeFloatArray
 
class  DistiAttributeDoubleArray
 
class  DistiAttributeTextureModeEnum< containerClass >
 
class  DistiAttributeTextureFilterEnum< containerClass >
 
class  DistiAttributePolyModeEnum< containerClass >
 
class  DistiAttributePolyEndEnum< containerClass >
 
class  DistiAttributeShadingEnum< containerClass >
 
class  DistiAttributeColorMaterialModeEnum< containerClass >
 
class  DistiAttributeProtectionEnum< containerClass >
 
class  DistiAttributeAlphaModeEnum< containerClass >
 
class  DistiAttributeString
 
class  DistiAttributeEncodedString
 
class  DistiAttributeEncodedStdString
 
class  DistiAttributeFixedString
 
class  DistiAttributeStdString
 
class  DistiAttributeLocation
 
class  DistiAttributeDictionaryAttribute
 
class  DistiAttributeDictionaryAttributeSibling
 
class  DistiAttributeStdMap< Map_t >
 
class  DistiAttributeVertexArray< T >
 
class  DistiAttributeVertexArray< Vertex >
 
class  DistiAttributeTexturePointArray
 
class  DistiAttributeNeverWrite< T >
 
class  DistiAttributeAlias
 
class  DistiAttributeDynamicArray< T, showIndex >
 
class  DistiAttributeStdVector< T, showIndex >
 
class  DistiAttributeHomogeneousItemArray< T >
 
class  DistiAttributeProperty< containerT, T, SetArgT, GetReturnT >
 
class  DistiEmptyAttribute
 
class  DistiAttributeEnumDirect< enumType >
 
class  AttributeFnCallback
 

Namespaces

 disti
 

Macros

#define DISTI_REGISTER_METHOD_CALLBACK(instance, Class, Method)
 
#define DISTI_SET_OBJECT_CALLBACK1(object, method, parent)
 
#define DISTI_ADD_ATTRIBUTE(Type, name, memberVarAddr)
 
#define DISTI_ADD_ATTRIBUTE_CALLBACK(Type, name, memberVarAddr, callbackFunction)
 
#define DISTI_ADD_ATTRIBUTE_SET_GET(Type, name, setter, getter)
 
#define DISTI_ADD_ATTRIBUTE_STRING(name, memberVarAddr)
 
#define DISTI_ADD_ATTRIBUTE_STRING_CALLBACK(name, memberVarAddr, callbackFunction)
 
#define DISTI_ADD_ATTRIBUTE_ALIAS(aliasName, origName, obj)
 

Functions

template<typename Type , class Class >
DistiAttributeProperty< Class, Type, Type > * CreateDistiAttributeProperty (const AttributeName &attrName, Class *const obj, const typename DistiAttributeProperty< Class, Type, Type >::SetMethodType setMethod, const typename DistiAttributeProperty< Class, Type, Type >::GetMethodType getMethod=NULL)
 
template<typename Type , class Class >
DistiAttributeProperty< Class, Type, Type > * CreateDistiAttributeProperty (const AttributeName &attrName, Class *const obj, const typename DistiAttributeProperty< Class, Type, Type >::SetMethodType setMethod, const typename DistiAttributeProperty< Class, Type, Type >::GetMethodConstType getMethod)
 
template<typename Type , class Class >
DistiAttributeProperty< Class, Type > * CreateDistiAttributeProperty (const AttributeName &attrName, Class *const obj, const typename DistiAttributeProperty< Class, Type >::GetMethodConstType getMethod)
 
template<typename Type , class Class >
DistiAttributeProperty< Class, Type > * CreateDistiAttributeProperty (const AttributeName &attrName, Class *const obj, const typename DistiAttributeProperty< Class, Type >::GetMethodType getMethod)
 
template<typename Type , class Class >
DistiAttributeProperty< Class, Type, const Type & > * CreateDistiAttributeProperty (const AttributeName &attrName, Class *const obj, const typename DistiAttributeProperty< Class, Type, const Type & >::SetMethodType setMethod, const typename DistiAttributeProperty< Class, Type, const Type & >::GetMethodType getMethod=NULL)
 
template<typename Type , class Class >
DistiAttributeProperty< Class, Type, const Type & > * CreateDistiAttributeProperty (const AttributeName &attrName, Class *const obj, const typename DistiAttributeProperty< Class, Type, const Type & >::SetMethodType setMethod, const typename DistiAttributeProperty< Class, Type, const Type & >::GetMethodConstType getMethod)
 
template<typename GetReturnT , typename SetArgT , class Class >
DistiAttributeProperty< Class, GetReturnT, SetArgT > * CreateDistiAttributeProperty (const AttributeName &attrName, Class *const obj, const typename DistiAttributeProperty< Class, GetReturnT, SetArgT >::SetMethodType setMethod, const typename DistiAttributeProperty< Class, GetReturnT, SetArgT >::GetMethodType getMethod)
 
template<class Class >
DistiAttributeProperty< Class, Vector, const Vertex &, const Vertex & > * CreateDistiAttributePropertyVertexToVector (const AttributeName &attrName, Class *const obj, const typename DistiAttributeProperty< Class, Vector, const Vertex &, const Vertex & >::SetMethodType setMethod, const typename DistiAttributeProperty< Class, Vector, const Vertex &, const Vertex & >::GetMethodConstType getMethod)
 

Detailed Description

Defines templated metadata classes for DisplayObjects and other uses.

Copyright Information

Copyright (c) 2017 by The DiSTI Corporation.
11301 Corporate Blvd; Suite 100
Orlando, Florida 32817
USA

All rights reserved.

This Software contains proprietary trade secrets of DiSTI and may not be reproduced, in whole or part, in any form, or by any means of electronic, mechanical, or otherwise, without the written permission of DiSTI. Said permission may be derived through the purchase of applicable DiSTI product licenses which detail the distribution rights of this content and any Derivative Works based on this or other copyrighted DiSTI Software.

NO WARRANTY. THE SOFTWARE IS PROVIDED "AS-IS," WITHOUT WARRANTY OF ANY KIND, AND ANY USE OF THIS SOFTWARE PRODUCT IS AT YOUR OWN RISK. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, DISTI AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE.

LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL DISTI OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE, EVEN IF DISTI HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. DISTI'S ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY SHALL NOT EXCEED FIVE DOLLARS (US$5.00).

The aforementioned terms and restrictions are governed by the laws of the State of Florida and the United States of America.

Macro Definition Documentation

#define DISTI_ADD_ATTRIBUTE (   Type,
  name,
  memberVarAddr 
)
Value:
{ \
static const AttributeName attr( name ); \
CallbackAttributeNotifier<ThisClass> cb( this, attr ); \
this->Attributes().Add( new DistiAttribute<Type>( &cb, ( attr ), ( memberVarAddr ) ) ); \
}

A macro for boilerplate code to setup a DisplayObject attribute.

Parameters
TypeThe type of the attribute.
nameThe unique string name identifying the attribute.
memberVarAddrA pointer to the member variable of type Type. Can be NULL if no member variable is desired.
See also
DISTI_ADD_ATTRIBUTE_CALLBACK
DISTI_ADD_ATTRIBUTE_SET_GET
#define DISTI_ADD_ATTRIBUTE_ALIAS (   aliasName,
  origName,
  obj 
)
Value:
{ \
static const AttributeName aliasAttr( aliasName ); \
static const AttributeName origAttr( origName ); \
DistiAttribDict& attributes = ( obj )->Attributes(); \
this->Attributes().Add( new DistiAttributeAlias( NULL, aliasAttr, origAttr, &attributes ) ); \
}

A macro for boilerplate code to setup an alias to an existing DisplayObject attribute.

Parameters
nameThe unique string name identifying the attribute.
origNameThe unique string idenfifying the attribute to create the alias from.
objThe object containing the origName attribute.
See also
DISTI_ADD_ATTRIBUTE
#define DISTI_ADD_ATTRIBUTE_CALLBACK (   Type,
  name,
  memberVarAddr,
  callbackFunction 
)
Value:
{ \
typedef void ( ThisClass::*Method )(); /* Member function pointer */ \
static const AttributeName attr( name ); \
CallbackAttributeNotifier<ThisClass> cb( this, attr, reinterpret_cast<Method>( callbackFunction ) ); \
this->Attributes().Add( new DistiAttribute<Type>( &cb, ( attr ), ( memberVarAddr ) ) ); \
}

A macro for boilerplate code to setup a DisplayObject attribute that has a callback function.

Parameters
TypeThe type of the attribute.
nameThe unique string name identifying the attribute.
memberVarAddrA pointer to the member variable of type Type. Can be NULL if no member variable is desired.
callbackFunctionA member function pointer to the function called when this attribute is changed.
See also
DISTI_ADD_ATTRIBUTE
DISTI_ADD_ATTRIBUTE_SET_GET
#define DISTI_ADD_ATTRIBUTE_SET_GET (   Type,
  name,
  setter,
  getter 
)
Value:
{ \
static const AttributeName attr( name ); \
this->Attributes().Add( CreateDistiAttributeProperty<Type>( attr, this, setter, getter ) ); \
}

A macro for boilerplate code to setup a DisplayObject attribute that has a setter and a getter function.

Parameters
TypeThe type of the attribute.
nameThe unique string name identifying the attribute.
setterA member function pointer to the setter function (can be NULL)
getterA member function pointer to the getter function (can be NULL)
See also
DISTI_ADD_ATTRIBUTE
DISTI_ADD_ATTRIBUTE_CALLBACK
#define DISTI_ADD_ATTRIBUTE_STRING (   name,
  memberVarAddr 
)
Value:
{ \
static const AttributeName attr( name ); \
CallbackAttributeNotifier<ThisClass> cb( this, attr ); \
this->Attributes().Add( new DistiAttributeEncodedStdString( &cb, attr, memberVarAddr ) ); \
}

A macro for boilerplate code to setup a string as a DisplayObject attribute.

Parameters
nameThe unique string name identifying the attribute.
memberVarAddrA pointer to the member variable of type std::string. Can be NULL if no member variable is desired.
See also
DISTI_ADD_ATTRIBUTE_STRING_CALLBACK
#define DISTI_ADD_ATTRIBUTE_STRING_CALLBACK (   name,
  memberVarAddr,
  callbackFunction 
)
Value:
{ \
typedef void ( ThisClass::*Method )(); /* Member function pointer */ \
static const AttributeName attr( name ); \
CallbackAttributeNotifier<ThisClass> cb( this, attr, reinterpret_cast<Method>( callbackFunction ) ); \
this->Attributes().Add( new DistiAttributeEncodedStdString( &cb, attr, memberVarAddr ) ); \
}

A macro for boilerplate code to setup a string as a DisplayObject attribute with a callback

Parameters
nameThe unique string name identifying the attribute.
memberVarAddrA pointer to the member variable of type std::string. Can be NULL if no member variable is desired.
callbackFunctionThe function that gets called when the attribute changes.
See also
DISTI_ADD_ATTRIBUTE_STRING
#define DISTI_REGISTER_METHOD_CALLBACK (   instance,
  Class,
  Method 
)
Value:
{ \
typedef CallbackMethodCallerTemplate<Class, Class> Caller; \
typedef typename Caller::MethodType1 MethodType; \
const MethodType callback = reinterpret_cast<MethodType>( Method ); \
ThisClass::CallbackCaller( new Caller( callback, instance ) ); \
}

A macro for boilerplate code to setup a DisplayObject callback.

Parameters
instanceThe DisplayObject instance.
ClassThe current class name, derived from DisplayObject.
MethodThe class's method name for the callback.
// Given a class ScrollList that inherits from DisplayObject...
ScrollList::ScrollList()
{
DISTI_REGISTER_METHOD_CALLBACK( this, &ScrollList::EventCallback );
}
int ScrollList::EventCallback( Group* self, DisplayEvent* ev )
{
// ... event handler code ...
}
#define DISTI_SET_OBJECT_CALLBACK1 (   object,
  method,
  parent 
)
Value:
( object )->CallbackCaller( \
new CallbackMethodCallerTemplate<DisplayObject, DisplayObject>( \
Definition: callback_caller.h:59

A macro for boilerplate code to setup a DisplayObject method caller for MethodType 1.

Parameters
objectThe DisplayObject instance.
methodThe method that should be called.
parentThe parent to the object