Interface Technology Basics: UString Class Reference
Author: Steinberg

Interface Technology Basics VST 3.7 SDK for developing VST plug-in

Public Member Functions | Protected Attributes | List of all members
UString Class Reference

UTF-16 string class without buffer management. More...

`#include <ustring.h>`

Inheritance diagram for UString:

## Public Member Functions
| UString (char16 *buffer, int32 size)
| Construct from UTF-16 string, size is in code unit (count of char16) More...
int32 | getSize () const
| returns buffer size More...
| operator const char16 * () const
| cast to char16* More...
int32 | getLength () const
| Returns length of string (in code unit). More...
UString & | assign (const char16 *src, int32 srcSize=-1)
| Copy from UTF-16 buffer (srcSize is in code unit (count of char16)). More...
UString & | append (const char16 *src, int32 srcSize=-1)
| Append UTF-16 buffer (srcSize is in code unit (count of char16)). More...
const UString & | copyTo (char16 *dst, int32 dstSize) const
| Copy to UTF-16 buffer (dstSize is in code unit (count of char16)). More...
UString & | fromAscii (const char *src, int32 srcSize=-1)
| Copy from ASCII string (srcSize is in code unit (count of char16)). More...
UString & | assign (const char *src, int32 srcSize=-1)
const UString & | toAscii (char *dst, int32 dstSize) const
| Copy to ASCII string. More...
bool | scanInt (int64 &value) const
| Scan integer from string. More...
bool | printInt (int64 value)
| Print integer to string. More...
bool | scanFloat (double &value) const
| Scan float from string. More...
bool | printFloat (double value, int32 precision=4)
| Print float to string. More...

## Protected Attributes
char16 * | thisBuffer
int32 | thisSize
| size in code unit (not in byte!) More...

## Detailed Description

UTF-16 string class without buffer management.

Note: that some characters are encoded in 2 UTF16 code units (surrogate pair), this means that getLength returns the number of code unit, not the count of character!

## Constructor & Destructor Documentation

## ◆ UString()

UString | ( | char16 * | buffer,
|  | int32 | size
| ) |  |
| inline

Construct from UTF-16 string, size is in code unit (count of char16)

## Member Function Documentation

## ◆ getSize()

int32 getSize | ( |  | ) | const
| inline

returns buffer size

## ◆ operator const char16 *()

operator const char16 * | ( |  | ) | const
| inline

cast to char16*

## ◆ getLength()

int32 getLength | ( |  | ) | const

Returns length of string (in code unit).

Note this is not the count of character!

## ◆ assign() [1/2]

UString & assign | ( | const char16 * | src,
|  | int32 | srcSize = `-1`
| ) |  |

Copy from UTF-16 buffer (srcSize is in code unit (count of char16)).

## ◆ append()

UString & append | ( | const char16 * | src,
|  | int32 | srcSize = `-1`
| ) |  |

Append UTF-16 buffer (srcSize is in code unit (count of char16)).

## ◆ copyTo()

const UString & copyTo | ( | char16 * | dst,
|  | int32 | dstSize
| ) |  | const

Copy to UTF-16 buffer (dstSize is in code unit (count of char16)).

## ◆ fromAscii()

UString & fromAscii | ( | const char * | src,
|  | int32 | srcSize = `-1`
| ) |  |

Copy from ASCII string (srcSize is in code unit (count of char16)).

## ◆ assign() [2/2]

UString & assign | ( | const char * | src,
|  | int32 | srcSize = `-1`
| ) |  |
| inline

## ◆ toAscii()

const UString & toAscii | ( | char * | dst,
|  | int32 | dstSize
| ) |  | const

Copy to ASCII string.

## ◆ scanInt()

bool scanInt | ( | int64 & | value | ) | const

Scan integer from string.

## ◆ printInt()

bool printInt | ( | int64 | value | ) |

Print integer to string.

## ◆ scanFloat()

bool scanFloat | ( | double & | value | ) | const

Scan float from string.

## ◆ printFloat()

bool printFloat | ( | double | value,
|  | int32 | precision = `4`
| ) |  |

Print float to string.

## Member Data Documentation

## ◆ thisBuffer

char16* thisBuffer
| protected

## ◆ thisSize

int32 thisSize
| protected

size in code unit (not in byte!)

Empty

Copyright © Steinberg Media Technologies GmbH. All Rights Reserved. This documentation is under this license.