Assimp  v3.0 (July 2012)
Public Member Functions | Public Attributes
aiString Struct Reference

Represents an UTF-8 string, zero byte terminated. More...

List of all members.

Public Member Functions

 aiString ()
 Default constructor, the string is set to have zero length.
 aiString (const aiString &rOther)
 Copy constructor.
 aiString (const std::string &pString)
 Constructor from std::string.
void Append (const char *app)
 Append a string to the string.
const char * C_Str () const
 Returns a pointer to the underlying zero-terminated array of characters.
void Clear ()
 Clear the string - reset its length to zero.
bool operator!= (const aiString &other) const
 Inverse comparison operator.
aiStringoperator= (const char *sz)
 Assign a const char* to the string.
aiStringoperator= (const std::string &pString)
 Assign a cstd::string to the string.
bool operator== (const aiString &other) const
 Comparison operator.
void Set (const std::string &pString)
 Copy a std::string to the aiString.
void Set (const char *sz)
 Copy a const char* to the aiString.

Public Attributes

char data [MAXLEN]
 String buffer.
size_t length
 Binary length of the string excluding the terminal 0.

Detailed Description

Represents an UTF-8 string, zero byte terminated.

The character set of an aiString is explicitly defined to be UTF-8. This Unicode transformation was chosen in the belief that most strings in 3d files are limited to ASCII, thus the character set needed to be strictly ASCII compatible.

Most text file loaders provide proper Unicode input file handling, special unicode characters are correctly transcoded to UTF8 and are kept throughout the libraries' import pipeline.

For most applications, it will be absolutely sufficient to interpret the aiString as ASCII data and work with it as one would work with a plain char*. Windows users in need of proper support for i.e asian characters can use the #MultiByteToWideChar(), #WideCharToMultiByte() WinAPI functionality to convert the UTF-8 strings to their working character set (i.e. MBCS, WideChar).

We use this representation instead of std::string to be C-compatible. The (binary) length of such a string is limited to MAXLEN characters (including the the terminating zero).


Constructor & Destructor Documentation

aiString::aiString ( )
inline

Default constructor, the string is set to have zero length.

aiString::aiString ( const aiString rOther)
inline

Copy constructor.

aiString::aiString ( const std::string &  pString)
inlineexplicit

Constructor from std::string.


Member Function Documentation

void aiString::Append ( const char *  app)
inline

Append a string to the string.

const char* aiString::C_Str ( ) const
inline

Returns a pointer to the underlying zero-terminated array of characters.

void aiString::Clear ( )
inline

Clear the string - reset its length to zero.

bool aiString::operator!= ( const aiString other) const
inline

Inverse comparison operator.

aiString& aiString::operator= ( const char *  sz)
inline

Assign a const char* to the string.

aiString& aiString::operator= ( const std::string &  pString)
inline

Assign a cstd::string to the string.

bool aiString::operator== ( const aiString other) const
inline

Comparison operator.

void aiString::Set ( const std::string &  pString)
inline

Copy a std::string to the aiString.

void aiString::Set ( const char *  sz)
inline

Copy a const char* to the aiString.


Member Data Documentation

char aiString::data[MAXLEN]

String buffer.

Size limit is MAXLEN

size_t aiString::length

Binary length of the string excluding the terminal 0.

This is NOT the logical length of strings containing UTF-8 multibyte sequences! It's the number of bytes from the beginning of the string to its end.


The documentation for this struct was generated from the following file: