diff options
Diffstat (limited to 'qtools')
-rw-r--r-- | qtools/qcache.h | 2 | ||||
-rw-r--r-- | qtools/scstring.cpp | 15 | ||||
-rw-r--r-- | qtools/scstring.h | 1 |
3 files changed, 17 insertions, 1 deletions
diff --git a/qtools/qcache.h b/qtools/qcache.h index 78cef3d..f15345e 100644 --- a/qtools/qcache.h +++ b/qtools/qcache.h @@ -101,7 +101,7 @@ public: bool remove( const char *k ) { return QGCache::remove_other(k); } type *take( const char *k ) - { return (type *)QGCache::take_ascii(k); } + { return (type *)QGCache::take_other(k); } type *find( const char *k, bool ref=TRUE ) const { return (type *)QGCache::find_other(k,ref);} type *operator[]( const char *k ) const diff --git a/qtools/scstring.cpp b/qtools/scstring.cpp index 4a36755..18a5492 100644 --- a/qtools/scstring.cpp +++ b/qtools/scstring.cpp @@ -643,6 +643,21 @@ void SCString::msg_index( uint index ) #endif } +bool SCString::stripPrefix(const char *prefix) +{ + if (prefix==0) return FALSE; + uint plen = qstrlen(prefix); + if (m_data && qstrncmp(prefix,m_data,plen)==0) // prefix matches + { + uint len = qstrlen(m_data); + uint newlen = len-plen+1; + qmemmove(m_data,m_data+plen,newlen); + resize(newlen); + return TRUE; + } + return FALSE; +} + //--------------------------------------------------------------------------- void *qmemmove( void *dst, const void *src, uint len ) diff --git a/qtools/scstring.h b/qtools/scstring.h index 41dcfac..08de44b 100644 --- a/qtools/scstring.h +++ b/qtools/scstring.h @@ -64,6 +64,7 @@ public: int contains( char c, bool cs=TRUE ) const; int contains( const char *str, bool cs=TRUE ) const; int contains( const QRegExp & ) const; + bool stripPrefix(const char *prefix); SCString left( uint len ) const; SCString right( uint len ) const; |