PixelLightAPI  .
Public Member Functions
PLCore::Object Class Reference

Object base class. More...

#include <Object.h>

Inheritance diagram for PLCore::Object:
Inheritance graph
[legend]

List of all members.

Public Member Functions

PLCORE_API Object ()
 Constructor.
virtual PLCORE_API ~Object ()
 Destructor.
PLCORE_API bool IsInstanceOfByReference (const Class &cClass) const
 Check if object is instance of a given class by using a given class reference.
PLCORE_API bool IsInstanceOf (const String &sClass) const
 Check if object is instance of a given class.
PLCORE_API const List< DynVar * > GetAttributes () const
 Get attributes.
PLCORE_API DynVarGetAttribute (const String &sName) const
 Get attribute.
PLCORE_API void GetMethods (List< DynFuncPtr > &lstMethods)
 Get all callable methods.
PLCORE_API DynFuncPtr GetMethod (const String &sName)
 Get callable method by using a given method name.
PLCORE_API const List< DynEvent * > GetSignals () const
 Get a list of all signals.
PLCORE_API DynEventGetSignal (const String &sName) const
 Get signal by using a given signal name.
PLCORE_API const List
< DynEventHandler * > 
GetSlots () const
 Get a list of all slots.
PLCORE_API DynEventHandlerGetSlot (const String &sName) const
 Get slot by using a given slot name.
PLCORE_API void SetAttribute (const String &sName, const String &sValue)
 Set attribute value by using a given string value.
PLCORE_API void SetAttribute (const String &sName, const DynVar &cVar)
 Set attribute value by using a given dynamic variable reference.
PLCORE_API void SetAttribute (const String &sName, const DynVar *pVar)
 Set attribute value by using a given dynamic variable pointer.
PLCORE_API void SetAttributeDefault (const String &sName)
 Set attribute to it's default value.
PLCORE_API void CallMethod (const String &sName, DynParams &cParams)
 Call method with given dynamic parameters.
PLCORE_API void CallMethod (const String &sName, const DynParams &cParams)
 Call method with given constant dynamic parameters.
PLCORE_API void CallMethod (const String &sName, const String &sParams)
 Call method with parameters given as string.
PLCORE_API void CallMethod (const String &sName, const XmlElement &cElement)
 Call method with parameters given as XML element.
PLCORE_API String GetValues (EDefaultValue nDefaultValue=NoDefault) const
 Get attribute values as a string.
PLCORE_API void SetValues (const String &sVars)
 Set multiple attribute values as a string at once.
PLCORE_API void GetValuesXml (XmlElement &cElement, EDefaultValue nDefaultValue=NoDefault) const
 Get attribute values as XML.
PLCORE_API void SetValuesXml (const XmlElement &cElement)
 Set attribute values from XML.
PLCORE_API void SetDefaultValues ()
 Set all attributes to default.
virtual PLCORE_API String ToString () const
 Get object as string.
virtual PLCORE_API void FromString (const String &sString)
 Set object from string.
virtual PLCORE_API XmlElement ToXml () const
 Get object as XML.
virtual PLCORE_API void FromXml (const XmlElement &cElement)
 Set object from XML.

Detailed Description

Object base class.


Constructor & Destructor Documentation

PLCORE_API PLCore::Object::Object ( )
virtual PLCORE_API PLCore::Object::~Object ( ) [virtual]

Destructor.


Member Function Documentation

PLCORE_API bool PLCore::Object::IsInstanceOfByReference ( const Class cClass) const

Check if object is instance of a given class by using a given class reference.

Parameters:
[in]cClassClass
Returns:
'true' if the object is an instance of the class or one of it's derived classes, else 'false'
PLCORE_API bool PLCore::Object::IsInstanceOf ( const String sClass) const

Check if object is instance of a given class.

Parameters:
[in]sClassClass name (with namespace)
Returns:
'true' if the object is an instance of the class or one of it's derived classes, else 'false'
PLCORE_API const List<DynVar*> PLCore::Object::GetAttributes ( ) const

Get attributes.

Returns:
List of attributes (do not destroy the returned attribute instances)
Remarks:
Use this function with caution, as the list is assembled and copied each time the function is called! In general it is recommended to use GetClass()->GetAttributes() to obtain a list of attribute descriptors and then call GetAttribute() from the descriptor to get access to the actual attribute
PLCORE_API DynVar* PLCore::Object::GetAttribute ( const String sName) const

Get attribute.

Parameters:
[in]sNameAttribute name
Returns:
Attribute (do not destroy the returned instance, can be a null pointer, if no attribute with that name could be found)
PLCORE_API void PLCore::Object::GetMethods ( List< DynFuncPtr > &  lstMethods)

Get all callable methods.

Parameters:
[out]lstMethodsReceives the list of callable methods, the given list is not cleared before new entries are added (do not destroy the returned instances)
Remarks:
Performance warning: Use this function with caution, as the list is assembled and callable method instances are created each time the function is called! If you only need the method descriptors, use GetClass()->GetMethods() instead.
PLCORE_API DynFuncPtr PLCore::Object::GetMethod ( const String sName)

Get callable method by using a given method name.

Parameters:
[in]sNameMethod name
Returns:
Callable method (do not destroy the returned instance, can be a null pointer, if no method with that name could be found)
Remarks:
Performance warning: Use this function with caution, as the callable method instance is created each time the function is called! If you only need the method descriptor, use GetClass()->GetMethod() instead.
PLCORE_API const List<DynEvent*> PLCore::Object::GetSignals ( ) const

