summaryrefslogtreecommitdiff
path: root/noncore/apps/tableviewer/db/common.cpp
Unidiff
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
@@ -14,21 +14,29 @@
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include <stdlib.h> 20#include "common.h"
21#include "datacache.h"
22
23/* OPIE */
24#include <opie2/odebug.h>
25#include <qpe/timestring.h>
26using namespace Opie::Core;
27
28/* QT */
21#include <qstring.h> 29#include <qstring.h>
22#include <qheader.h> 30#include <qheader.h>
23#include <qvector.h> 31#include <qvector.h>
24#include <qdatetime.h> 32#include <qdatetime.h>
25#include <qpe/timestring.h> 33
26#include "common.h" 34/* STD */
27#include "datacache.h"
28#include <assert.h> 35#include <assert.h>
36#include <stdlib.h>
29 37
30static const int del_flag = 0x1; 38static const int del_flag = 0x1;
31static const int new_flag = 0x2; 39static const int new_flag = 0x2;
32 40
33/* Helper function */ 41/* Helper function */
34 42
@@ -309,13 +317,13 @@ void TVVariant::load(QDataStream &s )
309 int x; 317 int x;
310 s >> x; 318 s >> x;
311 d->value.i = x; 319 d->value.i = x;
312 } 320 }
313 break; 321 break;
314 default: 322 default:
315 qFatal("Unrecognized data type"); 323 ofatal << "Unrecognized data type" << oendl;
316 } 324 }
317} 325}
318 326
319void TVVariant::save( QDataStream &s ) const 327void TVVariant::save( QDataStream &s ) const
320{ 328{
321 s << type(); 329 s << type();
@@ -1075,13 +1083,13 @@ QDataStream &operator>>( QDataStream &s, DataElem &d)
1075 int size; 1083 int size;
1076 TVVariant t; 1084 TVVariant t;
1077 int index = 0; 1085 int index = 0;
1078 1086
1079 s >> size; /* redundent data but makes streaming easier */ 1087 s >> size; /* redundent data but makes streaming easier */
1080 if (size != d.getNumFields()) { 1088 if (size != d.getNumFields()) {
1081 qWarning("DataSize mis-match"); 1089 owarn << "DataSize mis-match" << oendl;
1082 return s; /* sanity check failed.. don't load */ 1090 return s; /* sanity check failed.. don't load */
1083 } 1091 }
1084 1092
1085 for(i = 0; i < size; i++) { 1093 for(i = 0; i < size; i++) {
1086 s >> (Q_UINT16)index; 1094 s >> (Q_UINT16)index;
1087 s >> t; 1095 s >> t;
@@ -1374,13 +1382,13 @@ bool DataElem::contains(int i, TVVariant v) const
1374 /* meaningless for dates */ 1382 /* meaningless for dates */
1375 case TVVariant::Int: 1383 case TVVariant::Int:
1376 case TVVariant::Time: 1384 case TVVariant::Time:
1377 case TVVariant::Date: 1385 case TVVariant::Date:
1378 break; 1386 break;
1379 default: 1387 default:
1380 qWarning("Tried to compare unknown data type"); 1388 owarn << "Tried to compare unknown data type" << oendl;
1381 } 1389 }
1382 return FALSE; 1390 return FALSE;
1383} 1391}
1384 1392
1385bool DataElem::startsWith(int i, TVVariant v) const 1393bool DataElem::startsWith(int i, TVVariant v) const
1386{ 1394{
@@ -1400,13 +1408,13 @@ bool DataElem::startsWith(int i, TVVariant v) const
1400 /* meaningless for dates */ 1408 /* meaningless for dates */
1401 case TVVariant::Int: 1409 case TVVariant::Int:
1402 case TVVariant::Time: 1410 case TVVariant::Time:
1403 case TVVariant::Date: 1411 case TVVariant::Date:
1404 return FALSE; 1412 return FALSE;
1405 default: 1413 default:
1406 qWarning("Tried to compare unknown data type"); 1414 owarn << "Tried to compare unknown data type" << oendl;
1407 } 1415 }
1408 return FALSE; 1416 return FALSE;
1409} 1417}
1410 1418
1411bool DataElem::endsWith(int i, TVVariant v) const 1419bool DataElem::endsWith(int i, TVVariant v) const
1412{ 1420{
@@ -1426,13 +1434,13 @@ bool DataElem::endsWith(int i, TVVariant v) const
1426 /* meaningless for dates */ 1434 /* meaningless for dates */
1427 case TVVariant::Int: 1435 case TVVariant::Int:
1428 case TVVariant::Time: 1436 case TVVariant::Time:
1429 case TVVariant::Date: 1437 case TVVariant::Date:
1430 return FALSE; 1438 return FALSE;
1431 default: 1439 default:
1432 qWarning("Tried to compare unknown data type"); 1440 owarn << "Tried to compare unknown data type" << oendl;
1433 } 1441 }
1434 return FALSE; 1442 return FALSE;
1435} 1443}
1436 1444
1437/*! 1445/*!
1438 Determins which of the first to parameters are closer to the third, target 1446 Determins which of the first to parameters are closer to the third, target
@@ -1458,13 +1466,13 @@ bool DataElem::closer(DataElem*d1, DataElem *d2, TVVariant target, int column)
1458 1466
1459 type = d1->getField(column).type(); 1467 type = d1->getField(column).type();
1460 1468
1461 if(d2) { 1469 if(d2) {
1462 if (type != d2->getField(column).type()) { 1470 if (type != d2->getField(column).type()) {
1463 /* can't do compare */ 1471 /* can't do compare */
1464 qWarning("Tried to compare two incompatable types"); 1472 owarn << "Tried to compare two incompatable types" << oendl;
1465 return FALSE; 1473 return FALSE;
1466 } 1474 }
1467 return target.closer(d1->getField(column), d2->getField(column)); 1475 return target.closer(d1->getField(column), d2->getField(column));
1468 } 1476 }
1469 return target.close(d1->getField(column)); 1477 return target.close(d1->getField(column));
1470} 1478}