| 
    SNAP Library 2.0, Developer Reference
    2013-05-13 16:33:57
    
   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] | 
        
Definition at line 1154 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 1195 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 1179 of file dt.h.
References TUInt().
Referenced by TSecTm::GetMemUsed().
{return sizeof(TUInt);}


| int TUInt::GetPrimHashCd | ( | ) |  const [inline] | 
        
Definition at line 1181 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 1184 of file dt.h.
References TRnd::GetUniDevUInt(), and Rnd.
{return Rnd.GetUniDevUInt(Range);}

| int TUInt::GetSecHashCd | ( | ) |  const [inline] | 
        
Definition at line 1182 of file dt.h.
References Val.
Referenced by TSecTm::GetSecHashCd().
{return Val/0x10;}

| TStr TUInt::GetStr | ( | ) |  const [inline] | 
        
Definition at line 1186 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 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] | 
        
Definition at line 2117 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 2107 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 2096 of file dt.cpp.
References TVec< TVal, TSizeTy >::Len(), and TStr::SplitOnAllCh().
                                                                    {
        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.
References TVec< TVal, TSizeTy >::Len(), and TStr::SplitOnAllCh().
                                                            {
        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::Load | ( | TSIn & | SIn | ) |  [inline] | 
        
Definition at line 1158 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 2077 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 1159 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 2082 of file dt.cpp.
References TInt::GetStr(), Val, and XSaveBETagArg.
                                                     {
  XSaveBETagArg(Nm, "Val", TInt::GetStr(Val));
}

Definition at line 1150 of file dt.h.
Referenced by TUniCodec::GetRndUint().
Definition at line 1151 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 1148 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().