On this page

C

Qul::String Class

class Qul::String

The String class provides an interface to the Qt Quick Ultralite APIs. More...

Header: #include <qul/unicodestring.h>
Since: Qt Quick Ultralite 2.12

Public Functions

String()
String(const Qul::StdStringType &value)
String(const char *utf8)
String(const std::string &value)

Macros

Detailed Description

The String class is designed as an interface type. Its main use case is as a function parameter type. It allows a single function to accept a wide variety of string data sources.

Member Function Documentation

String::String()

Constructs an empty latin1 string with 0 length.

String::String(const Qul::StdStringType &value)

Constructs a string from the StdStringType parameter.

String initializes a new StdStringType which copies the string data from the referenced StdStringType.

Note: Enabled when QUL_STD_STRING_SUPPORT is defined in the Qt Quick Ultralite core library. For more infomation, see CMake Manual

See also Building Qt Quick Ultralite from sources.

String::String(const char *utf8)

Constructs a view on a UTF-8 string.

The Qt Quick Ultralite string does not own the data but acts as a view to the data. When used as a data member, care must be taken to ensure that the referenced string data outlives the String on all code paths.

String::String(const std::string &value)

Constructs a string from std::string.

String initializes a new std::string which copies the string data from the referenced std::string.

Note: Enabled when QUL_STD_STRING_SUPPORT is defined in the Qt Quick Ultralite core library. For more infomation, see CMake Manual

See also Building Qt Quick Ultralite from sources.

Related Non-Members

StdStringType

The StdStringType is a type definition for a std::string using Qt Quick Ultralite memory custom allocator.

Application developers who wish to use a std::string and see its allocation size added to the Memory footprint logging, should use this typedef to declare their string variables.

A String constructor accepts a parameter of this type.

To enable the usage of this typedef, QUL_STD_STRING_SUPPORT must be defined. For more information, see QUL_STD_STRING_SUPPORT and CMake Manual.

Macro Documentation

QUL_STD_STRING_SUPPORT

This compile definition is defined by default in the Qt Quick Ultralite core library.

When it is defined in the Qt Quick Ultralite core library, it enables String constructors that take std::string and StdStringType parameters. It also enables the usage of StdStringType typedef.

When it is defined only for the application build, it enables only the StdStringType typedef for use in the application.

See also CMake Manual and Building Qt Quick Ultralite from sources.

Available under certain Qt licenses.
Find out more.