1.26.2.1
Gameface
cohtml::Binder Class Referenceabstract

Provides binding between C++ and the UI. More...

Public Types

enum  BindingMode { BM_Value, BM_Scoped, BM_GetTypeInfo }
 
typedef void(* ArrayElementReader) (Binder *, void *, size_t)
 
typedef void(* ArrayElementBinder) (Binder *, void *, size_t)
 
typedef size_t(* ArrayLengthGetter) (void *)
 

Public Member Functions

virtual ~Binder ()=0
 
 Binder ()
 
virtual TypeDescription RegisterType (const char *name, void *object)
 Register type in the binding. More...
 
virtual TypeDescription RegisterType (const char *name, const void *object)
 Register type in the binding. More...
 
virtual void AddProperty (void *object, const Property &property)
 
virtual void AddMethod (const char *name, IEventHandler *method)
 
virtual void BeginType ()
 
virtual void ReadType ()
 
virtual TypeInfo * GetTypeInfo () const
 
virtual void EndType (void *)
 
virtual void BeginEvent (const char *eventName, int arguments)=0
 
virtual void EndEvent ()=0
 
virtual void BeginExposeObject ()=0
 
virtual void SetAsGlobal (const char *name, void *object)=0
 
virtual void SetMode (BindingMode mode)=0
 
virtual Binder::BindingMode GetMode ()=0
 
virtual bool BindObject (TypeInfo *type, void *object)=0
 
virtual void TypeName (const char *name)=0
 
virtual void PropertyName (const char *name)=0
 
virtual void BindNull ()=0
 
virtual void Bind (bool value)=0
 
virtual void Bind (signed short value)=0
 
virtual void Bind (unsigned short value)=0
 
virtual void Bind (signed int value)=0
 
virtual void Bind (unsigned int value)=0
 
virtual void Bind (signed long long value)=0
 
virtual void Bind (unsigned long long value)=0
 
virtual void Bind (signed long value)=0
 
virtual void Bind (unsigned long value)=0
 
virtual void Bind (signed char value)=0
 
virtual void Bind (unsigned char value)=0
 
virtual void Bind (float value)=0
 
virtual void Bind (double value)=0
 
virtual void Bind (const char *value)=0
 
virtual void Bind (const wchar_t *value)=0
 
virtual void Bind (const char16_t *value)=0
 
virtual void Bind (const char32_t *value)=0
 
virtual void BindArray (const int *values, size_t count)=0
 
virtual void BindArray (const float *values, size_t count)=0
 
virtual bool TryBindArrayByRef (void *arr, size_t size, ArrayElementBinder elementBinder, ArrayElementReader elementReader)=0
 Deprecated Use TryBindArrayByRef(void* arr, ArrayElementBinder elementBinder, ArrayElementReader elementReader, ArrayLengthGetter lengthGetter) More...
 
virtual bool TryBindArrayByRef (void *arr, ArrayElementBinder elementBinder, ArrayElementReader elementReader, ArrayLengthGetter lengthGetter)=0
 
virtual void ArrayBegin (size_t size)=0
 Start exporting an array. More...
 
virtual void ArrayEnd ()=0
 End exporting an array. More...
 
virtual void MapBegin (size_t size)=0
 Start exporting a map (object) More...
 
virtual void MapEnd ()=0
 End exporting a map. More...
 
virtual void OnTypeBegin ()=0
 
virtual void OnTypeEnd ()=0
 
virtual void OnReadTypeBegin ()=0
 
virtual void OnReadTypeEnd ()=0
 
virtual void ReadNull ()=0
 
virtual void Read (bool &value)=0
 
virtual void Read (signed short &value)=0
 
virtual void Read (unsigned short &value)=0
 
virtual void Read (signed int &value)=0
 
virtual void Read (unsigned int &value)=0
 
virtual void Read (signed long long &value)=0
 
virtual void Read (unsigned long long &value)=0
 
virtual void Read (signed long &value)=0
 
virtual void Read (unsigned long &value)=0
 
virtual void Read (char &value)=0
 
virtual void Read (signed char &value)=0
 
virtual void Read (unsigned char &value)=0
 
virtual void Read (float &value)=0
 
virtual void Read (double &value)=0
 
virtual void Read (const char *&buffer, size_t &size)=0
 
virtual void Read (const wchar_t *&value, size_t &size)=0
 
virtual void Read (const char16_t *&value, size_t &size)=0
 
virtual void Read (const char32_t *&value, size_t &size)=0
 
virtual bool ReadProperty (const char *name)=0
 
virtual bool ReadType (const char *name)=0
 
virtual size_t ReadArrayBegin ()=0
 Start reading an array. More...
 
virtual void ReadArrayElement (size_t index)=0
 Read element from an array. More...
 
virtual void ReadArrayEnd ()=0
 End reading an array. More...
 
virtual size_t ReadMapBegin ()=0
 Start reading a map (object) More...
 
virtual void ReadKeyValuePair ()=0
 Read next key-value pair from a map. More...
 
virtual void ReadMapEnd ()=0
 End reading a map. More...
 
virtual ValueType PeekValueType ()=0
 Peek the type of the current value. More...
 

Protected Member Functions

 Binder (const Binder &)
 
Binderoperator= (const Binder &)
 

Protected Attributes

BinderImpl * m_Impl
 

Friends

class TypeDescription
 

Detailed Description

Provides binding between C++ and the UI.

Member Typedef Documentation

◆ ArrayElementBinder

typedef void(* cohtml::Binder::ArrayElementBinder) (Binder *, void *, size_t)

◆ ArrayElementReader

typedef void(* cohtml::Binder::ArrayElementReader) (Binder *, void *, size_t)

◆ ArrayLengthGetter

typedef size_t(* cohtml::Binder::ArrayLengthGetter) (void *)

Member Enumeration Documentation

◆ BindingMode

Enumerator
BM_Value 
BM_Scoped 
BM_GetTypeInfo 

Constructor & Destructor Documentation

◆ ~Binder()

virtual cohtml::Binder::~Binder ( )
pure virtual

◆ Binder() [1/2]

cohtml::Binder::Binder ( )

◆ Binder() [2/2]

cohtml::Binder::Binder ( const Binder )
protected

Member Function Documentation

◆ AddMethod()

virtual void cohtml::Binder::AddMethod ( const char *  name,
IEventHandler method 
)
virtual

◆ AddProperty()

virtual void cohtml::Binder::AddProperty ( void *  object,
const Property property 
)
virtual

◆ ArrayBegin()

virtual void cohtml::Binder::ArrayBegin ( size_t  size)
pure virtual

Start exporting an array.

Parameters
sizesize of the array

◆ ArrayEnd()

virtual void cohtml::Binder::ArrayEnd ( )
pure virtual

End exporting an array.

◆ BeginEvent()

virtual void cohtml::Binder::BeginEvent ( const char *  eventName,
int  arguments 
)
pure virtual

◆ BeginExposeObject()

virtual void cohtml::Binder::BeginExposeObject ( )
pure virtual

◆ BeginType()

virtual void cohtml::Binder::BeginType ( )
virtual

◆ Bind() [1/17]

virtual void cohtml::Binder::Bind ( bool  value)
pure virtual

◆ Bind() [2/17]

virtual void cohtml::Binder::Bind ( signed short  value)
pure virtual

◆ Bind() [3/17]

virtual void cohtml::Binder::Bind ( unsigned short  value)
pure virtual

◆ Bind() [4/17]

virtual void cohtml::Binder::Bind ( signed int  value)
pure virtual

◆ Bind() [5/17]

virtual void cohtml::Binder::Bind ( unsigned int  value)
pure virtual

◆ Bind() [6/17]

virtual void cohtml::Binder::Bind ( signed long long  value)
pure virtual

◆ Bind() [7/17]

virtual void cohtml::Binder::Bind ( unsigned long long  value)
pure virtual

◆ Bind() [8/17]

virtual void cohtml::Binder::Bind ( signed long  value)
pure virtual

◆ Bind() [9/17]

virtual void cohtml::Binder::Bind ( unsigned long  value)
pure virtual

◆ Bind() [10/17]

virtual void cohtml::Binder::Bind ( signed char  value)
pure virtual

◆ Bind() [11/17]

virtual void cohtml::Binder::Bind ( unsigned char  value)
pure virtual

◆ Bind() [12/17]

virtual void cohtml::Binder::Bind ( float  value)
pure virtual

◆ Bind() [13/17]

virtual void cohtml::Binder::Bind ( double  value)
pure virtual

◆ Bind() [14/17]

virtual void cohtml::Binder::Bind ( const char *  value)
pure virtual

◆ Bind() [15/17]

virtual void cohtml::Binder::Bind ( const wchar_t *  value)
pure virtual

◆ Bind() [16/17]

virtual void cohtml::Binder::Bind ( const char16_t *  value)
pure virtual

◆ Bind() [17/17]

virtual void cohtml::Binder::Bind ( const char32_t *  value)
pure virtual

◆ BindArray() [1/2]

virtual void cohtml::Binder::BindArray ( const int *  values,
size_t  count 
)
pure virtual

◆ BindArray() [2/2]

virtual void cohtml::Binder::BindArray ( const float *  values,
size_t  count 
)
pure virtual

◆ BindNull()

virtual void cohtml::Binder::BindNull ( )
pure virtual

◆ BindObject()

virtual bool cohtml::Binder::BindObject ( TypeInfo *  type,
void *  object 
)
pure virtual

◆ EndEvent()

virtual void cohtml::Binder::EndEvent ( )
pure virtual

◆ EndType()

virtual void cohtml::Binder::EndType ( void *  )
virtual

◆ GetMode()

virtual Binder::BindingMode cohtml::Binder::GetMode ( )
pure virtual

◆ GetTypeInfo()

virtual TypeInfo* cohtml::Binder::GetTypeInfo ( ) const
virtual

◆ MapBegin()

virtual void cohtml::Binder::MapBegin ( size_t  size)
pure virtual

Start exporting a map (object)

Parameters
sizesize of the map

◆ MapEnd()

virtual void cohtml::Binder::MapEnd ( )
pure virtual

End exporting a map.

◆ OnReadTypeBegin()

virtual void cohtml::Binder::OnReadTypeBegin ( )
pure virtual

◆ OnReadTypeEnd()

virtual void cohtml::Binder::OnReadTypeEnd ( )
pure virtual

◆ OnTypeBegin()

virtual void cohtml::Binder::OnTypeBegin ( )
pure virtual

◆ OnTypeEnd()

virtual void cohtml::Binder::OnTypeEnd ( )
pure virtual

◆ operator=()

Binder& cohtml::Binder::operator= ( const Binder )
protected

◆ PeekValueType()

virtual ValueType cohtml::Binder::PeekValueType ( )
pure virtual

Peek the type of the current value.

Returns
the type of the current value

◆ PropertyName()

virtual void cohtml::Binder::PropertyName ( const char *  name)
pure virtual

◆ Read() [1/18]

virtual void cohtml::Binder::Read ( bool &  value)
pure virtual

◆ Read() [2/18]

virtual void cohtml::Binder::Read ( signed short &  value)
pure virtual

◆ Read() [3/18]

virtual void cohtml::Binder::Read ( unsigned short &  value)
pure virtual

◆ Read() [4/18]

virtual void cohtml::Binder::Read ( signed int &  value)
pure virtual

◆ Read() [5/18]

virtual void cohtml::Binder::Read ( unsigned int &  value)
pure virtual

◆ Read() [6/18]

virtual void cohtml::Binder::Read ( signed long long &  value)
pure virtual

◆ Read() [7/18]

virtual void cohtml::Binder::Read ( unsigned long long &  value)
pure virtual

◆ Read() [8/18]

virtual void cohtml::Binder::Read ( signed long &  value)
pure virtual

◆ Read() [9/18]

virtual void cohtml::Binder::Read ( unsigned long &  value)
pure virtual

◆ Read() [10/18]

virtual void cohtml::Binder::Read ( char &  value)
pure virtual

◆ Read() [11/18]

virtual void cohtml::Binder::Read ( signed char &  value)
pure virtual

◆ Read() [12/18]

virtual void cohtml::Binder::Read ( unsigned char &  value)
pure virtual

