summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth/lib/parser.cc
Side-by-side diff
Diffstat (limited to 'noncore/net/opietooth/lib/parser.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/lib/parser.cc60
1 files changed, 33 insertions, 27 deletions
diff --git a/noncore/net/opietooth/lib/parser.cc b/noncore/net/opietooth/lib/parser.cc
index 8baf284..7e95907 100644
--- a/noncore/net/opietooth/lib/parser.cc
+++ b/noncore/net/opietooth/lib/parser.cc
@@ -1,7 +1,13 @@
+#include "parser.h"
+
+/* OPIE */
+#include <opie2/odebug.h>
+using namespace Opie::Core;
+
+/* QT */
#include <qstringlist.h>
-#include "parser.h"
using namespace OpieTooth;
@@ -13,29 +19,29 @@ namespace {
// @eturn 13398
// tactic find " (
int convert( const QString& line, QString& ret ) {
-// qWarning("called");
+// owarn << "called" << oendl;
ret = QString::null;
int i = 0;
int pos = line.findRev("\" (");
if ( pos > 0 ) { // it shouldn't be at pos 0
ret = line.left(pos ).stripWhiteSpace();
- // qWarning("ret: %s", ret.latin1() );
+ // owarn << "ret: " << ret.latin1() << oendl;
ret = ret.replace(QRegExp("[\"]"), "");
- //qWarning("ret: %s", ret.latin1() );
+ //owarn << "ret: " << ret.latin1() << oendl;
QString dummy = line.mid(pos + 5 );
- //qWarning("dummy: %s", dummy.latin1() );
+ //owarn << "dummy: " << dummy.latin1() << oendl;
dummy = dummy.replace(QRegExp("[)]"), "");
- //qWarning("dummy: %s", dummy.latin1() );
+ //owarn << "dummy: " << dummy.latin1() << oendl;
// dummy = dummy.remove( dummy.length() -2, 1 ); // remove the )
bool ok;
i = dummy.toInt(&ok, 16 );
//if (ok ) {
- // qWarning("converted %d", i);
- //}else qWarning("failed" );
- //qWarning("exiting");
+ // owarn << "converted " << i << oendl;
+ //}else owarn << "failed" << oendl;
+ //owarn << "exiting" << oendl;
return i;
}
- //qWarning("output %d", i );
+ //owarn << "output " << i << oendl;
return i;
}
@@ -57,11 +63,11 @@ void Parser::parse( const QString& string) {
QStringList list = QStringList::split('\n', string,TRUE );
QStringList::Iterator it;
for (it = list.begin(); it != list.end(); ++it ) {
- //qWarning("line:%s:line", (*it).latin1() );
+ //owarn << "line:" << (*it).latin1() << oendl;
if ( (*it).startsWith("Browsing") ) continue;
if ( (*it).stripWhiteSpace().isEmpty() ) { // line is empty because a new Service begins
- qWarning("could add");
+ owarn << "could add" << oendl;
// now see if complete and add
if (m_complete ) {
if (!m_item.serviceName().isEmpty() )
@@ -80,22 +86,22 @@ void Parser::parse( const QString& string) {
}
// missed the last one
if (m_complete) {
-// qWarning("adding");
+// owarn << "adding" << oendl;
if (!m_item.serviceName().isEmpty() )
m_list.append(m_item );
}
QValueList<Services>::Iterator it2;
if (m_list.isEmpty() )
- qWarning("m_list is empty");
+ owarn << "m_list is empty" << oendl;
for (it2 = m_list.begin(); it2 != m_list.end(); ++it2 ) {
- qWarning("name %s", (*it2).serviceName().latin1() );
+ owarn << "name " << (*it2).serviceName().latin1() << oendl;
}
}
bool Parser::parseName( const QString& str) {
if (str.startsWith("Service Name:") ) {
m_item.setServiceName( str.mid(13).stripWhiteSpace() );
- qWarning(m_item.serviceName() );
+ owarn << m_item.serviceName() << oendl;
return true;
}
return false;
@@ -103,13 +109,13 @@ bool Parser::parseName( const QString& str) {
bool Parser::parseRecHandle( const QString& str) {
if (str.startsWith("Service RecHandle:" ) ) {
QString out = str.mid(18 ).stripWhiteSpace();
- qWarning("out %s", out.latin1() );
+ owarn << "out " << out.latin1() << oendl;
int value = out.mid(2).toInt(&m_ok, 16 );
if (m_ok && (value != -1) )
m_complete = true;
else
m_complete = false;
- qWarning("rec handle %d", value);
+ owarn << "rec handle " << value << oendl;
m_item.setRecHandle( value );
return true;
@@ -118,13 +124,13 @@ bool Parser::parseRecHandle( const QString& str) {
}
bool Parser::parseClassId( const QString& str) {
if (str.startsWith("Service Class ID List:") ) {
- qWarning("found class id" );
- qWarning("line:%s", str.latin1() );
+ owarn << "found class id" << oendl;
+ owarn << "line: " << str.latin1() << oendl;
m_classOver = true;
return true;
}else if ( m_classOver && str.startsWith(" " ) ){ // ok now are the informations in place
- qWarning("line with class id" );
- qWarning("%s",str.latin1() );
+ owarn << "line with class id" << oendl;
+ owarn << str.latin1() << oendl;
// "Obex Object Push" (0x1105)
// find backwards the " and the from 0 to pos and the mid pos+1
@@ -133,12 +139,12 @@ bool Parser::parseClassId( const QString& str) {
QString classes;
int ids;
ids = convert( str, classes );
- qWarning("ids %d", ids );
+ owarn << "ids " << ids << oendl;
m_item.insertClassId( ids, classes );
return true;
}else{
- qWarning("Else %d", m_classOver );
+ owarn << "Else " << m_classOver << oendl;
m_classOver = false;
}
return false;
@@ -150,7 +156,7 @@ bool Parser::parseProtocol( const QString& str) {
return true;
}else if (m_protocolOver && str.startsWith(" ") ) { // "L2CAP" (0x0100)
- qWarning("double protocol filter");
+ owarn << "double protocol filter" << oendl;
if (!m_protocolAdded ) { // the protocol does neither supply a channel nor port so add it now
Services::ProtocolDescriptor desc( m_protName, m_protId );
@@ -162,7 +168,7 @@ bool Parser::parseProtocol( const QString& str) {
}
return true;
}else if (m_protocolOver && str.startsWith(" ") ) {
- qWarning("tripple protocol filter");
+ owarn << "tripple protocol filter" << oendl;
m_protocolAdded = true;
QString dummy = str.stripWhiteSpace();
int pos = dummy.findRev(':');
@@ -187,7 +193,7 @@ bool Parser::parseProfile( const QString& str) {
int pos = str.findRev(':');
if ( pos > 0 ) {
int dummy = str.mid(pos+1 ).stripWhiteSpace().toInt();
- qWarning("dummyInt:%d", dummy );
+ owarn << "dummyInt: " << dummy << oendl;
Services::ProfileDescriptor desc( m_profName, m_profId, dummy );
m_item.insertProfileDescriptor(desc);
}