summaryrefslogtreecommitdiffabout
path: root/microkde
Side-by-side diff
Diffstat (limited to 'microkde') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kidmanager.cpp10
-rw-r--r--microkde/kidmanager.h10
2 files changed, 10 insertions, 10 deletions
diff --git a/microkde/kidmanager.cpp b/microkde/kidmanager.cpp
index e687e5d..d712771 100644
--- a/microkde/kidmanager.cpp
+++ b/microkde/kidmanager.cpp
@@ -1,110 +1,110 @@
#include "kidmanager.h"
KIdManager::KIdManager()
{
}
// :profilename;12;id_withLen12;123456:
// 123456 is the csum
-QString KIdManager::setId (const QString& idString,const QString& prof,const QString& idvalue )
+const QString KIdManager::setId (const QString& idString,const QString& prof,const QString& idvalue )
{
int startProf;
int startIDnum;
int startIDnumlen;
int startID;
int lenID;
int startCsum;
int lenCsum;
int endall;
QString newIDString;
if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) {
newIDString = idString.left(startIDnum ) + QString::number( idvalue.length() ) +";"+idvalue+ ";"+idString.mid( startCsum );
} else {
newIDString = idString + prof+";"+ QString::number( idvalue.length() ) +";"+idvalue +";0:";
}
//qDebug("setID:profile:%s*retval:%s*idvalue:%s* ", prof.latin1(), newIDString.latin1() ,idvalue.latin1() );
return newIDString;
}
-QString KIdManager::getId (const QString& idString,const QString& prof )
+const QString KIdManager::getId (const QString& idString,const QString& prof )
{
int startProf;
int startIDnum;
int startIDnumlen;
int startID;
int lenID;
int startCsum;
int lenCsum;
int endall;
QString idval = "";
if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) )
idval = idString.mid( startID, lenID );
//qDebug("getID:profile:%s*retval:%s*idstring:%s* ", prof.latin1(), idval.latin1() ,idString.latin1() );
return idval;
}
-QString KIdManager::removeId (const QString& idString,const QString& prof )
+const QString KIdManager::removeId (const QString& idString,const QString& prof )
{
int startProf;
int startIDnum;
int startIDnumlen;
int startID;
int lenID;
int startCsum;
int lenCsum;
int endall;
QString newIDString;
if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) {
newIDString = idString.left(startProf) + idString.mid( endall+1 );
} else {
newIDString = idString;
}
//qDebug("removeID:profile:%s*retval:%s*oldidstring:%s* ", prof.latin1(), newIDString.latin1() ,idString.latin1() );
return newIDString;
}
-QString KIdManager::setCsum (const QString& idString,const QString& prof,const QString& idCsum )
+const QString KIdManager::setCsum (const QString& idString,const QString& prof,const QString& idCsum )
{
int startProf;
int startIDnum;
int startIDnumlen;
int startID;
int lenID;
int startCsum;
int lenCsum;
int endall;
QString newIDString;
if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) {
newIDString = idString.left(startCsum) + idCsum+ idString.mid( endall +1);
} else {
newIDString = idString + prof + ";3;_u_;"+ idCsum + ":";
}
//qDebug("setCsum:profile:%s*retval:%s*idCsum:%s* ", prof.latin1(), newIDString.latin1() ,idCsum.latin1() );
return newIDString;
}
-QString KIdManager::getCsum (const QString& idString,const QString& prof )
+const QString KIdManager::getCsum (const QString& idString,const QString& prof )
{
int startProf;
int startIDnum;
int startIDnumlen;
int startID;
int lenID;
int startCsum;
int lenCsum;
int endall;
QString idval = "";
if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) )
idval = idString.mid( startCsum, lenCsum );
//qDebug("getCsum:profile:%s*retval:%s*idstring:%s* ", prof.latin1(), idval.latin1() ,idString.latin1() );
return idval;
}
// :profilename;12;id_withLen12;123456:
bool KIdManager::getNumbers (const QString& idString,const QString& prof, int &startProf, int &startIDnum, int &startIDnumlen,int &startID, int& lenID, int &startCsum, int &lenCsum, int & endall)
{
startProf = idString.find( ":"+prof+";" );
if ( startProf >= 0 ) {
startIDnum = prof.length()+2+startProf;
startID = idString.find( ";", startIDnum ) +1;
startIDnumlen = startID - startIDnum - 1;
diff --git a/microkde/kidmanager.h b/microkde/kidmanager.h
index 00580a0..9786c9f 100644
--- a/microkde/kidmanager.h
+++ b/microkde/kidmanager.h
@@ -1,24 +1,24 @@
#ifndef MINIKDE_KIDMANAGER_H
#define MINIKDE_KIDMANAGER_H
#include <qstring.h>
#include <qobject.h>
class KIdManager : public QObject
{
Q_OBJECT
public:
KIdManager( );
- static QString setId (const QString& idString,const QString& id,const QString& idvalue ) ;
- static QString getId (const QString& idString,const QString& id ) ;
- static QString removeId (const QString& idString,const QString& id ) ;
- static QString setCsum (const QString& idString,const QString& id,const QString& idvalue ) ;
- static QString getCsum (const QString& idString,const QString& id ) ;
+ static const QString setId (const QString& idString,const QString& id,const QString& idvalue ) ;
+ static const QString getId (const QString& idString,const QString& id ) ;
+ static const QString removeId (const QString& idString,const QString& id ) ;
+ static const QString setCsum (const QString& idString,const QString& id,const QString& idvalue ) ;
+ static const QString getCsum (const QString& idString,const QString& id ) ;
static bool getNumbers (const QString& idString,const QString& id, int &startProf, int &startIDnum, int &startIDnumlen,int &startID, int& lenID, int &startCsum, int &lenCsum, int & endall) ;
private:
private slots:
};
#endif