Qt 4.8
Public Functions | Properties | List of all members
QLatin1Literal Class Reference

The QLatin1Literal class provides a thin wrapper around string literals used in source code. More...

#include <qstringbuilder.h>

Public Functions

const char * data () const
 Returns a pointer to the first character of the string literal. More...
 
template<int N>
 QLatin1Literal (const char(&str)[N])
 Constructs a new literal from the string str. More...
 
int size () const
 Returns the number of characters in the literal excluding the trailing NULL char. More...
 

Properties

const char *const m_data
 
const int m_size
 

Detailed Description

The QLatin1Literal class provides a thin wrapper around string literals used in source code.

Warning
This function is not part of the public interface.
Note
This class or function is reentrant.
Since
4.6

Unlike QLatin1String, a QLatin1Literal can retrieve its size without iterating over the literal.

The main use of QLatin1Literal is in conjunction with QStringBuilder to reduce the number of reallocations needed to build up a string from smaller chunks.

See also
QStringBuilder, QLatin1String, QString, QStringRef

Definition at line 63 of file qstringbuilder.h.

Constructors and Destructors

◆ QLatin1Literal()

template<int N>
QLatin1Literal::QLatin1Literal ( const char(&)  str[N])
inline

Constructs a new literal from the string str.

Definition at line 70 of file qstringbuilder.h.

71  : m_size(N - 1), m_data(str) {}
const int m_size
const char *const m_data

Functions

◆ data()

const char * QLatin1Literal::data ( ) const
inline

Returns a pointer to the first character of the string literal.

The string literal is terminated by a NUL character.

Definition at line 67 of file qstringbuilder.h.

Referenced by QConcatenable< QLatin1Literal >::appendTo().

67 { return m_data; }
const char *const m_data

◆ size()

int QLatin1Literal::size ( ) const
inline

Returns the number of characters in the literal excluding the trailing NULL char.

Definition at line 66 of file qstringbuilder.h.

Referenced by QConcatenable< QLatin1Literal >::size().

66 { return m_size; }
const int m_size

Properties

◆ m_data

const char* const QLatin1Literal::m_data
private

Definition at line 75 of file qstringbuilder.h.

◆ m_size

const int QLatin1Literal::m_size
private

Definition at line 74 of file qstringbuilder.h.


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