1.14.0.5
Hummingbird
A modern user interface library for games
cohtml::Property Class Referenceabstract

Represents a property of a type exposed to the scripting. More...

Inherited by cohtml::AdjustPointer, cohtml::TypedProperty< ValueType >, cohtml::TypedProperty< const PropertyType &>, cohtml::TypedProperty< const PropertyType(&)[ArraySize]>, and cohtml::TypedProperty< ReturnsByRef< Getter >::ValuePassType >.

Public Member Functions

 Property (const char *name, bool isByRef=true)
 Create a new property. More...
 
const char * GetName () const
 Get the name of the property. More...
 
bool IsByRef () const
 Can this property be exported By-Ref. Temporaries can not be exported by reference. More...
 
virtual void * Bind (Binder *binder, void *object) const =0
 Expose the property's name and value to a binder. More...
 
virtual void * BindValue (Binder *binder, void *object) const =0
 Expose only the value of the property to a binder. More...
 
virtual void * Read (Binder *binder, void *object) const =0
 Read the value from a binder. More...
 
virtual PropertyClone () const =0
 Clone the property. More...
 
virtual bool ToBoolean (void *object, bool *boolean) const =0
 Convert the property value to a boolean. More...
 
virtual bool ToNumber (void *object, float *number) const =0
 Convert the property value to a number. More...
 
virtual bool ToString (void *object, char *buffer, size_t *length) const =0
 Convert the property value to a string value. More...
 
virtual bool ToColor (void *object, renoir::Color *color) const =0
 Convert the property value to a color value. More...
 
virtual bool ToTransformMatrix2D (void *object, float matrix[6]) const =0
 Convert the property value to a matrix. More...
 
virtual bool ToArray (Binder *binder, void *object, ArrayInfo *arrayInfo) const =0
 Convert the property value to a array type information. More...
 
virtual bool ToObject (Binder *binder, void *object, ObjectInfo *typeInfo) const =0
 Convert the property value to a object type information. More...
 

Detailed Description

Represents a property of a type exposed to the scripting.

Constructor & Destructor Documentation

◆ Property()

cohtml::Property::Property ( const char *  name,
bool  isByRef = true 
)
inline

Create a new property.

Parameters
name- name of the property. This name will be used in the scripting
isByRef- whether this property can be exposed ByRef to the scripting
Note
name must live until cohtml::IViewListener::OnBindingsReleased is called.

Member Function Documentation

◆ Bind()

virtual void* cohtml::Property::Bind ( Binder binder,
void *  object 
) const
pure virtual

Expose the property's name and value to a binder.

Parameters
binder- the binder to use
object- object to get the property value from
Returns
- adjusted object pointer if necessary

◆ BindValue()

virtual void* cohtml::Property::BindValue ( Binder binder,
void *  object 
) const
pure virtual

Expose only the value of the property to a binder.

Parameters
binder- the binder to use
object- object to get the property value from
Returns
- adjusted object pointer if necessary

◆ Clone()

virtual Property* cohtml::Property::Clone ( ) const
pure virtual

Clone the property.

Returns
a heap allocated copy of the property

◆ GetName()

const char* cohtml::Property::GetName ( ) const
inline

Get the name of the property.

Returns
the name of the property

◆ IsByRef()

bool cohtml::Property::IsByRef ( ) const
inline

Can this property be exported By-Ref. Temporaries can not be exported by reference.

Returns
true if the property can be exported safely by reference.

◆ Read()

virtual void* cohtml::Property::Read ( Binder binder,
void *  object 
) const
pure virtual

Read the value from a binder.

Parameters
binder- the binder to use
object- the object to set the property into
Returns
- adjusted object pointer if necessary

◆ ToArray()

virtual bool cohtml::Property::ToArray ( Binder binder,
void *  object,
ArrayInfo arrayInfo 
) const
pure virtual

Convert the property value to a array type information.

Parameters
binder- the binder to use
object- object to get the property value from
arrayInfo- information about array type - callbacks, properties, methods
Returns
true if conversion is possible and successful

◆ ToBoolean()

virtual bool cohtml::Property::ToBoolean ( void *  object,
bool *  boolean 
) const
pure virtual

Convert the property value to a boolean.

Parameters
object- object to get the property value from
boolean- where to store the property value
Returns
true if conversion is possible and successful

◆ ToColor()

virtual bool cohtml::Property::ToColor ( void *  object,
renoir::Color *  color 
) const
pure virtual

Convert the property value to a color value.

Parameters
object- object to get the property value from
color- where to store the property value
Returns
true if conversion is possible and successful

◆ ToNumber()

virtual bool cohtml::Property::ToNumber ( void *  object,
float *  number 
) const
pure virtual

Convert the property value to a number.

Parameters
object- object to get the property value from
number- where to store the property value
Returns
true if conversion is possible and successful

◆ ToObject()

virtual bool cohtml::Property::ToObject ( Binder binder,
void *  object,
ObjectInfo typeInfo 
) const
pure virtual

Convert the property value to a object type information.

Parameters
binder- the binder to use
object- object to get the property value from
typeInfo- information about object type - properties and methods if it's user defined type
Returns
true if conversion is possible and successful

◆ ToString()

virtual bool cohtml::Property::ToString ( void *  object,
char *  buffer,
size_t *  length 
) const
pure virtual

Convert the property value to a string value.

Parameters
object- object to get the property value from
buffer- char buffer for the value
length- where to store the length of the converted value
Returns
true if conversion is possible and successful

◆ ToTransformMatrix2D()

virtual bool cohtml::Property::ToTransformMatrix2D ( void *  object,
float  matrix[6] 
) const
pure virtual

Convert the property value to a matrix.

Parameters
object- object to get the property value from
matrix- where to store the property value
Returns
true if conversion is possible and successful