-rw-r--r-- | noncore/apps/tableviewer/db/common.cpp | 28 | ||||
-rw-r--r-- | noncore/apps/tableviewer/db/datacache.cpp | 12 | ||||
-rw-r--r-- | noncore/apps/tableviewer/db/xmlsource.cpp | 30 |
3 files changed, 46 insertions, 24 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 @@ -12,25 +12,33 @@ ** 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; @@ -307,17 +315,17 @@ void TVVariant::load(QDataStream &s ) 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 ) { @@ -1073,17 +1081,17 @@ 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); } @@ -1372,17 +1380,17 @@ bool DataElem::contains(int i, TVVariant v) const /* 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; @@ -1398,17 +1406,17 @@ bool DataElem::startsWith(int i, TVVariant v) const /* 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; @@ -1424,17 +1432,17 @@ bool DataElem::endsWith(int i, TVVariant v) const /* 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. @@ -1456,15 +1464,15 @@ bool DataElem::closer(DataElem*d1, DataElem *d2, TVVariant target, int column) 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)); } diff --git a/noncore/apps/tableviewer/db/datacache.cpp b/noncore/apps/tableviewer/db/datacache.cpp index 7c14eef..6380e1b 100644 --- a/noncore/apps/tableviewer/db/datacache.cpp +++ b/noncore/apps/tableviewer/db/datacache.cpp @@ -21,19 +21,27 @@ * This file is used to load the xml files that represent the database. * The main requirment for said file is each data entry must contain a key, * otherwise any other data headings are allowed. */ #include "datacache.h" #include "xmlsource.h" #include "csvsource.h" -#include <stdlib.h> + +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + +/* QT */ #include <qheader.h> +/* STD */ +#include <stdlib.h> + #define INIT_TABLE_SIZE 128 /*! \class DBStore datastore.h \brief The DBStore class is the class responsible for storing, sorting and searching the data loaded by the application @@ -145,17 +153,17 @@ void DBStore::addItem(DataElem *delem) { addItemInternal(delem); } void DBStore::addItemInternal(DataElem *delem) { /* if already full, don't over fill, do a qWarning though */ if (full) { - qWarning("Attempted to add items to already full table"); + owarn << "Attempted to add items to already full table" << oendl; return; } master_table.insert(number_elems, delem); current_elem = number_elems; number_elems++; diff --git a/noncore/apps/tableviewer/db/xmlsource.cpp b/noncore/apps/tableviewer/db/xmlsource.cpp index 94fec36..4ca6aee 100644 --- a/noncore/apps/tableviewer/db/xmlsource.cpp +++ b/noncore/apps/tableviewer/db/xmlsource.cpp @@ -13,22 +13,28 @@ ** ** 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 "xmlsource.h" -#include <qdict.h> -#include <stdlib.h> -#include <qtextstream.h> #include "../xmlencodeattr.h" +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; +/* QT */ +#include <qdict.h> +#include <qtextstream.h> + +/* STD */ +#include <stdlib.h> DBXml::DBXml(DBStore *d) { dstore = d; } QString DBXml::type() { @@ -135,17 +141,17 @@ DBXmlHandler::DBXmlHandler(DBStore *ds) Destroys the DBXmlHandler */ DBXmlHandler::~DBXmlHandler() { } QString DBXmlHandler::errorProtocol() { - qWarning("Error reading file"); + owarn << "Error reading file" << oendl; return errorProt; } bool DBXmlHandler::startDocument() { errorProt = ""; state = StateInit; return TRUE; @@ -167,17 +173,17 @@ bool DBXmlHandler::startElement(const QString&, const QString&, return TRUE; } if (state == StateHeader && qName == "key") { /* Ok, adding a new key to our KeyList TODO */ state = StateKey; last_key_type = TVVariant::String; key = atts.value("name"); if (key.isEmpty()) { - qWarning("empty key name"); + owarn << "empty key name" << oendl; return FALSE; } if(!atts.value("type").isEmpty()) last_key_type = TVVariant::nameToType(atts.value("type")); return TRUE; } if (state == StateDocument && qName == "record") { state = StateRecord; @@ -185,23 +191,23 @@ bool DBXmlHandler::startElement(const QString&, const QString&, // Now expecting a <record> tag return TRUE; } if (state == StateRecord) { state = StateField; /* the qName is the name of a key */ if (!keyIndexList[qName]) { /* invalid key, we failed */ - qWarning("Invalid key in record"); + owarn << "Invalid key in record" << oendl; return FALSE; } keyIndex = *keyIndexList[qName]; return TRUE; } - qWarning("Unable to determine tag type"); + owarn << "Unable to determine tag type" << oendl; return FALSE; } bool DBXmlHandler::endElement(const QString&, const QString&, const QString& qName) { switch(state) { case StateField: @@ -220,17 +226,17 @@ bool DBXmlHandler::endElement(const QString&, const QString&, data_store->addItem(current_data); state = StateDocument; break; case StateDocument: // we are done... break; default: // should only get a 'endElement' from one of the above states. - qWarning("Invalid end tag"); + owarn << "Invalid end tag" << oendl; return FALSE; break; } return TRUE; } bool DBXmlHandler::characters(const QString& ch) { @@ -249,49 +255,49 @@ bool DBXmlHandler::characters(const QString& ch) return TRUE; } if (state == StateField) { /* Ok, need to add data here */ current_data->setField(keyIndex, ch_simplified); return TRUE; } - qWarning("Junk characters found... ignored"); + owarn << "Junk characters found... ignored" << oendl; return TRUE; } QString DBXmlHandler::errorString() { return "the document is not in the expected file format"; } bool DBXmlHandler::warning(const QXmlParseException& exception) { errorProt += QString("warning parsing error: %1 in line %2, column %3\n" ) .arg(exception.message()) .arg(exception.lineNumber()) .arg(exception.columnNumber()); - qWarning(errorProt); + owarn << errorProt << oendl; return QXmlDefaultHandler::fatalError(exception); } bool DBXmlHandler::error(const QXmlParseException& exception) { errorProt += QString("error parsing error: %1 in line %2, column %3\n" ) .arg(exception.message()) .arg(exception.lineNumber()) .arg(exception.columnNumber()); - qWarning(errorProt); + owarn << errorProt << oendl; return QXmlDefaultHandler::fatalError(exception); } bool DBXmlHandler::fatalError(const QXmlParseException& exception) { errorProt += QString("fatal parsing error: %1 in line %2, column %3\n" ) .arg(exception.message()) .arg(exception.lineNumber()) .arg(exception.columnNumber()); - qWarning(errorProt); + owarn << errorProt << oendl; return QXmlDefaultHandler::fatalError(exception); } |