|
SNAP Library 2.2, User Reference
2014-03-11 19:15:55
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 TUInt &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) |
| static bool | IsIpv6Str (const TStr &IpStr, const char &SplitCh= ':') |
Public Attributes | |
| uint | Val |
Static Public Attributes | |
| static const uint | Mn = 0 |
| static const uint | Mx = UINT_MAX |
| static TRnd | Rnd |
| TUInt::TUInt | ( | ) | [inline] |
| TUInt::TUInt | ( | const uint & | _Val | ) | [inline] |
| TUInt::TUInt | ( | TSIn & | SIn | ) | [inline, explicit] |
| static TStr TUInt::GetKiloStr | ( | const uint & | Val | ) | [inline, static] |
| static TStr TUInt::GetMegaStr | ( | const uint & | Val | ) | [inline, static] |
| int TUInt::GetMemUsed | ( | ) | const [inline] |
| int TUInt::GetPrimHashCd | ( | ) | const [inline] |
| static uint TUInt::GetRnd | ( | const uint & | Range = 0 | ) | [inline, static] |
Definition at line 1184 of file dt.h.
{return Rnd.GetUniDevUInt(Range);}
| int TUInt::GetSecHashCd | ( | ) | const [inline] |
| TStr TUInt::GetStr | ( | ) | const [inline] |
Definition at line 1186 of file dt.h.
{return TUInt::GetStr(Val);}
| static TStr TUInt::GetStr | ( | const uint & | Val | ) | [inline, static] |
| static TStr TUInt::GetStr | ( | const TUInt & | 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] |
| uint TUInt::GetUIntFromIpStr | ( | const TStr & | IpStr, |
| const char & | SplitCh = '.' |
||
| ) | [static] |
Definition at line 2107 of file dt.cpp.
{
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 2096 of file dt.cpp.
{
TStrV IpStrV; IpStr.SplitOnAllCh(SplitCh, IpStrV);
Ip = 0; int Byte = 0;
if (IpStrV.Len() != 4) { return false; }
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] |
| bool TUInt::IsIpv6Str | ( | const TStr & | IpStr, |
| const char & | SplitCh = ':' |
||
| ) | [static] |
Definition at line 2122 of file dt.cpp.
{
TStrV IpStrV; IpStr.SplitOnAllCh(SplitCh, IpStrV, false);
// check we have 8 groups
if (IpStrV.Len() > 8) { return false; }
// each group must be in hexa and in range from 0x0000 to 0xFFFF
int Group = 0;
for (int IpStrN = 0; IpStrN < IpStrV.Len(); IpStrN++) {
if (IpStrV[IpStrN].Empty()) { continue; }
if (IpStrV[IpStrN].IsHexInt(true, 0x0000, 0xFFFF, Group)) { continue; }
return false;
}
// all fine
return true;
}
| static uint TUInt::JavaUIntToCppUInt | ( | const uint & | JavaUInt | ) | [inline, static] |
| void TUInt::LoadXml | ( | const PXmlTok & | XmlTok, |
| const TStr & | Nm | ||
| ) |
Definition at line 2077 of file dt.cpp.
{
XLoadHd(Nm);
Val=TXmlObjSer::GetIntArg(XmlTok, "Val");
}
| 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] |
| void TUInt::SaveXml | ( | TSOut & | SOut, |
| const TStr & | Nm | ||
| ) | const |
Definition at line 2082 of file dt.cpp.
{
XSaveBETagArg(Nm, "Val", TInt::GetStr(Val));
}
TRnd TUInt::Rnd [static] |