conversions.cpp File Reference

#include <cstdlib>
#include <cerrno>
#include <sstream>
#include "conversions.h"
#include "log.h"

Include dependency graph for conversions.cpp:

Go to the source code of this file.

Functions

string itos (int i)
string iptos (unsigned long ip)
bool try_get_long (const string &value, long &i)
bool try_get_double (const string &value, double &d)
bool try_get_bool (const string &value, bool &b)
double get_double (const string &value)
long get_long (const string &value)
bool get_bool (const string &value)
void utf8tows (const char *utf8, std::wstring &ws)
 Convert UTF-8 string to wchar_t string.
void appendW (long w, std::string &utf8)
 Convert one unicode character to UTF-8.
void wstoutf8 (const std::wstring &ws, std::string &utf8)
 Convert wchar_t strinf to UTF-8 string.


Function Documentation

void appendW long  w,
std::string &  utf8
 

Convert one unicode character to UTF-8.

Parameters:
w Isn't wchar_t directly since wchar_t may be in some encoding like UTF-16 not UTF-32
utf8 Output string coding w in utf8

Definition at line 240 of file conversions.cpp.

References LOGE.

Referenced by wstoutf8().

bool get_bool const string &  value  ) 
 

Definition at line 119 of file conversions.cpp.

References Log::die(), Log::error(), g_log, and try_get_bool().

Referenced by Settings::isTrue().

Here is the call graph for this function:

double get_double const string &  value  ) 
 

Definition at line 93 of file conversions.cpp.

References Log::die(), Log::error(), g_log, and try_get_double().

Referenced by Settings::getDouble().

Here is the call graph for this function:

long get_long const string &  value  ) 
 

Definition at line 106 of file conversions.cpp.

References Log::die(), Log::error(), g_log, and try_get_long().

Referenced by Settings::getInt().

Here is the call graph for this function:

string iptos unsigned long  ip  ) 
 

convert int with IP address to string ip is in network byte order

Definition at line 20 of file conversions.cpp.

string itos int  i  ) 
 

convert integer to string

Definition at line 12 of file conversions.cpp.

bool try_get_bool const string &  value,
bool &  b
 

Definition at line 76 of file conversions.cpp.

Referenced by get_bool().

bool try_get_double const string &  value,
double &  d
 

Definition at line 57 of file conversions.cpp.

References g_log, and Log::perror().

Referenced by get_double().

Here is the call graph for this function:

bool try_get_long const string &  value,
long &  i
 

Definition at line 38 of file conversions.cpp.

References g_log, and Log::perror().

Referenced by get_long().

Here is the call graph for this function:

void utf8tows const char *  utf8,
std::wstring &  ws
 

Convert UTF-8 string to wchar_t string.

Parameters:
utf8 input string encoded in utf-8
ws output string

Definition at line 140 of file conversions.cpp.

References LOGE.

Referenced by Console::addConsoleMessage(), Translator::loadFile(), FontFTGL::RenderUTF8(), and Translator::translateW().

void wstoutf8 const std::wstring &  ws,
std::string &  utf8
 

Convert wchar_t strinf to UTF-8 string.

Parameters:
ws input string containing wchar_t string
utf8 output string encoded in UTF-8

Definition at line 281 of file conversions.cpp.

References appendW().

Referenced by Console::addConsoleMessage(), and InputString::updateCachedStrings().

Here is the call graph for this function:


Generated on Wed Apr 12 13:57:16 2006 for bjs by  doxygen 1.4.5