当前位置: 首页>>代码示例>>C++>>正文


C++ CArray::GetData方法代码示例

本文整理汇总了C++中CArray::GetData方法的典型用法代码示例。如果您正苦于以下问题:C++ CArray::GetData方法的具体用法?C++ CArray::GetData怎么用?C++ CArray::GetData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CArray的用法示例。


在下文中一共展示了CArray::GetData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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.
}
开发者ID:Meitinger,项目名称:windirstat,代码行数:25,代码来源:sortinglistcontrol.cpp

示例2: 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());

}
开发者ID:litao1009,项目名称:SimpleRoom,代码行数:30,代码来源:SkyODL.cpp

示例3: Execute

TTaskResult CBeep::Execute(CRobot * Robot, CExecutableRWGraphicObjectList * ExecutableObjectList, bool & result)
{
    if (Robot->GetSoftwareRevision() <= 1.06)   /*Do the tune as beeps for robots before version 1.07*/
    {
        Robot->AddBeepToInstructions(GetFrequency(), GetDuration());
        CFlowZap *FZ = (CFlowZap*)m_fc;
        CBeep* LastBeep = this;
        CInstruction *Next = FZ->GetNextInstructionInList(this);

        //	Next = FZ->GetNextExecutableInstruction(Next);
        while (Next->IsKindOf(RUNTIME_CLASS(CBeep)))
        {
            LastBeep = (CBeep*)Next;
            Robot->AddBeepToInstructions(LastBeep->GetFrequency(), LastBeep->GetDuration());
            Next = FZ->GetNextInstructionInList(Next);
            //		Next = FZ->GetNextExecutableInstruction(Next);
        }

        FZ->SetCueToInstruction(LastBeep);
        FZ->RedrawWindow();
    }
    else
    {
        unsigned int NumberOfNotes = 1;
        CArray<short, short> FrequencyList;
        FrequencyList.SetSize(20, 20);
        CArray<int, int> DurationList;
        DurationList.SetSize(20, 20);
        FrequencyList[0] = GetFrequency();
        DurationList[0] = GetDuration();
        CFlowZap *FZ = (CFlowZap*)m_fc;
        CBeep* LastBeep = this;
        CInstruction *Next = FZ->GetNextInstructionInList(this);

        //	Next = FZ->GetNextExecutableInstruction(Next);
        while (Next->IsKindOf(RUNTIME_CLASS(CBeep)))
        {
            LastBeep = (CBeep*)Next;
            FrequencyList[NumberOfNotes] = LastBeep->GetFrequency();
            DurationList[NumberOfNotes] = LastBeep->GetDuration();
            NumberOfNotes++;
            Next = FZ->GetNextInstructionInList(Next);
            //		Next = FZ->GetNextExecutableInstruction(Next);
        }

        FrequencyList[NumberOfNotes] = -1;
        DurationList[NumberOfNotes] = 0;
        NumberOfNotes++;
        Robot->AddTuneToInstructions(FrequencyList.GetData(), DurationList.GetData(), NumberOfNotes);

        FZ->SetCueToInstruction(LastBeep);
        FZ->RedrawWindow();
    }

    TTaskResult TaskResult;
    TaskResult = Robot->FollowInstructions(true, true, IR_InstructionComplete);
    return TaskResult;
}
开发者ID:dogshoes,项目名称:map-n-zap,代码行数:58,代码来源:Beep.cpp

示例4: 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
开发者ID:Cholga,项目名称:tlcopy,代码行数:58,代码来源:Convert.cpp

示例5: OnOK

void CMultiSelDlg::OnOK() 
{
    // now copy selection to the selection strings
    CString         strSel;

	if(m_bSingleSelect)
	{
		int iSel = m_tListBox.GetCurSel();
		if(iSel>=0)
		{
			m_tListBox.GetText(iSel, strSel);
			m_astrStringsSel.Add(strSel);
		}
	}
	else
	{
		CArray<int,int> aiListBoxSel;
		int             iCount = m_tListBox.GetSelCount();
		aiListBoxSel.SetSize(iCount);
		m_tListBox.GetSelItems(iCount, aiListBoxSel.GetData());

		for(int iSel = 0; iSel < iCount; ++iSel)
		{
			m_tListBox.GetText(aiListBoxSel[iSel], strSel);
			m_astrStringsSel.Add(strSel);
		}
	}

	CDialog::OnOK();
}
开发者ID:LM25TTD,项目名称:ATCMcontrol_Engineering,代码行数:30,代码来源:MultiSelDlg.cpp

示例6: 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();
	}		
}
开发者ID:mar80nik,项目名称:TChart,代码行数:28,代码来源:SeriesListCtrl.cpp

示例7: SavePersistentAttributes

void CSortingListControl::SavePersistentAttributes()
{
	CArray<int, int> arr;
	arr.SetSize(GetHeaderCtrl()->GetItemCount());

	GetColumnOrderArray(arr.GetData(), arr.GetSize());	
	CPersistence::SetColumnOrder(m_name, arr);

	for (int i=0; i < arr.GetSize(); i++)
		arr[i]= GetColumnWidth(i);
	CPersistence::SetColumnWidths(m_name, arr);

	// Not so good: CPersistence::SetSorting(m_name, m_sorting.column1, m_sorting.ascending1, m_sorting.column2, m_sorting.ascending2);
}
开发者ID:Meitinger,项目名称:windirstat,代码行数:14,代码来源:sortinglistcontrol.cpp

示例8: Read

BOOL CFormStreamReader::Read(void *pv, ULONG cb, ULONG *pcbRead)
{
	if(pv == NULL) return FALSE;
	if(pcbRead == NULL) return FALSE;

	CArray<BYTE, BYTE> *pBuffer = m_pForm->GetBuffer();

	*pcbRead = min(cb, pBuffer->GetCount() - m_pos);

	memcpy(pv, &pBuffer->GetData()[m_pos], *pcbRead);
	m_pos += *pcbRead;

	return (m_pos >= (ULONG)pBuffer->GetCount()) ? FALSE : TRUE;
}
开发者ID:MFDonadeli,项目名称:PMA,代码行数:14,代码来源:StreamReader.cpp

示例9: ConvertBufferToString

bool SgmlFile::ConvertBufferToString(CArray<BYTE, BYTE> &aLineBytes, CString &csLine, UINT nCodepage) {
    bool bSuccess = true;

    if (aLineBytes.GetSize() > 0) {
#ifdef _UNICODE
        WCHAR *wszLine = new WCHAR[aLineBytes.GetSize() + 1];
        int iChars = ::MultiByteToWideChar(nCodepage, 0, (const char *)aLineBytes.GetData(), 
            aLineBytes.GetSize(), wszLine, aLineBytes.GetSize());
        wszLine[iChars] = 0;

        // TODO what about the data already being Unicode? And in the wrong order?

        csLine = wszLine;
        delete[] wszLine;
#else
        aLineBytes.Add(0);
        csLine = aLineBytes.GetData();
#endif
    } else 
        // at least a \n was found (empty line)
        csLine.Empty();

    return bSuccess;
}
开发者ID:identity0815,项目名称:os45,代码行数:24,代码来源:SgmlParser.cpp

示例10: OnOK

void CRemoveChannelsDlg::OnOK()
//-----------------------------
{
    int nCount = m_RemChansList.GetSelCount();
    CArray<int,int> aryListBoxSel;
    aryListBoxSel.SetSize(nCount);
    m_RemChansList.GetSelItems(nCount, aryListBoxSel.GetData());

    m_bKeepMask.assign(m_nChannels, true);
    for (int n = 0; n < nCount; n++)
    {
            m_bKeepMask[aryListBoxSel[n]] = false;
    }
    if ((static_cast<UINT>(nCount) == m_nRemove && nCount > 0)  || (m_nRemove == 0 && (m_pSndFile->GetNumChannels() >= nCount + m_pSndFile->GetModSpecifications().channelsMin)))
            CDialog::OnOK();
    else
            CDialog::OnCancel();
}
开发者ID:aidush,项目名称:openmpt,代码行数:18,代码来源:dlg_misc.cpp

示例11: OnBnClickedCopy

void CCommunicationTrafficDlg::OnBnClickedCopy()
{
//--------------------------------------------------------------------------------------------------------------------

   
    CArray <int, int> aryListSel;
    int nCount= m_DataList.GetSelCount();
    aryListSel.SetSize(nCount);
    m_DataList.GetSelItems(nCount, aryListSel.GetData()); 

  //  aryListSel中存的就是选中列的index值,如果需要取内容,加以下语句:
        CString str,content;
        for (int i= nCount-1; i>= 0; i--)
        {
            m_DataList.GetText(aryListSel.GetAt(i), (CString&)str);
            str+=_T("\n");
            content==str;
        }


//--------------------------------------------------------------------------------------------------------------------
     
    HGLOBAL hClip; 
    //定义一个HGLOBAL句柄变量用来指向分配的内存块
    if (OpenClipboard())
    {
        EmptyClipboard();                            //将剪贴板内容清空
        hClip=GlobalAlloc(GMEM_MOVEABLE,content.GetLength()+1); 
        //在堆上分配可移动的内存块,程序返回一个内存句柄
        char * buff;                                 //定义指向字符型的指针变量
        buff=(char*)GlobalLock(hClip);
        //对分配的内存块进行加锁,将内存块句柄转化成一个指针,并将相应的引用计数器加1
        strcpy(buff,(char*)content.GetBuffer());
        //将用户输入的数据复制到指针变量中,实际上就是复制到分配的内存块中
        GlobalUnlock(hClip);
        //数据写入完毕,进行解锁操作,并将引用计数器数字减1
        SetClipboardData(CF_TEXT,hClip);
        //将存放有数据的内存块放入剪贴板的资源管理中
        CloseClipboard();
        //关闭剪贴板,释放剪贴板资源的占用权
      
    }
//--------------------------------------------------------------------------------------------------------------------
}
开发者ID:ALEXLCC,项目名称:T3000_Building_Automation_System,代码行数:44,代码来源:CommunicationTrafficDlg.cpp

