wxGISTask::wxGISTask(const wxXmlNode* pIniNode) { //load m_nId = GetDecimalValue(pIniNode, wxT("id"), wxNOT_FOUND); m_sName = pIniNode->GetAttribute(wxT("name"), NONAME); m_sDescription = pIniNode->GetAttribute(wxT("desc"), NONAME); m_sCat = pIniNode->GetAttribute(wxT("cat"), NONAME); m_nState = (wxGISEnumTaskStateType)GetDecimalValue(pIniNode, wxT("state"), enumGISTaskUnk); m_nPriority = GetDecimalValue(pIniNode, wxT("prio"), wxNOT_FOUND); m_dtBeg = GetDateValue(pIniNode, wxT("beg"), wxDateTime::Now()); m_dtEnd = GetDateValue(pIniNode, wxT("end"), wxDateTime::Now()); long nVolumeHi = GetDecimalValue(pIniNode, wxT("vol_hi"), 0); long nVolumeLo = GetDecimalValue(pIniNode, wxT("vol_lo"), 0); m_nVolume = wxULongLong(nVolumeHi, nVolumeLo); m_dfDone = GetFloatValue(pIniNode, wxT("done"), 0.0); m_pParams = NULL; wxXmlNode *Children = pIniNode->GetChildren(); while(Children) { if(Children->GetName().IsSameAs(wxT("params"), false)) { if(m_pParams) wxDELETE(m_pParams); m_pParams = new wxXmlNode(*Children); } //else if(Children->GetName().IsSameAs(wxT("messages"), false)) //{ // LoadMessages(Children); //} Children = Children->GetNext(); } }
void wxGISTask::ChangeTask(const wxXmlNode* pTaskNode) { //load m_sName = pTaskNode->GetAttribute(wxT("name"), m_sName); m_sDescription = pTaskNode->GetAttribute(wxT("desc"), m_sDescription); m_sCat = pTaskNode->GetAttribute(wxT("cat"), m_sCat); m_nState = (wxGISEnumTaskStateType)GetDecimalValue(pTaskNode, wxT("state"), m_nState); m_nPriority = GetDecimalValue(pTaskNode, wxT("prio"), m_nPriority); m_dtBeg = GetDateValue(pTaskNode, wxT("beg"), m_dtBeg); m_dtEnd = GetDateValue(pTaskNode, wxT("end"), m_dtEnd); long nVolHi = GetDecimalValue(pTaskNode, wxT("vol_hi"), (long)m_nVolume.GetHi()); long nVolLo = GetDecimalValue(pTaskNode, wxT("vol_lo"), (long)m_nVolume.GetLo()); m_nVolume = wxULongLong(nVolHi, nVolLo); m_dfDone = GetFloatValue(pTaskNode, wxT("done"), m_dfDone); wxXmlNode *Children = pTaskNode->GetChildren(); while(Children) { if(Children->GetName().IsSameAs(wxT("params"), false)) { if(m_pParams) wxDELETE(m_pParams); m_pParams = new wxXmlNode(*Children); } //else if(Children->GetName().IsSameAs(wxT("messages"), false)) //{ // LoadMessages(Children); //} Children = Children->GetNext(); } }
void DataStreamTestCase::LongLongRW() { TestMultiRW<wxLongLong>::ValueArray ValuesLL; TestMultiRW<wxULongLong>::ValueArray ValuesULL; ValuesLL.push_back(wxLongLong(0l)); ValuesLL.push_back(wxLongLong(1l)); ValuesLL.push_back(wxLongLong(-1l)); ValuesLL.push_back(wxLongLong(0x12345678l)); ValuesLL.push_back(wxLongLong(0x12345678l, 0xabcdef01l)); ValuesULL.push_back(wxULongLong(0l)); ValuesULL.push_back(wxULongLong(1l)); ValuesULL.push_back(wxULongLong(0x12345678l)); ValuesULL.push_back(wxULongLong(0x12345678l, 0xabcdef01l)); CPPUNIT_ASSERT( TestRW(wxLongLong(0x12345678l)) == wxLongLong(0x12345678l) ); CPPUNIT_ASSERT( TestRW(wxLongLong(0x12345678l, 0xabcdef01l)) == wxLongLong(0x12345678l, 0xabcdef01l) ); CPPUNIT_ASSERT( TestMultiRW<wxLongLong>(ValuesLL, &wxDataOutputStream::WriteLL, &wxDataInputStream::ReadLL).IsOk() ); CPPUNIT_ASSERT( TestMultiRW<wxULongLong>(ValuesULL, &wxDataOutputStream::WriteLL, &wxDataInputStream::ReadLL).IsOk() ); }
ElfObject::ElfObject( const wxString& srcfile, uint hdrsize ) : data( wxULongLong(hdrsize).GetLo(), L"ELF headers" ) , proghead( NULL ) , secthead( NULL ) , filename( srcfile ) , header( *(ELF_HEADER*)data.GetPtr() ) { isCdvd = false; checkElfSize(data.GetSizeInBytes()); readFile(); initElfHeaders(); }
// All of ElfObjects functions. ElfObject::ElfObject(const wxString& srcfile, IsoFile& isofile) : data( wxULongLong(isofile.getLength()).GetLo(), L"ELF headers" ) , proghead( NULL ) , secthead( NULL ) , filename( srcfile ) , header( *(ELF_HEADER*)data.GetPtr() ) { isCdvd = true; checkElfSize(data.GetSizeInBytes()); readIso(isofile); initElfHeaders(); }
void GetValueByRow(wxVariant &variant, unsigned int row, unsigned int col) const { const WADArchiveEntry& entry = m_archive->GetFilteredEntry(row); switch (col) { case 0: variant = entry.GetFileName(); break; case 1: variant = wxFileName::GetHumanReadableSize(wxULongLong(entry.GetSize())); break; } }
bool wxGISApplication::SetupLog(const wxString &sLogPath, const wxString &sNamePrefix) { if(sLogPath.IsEmpty()) { wxLogError(_("wxGISApplication: Failed to get log folder")); return false; } if(!wxDirExists(sLogPath)) wxFileName::Mkdir(sLogPath, 0777, wxPATH_MKDIR_FULL); wxDateTime dt(wxDateTime::Now()); wxString logfilename = sLogPath + wxFileName::GetPathSeparator() + wxString::Format(wxT("%slog_%.4d%.2d%.2d.log"),sNamePrefix.c_str(), dt.GetYear(), dt.GetMonth() + 1, dt.GetDay()); if(m_LogFile.IsOpened()) m_LogFile.Close(); if(!m_LogFile.Open(logfilename.GetData(), wxT("a+"))) wxLogError(_("wxGISApplication: Failed to open log file %s"), logfilename.c_str()); wxLog::SetActiveTarget(new wxLogStderr(m_LogFile.fp())); #ifdef WXGISPORTABLE wxLogMessage(wxT("Portable")); #endif wxLogMessage(wxT(" ")); wxLogMessage(wxT("####################################################################")); wxLogMessage(wxT("## %s ##"),wxNow().c_str()); wxLogMessage(wxT("####################################################################")); wxLongLong nFreeMem = wxGetFreeMemory(); wxString sFreeMem = wxFileName::GetHumanReadableSize(wxULongLong(nFreeMem.GetHi(), nFreeMem.GetLo())); // long dFreeMem = wxMemorySize(wxGetFreeMemory() / 1048576).ToLong(); wxLogMessage(_("HOST '%s': OS desc - %s, free memory - %s"), wxGetFullHostName().c_str(), wxGetOsDescription().c_str(), sFreeMem.c_str()); wxLogMessage(_("wxGISApplication: %s %s is initializing..."), GetAppName().c_str(), GetAppVersionString().c_str()); wxLogMessage(_("wxGISApplication: Log file: %s"), logfilename.c_str()); return true; }
void wxAnyTestCase::wxVariantConversions() { #if wxUSE_VARIANT // // Test various conversions to and from wxVariant // bool res; // Prepare wxVariants wxVariant vLong(123L); wxVariant vString("ABC"); wxVariant vDouble(TEST_FLOAT_CONST); wxVariant vBool((bool)true); wxVariant vChar('A'); #ifdef wxLongLong_t wxVariant vLongLong(wxLongLong(wxLL(0xAABBBBCCCC))); wxVariant vULongLong(wxULongLong(wxULL(123456))); #endif wxArrayString arrstr; arrstr.push_back("test string"); wxVariant vArrayString(arrstr); wxVariant vDateTime(m_testDateTime); wxVariant vVoidPtr(dummyVoidPointer); wxVariant vCustomType(new wxMyVariantData(MyClass(101))); wxVariant vList; vList.NullList(); vList.Append(15); vList.Append("abc"); // Convert to wxAnys, and then back to wxVariants wxVariant variant; wxAny any(vLong); CPPUNIT_ASSERT(any == 123L); res = any.GetAs(&variant); CPPUNIT_ASSERT(res); CPPUNIT_ASSERT(variant == 123L); // Make sure integer variant has correct type information CPPUNIT_ASSERT(variant.GetLong() == 123); CPPUNIT_ASSERT(variant.GetType() == "long"); // Unsigned long wxAny should convert to "ulonglong" wxVariant any = 1000UL; res = any.GetAs(&variant); CPPUNIT_ASSERT(res); CPPUNIT_ASSERT(variant.GetType() == "ulonglong"); CPPUNIT_ASSERT(variant.GetLong() == 1000); any = vString; CPPUNIT_ASSERT(any == "ABC"); res = any.GetAs(&variant); CPPUNIT_ASSERT(res); CPPUNIT_ASSERT(variant.GetString() == "ABC"); // Must be able to build string wxVariant from wxAny built from // string literal any = "ABC"; res = any.GetAs(&variant); CPPUNIT_ASSERT(res); CPPUNIT_ASSERT(variant.GetType() == "string"); CPPUNIT_ASSERT(variant.GetString() == "ABC"); any = L"ABC"; res = any.GetAs(&variant); CPPUNIT_ASSERT(res); CPPUNIT_ASSERT(variant.GetType() == "string"); #if wxUSE_UNICODE CPPUNIT_ASSERT(variant.GetString() == L"ABC"); #endif any = vDouble; double d = wxANY_AS(any, double); CPPUNIT_ASSERT_DOUBLES_EQUAL(d, TEST_FLOAT_CONST, FEQ_DELTA); res = any.GetAs(&variant); CPPUNIT_ASSERT(res); CPPUNIT_ASSERT_DOUBLES_EQUAL(variant.GetDouble(), TEST_FLOAT_CONST, FEQ_DELTA); any = vBool; CPPUNIT_ASSERT(wxANY_AS(any, bool) == true); res = any.GetAs(&variant); CPPUNIT_ASSERT(res); CPPUNIT_ASSERT(variant.GetBool() == true); any = wxAny(vChar); //CPPUNIT_ASSERT(wxANY_AS(any, wxUniChar) == 'A'); res = any.GetAs(&variant); CPPUNIT_ASSERT(res); CPPUNIT_ASSERT(variant.GetChar() == 'A'); #ifdef wxLongLong_t any = wxAny(vLongLong); CPPUNIT_ASSERT(any == wxLL(0xAABBBBCCCC)); res = any.GetAs(&variant); CPPUNIT_ASSERT(res); CPPUNIT_ASSERT(variant.GetType() == "longlong"); CPPUNIT_ASSERT(variant.GetLongLong() == wxLongLong(wxLL(0xAABBBBCCCC))); #if LONG_MAX == wxINT64_MAX // As a sanity check, test that wxVariant of type 'long' converts // seamlessly to 'longlong' (on some 64-bit systems) any = 0xAABBBBCCCCL; res = any.GetAs(&variant); CPPUNIT_ASSERT(variant.GetLongLong() == wxLongLong(wxLL(0xAABBBBCCCC))); #endif any = wxAny(vULongLong); CPPUNIT_ASSERT(any == wxLL(123456)); res = any.GetAs(&variant); CPPUNIT_ASSERT(res); CPPUNIT_ASSERT(variant.GetType() == "ulonglong"); CPPUNIT_ASSERT(variant.GetULongLong() == wxULongLong(wxULL(123456))); #endif // Cannot test equality for the rest, just test that they convert // back correctly. any = wxAny(vArrayString); res = any.GetAs(&variant); CPPUNIT_ASSERT(res); wxArrayString arrstr2 = variant.GetArrayString(); CPPUNIT_ASSERT(arrstr2 == arrstr); any = m_testDateTime; CPPUNIT_ASSERT(wxANY_AS(any, wxDateTime) == m_testDateTime); any = wxAny(vDateTime); CPPUNIT_ASSERT(wxANY_AS(any, wxDateTime) == m_testDateTime); res = any.GetAs(&variant); CPPUNIT_ASSERT(res); CPPUNIT_ASSERT(variant == m_testDateTime); any = wxAny(vVoidPtr); res = any.GetAs(&variant); CPPUNIT_ASSERT(res); CPPUNIT_ASSERT(variant.GetVoidPtr() == dummyVoidPointer); any = wxAny(vList); CPPUNIT_ASSERT(wxANY_CHECK_TYPE(any, wxAnyList)); wxAnyList anyList = wxANY_AS(any, wxAnyList); CPPUNIT_ASSERT(anyList.GetCount() == 2); CPPUNIT_ASSERT(wxANY_AS((*anyList[0]), int) == 15); CPPUNIT_ASSERT(wxANY_AS((*anyList[1]), wxString) == "abc"); res = any.GetAs(&variant); CPPUNIT_ASSERT(res); CPPUNIT_ASSERT(variant.GetType() == "list"); CPPUNIT_ASSERT(variant.GetCount() == 2); CPPUNIT_ASSERT(variant[0].GetLong() == 15); CPPUNIT_ASSERT(variant[1].GetString() == "abc"); any = wxAny(vCustomType); CPPUNIT_ASSERT(wxANY_CHECK_TYPE(any, wxVariantData*)); res = any.GetAs(&variant); CPPUNIT_ASSERT(res); CPPUNIT_ASSERT(variant.GetType() == "MyClass"); #endif // wxUSE_VARIANT }
// Operation definition #define SHL(x,r) (x << r) #define SHR(x,r) (x >> r) #define ROTL(x,r) ((x << r) | (x >> (64 - r))) #define ROTR(x,r) ((x >> r) | (x << (64 - r))) #define CH(x,y,z) ((x & y) | ((~x) & z)) #define MAJ(x,y,z) ((x & y) | (x & z) | (y & z)) #define SUM0_384(x) (ROTR(x,28) ^ ROTR(x,34) ^ ROTR(x,39)) #define SUM1_384(x) (ROTR(x,14) ^ ROTR(x,18) ^ ROTR(x,41)) #define SIGMA0_384(x) (ROTR(x,1) ^ ROTR(x,8) ^ SHR(x,7)) #define SIGMA1_384(x) (ROTR(x,19) ^ ROTR(x,61) ^ SHR(x,6)) // Constants for elaborations in t static const wxULongLong K_384[] = { wxULongLong(0x428a2f98,0xd728ae22), wxULongLong(0x71374491,0x23ef65cd), wxULongLong(0xb5c0fbcf,0xec4d3b2f), wxULongLong(0xe9b5dba5,0x8189dbbc), wxULongLong(0x3956c25b,0xf348b538), wxULongLong(0x59f111f1,0xb605d019), wxULongLong(0x923f82a4,0xaf194f9b), wxULongLong(0xab1c5ed5,0xda6d8118), wxULongLong(0xd807aa98,0xa3030242), wxULongLong(0x12835b01,0x45706fbe), wxULongLong(0x243185be,0x4ee4b28c), wxULongLong(0x550c7dc3,0xd5ffb4e2), wxULongLong(0x72be5d74,0xf27b896f), wxULongLong(0x80deb1fe,0x3b1696b1), wxULongLong(0x9bdc06a7,0x25c71235), wxULongLong(0xc19bf174,0xcf692694), wxULongLong(0xe49b69c1,0x9ef14ad2), wxULongLong(0xefbe4786,0x384f25e3), wxULongLong(0x0fc19dc6,0x8b8cd5b5), wxULongLong(0x240ca1cc,0x77ac9c65), wxULongLong(0x2de92c6f,0x592b0275), wxULongLong(0x4a7484aa,0x6ea6e483), wxULongLong(0x5cb0a9dc,0xbd41fbd4), wxULongLong(0x76f988da,0x831153b5), wxULongLong(0x983e5152,0xee66dfab), wxULongLong(0xa831c66d,0x2db43210), wxULongLong(0xb00327c8,0x98fb213f), wxULongLong(0xbf597fc7,0xbeef0ee4), wxULongLong(0xc6e00bf3,0x3da88fc2), wxULongLong(0xd5a79147,0x930aa725), wxULongLong(0x06ca6351,0xe003826f), wxULongLong(0x14292967,0x0a0e6e70), wxULongLong(0x27b70a85,0x46d22ffc), wxULongLong(0x2e1b2138,0x5c26c926), wxULongLong(0x4d2c6dfc,0x5ac42aed), wxULongLong(0x53380d13,0x9d95b3df), wxULongLong(0x650a7354,0x8baf63de), wxULongLong(0x766a0abb,0x3c77b2a8), wxULongLong(0x81c2c92e,0x47edaee6), wxULongLong(0x92722c85,0x1482353b), wxULongLong(0xa2bfe8a1,0x4cf10364), wxULongLong(0xa81a664b,0xbc423001), wxULongLong(0xc24b8b70,0xd0f89791), wxULongLong(0xc76c51a3,0x0654be30), wxULongLong(0xd192e819,0xd6ef5218), wxULongLong(0xd6990624,0x5565a910), wxULongLong(0xf40e3585,0x5771202a), wxULongLong(0x106aa070,0x32bbd1b8), wxULongLong(0x19a4c116,0xb8d2d0c8), wxULongLong(0x1e376c08,0x5141ab53), wxULongLong(0x2748774c,0xdf8eeb99), wxULongLong(0x34b0bcb5,0xe19b48a8), wxULongLong(0x391c0cb3,0xc5c95a63), wxULongLong(0x4ed8aa4a,0xe3418acb), wxULongLong(0x5b9cca4f,0x7763e373), wxULongLong(0x682e6ff3,0xd6b2b8a3), wxULongLong(0x748f82ee,0x5defb2fc), wxULongLong(0x78a5636f,0x43172f60), wxULongLong(0x84c87814,0xa1f0ab72), wxULongLong(0x8cc70208,0x1a6439ec), wxULongLong(0x90befffa,0x23631e28), wxULongLong(0xa4506ceb,0xde82bde9), wxULongLong(0xbef9a3f7,0xb2c67915), wxULongLong(0xc67178f2,0xe372532b),