#include <Util.h>
Public Types | |
enum | Reason { REASON_BAD_STATE, REASON_CID_CHANGE, REASON_CID_TAKEN, REASON_FLOODING, REASON_HUB_FULL, REASON_INVALID_COMMAND_TYPE, REASON_INVALID_IP, REASON_INVALID_SID, REASON_LOGIN_TIMEOUT, REASON_MAX_COMMAND_SIZE, REASON_NICK_INVALID, REASON_NICK_TAKEN, REASON_NO_BASE_SUPPORT, REASON_NO_TIGR_SUPPORT, REASON_PID_MISSING, REASON_PID_CID_LENGTH, REASON_PID_CID_MISMATCH, REASON_PID_WITHOUT_CID, REASON_PLUGIN, REASON_WRITE_OVERFLOW, REASON_NO_BANDWIDTH, REASON_INVALID_DESCRIPTION, REASON_WRITE_TIMEOUT, REASON_LAST } |
Static Public Member Functions | |
static ADCHPP_DLL void | decodeUrl (const std::string &aUrl, std::string &aServer, short &aPort, std::string &aFile) |
Decodes a URL the best it can. | |
static ADCHPP_DLL std::string | formatBytes (int64_t aBytes) |
static std::string | formatBytes (const std::string &aString) |
static std::string | formatSeconds (int64_t aSec) |
static ADCHPP_DLL std::string | formatTime (const std::string &msg, time_t t=time(NULL)) |
static ADCHPP_DLL std::string | getAppName () |
static ADCHPP_DLL std::string | getAppPath () |
static const std::string & | getCfgPath () |
static ADCHPP_DLL std::string | getLocalIp () |
Avoid this! Use the one of a connected socket instead. | |
static ADCHPP_DLL std::string | getOsVersion () |
static ADCHPP_DLL std::string | getShortTimeString () |
static ADCHPP_DLL std::string | getTimeString () |
static ADCHPP_DLL void | initialize (const std::string &configPath) |
static ADCHPP_DLL bool | isPrivateIp (std::string const &ip) |
static uint32_t | rand (uint32_t low, uint32_t high) |
static uint32_t | rand (uint32_t high) |
static ADCHPP_DLL uint32_t | rand () |
static double | randd () |
static ADCHPP_DLL void | setApp (const std::string &app) |
static void | setCfgPath (const std::string &path) |
static bool | toBool (const char *aString) |
static bool | toBool (const std::string &aString) |
static double | toDouble (const char *aString) |
static double | toDouble (const std::string &aString) |
static float | toFloat (const char *aString) |
static float | toFloat (const std::string &aString) |
static int | toInt (const char *aString) |
static int | toInt (const std::string &aString) |
static int64_t | toInt64 (const char *aString) |
static int64_t | toInt64 (const std::string &aString) |
static ADCHPP_DLL void | tokenize (StringList &lst, const std::string &str, char sep, std::string::size_type j=0) |
static const std::string & | toString (const std::string &aString) |
static std::string | toString (double val, int maxDec=2) |
static std::string | toString (unsigned long long val) |
static std::string | toString (long long val) |
static std::string | toString (unsigned long val) |
static std::string | toString (long val) |
static std::string | toString (unsigned int val) |
static std::string | toString (int val) |
static std::string | toString (unsigned short val) |
static std::string | toString (short val) |
static std::string | toString (bool val) |
static ADCHPP_DLL std::string | translateError (int aError) |
static ADCHPP_DLL bool | validateCharset (std::string const &field, int p) |
Static Public Attributes | |
static std::string | appName |
static std::string | appPath |
static ADCHPP_DLL std::string | emptyString |
static std::wstring | emptyStringW |
static ADCHPP_DLL size_t | reasons [REASON_LAST] |
Static Private Attributes | |
static ADCHPP_DLL std::string | cfgPath |
Definition at line 87 of file Util.h.
enum adchpp::Util::Reason |
void adchpp::Util::decodeUrl | ( | const std::string & | aUrl, | |
std::string & | aServer, | |||
short & | aPort, | |||
std::string & | aFile | |||
) | [static] |
string adchpp::Util::formatBytes | ( | int64_t | aBytes | ) | [static] |
static std::string adchpp::Util::formatBytes | ( | const std::string & | aString | ) | [inline, static] |
Definition at line 142 of file Util.h.
References formatBytes(), and toInt64().
Referenced by formatBytes().
static std::string adchpp::Util::formatSeconds | ( | int64_t | aSec | ) | [inline, static] |
string adchpp::Util::formatTime | ( | const std::string & | msg, | |
time_t | t = time(NULL) | |||
) | [static] |
Definition at line 229 of file Util.cpp.
Referenced by adchpp::LogManager::dolog().
string adchpp::Util::getAppName | ( | ) | [static] |
string adchpp::Util::getAppPath | ( | ) | [static] |
Definition at line 147 of file Util.cpp.
References appPath.
Referenced by adchpp::File::makeAbsolutePath().
static const std::string& adchpp::Util::getCfgPath | ( | ) | [inline, static] |
Definition at line 127 of file Util.h.
References cfgPath.
Referenced by adchpp::LogManager::dolog().
string adchpp::Util::getLocalIp | ( | ) | [static] |
Avoid this! Use the one of a connected socket instead.
..
Definition at line 155 of file Util.cpp.
References emptyString.
string adchpp::Util::getOsVersion | ( | ) | [static] |
Definition at line 278 of file Util.cpp.
References toString().
void adchpp::Util::initialize | ( | const std::string & | configPath | ) | [static] |
Definition at line 63 of file Util.cpp.
References setCfgPath(), and adchpp::sgenrand().
bool adchpp::Util::isPrivateIp | ( | std::string const & | ip | ) | [static] |
Definition at line 406 of file Util.cpp.
Referenced by adchpp::ClientManager::verifyIp().
static uint32_t adchpp::Util::rand | ( | uint32_t | low, | |
uint32_t | high | |||
) | [inline, static] |
static uint32_t adchpp::Util::rand | ( | uint32_t | high | ) | [inline, static] |
uint32_t adchpp::Util::rand | ( | ) | [static] |
Definition at line 372 of file Util.cpp.
References LOWER_MASK, M, MATRIX_A, adchpp::mt, adchpp::mti, N, adchpp::sgenrand(), TEMPERING_MASK_B, TEMPERING_MASK_C, TEMPERING_SHIFT_L, TEMPERING_SHIFT_S, TEMPERING_SHIFT_T, TEMPERING_SHIFT_U, and UPPER_MASK.
Referenced by adchpp::ClientManager::enterVerify(), adchpp::CID::generate(), adchpp::ClientManager::makeSID(), and randd().
static double adchpp::Util::randd | ( | ) | [inline, static] |
void adchpp::Util::setApp | ( | const std::string & | app | ) | [static] |
static void adchpp::Util::setCfgPath | ( | const std::string & | path | ) | [inline, static] |
Definition at line 128 of file Util.h.
References cfgPath.
Referenced by initialize().
static bool adchpp::Util::toBool | ( | const char * | aString | ) | [inline, static] |
static bool adchpp::Util::toBool | ( | const std::string & | aString | ) | [inline, static] |
static double adchpp::Util::toDouble | ( | const char * | aString | ) | [inline, static] |
static double adchpp::Util::toDouble | ( | const std::string & | aString | ) | [inline, static] |
Definition at line 159 of file Util.h.
References toDouble().
Referenced by toDouble().
static float adchpp::Util::toFloat | ( | const char * | aString | ) | [inline, static] |
static float adchpp::Util::toFloat | ( | const std::string & | aString | ) | [inline, static] |
static int adchpp::Util::toInt | ( | const char * | aString | ) | [inline, static] |
static int adchpp::Util::toInt | ( | const std::string & | aString | ) | [inline, static] |
Definition at line 158 of file Util.h.
References toInt().
Referenced by decodeUrl(), adchpp::SimpleXML::getIntChildAttrib(), toBool(), and toInt().
static int64_t adchpp::Util::toInt64 | ( | const char * | aString | ) | [inline, static] |
static int64_t adchpp::Util::toInt64 | ( | const std::string & | aString | ) | [inline, static] |
Definition at line 161 of file Util.h.
References toInt64().
Referenced by formatBytes(), adchpp::SimpleXML::getLongLongChildAttrib(), and toInt64().
static ADCHPP_DLL void adchpp::Util::tokenize | ( | StringList & | lst, | |
const std::string & | str, | |||
char | sep, | |||
std::string::size_type | j = 0 | |||
) | [static] |
Referenced by adchpp::PluginManager::CommandDispatch::operator()().
static const std::string& adchpp::Util::toString | ( | const std::string & | aString | ) | [inline, static] |
static std::string adchpp::Util::toString | ( | double | val, | |
int | maxDec = 2 | |||
) | [inline, static] |
static std::string adchpp::Util::toString | ( | unsigned long long | val | ) | [inline, static] |
static std::string adchpp::Util::toString | ( | long long | val | ) | [inline, static] |
static std::string adchpp::Util::toString | ( | unsigned long | val | ) | [inline, static] |
static std::string adchpp::Util::toString | ( | long | val | ) | [inline, static] |
static std::string adchpp::Util::toString | ( | unsigned int | val | ) | [inline, static] |
static std::string adchpp::Util::toString | ( | int | val | ) | [inline, static] |
static std::string adchpp::Util::toString | ( | unsigned short | val | ) | [inline, static] |
static std::string adchpp::Util::toString | ( | short | val | ) | [inline, static] |
static std::string adchpp::Util::toString | ( | bool | val | ) | [inline, static] |
Definition at line 175 of file Util.h.
Referenced by adchpp::AdcCommand::AdcCommand(), adchpp::SimpleXML::addAttrib(), adchpp::SimpleXML::addChildAttrib(), adchpp::SimpleXML::addTag(), getOsVersion(), adchpp::PluginManager::loadPlugin(), adchpp::SocketManager::run(), adchpp::Entity::setFlag(), and adchpp::Entity::unsetFlag().
string adchpp::Util::translateError | ( | int | aError | ) | [static] |
Definition at line 245 of file Util.cpp.
Referenced by adchpp::File::read(), adchpp::Thread::start(), and adchpp::File::write().
bool adchpp::Util::validateCharset | ( | std::string const & | field, | |
int | p | |||
) | [static] |
Definition at line 420 of file Util.cpp.
Referenced by adchpp::ClientManager::verifyINF(), and adchpp::ClientManager::verifyNick().
string adchpp::Util::appName [static] |
Definition at line 136 of file Util.h.
Referenced by getAppName(), and setApp().
string adchpp::Util::appPath [static] |
Definition at line 135 of file Util.h.
Referenced by getAppPath(), and setApp().
string adchpp::Util::cfgPath [static, private] |
Definition at line 249 of file Util.h.
Referenced by getCfgPath(), and setCfgPath().
string adchpp::Util::emptyString [static] |
Definition at line 119 of file Util.h.
Referenced by adchpp::SimpleXML::fromXML(), adchpp::Entity::getField(), getLocalIp(), adchpp::AdcCommand::getParam(), adchpp::SimpleXML::SimpleXML(), adchpp::SimpleXML::toXML(), adchpp::Text::wideToAcp(), and adchpp::Text::wideToUtf8().
wstring adchpp::Util::emptyStringW [static] |
Definition at line 120 of file Util.h.
Referenced by adchpp::Text::acpToWide().
size_t adchpp::Util::reasons [static] |
Definition at line 117 of file Util.h.
Referenced by adchpp::ManagedSocket::disconnect().