◆ Read() [13/18]

virtual void cohtml::Binder::Read ( float &  value)
pure virtual

◆ Read() [14/18]

virtual void cohtml::Binder::Read ( double &  value)
pure virtual

◆ Read() [15/18]

virtual void cohtml::Binder::Read ( const char *&  buffer,
size_t &  size 
)
pure virtual

◆ Read() [16/18]

virtual void cohtml::Binder::Read ( const wchar_t *&  value,
size_t &  size 
)
pure virtual

◆ Read() [17/18]

virtual void cohtml::Binder::Read ( const char16_t *&  value,
size_t &  size 
)
pure virtual

◆ Read() [18/18]

virtual void cohtml::Binder::Read ( const char32_t *&  value,
size_t &  size 
)
pure virtual

◆ ReadArrayBegin()

virtual size_t cohtml::Binder::ReadArrayBegin ( )
pure virtual

Start reading an array.

Returns
the size of the array

◆ ReadArrayElement()

virtual void cohtml::Binder::ReadArrayElement ( size_t  index)
pure virtual

Read element from an array.

Parameters
indexthe index of the element in the array

◆ ReadArrayEnd()

virtual void cohtml::Binder::ReadArrayEnd ( )
pure virtual

End reading an array.

◆ ReadKeyValuePair()

virtual void cohtml::Binder::ReadKeyValuePair ( )
pure virtual

Read next key-value pair from a map.

◆ ReadMapBegin()

virtual size_t cohtml::Binder::ReadMapBegin ( )
pure virtual

Start reading a map (object)

Returns
the size of the map

◆ ReadMapEnd()

virtual void cohtml::Binder::ReadMapEnd ( )
pure virtual

End reading a map.

◆ ReadNull()

virtual void cohtml::Binder::ReadNull ( )
pure virtual

◆ ReadProperty()

virtual bool cohtml::Binder::ReadProperty ( const char *  name)
pure virtual

◆ ReadType() [1/2]

virtual void cohtml::Binder::ReadType ( )
virtual

◆ ReadType() [2/2]

virtual bool cohtml::Binder::ReadType ( const char *  name)
pure virtual

◆ RegisterType() [1/2]

virtual TypeDescription cohtml::Binder::RegisterType ( const char *  name,
void *  object 
)
virtual

Register type in the binding.

Parameters
namename for the type
objectinstance of this type
Returns
TypeDescription object to be used to describe the properties of object
Warning
The name of the type should be unique for each type. Using duplicated names is undefined behavior

◆ RegisterType() [2/2]

virtual TypeDescription cohtml::Binder::RegisterType ( const char *  name,
const void *  object 
)
virtual

Register type in the binding.

Parameters
namename for the type
objectinstance of this type
Returns
TypeDescription object to be used to describe the properties of object
Warning
The name of the type should be unique for each type. Using duplicated names is undefined behavior

◆ SetAsGlobal()

virtual void cohtml::Binder::SetAsGlobal ( const char *  name,
void *  object 
)
pure virtual

◆ SetMode()

virtual void cohtml::Binder::SetMode ( BindingMode  mode)
pure virtual

◆ TryBindArrayByRef() [1/2]

virtual bool cohtml::Binder::TryBindArrayByRef ( void *  arr,
size_t  size,
ArrayElementBinder  elementBinder,
ArrayElementReader  elementReader 
)
pure virtual

Deprecated Use TryBindArrayByRef(void* arr, ArrayElementBinder elementBinder, ArrayElementReader elementReader, ArrayLengthGetter lengthGetter)

◆ TryBindArrayByRef() [2/2]

virtual bool cohtml::Binder::TryBindArrayByRef ( void *  arr,
ArrayElementBinder  elementBinder,
ArrayElementReader  elementReader,
ArrayLengthGetter  lengthGetter 
)
pure virtual

◆ TypeName()

virtual void cohtml::Binder::TypeName ( const char *  name)
pure virtual

Friends And Related Function Documentation

◆ TypeDescription

friend class TypeDescription
friend

Member Data Documentation

◆ m_Impl

BinderImpl* cohtml::Binder::m_Impl
protected