From 576eb4299a00bc053db35414406f46372a0f70f2 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:42:31 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1157643 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- lskat/lskatproc/KEMessage.cpp | 70 +++++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 35 deletions(-) (limited to 'lskat/lskatproc/KEMessage.cpp') diff --git a/lskat/lskatproc/KEMessage.cpp b/lskat/lskatproc/KEMessage.cpp index db598573..ce8985f3 100644 --- a/lskat/lskatproc/KEMessage.cpp +++ b/lskat/lskatproc/KEMessage.cpp @@ -19,7 +19,7 @@ #include #include "KEMessage.h" -void KEMessage::AddEntry(QString key,KMessageEntry *entry) +void KEMessage::AddEntry(TQString key,KMessageEntry *entry) { // printf(" AddingEntry: %s with data field %p\n",(char *)key,entry->QueryData()); if (!entry) return ; @@ -27,7 +27,7 @@ void KEMessage::AddEntry(QString key,KMessageEntry *entry) keys.append(key.latin1()); } -void KEMessage::AddDataType(QString key,int size,const char *data,KGM_TYPE type) +void KEMessage::AddDataType(TQString key,int size,const char *data,KGM_TYPE type) { // printf("AddDataType for %s size=%d\n",(const char *)key,size); if (size<=0) return ; @@ -37,28 +37,28 @@ void KEMessage::AddDataType(QString key,int size,const char *data,KGM_TYPE type) AddEntry(key,entry); } -void KEMessage::AddData(QString key,short data) +void KEMessage::AddData(TQString key,short data) { AddDataType(key,sizeof(short),(char *)&data,KGM_TYPE_SHORT); } -void KEMessage::AddData(QString key,long data) +void KEMessage::AddData(TQString key,long data) { AddDataType(key,sizeof(long),(char *)&data,KGM_TYPE_LONG); } -void KEMessage::AddData(QString key,float data) +void KEMessage::AddData(TQString key,float data) { AddDataType(key,sizeof(float),(char *)&data,KGM_TYPE_FLOAT); } -void KEMessage::AddData(QString key,const char *data,int size) +void KEMessage::AddData(TQString key,const char *data,int size) { if (size<0) size=strlen(data)+1; // +1 for 0 Byte AddDataType(key,size,data,KGM_TYPE_DATA); } -KGM_TYPE KEMessage::QueryType(QString key) +KGM_TYPE KEMessage::QueryType(TQString key) { KMessageEntry *entry; entry=dict.find(key); @@ -66,7 +66,7 @@ KGM_TYPE KEMessage::QueryType(QString key) return entry->QueryType(); } -bool KEMessage::HasKey(QString key) +bool KEMessage::HasKey(TQString key) { KMessageEntry *entry; entry=dict.find(key); @@ -74,7 +74,7 @@ bool KEMessage::HasKey(QString key) return true; } -bool KEMessage::GetData(QString key,short &s) +bool KEMessage::GetData(TQString key,short &s) { short *result; KMessageEntry *entry; @@ -87,7 +87,7 @@ bool KEMessage::GetData(QString key,short &s) return true; } -bool KEMessage::GetData(QString key,long &l) +bool KEMessage::GetData(TQString key,long &l) { long *result; KMessageEntry *entry; @@ -99,7 +99,7 @@ bool KEMessage::GetData(QString key,long &l) return true; } -bool KEMessage::GetData(QString key,float &f) +bool KEMessage::GetData(TQString key,float &f) { float *result; KMessageEntry *entry; @@ -112,7 +112,7 @@ bool KEMessage::GetData(QString key,float &f) return true; } -bool KEMessage::GetData(QString key,char * &c,int &size) +bool KEMessage::GetData(TQString key,char * &c,int &size) { KMessageEntry *entry; entry=dict.find(key); @@ -123,13 +123,13 @@ bool KEMessage::GetData(QString key,char * &c,int &size) return true; } -QString KEMessage::EntryToString(char *key,KMessageEntry *entry) +TQString KEMessage::EntryToString(char *key,KMessageEntry *entry) { - QString s,tmp; + TQString s,tmp; int size,i; KGM_TYPE type; char *data; - s=QCString(""); + s=TQCString(""); if (!entry) return s; size=entry->QuerySize(); type=entry->QueryType(); @@ -142,7 +142,7 @@ QString KEMessage::EntryToString(char *key,KMessageEntry *entry) size,KEMESSAGE_SEP, (int)type,KEMESSAGE_SEP); */ - tmp=QCString(key); + tmp=TQCString(key); s+=tmp; s+=KEMESSAGE_SEP; tmp.sprintf("%d",size); @@ -168,31 +168,31 @@ QString KEMessage::EntryToString(char *key,KMessageEntry *entry) return s; } -QString KEMessage::StringToEntry(QString str,KMessageEntry *entry) +TQString KEMessage::StringToEntry(TQString str,KMessageEntry *entry) { int pos,oldpos,cnt,len; - QString key,size,type,data; + TQString key,size,type,data; const char *p; char *q; char c; len=KEMESSAGE_SEP.length(); - if (!entry) return QString(); + if (!entry) return TQString(); pos=str.find(KEMESSAGE_SEP,0); - if (pos<0) return QString(); // wrong format + if (pos<0) return TQString(); // wrong format key=str.left(pos); oldpos=pos; pos=str.find(KEMESSAGE_SEP,oldpos+len); - if (pos<0) return QString(); // wrong format + if (pos<0) return TQString(); // wrong format size=str.mid(oldpos+len,pos-oldpos-len); oldpos=pos; pos=str.find(KEMESSAGE_SEP,oldpos+len); - if (pos<0) return QString(); // wrong format + if (pos<0) return TQString(); // wrong format type=str.mid(oldpos+len,pos-oldpos-len); @@ -205,10 +205,10 @@ QString KEMessage::StringToEntry(QString str,KMessageEntry *entry) // I hope this works with unicode strings as well p=data.latin1(); q=(char *)calloc(data.length()/2,sizeof(char)); - if (!q) return QString(); + if (!q) return TQString(); for(pos=0;pos(int)data.length()) return QString(); // SEVERE ERROR + if (pos*2+1>(int)data.length()) return TQString(); // SEVERE ERROR c=*(p+2*pos)-'a' | ((*(p+2*pos+1)-'a')<<4); q[pos]=c; } @@ -218,35 +218,35 @@ QString KEMessage::StringToEntry(QString str,KMessageEntry *entry) return key; } -QString KEMessage::ToString() +TQString KEMessage::ToString() { - QString s; + TQString s; KMessageEntry *entry; char *it; s=KEMESSAGE_HEAD+KEMESSAGE_CR; for (it=keys.first();it!=0;it=keys.next()) { - entry=dict.find(QCString(it)); + entry=dict.find(TQCString(it)); s+=EntryToString(it,entry); } s+=KEMESSAGE_TAIL+KEMESSAGE_CR; return s; } -bool KEMessage::AddString(QString s) +bool KEMessage::AddString(TQString s) { // break s into key,size and data - QString key; + TQString key; KMessageEntry *entry=new KMessageEntry; key=StringToEntry(s,entry); if (!key) return false; AddEntry(key,entry); return true; } -bool KEMessage::AddStringMsg(QString str) +bool KEMessage::AddStringMsg(TQString str) { bool result; - QString data; + TQString data; int pos,oldpos,len; len=KEMESSAGE_CR.length(); @@ -277,7 +277,7 @@ void KEMessage::RemoveAll() dict.clear(); } -void KEMessage::Remove(QString key) +void KEMessage::Remove(TQString key) { keys.remove(key.latin1()); dict.remove(key); @@ -287,7 +287,7 @@ uint KEMessage::QueryNumberOfKeys() { return keys.count(); } -QStrList *KEMessage::QueryKeys() +TQStrList *KEMessage::QueryKeys() { return &keys; } @@ -315,10 +315,10 @@ KEMessage &KEMessage::operator=(KEMessage &msg) // printf("Assigning = KEMessage from %p to %p\n",&msg,this); for (it=msg.keys.first();it!=0;it=msg.keys.next()) { - entry=msg.dict.find(QCString(it)); + entry=msg.dict.find(TQCString(it)); newentry=new KMessageEntry; *newentry=*entry; - AddEntry(QCString(it),newentry); + AddEntry(TQCString(it),newentry); } // return *newmsg; -- cgit v1.2.1