示例12: OnSelectPassenger

void CSelectPassenger::OnSelectPassenger()
{
	int selCount = listboxPassenger.GetSelCount();
	CArray<PassengerInfo>& passlist = CConfig::GetConfig().GetPassenger();
	CArray<int> selectedIndex;
	selectedIndex.SetSize(selCount);
	listboxPassenger.GetSelItems(selCount, selectedIndex.GetData());

	for(int i = 0; i < passlist.GetCount(); i++)
	{
		for(int j = 0; j < selectedIndex.GetCount(); j++)
		{
			CString str;
			listboxPassenger.GetText(selectedIndex[j], str);
			if(passlist[i].name == str)
			{
				selectedpass.Add(passlist[i]);
			}
		}
	}
}
开发者ID:AlexBu,项目名称:HTTPSClient,代码行数:21,代码来源:SelectPassenger.cpp

示例13: UpdateChart

void CChartDlg::UpdateChart()
{
	// Get the indexes of all the selected items.
	int nCount = m_Datasel.GetSelCount();
	if(nCount <= 0)
		return;
	UpdateData();
	m_Chart.ClearAll();
	m_Chart.SetAxis(m_dBase+5.0*m_dVary,m_dBase-5.0*m_dVary,m_dBase,m_dVary*4.0);
	CArray<int,int> aryListBoxSel;
	aryListBoxSel.SetSize(nCount);
	m_Datasel.GetSelItems(nCount, aryListBoxSel.GetData()); 
	int nTotal = nCount;
	CString sCurr;
	while(nCount > 0)
	{
		m_Datasel.GetText(nTotal-nCount--,sCurr);
		m_Chart.AddData(atof(sCurr));

	}
}
开发者ID:Biotron,项目名称:kpgweigher,代码行数:21,代码来源:ChartDlg.cpp

示例14: OnBnClickedAutoupdate

void CChartDlg::OnBnClickedAutoupdate()
{
	// TODO: 在此添加控件通知处理程序代码
	//auto size the chart
	int nCount = m_Datasel.GetSelCount();
	if(nCount <= 0)
		return;
	CArray<int,int> aryListBoxSel;
	aryListBoxSel.SetSize(nCount);
	m_Datasel.GetSelItems(nCount, aryListBoxSel.GetData()); 

	int nTotal = nCount;
	CString sCurr;
	double new_base=0;
	
	while(nCount > 0)
	{
		m_Datasel.GetText(nTotal-nCount--,sCurr);
		new_base += atof(sCurr);
	}
	new_base = new_base/nTotal;

	nCount = nTotal;
	double new_vary=0;
	while(nCount > 0)
	{
		m_Datasel.GetText(nTotal-nCount--,sCurr);
		new_vary += (atof(sCurr)-new_base)*(atof(sCurr)-new_base);
	}
	new_vary = sqrt(new_vary/nTotal);

	m_dBase = new_base;
	m_dVary = new_vary;
	UpdateData(FALSE);
	UpdateChart();
}
开发者ID:Biotron,项目名称:kpgweigher,代码行数:36,代码来源:ChartDlg.cpp

示例15: main

void main()
{
	CArray arr;
	arr.Add(1234);
	arr.Add(23);
	arr.Add(44);
	arr.Add(21);
	arr.Add(5);
	arr.RemoveAt(2,20000000); //从第二个位置起,删除2个数据
	arr.InsertAt(3,10,2);
	int i = 0;
	int nSize = arr.GetSize();
	cout << "共有 " << nSize << " 条数据" << endl;
	
	TYPE *p = arr.GetData();
	
	qsort(p,nSize,sizeof(TYPE),compar);

	while(i < nSize)
	{
		cout << arr[i] << endl;
		++i;
	}
}
开发者ID:Jolly23,项目名称:Cpp_Study,代码行数:24,代码来源:NewAR.cpp


注:本文中的CArray::GetData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。