summaryrefslogtreecommitdiff
path: root/noncore/apps/tableviewer/db/common.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/tableviewer/db/common.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/tableviewer/db/common.cpp165
1 files changed, 81 insertions, 84 deletions
diff --git a/noncore/apps/tableviewer/db/common.cpp b/noncore/apps/tableviewer/db/common.cpp
index b58af85..c35dbea 100644
--- a/noncore/apps/tableviewer/db/common.cpp
+++ b/noncore/apps/tableviewer/db/common.cpp
@@ -18,4 +18,4 @@
**
-**********************************************************************/
-#include "common.h"
+**********************************************************************/
+#include "common.h"
#include "datacache.h"
@@ -90,3 +90,3 @@ int QStringVector::compareItems(Item a, Item b)
QString *qb = (QString *)b;
-
+
return QString::compare(*qa, *qb);
@@ -96,3 +96,3 @@ int QStringVector::compareItems(Item a, Item b)
\class TVVariant
- A way of abstracting void * and keeping information on
+ A way of abstracting void * and keeping information on
the keytypes and behaviours in one place
@@ -322,3 +322,3 @@ void TVVariant::load(QDataStream &s )
default:
- ofatal << "Unrecognized data type" << oendl;
+ ofatal << "Unrecognized data type" << oendl;
}
@@ -384,3 +384,3 @@ const QString TVVariant::toString() const
return ((QTime*)d->value.ptr)->toString();
- case Int:
+ case Int:
return QString::number(d->value.i);
@@ -426,3 +426,3 @@ const QDate TVVariant::toDate() const
}
-
+
@@ -435,3 +435,3 @@ const QTime TVVariant::toTime() const
return *((QTime *)d->value.ptr);
-
+
if(d->typ == String) {
@@ -456,3 +456,3 @@ const QTime TVVariant::toTime() const
return *((Q##f*)d->value.ptr); }
-
+
TV_VARIANT_AS(String)
@@ -562,3 +562,3 @@ bool TVVariant::closer(TVVariant n, TVVariant o)
if(d->typ == Invalid)
- return FALSE;
+ return FALSE;
@@ -574,3 +574,3 @@ bool TVVariant::closer(TVVariant n, TVVariant o)
case String: {
- /* case for strings is close is a substring.. closer is
+ /* case for strings is close is a substring.. closer is
* earlier alphabetically */
@@ -584,3 +584,3 @@ bool TVVariant::closer(TVVariant n, TVVariant o)
/* contains sub-str, if later than is not closer */
- if(QString::compare(qs1, qs2) > 0)
+ if(QString::compare(qs1, qs2) > 0)
return FALSE;
@@ -595,9 +595,9 @@ bool TVVariant::closer(TVVariant n, TVVariant o)
int diff1 = (i1 - iv);
- if (diff1 < 0)
+ if (diff1 < 0)
diff1 = -diff1;
int diff2 = (i2 - iv);
- if (diff2 < 0)
+ if (diff2 < 0)
diff2 = -diff2;
- if (diff1 < diff2)
+ if (diff1 < diff2)
return TRUE;
@@ -612,6 +612,6 @@ bool TVVariant::closer(TVVariant n, TVVariant o)
int diff1 = i1.daysTo(iv);
- if (diff1 < 0)
+ if (diff1 < 0)
diff1 = -diff1;
int diff2 = i2.daysTo(iv);
- if (diff2 < 0)
+ if (diff2 < 0)
diff2 = -diff2;
@@ -629,6 +629,6 @@ bool TVVariant::closer(TVVariant n, TVVariant o)
int diff1 = i1.msecsTo(iv);
- if (diff1 < 0)
+ if (diff1 < 0)
diff1 = -diff1;
int diff2 = i2.msecsTo(iv);
- if (diff2 < 0)
+ if (diff2 < 0)
diff2 = -diff2;
@@ -651,3 +651,3 @@ bool TVVariant::close(TVVariant n)
if(type() == Invalid)
- return FALSE;
+ return FALSE;
@@ -659,3 +659,3 @@ bool TVVariant::close(TVVariant n)
case String: {
- /* case for strings is close is a substring.. closer is
+ /* case for strings is close is a substring.. closer is
* earlier alphabetically */
@@ -668,3 +668,3 @@ bool TVVariant::close(TVVariant n)
}
- case Int:
+ case Int:
case Date:
@@ -683,3 +683,3 @@ bool TVVariant::close(TVVariant n)
\brief document me!
-
+
document me!
@@ -690,3 +690,3 @@ Key::Key() : kname(), kexample(), kflags(0) { }
Key::Key(QString name, TVVariant example, int flags) :
- kname(name), kexample(example), kflags(flags) { }
+ kname(name), kexample(example), kflags(flags) { }
@@ -699,3 +699,3 @@ Key::Key(const Key &other)
-Key& Key::operator=(const Key& key)
+Key& Key::operator=(const Key& key)
{
@@ -779,3 +779,3 @@ void Key::setNewFlag(bool v)
*/
-KeyList::KeyList() : QIntDict<Key>(20)
+KeyList::KeyList() : QIntDict<Key>(20)
{
@@ -785,3 +785,3 @@ KeyList::KeyList() : QIntDict<Key>(20)
/* Should be deep copy, but isn't */
-KeyList::KeyList(const KeyList &k) : QIntDict<Key>(k)
+KeyList::KeyList(const KeyList &k) : QIntDict<Key>(k)
{
@@ -824,3 +824,3 @@ bool KeyList::operator!=(const KeyList &other)
*/
-int KeyList::getNumFields() const
+int KeyList::getNumFields() const
{
@@ -849,12 +849,12 @@ int KeyList::addKey(QString name, TVVariant::KeyType type)
switch(type) {
- case TVVariant::String:
+ case TVVariant::String:
return addKey(name, TVVariant("<undefined>").asString());
break;
- case TVVariant::Date:
+ case TVVariant::Date:
return addKey(name, TVVariant(QDate::currentDate()).asDate());
break;
- case TVVariant::Time:
+ case TVVariant::Time:
return addKey(name, TVVariant(QTime(0,0,0)).toTime());
break;
- case TVVariant::Int:
+ case TVVariant::Int:
return addKey(name, TVVariant(0).toInt());
@@ -862,4 +862,3 @@ int KeyList::addKey(QString name, TVVariant::KeyType type)
default:
- qWarning(QObject::tr("KeyList::addKey() Cannot make default "
- "value for type %1, Key not added.").arg(type));
+ owarn << "KeyList::addKey() Cannot make default value for type " << type << ", Key not added." << oendl;
break;
@@ -869,3 +868,3 @@ int KeyList::addKey(QString name, TVVariant::KeyType type)
-void KeyList::setKeyFlags(int i, int flag)
+void KeyList::setKeyFlags(int i, int flag)
{
@@ -882,3 +881,3 @@ int KeyList::getKeyFlags(int i) const
-bool KeyList::checkNewFlag(int i) const
+bool KeyList::checkNewFlag(int i) const
{
@@ -889,3 +888,3 @@ bool KeyList::checkNewFlag(int i) const
-void KeyList::setNewFlag(int i, bool f)
+void KeyList::setNewFlag(int i, bool f)
{
@@ -896,3 +895,3 @@ void KeyList::setNewFlag(int i, bool f)
-bool KeyList::checkDeleteFlag(int i) const
+bool KeyList::checkDeleteFlag(int i) const
{
@@ -903,3 +902,3 @@ bool KeyList::checkDeleteFlag(int i) const
-void KeyList::setDeleteFlag(int i, bool f)
+void KeyList::setDeleteFlag(int i, bool f)
{
@@ -920,3 +919,3 @@ QString KeyList::getKeyName(int i) const
-void KeyList::setKeyName(int i, const QString &n)
+void KeyList::setKeyName(int i, const QString &n)
{
@@ -936,3 +935,3 @@ TVVariant::KeyType KeyList::getKeyType(int i) const
-void KeyList::setKeyType(int i, TVVariant::KeyType t)
+void KeyList::setKeyType(int i, TVVariant::KeyType t)
{
@@ -1042,5 +1041,5 @@ QDataStream &operator>>( QDataStream &s, KeyList &k)
/*!
- Constructs a DataElem. This function needs a container because the
- size, types of keys and primary key are all defined by the containing
- database
+ Constructs a DataElem. This function needs a container because the
+ size, types of keys and primary key are all defined by the containing
+ database
*/
@@ -1088,3 +1087,3 @@ QDataStream &operator>>( QDataStream &s, DataElem &d)
if (size != d.getNumFields()) {
- owarn << "DataSize mis-match" << oendl;
+ owarn << "DataSize mis-match" << oendl;
return s; /* sanity check failed.. don't load */
@@ -1111,3 +1110,3 @@ KeyList DataElem::getKeys() const
-/*!
+/*!
This function determines whether field index i of the element has been
@@ -1115,4 +1114,4 @@ KeyList DataElem::getKeys() const
- \return 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
+ \return 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
*/
@@ -1122,3 +1121,3 @@ bool DataElem::hasValidValue(int i) const
return FALSE;
- if(!contained->getKeys()->validIndex(i))
+ if(!contained->getKeys()->validIndex(i))
return FALSE;
@@ -1127,3 +1126,3 @@ bool DataElem::hasValidValue(int i) const
-/*!
+/*!
This function determines whether field name qs of the element has been
@@ -1131,6 +1130,6 @@ bool DataElem::hasValidValue(int i) const
- \return 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
+ \return 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
*/
-bool DataElem::hasValidValue(QString qs) const
+bool DataElem::hasValidValue(QString qs) const
{
@@ -1141,3 +1140,3 @@ bool DataElem::hasValidValue(QString qs) const
/*! returns the type of the field specified by index i */
-TVVariant::KeyType DataElem::getFieldType(int i) const
+TVVariant::KeyType DataElem::getFieldType(int i) const
{
@@ -1153,5 +1152,5 @@ TVVariant::KeyType DataElem::getFieldType(QString qs) const
-/*!
- returns a pointer to the data stored in field index i for this
- data element, (value may not be valid)
+/*!
+ returns a pointer to the data stored in field index i for this
+ data element, (value may not be valid)
*/
@@ -1164,5 +1163,5 @@ TVVariant DataElem::getField(int i) const
-/*!
- returns a pointer to the data stored in field name qs for this
- data element, (value may not be valid)
+/*!
+ returns a pointer to the data stored in field name qs for this
+ data element, (value may not be valid)
*/
@@ -1181,3 +1180,3 @@ TVVariant DataElem::getField(QString qs) const
*/
-void DataElem::setField(int i, QString q)
+void DataElem::setField(int i, QString q)
{
@@ -1210,5 +1209,3 @@ void DataElem::setField(int i, QString q)
default:
- qWarning(
- QObject::tr("DataElem::setField(%1, %2) No valid type found").arg(i).arg(q)
- );
+ owarn << "DataElem::setField(" << i << ", " << q << ") No valid type found" << oendl;
}
@@ -1221,5 +1218,5 @@ void DataElem::setField(int i, QString q)
\param i index of the field to set
- \param value a pointer to the (already allocated) value to set
+ \param value a pointer to the (already allocated) value to set
*/
-void DataElem::setField(int i, TVVariant value)
+void DataElem::setField(int i, TVVariant value)
{
@@ -1238,3 +1235,3 @@ void DataElem::setField(int i, TVVariant value)
*/
-void DataElem::setField(QString qs, QString q)
+void DataElem::setField(QString qs, QString q)
{
@@ -1250,3 +1247,3 @@ void DataElem::setField(QString qs, QString q)
\param qs name of the field to set
- \param value a pointer to the (already allocated) value to set
+ \param value a pointer to the (already allocated) value to set
*/
@@ -1269,3 +1266,3 @@ void DataElem::unsetField(QString qs)
/*!
- Converts the data element to a Rich Text QString
+ Converts the data element to a Rich Text QString
*/
@@ -1292,3 +1289,3 @@ QString DataElem::toQString() const
/*! formats individual fields to strings so can be displayed */
-QString DataElem::toQString(int i) const
+QString DataElem::toQString(int i) const
{
@@ -1300,3 +1297,3 @@ QString DataElem::toQString(int i) const
/*! formats individual fields to strings so can be sorted by QListView */
-QString DataElem::toSortableQString(int i) const
+QString DataElem::toSortableQString(int i) const
{
@@ -1315,3 +1312,3 @@ QString DataElem::toSortableQString(int i) const
static QDate epochD(1800, 1, 1);
- scratch.sprintf("%08d",
+ scratch.sprintf("%08d",
epochD.daysTo(getField(i).toDate()));
@@ -1321,3 +1318,3 @@ QString DataElem::toSortableQString(int i) const
static QTime epochT(0, 0, 0);
- scratch.sprintf("%08d",
+ scratch.sprintf("%08d",
epochT.msecsTo(getField(i).toTime()));
@@ -1382,3 +1379,3 @@ bool DataElem::contains(int i, TVVariant v) const
/* meaningless for dates */
- case TVVariant::Int:
+ case TVVariant::Int:
case TVVariant::Time:
@@ -1387,3 +1384,3 @@ bool DataElem::contains(int i, TVVariant v) const
default:
- owarn << "Tried to compare unknown data type" << oendl;
+ owarn << "Tried to compare unknown data type" << oendl;
}
@@ -1408,3 +1405,3 @@ bool DataElem::startsWith(int i, TVVariant v) const
/* meaningless for dates */
- case TVVariant::Int:
+ case TVVariant::Int:
case TVVariant::Time:
@@ -1413,3 +1410,3 @@ bool DataElem::startsWith(int i, TVVariant v) const
default:
- owarn << "Tried to compare unknown data type" << oendl;
+ owarn << "Tried to compare unknown data type" << oendl;
}
@@ -1434,3 +1431,3 @@ bool DataElem::endsWith(int i, TVVariant v) const
/* meaningless for dates */
- case TVVariant::Int:
+ case TVVariant::Int:
case TVVariant::Time:
@@ -1439,3 +1436,3 @@ bool DataElem::endsWith(int i, TVVariant v) const
default:
- owarn << "Tried to compare unknown data type" << oendl;
+ owarn << "Tried to compare unknown data type" << oendl;
}
@@ -1448,5 +1445,5 @@ bool DataElem::endsWith(int i, TVVariant v) const
- \return
+ \return
<UL>
- <LI>TRUE if the first element is a closer match to the target than the
+ <LI>TRUE if the first element is a closer match to the target than the
second element</LI>
@@ -1458,3 +1455,3 @@ bool DataElem::closer(DataElem*d1, DataElem *d2, TVVariant target, int column)
{
- int type;
+ int type;
@@ -1471,3 +1468,3 @@ bool DataElem::closer(DataElem*d1, DataElem *d2, TVVariant target, int column)
/* can't do compare */
- owarn << "Tried to compare two incompatable types" << oendl;
+ owarn << "Tried to compare two incompatable types" << oendl;
return FALSE;
@@ -1475,3 +1472,3 @@ bool DataElem::closer(DataElem*d1, DataElem *d2, TVVariant target, int column)
return target.closer(d1->getField(column), d2->getField(column));
- }
+ }
return target.close(d1->getField(column));