filters

#include <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 TQString &, Type type=String)
 
 AIElement (const TQCString &)
 
 AIElement (const char *)
 
 AIElement (const TQValueVector< AIElement > &, Type type=ElementArray)
 
 AIElement (int)
 
 AIElement (uint)
 
 AIElement (double)
 
 AIElement (const TQByteArray &)
 
 AIElement (uchar)
 
AIElement & operator= (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 TQString toString () const
 
const TQCString toCString () const
 
int toInt (bool *ok=0) const
 
uint toUInt (bool *ok=0) const
 
double toDouble (bool *ok=0) const
 
const TQValueVector< AIElement > toElementArray () const
 
const TQValueVector< AIElement > toBlock () const
 
const TQString toReference () const
 
const TQString toOperator () const
 
const TQByteArray toByteArray () const
 
uchar toByte (bool *ok=0) const
 
TQString & asString ()
 
TQCString & asCString ()
 
int & asInt ()
 
uint & asUInt ()
 
double & asDouble ()
 
TQValueVector< AIElement > & asElementArray ()
 
TQValueVector< AIElement > & asBlock ()
 
TQString & asReference ()
 
TQString & asToken ()
 
TQByteArray & asByteArray ()
 
uchar & asByte ()
 

Static Public Member Functions

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

Detailed Description

Author

Definition at line 33 of file aielement.h.

Member Enumeration Documentation

◆ Type

enum AIElement::Type

Definition at line 35 of file aielement.h.

Constructor & Destructor Documentation

◆ AIElement() [1/11]

AIElement::AIElement ( )

Constructs an invalid aielement.

Definition at line 117 of file aielement.cpp.

◆ ~AIElement()

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.cpp.

◆ AIElement() [2/11]

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. TQImage is.

Definition at line 141 of file aielement.cpp.

◆ AIElement() [3/11]

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

Constructs a new aielement with a string value, val.

Definition at line 150 of file aielement.cpp.

◆ AIElement() [4/11]

AIElement::AIElement ( const TQCString &  val)

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

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

Definition at line 164 of file aielement.cpp.

◆ AIElement() [5/11]

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.cpp.

◆ AIElement() [6/11]

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

Constructs a new aielement with a list value, val.

Definition at line 237 of file aielement.cpp.

◆ AIElement() [7/11]

AIElement::AIElement ( int  val)

Constructs a new aielement with an integer value, val.

Definition at line 189 of file aielement.cpp.

◆ AIElement() [8/11]

AIElement::AIElement ( uint  val)

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

Definition at line 199 of file aielement.cpp.

◆ AIElement() [9/11]

AIElement::AIElement ( double  val)

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

Definition at line 220 of file aielement.cpp.

◆ AIElement() [10/11]

AIElement::AIElement ( const TQByteArray &  val)

Definition at line 244 of file aielement.cpp.

◆ AIElement() [11/11]

AIElement::AIElement ( uchar  val)

Constructs a new aielement with an byte value, val.

Definition at line 209 of file aielement.cpp.

Member Function Documentation

◆ asBlock()

TQValueVector< AIElement > & AIElement::asBlock ( )

Definition at line 657 of file aielement.cpp.

◆ asByte()

uchar & AIElement::asByte ( )

Returns the aielement's value as byte reference.

Definition at line 616 of file aielement.cpp.

◆ asByteArray()

TQByteArray & AIElement::asByteArray ( )

Definition at line 665 of file aielement.cpp.

◆ asDouble()

double & AIElement::asDouble ( )

Returns the aielement's value as double reference.

Definition at line 602 of file aielement.cpp.

◆ asElementArray()

TQValueVector< 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.

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

Definition at line 650 of file aielement.cpp.

◆ asInt()

int & AIElement::asInt ( )

Returns the aielement's value as int reference.

Definition at line 572 of file aielement.cpp.

◆ asUInt()

uint & AIElement::asUInt ( )

Returns the aielement's value as unsigned int reference.

Definition at line 587 of file aielement.cpp.

◆ canCast()

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.cpp.

◆ cast()

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.cpp.

◆ clear()

void AIElement::clear ( )

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

Definition at line 297 of file aielement.cpp.

◆ isValid()

bool AIElement::isValid ( ) const
inline

Definition at line 146 of file aielement.h.

◆ nameToType()

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.cpp.

◆ operator!=()

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.cpp.

◆ operator=()

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 TQImage, a shallow copy is performed.

Definition at line 258 of file aielement.cpp.

◆ operator==()

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.cpp.

◆ toBlock()

const TQValueVector< AIElement > AIElement::toBlock ( ) const

Definition at line 548 of file aielement.cpp.

◆ toByte()

uchar AIElement::toByte ( bool *  ok = 0) const

Definition at line 440 of file aielement.cpp.

◆ toByteArray()

const TQByteArray AIElement::toByteArray ( ) const

Definition at line 556 of file aielement.cpp.

◆ toCString()

const TQCString AIElement::toCString ( ) const

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

See also
asCString()

Definition at line 397 of file aielement.cpp.

◆ toDouble()

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.cpp.

◆ toElementArray()

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

Returns the aielement as a TQValueList<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.

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

Definition at line 541 of file aielement.cpp.

◆ toInt()

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.cpp.

◆ toOperator()

const TQString AIElement::toOperator ( ) const

Definition at line 384 of file aielement.cpp.

◆ toReference()

const TQString AIElement::toReference ( ) const

Definition at line 377 of file aielement.cpp.

◆ toString()

const TQString AIElement::toString ( ) const

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

See also
asString()

Definition at line 360 of file aielement.cpp.

◆ toUInt()

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.cpp.

◆ type()

AIElement::Type AIElement::type ( ) const
inline

Definition at line 141 of file aielement.h.

◆ typeName()

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, "TQFont", "TQString", or "TQValueList<AIElement>". An Invalid aielement returns 0.

Definition at line 289 of file aielement.cpp.

◆ typeToName()

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.cpp.


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