SNAP Library , Developer Reference
2013-01-07 14:03:36
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
#include <dt.h>
Public Member Functions | |
TUInt () | |
TUInt (const uint &_Val) | |
operator uint () const | |
TUInt (TSIn &SIn) | |
void | Load (TSIn &SIn) |
void | Save (TSOut &SOut) const |
void | LoadXml (const PXmlTok &XmlTok, const TStr &Nm) |
void | SaveXml (TSOut &SOut, const TStr &Nm) const |
TUInt & | operator= (const TUInt &UInt) |
TUInt & | operator= (const uint &_Val) |
TUInt | operator++ (int) |
TUInt | operator-- (int) |
uint | operator() () const |
uint & | operator() () |
TUInt & | operator~ () |
TUInt & | operator&= (const TUInt &UInt) |
TUInt & | operator|= (const TUInt &UInt) |
TUInt & | operator^= (const TUInt &UInt) |
TUInt & | operator>>= (const int &ShiftBits) |
TUInt & | operator<<= (const int &ShiftBits) |
int | GetMemUsed () const |
int | GetPrimHashCd () const |
int | GetSecHashCd () const |
TStr | GetStr () const |
Static Public Member Functions | |
static uint | GetRnd (const uint &Range=0) |
static TStr | GetStr (const uint &Val) |
static TStr | GetStr (const TInt &UInt) |
static TStr | GetStr (const uint &Val, const char *FmtStr) |
static TStr | GetStr (const uint &Val, const TStr &FmtStr) |
static TStr | GetKiloStr (const uint &Val) |
static TStr | GetMegaStr (const uint &Val) |
static uint | JavaUIntToCppUInt (const uint &JavaUInt) |
static bool | IsIpStr (const TStr &IpStr, uint &Ip, const char &SplitCh= '.') |
static bool | IsIpStr (const TStr &IpStr, const char &SplitCh= '.') |
static uint | GetUIntFromIpStr (const TStr &IpStr, const char &SplitCh= '.') |
static TStr | GetStrFromIpUInt (const uint &Ip) |
Public Attributes | |
uint | Val |
Static Public Attributes | |
static const uint | Mn = 0 |
static const uint | Mx = UINT_MAX |
static TRnd | Rnd |
TUInt::TUInt | ( | ) | [inline] |
Definition at line 1138 of file dt.h.
Referenced by GetMemUsed().
: Val(0){}
TUInt::TUInt | ( | const uint & | _Val | ) | [inline] |
TUInt::TUInt | ( | TSIn & | SIn | ) | [inline, explicit] |
static TStr TUInt::GetKiloStr | ( | const uint & | Val | ) | [inline, static] |
Definition at line 1179 of file dt.h.
References GetStr().
Referenced by GetMegaStr().
{ if (Val>100*1000){return GetStr(Val/1000)+"K";} else if (Val>1000){return GetStr(Val/1000)+"."+GetStr((Val%1000)/100)+"K";} else {return GetStr(Val);}}
static TStr TUInt::GetMegaStr | ( | const uint & | Val | ) | [inline, static] |
int TUInt::GetMemUsed | ( | ) | const [inline] |
Definition at line 1163 of file dt.h.
References TUInt().
Referenced by TSecTm::GetMemUsed().
{return sizeof(TUInt);}
int TUInt::GetPrimHashCd | ( | ) | const [inline] |
Definition at line 1165 of file dt.h.
References Val.
Referenced by TSecTm::GetPrimHashCd().
{return int(Val);}
static uint TUInt::GetRnd | ( | const uint & | Range = 0 | ) | [inline, static] |
Definition at line 1168 of file dt.h.
References TRnd::GetUniDevUInt(), and Rnd.
{return Rnd.GetUniDevUInt(Range);}
int TUInt::GetSecHashCd | ( | ) | const [inline] |
Definition at line 1166 of file dt.h.
References Val.
Referenced by TSecTm::GetSecHashCd().
{return Val/0x10;}
TStr TUInt::GetStr | ( | ) | const [inline] |
Definition at line 1170 of file dt.h.
References Val.
Referenced by TUniCodec::EncodeUtf16ToBytes(), TUniCodec::EncodeUtf16ToWords(), TBlobPt::GetAddrStr(), GetKiloStr(), GetMegaStr(), GetStr(), TXmlLx::GetSym(), TXmlDoc::GetXmlStr(), TXmlLx::GetXmlStrFromPlainMem(), TXmlLx::GetXmlStrFromPlainStr(), and TSOut::PutUInt().
{return TUInt::GetStr(Val);}
static TStr TUInt::GetStr | ( | const uint & | Val | ) | [inline, static] |
static TStr TUInt::GetStr | ( | const TInt & | UInt | ) | [inline, static] |
TStr TUInt::GetStr | ( | const uint & | Val, |
const char * | FmtStr | ||
) | [static] |
static TStr TUInt::GetStr | ( | const uint & | Val, |
const TStr & | FmtStr | ||
) | [inline, static] |
TStr TUInt::GetStrFromIpUInt | ( | const uint & | Ip | ) | [static] |
Definition at line 2085 of file dt.cpp.
References TStr::Fmt().
{ return TStr::Fmt("%d.%d.%d.%d", ((Ip>>24) & 0xFF), ((Ip>>16) & 0xFF), ((Ip>>8) & 0xFF), (Ip & 0xFF)); }
uint TUInt::GetUIntFromIpStr | ( | const TStr & | IpStr, |
const char & | SplitCh = '.' |
||
) | [static] |
Definition at line 2075 of file dt.cpp.
References TStr::CStr(), EAssertR, TStr::Fmt(), and TStr::SplitOnAllCh().
{ TStrV IpStrV; IpStr.SplitOnAllCh(SplitCh, IpStrV); uint Ip = 0; int Byte = 0; EAssertR(IpStrV[0].IsInt(true, 0, 255, Byte), TStr::Fmt("Bad IP: '%s;", IpStr.CStr())); Ip = (uint)Byte; EAssertR(IpStrV[1].IsInt(true, 0, 255, Byte), TStr::Fmt("Bad IP: '%s;", IpStr.CStr())); Ip = (Ip << 8) | (uint)Byte; EAssertR(IpStrV[2].IsInt(true, 0, 255, Byte), TStr::Fmt("Bad IP: '%s;", IpStr.CStr())); Ip = (Ip << 8) | (uint)Byte; EAssertR(IpStrV[3].IsInt(true, 0, 255, Byte), TStr::Fmt("Bad IP: '%s;", IpStr.CStr())); Ip = (Ip << 8) | (uint)Byte; return Ip; }
bool TUInt::IsIpStr | ( | const TStr & | IpStr, |
uint & | Ip, | ||
const char & | SplitCh = '.' |
||
) | [static] |
Definition at line 2065 of file dt.cpp.
References TStr::SplitOnAllCh().
{ TStrV IpStrV; IpStr.SplitOnAllCh(SplitCh, IpStrV); Ip = 0; int Byte = 0; if (!IpStrV[0].IsInt(true, 0, 255, Byte)) { return false; }; Ip = (uint)Byte; if (!IpStrV[1].IsInt(true, 0, 255, Byte)) { return false; }; Ip = (Ip << 8) | (uint)Byte; if (!IpStrV[2].IsInt(true, 0, 255, Byte)) { return false; }; Ip = (Ip << 8) | (uint)Byte; if (!IpStrV[3].IsInt(true, 0, 255, Byte)) { return false; }; Ip = (Ip << 8) | (uint)Byte; return true; }
static bool TUInt::IsIpStr | ( | const TStr & | IpStr, |
const char & | SplitCh = '.' |
||
) | [inline, static] |
static uint TUInt::JavaUIntToCppUInt | ( | const uint & | JavaUInt | ) | [inline, static] |
void TUInt::Load | ( | TSIn & | SIn | ) | [inline] |
Definition at line 1142 of file dt.h.
References TSIn::Load(), and Val.
Referenced by TSecTm::Load().
void TUInt::LoadXml | ( | const PXmlTok & | XmlTok, |
const TStr & | Nm | ||
) |
Definition at line 2046 of file dt.cpp.
References TXmlObjSer::GetIntArg(), Val, and XLoadHd.
{ XLoadHd(Nm); Val=TXmlObjSer::GetIntArg(XmlTok, "Val"); }
TUInt::operator uint | ( | ) | const [inline] |
uint TUInt::operator() | ( | ) | const [inline] |
uint& TUInt::operator() | ( | ) | [inline] |
TUInt TUInt::operator++ | ( | int | ) | [inline] |
TUInt TUInt::operator-- | ( | int | ) | [inline] |
TUInt& TUInt::operator<<= | ( | const int & | ShiftBits | ) | [inline] |
TUInt& TUInt::operator>>= | ( | const int & | ShiftBits | ) | [inline] |
TUInt& TUInt::operator~ | ( | ) | [inline] |
void TUInt::Save | ( | TSOut & | SOut | ) | const [inline] |
Definition at line 1143 of file dt.h.
References TSOut::Save(), and Val.
Referenced by TSecTm::Save().
void TUInt::SaveXml | ( | TSOut & | SOut, |
const TStr & | Nm | ||
) | const |
Definition at line 2051 of file dt.cpp.
References TInt::GetStr(), Val, and XSaveBETagArg.
{ XSaveBETagArg(Nm, "Val", TInt::GetStr(Val)); }
Definition at line 1134 of file dt.h.
Referenced by TUniCodec::GetRndUint().
Definition at line 1135 of file dt.h.
Referenced by TBlobPt::Clr(), TBlobPt::Empty(), TSecTm::GetCurTm(), TSecTm::GetInUnits(), TUniCodec::GetRndUint(), TSecTm::GetTmSec(), TSecTm::IsDef(), TUniCodec::TestUtf16(), TUniCodec::TestUtf8(), and TSecTm::Undef().
TRnd TUInt::Rnd [static] |
Definition at line 1132 of file dt.h.
Referenced by TSecTm::AddDays(), TSecTm::AddHours(), TSecTm::AddMins(), TSecTm::AddSecs(), TSecTm::AddWeeks(), GetPrimHashCd(), GetSecHashCd(), GetStr(), Load(), LoadXml(), TSecTm::operator uint(), operator uint(), operator&=(), operator()(), operator++(), operator--(), operator<<=(), operator=(), operator>>=(), operator^=(), operator|=(), operator~(), Save(), SaveXml(), TSecTm::SubDays(), TSecTm::SubHours(), TSecTm::SubMins(), TSecTm::SubSecs(), TSecTm::SubWeeks(), TSecTm::TSecTm(), and TUInt().