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.cpp28
1 files changed, 18 insertions, 10 deletions
diff --git a/noncore/apps/tableviewer/db/common.cpp b/noncore/apps/tableviewer/db/common.cpp
index dbf9370..6e544ba 100644
--- a/noncore/apps/tableviewer/db/common.cpp
+++ b/noncore/apps/tableviewer/db/common.cpp
@@ -8,33 +8,41 @@
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
-#include <stdlib.h>
+#include "common.h"
+#include "datacache.h"
+
+/* OPIE */
+#include <opie2/odebug.h>
+#include <qpe/timestring.h>
+using namespace Opie::Core;
+
+/* QT */
#include <qstring.h>
#include <qheader.h>
#include <qvector.h>
#include <qdatetime.h>
-#include <qpe/timestring.h>
-#include "common.h"
-#include "datacache.h"
+
+/* STD */
#include <assert.h>
+#include <stdlib.h>
static const int del_flag = 0x1;
static const int new_flag = 0x2;
/* Helper function */
int parseNextNumber(QString *q) {
QChar c;
uint i;
int result = 0;
bool found_digits = FALSE;
@@ -303,25 +311,25 @@ void TVVariant::load(QDataStream &s )
s >> *x;
d->value.ptr = x;
}
break;
case Int:
{
int x;
s >> x;
d->value.i = x;
}
break;
default:
- qFatal("Unrecognized data type");
+ ofatal << "Unrecognized data type" << oendl;
}
}
void TVVariant::save( QDataStream &s ) const
{
s << type();
switch( d->typ ) {
case String:
s << *((QString *)d->value.ptr);
break;
case Date:
@@ -1069,25 +1077,25 @@ QDataStream &operator<<( QDataStream &s, const DataElem &d)
return s;
}
QDataStream &operator>>( QDataStream &s, DataElem &d)
{
int i;
int size;
TVVariant t;
int index = 0;
s >> size; /* redundent data but makes streaming easier */
if (size != d.getNumFields()) {
- qWarning("DataSize mis-match");
+ owarn << "DataSize mis-match" << oendl;
return s; /* sanity check failed.. don't load */
}
for(i = 0; i < size; i++) {
s >> (Q_UINT16)index;
s >> t;
d.setField(index, t);
}
return s;
}
/*! Returns the number of possible (not valid) fields in the data element */
@@ -1368,25 +1376,25 @@ bool DataElem::contains(int i, TVVariant v) const
QString qs2 = v.toString().lower();
if (qs1.contains(qs2) > 0) return TRUE;
break;
}
/* meaningless for ints */
/* meaningless for time */
/* meaningless for dates */
case TVVariant::Int:
case TVVariant::Time:
case TVVariant::Date:
break;
default:
- qWarning("Tried to compare unknown data type");
+ owarn << "Tried to compare unknown data type" << oendl;
}
return FALSE;
}
bool DataElem::startsWith(int i, TVVariant v) const
{
if (!hasValidValue(i)) return FALSE;
if (getField(i).type() != v.type())
return FALSE;
switch(getField(i).type()) {
@@ -1394,25 +1402,25 @@ bool DataElem::startsWith(int i, TVVariant v) const
QString qs1 = getField(i).toString().lower();
QString qs2 = v.toString().lower();
return qs1.startsWith(qs2);
}
/* meaningless for ints */
/* meaningless for time */
/* meaningless for dates */
case TVVariant::Int:
case TVVariant::Time:
case TVVariant::Date:
return FALSE;
default:
- qWarning("Tried to compare unknown data type");
+ owarn << "Tried to compare unknown data type" << oendl;
}
return FALSE;
}
bool DataElem::endsWith(int i, TVVariant v) const
{
if (!hasValidValue(i)) return FALSE;
if (getField(i).type() != v.type())
return FALSE;
switch(getField(i).type()) {
@@ -1420,25 +1428,25 @@ bool DataElem::endsWith(int i, TVVariant v) const
QString qs1 = getField(i).toString().lower();
QString qs2 = v.toString().lower();
return qs1.startsWith(qs2);
}
/* meaningless for ints */
/* meaningless for time */
/* meaningless for dates */
case TVVariant::Int:
case TVVariant::Time:
case TVVariant::Date:
return FALSE;
default:
- qWarning("Tried to compare unknown data type");
+ owarn << "Tried to compare unknown data type" << oendl;
}
return FALSE;
}
/*!
Determins which of the first to parameters are closer to the third, target
parameter.
\return
<UL>
<LI>TRUE if the first element is a closer match to the target than the
second element</LI>
@@ -1452,19 +1460,19 @@ bool DataElem::closer(DataElem*d1, DataElem *d2, TVVariant target, int column)
if(!d1) return FALSE;
if (!d1->hasValidValue(column)) return FALSE;
if(!target.isValid()) return FALSE;
type = d1->getField(column).type();
if(d2) {
if (type != d2->getField(column).type()) {
/* can't do compare */
- qWarning("Tried to compare two incompatable types");
+ owarn << "Tried to compare two incompatable types" << oendl;
return FALSE;
}
return target.closer(d1->getField(column), d2->getField(column));
}
return target.close(d1->getField(column));
}