Get a list of all signals.

Returns:
List of signals (do not destroy the returned instances)
Remarks:
Use this function with caution, as the list is assembled and copied each time the function is called! In general it is recommended to use GetClass()->GetSignals() to obtain a list of signal descriptors and then call GetSignal() from the descriptor to get access to the actual signal
PLCORE_API DynEvent* PLCore::Object::GetSignal ( const String sName) const

Get signal by using a given signal name.

Parameters:
[in]sNameSignal name
Returns:
Signal (do not destroy the returned instance, can be a null pointer, if no signal with that name could be found)
PLCORE_API const List<DynEventHandler*> PLCore::Object::GetSlots ( ) const

Get a list of all slots.

Returns:
List of slots (do not destroy the returned instances)
Remarks:
Use this function with caution, as the list is assembled and copied each time the function is called! In general it is recommended to use GetClass()->GetSlots() to obtain a list of slot descriptors and then call GetSlot() from the descriptor to get access to the actual slot
PLCORE_API DynEventHandler* PLCore::Object::GetSlot ( const String sName) const

Get slot by using a given slot name.

Parameters:
[in]sNameSlot name
Returns:
Slot (do not destroy the returned instance, can be a null pointer, if no slot with that name could be found)
PLCORE_API void PLCore::Object::SetAttribute ( const String sName,
const String sValue 
)

Set attribute value by using a given string value.

Parameters:
[in]sNameAttribute name
[in]sValueAttribute value as string
PLCORE_API void PLCore::Object::SetAttribute ( const String sName,
const DynVar cVar 
)

Set attribute value by using a given dynamic variable reference.

Parameters:
[in]sNameAttribute name
[in]cVarAttribute value as dynamic variable reference
PLCORE_API void PLCore::Object::SetAttribute ( const String sName,
const DynVar pVar 
)

Set attribute value by using a given dynamic variable pointer.

Parameters:
[in]sNameAttribute name
[in]pVarAttribute value as dynamic variable pointer, in case of a null pointer, nothing happens at all
Remarks:
This is a comfort method allowing to write e.g. pFirstObject->SetAttribute("MyAttribute", pSecondObject->GetAttribute("MyAttribute")); instead of DynVar *pDynVar = pSecondObject->GetAttribute(); if (pDynVar) pFirstObject->SetAttribute("MyAttribute", *pDynVar); In case there's no such attribute in "pSecondObject", nothing happens at all.
PLCORE_API void PLCore::Object::SetAttributeDefault ( const String sName)

Set attribute to it's default value.

Parameters:
[in]sNameAttribute name
PLCORE_API void PLCore::Object::CallMethod ( const String sName,
DynParams cParams 
)

Call method with given dynamic parameters.

Parameters:
[in]sNameMethod name
[in]cParamsDynamic parameters
PLCORE_API void PLCore::Object::CallMethod ( const String sName,
const DynParams cParams 
)

Call method with given constant dynamic parameters.

Parameters:
[in]sNameMethod name
[in]cParamsConstant dynamic parameters
PLCORE_API void PLCore::Object::CallMethod ( const String sName,
const String sParams 
)

Call method with parameters given as string.

Parameters:
[in]sNameMethod name
[in]sParamsParameters as string
PLCORE_API void PLCore::Object::CallMethod ( const String sName,
const XmlElement cElement 
)

Call method with parameters given as XML element.

Parameters:
[in]sNameMethod name
[in]cElementParameters as XML element
PLCORE_API String PLCore::Object::GetValues ( EDefaultValue  nDefaultValue = NoDefault) const

Get attribute values as a string.

Parameters:
[in]nDefaultValue'WithDefault' to retrieve all attributes, 'NoDefault' to only retrieve attributes that are not set to default
Returns:
String containing attributes and values
Remarks:
The returned string contains the attributes and their values. Example: "Name='Test' IntValue='10'"
PLCORE_API void PLCore::Object::SetValues ( const String sVars)

Set multiple attribute values as a string at once.

Parameters:
[in]sVarsString containing attributes and values (e.g. "Name='Bob' Position='1 2 3'")
PLCORE_API void PLCore::Object::GetValuesXml ( XmlElement cElement,
EDefaultValue  nDefaultValue = NoDefault 
) const

Get attribute values as XML.

Parameters:
[out]cElementXML element
[in]nDefaultValue'WithDefault' to retrieve all attributes, 'NoDefault' to only retrieve attributes that are not set to default
Remarks:
The attributes and their values are added as XML-attributes to the given XML-element
PLCORE_API void PLCore::Object::SetValuesXml ( const XmlElement cElement)

Set attribute values from XML.

Parameters:
[out]cElementXML element
Remarks:
The attributes and their values are read from the XML-attributes of the given XML-element
PLCORE_API void PLCore::Object::SetDefaultValues ( )

Set all attributes to default.

virtual PLCORE_API String PLCore::Object::ToString ( ) const [virtual]

Get object as string.

Returns:
String representation of object
virtual PLCORE_API void PLCore::Object::FromString ( const String sString) [virtual]

Set object from string.

Parameters:
[in]sStringString representation of object
virtual PLCORE_API XmlElement PLCore::Object::ToXml ( ) const [virtual]

Get object as XML.

Returns:
XML representation of object
virtual PLCORE_API void PLCore::Object::FromXml ( const XmlElement cElement) [virtual]

Set object from XML.

Parameters:
[in]cElementXML representation of object

The documentation for this class was generated from the following file:


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:09:23
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported