qTox  Version: nightly | Commit: bc751c8e1cac455f9690654fcfe0f560d2d7dfdd
Public Member Functions | Private Attributes | List of all members
ToxString Class Reference

Helper to convert safely between strings in the c-toxcore representation and QString. More...

#include <toxstring.h>

Collaboration diagram for ToxString:
Collaboration graph

Public Member Functions

 ToxString (const QString &text)
 Creates a ToxString from a QString. More...
 
 ToxString (const QByteArray &text)
 Creates a ToxString from bytes in a QByteArray. More...
 
 ToxString (const uint8_t *text, size_t length)
 Creates a ToxString from the representation used by c-toxcore. More...
 
const uint8_t * data () const
 Returns a pointer to the beginning of the string data. More...
 
size_t size () const
 Get the number of bytes in the string. More...
 
QString getQString () const
 Gets the string as QString. More...
 
QByteArray getBytes () const
 getBytes Gets the bytes of the string. More...
 

Private Attributes

QByteArray string
 

Detailed Description

Helper to convert safely between strings in the c-toxcore representation and QString.

Definition at line 27 of file toxstring.h.

Constructor & Destructor Documentation

◆ ToxString() [1/3]

ToxString::ToxString ( const QString &  text)
explicit

Creates a ToxString from a QString.

Parameters
stringInput text.

Definition at line 37 of file toxstring.cpp.

◆ ToxString() [2/3]

ToxString::ToxString ( const QByteArray &  text)
explicit

Creates a ToxString from bytes in a QByteArray.

Parameters
textInput text.

Definition at line 46 of file toxstring.cpp.

◆ ToxString() [3/3]

ToxString::ToxString ( const uint8_t *  text,
size_t  length 
)

Creates a ToxString from the representation used by c-toxcore.

Parameters
textPointer to the beginning of the text.
lengthNumber of bytes to read from the beginning.

Definition at line 56 of file toxstring.cpp.

Member Function Documentation

◆ data()

const uint8_t * ToxString::data ( ) const

Returns a pointer to the beginning of the string data.

Returns
Pointer to the beginning of the string data.

Definition at line 66 of file toxstring.cpp.

Here is the caller graph for this function:

◆ getBytes()

QByteArray ToxString::getBytes ( ) const

getBytes Gets the bytes of the string.

Returns
Bytes of the string as QByteArray.

Definition at line 93 of file toxstring.cpp.

◆ getQString()

QString ToxString::getQString ( ) const

Gets the string as QString.

Returns
QString representation of the string.

Definition at line 84 of file toxstring.cpp.

Here is the caller graph for this function:

◆ size()

size_t ToxString::size ( ) const

Get the number of bytes in the string.

Returns
Number of bytes in the string.

Definition at line 75 of file toxstring.cpp.

Here is the caller graph for this function:

Member Data Documentation

◆ string

QByteArray ToxString::string
private

Definition at line 40 of file toxstring.h.


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