42 #ifndef QSTRINGBUILDER_H 43 #define QSTRINGBUILDER_H 45 #include <QtCore/qstring.h> 46 #include <QtCore/qbytearray.h> 48 #if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) 49 # if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ == 0) 50 # include <QtCore/qmap.h> 66 int size()
const {
return m_size; }
67 const char *
data()
const {
return m_data; }
71 : m_size(N - 1), m_data(str) {}
81 static void convertFromAscii(
const char *
a,
int len,
QChar *&out);
82 static void convertToAscii(
const QChar *a,
int len,
char *&out);
85 #ifndef QT_NO_TEXTCODEC 95 #ifndef QT_NO_TEXTCODEC 111 template <
typename A,
typename B>
124 typename T::iterator
d = s.data();
125 typename T::const_iterator
const start =
d;
139 operator ConvertTo()
const {
return convertTo<ConvertTo>(); }
142 int size()
const {
return Concatenable::size(*
this); }
180 enum { ExactSize =
true };
181 static int size(
const char) {
return 1; }
182 #ifndef QT_NO_CAST_FROM_ASCII 196 enum { ExactSize =
true };
208 enum { ExactSize =
true };
212 #ifndef QT_NO_CAST_TO_ASCII 214 { convertToAscii(c, out); }
222 enum { ExactSize =
true };
225 { *out++ =
QChar(c); }
226 #ifndef QT_NO_CAST_TO_ASCII 228 { convertToAscii(c, out); }
236 enum { ExactSize =
true };
240 for (
const char *s = a.
latin1(); *s; )
245 for (
const char *s = a.
latin1(); *s; )
254 enum { ExactSize =
true };
255 static int size(
const QLatin1Literal &
a) {
return a.
size(); }
258 for (
const char *s = a.
data(); *s; )
261 static inline void appendTo(
const QLatin1Literal &
a,
char *&out)
263 for (
const char *s = a.
data(); *s; )
272 enum { ExactSize =
true };
276 const int n = a.
size();
277 memcpy(out, reinterpret_cast<const char*>(a.
constData()),
sizeof(
QChar) * n);
280 #ifndef QT_NO_CAST_TO_ASCII 290 enum { ExactSize =
true };
294 const int n = a.
size();
295 memcpy(out, reinterpret_cast<const char*>(a.
constData()),
sizeof(
QChar) * n);
298 #ifndef QT_NO_CAST_TO_ASCII 309 enum { ExactSize =
false };
310 static int size(
const char[N]) {
return N - 1; }
311 #ifndef QT_NO_CAST_FROM_ASCII 317 static inline void appendTo(
const char a[N],
char *&out)
328 enum { ExactSize =
false };
329 static int size(
const char[N]) {
return N - 1; }
330 #ifndef QT_NO_CAST_FROM_ASCII 336 static inline void appendTo(
const char a[N],
char *&out)
347 enum { ExactSize =
false };
349 #ifndef QT_NO_CAST_FROM_ASCII 366 enum { ExactSize =
false };
368 #ifndef QT_NO_CAST_FROM_ASCII 378 const char *
const end = ba.
end();
391 template <
typename A,
typename B>
401 template<
typename T>
static inline void appendTo(
const type &p, T *&out)
408 template <
typename A,
typename B>
417 #if defined(QT_USE_FAST_OPERATOR_PLUS) || defined(QT_USE_QSTRINGBUILDER) 418 template <
typename A,
typename B>
426 template <
typename A,
typename B>
429 #ifndef QT_NO_CAST_TO_ASCII 443 template <
typename A,
typename B>
459 #endif // QSTRINGBUILDER_H #define QT_ASCII_CAST_WARN
QConcatenable< QStringBuilder< A, B > > Concatenable
static void appendTo(const QLatin1Char c, char *&out)
static int size(const QLatin1Literal &a)
The QLatin1Literal class provides a thin wrapper around string literals used in source code...
#define QT_END_NAMESPACE
This macro expands to.
static void appendTo(const char a[N], char *&out)
char * data()
Returns a pointer to the data stored in the byte array.
int length() const
Returns the number of characters referred to by the string reference.
char toLatin1() const
Converts a Latin-1 character to an 8-bit ASCII representation of the character.
QByteArray & operator+=(QByteArray &a, const QStringBuilder< A, B > &b)
ushort unicode() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
#define it(className, varName)
QtStringBuilder::ConvertToTypeHelper< typename QConcatenable< A >::ConvertTo, typename QConcatenable< B >::ConvertTo >::ConvertTo ConvertTo
QStringBuilder< A, B > type
The QByteArray class provides an array of bytes.
int length() const
Returns the number of characters in this string.
static QT_ASCII_CAST_WARN void appendTo(const QStringRef &a, char *&out)
Concatenable::ConvertTo ConvertTo
long ASN1_INTEGER_get ASN1_INTEGER * a
The QString class provides a Unicode character string.
static void appendTo(const QByteArray &ba, QChar *&out)
static void convertFromAscii(const char *a, int len, QChar *&out)
static void appendTo(const QChar c, QChar *&out)
static QT_ASCII_CAST_WARN void appendTo(const QString &a, char *&out)
The QChar class provides a 16-bit Unicode character.
QChar * data()
Returns a pointer to the data stored in the QString.
static void appendTo(const char c, char *&out)
QLatin1Literal(const char(&str)[N])
Constructs a new literal from the string str.
const QChar * constData() const
Same as unicode().
void reserve(int size)
Attempts to allocate memory for at least size characters.
QStringBuilder(const QByteArray &a_, const QByteArray &b_)
static int size(const QLatin1String &a)
static void QT_ASCII_CAST_WARN appendTo(const char a[N], QChar *&out)
static void appendTo(const char a[N], char *&out)
static void convertToLatin1(QChar a, char *&out)
static int size(const char)
int size() const
Returns the number of characters referred to by the string reference.
#define QT_BEGIN_NAMESPACE
This macro expands to.
const char * latin1() const
Returns the Latin-1 string stored in this object.
The QStringBuilder class is a template class that provides a facility to build up QStrings from small...
static void appendTo(const type &p, T *&out)
int size() const
Returns the number of characters in this string.
static void appendTo(const QLatin1Literal &a, char *&out)
static int size(const char *a)
QByteArray toLatin1() const
Returns a Latin-1 representation of the string as a QByteArray.
static int size(const type &p)
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
static void appendTo(const QLatin1String &a, QChar *&out)
static void appendTo(const QCharRef &c, QChar *&out)
static void appendTo(const QString &a, QChar *&out)
static void appendTo(const QLatin1Char c, QChar *&out)
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
QStringBuilder< typename QConcatenable< A >::type, typename QConcatenable< B >::type > operator%(const A &a, const B &b)
static void appendTo(const QLatin1String &a, char *&out)
The QStringRef class provides a thin wrapper around QString substrings.
static int size(const QChar)
const char * data() const
Returns a pointer to the first character of the string literal.
static int size(const QStringRef &a)
static void convertToAscii(QChar a, char *&out)
char toAscii() const
Returns the character value of the QChar obtained using the current codec used to read C strings...
void resize(int size)
Sets the size of the string to size characters.
const char * constData() const
Returns a pointer to the data stored in the byte array.
uint qstrlen(const char *str)
static int size(const char[N])
QByteArray toLatin1() const
static QT_ASCII_CAST_WARN void appendTo(const char c, QChar *&out)
static void appendTo(const QByteArray &ba, char *&out)
static QT_ASCII_CAST_WARN void appendTo(const QCharRef &c, char *&out)
static int size(const QByteArray &ba)
static void QT_ASCII_CAST_WARN appendTo(const char *a, QChar *&out)
The QCharRef class is a helper class for QString.
void resize(int size)
Sets the size of the byte array to size bytes.
static QTextCodec * codecForCStrings
static void QT_ASCII_CAST_WARN appendTo(const char a[N], QChar *&out)
static QT_ASCII_CAST_WARN void appendTo(const QChar c, char *&out)
static void appendTo(const QLatin1Literal &a, QChar *&out)
static void appendTo(const QStringRef &a, QChar *&out)
int size() const
Returns the number of bytes in this byte array.
static void convertFromAscii(char a, QChar *&out)
static int size(const QLatin1Char)
QStringBuilder(const A &a_, const B &b_)
Constructs a QStringBuilder from a and b.
static void appendTo(const char *a, char *&out)
static int size(const QCharRef &)
void reserve(int size)
Attempts to allocate memory for at least size bytes.
static const KeyPair *const end
static QChar fromAscii(char c)
Converts the ASCII character c to its equivalent QChar.
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
QByteArray convertToLatin1(const JSC::UString &str)
const QChar * constData() const
Returns a pointer to the data stored in the QString.
QStringBuilder(const QString &a_, const QString &b_)
int size() const
Returns the number of characters in the literal excluding the trailing NULL char. ...
static int size(const QString &a)
static int size(const char[N])
timeval operator+(const timeval &t1, const timeval &t2)