lib

Kross::Api::Object Class Reference

#include <object.h>

Inheritance diagram for Kross::Api::Object:

Kross::Api::Callable Kross::Api::Exception Kross::Api::Value< T, V > Kross::Python::PythonObject Kross::Api::Value< Kross::Api::List, QMap< QString, Kross::Api::Object::Ptr > > Kross::Api::Value< Kross::Api::List, QValueList< Kross::Api::Object::KSharedPtr< List > > > Kross::Api::Value< Kross::Api::Variant, QVariant > Kross::Api::Event< Kross::Api::EventAction > Kross::Api::Event< Kross::Api::EventScript > Kross::Api::Event< Kross::Api::EventSignal > Kross::Api::Event< Kross::Api::EventSlot > Kross::Api::Event< Kross::Api::Module > Kross::Api::Event< Kross::Api::QtObject > Kross::Api::Event< T > Kross::Api::Dict Kross::Api::List Kross::Api::Variant

List of all members.


Detailed Description

The common Object class all other object-classes are inheritated from.

The Object class is used as base class to provide common functionality. It's similar to what we know in Python as PyObject or in Qt as QObject.

Inherited from e.g. Value, Module and Class .

This class implementates reference counting for shared objects. So, no need to take care of freeing objects.

Definition at line 50 of file object.h.


Public Types

typedef KSharedPtr< ObjectPtr

Public Member Functions

 Object ()
virtual ~Object ()
virtual const QString getClassName () const =0
virtual const QString toString ()
virtual Object::Ptr call (const QString &name, KSharedPtr< List > arguments)
virtual QStringList getCalls ()

Static Public Member Functions

template<class T>
static T * fromObject (Object::Ptr object)
template<typename TYPE>
static Object::Ptr toObject (TYPE t)

Member Typedef Documentation


Constructor & Destructor Documentation

Object::Object (  )  [explicit]

Constructor.

Definition at line 29 of file object.cpp.

Object::~Object (  )  [virtual]

Destructor.

Definition at line 37 of file object.cpp.


Member Function Documentation

virtual const QString Kross::Api::Object::getClassName (  )  const [pure virtual]

Return the class name.

This could be something like "Kross::Api::Object" for this object. The value is mainly used for display purposes.

Returns:
The name of this class.

Implemented in Kross::Api::Callable, Kross::Api::Dict, Kross::Api::EventAction, Kross::Api::EventScript, Kross::Api::EventSignal, Kross::Api::EventSlot, Kross::Api::Exception, Kross::Api::List, Kross::Api::QtObject, Kross::Api::Variant, Kross::Api::MainModule, and Kross::Python::PythonObject.

const QString Object::toString (  )  [virtual]

Returns:
a string representation of the object or it's content. This method is mainly used for debugging and testing purposes.

Reimplemented in Kross::Api::Dict, Kross::Api::Exception, Kross::Api::List, and Kross::Api::Variant.

Definition at line 45 of file object.cpp.

virtual Object::Ptr Kross::Api::Object::call ( const QString &  name,
KSharedPtr< List arguments 
) [virtual]

Pass a call to the object and evaluated it recursive down the object-hierachy.

Objects like Class are able to handle call's by just implementing this function. If the call is done the called() method will be executed recursive from bottom up the call hierachy.

Exceptions:
TypeException if the object or the name is not callable.
Parameters:
name Each call has a name that says what should be called. In the case of a Class the name is the functionname.
arguments The list of arguments passed to the call.
Returns:
The call-result as Object::Ptr instance or NULL if the call has no result.

Reimplemented in Kross::Api::EventScript, Kross::Api::EventSignal, and Kross::Api::EventSlot.

virtual QStringList Kross::Api::Object::getCalls (  )  [inline, virtual]

Return a list of supported callable objects.

Returns:
List of supported calls.

Reimplemented in Kross::Python::PythonObject.

Definition at line 109 of file object.h.

template<class T>
T * Kross::Api::Object::fromObject ( Object::Ptr  object  )  [inline, static]

Try to convert the Object instance to the template class T.

Exceptions:
TypeException if the cast failed.
Parameters:
object The Object to cast.
Returns:
The to a instance from template type T casted Object.

Definition at line 141 of file object.h.

template<typename TYPE>
static Object::Ptr Kross::Api::Object::toObject ( TYPE  t  )  [inline, static]

This method got used by the ProxyFunction classes to translate an unknown TYPE to a Object instance.

Classes like Value or ListT or Class are overwriting this method to transparently translate these passed type while this method just assumes that the type is already a Object instance.

Reimplemented in Kross::Api::Class< T >, Kross::Api::List, Kross::Api::ListT< OBJECT >, Kross::Api::Value< T, V >, Kross::Api::Class< Kross::Api::QtObject >, Kross::Api::Class< Kross::Api::Module >, Kross::Api::Value< Kross::Api::Variant, QVariant >, Kross::Api::Value< Kross::Api::List, QValueList< Kross::Api::Object::KSharedPtr< List > > >, and Kross::Api::Value< Kross::Api::List, QMap< QString, Kross::Api::Object::Ptr > >.

Definition at line 132 of file object.h.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys