filters

AIElement Class Reference

#include <aielement.h>

List of all members.


Detailed Description

Author:

Definition at line 33 of file aielement.h.


Public Types

enum  Type {
  Invalid, String, Int, UInt,
  Double, CString, Operator, Reference,
  ElementArray, Block, ByteArray, Byte
}

Public Member Functions

 AIElement ()
 ~AIElement ()
 AIElement (const AIElement &)
 AIElement (const QString &, Type type=String)
 AIElement (const QCString &)
 AIElement (const char *)
 AIElement (const QValueVector< AIElement > &, Type type=ElementArray)
 AIElement (int)
 AIElement (uint)
 AIElement (double)
 AIElement (const QByteArray &)
 AIElement (uchar)
AIElementoperator= (const AIElement &)
bool operator== (const AIElement &) const
bool operator!= (const AIElement &) const
Type type () const
const char * typeName () const
bool canCast (Type) const
bool cast (Type)
bool isValid () const
void clear ()
const QString toString () const
const QCString toCString () const
int toInt (bool *ok=0) const
uint toUInt (bool *ok=0) const
double toDouble (bool *ok=0) const
const QValueVector< AIElementtoElementArray () const
const QValueVector< AIElementtoBlock () const
const QString toReference () const
const QString toOperator () const
const QByteArray toByteArray () const
uchar toByte (bool *ok=0) const
QString & asString ()
QCString & asCString ()
int & asInt ()
uint & asUInt ()
double & asDouble ()
QValueVector< AIElement > & asElementArray ()
QValueVector< AIElement > & asBlock ()
QString & asReference ()
QString & asToken ()
QByteArray & asByteArray ()
uchar & asByte ()

Static Public Member Functions

static const char * typeToName (Type typ)
static Type nameToType (const char *name)

Constructor & Destructor Documentation

AIElement::AIElement (  ) 

Constructs an invalid aielement.

Definition at line 117 of file aielement.cc.

AIElement::~AIElement (  ) 

Destroys the AIElement and the contained object.

Note that subclasses that reimplement clear() should reimplement the destructor to call clear(). This destructor calls clear(), but because it is the destructor, AIElement::clear() is called rather than a subclass's clear().

Definition at line 130 of file aielement.cc.

AIElement::AIElement ( const AIElement p  ) 

Constructs a copy of the aielement, p, passed as the argument to this constructor. Usually this is a deep copy, but a shallow copy is made if the stored data type is explicitly shared, as e.g. QImage is.

Definition at line 141 of file aielement.cc.

AIElement::AIElement ( const QString &  val,
Type  type = String 
)

Constructs a new aielement with a string value, val.

Definition at line 150 of file aielement.cc.

AIElement::AIElement ( const QCString &  val  ) 

Constructs a new aielement with a C-string value, val.

If you want to modify the QCString after you've passed it to this constructor, we recommend passing a deep copy (see QCString::copy()).

Definition at line 164 of file aielement.cc.

AIElement::AIElement ( const char *  val  ) 

Constructs a new aielement with a C-string value of val if val is non-null. The aielement creates a deep copy of val.

If val is null, the resulting aielement has type Invalid.

Definition at line 177 of file aielement.cc.

AIElement::AIElement ( const QValueVector< AIElement > &  val,
Type  type = ElementArray 
)

Constructs a new aielement with a list value, val.

Definition at line 237 of file aielement.cc.

AIElement::AIElement ( int  val  ) 

Constructs a new aielement with an integer value, val.

Definition at line 189 of file aielement.cc.

AIElement::AIElement ( uint  val  ) 

Constructs a new aielement with an unsigned integer value, val.

Definition at line 199 of file aielement.cc.

AIElement::AIElement ( double  val  ) 

Constructs a new aielement with a floating point value, val.

Definition at line 220 of file aielement.cc.

AIElement::AIElement ( uchar  val  ) 

Constructs a new aielement with an byte value, val.

Definition at line 209 of file aielement.cc.


Member Function Documentation

AIElement & AIElement::operator= ( const AIElement aielement  ) 

Assigns the value of the aielement aielement to this aielement.

This is a deep copy of the aielement, but note that if the aielement holds an explicitly shared type such as QImage, a shallow copy is performed.

Definition at line 258 of file aielement.cc.

bool AIElement::operator== ( const AIElement v  )  const

Compares this AIElement with v and returns TRUE if they are equal; otherwise returns FALSE.

Definition at line 763 of file aielement.cc.

bool AIElement::operator!= ( const AIElement v  )  const

Compares this AIElement with v and returns TRUE if they are not equal; otherwise returns FALSE.

Definition at line 801 of file aielement.cc.

const char * AIElement::typeName (  )  const

Returns the name of the type stored in the aielement. The returned strings describe the C++ datatype used to store the data: for example, "QFont", "QString", or "QValueList<AIElement>". An Invalid aielement returns 0.

Definition at line 289 of file aielement.cc.

bool AIElement::canCast ( Type  t  )  const

Returns TRUE if the aielement's type can be cast to the requested type, t. Such casting is done automatically when calling the toInt(), ... or asInt(), ... methods.

The following casts are done automatically:

  • CString => String
  • Double => String, Int, UInt
  • Int => String, Double, UInt
  • String => CString, Int, Uint, Double
  • UInt => String, Double, Int

Definition at line 686 of file aielement.cc.

bool AIElement::cast ( Type  t  ) 

Casts the aielement to the requested type.

If the cast cannot be done, the aielement is set to the default value of the requested type (e.g. an empty string if the requested type t is AIElement::String, an empty point array if the requested type t is AIElement::PointArray, etc).

Returns:
TRUE if the current type of the aielement was successfully casted; otherwise returns FALSE.
See also:
canCast()

Definition at line 719 of file aielement.cc.

void AIElement::clear (  ) 

Convert this aielement to type Invalid and free up any resources used.

Definition at line 297 of file aielement.cc.

const QString AIElement::toString (  )  const

Returns the aielement as a QString if the aielement has type() String, CString, ByteArray, Int, Uint, Double, or QString::null otherwise.

See also:
asString()

Definition at line 360 of file aielement.cc.

const QCString AIElement::toCString (  )  const

Returns the aielement as a QCString if the aielement has type() CString or String, or a 0 otherwise.

See also:
asCString()

Definition at line 397 of file aielement.cc.

int AIElement::toInt ( bool *  ok = 0  )  const

Returns the aielement as an int if the aielement has type() String, CString, Int, UInt, Double, Byte, or 0 otherwise.

If ok is non-null, *ok is set to TRUE if the value could be converted to an int and FALSE otherwise.

See also:
asInt() canCast()

Definition at line 421 of file aielement.cc.

uint AIElement::toUInt ( bool *  ok = 0  )  const

Returns the aielement as an unsigned int if the aielement has type() String, CString, UInt, Int, Double, Byte, or 0 otherwise.

If ok is non-null, *ok is set to TRUE if the value could be converted to a uint and FALSE otherwise.

See also:
asUInt()

Definition at line 469 of file aielement.cc.

double AIElement::toDouble ( bool *  ok = 0  )  const

Returns the aielement as a double if the aielement has type() String, CString, Double, Int, UInt, Byte, or 0.0 otherwise.

If ok is non-null, *ok is set to TRUE if the value could be converted to a double and FALSE otherwise.

See also:
asDouble()

Definition at line 498 of file aielement.cc.

const QValueVector< AIElement > AIElement::toElementArray (  )  const

Returns the aielement as a QValueList<AIElement> if the aielement has type() List or StringList, or an empty list otherwise.

Note that if you want to iterate over the list, you should iterate over a copy, e.g.

    QValueList<AIElement> list = myAIElement.toList();
    QValueList<AIElement>::Iterator it = list.begin();
    while( it != list.end() ) {
    myProcessing( *it );
    ++it;
    }

See also:
asList()

Definition at line 541 of file aielement.cc.

int & AIElement::asInt (  ) 

Returns the aielement's value as int reference.

Definition at line 572 of file aielement.cc.

uint & AIElement::asUInt (  ) 

Returns the aielement's value as unsigned int reference.

Definition at line 587 of file aielement.cc.

double & AIElement::asDouble (  ) 

Returns the aielement's value as double reference.

Definition at line 602 of file aielement.cc.

QValueVector< AIElement > & AIElement::asElementArray (  ) 

Returns the aielement's value as aielement list reference.

Note that if you want to iterate over the list, you should iterate over a copy, e.g.

    QValueList<AIElement> list = myAIElement.asList();
    QValueList<AIElement>::Iterator it = list.begin();
    while( it != list.end() ) {
    myProcessing( *it );
    ++it;
    }

Definition at line 650 of file aielement.cc.

uchar & AIElement::asByte (  ) 

Returns the aielement's value as byte reference.

Definition at line 616 of file aielement.cc.

const char * AIElement::typeToName ( Type  typ  )  [static]

Converts the enum representation of the storage type, typ, to its string representation.

Definition at line 330 of file aielement.cc.

AIElement::Type AIElement::nameToType ( const char *  name  )  [static]

Converts the string representation of the storage type gven in name, to its enum representation.

If the string representation cannot be converted to any enum representation, the aielement is set to Invalid.

Definition at line 344 of file aielement.cc.


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