Qt 4.8
Static Protected Functions | List of all members
QAbstractConcatenable Struct Reference

#include <qstringbuilder.h>

Inheritance diagram for QAbstractConcatenable:
QConcatenable< char > QConcatenable< char[N]> QConcatenable< const char * > QConcatenable< const char[N]> QConcatenable< QByteArray > QConcatenable< QChar > QConcatenable< QCharRef > QConcatenable< QString > QConcatenable< QStringRef >

Static Protected Functions

static void convertFromAscii (const char *a, int len, QChar *&out)
 
static void convertFromAscii (char a, QChar *&out)
 
static void convertToAscii (const QChar *a, int len, char *&out)
 
static void convertToAscii (QChar a, char *&out)
 
static void convertToLatin1 (QChar a, char *&out)
 

Detailed Description

Definition at line 78 of file qstringbuilder.h.

Functions

◆ convertFromAscii() [1/2]

void QAbstractConcatenable::convertFromAscii ( const char *  a,
int  len,
QChar *&  out 
)
staticprotected
Warning
This function is not part of the public interface. Note: The len contains the ending \0

Definition at line 175 of file qstringbuilder.cpp.

Referenced by QConcatenable< char >::appendTo(), QConcatenable< char[N]>::appendTo(), QConcatenable< const char[N]>::appendTo(), QConcatenable< const char * >::appendTo(), and QConcatenable< QByteArray >::appendTo().

176 {
177 #ifndef QT_NO_TEXTCODEC
178  if (QString::codecForCStrings && len) {
179  QString tmp = QString::fromAscii(a, len > 0 ? len - 1 : -1);
180  memcpy(out, reinterpret_cast<const char *>(tmp.constData()), sizeof(QChar) * tmp.size());
181  out += tmp.length();
182  return;
183  }
184 #endif
185  if (len == -1) {
186  if (!a)
187  return;
188  while (*a)
189  *out++ = QLatin1Char(*a++);
190  } else {
191  for (int i = 0; i < len - 1; ++i)
192  *out++ = QLatin1Char(a[i]);
193  }
194 }
static QString fromAscii(const char *, int size=-1)
Returns a QString initialized with the first size characters from the string str. ...
Definition: qstring.cpp:4276
int length() const
Returns the number of characters in this string.
Definition: qstring.h:696
long ASN1_INTEGER_get ASN1_INTEGER * a
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
int size() const
Returns the number of characters in this string.
Definition: qstring.h:102
static QTextCodec * codecForCStrings
Definition: qstring.h:621
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55
const QChar * constData() const
Returns a pointer to the data stored in the QString.
Definition: qstring.h:712

◆ convertFromAscii() [2/2]

static void QAbstractConcatenable::convertFromAscii ( char  a,
QChar *&  out 
)
inlinestaticprotected

Definition at line 83 of file qstringbuilder.h.

84  {
85 #ifndef QT_NO_TEXTCODEC
87  *out++ = QChar::fromAscii(a);
88  else
89 #endif
90  *out++ = QLatin1Char(a);
91  }
long ASN1_INTEGER_get ASN1_INTEGER * a
static QTextCodec * codecForCStrings
Definition: qstring.h:621
static QChar fromAscii(char c)
Converts the ASCII character c to its equivalent QChar.
Definition: qchar.cpp:1521
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

◆ convertToAscii() [1/2]

void QAbstractConcatenable::convertToAscii ( const QChar a,
int  len,
char *&  out 
)
staticprotected
Warning
This function is not part of the public interface.

Definition at line 197 of file qstringbuilder.cpp.

198 {
199 #ifndef QT_NO_TEXTCODEC
202  memcpy(out, tmp.constData(), tmp.size());
203  out += tmp.length();
204  return;
205  }
206 #endif
207  if (len == -1) {
208  while (a->unicode())
209  convertToLatin1(*a++, out);
210  } else {
211  for (int i = 0; i < len; ++i)
212  convertToLatin1(a[i], out);
213  }
214 }
ushort unicode() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qchar.h:251
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
static void convertToLatin1(QChar a, char *&out)
QByteArray fromUnicode(const QString &uc) const
Converts str from Unicode to the encoding of this codec, and returns the result in a QByteArray...
int length() const
Same as size().
Definition: qbytearray.h:356
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433
static QTextCodec * codecForCStrings
Definition: qstring.h:621
int size() const
Returns the number of bytes in this byte array.
Definition: qbytearray.h:402

◆ convertToAscii() [2/2]

static void QAbstractConcatenable::convertToAscii ( QChar  a,
char *&  out 
)
inlinestaticprotected

Definition at line 93 of file qstringbuilder.h.

94  {
95 #ifndef QT_NO_TEXTCODEC
97  *out++ = a.toAscii(); //###
98  else
99 #endif
100  convertToLatin1(a, out);
101  }
static void convertToLatin1(QChar a, char *&out)
char toAscii() const
Returns the character value of the QChar obtained using the current codec used to read C strings...
Definition: qchar.cpp:1490
static QTextCodec * codecForCStrings
Definition: qstring.h:621

◆ convertToLatin1()

static void QAbstractConcatenable::convertToLatin1 ( QChar  a,
char *&  out 
)
inlinestaticprotected

Definition at line 103 of file qstringbuilder.h.

Referenced by convertToAscii().

104  {
105  *out++ = a.unicode() > 0xff ? '?' : char(a.unicode());
106  }
ushort unicode() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qchar.h:251

The documentation for this struct was generated from the following files: