OpenMW
Public Member Functions | Private Member Functions | Private Attributes
ToUTF8::Utf8Encoder Class Reference

#include <to_utf8.hpp>

List of all members.

Public Member Functions

 Utf8Encoder (FromType sourceEncoding)
std::string getUtf8 (const char *input, size_t size)
std::string getUtf8 (const std::string &str)
std::string getLegacyEnc (const char *input, size_t size)
std::string getLegacyEnc (const std::string &str)

Private Member Functions

void resize (size_t size)
size_t getLength (const char *input, bool &ascii)
void copyFromArray (unsigned char chp, char *&out)
size_t getLength2 (const char *input, bool &ascii)
void copyFromArray2 (const char *&chp, char *&out)

Private Attributes

std::vector< char > mOutput
signed char * translationArray

Constructor & Destructor Documentation

Utf8Encoder::Utf8Encoder ( FromType  sourceEncoding)

Member Function Documentation

void Utf8Encoder::copyFromArray ( unsigned char  chp,
char *&  out 
) [private]
void Utf8Encoder::copyFromArray2 ( const char *&  chp,
char *&  out 
) [private]
std::string Utf8Encoder::getLegacyEnc ( const char *  input,
size_t  size 
)
std::string ToUTF8::Utf8Encoder::getLegacyEnc ( const std::string &  str) [inline]
size_t Utf8Encoder::getLength ( const char *  input,
bool &  ascii 
) [private]

Get the total length length needed to decode the given string with the given translation array. The arrays are encoded with 6 bytes per character, with the first giving the length and the next 5 the actual data.

The function serves a dual purpose for optimization reasons: it checks if the input is pure ascii (all values are <= 127). If this is the case, then the ascii parameter is set to true, and the caller can optimize for this case.

size_t Utf8Encoder::getLength2 ( const char *  input,
bool &  ascii 
) [private]
std::string Utf8Encoder::getUtf8 ( const char *  input,
size_t  size 
)
std::string ToUTF8::Utf8Encoder::getUtf8 ( const std::string &  str) [inline]
void Utf8Encoder::resize ( size_t  size) [private]

Member Data Documentation

std::vector<char> ToUTF8::Utf8Encoder::mOutput [private]
signed char* ToUTF8::Utf8Encoder::translationArray [private]

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