本文整理汇总了C++中CArray::GetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ CArray::GetSize方法的具体用法?C++ CArray::GetSize怎么用?C++ CArray::GetSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CArray
的用法示例。
在下文中一共展示了CArray::GetSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnDeleteSeries
void SeriesListCtrl::OnDeleteSeries()
{
POSITION pos=GetFirstSelectedItemPosition(); bool upd=false; void *x;
if(pos)
{
CArray<int,const int&> ToDel; int i; CString temp;
while(pos) ToDel.Add(GetItemData(GetNextSelectedItem(pos)));
qsort(ToDel.GetData(),ToDel.GetSize(),sizeof(int),compfunc);
for(i=0;i<ToDel.GetSize();i++)
{
int n=ToDel[i];
temp.Format("Series %s contains %d points. Remove it?",Items[n].Name,Items[n].Size);
if(AfxMessageBox(temp,MB_YESNO)==IDNO) ToDel[i]=-1;
}
if((x=Series->GainAcsess(WRITE))!=0)
{
upd=true;
SeriesProtector Protector(x); TSeriesArray& Series(Protector);
{
for(i=0;i<ToDel.GetSize();i++)
if(ToDel[i]>=0) Series.DeleteItem(ToDel[i]);
}
}
if(upd) UpdateSeriesList();
}
}
示例2: AddMissingFile
void CTemplateParserApp::AddMissingFile(CString csFile)
{
// unfortunately doesn't work: as FileExists() doesn't work
char szFileName[MAX_PATH*2];
strcpy (szFileName, (LPCTSTR)csFile);
CArray<CString, CString> nonExistant;
char *szSuffix = strrchr(szFileName, '\\');
while(NULL != szSuffix && !FileExists(szFileName))
{
// there must be at least one \ remaining in szFile (i.e. c:\)
CString csNono(szFileName);
// TODO: Wie geht denn das hier mit der Speicherverwaltung??
// Diese Variable ist doch nur auf dem Stack.
nonExistant.Add(csNono);
szSuffix[0] = '\0';
szSuffix = strrchr(szFileName, '\\');
}
if (nonExistant.GetSize() > 0)
{
for (int i=nonExistant.GetSize()-1; i>=0; --i)
{
m_writtenFiles.Add(nonExistant[i]);
// it is important that them are added in reverse order
// so that created directories are before the contained files
}
}
}
示例3: OnViewShowunknown
void CDirstatDoc::OnViewShowunknown()
{
CArray<CItem *, CItem *> drives;
GetDriveItems(drives);
if (m_showUnknown)
{
for (int i=0; i < drives.GetSize(); i++)
{
CItem *unknown= drives[i]->FindUnknownItem();
ASSERT(unknown != NULL);
if (GetSelection() == unknown)
SetSelection(unknown->GetParent());
if (GetZoomItem() == unknown)
m_zoomItem= unknown->GetParent();
drives[i]->RemoveUnknownItem();
}
m_showUnknown= false;
}
else
{
for (int i=0; i < drives.GetSize(); i++)
drives[i]->CreateUnknownItem();
m_showUnknown= true;
}
if (drives.GetSize() > 0)
SetWorkingItem(GetRootItem());
UpdateAllViews(NULL);
}
示例4: OnDrawFace
void CSkyODL::OnDrawFace( Gdiplus::Graphics& gcDrawer, float fScale )
{
CBaseODL::OnDrawFace(gcDrawer, fScale);
Gdiplus::Pen Dot( m_clDotColor, static_cast<Gdiplus::REAL>(1.0 / fScale));
CArray<Gdiplus::Point> st;
CArray<BYTE> stBytes;
for (auto& curItem : m_arrTopPoint)
{
Gdiplus::Point pt;
pt.X = static_cast<INT>(curItem.X());
pt.Y = static_cast<INT>(-curItem.Z());
st.Add(pt);
}
if(st.GetSize()<=0)
{
return;
}
Gdiplus::Pen pen( m_clPenColor, static_cast<Gdiplus::REAL>(1.0 / fScale));
pen.SetDashStyle(Gdiplus::DashStyleSolid);
Gdiplus::HatchBrush brush( Gdiplus::HatchStyle(Gdiplus::HatchStyle::HatchStyleCross ), m_clPenColor, Gdiplus::Color(0,255,255,255) );
//画皮肤
gcDrawer.FillPolygon(&brush, st.GetData(), st.GetSize(), Gdiplus::FillMode::FillModeAlternate);
gcDrawer.DrawLines(&pen, st.GetData(), st.GetSize());
}
示例5: OnRemoveUI
void CUIDesignerView::OnRemoveUI()
{
CArray<CControlUI*,CControlUI*> arrSelected;
m_MultiTracker.GetSelected(arrSelected);
//remove form
for (int i=0; i<arrSelected.GetSize(); i++)
{
CControlUI* pControl = arrSelected[i];
if(pControl == m_LayoutManager.GetForm())
{
arrSelected.RemoveAt(i);
break;;
}
}
m_UICommandHistory.Begin(arrSelected, actionDelete);
for(int i=0; i<arrSelected.GetSize(); i++)
{
CControlUI* pControl = arrSelected[i];
CControlUI* pParent=pControl->GetParent();
HTREEITEM hDelete=(HTREEITEM)(((ExtendedAttributes*)pControl->GetTag())->hItem);
g_pClassView->RemoveUITreeItem(hDelete);
RemoveUI(pControl);
if(pParent)
pParent->NeedUpdate();
}
m_UICommandHistory.End();
g_pPropertiesWnd->HideAllProperties(TRUE,TRUE);
m_MultiTracker.RemoveAll();
}
示例6: get_port_num
int get_port_num()
{
USES_CONVERSION;
int com_num = 0;
int m_nSerialPortNum(0);// 串口计数
CString strSerialList[256]; // 临时定义 256 个字符串组
CArray<SSerInfo, SSerInfo&> asi;
EnumSerialPorts(asi,TRUE);// TRUE 时枚举当前可以打开的串口, FALSE 枚举所有串口
m_nSerialPortNum = asi.GetSize();
for (int i = 0; i<asi.GetSize(); i++)
{
CString str = asi[i].strFriendlyName;
string com_port_str = W2A(str);
if (!strncmp(com_port_str.c_str(), "USB Serial", 10))
{
CString str1 = str;
int npos_head = str1.Find(L"COM"); //not find return -1 else return 0
if (npos_head > -1)
{
npos_head = npos_head + 3;
}
int npos_end = str1.Find(')');
if (npos_end > -1)
{
}
CString str2 = str1.Mid(npos_head, npos_end - npos_head);
com_num = atoi(W2A(str2));
break;
}
}
return com_num;
}
示例7: GetPages
void CPageStream::GetPages(CArray<CPage *, CPage *> &pages, int fromMsec, int toMsec, int offset, int &firstPos, int &lastPos)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
if (m_pageArray.GetSize() <= 0)
return;
bool isFirst = true;
for (int i = 0; i < m_pageArray.GetSize(); ++i)
{
CPage *page = m_pageArray[i];
if (page &&
((page->GetEnd() + offset > fromMsec && page->GetEnd() + offset <= toMsec) ||
(page->GetBegin() + offset >= fromMsec && page->GetBegin() + offset < toMsec) ||
(page->GetBegin() + offset < fromMsec && page->GetEnd() + offset > toMsec)))
{
CPage *newPage = page->Copy(true);
if (newPage)
{
newPage->SetBegin(newPage->GetBegin() + offset);
newPage->SetEnd(newPage->GetEnd() + offset);
pages.Add(newPage);
if (isFirst)
firstPos = pages.GetSize() - 1;
isFirst = false;
}
}
}
// at least one page is inserted
if (!isFirst)
lastPos = pages.GetSize() - 1;
}
示例8: LoadPersistentAttributes
void CSortingListControl::LoadPersistentAttributes()
{
CArray<int, int> arr;
arr.SetSize(GetHeaderCtrl()->GetItemCount());
GetColumnOrderArray(arr.GetData(), arr.GetSize());
CPersistence::GetColumnOrder(m_name, arr);
SetColumnOrderArray(arr.GetSize(), arr.GetData());
for (int i=0; i < arr.GetSize(); i++)
arr[i]= GetColumnWidth(i);
CPersistence::GetColumnWidths(m_name, arr);
for (i=0; i < arr.GetSize(); i++)
{
// To avoid "insane" settings we set the column width to
// maximal twice the default width.
int maxWidth= GetColumnWidth(i) * 2;
int w= min(arr[i], maxWidth);
SetColumnWidth(i, w);
}
// Not so good: CPersistence::GetSorting(m_name, GetHeaderCtrl()->GetItemCount(), m_sorting.column1, m_sorting.ascending1, m_sorting.column2, m_sorting.ascending2);
// We refrain from saving the sorting because it is too likely, that
// users start up with insane settings and don't get it.
}
示例9: OnViewShowfreespace
void CDirstatDoc::OnViewShowfreespace()
{
CArray<CItem *, CItem *> drives;
GetDriveItems(drives);
if (m_showFreeSpace)
{
for (int i=0; i < drives.GetSize(); i++)
{
CItem *free= drives[i]->FindFreeSpaceItem();
ASSERT(free != NULL);
if (GetSelection() == free)
SetSelection(free->GetParent());
if (GetZoomItem() == free)
m_zoomItem= free->GetParent();
drives[i]->RemoveFreeSpaceItem();
}
m_showFreeSpace= false;
}
else
{
for (int i=0; i < drives.GetSize(); i++)
drives[i]->CreateFreeSpaceItem();
m_showFreeSpace= true;
}
if (drives.GetSize() > 0)
SetWorkingItem(GetRootItem());
UpdateAllViews(NULL);
}
示例10: ConvertReceivedDataToString
CString ConvertReceivedDataToString(CByteArray & data)
{
// data is UTF-8 encoded
CArray<WCHAR, WCHAR> wc;
// First, compute the amount of space required. n will include the
// space for the terminal NUL character
INT_PTR n = ::MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)data.GetData(), (int)data.GetSize(), NULL, 0);
if(n == 0)
{ /* failed */
DWORD err = ::GetLastError();
TRACE(_T("%s: MultiByteToWideChar (1) returned error %d\n"), AfxGetApp()->m_pszAppName, err);
return CString(_T(""));
} /* failed */
else
{ /* success */
wc.SetSize(n);
n = ::MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)data.GetData(), (int)data.GetSize(), (LPWSTR)wc.GetData(), (int)n);
if(n == 0)
{ /* failed */
DWORD err = ::GetLastError();
TRACE(_T("%s: MultiByteToWideChar (2) returned error %d\n"), AfxGetApp()->m_pszAppName, err);
return CString(_T(""));
} /* failed */
} /* success */
// Data is now in Unicode
// If we are a Unicode app we are done
// If we are an ANSI app, convert it back to ANSI
#ifdef _UNICODE
// If this is a Unicode app we are done
return CString(wc.GetData(), (int)wc.GetSize());
#else // ANSI
// Invert back to ANSI
CString s;
n = ::WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)wc.GetData(), (int)wc.GetSize(), NULL, 0, NULL, NULL);
if(n == 0)
{ /* failed */
DWORD err = ::GetLastError();
TRACE(_T("%s: WideCharToMultiByte (1) returned error %d\n"), AfxGetApp()->m_pszAppName, err);
return CString("");
} /* failed */
else
{ /* success */
LPSTR p = s.GetBuffer((int)n);
n = ::WideCharToMultiByte(CP_ACP, 0, wc.GetData(), (int)wc.GetSize(), p, (int)n, NULL, NULL);
if(n == 0)
{ /* conversion failed */
DWORD err = ::GetLastError();
TRACE(_T("%s: WideCharToMultiByte (2) returned error %d\n"), AfxGetApp()->m_pszAppName, err);
s.ReleaseBuffer();
return CString("");
} /* conversion failed */
s.ReleaseBuffer();
return s;
} /* success */
#endif
} // ConvertReceivedDataToString
示例11: OnReadScoreFile
void CStaticDlg::OnReadScoreFile(CString pszFileName, int mode){
CStdioFile file;
CFileException e;
CFileStatus status;
if(mode != -1)
pszFileName.Format(pszFileName+("_%d"), mode);
if(CFile::GetStatus(pszFileName, status)){//파일이 존재하는 경우 읽어오기만함
if(!(file.Open(pszFileName, CFile::modeRead | CFile::shareDenyNone, &e))) {
TRACE( _T("Can't open file %s, error = %u\n"), pszFileName, e.m_cause );
return;
}
}else{//파일이 존재하지 않는다면 생성한다
if(!(file.Open(pszFileName, CFile::modeCreate | CFile::modeRead | CFile::shareDenyNone, &e))) {
TRACE( _T("Can't open file %s, error = %u\n"), pszFileName, e.m_cause );
return;
}
}
CString _buf;
CArray<Record, Record> array;
Record record;
while (file.ReadString(_buf)){
CString name, time, strHour, strMinute, strSecond, strTimeset;
name = _T("5");
int hour = _ttoi(name);
AfxExtractSubString(name, _buf, 0, ',');
AfxExtractSubString(time, _buf, 1, ',');
AfxExtractSubString(strHour, time, 0, ':');
AfxExtractSubString(strMinute, time, 1, ':');
AfxExtractSubString(strSecond, time, 2, ':');
AfxExtractSubString(strTimeset, time, 3, ':');
record = Record(name, _ttoi(strHour), _ttoi(strMinute), _ttoi(strSecond), _ttoi(strTimeset));
array.Add(record);
}
QSortCArray( array, CompareRecord );
int printSize = array.GetSize() < 5 ? array.GetSize() : 5;
for(int i=0; i< printSize; i++ )
{
CString strTemp;
strTemp.Format(_T("%d. %s (%d:%d:%d:%d) \n"), i+1, array[i].name,array[i].hour, array[i].minute, array[i].second, array[i].timeset );
if(mode == -1){
m_strRankList += strTemp;
}else{
m_strPractice += strTemp;
}
}
UpdateData(FALSE);
file.Close();
}
示例12:
// 将OpenCV图像显示到控件上
void CJudgeDlg::DrawPicture2HDC()
{
m_matImage = LoadFOVImage2Color(m_pDocument->GetDirectory(), m_nFOVIndex);
if ( !m_matImage.empty() )
{
CArray<CvRect, CvRect>* pRect;
CvRect cvRect;
CvPoint pt1, pt2;
int i;
//pRect = m_pDocument->GetTargetInfoInFOV(m_nWorkPosition, m_nFOVIndex);
//for ( i = 0; i < pRect->GetSize(); i++ )
//{
// cvRect = pRect->GetAt(i);
// pt1.x = cvRect.x;
// pt1.y = cvRect.y;
// pt2.x = cvRect.x + cvRect.width;
// pt2.y = cvRect.y + cvRect.height;
// cvRectangle(m_pcvImage, pt1, pt2, CV_RGB(255,0,0), 2, 8,0);
//}
pRect = m_pDocument->GetSimpleTargetInfoInFOV(m_nFOVIndex);
for ( i = 0; i < pRect->GetSize(); i++ )
{
cvRect = pRect->GetAt(i);
pt1.x = cvRect.x;
pt1.y = cvRect.y;
pt2.x = cvRect.x + cvRect.width;
pt2.y = cvRect.y + cvRect.height;
cv::rectangle(m_matImage, pt1, pt2, CV_RGB(255,0,0), 2, 8,0);
}
pRect = m_pDocument->GetOverlapTargetInfoInFOV( m_nFOVIndex);
for ( i = 0; i < pRect->GetSize(); i++ )
{
cvRect = pRect->GetAt(i);
pt1.x = cvRect.x;
pt1.y = cvRect.y;
pt2.x = cvRect.x + cvRect.width;
pt2.y = cvRect.y + cvRect.height;
cv::rectangle(m_matImage, pt1, pt2, CV_RGB(0,255,0), 2, 8,0);
}
UINT ID = IDC_FOV_IMAGE;
CDC *pDC = this->GetDlgItem(ID)->GetDC();
HDC hDC = pDC->GetSafeHdc();
CRect rect;
this->GetDlgItem(ID)->GetClientRect(&rect);
CMyBitmap bmp;
bmp.CopyFromMat(m_matImage);
bmp.Draw(hDC,rect,1,0,0);
ReleaseDC(pDC);
}
}
示例13: MakeShortName
void CStockManager::MakeShortName(StockUserInfo *pStock)
{
// 低位是汉字长度,高位是拼音长度
short nPyjc = 0;
CString StockName = pStock->GetName(TRUE);
StockInfoEx *pStockEx = GetStockInfoEx(&pStock->m_ciStockCode);
memcpy(&pStock->m_cShortPyjc[12], &pStockEx, sizeof(StockInfoEx *));
int i = 0;
int bufsz = 0;
CArray<CStringArray*,CStringArray*> ay;
CStringArray* pItem;
char *s = StockName.GetBuffer(StockName.GetLength());
while(i < StockName.GetLength())
{
pItem = GetPyjcByHZ(s,i);
ay.Add(pItem);
bufsz += pItem->GetSize();
if(pItem->GetSize() > 1)
bufsz++;
}
StockName.ReleaseBuffer();
if(ay.GetSize())
{
int j = 0;
pStockEx->pPyjcArray = new CString;
LPSTR pBuffer = pStockEx->pPyjcArray->GetBufferSetLength(bufsz + 1);
for(i = 0; i < ay.GetSize(); i++)
{
pItem = ay.GetAt(i);
if(pItem->GetSize() > 1)
{
pBuffer[j++] = (char)pItem->GetSize();
for(int k = 0; k < pItem->GetSize(); k++)
pBuffer[j++] = pItem->GetAt(k).GetAt(0);
}
else if(pItem->GetSize())
{
char c = pItem->GetAt(0).GetAt(0);
pBuffer[j++] = pItem->GetAt(0).GetAt(0);
}
}
pStockEx->pPyjcArray->ReleaseBuffer(j);
}
_delArrayObj(ay);
}
示例14: GetExportFunctionInfo
u32 CHookFunction_i::GetExportFunctionInfo(CArray<EXPORT_FUN_INFO, EXPORT_FUN_INFO&>& InfoArray,
const char* pszDllFile)
{
if(!pszDllFile)
{
return 0;
}
PLOADED_IMAGE pImage = ::ImageLoad((char*)pszDllFile, NULL);
if(!pImage)
{
return 0;
}
DWORD dwBase = (DWORD)pImage->MappedAddress;
PIMAGE_SECTION_HEADER pSections = (PIMAGE_SECTION_HEADER)((DWORD)pImage->FileHeader + sizeof(IMAGE_NT_HEADERS));
PIMAGE_EXPORT_DIRECTORY pExportDir = (PIMAGE_EXPORT_DIRECTORY)(RVA2RawAdr(pSections, pImage->FileHeader->OptionalHeader.DataDirectory[0].VirtualAddress) + dwBase);
InfoArray.RemoveAll();
EXPORT_FUN_INFO info;
DWORD* pFunOffsetAdr = (DWORD*)(RVA2RawAdr(pSections, pExportDir->AddressOfFunctions) + dwBase);
for(DWORD i = 0; i < pExportDir->NumberOfFunctions; i++)
{
info.dwOffset = 0;
info.strFunName = "";
info.dwOrdinal = 0;
info.dwOffset = *(pFunOffsetAdr + i);
info.dwOrdinal = i + 1;
InfoArray.Add(info);
}
DWORD* pFunNamesAdr = (DWORD*)(RVA2RawAdr(pSections, pExportDir->AddressOfNames) + dwBase);
WORD* pFunNamesOrdinalAdr = (WORD*)(RVA2RawAdr(pSections, pExportDir->AddressOfNameOrdinals) + dwBase);
char* pName = NULL;
for(i = 0; i < pExportDir->NumberOfNames; i++)
{
pName = (char*)(RVA2RawAdr(pSections, *(pFunNamesAdr+i)) + dwBase);
int idx = *(pFunNamesOrdinalAdr+i);
if(idx < InfoArray.GetSize())
{
EXPORT_FUN_INFO& tmpInfo = InfoArray.ElementAt(idx);
tmpInfo.strFunName = pName;
}
}
ImageUnload(pImage);
return InfoArray.GetSize();
}
示例15: UpdateInputMenu
void CAbstractVstEditor::UpdateInputMenu()
{
CMenu* pInfoMenu = m_pMenu->GetSubMenu(2);
pInfoMenu->DeleteMenu(0, MF_BYPOSITION);
CModDoc* pModDoc = m_pVstPlugin->GetModDoc();
module_renderer* pSndFile = pModDoc->GetSoundFile();
if (m_pInputMenu->m_hMenu) {
m_pInputMenu->DestroyMenu();
}
if (!m_pInputMenu->m_hMenu) {
m_pInputMenu->CreatePopupMenu();
}
CString name;
CArray<CVstPlugin*, CVstPlugin*> inputPlugs;
m_pVstPlugin->GetInputPlugList(inputPlugs);
for (int nPlug=0; nPlug<inputPlugs.GetSize(); nPlug++) {
name.Format("FX%02d: %s", inputPlugs[nPlug]->m_nSlot+1, inputPlugs[nPlug]->m_pMixStruct->Info.szName);
m_pInputMenu->AppendMenu(MF_STRING, ID_PLUGSELECT+inputPlugs[nPlug]->m_nSlot, name);
}
CArray<UINT, UINT> inputChannels;
m_pVstPlugin->GetInputChannelList(inputChannels);
for (int nChn=0; nChn<inputChannels.GetSize(); nChn++) {
if (nChn==0 && inputPlugs.GetSize()) {
m_pInputMenu->AppendMenu(MF_SEPARATOR);
}
name.Format("Chn%02d: %s", inputChannels[nChn]+1, pSndFile->ChnSettings[inputChannels[nChn]].szName);
m_pInputMenu->AppendMenu(MF_STRING, NULL, name);
}
CArray<UINT, UINT> inputInstruments;
m_pVstPlugin->GetInputInstrumentList(inputInstruments);
bool checked;
for (int nIns=0; nIns<inputInstruments.GetSize(); nIns++) {
checked=false;
if (nIns==0 && (inputPlugs.GetSize() || inputChannels.GetSize())) {
m_pInputMenu->AppendMenu(MF_SEPARATOR);
}
name.Format("Ins%02d: %s", inputInstruments[nIns], (LPCTSTR)pSndFile->GetInstrumentName(inputInstruments[nIns]));
if (inputInstruments[nIns] == (UINT)m_nInstrument) checked=true;
m_pInputMenu->AppendMenu(MF_STRING|(checked?MF_CHECKED:0), ID_SELECTINST+inputInstruments[nIns], name);
}
if ((inputPlugs.GetSize() == 0) &&
(inputChannels.GetSize() == 0) &&
(inputInstruments.GetSize() == 0)) {
m_pInputMenu->AppendMenu(MF_STRING|MF_GRAYED, NULL, "None");
}
pInfoMenu->InsertMenu(0, MF_BYPOSITION|MF_POPUP, (UINT)m_pInputMenu->m_hMenu, "I&nputs");
}