void CConnections::RemoveAll() { POSITION pos; CString sKey; pos = GetStartPosition(); CConnection* pConnection; while (NULL!=pos) { GetNextAssoc(pos,sKey,pConnection); Remove(sKey); pos = GetStartPosition(); } }
CCAttrMap* CCAttrMap::Copy() { CCAttrMap *pNewAttrMap = new CCAttrMap( GetCount() ); if( pNewAttrMap != NULL ) { // iterating all (key, value) pairs for( iterator Pos = GetStartPosition(); Pos != GetEndPosition(); ) { CCRuntimeClass *pType; void *pVal; GetNextAssoc( Pos, pType, pVal ); // Get the attribute value of this attribute NodeAttribute* pAttr = (NodeAttribute*)pVal; // Copy the attribute NodeAttribute* pNewAttr = (NodeAttribute*) (pAttr->SimpleCopy()); // Stick the new attr into the new attr map if (pNewAttr != NULL) pNewAttrMap->SetAt(pNewAttr->GetAttributeType(),pNewAttr); } } pNewAttrMap->attrMapCreator = attrMapCreator; return pNewAttrMap; }
void CCAttrMap::ApplyAttributesToNode(NodeRenderableInk * pInk) { iterator pos = GetStartPosition(); while( pos != GetEndPosition() ) { CCRuntimeClass *pKey; void *pVal; GetNextAssoc(pos, pKey, pVal); NodeAttribute * pAttr = (NodeAttribute *)pVal; // copy the attribute if( pAttr->CanBeAppliedToObject() ) { NodeAttribute * pAttrCopy = NULL; pAttr->NodeCopy((Node **)(&pAttrCopy)); pAttrCopy->AttachNode(pInk, LASTCHILD); // nb now that GLAs have an independent flag to indicate when // they are copied from the default, it is safe to fix linkages // this ensures that GLA defaults get copied when BlendRefs are // made from complex nodes, and that they are found when MakeAppliedAttributes // calls FindAppliedAttributes on the unattached subtree // TODO?? // What about just copying compound node's Parent pointers to // pseudo attach the tree, rather than copying applied attrs to unattached tree // Just need to watch when deleting that it doesn't do anything to the // parents pointers - which it shouldn't surely? pAttrCopy->LinkToGeometry(pInk); } } }
void CCAttrMap::TransformBrushFills(TransformBase& Trans) { CCRuntimeClass *pType; void *pVal; for( iterator Pos = GetStartPosition(); Pos != GetEndPosition(); ) { GetNextAssoc(Pos,pType,pVal); if (pVal != NULL) { NodeAttribute* pNodeAttr = (NodeAttribute *)pVal; // check that we are not about to set line width to zero if( pNodeAttr->IsALineWidthAttr() && Trans.TransLines != FALSE ) { INT32 Test = labs( INT32(Trans.GetScalar().MakeDouble() * ((AttrLineWidth*)pNodeAttr)->Value.LineWidth) ); if (Test <= 10) Trans.TransLines = FALSE; } if (!pNodeAttr->NeedsToRenderAtEachBrushStroke()) pNodeAttr->Transform(Trans); } } }
// Iterate over the tuples in the sorter in batches/vectors of the given size void Sorter::VectorizedIterate( CodeGen &codegen, llvm::Value *sorter_ptr, uint32_t vector_size, Sorter::VectorizedIterateCallback &callback) const { llvm::Value *start_pos = GetStartPosition(codegen, sorter_ptr); llvm::Value *num_tuples = GetNumberOfStoredTuples(codegen, sorter_ptr); // Determine the number of bytes to skip per vector llvm::Value *vec_sz = codegen.Const32(vector_size); llvm::Value *tuple_size = GetTupleSize(codegen); llvm::Value *skip = codegen->CreateMul(vec_sz, tuple_size); lang::VectorizedLoop loop{ codegen, num_tuples, vector_size, {{"pos", start_pos}}}; { llvm::Value *curr_pos = loop.GetLoopVar(0); auto curr_range = loop.GetCurrentRange(); // Provide an accessor into the sorted space SorterAccess sorter_access{*this, start_pos}; // Issue the callback callback.ProcessEntries(codegen, curr_range.start, curr_range.end, sorter_access); // Bump the pointer by the size of a tuple llvm::Value *next_pos = codegen->CreateInBoundsGEP(curr_pos, skip); loop.LoopEnd(codegen, {next_pos}); } }
__int64 FileReader::GetFilePointer() { // BoostThread Boost; LARGE_INTEGER li; li.QuadPart = 0; li.LowPart = ::SetFilePointer(m_hFile, 0, &li.HighPart, FILE_CURRENT); __int64 start; __int64 length = 0; GetFileSize(&start, &length); __int64 startPos = 0; GetStartPosition(&startPos); if (startPos > 0) { if(startPos > (__int64)li.QuadPart) li.QuadPart = (__int64)(length - startPos + (__int64)li.QuadPart); else li.QuadPart = (__int64)((__int64)li.QuadPart - startPos); } return li.QuadPart; }
CCtrlItem* CDevObjDoc::GetCancelItem() { if (m_bObjectsIsDeleting) return NULL; CCtrlObj* pFindObj = NULL; POSITION posItem = GetStartPosition(); while (posItem != NULL) { CCtrlItem* pItem = (CCtrlItem *)GetNextItem(posItem); if (pItem != NULL) { CCtrlObj* pCtrlObj = pItem->m_pCtrlObj; ATLASSERT(pCtrlObj != NULL); if (pCtrlObj->m_bCancel) { if (pFindObj == NULL || pCtrlObj->m_nTabIndex < pFindObj->m_nTabIndex) pFindObj = pCtrlObj; } } } return pFindObj != NULL ? pFindObj->m_pClientItem : NULL; }
int CDevObjDoc::SetItemTabOrder(CCtrlItem* pItem, int nTabOrder) { ATLASSERT(GetCtrlItemCount() > 0); if (nTabOrder >= GetCtrlItemCount()) nTabOrder = GetCtrlItemCount() - 1; int nOldTabOrder = pItem->m_pCtrlObj->m_nTabIndex; POSITION posItem = GetStartPosition(); while (posItem != NULL) { CCtrlItem* pItemT = (CCtrlItem *)GetNextItem(posItem); if (pItemT != NULL) { CCtrlObj* pCtrlObj = pItemT->m_pCtrlObj; ATLASSERT(pCtrlObj != NULL); if (pItemT == pItem) { pCtrlObj->m_nTabIndex = nTabOrder; } else { if (pCtrlObj->m_nTabIndex > nOldTabOrder) pCtrlObj->m_nTabIndex--; if (pCtrlObj->m_nTabIndex >= nTabOrder && nTabOrder >= 0) pCtrlObj->m_nTabIndex++; } } } return nTabOrder; }
COleClientItem* COleDocument::GetInPlaceActiveItem(CWnd* pWnd) { ASSERT_VALID(this); ASSERT(pWnd != NULL); ASSERT_VALID(pWnd); // check for any item active on the immediate frame of pWndContainer // (two active objects on same frame are not supported) if (!pWnd->IsFrameWnd()) { CFrameWnd* pFrameWnd = pWnd->GetParentFrame(); if (pFrameWnd != NULL) pWnd = pFrameWnd; } POSITION pos = GetStartPosition(); COleClientItem* pItem; while ((pItem = GetNextClientItem(pos)) != NULL) { if (pItem->m_pView != NULL && pItem->IsInPlaceActive() && (pItem->m_pView == pWnd || pItem->m_pView->GetParentFrame() == pWnd)) { // that item is active on pWndContainer return pItem; } } // no item active on that window return NULL; }
void CABMOfficeSystemcppDoc::Serialize(CArchive& ar) { if (ar.IsStoring()) { // TODO: add storing code here } else { // TODO: add loading code here } // Calling the base class COleDocument enables serialization // of the container document's COleClientItem objects. COleDocument::Serialize(ar); // activate the first one if (!ar.IsStoring()) { POSITION posItem = GetStartPosition(); if (posItem != NULL) { CDocItem* pItem = GetNextItem(posItem); POSITION posView = GetFirstViewPosition(); COleDocObjectItem *pDocObjectItem = DYNAMIC_DOWNCAST(COleDocObjectItem, pItem); if (posView != NULL && pDocObjectItem != NULL) { CView* pView = GetNextView(posView); pDocObjectItem->DoVerb(OLEIVERB_SHOW, pView); } } } }
void CCAttrMap::TransformForBrush(TransformBase& Trans) { CCRuntimeClass *pType; void *pVal; for( iterator Pos = GetStartPosition(); Pos != GetEndPosition(); ) { GetNextAssoc(Pos,pType,pVal); if (pVal != NULL) { NodeAttribute* pNodeAttr = (NodeAttribute *)pVal; // check that we are not about to set line width to zero if( pNodeAttr->IsALineWidthAttr() && Trans.TransLines != FALSE ) { double Test = Trans.GetScalar().MakeDouble() * (double)((AttrLineWidth*)pNodeAttr)->Value.LineWidth; // TRACEUSER( "Diccon", _T("Scale line width by %f\n"), Test); if (Test <= 1.0) { // TRACEUSER( "Diccon", _T("Setting line width scaling OFF\n")); Trans.TransLines = FALSE; } } if (pNodeAttr->NeedsToRenderAtEachBrushStroke()) pNodeAttr->Transform(Trans); } } }
COleDocument::~COleDocument() { ASSERT_VALID(this); #ifdef _DEBUG if (!m_docItemList.IsEmpty()) TRACE(traceOle, 0, "Warning: destroying COleDocument with %d doc items.\n", m_docItemList.GetCount()); #endif // remove all doc-items from the list before shutting down the storage POSITION pos = GetStartPosition(); while (pos != NULL) { CDocItem* pItem = GetNextItem(pos); ASSERT(pItem != NULL); delete pItem; } // release the hold on the document storage RELEASE(m_lpRootStg); CoTaskMemFree(m_ptd); AfxOleUnlockApp(); }
BOOL COleDocument::ApplyPrintDevice(const DVTARGETDEVICE* ptd) { ASSERT_VALID(this); ASSERT(ptd == NULL || AfxIsValidAddress(ptd, (size_t)ptd->tdSize, FALSE)); // allocate copy of target device if (ptd != NULL) { DVTARGETDEVICE* ptdNew = _AfxOleCopyTargetDevice((DVTARGETDEVICE*)ptd); if (ptdNew == NULL) return FALSE; ptd = ptdNew; } // remove old target device from memory CoTaskMemFree(m_ptd); m_ptd = (DVTARGETDEVICE*)ptd; // Note: updating all the client items does not refresh the pres. cache POSITION pos = GetStartPosition(); COleClientItem* pItem; while ((pItem = GetNextClientItem(pos)) != NULL) { // update all the client items with new target device pItem->SetPrintDevice(ptd); } return TRUE; }
BOOL COleDocument::SaveModified() { // determine if necessary to discard changes if (::InSendMessage()) { POSITION pos = GetStartPosition(); COleClientItem* pItem; while ((pItem = GetNextClientItem(pos)) != NULL) { ASSERT(pItem->m_lpObject != NULL); SCODE sc = pItem->m_lpObject->IsUpToDate(); if (sc != OLE_E_NOTRUNNING && FAILED(sc)) { // inside inter-app SendMessage limits the user's choices CString name = m_strPathName; if (name.IsEmpty()) VERIFY(name.LoadString(AFX_IDS_UNTITLED)); CString prompt; AfxFormatString1(prompt, AFX_IDP_ASK_TO_DISCARD, name); return AfxMessageBox(prompt, MB_OKCANCEL|MB_DEFBUTTON2, AFX_IDP_ASK_TO_DISCARD) == IDOK; } } } // sometimes items change without a notification, so we have to // update the document's modified flag before calling // CDocument::SaveModified. UpdateModifiedFlag(); return CDocument::SaveModified(); }
COleClientItem* COleLinkingDoc::OnFindEmbeddedItem(LPCTSTR lpszItemName) { ASSERT_VALID(this); ASSERT(AfxIsValidString(lpszItemName)); // default implementation walks list of client items looking for // a case sensitive match POSITION pos = GetStartPosition(); COleClientItem* pItem; while ((pItem = GetNextClientItem(pos)) != NULL) { // a client item is running if there is a match in name // and the m_lpObject is also running. TCHAR szItemName[OLE_MAXITEMNAME]; pItem->GetItemName(szItemName, _countof(szItemName)); if (lstrcmp(szItemName, lpszItemName) == 0) return pItem; } TRACE(traceOle, 1, "Warning: default COleLinkingDoc::OnFindEmbeddedItem\n"); TRACE(traceOle, 1, _T("\timplementation failed to find item '%s'.\n"), lpszItemName); return NULL; // no matching item found }
// percentChunk is a number between 0 and 100, the amoun of % points that this will eat up void CSerialMapStringToOb::storeSerialize(CArchive &ar, CSimpleProgressBar* pProgress, int percentChunk) { if(ar.IsStoring()) { CObject* pObj; CString sKey; int sz = GetCount(); int iProgCount=0; int lastPer=0; int basePer = 0; if(pProgress) basePer = pProgress->m_nPercentage; POSITION p = GetStartPosition( ); while(p) { GetNextAssoc(p, sKey, pObj); if(pObj) pObj->Serialize(ar); if(pProgress) { ++iProgCount; int per = basePer + int(percentChunk*iProgCount/sz); if(per >= lastPer + 2) pProgress->Step(per); } } } else { ASSERT(FALSE); // can only output serialize } }
COleClientItem* COleDocument::GetPrimarySelectedItem(CView* pView) { ASSERT_VALID(this); ASSERT(pView != NULL); ASSERT_VALID(pView); COleClientItem* pSelectedItem = NULL; // walk all items in the document - return one if there // is only one client item selected // (note: non OLE client items are ignored) POSITION pos = GetStartPosition(); COleClientItem* pItem; while ((pItem = GetNextClientItem(pos)) != NULL) { if (pView->IsSelected(pItem)) { // client item selected in if (pSelectedItem != NULL) return NULL; // more than one - no primary selection pSelectedItem = pItem; } } return pSelectedItem; }
int64_t FileReader::GetFilePointer() { #ifdef _WIN32 LARGE_INTEGER li; li.QuadPart = 0; li.LowPart = ::SetFilePointer(m_hFile, 0, &li.HighPart, FILE_CURRENT); int64_t start; int64_t length = 0; GetFileSize(&start, &length); int64_t startPos = 0; GetStartPosition(&startPos); if (startPos > 0) { if(startPos > (int64_t)li.QuadPart) li.QuadPart = (int64_t)(length - startPos + (int64_t)li.QuadPart); else li.QuadPart = (int64_t)((int64_t)li.QuadPart - startPos); } return li.QuadPart; #else #error FIXME: Add a GetFilePointer() implementation for your OS return 0; #endif }
void COleDocument::Serialize(CArchive& ar) { ASSERT_VALID(this); // serialize all items in the doc item list if (ar.IsStoring()) { DWORD dwCount = 0; POSITION pos = GetStartPosition(); while (pos != NULL) { CDocItem* pDocItem = GetNextItem(pos); ASSERT_VALID(pDocItem); // only count non-blank ones if (!pDocItem->IsBlank()) ++dwCount; } ar << dwCount; // write count of objects // serialize all the items in the list pos = GetStartPosition(); while (pos != NULL) { CDocItem* pDocItem = GetNextItem(pos); ASSERT_VALID(pDocItem); // only write non-blank ones if (!pDocItem->IsBlank()) ar << pDocItem; } } else { // read number of items in the file DWORD dwCount; ar >> dwCount; // read all of them into the list while (dwCount--) { CDocItem* pDocItem; ar >> pDocItem; // as they are serialized, they are added! } } }
CCtrlItem* CDevObjDoc::GetNextTabItem(CCtrlItem* pItem, BOOL bPrevious) { int nTabOrder = 0; CCtrlObj* pFindObj = NULL; if (pItem != NULL) nTabOrder = pItem->m_pCtrlObj->m_nTabIndex; POSITION posItem = GetStartPosition(); while (posItem != NULL) { CCtrlItem* pItemT = (CCtrlItem *)GetNextItem(posItem); if (pItemT != NULL) { CCtrlObj* pCtrlObj = pItemT->m_pCtrlObj; ATLASSERT(pCtrlObj != NULL); if (!pCtrlObj->m_bTabStop || !pItemT->IsEnabled()) continue; if (pItemT == pItem) continue; if (pFindObj == NULL) pFindObj = pCtrlObj; if (!bPrevious) { if (pFindObj->m_nTabIndex < nTabOrder && pCtrlObj->m_nTabIndex > nTabOrder) { pFindObj = pCtrlObj; } else if ((pCtrlObj->m_nTabIndex >= nTabOrder) || (pCtrlObj->m_nTabIndex < nTabOrder && pFindObj->m_nTabIndex < nTabOrder)) { if (pFindObj->m_nTabIndex > pCtrlObj->m_nTabIndex) pFindObj = pCtrlObj; } } else { if (pFindObj->m_nTabIndex > nTabOrder && pCtrlObj->m_nTabIndex < nTabOrder) { pFindObj = pCtrlObj; } else if ((pCtrlObj->m_nTabIndex <= nTabOrder) || (pCtrlObj->m_nTabIndex > nTabOrder && pFindObj->m_nTabIndex > nTabOrder)) { if (pFindObj->m_nTabIndex < pCtrlObj->m_nTabIndex) pFindObj = pCtrlObj; } } } } return pFindObj != NULL ? pFindObj->m_pClientItem : NULL; }
void OrbLogic::Update(float time_step) { //Check for orbs to delete for(int i = 0; i < active_orbs.size(); i++) { if(!active_orbs[i]->active && active_orbs[i]->state == Orb::OFFSCREEN) { delete active_orbs[i]; active_orbs.erase(active_orbs.begin() + i); } } for(int i = 0; i < active_black_orbs.size(); i++) { if(!active_black_orbs[i]->active && active_black_orbs[i]->state == Orb::OFFSCREEN) { delete active_black_orbs[i]; active_black_orbs.erase(active_black_orbs.begin() + i); } } //Updated difficulty as time goes on if( difficulty_timer.seconds() >= 100) { black_orbs+=2; difficulty_timer.reset(); } //Decides when to add new orbs every 10 seconds if(logic_timer.seconds() >= 10) { if(random.rand_lt(5) > 0 ) { //80% of the time send out reds active_orbs.push_back( new Orb(Orb::RED, GetStartPosition())); active_orbs.push_back(new Orb(Orb::RED, GetStartPosition())); active_orbs.push_back(new Orb(Orb::RED, GetStartPosition())); } if(random.rand_lt(2)) { //50% of the time send out greens active_orbs.push_back(new Orb(Orb::GREEN, GetStartPosition())); active_orbs.push_back(new Orb(Orb::GREEN, GetStartPosition())); } if(random.rand_lt(3) == 1) { //30% of the time send out blues active_orbs.push_back(new Orb(Orb::BLUE, GetStartPosition())); } if(active_black_orbs.size() < black_orbs) { int orbs_needed = black_orbs - active_black_orbs.size(); for(int i = 0; i <orbs_needed; i++) { active_black_orbs.push_back(new Orb(Orb::BLACK, GetStartPosition())); } } logic_timer.reset(); } for(int i = 0; i < active_orbs.size(); i++) { active_orbs[i]->Update(time_step); } for(int i = 0; i < active_black_orbs.size(); i++) { active_black_orbs[i]->Update(time_step); } }
void CMapFunctionProperties::PrintMap() { CMainFrame* pMainFrame = (CMainFrame*)::AfxGetMainWnd(); CObject *pNext; CFunctionProperties *pCurrent = NULL; POSITION pos; TCHAR buffer[8]; if( GetCount() == 0 ) { pMainFrame->m_wndOutputTabView.AddMsg1(_T("FunctionProperties Map is Empty")); } else { pMainFrame->m_wndOutputTabView.AddMsg1(_T("*** FUNCTION PROPERTIES MAP ***")); pos = GetStartPosition(); while( pos != NULL ) { CString ref = _T("REF_"); CString strItem = _T("ITEM_"); CString strFile = _T("FILE_"); CString strPath = _T("PATH_"); CString strLang = _T("LANG"); CString strRType = _T("RETURN_TYPE"); GetNextAssoc(pos, ref, pNext); pCurrent = (CFunctionProperties *) pNext; pMainFrame->m_wndOutputTabView.AddMsg1(ref); HTREEITEM hItem = pCurrent->getItem(); int item = (int )hItem; strItem += _itot( item, buffer, 10 ); pMainFrame->m_wndOutputTabView.AddMsg1(strItem); strFile += (const TCHAR *)pCurrent->getFile(); pMainFrame->m_wndOutputTabView.AddMsg1(strFile); strPath += (const TCHAR *)pCurrent->getPath(); pMainFrame->m_wndOutputTabView.AddMsg1(strPath); int lang = pCurrent->getLanguage(); strLang = _itot( lang, buffer, 10 ); pMainFrame->m_wndOutputTabView.AddMsg1(strLang); int rtype = pCurrent->getReturnType(); strRType = _itot( rtype, buffer, 10 ); pMainFrame->m_wndOutputTabView.AddMsg1(strRType); pMainFrame->m_wndOutputTabView.AddMsg1(_T("************************")); } } }
void SubRectAllocator::GetRect(CRect& rect, const Subtitle* s, const Align& align, int tlb, int brb) { SubRect sr(rect, s->m_layer); sr.rect.InflateRect(tlb, tlb, brb, brb); StringMapW<SubRect>::CPair* pPair = Lookup(s->m_name); if(pPair && pPair->m_value.rect != sr.rect) { RemoveKey(s->m_name); pPair = NULL; } if(!pPair) { bool vertical = s->m_direction.primary == _T("down") || s->m_direction.primary == _T("up"); bool fOK = false; while(!fOK) { fOK = true; POSITION pos = GetStartPosition(); while(pos) { const SubRect& sr2 = GetNextValue(pos); if(sr.layer == sr2.layer && !(sr.rect & sr2.rect).IsRectEmpty()) { if(vertical) { if(align.h < 0.5) { sr.rect.right = sr2.rect.right + sr.rect.Width(); sr.rect.left = sr2.rect.right; } else { sr.rect.left = sr2.rect.left - sr.rect.Width(); sr.rect.right = sr2.rect.left; } } else { if(align.v < 0.5) { sr.rect.bottom = sr2.rect.bottom + sr.rect.Height(); sr.rect.top = sr2.rect.bottom; } else { sr.rect.top = sr2.rect.top - sr.rect.Height(); sr.rect.bottom = sr2.rect.top; } } fOK = false; } } } SetAt(s->m_name, sr); rect = sr.rect; rect.DeflateRect(tlb, tlb, brb, brb); } }
llvm::Value *Sorter::GetNumberOfStoredTuples(CodeGen &codegen, llvm::Value *sorter_ptr) const { // TODO: util::Sorter has a function to handle this ... llvm::Value *start_pos = GetStartPosition(codegen, sorter_ptr); llvm::Value *end_pos = GetEndPosition(codegen, sorter_ptr); llvm::Value *tuple_size = codegen->CreateZExt(GetTupleSize(codegen), codegen.Int64Type()); llvm::Value *diff_bytes = codegen->CreatePtrDiff(end_pos, start_pos); llvm::Value *num_tuples = codegen->CreateUDiv(diff_bytes, tuple_size); return codegen->CreateTruncOrBitCast(num_tuples, codegen.Int32Type()); }
void FreeAllEntries() { POSITION pos = GetStartPosition(); void *p, *pp; while (pos) { GetNextAssoc(pos, p, pp); if (p == pp) free(p); else FailCase("ERROR: freeing invalid pointer %p\n", p); } }
//-------------------------------------------------------------------------------- bool CFileIndexObjMap::Write(CFile& file) { DWORD nPos; bool bPosOk = false; bool bRv = true; POSITION pos = GetStartPosition(); TRY { nPos = file.GetPosition(); bPosOk = true; DWORD nNum = 'CMAP'; file.Write(&nNum, sizeof(nNum)); nNum = GetCount(); file.Write(&nNum, sizeof(nNum)); } CATCH_ALL(e) { bRv = false; pos = NULL; } END_CATCH_ALL; while(pos != NULL) TRY { LPCTSTR pKey; CFileIndexObject* pObj; GetNextAssoc(pos, pKey, pObj); if(pObj == NULL) THROW(new CException); pObj->Write(file, false); } CATCH_ALL(e) { bRv = false; break; } END_CATCH_ALL; if(bPosOk && ! bRv) TRY { file.Seek(nPos, CFile::begin); } CATCH_ALL(e) { } END_CATCH_ALL; return bRv; }
void CTypeLibCacheMap::RemoveAll(void* pExcept) { POSITION pos = GetStartPosition(); void* pTypeLibID; CTypeLibCache* pCache; while (pos != NULL) { GetNextAssoc(pos, pTypeLibID, (void*&)pCache); if (pCache != pExcept) delete pCache; } }
CConnectionPoint::~CConnectionPoint() { POSITION pos = GetStartPosition(); while (pos != NULL) { LPUNKNOWN pUnk = GetNextConnection(pos); ASSERT(pUnk != NULL); pUnk->Release(); } if (m_pConnections != NULL) delete m_pConnections; }
Item::Item(ItemColor c, Type t) :speed(200.0f), gravity(500.0f), size(32.0f,32.0f), velocity(0,0), active(true), activate_gravity(true), done(false) { color = c; type = t; state = COLLECTABLE; position = GetStartPosition(); current = new Rect(position.x,position.y,size.i,size.j); previous = new Rect(position.x,position.y,size.i,size.j); life_time.start(); }
void CCSRegionsMap::cleanup() { CCSRegions* pRegions = NULL; UINT key = 0; POSITION pos = GetStartPosition(); while (pos) { GetNextAssoc(pos, key, pRegions); pRegions->RemoveAll(); delete pRegions; pRegions = NULL; } RemoveAll(); }