xoreos  0.0.5
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Common::ConversionManager Class Reference

A manager handling string encoding conversions. More...

Inheritance diagram for Common::ConversionManager:
Inheritance graph
[legend]
Collaboration diagram for Common::ConversionManager:
Collaboration graph
[legend]

Public Member Functions

 ConversionManager ()
 
 ~ConversionManager ()
 
bool hasSupportTranscode (Encoding from, Encoding to)
 
UString convert (Encoding encoding, byte *data, size_t n)
 
MemoryReadStreamconvert (Encoding encoding, const UString &str, bool terminate=true)
 

Private Member Functions

bytedoConvert (iconv_t &ctx, byte *data, size_t nIn, size_t nOut, size_t &size)
 
UString convert (iconv_t &ctx, byte *data, size_t n, size_t growth, size_t termSize)
 
MemoryReadStreamconvert (iconv_t &ctx, const UString &str, size_t growth, size_t termSize)
 

Private Attributes

iconv_t _contextFrom [kEncodingMAX]
 
iconv_t _contextTo [kEncodingMAX]
 

Additional Inherited Members

- Static Public Member Functions inherited from Common::Singleton< ConversionManager >
static ConversionManagerinstance ()
 
static void destroy ()
 
- Protected Types inherited from Common::Singleton< ConversionManager >
typedef ConversionManager SingletonBaseType
 
- Protected Member Functions inherited from Common::Singleton< ConversionManager >
 Singleton ()
 
virtual ~Singleton ()
 

Detailed Description

A manager handling string encoding conversions.

Definition at line 60 of file encoding.cpp.

Constructor & Destructor Documentation

◆ ConversionManager()

Common::ConversionManager::ConversionManager ( )
inline

Definition at line 62 of file encoding.cpp.

References _contextFrom, _contextTo, Common::kEncodingMAX, Common::kEncodingName, and warning().

Here is the call graph for this function:

◆ ~ConversionManager()

Common::ConversionManager::~ConversionManager ( )
inline

Definition at line 77 of file encoding.cpp.

References _contextFrom, _contextTo, and Common::kEncodingMAX.

Member Function Documentation

◆ convert() [1/4]

UString Common::ConversionManager::convert ( Encoding  encoding,
byte data,
size_t  n 
)
inline

Definition at line 100 of file encoding.cpp.

References _contextFrom, Common::kEncodingGrowthFrom, and Common::kEncodingMAX.

Referenced by convert().

Here is the caller graph for this function:

◆ convert() [2/4]

MemoryReadStream* Common::ConversionManager::convert ( Encoding  encoding,
const UString str,
bool  terminate = true 
)
inline

Definition at line 107 of file encoding.cpp.

References _contextTo, convert(), Common::kEncodingGrowthTo, Common::kEncodingMAX, and Common::kTerminatorLength.

Here is the call graph for this function:

◆ convert() [3/4]

UString Common::ConversionManager::convert ( iconv_t &  ctx,
byte data,
size_t  n,
size_t  growth,
size_t  termSize 
)
inlineprivate

Definition at line 143 of file encoding.cpp.

References doConvert(), and Common::ScopedPtrBase< T, Deallocator >::get().

Here is the call graph for this function:

◆ convert() [4/4]

MemoryReadStream* Common::ConversionManager::convert ( iconv_t &  ctx,
const UString str,
size_t  growth,
size_t  termSize 
)
inlineprivate

Definition at line 158 of file encoding.cpp.

References Common::UString::c_str(), doConvert(), and Common::ScopedPtrBase< T, Deallocator >::release().

Here is the call graph for this function:

◆ doConvert()

byte* Common::ConversionManager::doConvert ( iconv_t &  ctx,
byte data,
size_t  nIn,
size_t  nOut,
size_t &  size 
)
inlineprivate

Definition at line 119 of file encoding.cpp.

References Common::ScopedPtrBase< T, Deallocator >::get(), Common::ScopedPtrBase< T, Deallocator >::release(), and warning().

Referenced by convert().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasSupportTranscode()

bool Common::ConversionManager::hasSupportTranscode ( Encoding  from,
Encoding  to 
)
inline

Definition at line 86 of file encoding.cpp.

References _contextFrom, _contextTo, Common::kEncodingMAX, and Common::kEncodingUTF8.

Member Data Documentation

◆ _contextFrom

iconv_t Common::ConversionManager::_contextFrom[kEncodingMAX]
private

Definition at line 116 of file encoding.cpp.

Referenced by ConversionManager(), convert(), hasSupportTranscode(), and ~ConversionManager().

◆ _contextTo

iconv_t Common::ConversionManager::_contextTo[kEncodingMAX]
private

Definition at line 117 of file encoding.cpp.

Referenced by ConversionManager(), convert(), hasSupportTranscode(), and ~ConversionManager().


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