liblcf
|
Functions | |
std::string | CodepageToEncoding (int codepage) |
std::string | DetectEncoding (std::istream &filestream) |
std::string | DetectEncoding (const std::string &data) |
std::vector< std::string > | DetectEncodings (std::istream &filestream) |
std::vector< std::string > | DetectEncodings (const std::string &data) |
std::string | GetEncoding (const std::string &ini_file) |
std::string | GetEncoding (std::istream &filestream) |
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) |
std::string | Normalize (const std::string &str) |
template<typename T > | |
T * | GetElement (std::vector< T > &vec, int one_based_index) |
template<typename T > | |
const T * | GetElement (const std::vector< T > &vec, int one_based_index) |
ReaderUtil namespace.
std::string ReaderUtil::CodepageToEncoding | ( | int | codepage | ) |
Returns the encoding name of a windows numeric codepage.
codepage | codepage to lookup. |
Definition at line 50 of file reader_util.cpp.
Referenced by GetEncoding(), GetLocaleEncoding(), Encoder::Init(), and Recode().
std::string ReaderUtil::DetectEncoding | ( | std::istream & | filestream | ) |
Detects the encoding based on text analysis.
filestream | stream containing the database file |
Definition at line 80 of file reader_util.cpp.
References DetectEncodings().
std::string ReaderUtil::DetectEncoding | ( | const std::string & | data | ) |
Detects the encoding based on text analysis.
filestream | stream containing the database file |
Definition at line 90 of file reader_util.cpp.
References Data::data, and DetectEncodings().
std::vector< std::string > ReaderUtil::DetectEncodings | ( | std::istream & | filestream | ) |
Detects the encoding based on text analysis and returns a vector with possible candidates, highest candidate being at the beginning.
filestream | stream containing the database file |
Definition at line 100 of file reader_util.cpp.
References RPG::Terms::accessory, RPG::Terms::agility, RPG::System::airship_name, RPG::Terms::armor, RPG::Terms::attack, RPG::System::battletest_background, RPG::System::boat_name, RPG::Terms::defense, RPG::Terms::exit_game, RPG::Terms::exit_game_message, RPG::Terms::exp_short, RPG::Terms::file, RPG::System::frame_name, RPG::System::gameover_name, RPG::Terms::health_points, RPG::Terms::helmet, RPG::Terms::hp_short, RPG::Terms::level, LDB_Reader::Load(), RPG::Terms::load_game, RPG::Terms::load_game_message, RPG::Terms::lvl_short, RPG::Terms::menu_quit, RPG::Terms::menu_save, RPG::Terms::new_game, RPG::Terms::no, RPG::Terms::normal_status, RPG::Terms::order, RPG::Terms::row, RPG::Terms::save_game_message, RPG::Terms::shield, RPG::System::ship_name, RPG::Terms::sp_cost, RPG::Terms::sp_short, RPG::Terms::spirit, RPG::Terms::spirit_points, RPG::Terms::status, Data::system, RPG::System::system2_name, RPG::System::system_name, Data::terms, RPG::System::title_name, RPG::Terms::wait_off, RPG::Terms::wait_on, RPG::Terms::weapon, and RPG::Terms::yes.
Referenced by DetectEncoding().
std::vector< std::string > ReaderUtil::DetectEncodings | ( | const std::string & | data | ) |
Detects the encoding based on text analysis and returns a vector with possible candidates, highest candidate being at the beginning.
string | encoded data of a few hundred bytes |
Definition at line 158 of file reader_util.cpp.
References Data::data.
T* ReaderUtil::GetElement | ( | std::vector< T > & | vec, |
int | one_based_index | ||
) |
Helper function that returns an element from a vector using a 1-based index as usually used by LCF data structures.
vec | Vector to return element from |
one_based_index | index to access vector at "index - 1" |
Definition at line 131 of file reader_util.h.
const T* ReaderUtil::GetElement | ( | const std::vector< T > & | vec, |
int | one_based_index | ||
) |
Helper function that returns an element from a vector using a 1-based index as usually used by LCF data structures.
vec | Vector to return element from |
one_based_index | index to access vector at "index - 1" |
Definition at line 153 of file reader_util.h.
std::string ReaderUtil::GetEncoding | ( | const std::string & | ini_file | ) |
Returns the encoding set in the ini file.
ini_file | The ini file to parse. |
Definition at line 207 of file reader_util.cpp.
References CodepageToEncoding(), INIReader::Get(), and INIReader::ParseError().
std::string ReaderUtil::GetEncoding | ( | std::istream & | filestream | ) |
Returns the encoding set in the ini file.
filestream | The ini file to parse. |
Definition at line 218 of file reader_util.cpp.
References CodepageToEncoding(), INIReader::Get(), and INIReader::ParseError().
std::string ReaderUtil::GetLocaleEncoding | ( | ) |
Returns the system encoding based on current locale settings.
Definition at line 229 of file reader_util.cpp.
References CodepageToEncoding().
std::string ReaderUtil::Normalize | ( | const std::string & | str | ) |
Converts a UTF-8 string to lowercase and then decomposes it.
str | the string to normalize. |
Definition at line 376 of file reader_util.cpp.
std::string ReaderUtil::Recode | ( | const std::string & | str_to_encode, |
const std::string & | source_encoding | ||
) |
Converts a string to unicode.
str_to_encode | string to encode |
source_encoding | Encoding of str_to_encode |
Definition at line 286 of file reader_util.cpp.
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.
str_to_encode | the string to convert. |
src_enc | the source encoding. |
dst_enc | the destination encoding. |
Definition at line 290 of file reader_util.cpp.
References CodepageToEncoding(), and makeScopeGuard().