StringConverter Class Reference

#include <string_converter.h>

Inheritance diagram for StringConverter:
zmm::Object

Public Member Functions

 StringConverter (zmm::String from, zmm::String to)
virtual ~StringConverter ()
zmm::String convert (zmm::String str, bool validate=false)
 Converts uses the from and to values that were passed to the constructor to convert the string str to a specific character set.
bool validate (zmm::String str)
void retain ()
void release ()
int getRefCount ()

Static Public Member Functions

static zmm::Ref< StringConverteri2f ()
 internal (UTF-8) to filesystem
static zmm::Ref< StringConverterf2i ()
 filesystem to internal
static zmm::Ref< StringConverterm2i ()
 metadata to internal
static void * operator new (size_t size)
static void operator delete (void *ptr)

Protected Member Functions

zmm::String _convert (zmm::String str, bool validate, size_t *stoppedAt=NULL)

Protected Attributes

iconv_t cd
bool dirty
mt_atomic_t _ref_count
pthread_mutex_t mutex

Detailed Description

Definition at line 38 of file string_converter.h.


Constructor & Destructor Documentation

StringConverter::StringConverter ( zmm::String  from,
zmm::String  to 
)

Definition at line 41 of file string_converter.cc.

References _, _Exception, zmm::String::c_str(), cd, and dirty.

Referenced by f2i(), i2f(), and m2i().

StringConverter::~StringConverter (  )  [virtual]

Definition at line 53 of file string_converter.cc.

References cd.


Member Function Documentation

zmm::String StringConverter::_convert ( zmm::String  str,
bool  validate,
size_t *  stoppedAt = NULL 
) [protected]

Todo:
should encode the whole string anyway

Definition at line 98 of file string_converter.cc.

References _, _Exception, zmm::String::c_str(), cd, dirty, FREE, zmm::String::length(), log_debug, log_error, MALLOC, and NULL.

Referenced by convert(), and validate().

zmm::String StringConverter::convert ( zmm::String  str,
bool  validate = false 
)

Converts uses the from and to values that were passed to the constructor to convert the string str to a specific character set.

Parameters:
str String to be converted.
validate if this parameter is true then an exception will be thrown if illegal input is encountered. If false, illegal characters will be padded with '?' and the function will return the string.

Definition at line 59 of file string_converter.cc.

References _convert(), zmm::String::length(), string_ok(), and zmm::String::substring().

Ref< StringConverter > StringConverter::f2i (  )  [static]
int Object::getRefCount (  )  [inherited]

Definition at line 78 of file object.cc.

References zmm::Object::_ref_count, and atomic_get().

Ref< StringConverter > StringConverter::i2f (  )  [static]

internal (UTF-8) to filesystem

Todo:
iconv caching

Definition at line 194 of file string_converter.cc.

References _, CFG_IMPORT_FILESYSTEM_CHARSET, DEFAULT_INTERNAL_CHARSET, Singleton< ConfigManager >::getInstance(), and StringConverter().

Ref< StringConverter > StringConverter::m2i (  )  [static]
void Object::operator delete ( void *  ptr  )  [static, inherited]

Definition at line 87 of file object.cc.

References FREE.

void * Object::operator new ( size_t  size  )  [static, inherited]

Definition at line 83 of file object.cc.

References MALLOC.

void Object::release (  )  [inherited]
void Object::retain (  )  [inherited]
bool StringConverter::validate ( zmm::String  str  ) 

Definition at line 85 of file string_converter.cc.

References _convert().


Field Documentation

mt_atomic_t zmm::Object::_ref_count [protected, inherited]
iconv_t StringConverter::cd [protected]

Definition at line 77 of file string_converter.h.

Referenced by _convert(), StringConverter(), and ~StringConverter().

bool StringConverter::dirty [protected]

Definition at line 78 of file string_converter.h.

Referenced by _convert(), and StringConverter().

pthread_mutex_t zmm::Object::mutex [protected, inherited]

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

Generated on Fri Mar 26 20:16:57 2010 for MediaTomb by  doxygen 1.6.1