diff options
-rw-r--r-- | qtools/qcache.h | 47 | ||||
-rw-r--r-- | qtools/qcstring.cpp | 241 | ||||
-rw-r--r-- | qtools/qcstring.h | 15 | ||||
-rw-r--r-- | qtools/qdatetime.cpp | 28 | ||||
-rw-r--r-- | qtools/qdatetime.h | 12 | ||||
-rw-r--r-- | qtools/qdict.h | 81 | ||||
-rw-r--r-- | qtools/qgcache.cpp | 34 | ||||
-rw-r--r-- | qtools/qgcache.h | 10 | ||||
-rw-r--r-- | qtools/qgdict.cpp | 93 | ||||
-rw-r--r-- | qtools/qgdict.h | 26 | ||||
-rw-r--r-- | src/cite.cpp | 2 | ||||
-rw-r--r-- | src/classdef.cpp | 2 | ||||
-rw-r--r-- | src/cmdmapper.cpp | 4 | ||||
-rw-r--r-- | src/cmdmapper.h | 2 | ||||
-rw-r--r-- | src/code.l | 5 | ||||
-rw-r--r-- | src/commentscan.l | 4 | ||||
-rw-r--r-- | src/configimpl.l | 9 | ||||
-rw-r--r-- | src/docparser.cpp | 14 | ||||
-rw-r--r-- | src/docparser.h | 1 | ||||
-rw-r--r-- | src/dotfilepatcher.cpp | 4 | ||||
-rw-r--r-- | src/dotnode.cpp | 34 | ||||
-rw-r--r-- | src/dotrunner.cpp | 4 | ||||
-rw-r--r-- | src/doxygen.cpp | 2 | ||||
-rw-r--r-- | src/eclipsehelp.cpp | 2 | ||||
-rw-r--r-- | src/fortrancode.l | 2 | ||||
-rw-r--r-- | src/fortranscanner.l | 2 | ||||
-rw-r--r-- | src/ftextstream.h | 6 | ||||
-rw-r--r-- | src/htmldocvisitor.cpp | 16 | ||||
-rw-r--r-- | src/index.cpp | 21 | ||||
-rw-r--r-- | src/mandocvisitor.cpp | 19 | ||||
-rw-r--r-- | src/markdown.cpp | 2 | ||||
-rw-r--r-- | src/rtfgen.cpp | 4 | ||||
-rw-r--r-- | src/sortdict.h | 4 | ||||
-rw-r--r-- | src/tclscanner.l | 20 |
34 files changed, 388 insertions, 384 deletions
diff --git a/qtools/qcache.h b/qtools/qcache.h index e1f13d6..39d4f7a 100644 --- a/qtools/qcache.h +++ b/qtools/qcache.h @@ -42,46 +42,6 @@ #include "qgcache.h" #endif // QT_H -#define USE_ASCII_STRING - -#ifndef USE_ASCII_STRING - -template<class type> class Q_EXPORT QCache : public QGCache -{ -public: - QCache( const QCache<type> &c ) : QGCache(c) {} - QCache( int maxCost=100, int size=17, bool caseSensitive=TRUE ) - : QGCache( maxCost, size, StringKey, caseSensitive, FALSE ) {} - ~QCache() { clear(); } - QCache<type> &operator=( const QCache<type> &c ) - { return (QCache<type>&)QGCache::operator=(c); } - int maxCost() const { return QGCache::maxCost(); } - int totalCost() const { return QGCache::totalCost(); } - void setMaxCost( int m ) { QGCache::setMaxCost(m); } - uint count() const { return QGCache::count(); } - uint size() const { return QGCache::size(); } - bool isEmpty() const { return QGCache::count() == 0; } - void clear() { QGCache::clear(); } - bool insert( const QString &k, const type *d, int c=1, int p=0 ) - { return QGCache::insert_string(k,(Item)d,c,p);} - bool remove( const QString &k ) - { return QGCache::remove_string(k); } - type *take( const QString &k ) - { return (type *)QGCache::take_string(k); } - type *find( const QString &k, bool ref=TRUE ) const - { return (type *)QGCache::find_string(k,ref);} - type *operator[]( const QString &k ) const - { return (type *)QGCache::find_string(k);} - void statistics() const { QGCache::statistics(); } - int hits() const { return QGCache::hits(); } - int misses() const { return QGCache::misses(); } -private: - void deleteItem( Item d ) { if ( del_item ) delete (type *)d; } -}; - -#else - - template<class type> class Q_EXPORT QCache : public QGCache { public: @@ -116,9 +76,6 @@ private: }; -#endif - - template<class type> class Q_EXPORT QCacheIterator : public QGCacheIterator { @@ -136,11 +93,7 @@ public: type *toLast() { return (type *)QGCacheIterator::toLast(); } operator type *() const { return (type *)QGCacheIterator::get(); } type *current() const { return (type *)QGCacheIterator::get(); } -#ifndef USE_ASCII_STRING - QString currentKey() const{ return QGCacheIterator::getKeyString(); } -#else const char *currentKey() const{ return QGCacheIterator::getKeyAscii(); } -#endif type *operator()() { return (type *)QGCacheIterator::operator()();} type *operator++() { return (type *)QGCacheIterator::operator++(); } type *operator+=(uint j) { return (type *)QGCacheIterator::operator+=(j);} diff --git a/qtools/qcstring.cpp b/qtools/qcstring.cpp index 6a14d66..64417e3 100644 --- a/qtools/qcstring.cpp +++ b/qtools/qcstring.cpp @@ -17,6 +17,7 @@ #include "qgstring.h" #include <qstring.h> +#include <limits.h> #include <stdlib.h> #include <stdio.h> #include <stdarg.h> @@ -88,8 +89,9 @@ int QCString::find( const QCString &str, int index, bool cs ) const int QCString::find( const QRegExp &rx, int index ) const { - QString d = QString::fromLatin1( data() ); - return d.find( rx, index ); + if ( index < 0 ) + index += length(); + return rx.match( data(), index ); } int QCString::findRev( char c, int index, bool cs) const @@ -146,8 +148,16 @@ int QCString::findRev( const char *str, int index, bool cs) const int QCString::findRev( const QRegExp &rx, int index ) const { - QString d = QString::fromLatin1( data() ); - return d.findRev( rx, index ); + if ( index < 0 ) // neg index ==> start from end + index += length(); + if ( (uint)index > length() ) // bad index + return -1; + while( index >= 0 ) { + if ( rx.match( data(), index ) == index ) + return index; + index--; + } + return -1; } int QCString::contains( char c, bool cs ) const @@ -194,8 +204,26 @@ int QCString::contains( const char *str, bool cs ) const int QCString::contains( const QRegExp &rx ) const { - QString d = QString::fromLatin1( data() ); - return d.contains( rx ); + if ( isEmpty() ) + return rx.match( data() ) < 0 ? 0 : 1; + int count = 0; + int index = -1; + int len = length(); + while ( index < len-1 ) { // count overlapping matches + index = rx.match( data(), index+1 ); + if ( index < 0 ) + break; + count++; + } + return count; +} + +bool QCString::startsWith( const char *s ) const +{ + const char *p = data(); + if (p==0 || s==0) return s==0; + while (*p!=0 && *p==*s) p++,s++; + return *s==0; } bool QCString::stripPrefix(const char *prefix) @@ -417,53 +445,204 @@ QCString &QCString::replace( uint index, uint len, const char *s) QCString &QCString::replace( const QRegExp &rx, const char *str ) { - QString d = QString::fromLatin1( data() ); - QString r = QString::fromLatin1( str ); - d.replace( rx, r ); - operator=( d.ascii() ); + if ( isEmpty() ) + return *this; + int index = 0; + int slen = qstrlen(str); + int len; + while ( index < (int)length() ) { + index = rx.match( data(), index, &len, FALSE ); + if ( index >= 0 ) { + replace( index, len, str ); + index += slen; + if ( !len ) + break; // Avoid infinite loop on 0-length matches, e.g. [a-z]* + } + else + break; + } return *this; } -short QCString::toShort(bool *ok) const +static bool ok_in_base( char c, int base ) { - QString s(data()); - return s.toShort(ok); + if ( base <= 10 ) + return c>='0' && c<='9' && (c-'0') < base; + else + return (c>='0' && c<='9') || + (c >= 'a' && c < char('a'+base-10)) || + (c >= 'A' && c < char('A'+base-10)); } -ushort QCString::toUShort(bool *ok) const +short QCString::toShort(bool *ok, int base) const { - QString s(data()); - return s.toUShort(ok); + long v = toLong( ok, base ); + if ( ok && *ok && (v < -32768 || v > 32767) ) { + *ok = FALSE; + v = 0; + } + return (short)v; } -int QCString::toInt(bool *ok) const +ushort QCString::toUShort(bool *ok,int base) const { - QString s(data()); - return s.toInt(ok); + ulong v = toULong( ok, base ); + if ( ok && *ok && (v > 65535) ) { + *ok = FALSE; + v = 0; + } + return (ushort)v; } -uint QCString::toUInt(bool *ok) const +int QCString::toInt(bool *ok, int base) const { - QString s(data()); - return s.toUInt(ok); + return (int)toLong( ok, base ); } -long QCString::toLong(bool *ok) const +uint QCString::toUInt(bool *ok,int base) const { - QString s(data()); - return s.toLong(ok); + return (uint)toULong( ok, base ); } -ulong QCString::toULong(bool *ok) const + +long QCString::toLong(bool *ok,int base) const { - QString s(data()); - return s.toULong(ok); + const char *p = data(); + long val=0; + int l = length(); + const long max_mult = INT_MAX / base; + bool is_ok = FALSE; + int neg = 0; + if ( !p ) + goto bye; + while ( l && isspace(*p) ) // skip leading space + l--,p++; + if ( l && *p == '-' ) { + l--; + p++; + neg = 1; + } else if ( *p == '+' ) { + l--; + p++; + } + + // NOTE: toULong() code is similar + if ( !l || !ok_in_base(*p,base) ) + goto bye; + while ( l && ok_in_base(*p,base) ) { + l--; + int dv; + if ( *p>='0' && *p<='9' ) { + dv = *p-'0'; + } else { + if ( *p >= 'a' && *p <= 'z' ) + dv = *p - 'a' + 10; + else + dv = *p - 'A' + 10; + } + if ( val > max_mult || (val == max_mult && dv > (INT_MAX%base)+neg) ) + goto bye; + val = base*val + dv; + p++; + } + if ( neg ) + val = -val; + while ( l && isspace(*p) ) // skip trailing space + l--,p++; + if ( !l ) + is_ok = TRUE; +bye: + if ( ok ) + *ok = is_ok; + return is_ok ? val : 0; +} + +ulong QCString::toULong(bool *ok,int base) const +{ + const char *p = data(); + ulong val=0; + int l = length(); + const ulong max_mult = 429496729; // UINT_MAX/10, rounded down + bool is_ok = FALSE; + if ( !p ) + goto bye; + while ( l && isspace(*p) ) // skip leading space + l--,p++; + if ( *p == '+' ) + l--,p++; + + // NOTE: toLong() code is similar + if ( !l || !ok_in_base(*p,base) ) + goto bye; + while ( l && ok_in_base(*p,base) ) { + l--; + uint dv; + if ( *p>='0' && *p<='9' ) { + dv = *p-'0'; + } else { + if ( *p >= 'a' && *p <= 'z' ) + dv = *p - 'a' + 10; + else + dv = *p - 'A' + 10; + } + if ( val > max_mult || (val == max_mult && dv > (UINT_MAX%base)) ) + goto bye; + val = base*val + dv; + p++; + } + + while ( l && isspace(*p) ) // skip trailing space + l--,p++; + if ( !l ) + is_ok = TRUE; +bye: + if ( ok ) + *ok = is_ok; + return is_ok ? val : 0; } -uint64 QCString::toUInt64(bool *ok) const +uint64 QCString::toUInt64(bool *ok,int base) const { - QString s(data()); - return s.toUInt64(ok); + const char *p = data(); + uint64 val=0; + int l = length(); + const uint64 max_mult = 1844674407370955161ULL; // ULLONG_MAX/10, rounded down + bool is_ok = FALSE; + if ( !p ) + goto bye; + while ( l && isspace(*p) ) // skip leading space + l--,p++; + if ( *p == '+' ) + l--,p++; + + // NOTE: toULong() code is similar + if ( !l || !ok_in_base(*p,base) ) + goto bye; + while ( l && ok_in_base(*p,base) ) { + l--; + uint dv; + if ( *p>='0' && *p<='9' ) { + dv = *p-'0'; + } else { + if ( *p >= 'a' && *p <= 'z' ) + dv = *p - 'a' + 10; + else + dv = *p - 'A' + 10; + } + if ( val > max_mult || (val == max_mult && dv > (ULLONG_MAX%base)) ) + goto bye; + val = base*val + dv; + p++; + } + + while ( l && isspace(*p) ) // skip trailing space + l--,p++; + if ( !l ) + is_ok = TRUE; +bye: + if ( ok ) + *ok = is_ok; + return is_ok ? val : 0; } QCString &QCString::setNum(short n) diff --git a/qtools/qcstring.h b/qtools/qcstring.h index abf30b3..f484207 100644 --- a/qtools/qcstring.h +++ b/qtools/qcstring.h @@ -282,19 +282,20 @@ public: QCString &remove( uint index, uint len ); QCString &replace( uint index, uint len, const char *s); QCString &replace( const QRegExp &rx, const char *str ); - short toShort( bool *ok=0 ) const; - ushort toUShort( bool *ok=0 ) const; - int toInt( bool *ok=0 ) const; - uint toUInt( bool *ok=0 ) const; - long toLong( bool *ok=0 ) const; - ulong toULong( bool *ok=0 ) const; - uint64 toUInt64( bool *ok=0 ) const; + short toShort( bool *ok=0, int base=10 ) const; + ushort toUShort( bool *ok=0, int base=10 ) const; + int toInt( bool *ok=0, int base=10 ) const; + uint toUInt( bool *ok=0, int base=10 ) const; + long toLong( bool *ok=0, int base=10 ) const; + ulong toULong( bool *ok=0, int base=10 ) const; + uint64 toUInt64( bool *ok=0, int base=10 ) const; QCString &setNum(short n); QCString &setNum(ushort n); QCString &setNum(int n); QCString &setNum(uint n); QCString &setNum(long n); QCString &setNum(ulong n); + bool startsWith( const char *s ) const; /** Converts the string to a plain C string */ operator const char *() const diff --git a/qtools/qdatetime.cpp b/qtools/qdatetime.cpp index 88569f8..8f1cab2 100644 --- a/qtools/qdatetime.cpp +++ b/qtools/qdatetime.cpp @@ -279,7 +279,7 @@ int QDate::daysInYear() const \sa toString(), dayName() */ -QString QDate::monthName( int month ) const +QCString QDate::monthName( int month ) const { #if defined(CHECK_RANGE) if ( month < 1 || month > 12 ) { @@ -287,8 +287,7 @@ QString QDate::monthName( int month ) const month = 1; } #endif - // ### Remove the fromLatin1 during localization - return QString::fromLatin1(monthNames[month-1]); + return monthNames[month-1]; } /*! @@ -299,7 +298,7 @@ QString QDate::monthName( int month ) const \sa toString(), monthName() */ -QString QDate::dayName( int weekday ) const +QCString QDate::dayName( int weekday ) const { #if defined(CHECK_RANGE) if ( weekday < 1 || weekday > 7 ) { @@ -307,8 +306,7 @@ QString QDate::dayName( int weekday ) const weekday = 1; } #endif - // ### Remove the fromLatin1 during localization - return QString::fromLatin1(weekdayNames[weekday-1]); + return weekdayNames[weekday-1]; } @@ -321,14 +319,14 @@ QString QDate::dayName( int weekday ) const \sa dayName(), monthName() */ -QString QDate::toString() const +QCString QDate::toString() const { int y, m, d; jul2greg( jd, y, m, d ); - QString buf = dayName(dayOfWeek()); + QCString buf = dayName(dayOfWeek()); buf += ' '; buf += monthName(m); - QString t; + QCString t; t.sprintf( " %d %d", d, y); buf += t; return buf; @@ -684,9 +682,9 @@ int QTime::msec() const before midnight would be "23:59:59". */ -QString QTime::toString() const +QCString QTime::toString() const { - QString buf; + QCString buf; buf.sprintf( "%.2d:%.2d:%.2d", hour(), minute(), second() ); return buf; } @@ -1190,17 +1188,17 @@ void QDateTime::setTimeUtc_t( uint secsSince1Jan1970UTC ) */ -QString QDateTime::toString() const +QCString QDateTime::toString() const { - QString buf = d.dayName(d.dayOfWeek()); + QCString buf = d.dayName(d.dayOfWeek()); buf += ' '; buf += d.monthName(d.month()); buf += ' '; - buf += QString().setNum(d.day()); + buf += QCString().setNum(d.day()); buf += ' '; buf += t.toString(); buf += ' '; - buf += QString().setNum(d.year()); + buf += QCString().setNum(d.year()); return buf; } diff --git a/qtools/qdatetime.h b/qtools/qdatetime.h index 010ae73..63007f3 100644 --- a/qtools/qdatetime.h +++ b/qtools/qdatetime.h @@ -39,7 +39,7 @@ #define QDATETIME_H #ifndef QT_H -#include "qstring.h" +#include "qcstring.h" #endif // QT_H @@ -65,10 +65,10 @@ public: int daysInMonth() const; // 28..31 int daysInYear() const; // 365 or 366 - virtual QString monthName( int month ) const; - virtual QString dayName( int weekday ) const; + virtual QCString monthName( int month ) const; + virtual QCString dayName( int weekday ) const; - QString toString() const; + QCString toString() const; bool setYMD( int y, int m, int d ); @@ -119,7 +119,7 @@ public: int second() const; // 0..59 int msec() const; // 0..999 - QString toString() const; + QCString toString() const; bool setHMS( int h, int m, int s, int ms=0 ); @@ -175,7 +175,7 @@ public: void setTime_t( uint secsSince1Jan1970UTC ); void setTimeUtc_t( uint secsSince1Jan1970UTC ); - QString toString() const; + QCString toString() const; QDateTime addDays( int days ) const; QDateTime addSecs( int secs ) const; diff --git a/qtools/qdict.h b/qtools/qdict.h index efc5bd0..12db365 100644 --- a/qtools/qdict.h +++ b/qtools/qdict.h @@ -42,89 +42,8 @@ #include "qgdict.h" #endif // QT_H -#define USE_ASCII_STRING - -#ifdef USE_ASCII_STRING - #define QAsciiDict QDict #define QAsciiDictIterator QDictIterator #include "qasciidict.h" -#else - -template<class type> class Q_EXPORT QDict : private QGDict -{ -public: - QDict(int size=17, bool caseSensitive=TRUE) - : QGDict(size,StringKey,caseSensitive,FALSE) {} - QDict( const QDict<type> &d ) : QGDict(d) {} - ~QDict() { clear(); } - QDict<type> &operator=(const QDict<type> &d) - { return (QDict<type>&)QGDict::operator=(d); } - - // capacity - uint count() const { return QGDict::count(); } - uint size() const { return QGDict::size(); } - bool isEmpty() const { return QGDict::count() == 0; } - - // modifiers - void insert( const QString &k, const type *d ) - { QGDict::look_string(k,(Item)d,1); } - void replace( const QString &k, const type *d ) - { QGDict::look_string(k,(Item)d,2); } - bool remove( const QString &k ) { return QGDict::remove_string(k); } - type *take( const QString &k ) { return (type *)QGDict::take_string(k); } - void clear() { QGDict::clear(); } - void resize( uint n ) { QGDict::resize(n); } - - // search - type *find( const QString &k ) const - { return (type *)((QGDict*)this)->QGDict::look_string(k,0,0); } - type *operator[]( const QString &k ) const - { return (type *)((QGDict*)this)->QGDict::look_string(k,0,0); } - - // operations - void statistics() const { QGDict::statistics(); } -private: - void deleteItem( Item d ); - - // new to be reimplemented methods - virtual int compareValues(const type *t1,const type *t2) const - { return const_cast<QDict<type>*>(this)->QGDict::compareItems((QCollection::Item)t1,(QCollection::Item)t2); } - - // reimplemented methods - virtual int compareItems(QCollection::Item i1,QCollection::Item i2) - { return compareValues((const type*)i1,(const type*)i2); } -}; - -#if defined(Q_DELETING_VOID_UNDEFINED) -template<> inline void QDict<void>::deleteItem( Item ) -{ -} -#endif - -template<class type> inline void QDict<type>::deleteItem( QCollection::Item d ) -{ - if ( del_item ) delete (type *)d; -} - - -template<class type> class Q_EXPORT QDictIterator : public QGDictIterator -{ -public: - QDictIterator(const QDict<type> &d) :QGDictIterator((QGDict &)d) {} - ~QDictIterator() {} - uint count() const { return dict->count(); } - bool isEmpty() const { return dict->count() == 0; } - type *toFirst() { return (type *)QGDictIterator::toFirst(); } - operator type *() const { return (type *)QGDictIterator::get(); } - type *current() const { return (type *)QGDictIterator::get(); } - QString currentKey() const{ return QGDictIterator::getKeyString(); } - type *operator()() { return (type *)QGDictIterator::operator()(); } - type *operator++() { return (type *)QGDictIterator::operator++(); } - type *operator+=(uint j) { return (type *)QGDictIterator::operator+=(j);} -}; - -#endif // USE_ASCII_STRING - #endif // QDICT_H diff --git a/qtools/qgcache.cpp b/qtools/qgcache.cpp index 03150fe..230823c 100644 --- a/qtools/qgcache.cpp +++ b/qtools/qgcache.cpp @@ -190,21 +190,21 @@ public: QCDict( uint size, uint kt, bool caseSensitive, bool copyKeys ) : QGDict( size, (KeyType)kt, caseSensitive, copyKeys ) {} - QCacheItem *find_string(const QString &key) const + QCacheItem *find_string(const QCString &key) const { return (QCacheItem*)((QCDict*)this)->look_string(key, 0, 0); } QCacheItem *find_ascii(const char *key) const { return (QCacheItem*)((QCDict*)this)->look_ascii(key, 0, 0); } QCacheItem *find_int(long key) const { return (QCacheItem*)((QCDict*)this)->look_int(key, 0, 0); } - QCacheItem *take_string(const QString &key) + QCacheItem *take_string(const QCString &key) { return (QCacheItem*)QGDict::take_string(key); } QCacheItem *take_ascii(const char *key) { return (QCacheItem*)QGDict::take_ascii(key); } QCacheItem *take_int(long key) { return (QCacheItem*)QGDict::take_int(key); } - bool insert_string( const QString &key, const QCacheItem *ci ) + bool insert_string( const QCString &key, const QCacheItem *ci ) { return QGDict::look_string(key,(Item)ci,1)!=0;} bool insert_ascii( const char *key, const QCacheItem *ci ) { return QGDict::look_ascii(key,(Item)ci,1)!=0;} @@ -212,7 +212,7 @@ public: { return QGDict::look_int(key,(Item)ci,1)!=0;} bool remove_string( QCacheItem *item ) - { return QGDict::remove_string(*((QString*)(item->key)),item); } + { return QGDict::remove_string(*((QCString*)(item->key)),item); } bool remove_ascii( QCacheItem *item ) { return QGDict::remove_ascii((const char *)item->key,item); } bool remove_int( QCacheItem *item ) @@ -345,7 +345,7 @@ void QGCache::setMaxCost( int maxCost ) invalid. */ -bool QGCache::insert_string( const QString &key, QCollection::Item data, +bool QGCache::insert_string( const QCString &key, QCollection::Item data, int cost, int priority) { if ( tCost + cost > mCost ) { @@ -365,7 +365,7 @@ bool QGCache::insert_string( const QString &key, QCollection::Item data, priority = -32768; else if ( priority > 32767 ) priority = 32677; - QCacheItem *ci = new QCacheItem( new QString(key), newItem(data), + QCacheItem *ci = new QCacheItem( new QCString(key), newItem(data), cost, (short)priority ); CHECK_PTR( ci ); lruList->insert( 0, ci ); @@ -417,7 +417,7 @@ bool QGCache::insert_other( const char *key, QCollection::Item data, Removes an item from the cache. */ -bool QGCache::remove_string( const QString &key ) +bool QGCache::remove_string( const QCString &key ) { Item d = take_string( key ); if ( d ) @@ -442,7 +442,7 @@ bool QGCache::remove_other( const char *key ) Takes an item out of the cache (no delete). */ -QCollection::Item QGCache::take_string( const QString &key ) +QCollection::Item QGCache::take_string( const QCString &key ) { QCacheItem *ci = dict->take_string( key ); // take from dict Item d; @@ -450,7 +450,7 @@ QCollection::Item QGCache::take_string( const QString &key ) d = ci->data; tCost -= ci->cost; lruList->take( ci ); // take from list - delete (QString*)ci->key; + delete (QCString*)ci->key; delete ci; } else { d = 0; @@ -497,7 +497,7 @@ void QGCache::clear() switch ( keytype ) { case StringKey: dict->remove_string( ci ); - delete (QString*)ci->key; + delete (QCString*)ci->key; break; case AsciiKey: dict->remove_ascii( ci ); @@ -522,7 +522,7 @@ void QGCache::clear() Finds an item in the cache. */ -QCollection::Item QGCache::find_string( const QString &key, bool ref ) const +QCollection::Item QGCache::find_string( const QCString &key, bool ref ) const { QCacheItem *ci = dict->find_string( key ); #if defined(DEBUG) @@ -599,7 +599,7 @@ bool QGCache::makeRoomFor( int cost, int priority ) switch ( keytype ) { case StringKey: dict->remove_string( ci ); - delete (QString*)ci->key; + delete (QCString*)ci->key; break; case AsciiKey: dict->remove_ascii( ci ); @@ -628,9 +628,9 @@ bool QGCache::makeRoomFor( int cost, int priority ) void QGCache::statistics() const { #if defined(DEBUG) - QString line; + QCString line; line.fill( '*', 80 ); - qDebug( "%s",line.ascii() ); + qDebug( "%s",line.data() ); qDebug( "CACHE STATISTICS:" ); qDebug( "cache contains %d item%s, with a total cost of %d", count(), count() != 1 ? "s" : "", tCost ); @@ -651,7 +651,7 @@ void QGCache::statistics() const lruList->dumps != 1 ? "have" : "has", lruList->dumpCosts ); qDebug( "Statistics from internal dictionary class:" ); dict->statistics(); - qDebug( "%s",line.ascii() ); + qDebug( "%s",line.data() ); #endif } @@ -794,10 +794,10 @@ QCollection::Item QGCacheIterator::get() const Returns the key of the current item. */ -QString QGCacheIterator::getKeyString() const +QCString QGCacheIterator::getKeyString() const { QCacheItem *item = it->current(); - return item ? *((QString*)item->key) : QString::null; + return item ? *((QCString*)item->key) : QCString(); } /*! diff --git a/qtools/qgcache.h b/qtools/qgcache.h index a71f6d3..5d8a243 100644 --- a/qtools/qgcache.h +++ b/qtools/qgcache.h @@ -70,16 +70,16 @@ protected: void setMaxCost( int maxCost ); void clear(); - bool insert_string( const QString &key, QCollection::Item, + bool insert_string( const QCString &key, QCollection::Item, int cost, int priority ); bool insert_other( const char *key, QCollection::Item, int cost, int priority ); - bool remove_string( const QString &key ); + bool remove_string( const QCString &key ); bool remove_other( const char *key ); - QCollection::Item take_string( const QString &key ); + QCollection::Item take_string( const QCString &key ); QCollection::Item take_other( const char *key ); - QCollection::Item find_string( const QString &key, bool ref=TRUE ) const; + QCollection::Item find_string( const QCString &key, bool ref=TRUE ) const; QCollection::Item find_other( const char *key, bool ref=TRUE ) const; void statistics() const; @@ -112,7 +112,7 @@ protected: QCollection::Item toLast(); QCollection::Item get() const; - QString getKeyString() const; + QCString getKeyString() const; const char *getKeyAscii() const; intptr_t getKeyInt() const; diff --git a/qtools/qgdict.cpp b/qtools/qgdict.cpp index ab3fea9..a3db8de 100644 --- a/qtools/qgdict.cpp +++ b/qtools/qgdict.cpp @@ -83,36 +83,9 @@ public: Returns the hash key for \e key, when key is a string. */ -int QGDict::hashKeyString( const QString &key ) +int QGDict::hashKeyString( const QCString &key ) { -#if defined(CHECK_NULL) - if ( key.isNull() ) - qWarning( "QGDict::hashStringKey: Invalid null key" ); -#endif - int i; - uint h=0; - uint g; - int len = key.length(); - const QChar *p = key.unicode(); - if ( cases ) { // case sensitive - for ( i=0; i<len; i++ ) { - h = (h<<4) + p[i].cell(); - if ( (g = h & 0xf0000000) ) - h ^= g >> 24; - h &= ~g; - } - } else { // case insensitive - for ( i=0; i<len; i++ ) { - h = (h<<4) + p[i].lower().cell(); - if ( (g = h & 0xf0000000) ) - h ^= g >> 24; - h &= ~g; - } - } - int index = h; - if ( index < 0 ) // adjust index to table size - index = -index; - return index; + return hashKeyAscii(key.data()); } /*! @@ -337,7 +310,7 @@ QGDict &QGDict::operator=( const QGDict &dict ) */ -/*! \fn QString QGDictIterator::getKeyString() const +/*! \fn QCString QGDictIterator::getKeyString() const \internal */ @@ -379,21 +352,21 @@ QGDict &QGDict::operator=( const QGDict &dict ) The do-it-all function; op is one of op_find, op_insert, op_replace */ -QCollection::Item QGDict::look_string( const QString &key, QCollection::Item d, int op ) +QCollection::Item QGDict::look_string( const QCString &key, QCollection::Item d, int op ) { - QStringBucket *n; + QCStringBucket *n; int index = hashKeyString(key) % vlen; if ( op == op_find ) { // find if ( cases ) { - for ( n=(QStringBucket*)vec[index]; n; - n=(QStringBucket*)n->getNext() ) { + for ( n=(QCStringBucket*)vec[index]; n; + n=(QCStringBucket*)n->getNext() ) { if ( key == n->getKey() ) return n->getData(); // item found } } else { - QString k = key.lower(); - for ( n=(QStringBucket*)vec[index]; n; - n=(QStringBucket*)n->getNext() ) { + QCString k = key.lower(); + for ( n=(QCStringBucket*)vec[index]; n; + n=(QCStringBucket*)n->getNext() ) { if ( k == n->getKey().lower() ) return n->getData(); // item found } @@ -405,7 +378,7 @@ QCollection::Item QGDict::look_string( const QString &key, QCollection::Item d, remove_string( key ); } // op_insert or op_replace - n = new QStringBucket(key,newItem(d),vec[index]); + n = new QCStringBucket(key,newItem(d),vec[index]); CHECK_PTR( n ); #if defined(CHECK_NULL) if ( n->getData() == 0 ) @@ -542,10 +515,10 @@ void QGDict::resize( uint newsize ) switch ( keytype ) { case StringKey: { - QStringBucket *n=(QStringBucket *)old_vec[index]; + QCStringBucket *n=(QCStringBucket *)old_vec[index]; while ( n ) { look_string( n->getKey(), n->getData(), op_insert ); - QStringBucket *t=(QStringBucket *)n->getNext(); + QCStringBucket *t=(QCStringBucket *)n->getNext(); delete n; n = t; } @@ -624,16 +597,16 @@ void QGDict::unlink_common( int index, QBaseBucket *node, QBaseBucket *prev ) numItems--; } -QStringBucket *QGDict::unlink_string( const QString &key, QCollection::Item d ) +QCStringBucket *QGDict::unlink_string( const QCString &key, QCollection::Item d ) { if ( numItems == 0 ) // nothing in dictionary return 0; - QStringBucket *n; - QStringBucket *prev = 0; + QCStringBucket *n; + QCStringBucket *prev = 0; int index = hashKeyString(key) % vlen; if ( cases ) { - for ( n=(QStringBucket*)vec[index]; n; - n=(QStringBucket*)n->getNext() ) { + for ( n=(QCStringBucket*)vec[index]; n; + n=(QCStringBucket*)n->getNext() ) { bool found = (key == n->getKey()); if ( found && d ) found = (n->getData() == d); @@ -644,9 +617,9 @@ QStringBucket *QGDict::unlink_string( const QString &key, QCollection::Item d ) prev = n; } } else { - QString k = key.lower(); - for ( n=(QStringBucket*)vec[index]; n; - n=(QStringBucket*)n->getNext() ) { + QCString k = key.lower(); + for ( n=(QCStringBucket*)vec[index]; n; + n=(QCStringBucket*)n->getNext() ) { bool found = (k == n->getKey().lower()); if ( found && d ) found = (n->getData() == d); @@ -729,9 +702,9 @@ QPtrBucket *QGDict::unlink_ptr( void *key, QCollection::Item d ) item when several items have the same key). */ -bool QGDict::remove_string( const QString &key, QCollection::Item item ) +bool QGDict::remove_string( const QCString &key, QCollection::Item item ) { - QStringBucket *n = unlink_string( key, item ); + QCStringBucket *n = unlink_string( key, item ); if ( n ) { deleteItem( n->getData() ); delete n; @@ -785,9 +758,9 @@ bool QGDict::remove_ptr( void *key, QCollection::Item item ) /*! \internal */ -QCollection::Item QGDict::take_string( const QString &key ) +QCollection::Item QGDict::take_string( const QCString &key ) { - QStringBucket *n = unlink_string( key ); + QCStringBucket *n = unlink_string( key ); Item d; if ( n ) { d = n->getData(); @@ -864,9 +837,9 @@ void QGDict::clear() switch ( keytype ) { case StringKey: { - QStringBucket *n=(QStringBucket *)vec[j]; + QCStringBucket *n=(QCStringBucket *)vec[j]; while ( n ) { - QStringBucket *next = (QStringBucket*)n->getNext(); + QCStringBucket *next = (QCStringBucket*)n->getNext(); deleteItem( n->getData() ); delete n; n = next; @@ -930,14 +903,14 @@ void QGDict::clear() void QGDict::statistics() const { #if defined(DEBUG) - QString line; + QCString line; line.fill( '-', 60 ); double real, ideal; - qDebug( "%s",line.ascii() ); + qDebug( "%s",line.data() ); qDebug( "DICTIONARY STATISTICS:" ); if ( count() == 0 ) { qDebug( "Empty!" ); - qDebug( "%s", line.ascii() ); + qDebug( "%s", line.data() ); return; } real = 0.0; @@ -966,7 +939,7 @@ void QGDict::statistics() const qDebug( "Real dist = %g", real ); qDebug( "Rand dist = %g", ideal ); qDebug( "Real/Rand = %g", real/ideal ); - qDebug( "%s",line.ascii() ); + qDebug( "%s",line.data() ); #endif // DEBUG } @@ -1004,7 +977,7 @@ QDataStream &QGDict::read( QDataStream &s ) switch ( keytype ) { case StringKey: { - QString k; + QCString k; s >> k; read( s, d ); look_string( k, d, op_insert ); @@ -1060,7 +1033,7 @@ QDataStream& QGDict::write( QDataStream &s ) const while ( n ) { // write all buckets switch ( keytype ) { case StringKey: - s << ((QStringBucket*)n)->getKey(); + s << ((QCStringBucket*)n)->getKey(); break; case AsciiKey: s << ((QAsciiBucket*)n)->getKey(); diff --git a/qtools/qgdict.h b/qtools/qgdict.h index a5c8aa0..cf023fd 100644 --- a/qtools/qgdict.h +++ b/qtools/qgdict.h @@ -40,7 +40,7 @@ #ifndef QT_H #include "qcollection.h" -#include "qstring.h" +#include "qcstring.h" #endif // QT_H class QGDictIterator; @@ -60,14 +60,14 @@ protected: QBaseBucket *next; }; -class QStringBucket : public QBaseBucket +class QCStringBucket : public QBaseBucket { public: - QStringBucket( const QString &k, QCollection::Item d, QBaseBucket *n ) + QCStringBucket( const QCString &k, QCollection::Item d, QBaseBucket *n ) : QBaseBucket(d,n), key(k) {} - const QString &getKey() const { return key; } + const QCString &getKey() const { return key; } private: - QString key; + QCString key; }; class QAsciiBucket : public QBaseBucket @@ -106,7 +106,7 @@ class Q_EXPORT QGDict : public QCollection // generic dictionary class public: uint count() const { return numItems; } uint size() const { return vlen; } - QCollection::Item look_string( const QString& key, QCollection::Item, + QCollection::Item look_string( const QCString& key, QCollection::Item, int ); QCollection::Item look_ascii( const char *key, QCollection::Item, int ); QCollection::Item look_int( long key, QCollection::Item, int ); @@ -124,11 +124,11 @@ protected: QGDict &operator=( const QGDict & ); - bool remove_string( const QString &key, QCollection::Item item=0 ); + bool remove_string( const QCString &key, QCollection::Item item=0 ); bool remove_ascii( const char *key, QCollection::Item item=0 ); bool remove_int( long key, QCollection::Item item=0 ); bool remove_ptr( void *key, QCollection::Item item=0 ); - QCollection::Item take_string( const QString &key ); + QCollection::Item take_string( const QCString &key ); QCollection::Item take_ascii( const char *key ); QCollection::Item take_int( long key ); QCollection::Item take_ptr( void *key ); @@ -136,7 +136,7 @@ protected: void clear(); void resize( uint ); - int hashKeyString( const QString & ); + int hashKeyString( const QCString & ); int hashKeyAscii( const char * ); void statistics() const; @@ -154,7 +154,7 @@ private: uint copyk : 1; QGDItList *iterators; void unlink_common( int, QBaseBucket *, QBaseBucket * ); - QStringBucket *unlink_string( const QString &, + QCStringBucket *unlink_string( const QCString &, QCollection::Item item = 0 ); QAsciiBucket *unlink_ascii( const char *, QCollection::Item item = 0 ); QIntBucket *unlink_int( long, QCollection::Item item = 0 ); @@ -176,7 +176,7 @@ public: QCollection::Item toFirst(); QCollection::Item get() const; - QString getKeyString() const; + QCString getKeyString() const; const char *getKeyAscii() const; intptr_t getKeyInt() const; void *getKeyPtr() const; @@ -198,9 +198,9 @@ inline QCollection::Item QGDictIterator::get() const return curNode ? curNode->getData() : 0; } -inline QString QGDictIterator::getKeyString() const +inline QCString QGDictIterator::getKeyString() const { - return curNode ? ((QStringBucket*)curNode)->getKey() : QString::null; + return curNode ? ((QCStringBucket*)curNode)->getKey() : QCString(); } inline const char *QGDictIterator::getKeyAscii() const diff --git a/src/cite.cpp b/src/cite.cpp index a36f62c..42f695f 100644 --- a/src/cite.cpp +++ b/src/cite.cpp @@ -79,7 +79,7 @@ void CiteDict::writeLatexBibliography(FTextStream &t) { if (i) t << ","; i++; - t << bibTmpFile << QString().setNum(i); + t << bibTmpFile << QCString().setNum(i); } } bibdata = citeDataList.next(); diff --git a/src/classdef.cpp b/src/classdef.cpp index b38518c..7548c6c 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -1890,7 +1890,7 @@ void ClassDefImpl::writeIncludeFilesForSlice(OutputList &ol) const QFileInfo info(s); if (info.exists()) { - QString prefix = info.absFilePath(); + QCString prefix = info.absFilePath().utf8(); if (prefix.at(prefix.length() - 1) != '/') { prefix += '/'; diff --git a/src/cmdmapper.cpp b/src/cmdmapper.cpp index b4d35d4..d766fa3 100644 --- a/src/cmdmapper.cpp +++ b/src/cmdmapper.cpp @@ -239,14 +239,14 @@ int Mapper::map(const char *n) return !name.isEmpty() && (result=m_map.find(name)) ? *result: 0; } -QString Mapper::find(const int n) +QCString Mapper::find(const int n) { QDictIterator<int> mapIterator(m_map); for (int *curVal = mapIterator.toFirst();(curVal = mapIterator.current());++mapIterator) { if (*curVal == n || (*curVal == (n | SIMPLESECT_BIT))) return mapIterator.currentKey(); } - return NULL; + return QCString(); } Mapper::Mapper(const CommandMap *cm,bool caseSensitive) : m_map(89), m_cs(caseSensitive) diff --git a/src/cmdmapper.h b/src/cmdmapper.h index d670cd4..e0a2e65 100644 --- a/src/cmdmapper.h +++ b/src/cmdmapper.h @@ -214,7 +214,7 @@ class Mapper { public: int map(const char *n); - QString find(const int n); + QCString find(const int n); Mapper(const CommandMap *cm,bool caseSensitive); private: QDict<int> m_map; @@ -1327,9 +1327,8 @@ static void generateFunctionLink(CodeOutputInterface &ol,const char *funcName) //CodeClassDef *ccd=0; ClassDef *ccd=0; QCString locScope=g_classScope; - QString qq=removeRedundantWhiteSpace(funcName); - if (g_insidePHP && qq.startsWith("self::")) qq=qq.mid(4); - QCString locFunc(qq.data()); + QCString locFunc=removeRedundantWhiteSpace(funcName); + if (g_insidePHP && locFunc.startsWith("self::")) locFunc=locFunc.mid(4); QCString funcScope; QCString funcWithScope=locFunc; QCString funcWithFullScope=locFunc; diff --git a/src/commentscan.l b/src/commentscan.l index abf218c..7c9929c 100644 --- a/src/commentscan.l +++ b/src/commentscan.l @@ -1180,7 +1180,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$" addOutput(yytext); } <Comment>{B}*{CMD}"~"[a-z_A-Z-]* { // language switch command - QCString langId = QString(yytext).stripWhiteSpace().data()+2; + QCString langId = QCString(yytext).stripWhiteSpace().data()+2; if (!langId.isEmpty() && qstricmp(Config_getEnum(OUTPUT_LANGUAGE),langId)!=0) { // enable language specific section @@ -1190,7 +1190,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$" <Comment>{B}*{CMD}"f{"[^}\n]+"}"("{"?) { // start of a formula with custom environment setOutput(OutputDoc); formulaText="\\begin"; - formulaEnv=QString(yytext).stripWhiteSpace().data()+2; + formulaEnv=QCString(yytext).stripWhiteSpace().data()+2; if (formulaEnv.at(formulaEnv.length()-1)=='{') { // remove trailing open brace diff --git a/src/configimpl.l b/src/configimpl.l index 7d22859..e657745 100644 --- a/src/configimpl.l +++ b/src/configimpl.l @@ -1290,14 +1290,13 @@ static void cleanUpPaths(QStrList &str) if (fi.exists() && fi.isDir()) { int i = str.at(); - QString p = fi.absFilePath(); - if (p.at(p.length()-1)!='/') - p.append('/'); + QCString p = fi.absFilePath().utf8(); + if (p[p.length()-1]!='/') p+='/'; str.remove(); if (str.at()==i) // did not remove last item - str.insert(i,p.utf8()); + str.insert(i,p); else - str.append(p.utf8()); + str.append(p); } } sfp = str.next(); diff --git a/src/docparser.cpp b/src/docparser.cpp index 2ee3d7d..da4cfb2 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -6897,7 +6897,7 @@ int DocSection::parse() } else if (retval==RetVal_Subsubsection && m_level<=Doxygen::subpageNestingLevel+2) { - if ((m_level<=1+Doxygen::subpageNestingLevel) && !QString(g_token->sectionId).startsWith("autotoc_md")) + if ((m_level<=1+Doxygen::subpageNestingLevel) && !g_token->sectionId.startsWith("autotoc_md")) warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected subsubsection command found inside %s!",sectionLevelToName[m_level]); // then parse any number of nested sections while (retval==RetVal_Subsubsection) // more sections follow @@ -6912,7 +6912,7 @@ int DocSection::parse() } else if (retval==RetVal_Paragraph && m_level<=QMIN(5,Doxygen::subpageNestingLevel+3)) { - if ((m_level<=2+Doxygen::subpageNestingLevel) && !QString(g_token->sectionId).startsWith("autotoc_md")) + if ((m_level<=2+Doxygen::subpageNestingLevel) && !g_token->sectionId.startsWith("autotoc_md")) warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected paragraph command found inside %s!",sectionLevelToName[m_level]); // then parse any number of nested sections while (retval==RetVal_Paragraph) // more sections follow @@ -7084,8 +7084,10 @@ void DocRoot::parse() } if (retval==RetVal_Paragraph) { - if (!QString(g_token->sectionId).startsWith("autotoc_md")) + if (!g_token->sectionId.startsWith("autotoc_md")) + { warn_doc_error(g_fileName,doctokenizerYYlineno,"found paragraph command outside of subsubsection context!"); + } while (retval==RetVal_Paragraph) { if (!g_token->sectionId.isEmpty()) @@ -7113,7 +7115,7 @@ void DocRoot::parse() } if (retval==RetVal_Subsubsection) { - if (!(QString(g_token->sectionId).startsWith("autotoc_md"))) + if (!(g_token->sectionId.startsWith("autotoc_md"))) warn_doc_error(g_fileName,doctokenizerYYlineno,"found subsubsection command outside of subsection context!"); while (retval==RetVal_Subsubsection) { @@ -7142,8 +7144,10 @@ void DocRoot::parse() } if (retval==RetVal_Subsection) { - if (!(QString(g_token->sectionId).startsWith("autotoc_md"))) + if (!g_token->sectionId.startsWith("autotoc_md")) + { warn_doc_error(g_fileName,doctokenizerYYlineno,"found subsection command outside of section context!"); + } while (retval==RetVal_Subsection) { if (!g_token->sectionId.isEmpty()) diff --git a/src/docparser.h b/src/docparser.h index 84868f7..02fe135 100644 --- a/src/docparser.h +++ b/src/docparser.h @@ -22,6 +22,7 @@ #include <stdio.h> #include <qlist.h> +#include <qstring.h> #include <qcstring.h> #include "docvisitor.h" diff --git a/src/dotfilepatcher.cpp b/src/dotfilepatcher.cpp index 92a5618..efc6341 100644 --- a/src/dotfilepatcher.cpp +++ b/src/dotfilepatcher.cpp @@ -337,8 +337,8 @@ bool DotFilePatcher::run() const //printf("DotFilePatcher::addSVGConversion: file=%s zoomable=%d\n", // m_patchFile.data(),map->zoomable); } - QString tmpName = QString::fromUtf8(m_patchFile+".tmp"); - QString patchFile = QString::fromUtf8(m_patchFile); + QCString tmpName = m_patchFile+".tmp"; + QCString patchFile = m_patchFile; if (!QDir::current().rename(patchFile,tmpName)) { err("Failed to rename file %s to %s!\n",m_patchFile.data(),tmpName.data()); diff --git a/src/dotnode.cpp b/src/dotnode.cpp index 491bcb5..9eccdde 100644 --- a/src/dotnode.cpp +++ b/src/dotnode.cpp @@ -176,12 +176,12 @@ static void writeBoxMemberList(FTextStream &t, QCString DotNode::convertLabel(const QCString &l) { - QString bBefore("\\_/<({[: =-+@%#~?$"); // break before character set - QString bAfter(">]),:;|"); // break after character set - QString p(l); + QCString bBefore("\\_/<({[: =-+@%#~?$"); // break before character set + QCString bAfter(">]),:;|"); // break after character set + QCString p(l); if (p.isEmpty()) return QCString(); - QString result; - QChar c,pc=0; + QCString result; + char c,pc=0; uint idx = 0; int len=p.length(); int charsLeft=len; @@ -190,18 +190,18 @@ QCString DotNode::convertLabel(const QCString &l) while (idx < p.length()) { c = p[idx++]; - QString replacement; + QCString replacement; switch(c) { - case '\\': replacement="\\\\"; break; - case '\n': replacement="\\n"; break; - case '<': replacement="\\<"; break; - case '>': replacement="\\>"; break; - case '|': replacement="\\|"; break; - case '{': replacement="\\{"; break; - case '}': replacement="\\}"; break; - case '"': replacement="\\\""; break; - default: replacement=c; break; + case '\\': replacement="\\\\"; break; + case '\n': replacement="\\n"; break; + case '<': replacement="\\<"; break; + case '>': replacement="\\>"; break; + case '|': replacement="\\|"; break; + case '{': replacement="\\{"; break; + case '}': replacement="\\}"; break; + case '"': replacement="\\\""; break; + default: replacement+=c; break; } // Some heuristics to insert newlines to prevent too long // boxes and at the same time prevent ugly breaks @@ -219,7 +219,7 @@ QCString DotNode::convertLabel(const QCString &l) sinceLast=1; } else if (charsLeft>1+foldLen/4 && sinceLast>foldLen+foldLen/3 && - !isupper(c) && p[idx].category()==QChar::Letter_Uppercase) + !isupper(c) && isupper(p[idx])) { result+=replacement; result+="\\l"; @@ -241,7 +241,7 @@ QCString DotNode::convertLabel(const QCString &l) charsLeft--; pc=c; } - return result.utf8(); + return result; } static QCString stripProtectionPrefix(const QCString &s) diff --git a/src/dotrunner.cpp b/src/dotrunner.cpp index c01a4e5..a97d8af 100644 --- a/src/dotrunner.cpp +++ b/src/dotrunner.cpp @@ -63,8 +63,8 @@ static void checkPngResult(const char *imgName) static bool resetPDFSize(const int width,const int height, const char *base) { - QString tmpName = QString::fromUtf8(QCString(base)+".tmp"); - QString patchFile = QString::fromUtf8(QCString(base)+".dot"); + QCString tmpName = QCString(base)+".tmp"; + QCString patchFile = QCString(base)+".dot"; if (!QDir::current().rename(patchFile,tmpName)) { err("Failed to rename file %s to %s!\n",patchFile.data(),tmpName.data()); diff --git a/src/doxygen.cpp b/src/doxygen.cpp index c15eddd..7b4810e 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -9434,7 +9434,7 @@ static void copyLogo(const QCString &outputOption) } } -static void copyExtraFiles(QStrList files,const QString &filesOption,const QCString &outputOption) +static void copyExtraFiles(QStrList files,const QCString &filesOption,const QCString &outputOption) { uint i; for (i=0; i<files.count(); ++i) diff --git a/src/eclipsehelp.cpp b/src/eclipsehelp.cpp index dab001a..2757308 100644 --- a/src/eclipsehelp.cpp +++ b/src/eclipsehelp.cpp @@ -115,7 +115,7 @@ void EclipseHelp::finalize() QFile pluginFile(name); if (pluginFile.open(IO_WriteOnly)) { - QString docId = Config_getString(ECLIPSE_DOC_ID); + QCString docId = Config_getString(ECLIPSE_DOC_ID); FTextStream t(&pluginFile); t << "<plugin name=\"" << docId << "\" id=\"" << docId << "\"" << endl; t << " version=\"1.0.0\" provider-name=\"Doxygen\">" << endl; diff --git a/src/fortrancode.l b/src/fortrancode.l index eee4d47..d372299 100644 --- a/src/fortrancode.l +++ b/src/fortrancode.l @@ -971,7 +971,7 @@ LANGUAGE_BIND_SPEC BIND{BS}"("{BS}C{BS}(,{BS}NAME{BS}"="{BS}"\""(.*)"\""{BS})?") <Start>{TYPE_SPEC}/[,:( ] { QCString typ = yytext; typ = removeRedundantWhiteSpace(typ.lower()); - if (QString(typ).startsWith("real")) YY_FTN_REJECT; + if (typ.startsWith("real")) YY_FTN_REJECT; if (typ == "type" || typ == "class" || typ == "procedure") inTypeDecl = 1; yy_push_state(YY_START); BEGIN(Declaration); diff --git a/src/fortranscanner.l b/src/fortranscanner.l index 38abb89..d75134a 100644 --- a/src/fortranscanner.l +++ b/src/fortranscanner.l @@ -1985,7 +1985,7 @@ SymbolModifiers& SymbolModifiers::operator|=(QCString mdfStringArg) else newMdf.passVar = ""; } - else if (QString(mdfString.data()).startsWith("bind")) + else if (mdfString.startsWith("bind")) { // we need here the original string as we want to don't want to have the lowercase name between the quotes of the name= part newMdf.bindVar = extractBind(mdfStringArg); diff --git a/src/ftextstream.h b/src/ftextstream.h index d073f40..bfc5bd5 100644 --- a/src/ftextstream.h +++ b/src/ftextstream.h @@ -23,7 +23,6 @@ class FTextStream FTextStream &operator<<( char ); FTextStream &operator<<( const char *); - FTextStream &operator<<( const QString & ); FTextStream &operator<<( const QCString & ); FTextStream &operator<<( signed short ); FTextStream &operator<<( unsigned short ); @@ -59,11 +58,6 @@ inline FTextStream &FTextStream::operator<<( const char* s) return *this; } -inline FTextStream &FTextStream::operator<<( const QString & s) -{ - return operator<<(s.data()); -} - inline FTextStream &FTextStream::operator<<( const QCString &s) { return operator<<(s.data()); diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp index c7fcaf8..513c3a4 100644 --- a/src/htmldocvisitor.cpp +++ b/src/htmldocvisitor.cpp @@ -65,7 +65,7 @@ static const char *contexts[10] = "intertd" // 9 }; -static QCString convertIndexWordToAnchor(const QString &word) +static QCString convertIndexWordToAnchor(const QCString &word) { static char hex[] = "0123456789abcdef"; static int cnt = 0; @@ -1550,7 +1550,7 @@ void HtmlDocVisitor::visitPre(DocHtmlTable *t) } } - QString attrs = htmlAttribsToString(t->attribs()); + QCString attrs = htmlAttribsToString(t->attribs()); if (attrs.isEmpty()) { m_t << "<table"; @@ -1685,7 +1685,7 @@ void HtmlDocVisitor::visitPre(DocImage *img) forceEndParagraph(img); } if (m_hide) return; - QString baseName=img->name(); + QCString baseName=img->name(); int i; if ((i=baseName.findRev('/'))!=-1 || (i=baseName.findRev('\\'))!=-1) { @@ -1912,9 +1912,9 @@ void HtmlDocVisitor::visitPost(DocRef *ref) void HtmlDocVisitor::visitPre(DocSecRefItem *ref) { if (m_hide) return; - QString refName=ref->file(); + QCString refName=ref->file(); if (refName.right(Doxygen::htmlFileExtension.length())!= - QString(Doxygen::htmlFileExtension)) + QCString(Doxygen::htmlFileExtension)) { refName+=Doxygen::htmlFileExtension; } @@ -1946,7 +1946,7 @@ void HtmlDocVisitor::visitPost(DocSecRefList *s) //void HtmlDocVisitor::visitPre(DocLanguage *l) //{ -// QString langId = Config_getEnum(OUTPUT_LANGUAGE); +// QCString langId = Config_getEnum(OUTPUT_LANGUAGE); // if (l->id().lower()!=langId.lower()) // { // pushEnabled(); @@ -1956,7 +1956,7 @@ void HtmlDocVisitor::visitPost(DocSecRefList *s) // //void HtmlDocVisitor::visitPost(DocLanguage *l) //{ -// QString langId = Config_getEnum(OUTPUT_LANGUAGE); +// QCString langId = Config_getEnum(OUTPUT_LANGUAGE); // if (l->id().lower()!=langId.lower()) // { // popEnabled(); @@ -2144,7 +2144,7 @@ void HtmlDocVisitor::visitPre(DocHtmlBlockQuote *b) { if (m_hide) return; forceEndParagraph(b); - QString attrs = htmlAttribsToString(b->attribs()); + QCString attrs = htmlAttribsToString(b->attribs()); if (attrs.isEmpty()) { m_t << "<blockquote" << getDirHtmlClassOfNode(getTextDirByConfig(b), "doxtable") diff --git a/src/index.cpp b/src/index.cpp index f5faea4..1acd941 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -1943,6 +1943,11 @@ inline bool isId1(int c) return (c<127 && c>31); // printable ASCII character } +static QCString letterToString(uint letter) +{ + return QString(QChar(letter)).utf8(); +} + static QCString letterToLabel(uint startLetter) { char s[11]; // max 0x12345678 + '\0' @@ -2101,7 +2106,7 @@ static void writeAlphabeticalClassList(OutputList &ol, ClassDef::CompoundType ct if (headerItems) alphaLinks += " | "; headerItems++; QCString li = letterToLabel(*pLetter); - QCString ls = QString(QChar(*pLetter)).utf8(); + QCString ls = letterToString(*pLetter); alphaLinks += (QCString)"<a class=\"qindex\" href=\"#letter_" + li + "\">" + ls + "</a>"; @@ -2244,7 +2249,7 @@ static void writeAlphabeticalClassList(OutputList &ol, ClassDef::CompoundType ct ol.writeString("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">" "<tr>" "<td><div class=\"ah\">  "); - ol.writeString(QString(QChar(cell->letter())).utf8()); + ol.writeString(letterToString(cell->letter())); ol.writeString( "  </div>" "</td>" "</tr>" @@ -2839,7 +2844,7 @@ static void writeMemberList(OutputList &ol,bool useSections,int page, if (!firstItem) ol.endItemListItem(); if (!firstSection) ol.endItemList(); QCString cs = letterToLabel(ml->letter()); - QCString cl = QString(QChar(ml->letter())).utf8(); + QCString cl = letterToString(ml->letter()); QCString anchor=(QCString)"index_"+convertToId(cs); QCString title=(QCString)"- "+cl+" -"; ol.startSection(anchor,title,SectionInfo::Subsection); @@ -3120,7 +3125,7 @@ static void writeQuickMemberIndex(OutputList &ol, { uint i = ml->letter(); QCString is = letterToLabel(i); - QCString ci = QString(QChar(i)).utf8(); + QCString ci = letterToString(i); QCString anchor; QCString extension=Doxygen::htmlFileExtension; if (!multiPage) @@ -3210,7 +3215,7 @@ static void writeClassMemberIndexFiltered(OutputList &ol, ClassMemberHighlight h { fileName+="_"+letterToLabel(page); } - QCString cs = QString(QChar(page)).utf8(); + QCString cs = letterToString(page); if (addToIndex) { Doxygen::indexList->addContentsItem(FALSE,cs,0,fileName,0,FALSE,TRUE); @@ -3389,7 +3394,7 @@ static void writeFileMemberIndexFiltered(OutputList &ol, FileMemberHighlight hl) { fileName+="_"+letterToLabel(page); } - QCString cs = QString(QChar(page)).utf8(); + QCString cs = letterToString(page); if (addToIndex) { Doxygen::indexList->addContentsItem(FALSE,cs,0,fileName,0,FALSE,TRUE); @@ -3565,7 +3570,7 @@ static void writeNamespaceMemberIndexFiltered(OutputList &ol, { fileName+="_"+letterToLabel(page); } - QCString cs = QString(QChar(page)).utf8(); + QCString cs = letterToString(page); if (addToIndex) { Doxygen::indexList->addContentsItem(FALSE,cs,0,fileName,0,FALSE,TRUE); @@ -5200,7 +5205,7 @@ void renderMemberIndicesAsJs(FTextStream &t, if (!firstLetter) t << "," << endl; uint letter = ml->letter(); QCString is = letterToLabel(letter); - QCString ci = QString(QChar(letter)).utf8(); + QCString ci = letterToString(letter); QCString anchor; QCString extension=Doxygen::htmlFileExtension; QCString fullName = getInfo(i)->fname; diff --git a/src/mandocvisitor.cpp b/src/mandocvisitor.cpp index 997b24e..21e7cb9 100644 --- a/src/mandocvisitor.cpp +++ b/src/mandocvisitor.cpp @@ -905,25 +905,6 @@ void ManDocVisitor::visitPost(DocSecRefList *) m_t << ".PP" << endl; } -//void ManDocVisitor::visitPre(DocLanguage *l) -//{ -// QString langId = Config_getEnum(OUTPUT_LANGUAGE); -// if (l->id().lower()!=langId.lower()) -// { -// pushEnabled(); -// m_hide = TRUE; -// } -//} -// -//void ManDocVisitor::visitPost(DocLanguage *l) -//{ -// QString langId = Config_getEnum(OUTPUT_LANGUAGE); -// if (l->id().lower()!=langId.lower()) -// { -// popEnabled(); -// } -//} - void ManDocVisitor::visitPre(DocParamSect *s) { if (m_hide) return; diff --git a/src/markdown.cpp b/src/markdown.cpp index e63bf10..ce28540 100644 --- a/src/markdown.cpp +++ b/src/markdown.cpp @@ -2590,7 +2590,7 @@ void MarkdownFileParser::parseInput(const char *fileName, QCString docs = fileBuf; QCString id; QCString title=extractPageTitle(docs,id).stripWhiteSpace(); - if (QString(id).startsWith("autotoc_md")) id = ""; + if (id.startsWith("autotoc_md")) id = ""; g_indentLevel=title.isEmpty() ? 0 : -1; QCString titleFn = QFileInfo(fileName).baseName().utf8(); QCString fn = QFileInfo(fileName).fileName().utf8(); diff --git a/src/rtfgen.cpp b/src/rtfgen.cpp index 229a817..f32936e 100644 --- a/src/rtfgen.cpp +++ b/src/rtfgen.cpp @@ -3049,7 +3049,9 @@ void RTFGenerator::endInlineMemberDoc() void RTFGenerator::writeLineNumber(const char *,const char *,const char *,int l) { DoxyCodeLineOpen = TRUE; - t << QString("%1").arg(l,5) << " "; + QCString lineNumber; + lineNumber.sprintf("%05d",l); + t << lineNumber << " "; } void RTFGenerator::startCodeLine(bool) { diff --git a/src/sortdict.h b/src/sortdict.h index 4db330f..52eccd3 100644 --- a/src/sortdict.h +++ b/src/sortdict.h @@ -237,10 +237,6 @@ class SDict { return m_dict->find(key); } - T *find(const QString &key) - { - return m_dict->find(key); - } int findAt(const QCString &key) { T *item = find(key); diff --git a/src/tclscanner.l b/src/tclscanner.l index a680cf9..e763575 100644 --- a/src/tclscanner.l +++ b/src/tclscanner.l @@ -425,7 +425,7 @@ static struct int code_linenumbers; // if true create line numbers in code const char *code_font; // used font to codify bool config_autobrief; // value of configuration option - QMap<QString,QString> config_subst; // map of configuration option values + QMap<QCString,QCString> config_subst; // map of configuration option values QCString input_string; // file contents int input_position; // position in file QCString file_name; // name of used file @@ -464,7 +464,7 @@ static struct // scanner functions static int yyread(char *buf,int max_size); -static tcl_scan *tcl_scan_start(char type, QString content, QCString ns, Entry *entry_cls, Entry *entry_fn); +static tcl_scan *tcl_scan_start(char type, QCString content, QCString ns, Entry *entry_cls, Entry *entry_fn); static void tcl_scan_end(); static void tcl_comment(int what,const char *text); static void tcl_word(int what,const char *text); @@ -729,7 +729,7 @@ static void tcl_codify(const char *s,const char *str) } //! Codify 'str' with special font class 's'. -static void tcl_codify(const char *s,const QString &str) +static void tcl_codify(const char *s,const QCString &str) { if (tcl.code==NULL) return; tcl_codify(s,str); @@ -1135,10 +1135,10 @@ D //! Start new scan context for given 'content'. // @return created new scan context. -static tcl_scan *tcl_scan_start(char type, QString content, QCString ns, Entry *entry_cl, Entry *entry_fn) +static tcl_scan *tcl_scan_start(char type, QCString content, QCString ns, Entry *entry_cl, Entry *entry_fn) { tcl_scan *myScan=tcl.scan.at(0); -tcl_inf("line=%d type=%d '%s'\n",tcl.line_body0,type,content.ascii()); +tcl_inf("line=%d type=%d '%s'\n",tcl.line_body0,type,content.data()); myScan->line1=yylineno; yy_push_state(TOP); @@ -1167,7 +1167,7 @@ tcl_inf("line=%d type=%d '%s'\n",tcl.line_body0,type,content.ascii()); myScan->entry_cl = entry_cl; myScan->entry_fn = entry_fn; myScan->entry_scan = tcl.entry_current; - myScan->buffer_state=yy_scan_string(content.ascii()); + myScan->buffer_state=yy_scan_string(content.data()); myScan->line0=tcl.line_body0; myScan->line1=tcl.line_body1; myScan->after.clear(); @@ -2562,7 +2562,7 @@ tcl_inf("->\n"); if (myStr.left(2)=="::") myStr = myStr.mid(2); if (tcl.config_subst.contains(myStr)) { - myStr=tcl.config_subst[myStr].utf8(); + myStr=tcl.config_subst[myStr]; } if (myStr=="private") { @@ -2598,7 +2598,7 @@ tcl_inf("->\n"); if (myStr.left(2)=="::") myStr = myStr.mid(2); if (tcl.config_subst.contains(myStr)) { - myStr=tcl.config_subst[myStr].utf8(); + myStr=tcl.config_subst[myStr]; } } if (myStr=="proc") @@ -3018,7 +3018,7 @@ void TclLanguageScanner::parseCode(CodeOutputInterface & codeOutIntf, } } - QString myStr="Codifying.."; + QCString myStr="Codifying.."; if (scopeName) { myStr +=" scope="; @@ -3041,7 +3041,7 @@ void TclLanguageScanner::parseCode(CodeOutputInterface & codeOutIntf, myStr+=" file="; myStr+=fileDef->fileName(); } -tcl_inf("%s (%d,%d) %d %d\n",myStr.ascii(),startLine,endLine,isExampleBlock,inlineFragment); +tcl_inf("%s (%d,%d) %d %d\n",myStr.data(),startLine,endLine,isExampleBlock,inlineFragment); //tcl_inf("%s\n"input.data()); tcl_init(); tcl.collectXRefs = collectXRefs; |