adchpp::Util Class Reference

#include <Util.h>

Collaboration diagram for adchpp::Util:
Collaboration graph
[legend]

List of all members.

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

Detailed Description

Definition at line 87 of file Util.h.


Member Enumeration Documentation

Enumerator:
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 

Definition at line 90 of file Util.h.


Member Function Documentation

void adchpp::Util::decodeUrl ( const std::string &  aUrl,
std::string &  aServer,
short &  aPort,
std::string &  aFile 
) [static]

Decodes a URL the best it can.

.. Default ports: http:// -> port 80 dchub:// -> port 411

Definition at line 76 of file Util.cpp.

References toInt().

Here is the call graph for this function:

string adchpp::Util::formatBytes ( int64_t  aBytes  )  [static]

Definition at line 190 of file Util.cpp.

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().

Here is the call graph for this function:

Here is the caller graph for this function:

static std::string adchpp::Util::formatSeconds ( int64_t  aSec  )  [inline, static]

Definition at line 151 of file Util.h.

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().

Here is the caller graph for this function:

string adchpp::Util::getAppName (  )  [static]

Definition at line 150 of file Util.cpp.

References appName.

string adchpp::Util::getAppPath (  )  [static]

Definition at line 147 of file Util.cpp.

References appPath.

Referenced by adchpp::File::makeAbsolutePath().

Here is the caller graph for this function:

static const std::string& adchpp::Util::getCfgPath (  )  [inline, static]

Definition at line 127 of file Util.h.

References cfgPath.

Referenced by adchpp::LogManager::dolog().

Here is the caller graph for this function:

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().

Here is the call graph for this function:

string adchpp::Util::getShortTimeString (  )  [static]

Definition at line 207 of file Util.cpp.

string adchpp::Util::getTimeString (  )  [static]

Definition at line 216 of file Util.cpp.

void adchpp::Util::initialize ( const std::string &  configPath  )  [static]

Definition at line 63 of file Util.cpp.

References setCfgPath(), and adchpp::sgenrand().

Here is the call graph for this function:

bool adchpp::Util::isPrivateIp ( std::string const &  ip  )  [static]

Definition at line 406 of file Util.cpp.

Referenced by adchpp::ClientManager::verifyIp().

Here is the caller graph for this function:

static uint32_t adchpp::Util::rand ( uint32_t  low,
uint32_t  high 
) [inline, static]

Definition at line 243 of file Util.h.

References rand().

Referenced by rand().

Here is the call graph for this function:

Here is the caller graph for this function:

static uint32_t adchpp::Util::rand ( uint32_t  high  )  [inline, static]

Definition at line 242 of file Util.h.

References rand().

Referenced by rand().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

static double adchpp::Util::randd (  )  [inline, static]

Definition at line 244 of file Util.h.

References rand().

Here is the call graph for this function:

void adchpp::Util::setApp ( const std::string &  app  )  [static]

Definition at line 140 of file Util.cpp.

References appName, and appPath.

static void adchpp::Util::setCfgPath ( const std::string &  path  )  [inline, static]

Definition at line 128 of file Util.h.

References cfgPath.

Referenced by initialize().

Here is the caller graph for this function:

static bool adchpp::Util::toBool ( const char *  aString  )  [inline, static]

Definition at line 163 of file Util.h.

References toInt().

Here is the call graph for this function:

static bool adchpp::Util::toBool ( const std::string &  aString  )  [inline, static]

Definition at line 157 of file Util.h.

References toBool().

Referenced by toBool().

Here is the call graph for this function:

Here is the caller graph for this function:

static double adchpp::Util::toDouble ( const char *  aString  )  [inline, static]

Definition at line 165 of file Util.h.

static double adchpp::Util::toDouble ( const std::string &  aString  )  [inline, static]

Definition at line 159 of file Util.h.

References toDouble().

Referenced by toDouble().

Here is the call graph for this function:

Here is the caller graph for this function:

static float adchpp::Util::toFloat ( const char *  aString  )  [inline, static]

Definition at line 166 of file Util.h.

static float adchpp::Util::toFloat ( const std::string &  aString  )  [inline, static]

Definition at line 160 of file Util.h.

References toFloat().

Referenced by toFloat().

Here is the call graph for this function:

Here is the caller graph for this function:

static int adchpp::Util::toInt ( const char *  aString  )  [inline, static]

Definition at line 164 of file Util.h.

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().

Here is the call graph for this function:

Here is the caller graph for this function:

static int64_t adchpp::Util::toInt64 ( const char *  aString  )  [inline, static]

Definition at line 167 of file Util.h.

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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()().

Here is the caller graph for this function:

static const std::string& adchpp::Util::toString ( const std::string &  aString  )  [inline, static]

Definition at line 234 of file Util.h.

static std::string adchpp::Util::toString ( double  val,
int  maxDec = 2 
) [inline, static]

Definition at line 228 of file Util.h.

static std::string adchpp::Util::toString ( unsigned long long  val  )  [inline, static]

Definition at line 218 of file Util.h.

static std::string adchpp::Util::toString ( long long  val  )  [inline, static]

Definition at line 209 of file Util.h.

static std::string adchpp::Util::toString ( unsigned long  val  )  [inline, static]

Definition at line 204 of file Util.h.

static std::string adchpp::Util::toString ( long  val  )  [inline, static]

Definition at line 199 of file Util.h.

static std::string adchpp::Util::toString ( unsigned int  val  )  [inline, static]

Definition at line 194 of file Util.h.

static std::string adchpp::Util::toString ( int  val  )  [inline, static]

Definition at line 189 of file Util.h.

static std::string adchpp::Util::toString ( unsigned short  val  )  [inline, static]

Definition at line 184 of file Util.h.

static std::string adchpp::Util::toString ( short  val  )  [inline, static]

Definition at line 179 of file Util.h.

static std::string adchpp::Util::toString ( bool  val  )  [inline, static]
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().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:


Member Data Documentation

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]
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().

Generated on Sat Nov 27 23:39:00 2010 for adchpp by  doxygen 1.6.3