Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

DataElem Class Reference

A class representing a single row or element of a table in a DBStore. More...

#include </home/clem/local/src/opie/noncore/apps/tableviewer/db/common.h>

Collaboration diagram for DataElem:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 DataElem (DBStore *container)
 ~DataElem ()
int getNumFields () const
KeyList getKeys () const
bool hasValidValue (int) const
bool hasValidValue (QString) const
TVVariant::KeyType getFieldType (int) const
TVVariant::KeyType getFieldType (QString) const
TVVariant getField (int) const
TVVariant getField (QString) const
void setField (int, QString)
void setField (int, TVVariant)
void setField (QString, QString)
void setField (QString, TVVariant)
void unsetField (int)
void unsetField (QString)
QString toQString () const
QString toQString (int i) const
QString toSortableQString (int i) const
bool lessThan (int i, TVVariant) const
bool moreThan (int i, TVVariant) const
bool equalTo (int i, TVVariant) const
bool contains (int i, TVVariant) const
bool startsWith (int i, TVVariant) const
bool endsWith (int i, TVVariant) const

Static Public Member Functions

static int compare (const TVVariant, const TVVariant, int i)
static bool closer (DataElem *, DataElem *, TVVariant, int column)

Private Attributes

QIntDict< TVVariantvalues
DBStorecontained

Detailed Description

A class representing a single row or element of a table in a DBStore.

This class holds the data of a row in a table.

Definition at line 219 of file common.h.


Constructor & Destructor Documentation

DataElem::DataElem DBStore c  ) 
 

Constructs a DataElem. This function needs a container because the size, types of keys and primary key are all defined by the containing database

Definition at line 1046 of file common.cpp.

References contained, DBStore::getNumFields(), QPtrCollection::setAutoDelete(), size, TRUE, and values.

DataElem::~DataElem  ) 
 

Destroys a DataElem and frees memory used by the DataElem

Definition at line 1057 of file common.cpp.


Member Function Documentation

bool DataElem::closer DataElem d1,
DataElem d2,
TVVariant  target,
int  column
[static]
 

Determins which of the first to parameters are closer to the third, target parameter.

Returns:
  • TRUE if the first element is a closer match to the target than the second element
  • FALSE if the first element is not a closer match to the target than the second element

Definition at line 1454 of file common.cpp.

References TVVariant::close(), TVVariant::closer(), FALSE, getField(), TVVariant::isValid(), oendl, owarn, and type.

Referenced by TVListView::findItem().

static int DataElem::compare const   TVVariant,
const   TVVariant,
int  i
[static]
 

bool DataElem::contains int  i,
TVVariant 
const
 

Definition at line 1363 of file common.cpp.

References QString::contains(), TVVariant::Date, FALSE, getField(), hasValidValue(), TVVariant::Int, oendl, owarn, TVVariant::String, TVVariant::Time, TVVariant::toString(), TRUE, TVVariant::type(), and type.

Referenced by TVFilterView::passesFilter().

bool DataElem::endsWith int  i,
TVVariant 
const
 

Definition at line 1416 of file common.cpp.

References TVVariant::Date, FALSE, getField(), hasValidValue(), TVVariant::Int, oendl, owarn, QString::startsWith(), TVVariant::String, TVVariant::Time, TVVariant::toString(), TVVariant::type(), and type.

Referenced by TVFilterView::passesFilter().

bool DataElem::equalTo int  i,
TVVariant 
const
 

Definition at line 1353 of file common.cpp.

References FALSE, getField(), hasValidValue(), TVVariant::type(), and type.

Referenced by TVFilterView::passesFilter().

TVVariant DataElem::getField QString  qs  )  const
 

returns a pointer to the data stored in field name qs for this data element, (value may not be valid)

Definition at line 1168 of file common.cpp.

References contained, getField(), DBStore::getKeyIndex(), and i.

TVVariant DataElem::getField int  i  )  const
 

returns a pointer to the data stored in field index i for this data element, (value may not be valid)

Definition at line 1157 of file common.cpp.

References QIntDict< type >::find(), hasValidValue(), and values.

Referenced by closer(), contains(), endsWith(), equalTo(), getField(), lessThan(), moreThan(), operator<<(), DBXml::saveSource(), TVEditView::setData(), startsWith(), toQString(), and toSortableQString().

TVVariant::KeyType DataElem::getFieldType QString  qs  )  const
 

returns the type of the field specified by name qs

Definition at line 1147 of file common.cpp.

References contained, DBStore::getKeyIndex(), DBStore::getKeyType(), and i.

TVVariant::KeyType DataElem::getFieldType int  i  )  const
 

returns the type of the field specified by index i

Definition at line 1141 of file common.cpp.

References contained, and DBStore::getKeyType().

Referenced by TVEditView::openEditItemDialog().

KeyList DataElem::getKeys  )  const
 

Definition at line 1106 of file common.cpp.

References contained, and DBStore::getKeys().

Referenced by operator<<().

int DataElem::getNumFields  )  const
 

Returns the number of possible (not valid) fields in the data element

Definition at line 1101 of file common.cpp.

References contained, and DBStore::getNumFields().

Referenced by operator<<(), and operator>>().

bool DataElem::hasValidValue QString  qs  )  const
 

This function determines whether field name qs of the element has been set yet.

Returns:
A boolean value that is TRUE if the specfied field of this element has been set and FALSE if the field has not yet been set

Definition at line 1134 of file common.cpp.

References contained, DBStore::getKeyIndex(), hasValidValue(), and i.

bool DataElem::hasValidValue int  i  )  const
 

This function determines whether field index i of the element has been set yet.

Returns:
A boolean value that is TRUE if the specfied field of this element has been set and FALSE if the field has not yet been set

Definition at line 1118 of file common.cpp.

References contained, FALSE, QIntDict< type >::find(), DBStore::getKeys(), and values.

Referenced by contains(), endsWith(), equalTo(), getField(), hasValidValue(), lessThan(), moreThan(), DBXml::saveSource(), DBCsv::saveSource(), TVEditView::setData(), TVBrowseView::setDisplayText(), startsWith(), toQString(), and toSortableQString().

bool DataElem::lessThan int  i,
TVVariant 
const
 

Definition at line 1333 of file common.cpp.

References FALSE, getField(), hasValidValue(), TVVariant::type(), and type.

Referenced by TVFilterView::passesFilter().

bool DataElem::moreThan int  i,
TVVariant 
const
 

Definition at line 1343 of file common.cpp.

References FALSE, getField(), hasValidValue(), TVVariant::type(), and type.

Referenced by TVFilterView::passesFilter().

void DataElem::setField QString  qs,
TVVariant  value
 

Sets the value of the elements field name qs to the value at the pointer value.

Parameters:
qs name of the field to set
value a pointer to the (already allocated) value to set

Definition at line 1250 of file common.cpp.

References contained, DBStore::getKeyIndex(), i, and setField().

void DataElem::setField QString  qs,
QString  q
 

Sets the value of the elements field name qs to the value represented in the QString q.

Parameters:
qs name of the field to set
q a string that can be parsed to get the value to be set

Definition at line 1236 of file common.cpp.

References contained, DBStore::getKeyIndex(), i, and setField().

void DataElem::setField int  i,
TVVariant  value
 

Sets the value of the elements field index i to the value at the pointer value.

Parameters:
i index of the field to set
value a pointer to the (already allocated) value to set

Definition at line 1221 of file common.cpp.

References TVVariant::isValid(), QIntDict< type >::remove(), QIntDict< type >::replace(), and values.

void DataElem::setField int  i,
QString  q
 

Sets the value of the elements field index i to the value represented in the QString q.

Parameters:
i index of the field to set
q a string that can be parsed to get the value to be set

Definition at line 1181 of file common.cpp.

References TVVariant::asDate(), TVVariant::asInt(), TVVariant::asString(), TVVariant::asTime(), contained, TVVariant::Date, DBStore::getKeyType(), TVVariant::Int, oendl, owarn, TVVariant::String, t, and TVVariant::Time.

Referenced by DBXmlHandler::characters(), TVEditView::openEditItemDialog(), DBCsv::openSource(), operator>>(), and setField().

bool DataElem::startsWith int  i,
TVVariant 
const
 

Definition at line 1390 of file common.cpp.

References TVVariant::Date, FALSE, getField(), hasValidValue(), TVVariant::Int, oendl, owarn, QString::startsWith(), TVVariant::String, TVVariant::Time, TVVariant::toString(), TVVariant::type(), and type.

Referenced by TVFilterView::passesFilter().

QString DataElem::toQString int  i  )  const
 

formats individual fields to strings so can be displayed

Definition at line 1290 of file common.cpp.

References getField(), and hasValidValue().

QString DataElem::toQString  )  const
 

Converts the data element to a Rich Text QString

Definition at line 1269 of file common.cpp.

References contained, QIntDictIterator< type >::current(), QIntDictIterator< type >::currentKey(), getField(), DBStore::getKeyName(), hasValidValue(), i, and values.

Referenced by DBXml::saveSource(), DBCsv::saveSource(), TVBrowseView::setDisplayText(), and TVListViewItem::text().

QString DataElem::toSortableQString int  i  )  const
 

formats individual fields to strings so can be sorted by QListView

Definition at line 1298 of file common.cpp.

References contained, TVVariant::Date, QDate::daysTo(), getField(), DBStore::getKeyType(), hasValidValue(), TVVariant::Int, QTime::msecsTo(), QString::sprintf(), TVVariant::String, and TVVariant::Time.

Referenced by TVListViewItem::key().

void DataElem::unsetField QString   ) 
 

Definition at line 1260 of file common.cpp.

References contained, DBStore::getKeyIndex(), i, and unsetField().

void DataElem::unsetField int   ) 
 

Definition at line 1256 of file common.cpp.

References QIntDict< type >::remove(), and values.

Referenced by TVEditView::openEditItemDialog(), and unsetField().


Member Data Documentation

DBStore* DataElem::contained [private]
 

Definition at line 262 of file common.h.

Referenced by DataElem(), getField(), getFieldType(), getKeys(), getNumFields(), hasValidValue(), setField(), toQString(), toSortableQString(), and unsetField().

QIntDict<TVVariant> DataElem::values [private]
 

Definition at line 261 of file common.h.

Referenced by DataElem(), getField(), hasValidValue(), setField(), toQString(), and unsetField().


The documentation for this class was generated from the following files:
Generated on Sat Nov 5 17:30:08 2005 for OPIE by  doxygen 1.4.2