liblcf
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ReaderUtil Namespace Reference

Functions

std::string CodepageToEncoding (int codepage)
 
std::string DetectEncoding (const std::string &database_file)
 
std::string GetEncoding (const std::string &ini_file)
 
std::string GetLocaleEncoding ()
 
std::string Recode (const std::string &str_to_encode, const std::string &source_encoding)
 
std::string Recode (const std::string &str_to_encode, const std::string &src_enc, const std::string &dst_enc)
 

Detailed Description

ReaderUtil namespace.

Function Documentation

std::string ReaderUtil::CodepageToEncoding ( int  codepage)

Returns the encoding name of a windows numeric codepage.

Parameters
codepagecodepage to lookup.
Returns
name used by the converter or empty string if not found.

Definition at line 43 of file reader_util.cpp.

Referenced by GetEncoding(), GetLocaleEncoding(), and Recode().

+ Here is the caller graph for this function:

std::string ReaderUtil::GetEncoding ( const std::string &  ini_file)

Returns the encoding set in the ini file.

Parameters
ini_fileThe ini file to parse.
Returns
encoding or empty string if not found.

Definition at line 172 of file reader_util.cpp.

References CodepageToEncoding(), INIReader::Get(), and INIReader::ParseError().

+ Here is the call graph for this function:

std::string ReaderUtil::GetLocaleEncoding ( )

Returns the system encoding based on current locale settings.

Returns
system encoding or western if no locale found.

Definition at line 183 of file reader_util.cpp.

References CodepageToEncoding().

+ Here is the call graph for this function:

std::string ReaderUtil::Recode ( const std::string &  str_to_encode,
const std::string &  source_encoding 
)

Converts a string to unicode.

Parameters
str_to_encodestring to encode
source_encodingEncoding of str_to_encode
Returns
the recoded string.

Definition at line 236 of file reader_util.cpp.

Referenced by LcfWriter::Decode(), and LcfReader::Encode().

+ Here is the caller graph for this function:

std::string ReaderUtil::Recode ( const std::string &  str_to_encode,
const std::string &  src_enc,
const std::string &  dst_enc 
)

Converts a string between encodings.

Parameters
str_to_encodethe string to convert.
src_encthe source encoding.
dst_encthe destination encoding.
Returns
the recoded string.

Definition at line 240 of file reader_util.cpp.

References CodepageToEncoding().

+ Here is the call graph for this function: