void CommandManager::PurgeData() { // Delete callback functors BEFORE clearing mCommandList! // These are the items created within 'FN()' size_t i; CommandFunctor * pCallback = NULL; for(i=0; i<mCommandList.GetCount(); i++) { CommandListEntry *tmpEntry = mCommandList[i]; // JKC: We only want to delete each callbacks once. // AddItemList() may have inserted the same callback // several times over. if( tmpEntry->callback != pCallback ) { pCallback = tmpEntry->callback; delete pCallback; } } // mCommandList contains pointers to CommandListEntrys // mMenuBarList contains pointers to MenuBarListEntrys. // mSubMenuList contains pointers to SubMenuListEntrys WX_CLEAR_ARRAY( mCommandList ); WX_CLEAR_ARRAY( mMenuBarList ); WX_CLEAR_ARRAY( mSubMenuList ); mCommandNameHash.clear(); mCommandKeyHash.clear(); mCommandIDHash.clear(); mCurrentMenu = NULL; mCurrentMenuName = COMMAND; mCurrentID = 0; }
void AutoCompData::Clear() { m_Classes.Empty(); m_Functions.Empty(); m_Objects.Empty(); m_Vars.Empty(); wxDELETE( m_Exports ); WX_CLEAR_ARRAY( m_Namespaces ); WX_CLEAR_ARRAY( m_Files ); }
void ArraysTestCase::Clear() { ItemPtrArray items; WX_CLEAR_ARRAY(items); CPPUNIT_ASSERT_EQUAL( 0, items.size() ); items.push_back(new Item(17)); items.push_back(new Item(71)); CPPUNIT_ASSERT_EQUAL( 2, items.size() ); WX_CLEAR_ARRAY(items); CPPUNIT_ASSERT_EQUAL( 0, items.size() ); }
HexEditorCtrl::~HexEditorCtrl( void ){ Dynamic_Disconnector(); Clear(); WX_CLEAR_ARRAY(MainTagArray) WX_CLEAR_ARRAY(HighlightArray) WX_CLEAR_ARRAY(CompareArray) MainTagArray.Shrink(); HighlightArray.Shrink(); CompareArray.Shrink(); delete select; delete offset_scroll; }
void dbgController::ResultBreakpoints(pgQueryResultEvent &_ev) { pgBatchQuery *qry = _ev.GetQuery(); if (!HandleQuery(qry, _("Error fetching breakpoints."))) return; LOCKMUTEX(m_dbgThreadLock); // Do not bother to process the result, if the debugger thread is not // running or not exists if (m_dbgThread && m_dbgThread->IsRunning()) { if (qry->ReturnCode() == PGRES_TUPLES_OK) { pgSet *set = qry->ResultSet(); int pkgCol = -1, funcCol = set->ColNumber(wxT("func")), lineCol = set->ColNumber(wxT("linenumber")); if (set->HasColumn(wxT("pkg"))) { pkgCol = set->ColNumber(wxT("pkg")); } m_dbgThread->AddQuery( wxString::Format(ms_cmdGetVars, m_model->GetSession().c_str()), NULL, RESULT_ID_GET_VARS); m_frm->ClearBreakpointMarkers(); dbgBreakPointList &breakpoints = m_model->GetBreakPoints(); WX_CLEAR_ARRAY(breakpoints); while (!set->Eof()) { // The result set contains one tuple per breakpoint: // pkg, func, linenumber, target // or, // func, linenumber, target wxString pkg = (pkgCol == -1) ? wxT("0") : set->GetVal(pkgCol); wxString func = set->GetVal(funcCol); int lineNumber = (int)set->GetLong(lineCol); // Save this break-points in break-point list breakpoints.Append(new dbgBreakPoint(func, pkg, lineNumber)); // Mark the break-point in the viewer if (pkg == m_model->GetDisplayedPackage() && func == m_model->GetDisplayedFunction()) { m_frm->MarkBreakpoint(lineNumber - 1); } set->MoveNext(); } } // Release the result-set qry->Release(); } UNLOCKMUTEX(m_dbgThreadLock); }
bool Envelope::Load(wxTextFile * in, DirManager * dirManager) { if (in->GetNextLine() != "EnvNumPoints") return false; long len; if (!(in->GetNextLine().ToLong(&len))) return false; WX_CLEAR_ARRAY(mEnv) mEnv.Alloc(len); for (int i = 0; i < len; i++) { EnvPoint *e = new EnvPoint(); if (!(in->GetNextLine().ToDouble(&e->t))) return false; if (!(in->GetNextLine().ToDouble(&e->val))) return false; if (i > 0 && mEnv[i - 1]->t > e->t) return false; mEnv.Add(e); } mTrackLen = mEnv[len-1]->t; if (in->GetNextLine() != "EnvEnd") return false; return true; }
void DefaultMimeHandler::OnRelease(bool appShutDown) { CodeBlocksDockEvent evt(cbEVT_REMOVE_DOCK_WINDOW); evt.pWindow = m_Html; Manager::Get()->ProcessEvent(evt); m_Html->Destroy(); m_Html = 0; // save configuration ConfigManager* conf = Manager::Get()->GetConfigManager(_T("mime_types")); wxArrayString list = conf->EnumerateKeys(_T("/")); for (unsigned int i = 0; i < list.GetCount(); ++i) { conf->UnSet(list[i]); } for (unsigned int i = 0; i < m_MimeTypes.GetCount(); ++i) { cbMimeType* mt = m_MimeTypes[i]; wxString txt; txt << (mt->useEditor ? _T("true") : _T("false")) << _T(";"); txt << (mt->useAssoc ? _T("true") : _T("false")) << _T(";"); txt << (mt->programIsModal ? _T("true") : _T("false")) << _T(";"); txt << mt->wildcard << _T(";"); txt << mt->program << _T(' '); wxString key; key.Printf(_T("MimeType%d"), i); conf->Write(key, txt); } WX_CLEAR_ARRAY(m_MimeTypes); }
aisradar_pi::~aisradar_pi() { if ( AisTargets ) { WX_CLEAR_ARRAY(*AisTargets); delete AisTargets; AisTargets=0; } }
bool wxHandheldInstallCtrl::IsAllDestinationsEmpty() { wxLogDebug( wxT( "Entering wxHandheldInstallCtrl::IsAllDestinationsEmpty() " ) ); bool is_empty = FALSE; handheld_dest_array_type handheld_dest_array; wxArrayString sync_directories_array; GetUserDestinations( handheld_dest_array ); GetDirectoryDestinations( sync_directories_array ); if ( handheld_dest_array.IsEmpty() && sync_directories_array.IsEmpty() ) { wxLogDebug( wxT( "Both hhictrl array's returning empty." ) ); is_empty = TRUE; } //Free memory sync_directories_array.Clear(); // The WX_CLEAR_ARRAY(array) macro [see dynarray.h] is required to clear out all the // elements from memory of an array of structs that was built with WX_DEFINE_ARRAY. // All that this macro does is just to loop through the array, "delete" each element // to free it from memory, then mark the array as Empty(). WX_CLEAR_ARRAY( handheld_dest_array ); wxLogDebug( wxT( "Completing wxHandheldInstallCtrl::IsAllDestinationsEmpty()" ) ); return is_empty; }
bool Envelope::HandleXMLTag(const wxChar *tag, const wxChar **attrs) { // Return unless it's the envelope tag. if (wxStrcmp(tag, wxT("envelope"))) return false; int numPoints = 0; long nValue = -1; while (*attrs) { const wxChar *attr = *attrs++; const wxChar *value = *attrs++; if (!value) break; const wxString strValue = value; if( !wxStrcmp(attr, wxT("numpoints")) && XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue)) numPoints = nValue; } if (numPoints < 0) return false; WX_CLEAR_ARRAY(mEnv); mEnv.Alloc(numPoints); return true; }
bool pgBatchQuery::Release() { bool res = false; if (m_resultSet != NULL) { res = true; pgSet *set = m_resultSet; m_resultSet = NULL; if (set) delete set; set = NULL; } if (m_params) { res = true; WX_CLEAR_ARRAY((*m_params)); delete m_params; m_params = NULL; } return res; }
void Envelope::CopyFrom(const Envelope *e, double t0, double t1) { wxASSERT( t0 < t1 ); mOffset = wxMax(t0, e->mOffset); mTrackLen = wxMin(t1, e->mOffset + e->mTrackLen) - mOffset; WX_CLEAR_ARRAY(mEnv); int len = e->mEnv.Count(); int i = 0; // Skip the points that come before the copied region while( (i < len) && e->mOffset + e->mEnv[i]->GetT() <= t0) i++; // Create the point at 0 if it needs interpolated representation if (i>0) AddPointAtEnd( 0, e->GetValue(mOffset) ); // Copy points from inside the copied region while ( (i < len) && e->mOffset + e->mEnv[i]->GetT() - mOffset < mTrackLen) { AddPointAtEnd( e->mOffset + e->mEnv[i]->GetT() - mOffset, e->mEnv[i]->GetVal() ); i++; } // Create the final point if it needs interpolated representation if (mTrackLen > 0 && i < len) AddPointAtEnd( mTrackLen, e->GetValue(mOffset + mTrackLen)); }
ArrayOfPlugIn_AIS_Targets *aisradar_pi::GetAisTargets() { if ( AisTargets ) { WX_CLEAR_ARRAY(*AisTargets); delete AisTargets; } AisTargets = GetAISTargetArray(); return AisTargets; }
void CompilerFactory::UnregisterCompilers() { WX_CLEAR_ARRAY(CompilerFactory::Compilers); CompilerFactory::Compilers.Empty(); Compiler::m_CompilerIDs.Empty(); s_DefaultCompiler = nullptr; }
void wxListBox::DoSetItems( const wxArrayString& raChoices , void** ppClientData ) { BOOL bHideAndShow = IsShown(); int i; LONG lIndexType = 0; if (bHideAndShow) { ::WinShowWindow(GetHwnd(), FALSE); } ::WinSendMsg(GetHwnd(), LM_DELETEALL, (MPARAM)0, (MPARAM)0); m_nNumItems = raChoices.GetCount(); for (i = 0; i < m_nNumItems; i++) { if (m_windowStyle & wxLB_SORT) lIndexType = LIT_SORTASCENDING; else lIndexType = LIT_END; ::WinSendMsg(GetHwnd(), LM_INSERTITEM, (MPARAM)lIndexType, (MPARAM)raChoices[i].c_str()); if (ppClientData) { #if wxUSE_OWNER_DRAWN wxASSERT_MSG(ppClientData[i] == NULL, wxT("Can't use client data with owner-drawn listboxes")); #else // !wxUSE_OWNER_DRAWN ::WinSendMsg(WinUtil_GetHwnd(), LM_SETITEMHANDLE, MPFROMLONG(lCount), MPFROMP(ppClientData[i])); #endif // wxUSE_OWNER_DRAWN/!wxUSE_OWNER_DRAWN } } #if wxUSE_OWNER_DRAWN if ( m_windowStyle & wxLB_OWNERDRAW ) { // // First delete old items // WX_CLEAR_ARRAY(m_aItems); // // Then create new ones // for (size_t ui = 0; ui < (size_t)m_nNumItems; ui++) { wxOwnerDrawn* pNewItem = CreateItem(ui); pNewItem->SetName(raChoices[ui]); m_aItems.Add(pNewItem); ::WinSendMsg(GetHwnd(), LM_SETITEMHANDLE, MPFROMLONG(ui), MPFROMP(pNewItem)); } } #endif // wxUSE_OWNER_DRAWN ::WinShowWindow(GetHwnd(), TRUE); } // end of wxListBox::DoSetItems
// remove all pages bool wxNotebook::DeleteAllPages() { WX_CLEAR_ARRAY(m_pages) ; MacSetupTabs(); m_selection = wxNOT_FOUND ; InvalidateBestSize(); return true; }
void wxListBox::Free() { #if wxUSE_OWNER_DRAWN if ( m_windowStyle & wxLB_OWNERDRAW ) { WX_CLEAR_ARRAY(m_aItems); } #endif // wxUSE_OWNER_DRAWN }
void Envelope::testMe() { double t0=0, t1=0; SetInterpolateDB(false); Mirror(false); Flatten(0.5); checkResult( 1, Integral(0.0,100.0), 50); checkResult( 2, Integral(-10.0,10.0), 10); Flatten(0.5); checkResult( 3, Integral(0.0,100.0), 50); checkResult( 4, Integral(-10.0,10.0), 10); checkResult( 5, Integral(-20.0,-10.0), 5); Flatten(0.5); Insert( 5.0, 0.5 ); checkResult( 6, Integral(0.0,100.0), 50); checkResult( 7, Integral(-10.0,10.0), 10); Flatten(0.0); Insert( 0.0, 0.0 ); Insert( 5.0, 1.0 ); Insert( 10.0, 0.0 ); t0 = 10.0 - .1; t1 = 10.0 + .1; double result = Integral(0.0,t1); double resulta = Integral(0.0,t0); double resultb = Integral(t0,t1); // Integrals should be additive checkResult( 8, result - resulta - resultb, 0); Flatten(0.0); Insert( 0.0, 0.0 ); Insert( 5.0, 1.0 ); Insert( 10.0, 0.0 ); t0 = 10.0 - .1; t1 = 10.0 + .1; checkResult( 9, Integral(0.0,t1), 5); checkResult( 10, Integral(0.0,t0), 4.999); checkResult( 11, Integral(t0,t1), .001); WX_CLEAR_ARRAY(mEnv); Insert( 0.0, 0.0 ); Insert( 5.0, 1.0 ); Insert( 10.0, 0.0 ); checkResult( 12, NumberOfPointsAfter( -1 ), 3 ); checkResult( 13, NumberOfPointsAfter( 0 ), 2 ); checkResult( 14, NumberOfPointsAfter( 1 ), 2 ); checkResult( 15, NumberOfPointsAfter( 5 ), 1 ); checkResult( 16, NumberOfPointsAfter( 7 ), 1 ); checkResult( 17, NumberOfPointsAfter( 10 ), 0 ); checkResult( 18, NextPointAfter( 0 ), 5 ); checkResult( 19, NextPointAfter( 5 ), 10 ); }
void ArraysTestCase::TestSTL() { wxArrayInt list1; wxArrayInt::iterator it, en; wxArrayInt::reverse_iterator rit, ren; int i; static const int COUNT = 5; for ( i = 0; i < COUNT; ++i ) list1.push_back(i); CPPUNIT_ASSERT( list1.capacity() >= (size_t)COUNT ); CPPUNIT_ASSERT_EQUAL( COUNT, list1.size() ); for ( it = list1.begin(), en = list1.end(), i = 0; it != en; ++it, ++i ) { CPPUNIT_ASSERT( *it == i ); } CPPUNIT_ASSERT_EQUAL( COUNT, i ); for ( rit = list1.rbegin(), ren = list1.rend(), i = COUNT; rit != ren; ++rit, --i ) { CPPUNIT_ASSERT( *rit == i-1 ); } CPPUNIT_ASSERT_EQUAL( 0, i ); CPPUNIT_ASSERT( *list1.rbegin() == *(list1.end()-1) && *list1.begin() == *(list1.rend()-1) ); it = list1.begin()+1; rit = list1.rbegin()+1; CPPUNIT_ASSERT( *list1.begin() == *(it-1) && *list1.rbegin() == *(rit-1) ); CPPUNIT_ASSERT( ( list1.front() == 0 ) && ( list1.back() == COUNT - 1 ) ); list1.erase(list1.begin()); list1.erase(list1.end()-1); for ( it = list1.begin(), en = list1.end(), i = 1; it != en; ++it, ++i ) { CPPUNIT_ASSERT( *it == i ); } ItemPtrArray items; items.push_back(new Item(17)); CPPUNIT_ASSERT_EQUAL( 17, (*(items.rbegin()))->n ); CPPUNIT_ASSERT_EQUAL( 17, (**items.begin()).n ); WX_CLEAR_ARRAY(items); }
bool wxDataViewCtrl::ClearColumns() { if (GetDataViewPeer()->ClearColumns()) { WX_CLEAR_ARRAY(m_ColumnPtrs); return true; } else return false; }
wxHtmlParser::~wxHtmlParser() { while (RestoreState()) {} DestroyDOMTree(); WX_CLEAR_ARRAY(m_HandlersStack); WX_CLEAR_HASH_SET(wxHtmlTagHandlersSet, m_HandlersSet); delete m_entitiesParser; delete m_Source; }
// clear data so you can read another group of WM files void wxMimeTypesManagerImpl::ClearData() { m_aTypes.Clear(); m_aIcons.Clear(); m_aExtensions.Clear(); m_aDescriptions.Clear(); WX_CLEAR_ARRAY(m_aEntries); m_aEntries.Empty(); }
// Destructor palm_installer_base::~palm_installer_base() { // Clear out the array of users, or will see a memory leak for each member wxLogDebug( wxT( "Entering palm_installer_base() destructor. About to clear user array" ) ); // The WX_CLEAR_ARRAY(array) macro [see dynarray.h] is required to clear out all the // elements from memory of an array of structs that was built with WX_DEFINE_ARRAY. // All that this macro does is just to loop through the array, "delete" each element // to free it from memory, then mark the array as Empty(). WX_CLEAR_ARRAY( m_users_array ); wxLogDebug( wxT( "Successfully cleared user_array." ) ); }
void HexEditorCtrl::PreparePaintTAGs( void ){//TagElement& TAG ){ TagHideAll(); WX_CLEAR_ARRAY(hex_ctrl->TagArray); WX_CLEAR_ARRAY(text_ctrl->TagArray); //MainTagArray.Sort( TagElement::TagCompare ); //for( unsigned i = 0 ; i < MainTagArray.Count() ; i ++ ) //Painting all TAGs here. // PushTAGToControls(MainTagArray.Item(i)); PaintTAGsPrefilter( MainTagArray ); //HighlightArray.Sort( TagElement::TagCompare ); //for( unsigned i = 0 ; i < HighlightArray.Count() ; i ++ ) //Just highlighting required sections. // PushTAGToControls(HighlightArray.Item(i)); PaintTAGsPrefilter( HighlightArray ); //CompareArray.Sort( TagElement::TagCompare ); //for( unsigned i = 0 ; i < CompareArray.Count() ; i ++ ) //Just highlighting diff sections. // PushTAGToControls(CompareArray.Item(i)); PaintTAGsPrefilter( CompareArray ); }
void wxListBox::DoClear() { #if wxUSE_OWNER_DRAWN if ( m_windowStyle & wxLB_OWNERDRAW ) { WX_CLEAR_ARRAY(m_aItems); } #endif // wxUSE_OWNER_DRAWN ::WinSendMsg(GetHwnd(), LM_DELETEALL, (MPARAM)0, (MPARAM)0); m_nNumItems = 0; } // end of wxListBox::Clear
MfStatusCache::~MfStatusCache() { if ( m_evtmanHandle ) { MEventManager::Deregister(m_evtmanHandle); } Save(); // delete the elements too WX_CLEAR_ARRAY(m_folderData); }
void wxPropertyList::RemoveAll() { WX_CLEAR_ARRAY(m_PropertyItems); m_generatedProjects = false; if(GetNumberRows() > 0) DeleteRows(0, GetNumberRows()); m_strQuery.Empty(); #ifdef __LINUX__ // fix to make sure scrollbars are drawn properly wxGrid::AdjustScrollbars(); #endif }
pgBatchQuery::~pgBatchQuery() { if (m_resultSet) { delete m_resultSet; m_resultSet = NULL; } if (m_params) { WX_CLEAR_ARRAY((*m_params)); delete m_params; m_params = NULL; } }
void wxListBox::DoClear() { #if wxUSE_OWNER_DRAWN if ( HasFlag(wxLB_OWNERDRAW) ) { WX_CLEAR_ARRAY(m_aItems); } #endif // wxUSE_OWNER_DRAWN ListBox_ResetContent(GetHwnd()); m_noItems = 0; MSWOnItemsChanged(); UpdateOldSelections(); }
void Envelope::CopyFrom(Envelope * e) { mOffset = e->mOffset; int len = e->mEnv.Count(); mTrackLen = e->mEnv[len - 1]->t; WX_CLEAR_ARRAY(mEnv) mEnv.Alloc(len); for (int i = 0; i < len; i++) { EnvPoint *pt = new EnvPoint(); pt->t = e->mEnv[i]->t; pt->val = e->mEnv[i]->val; mEnv.Add(pt); } }