diff options
Diffstat (limited to 'umbrello/umbrello/codeimport/kdevcppparser/urlutil.cpp')
-rw-r--r-- | umbrello/umbrello/codeimport/kdevcppparser/urlutil.cpp | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/umbrello/umbrello/codeimport/kdevcppparser/urlutil.cpp b/umbrello/umbrello/codeimport/kdevcppparser/urlutil.cpp index 9b48649d..5235bc3c 100644 --- a/umbrello/umbrello/codeimport/kdevcppparser/urlutil.cpp +++ b/umbrello/umbrello/codeimport/kdevcppparser/urlutil.cpp @@ -20,10 +20,10 @@ */ #include "urlutil.h" -#include <qstringlist.h> +#include <tqstringlist.h> -#include <qdir.h> -#include <qfileinfo.h> +#include <tqdir.h> +#include <tqfileinfo.h> #include <kdebug.h> #include <unistd.h> @@ -39,27 +39,27 @@ // Namespace URLUtil /////////////////////////////////////////////////////////////////////////////// -QString URLUtil::filename(const QString & name) { +TQString URLUtil::filename(const TQString & name) { int slashPos = name.findRev("/"); return slashPos<0 ? name : name.mid(slashPos+1); } /////////////////////////////////////////////////////////////////////////////// -QString URLUtil::directory(const QString & name) { +TQString URLUtil::directory(const TQString & name) { int slashPos = name.findRev("/"); - return slashPos<0 ? QString("") : name.left(slashPos); + return slashPos<0 ? TQString("") : name.left(slashPos); } /////////////////////////////////////////////////////////////////////////////// -QString URLUtil::relativePath(const KURL & parent, const KURL & child, uint slashPolicy) { +TQString URLUtil::relativePath(const KURL & parent, const KURL & child, uint slashPolicy) { bool slashPrefix = slashPolicy & SLASH_PREFIX; bool slashSuffix = slashPolicy & SLASH_SUFFIX; if (parent == child) - return slashPrefix ? QString("/") : QString(""); + return slashPrefix ? TQString("/") : TQString(""); - if (!parent.isParentOf(child)) return QString(); + if (!parent.isParentOf(child)) return TQString(); int a=slashPrefix ? -1 : 1; int b=slashSuffix ? 1 : -1; return child.path(b).mid(parent.path(a).length()); @@ -67,15 +67,15 @@ QString URLUtil::relativePath(const KURL & parent, const KURL & child, uint slas /////////////////////////////////////////////////////////////////////////////// -QString URLUtil::relativePath(const QString & parent, const QString & child, uint slashPolicy) { +TQString URLUtil::relativePath(const TQString & parent, const TQString & child, uint slashPolicy) { return relativePath(KURL(parent), KURL(child), slashPolicy); } /////////////////////////////////////////////////////////////////////////////// -QString URLUtil::upDir(const QString & path, bool slashSuffix) { +TQString URLUtil::upDir(const TQString & path, bool slashSuffix) { int slashPos = path.findRev("/"); - if (slashPos<1) return QString::null; + if (slashPos<1) return TQString::null; return path.mid(0,slashPos+ (slashSuffix ? 1 : 0) ); } @@ -93,41 +93,41 @@ KURL URLUtil::mergeURL(const KURL & source, const KURL & dest, const KURL & chil if (dest == child) return source; // calculate - QString childUrlStr = child.url(-1); - QString destStemStr = dest.url(1); - QString sourceStemStr = source.url(1); + TQString childUrlStr = child.url(-1); + TQString destStemStr = dest.url(1); + TQString sourceStemStr = source.url(1); return KURL(sourceStemStr.append( childUrlStr.mid( destStemStr.length() ) ) ); } /////////////////////////////////////////////////////////////////////////////// -QString URLUtil::getExtension(const QString & path) { +TQString URLUtil::getExtension(const TQString & path) { int dotPos = path.findRev('.'); - if (dotPos<0) return QString(""); + if (dotPos<0) return TQString(""); return path.mid(dotPos+1); } /////////////////////////////////////////////////////////////////////////////// -QString URLUtil::extractPathNameRelative(const KURL &baseDirUrl, const KURL &url ) +TQString URLUtil::extractPathNameRelative(const KURL &baseDirUrl, const KURL &url ) { - QString absBase = extractPathNameAbsolute( baseDirUrl ), + TQString absBase = extractPathNameAbsolute( baseDirUrl ), absRef = extractPathNameAbsolute( url ); int i = absRef.find( absBase, 0, true ); if (i == -1) - return QString(); + return TQString(); if (absRef == absBase) - return QString( "." ); + return TQString( "." ); else - return absRef.replace( 0, absBase.length(), QString() ); + return absRef.replace( 0, absBase.length(), TQString() ); } /////////////////////////////////////////////////////////////////////////////// -QString URLUtil::extractPathNameRelative(const QString &basePath, const KURL &url ) +TQString URLUtil::extractPathNameRelative(const TQString &basePath, const KURL &url ) { #if (KDE_VERSION_MINOR!=0) || (KDE_VERSION_MAJOR!=3) KURL baseDirUrl = KURL::fromPathOrURL( basePath ); @@ -139,7 +139,7 @@ QString URLUtil::extractPathNameRelative(const QString &basePath, const KURL &ur /////////////////////////////////////////////////////////////////////////////// -QString URLUtil::extractPathNameRelative(const QString &basePath, const QString &absFilePath ) +TQString URLUtil::extractPathNameRelative(const TQString &basePath, const TQString &absFilePath ) { #if (KDE_VERSION_MINOR!=0) || (KDE_VERSION_MAJOR!=3) KURL baseDirUrl = KURL::fromPathOrURL( basePath ), @@ -153,7 +153,7 @@ QString URLUtil::extractPathNameRelative(const QString &basePath, const QString /////////////////////////////////////////////////////////////////////////////// -QString URLUtil::extractPathNameAbsolute( const KURL &url ) +TQString URLUtil::extractPathNameAbsolute( const KURL &url ) { if (isDirectory( url )) return url.path( +1 ); // with trailing "/" if none is present @@ -162,9 +162,9 @@ QString URLUtil::extractPathNameAbsolute( const KURL &url ) // Ok, this is an over-tight pre-condition on "url" since I hope nobody will never // stress this function with absurd cases ... but who knows? /* - QString path = url.path(); - QFileInfo fi( path ); // Argh: QFileInfo is back ;)) - return ( fi.exists()? path : QString() ); + TQString path = url.path(); + TQFileInfo fi( path ); // Argh: TQFileInfo is back ;)) + return ( fi.exists()? path : TQString() ); */ return url.path(); } @@ -179,14 +179,14 @@ bool URLUtil::isDirectory( const KURL &url ) /////////////////////////////////////////////////////////////////////////////// -bool URLUtil::isDirectory( const QString &absFilePath ) +bool URLUtil::isDirectory( const TQString &absFilePath ) { - return QDir( absFilePath ).exists(); + return TQDir( absFilePath ).exists(); } /////////////////////////////////////////////////////////////////////////////// -void URLUtil::dump( const KURL::List &urls, const QString &aMessage ) +void URLUtil::dump( const KURL::List &urls, const TQString &aMessage ) { if (!aMessage.isNull()) { @@ -203,9 +203,9 @@ void URLUtil::dump( const KURL::List &urls, const QString &aMessage ) /////////////////////////////////////////////////////////////////////////////// -QStringList URLUtil::toRelativePaths( const QString &baseDir, const KURL::List &urls) +TQStringList URLUtil::toRelativePaths( const TQString &baseDir, const KURL::List &urls) { - QStringList paths; + TQStringList paths; for (size_t i=0; i<urls.count(); ++i) { @@ -217,25 +217,25 @@ QStringList URLUtil::toRelativePaths( const QString &baseDir, const KURL::List & /////////////////////////////////////////////////////////////////////////////// -QString URLUtil::relativePathToFile( const QString & dirUrl, const QString & fileUrl ) +TQString URLUtil::relativePathToFile( const TQString & dirUrl, const TQString & fileUrl ) { if (dirUrl.isEmpty() || (dirUrl == "/")) return fileUrl; - QStringList dir = QStringList::split("/", dirUrl, false); - QStringList file = QStringList::split("/", fileUrl, false); + TQStringList dir = TQStringList::split("/", dirUrl, false); + TQStringList file = TQStringList::split("/", fileUrl, false); - QString resFileName = file.last(); + TQString resFileName = file.last(); file.remove(file.last()); uint i = 0; while ( (i < dir.count()) && (i < (file.count())) && (dir[i] == file[i]) ) i++; - QString result_up; - QString result_down; - QString currDir; - QString currFile; + TQString result_up; + TQString result_down; + TQString currDir; + TQString currFile; do { i >= dir.count() ? currDir = "" : currDir = dir[i]; @@ -261,17 +261,17 @@ QString URLUtil::relativePathToFile( const QString & dirUrl, const QString & fil /////////////////////////////////////////////////////////////////////////////// -// code from qt-3.1.2 version of QDir::canonicalPath() -QString URLUtil::canonicalPath( const QString & path ) +// code from qt-3.1.2 version of TQDir::canonicalPath() +TQString URLUtil::canonicalPath( const TQString & path ) { - QString r; + TQString r; char cur[PATH_MAX+1]; if ( ::getcwd( cur, PATH_MAX ) ) { char tmp[PATH_MAX+1]; - if( ::realpath( QFile::encodeName( path ), tmp ) ) + if( ::realpath( TQFile::encodeName( path ), tmp ) ) { - r = QFile::decodeName( tmp ); + r = TQFile::decodeName( tmp ); } //always make sure we go back to the current dir ::chdir( cur ); @@ -283,7 +283,7 @@ QString URLUtil::canonicalPath( const QString & path ) //written by "Dawit A." <adawit@kde.org> //borrowed from his patch to KShell -QString URLUtil::envExpand ( const QString& str ) +TQString URLUtil::envExpand ( const TQString& str ) { uint len = str.length(); @@ -294,11 +294,11 @@ QString URLUtil::envExpand ( const QString& str ) if (pos < 0) pos = len; - char* ret = getenv( QConstString(str.unicode()+1, pos-1).string().local8Bit().data() ); + char* ret = getenv( TQConstString(str.unicode()+1, pos-1).string().local8Bit().data() ); if (ret) { - QString expandedStr ( QFile::decodeName( ret ) ); + TQString expandedStr ( TQFile::decodeName( ret ) ); if (pos < (int)len) expandedStr += str.mid(pos); return expandedStr; |