summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--addon/doxmlparser/src/stringimpl.h24
-rw-r--r--qtools/qcstring.h2
2 files changed, 17 insertions, 9 deletions
diff --git a/addon/doxmlparser/src/stringimpl.h b/addon/doxmlparser/src/stringimpl.h
index 013858f..8931b42 100644
--- a/addon/doxmlparser/src/stringimpl.h
+++ b/addon/doxmlparser/src/stringimpl.h
@@ -4,26 +4,34 @@
#include <qstring.h>
#include "doxmlintf.h"
-class StringImpl : public QString, public IString
+class StringImpl : public IString
{
public:
StringImpl() {}
- StringImpl(const QString &str) : QString(str) {}
+ StringImpl(const QString &str) : m_str(str) {}
StringImpl &operator=(const QString &str)
- { QString::operator=(str); return *this; }
+ { m_str=str; return *this; }
virtual ~StringImpl() {}
+ const char *data() const
+ { return m_str.data(); }
// IString
const char *latin1() const
- { return QString::latin1(); }
+ { return m_str.latin1(); }
const char *utf8() const
- { return QString::utf8(); }
+ { m_cstr = m_str.utf8(); return m_cstr.data(); }
unsigned short unicodeCharAt(int index) const
- { return QString::unicode()[index].unicode(); }
+ { return m_str.unicode()[index].unicode(); }
bool isEmpty() const
- { return QString::isEmpty(); }
+ { return m_str.isEmpty(); }
int length() const
- { return QString::length(); }
+ { return m_str.length(); }
+
+ operator QString() const { return m_str; }
+
+ private:
+ QString m_str;
+ mutable QCString m_cstr; // used as a cache for m_str.utf8() to avoid returning a temporary
};
#endif
diff --git a/qtools/qcstring.h b/qtools/qcstring.h
index c2a5dc3..e1414b5 100644
--- a/qtools/qcstring.h
+++ b/qtools/qcstring.h
@@ -391,7 +391,7 @@ public:
// resizes LSData so it can hold size bytes (which includes the 0 terminator!)
// Since this is for long strings only, size should be > SHORT_STR_CAPACITY
- static LSData *resize(LSData *d,int size)
+ static LSData *resize(LSData *d,uint size)
{
if (d->len>0 && d->refCount==0) // non-const, non-empty
{