libqmlbind
A C library for creating QML bindings for other languages easily through exporting objects to QML
Files | Classes | Functions
qmlbind_string

Acts as string wrapper for libqmlbind's api. More...

Files

file  string.h
 Contains all methods defined on qmlbind_string.
 

Classes

struct  qmlbind_string
 an opaque struct mainly used as self argument in the methods defined in qmlbind_string. More...
 

Functions

QMLBIND_API const char * qmlbind_string_get_chars (const qmlbind_string *self)
 Returns a pointer to the chars stored in the qmlbind_string. More...
 
QMLBIND_API int qmlbind_string_get_length (const qmlbind_string *self)
 Returns the number of chars in this string. More...
 
QMLBIND_API void qmlbind_string_release (qmlbind_string *self)
 Destroys the qmlbind_string.
 

Detailed Description

Acts as string wrapper for libqmlbind's api.

This is equivalent to a QString stored as a QByteArray, encoded with QString::toUtf8.

Function Documentation

QMLBIND_API const char* qmlbind_string_get_chars ( const qmlbind_string self)

Returns a pointer to the chars stored in the qmlbind_string.

The pointer can be used to access the chars that compose the string. The data is '\0'-terminated. The pointer remains valid as long as the string isn't destroyed.

libqmlbind's equivalent of QByteArray::constData

QMLBIND_API int qmlbind_string_get_length ( const qmlbind_string self)

Returns the number of chars in this string.

The last byte in the string is at position qmlbind_string_get_length() - 1. In addition, qmlbind_string ensures that the char at position qmlbind_string_get_length() is always '\0', so that you can use the return value of qmlbind_string_get_chars() as argument to functions that expect '\0'-terminated strings.

libqmlbind's equivalent of QByteArray::size