本文整理汇总了C++中CObArray::GetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ CObArray::GetSize方法的具体用法?C++ CObArray::GetSize怎么用?C++ CObArray::GetSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CObArray
的用法示例。
在下文中一共展示了CObArray::GetSize方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ArrangeWindowsInWindow
//--------------------------------------------------------------------------------
void ArrangeWindowsInWindow (CWnd * pParentWnd, CObArray & arrWnd, DWORD dwOrient)
// Arranges the windows within the rectangle of another window.
//--------------------------------------------------------------------------------
{
if (arrWnd.GetSize() == 0) // no windows to size.. do nothing
return;
CRect ClientRect;
pParentWnd->GetClientRect(&ClientRect);
CSize ParentSize = ClientRect.Size();
if (ParentSize.cy == 0)
return; // no height => not much we can do
CObList SpcList; // list used to keep track of window spacing
// add initial Arrange rectangle to the list;
CWndSpaceElt * pSpcElt = new CWndSpaceElt;
pSpcElt->wd = 0;
pSpcElt->ht = ClientRect.Height();
SpcList.AddTail(pSpcElt);
// sort array of window positions by size so that we position the largest windows first.
// this improves the results quite a bit
CObject ** pArrData = arrWnd.GetData();
ASSERT(pArrData != NULL); // shouldn't be NULL as array is non-empty, but check anyway
qsort(pArrData, arrWnd.GetSize(), sizeof(CObject *), CompareWndRect);
HDWP hDWP = BeginDeferWindowPos(arrWnd.GetSize()); // defer window moves to save on refresh
// iterate thru all the windows in the list looking for a position to put it
for (int nWndNo = 0; nWndNo < arrWnd.GetSize(); nWndNo++)
{
CWnd * pWnd = (CWnd *)arrWnd[nWndNo];
ASSERT(pWnd != NULL);
ASSERT_VALID(pWnd);
PositionInSpcList(pWnd, SpcList, dwOrient, pParentWnd, ParentSize, hDWP);
}
if (hDWP != NULL)
::EndDeferWindowPos(hDWP); // move the windows
// Remove elements from the SpcList;
while (!SpcList.IsEmpty())
{
CWndSpaceElt * pElt = (CWndSpaceElt *) SpcList.GetTail();
delete pElt;
SpcList.RemoveTail();
}
}
示例2: GetArray
void CObBinTree::GetArray( CObArray& array )
{
array.SetSize( 0 );
WalkTree( StoreInArray, (LPVOID)&array, TV_INORDER );
ASSERT( array.GetSize()==GetCount() );
}
示例3: ExtendLoopByPriority
// 算法2.4:链条扩展算法
void CFaceIdentification::ExtendLoopByPriority()
{
CObArray extdLoopArr;
m_pFLPool->GetExtendLoopsByPriority(extdLoopArr);
if (extdLoopArr.GetSize() == 0) {
// Do partition
CFaceClipping::BodyPartition(&(m_pFLPool->m_faceLoopArray), m_pAsmbBody);
CFaceClipping::BodyRestCopy(&(m_pFLPool->m_loopArray), m_pAsmbBody);
return;
}
// 搜索得到所有扩展对的类型:Merg1,Thrd2和Math3
CP_ParaLoopsGroupsArr * plgArr = m_pFLPool->GetExtendLoopPair(extdLoopArr);
extdLoopArr.RemoveAll();
if(plgArr == NULL)
return TopologyDeduce();
CP_ParallelLoopsGroup * bestParaGroup = *(std::max_element(plgArr->begin(), plgArr->end(), CP_ParallelLoopsGroup::CompareTo));
m_pFLPool->ConnectLoop((CP_LoopExt *&)bestParaGroup->loopExtd,
(CP_LoopExt *&)bestParaGroup->loopNext, (CP_LoopExt *&)bestParaGroup->loopRest, m_pAsmbBody);
DeleteParaLoopsGroupsArr(plgArr);
TopologyDeduce();
}
示例4: CalcLoopAdjFaceNum
// 合并之后重新计算loop的邻接优先级
void CP_LoopExt::CalcLoopAdjFaceNum()
{
CObArray tmpAdjLoopArr;
int halfSize = GetHalfNumber();
for(int i = 0; i < halfSize; i++)
{
CP_LoopExt * adjLoop = (CP_LoopExt *)GetHalf(i)->m_pTwin->m_pLoop;
if(adjLoop->m_adjFaceNum != -1) continue;
int j;
for (j = 0; j < tmpAdjLoopArr.GetSize(); ++j) {
if (tmpAdjLoopArr[j] == adjLoop)
break;
}
if (j == tmpAdjLoopArr.GetSize()) tmpAdjLoopArr.Add(adjLoop);
}
m_adjFaceNum = tmpAdjLoopArr.GetSize();
tmpAdjLoopArr.RemoveAll();
}
示例5: SyncServerConnections
/**
* SyncServerConnections
*
*/
void CFtpManager::SyncServerConnections()
{
CConnectionManager connectionManager;
connectionManager.Load();
CObArray * listOfConnections;
listOfConnections = connectionManager.GetConnections();
int i = 0;
for(i = 0; i < listOfConnections->GetSize(); i++){
CConnection * con = (CConnection *)listOfConnections->GetAt(i);
if(con->host.GetLength() > 0)
{
SyncServerConnection(con);
}
}
}
示例6: OnExecuteComplete
LRESULT CSessionWnd::OnExecuteComplete(WPARAM wParam, LPARAM lParam)
{
WFSRESULT *pResult = (WFSRESULT *)lParam;
// finding serviceBasic
CServiceBasic *pServiceBasic = 0;
for(long i=0; i<g_arrayService.GetSize(); i++)
{
pServiceBasic = (CServiceBasic *)g_arrayService.GetAt(i);
if(pServiceBasic->m_nRequestedID == pResult->RequestID)
{
pServiceBasic->m_hResult = pResult->hResult;
*pServiceBasic->m_lppResult = pResult;
break;
}
pServiceBasic = 0;
}
if(pServiceBasic) pServiceBasic->m_nRequestedID = 0;
if(pServiceBasic) pServiceBasic->m_eventExecute.SetEvent();
return 0;
}
示例7: CAge
CObArray arr;
CAge* pa1;
CAge* pa2;
arr.Add(pa1 = new CAge(21)); // Element 0
arr.Add(pa2 = new CAge(40)); // Element 1
ASSERT(arr.GetSize() == 2);
arr.RemoveAll(); // Pointers removed but objects not deleted.
ASSERT(arr.GetSize() == 0);
delete pa1;
delete pa2; // Cleans up memory.
示例8: DeleteArray
void CHTMLFont::DeleteArray(CObArray & arrArray)
{
for ( int nObj=0; nObj < arrArray.GetSize(); nObj++)
delete (CHTMLFont *) arrArray[nObj];
arrArray.RemoveAll();
}
示例9: OnCreate
//.........这里部分代码省略.........
//m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT));
// TODO: Delete these five lines if you don't want the toolbar and menubar to be dockable
//m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY);
//m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY); // required or won't show toolbar
DockPane(&m_wndMenuBar);
//DockPane(&m_wndToolBar);
DockPane(&m_headerDoc);
// Bottom pane
//m_footerPane.EnableDocking(CBRS_ALIGN_BOTTOM);
//DockPane(&m_footerPane, AFX_IDW_DOCKBAR_BOTTOM);
//m_wndToolBar.ShowPane(SW_SHOW,0,0);
//m_wndToolBar.SetWi
// enable Visual Studio 2005 style docking window behavior
//CDockingManager::SetDockingMode(DT_SMART);
// enable Visual Studio 2005 style docking window auto-hide behavior
EnableAutoHidePanes(CBRS_ALIGN_ANY);
// Enable toolbar and docking window menu replacement
//EnablePaneMenu(TRUE, ID_VIEW_CUSTOMIZE, strCustomize, ID_VIEW_TOOLBAR);
// enable quick (Alt+drag) toolbar customization
//CMFCToolBar::EnableQuickCustomization();
if (CMFCToolBar::GetUserImages() == NULL)
{
// load user-defined toolbar images
if (m_UserImages.Load(_T(".\\UserImages.bmp")))
{
CMFCToolBar::SetUserImages(&m_UserImages);
}
}
// enable menu personalization (most-recently used commands)
// TODO: define your own basic commands, ensuring that each pulldown menu has at least one basic command.
CList<UINT, UINT> lstBasicCommands;
lstBasicCommands.AddTail(ID_APP_EXIT);
lstBasicCommands.AddTail(ID_EDIT_CUT);
lstBasicCommands.AddTail(ID_EDIT_PASTE);
lstBasicCommands.AddTail(ID_EDIT_UNDO);
lstBasicCommands.AddTail(ID_APP_ABOUT);
lstBasicCommands.AddTail(ID_VIEW_STATUS_BAR);
//CMFCToolBar::SetBasicCommands(lstBasicCommands);
// Display New Connection Dialog if no connections exist
m_connectionManager.Load();
CObArray * listOfConnections;
listOfConnections = m_connectionManager.GetConnections();
int connectionCount = listOfConnections->GetSize();
if(connectionCount == 0)
{
PostMessage( WM_COMMAND, ID_NEW_CONNECTION_MENU_ITEM, 0 );
}
// Start sync thread
//
//m_ftpManager.SyncServerConnections();
THREADPARAM * _param = new THREADPARAM;
_param->m = this;
// THREAD_PRIORITY_IDLE THREAD_PRIORITY_LOWEST
m_pFtpSyncThread = AfxBeginThread(CMainFrame::FtpSyncWorker, &_param, THREAD_PRIORITY_LOWEST); //, THREAD_PRIORITY_NORMAL, 0, CREATE_SUSPENDED);
if (m_pFtpSyncThread != NULL)
{
//TRACE(_T("AfxBeginThread: 0x%08lX\n"), m_pFtpSyncThread->m_nThreadID);
}
// Start Ad manager
//m_wndMenuBar.m_ad = m_ad;
//m_ad.Start();
// Create tray icon.
LoadTrayIcon();
// Check for an update
CUpgrade update;
update.CheckForUpgrade();
// Hostory
m_historyDlg = new CHistoryDialog(this);
m_historyDlg->Create(CHistoryDialog::IDD, GetDesktopWindow());
// Registry - GUID
//CRegistry reg;
//bool p = reg.IsPurchased();
//reg.Purchase();
//p = reg.IsPurchased();
//CString guid(_T(""));
//reg.GetGUID(guid);
return 0;
}
示例10: OnLoadUrl
/**
* OnLoadUrl
*
* Description: Load a url into the view
*
* Parameters: wparam: - 0 = no callback, 1 = yes callback
* lparam: CString url path
*/
LRESULT CMainFrame::OnLoadUrl(WPARAM wParam, LPARAM lParam)
{
CConnectionListView * connectionView = (CConnectionListView *)m_mainSplitter.GetPane(0,0);
CFileListView * fileListView = (CFileListView *)m_mainSplitter.GetPane(0,1);
CString * urlArg = (CString*)lParam;
if(urlArg){
TRACE1(" Load url: %s \n", urlArg->AllocSysString());
CString url(urlArg->AllocSysString());
delete urlArg;
CString host(_T(""));
CString dir(_T(""));
// Parse
if(url.Find(_T("ftp://")) != -1){
url = url.Mid(url.Find(_T("ftp://")) + 6, url.GetLength() - url.Find(_T("ftp://")));
}
int pos = url.Find('/');
if(pos != -1){
host = url.Mid(0, pos);
dir = url.Mid(pos, url.GetLength() - pos);
} else {
host = CString(url);
dir = CString(_T("/"));
}
// select connection
int connection_id = -1;
CObArray * listOfConnections;
listOfConnections = m_connectionManager.GetConnections();
int i = 0;
for(i = 0; i < listOfConnections->GetSize(); i++){
CConnection * con = (CConnection *)listOfConnections->GetAt(i);
if(con->host.Compare(host) == 0){
connection_id = i;
connectionView->SelectConnection(connection_id);
}
}
// Prompt for new connection information
if(connection_id < 0){
CConnectionDialog dlg;
dlg.SetHost(host); // prefill in host
dlg.DoModal();
// Update view with updated connections
connectionView->UpdateConnections();
// Re check host in connections
m_connectionManager.Load();
listOfConnections = m_connectionManager.GetConnections();
int i = 0;
for(i = 0; i < listOfConnections->GetSize(); i++){
CConnection * con = (CConnection *)listOfConnections->GetAt(i);
if(con->host.Compare(host) == 0){
connection_id = i;
connectionView->SelectConnection(connection_id);
}
}
if(connection_id < 0){
return 1; // No connection entered, abort
}
}
// Load file list view
fileListView->LoadServerConnection(connection_id);
fileListView->LoadDirectory(dir);
// Load url in header history.
if(m_headerDoc && ((int)wParam) == 1){
m_headerDoc.SetUrl( CString(host + dir) );
m_headerDoc.SetConnectionID(connection_id);
m_headerDoc.m_path = CString(dir); // This needs work
CFileListView * v = (CFileListView *)m_mainSplitter.GetPane(0,1);
m_headerDoc.m_path = CString(v->GetPath());
}
// Cleanup
delete urlArg;
}
return 1;
}
示例11: WorkerThread
// **************************************************************************
// WorkerThread ()
//
// Description:
// Worker thread function.
//
// Parameters:
// void *pvArgs Pointer to a WORKERTHREADARG structure which
// describes task to be performed.
//
// Returns:
// unsigned int - 0
// **************************************************************************
unsigned _stdcall CKDocument::WorkerThread (void *pvArgs)
{
// Cast argument to proper type so we can extract the required data
// about the task we are to perform:
WORKERTHREADARG *pWTA = (WORKERTHREADARG *)pvArgs;
ASSERT (pWTA);
// Execute specified task:
switch (pWTA->eTask)
{
case WORKERTHREADARG::START_SINGLE_SERVER:
case WORKERTHREADARG::STOP_SINGLE_SERVER:
{
// Extract pointer to server we are to start or stop from
// argument structure:
CKServer *pServer = (CKServer *)pWTA->pvObjectA;
ASSERT (pServer);
// Start or stop the server as the case may be:
if (pWTA->eTask == WORKERTHREADARG::START_SINGLE_SERVER)
pServer->Start ();
else
pServer->Stop ();
}
break;
case WORKERTHREADARG::START_MULTIPLE_SERVER:
case WORKERTHREADARG::STOP_MULTIPLE_SERVER:
{
// Extract the list (object array) of servers to start or stop
// from argument structure:
CObArray *pList = (CObArray *)pWTA->pvObjectA;
ASSERT (pList);
// Get the number of server in the list:
int cnServers = pList->GetSize ();
CKServer *pServer = NULL;
// Loop over the servers in the list:
while (--cnServers >= 0)
{
// Get pointer to next server in list:
pServer = (CKServer *) pList->GetAt (cnServers);
ASSERT (pServer);
// Start or stop that server as the case may be:
if (pWTA->eTask == WORKERTHREADARG::START_MULTIPLE_SERVER)
pServer->Start ();
else
pServer->Stop ();
}
}
break;
case WORKERTHREADARG::ADD_ITEMS:
{
// Extract the list (object array) of items to add from
// argument structure:
CObArray *pList = (CObArray *)pWTA->pvObjectA;
ASSERT (pList);
// Extract the number of items from the argument structure:
int cnItems = *(int *)pWTA->pvObjectB;
// Get pointer to first item from list. We will use it to
// get the group object these items will be added to:
CKItem *pItem = (CKItem *)pList->GetAt (0);
ASSERT (pItem);
// Get group that we are adding the items to:
CKGroup *pGroup = pItem->GetParentGroup ();
ASSERT (pGroup);
// Add the items to this group:
pGroup->AddItems (*pList, cnItems);
}
break;
default:
// unhandled task ?
ASSERT (FALSE);
break;
}
return (0);
}
示例12: DoImportLibrary
void CDialogPlacePart::DoImportLibrary()
{
CDraftDrawDoc *pDoc = theApp.GetActiveDocument();
std::wstring sFilter = _T("External library file (*.xml)|*.xml||");//All Files (*.*)|*.*||;
CStringArray saExtensions;
saExtensions.Add(_T("xml"));
CFileDialog fdialog(
TRUE, //save dialog box
NULL,
NULL,
0, //no flags
sFilter.c_str(),
NULL);
if (fdialog.DoModal() == IDOK){
//Get filename from dialog
int offset = fdialog.m_ofn.nFileExtension;
CString strFile = fdialog.m_ofn.lpstrFile;
int nFilterIndex = fdialog.m_ofn.nFilterIndex;
if ((!offset) || (fdialog.m_ofn.lpstrFile[offset] == 0)){
strFile += _T(".") + saExtensions[fdialog.m_ofn.nFilterIndex - 1];
sFilter = saExtensions[fdialog.m_ofn.nFilterIndex - 1];
}
//Try to import library
CImporter *pImporter = new CImporter();
CObArray *pObArray = new CObArray();
pImporter->ImportLibrary(strFile, pObArray, pDoc->m_szGrid);
//Create new library
CString strLib = strFile.Left(strFile.ReverseFind('.'));
if (strLib.ReverseFind(_T('\\')) >= 0){
strLib = strLib.Right(strLib.GetLength() - strLib.ReverseFind(_T('\\')) - 1);
}
if (strLib.GetLength() == 0) strLib = strFile;
DoInsertNewLibrary(strLib, TRUE);
//Iterate all shapes to bounding rect union
CRect rectUnion;
for (int i = 0; i < pObArray->GetSize(); i++){
CShapeUnit *pSh = (CShapeUnit *)pObArray->GetAt(i);
CRect rect;
pSh->GetRectTemp(rect);
TRACE(_T("Importing part %s.\n"),(LPCTSTR)(pSh->m_sUnitName));
//rectUnion.UnionRect(rectUnion, rect);
if (rect.Width()>rectUnion.Width()){
rectUnion = CRect(CPoint(0, 0), CSize(rect.Width(), rectUnion.Height()));
}
if (rect.Height()>rectUnion.Height()){
rectUnion = CRect(CPoint(0, 0), CSize(rectUnion.Width(), rect.Height()));
}
}
//rectUnion.InflateRect(DCABLE_PADDINGX_DEFAULT << 1, DCABLE_PADDINGY_DEFAULT << 1);
rectUnion.InflateRect(DCABLE_GRIDX_DEFAULT, DCABLE_GRIDY_DEFAULT);
CSize size=rectUnion.Size();
rectUnion = CRect(CPoint(0, 0), rectUnion.Size());
//Insert/update parts
for (int i = 0; i<pObArray->GetSize(); i++){
//Insert part
CShapeUnit *pSh = (CShapeUnit *)pObArray->GetAt(i);
//Do insert in librarry
DoInsertPart(pSh->m_sUnitName);
//Get bounding rect
CRect rectTemp;
pSh->GetRectTemp(rectTemp);
((CShapeFrmRect*)pSh->m_obarrShapearr[0])->m_Rect = rectUnion;
CPoint offset = CPoint((rectUnion.Width() - rectTemp.Width()) >> 1, (rectUnion.Height() - rectTemp.Height()) >> 1);
//Call a method to normalize ShapeUnit from bounding rect TopLeft to (0,0) or any other offset
//pSh->NormalizeChildShapes(CPoint(DCABLE_PADDINGX_DEFAULT, DCABLE_PADDINGY_DEFAULT));
pSh->NormalizeChildShapes(offset);
//Save parts
//Create new method in CDocument to be called from here and serialize the parts
CString strFile = pSh->m_sUnitName;
//Keep previous part edition status
BOOL bFlagPartEdit = pDoc->m_bFlagPartEdit;
//Set part edition mode to save the save
pDoc->m_bFlagPartEdit = TRUE;
CObArray* prevObArray = pDoc->m_pObArray;
pDoc->m_pObArray = &pSh->m_obarrShapearr;
pDoc->OnDatabaseSave(strLib + _T(".") + strFile);
pDoc->m_pObArray = prevObArray;
//Restore flag
pDoc->m_bFlagPartEdit = bFlagPartEdit;
}
}//End dialog result OK