kexi

KoMacro::Variable Class Reference

#include <variable.h>

Inheritance diagram for KoMacro::Variable:

KoMacro::MetaParameter KexiMacro::KexiVariable< ACTIONIMPL > KexiMacro::ObjectNameVariable< ACTIONIMPL > KexiMacro::ObjectVariable< ACTIONIMPL >

List of all members.


Detailed Description

A variable value used to provide abstract access to variables.

The class handles QVariant and QObject and provides access to them. Variable inherits KShared and implements reference couting. So, it's not needed to take care of memory-managment.

Definition at line 38 of file variable.h.


Public Types

typedef QValueList< KSharedPtr
< Variable > > 
List
typedef QMap< QString,
KSharedPtr< Variable > > 
Map

Public Member Functions

 Variable ()
 Variable (const QVariant &variant, const QString &name=QString::null, const QString &text=QString::null)
 Variable (const QObject *object)
 Variable (const QDomElement &element)
virtual ~Variable ()
QString name () const
void setName (const QString &name)
QString text () const
void setText (const QString &text)
void setObject (const QObject *object)
const QVariant variant () const
void setVariant (const QVariant &variant, bool detecttype=true)
const QObject * object () const
 operator QVariant () const
 operator const QObject * () const
const QString toString () const
int toInt () const
List children () const
void appendChild (KSharedPtr< Variable > variable)
void clearChildren ()
void setChildren (const List &children)

Properties

QVariant variant
QObject object
QString string

Member Typedef Documentation

typedef QValueList<KSharedPtr<Variable > > KoMacro::Variable::List

A list of variables.

Reimplemented from KoMacro::MetaParameter.

Definition at line 61 of file variable.h.

typedef QMap<QString, KSharedPtr<Variable > > KoMacro::Variable::Map

A map of variables.

Definition at line 66 of file variable.h.


Constructor & Destructor Documentation

Variable::Variable (  )  [explicit]

Default constructor.

Definition at line 79 of file variable.cpp.

Variable::Variable ( const QVariant &  variant,
const QString &  name = QString::null,
const QString &  text = QString::null 
)

Constructor from the QVariant variant .

Parameters:
variant The value this variable has.
name The unique name() this variable has.
text The describing text() this variable has.

Definition at line 87 of file variable.cpp.

Variable::Variable ( const QObject *  object  ) 

Constructor from the QObject object .

Parameters:
object The value this variable has.

Definition at line 98 of file variable.cpp.

Variable::Variable ( const QDomElement &  element  ) 

Constructor from the QDomElement element .

Deprecated:
replaced with methods of XMLHandler.
Parameters:
element The QDomElement that may optional contains the variable content or other additional informations.

Definition at line 106 of file variable.cpp.

Variable::~Variable (  )  [virtual]

Destructor.

Definition at line 132 of file variable.cpp.


Member Function Documentation

QString Variable::name (  )  const

Returns:
the name this Variable has.

Definition at line 137 of file variable.cpp.

void Variable::setName ( const QString &  name  ) 

Set the name.

Parameters:
name this Variable has.

Definition at line 142 of file variable.cpp.

QString Variable::text (  )  const

Returns:
the caption this Variable has.

Definition at line 147 of file variable.cpp.

void Variable::setText ( const QString &  text  ) 

Set the caption.

Parameters:
text this Variable has.

Definition at line 152 of file variable.cpp.

void Variable::setObject ( const QObject *  object  ) 

Set the QObject.

Parameters:
object this variable has. A previously remembered value will be overwritten and the new type is a TypeObject .

Definition at line 179 of file variable.cpp.

const QVariant KoMacro::Variable::variant (  )  const

Returns:
the QVariant this variable has. If this variable isn't a TypeVariant an invalid QVariant got returned.

void Variable::setVariant ( const QVariant &  variant,
bool  detecttype = true 
)

Set the QVariant.

Parameters:
variant this variable has. A previously remembered value will be overwritten and the new type is a TypeVariant . If
detecttype is true the method tries to set the variantType according to the passed QVariant. If false the variantType won't be changed.

Definition at line 165 of file variable.cpp.

const QObject* KoMacro::Variable::object (  )  const

Returns:
the QObject this variable has. If this variable isn't a TypeObject NULL got returned.

Variable::operator QVariant (  )  const

Implicit conversion to QVariant operator.

This method calls variant() internaly.

Definition at line 185 of file variable.cpp.

Variable::operator const QObject * (  )  const

Implicit conversion to QObject operator.

This method calls object() internaly.

Definition at line 190 of file variable.cpp.

const QString Variable::toString (  )  const

Returns:
a string-represenation of the variable.

Definition at line 195 of file variable.cpp.

int Variable::toInt (  )  const

Returns:
a integer-represenation of the variable.

Definition at line 211 of file variable.cpp.

Variable::List Variable::children (  )  const

Returns:
the optional list of Variable instances that are children of this Variable .
Note:
that the list is returned call-by-reference. The list is accessed as getter/setter (read/write). So, don't set this method to const!

Definition at line 216 of file variable.cpp.

void Variable::appendChild ( KSharedPtr< Variable variable  ) 

Append a Variable to the list of children this Variable has.

Definition at line 221 of file variable.cpp.

void Variable::clearChildren (  ) 

Clear the list of children this Variable has.

Definition at line 226 of file variable.cpp.

void Variable::setChildren ( const List children  ) 

Set the children this Variable has.

Definition at line 231 of file variable.cpp.


Property Documentation

const QVariant Variable::variant [read, write]

Property to get and set a QVariant as variable.

Definition at line 44 of file variable.h.

const QObject * Variable::object [read, write]

Property to get and set a QObject as variable.

Definition at line 49 of file variable.h.

QString KoMacro::Variable::string [read]

Property to get a string-representation of the variable.

Definition at line 54 of file variable.h.


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