| GL Studio C++ Runtime API

Classes | Namespaces | Macros | Functions | Variables
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 <locale>`
`#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 | DistiAttributeStdStringNeverWrite
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
namespace | 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<class T >
T | ConvertToIntOrBool (int value)
template<>
bool | ConvertToIntOrBool (int value)
template<class T >
T | ReadValueAsIntOrBool (std::istream &instr)
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)
AttributeObserver * | CreateAttributeFnCallback (WeakReferenceable *const obj, const std::function< void()> &func)
DistiAttributeBase::CallbackID | Connect (DisplayObject *obj, const std::string &resource, WeakReferenceable *funcOwner, std::function< void()> func)
template<class Class >
DistiAttributeBase::CallbackID | Connect (DisplayObject *obj, const std::string &resource, Class *const methodInstance, const typename AttributeMethodCallback< Class >::Callback method)
void | Disconnect (DisplayObject *obj, const std::string &resource, DistiAttributeBase::CallbackID id)

## Variables
const DistiAttributeBase::CallbackID | DISTI_INVALID_CALLBACK_ID = ~0u
| Value to represent that a given callback was not successfully created.

## 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

## ◆ DISTI_ADD_ATTRIBUTE

#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

  Type | The type of the attribute.
  name | The unique string name identifying the attribute.
  memberVarAddr | A 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

## ◆ DISTI_ADD_ATTRIBUTE_ALIAS

#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

  aliasName | The unique string name identifying the attribute.
  origName | The unique string idenfifying the attribute to create the alias from.
  obj | The object containing the origName attribute.

See also
  DISTI_ADD_ATTRIBUTE

## ◆ DISTI_ADD_ATTRIBUTE_CALLBACK

#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

  Type | The type of the attribute.
  name | The unique string name identifying the attribute.
  memberVarAddr | A pointer to the member variable of type Type. Can be NULL if no member variable is desired.
  callbackFunction | A member function pointer to the function called when this attribute is changed.

See also
  DISTI_ADD_ATTRIBUTE
  DISTI_ADD_ATTRIBUTE_SET_GET

## ◆ 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

  Type | The type of the attribute.
  name | The unique string name identifying the attribute.
  setter | A member function pointer to the setter function (can be NULL)
  getter | A member function pointer to the getter function (can be NULL)

See also
  DISTI_ADD_ATTRIBUTE
  DISTI_ADD_ATTRIBUTE_CALLBACK

## ◆ DISTI_ADD_ATTRIBUTE_STRING

#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

  name | The unique string name identifying the attribute.
  memberVarAddr | A 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

## ◆ 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

  name | The unique string name identifying the attribute.
  memberVarAddr | A pointer to the member variable of type std::string. Can be NULL if no member variable is desired.
  callbackFunction | The function that gets called when the attribute changes.

See also
  DISTI_ADD_ATTRIBUTE_STRING

## ◆ DISTI_REGISTER_METHOD_CALLBACK

#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

  instance | The DisplayObject instance.
  Class | The current class name, derived from DisplayObject.
  Method | The 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 ... } DISTI_REGISTER_METHOD_CALLBACK #define DISTI_REGISTER_METHOD_CALLBACK(instance, Class, Method) Definition: gls_metadata_attributes.h:2224

## ◆ DISTI_SET_OBJECT_CALLBACK1

#define DISTI_SET_OBJECT_CALLBACK1 | ( |  | object,
|  |  | method,
|  |  | parent
| ) |  |

Value:
( object )->CallbackCaller( \
new CallbackMethodCallerTemplate<DisplayObject, DisplayObject>( \
(disti::CallbackMethodCallerTemplate<DisplayObject, DisplayObject>::MethodType1)( method ), ( parent ) ) );
disti::CallbackMethodCallerTemplate
Definition: callback_caller.h:61

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

Parameters

  object | The DisplayObject instance.
  method | The method that should be called.
  parent | The parent to the object