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


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

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


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

示例1: SubstituteTags

int CProxy::SubstituteTags(CString *buf, int skAccept, int searchflag, char *searchstring, int startswithflag, char *startswithstring, char *errorcode, int adminFlag)
{
	int ret = 0;
	int	iError = 0;
	char	*pszSongTitle = (char *)1;
	char	szArtist[255] = "";
	int		playlistpos = 0;
	CString	substituted;
	char	tmpbuf[1024] = "";
	int		replaceflag = 0;
	CString tempArtist;
	int		foundit = 0;
	int		loop = 1;
	int		errorCode = 0;

	errorCode = atoi(errorcode);

	ret = buf->Find("%%ARTISTSELECT%%");

	if (ret != -1) {
		while(loop) {
			memset(szArtist, '\000', sizeof(szArtist));
			loop = getArtist(playlistpos, szArtist);
			if(loop) {
				tempArtist = szArtist;
				foundit = 0;
				for(int i=0;i <= ArtistList.GetUpperBound();i++) {
					if (ArtistList.GetAt(i) == tempArtist) {
						foundit = 1;
					}
				}
				if (!foundit) {
					if (strlen(tempArtist) > 0) {	
						ArtistList.Add(tempArtist);
					}
				}
			}
			playlistpos++;
		}

		CArray<CString, CString &> ArtistListSorted;

		for(int j=0;j <= ArtistList.GetUpperBound();j++) {
			int added = 0;
			for (int k=0;k <= ArtistListSorted.GetUpperBound();k++) {
				if (ArtistList.GetAt(j) < ArtistListSorted.GetAt(k)) {
					ArtistListSorted.InsertAt(k, ArtistList.GetAt(j));
					added = 1;
					break;
				}
			}
			if (!added) {
				ArtistListSorted.Add(ArtistList.GetAt(j));
			}
		}

		for(int i=0;i <= ArtistListSorted.GetUpperBound();i++) {
			substituted = *buf;
			substituted.Replace("%%ARTISTSELECT%%", ArtistListSorted.GetAt(i));
			iError = send(skAccept, substituted.GetBuffer(substituted.GetLength()), substituted.GetLength(), 0);
			iError = send(skAccept, "\r\n", strlen("\r\n"), 0);

		}
		return 1;
	}

	ret = buf->Find("%%ADMINWINAMPCONTROL%%");

	if (ret != -1) {
		substituted = *buf;
		if (adminFlag) {
			char	hiddenfield[1024] = "";
			sprintf(hiddenfield, "<table bordercolor=white border=1><tr><td colspan=5>Winamp Admin Control</td></tr><tr><td><a href=\"admin.cgi?pass=%s&action=prev\">Prev</td><td><a href=\"admin.cgi?pass=%s&action=play\">Play</td><td><a href=\"admin.cgi?pass=%s&action=pause\">Pause</td><td><a href=\"admin.cgi?pass=%s&action=stop\">Stop</td><td><a href=\"admin.cgi?pass=%s&action=next\">Next</td><tr><td colspan=5><a href=\"admin.cgi?pass=%s&action=refreshcache\">Refresh Playlist Cache</td></tr></table>", g_AdminPassword, g_AdminPassword, g_AdminPassword, g_AdminPassword, g_AdminPassword, g_AdminPassword);
			substituted.Replace("%%ADMINWINAMPCONTROL%%", hiddenfield);
		}
		else {
			substituted.Replace("%%ADMINWINAMPCONTROL%%", "");
		}
		iError = send(skAccept, substituted.GetBuffer(substituted.GetLength()), substituted.GetLength(), 0);
		iError = send(skAccept, "\r\n", strlen("\r\n"), 0);
		return 1;
	}

	ret = buf->Find("%%ADMINHIDDENFIELD%%");

	if (ret != -1) {
		substituted = *buf;
		if (adminFlag) {
			char	hiddenfield[1024] = "";
			sprintf(hiddenfield, "<input type=hidden name=pass value=\"%s\">", g_AdminPassword);
			substituted.Replace("%%ADMINHIDDENFIELD%%", hiddenfield);
		}
		else {
			substituted.Replace("%%ADMINHIDDENFIELD%%", "");
		}
		iError = send(skAccept, substituted.GetBuffer(substituted.GetLength()), substituted.GetLength(), 0);
		iError = send(skAccept, "\r\n", strlen("\r\n"), 0);
		return 1;
	}
	ret = buf->Find("%%ADMINPASSWORD%%");
//.........这里部分代码省略.........
开发者ID:KolorKode,项目名称:Stg,代码行数:101,代码来源:Proxy.cpp

示例2: OnExportData

void CBase_SampleChart::OnExportData()
{
	CString file = _T("C:/Points.csv");

	CFileDialog mFileDlg(FALSE,_T("csv"),_T("Points"),OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,_T("csv文件|*.csv||"),this);
	DWORD dwVersion = GetVersion();
	DWORD dwWindowsMajorVersion =  (DWORD)(LOBYTE(LOWORD(dwVersion)));
	DWORD dwWindowsMinorVersion =  (DWORD)(HIBYTE(LOWORD(dwVersion)));
	if (dwVersion < 0x80000000) mFileDlg.m_ofn.lStructSize=88;//显示新的文件对话框
	else mFileDlg.m_ofn.lStructSize=76;//显示老的文件对话框
	mFileDlg.m_ofn.lpstrTitle= _T("保存到文件");
	if(mFileDlg.DoModal() !=IDOK ) return;
	file = mFileDlg.GetPathName();

	CString strSep = _T(",");
	CFile f;
	BOOL ret = f.Open(file,CFile::modeCreate | CFile::modeReadWrite);
	if(!ret)
	{
		MessageBox(_T("打开文件失败,可能是文件为只读属性或被占用"));
		return;
	}
	CString line(_T("时间"));
	//
	CArray<CChartSerie*, CChartSerie*> series;
	series.Add(m_pcCurveMain);
	unsigned maxCount = 0;
	CChartSerie* pSerieOfMaxCount = NULL;
	for(int i=0; i<=series.GetUpperBound(); ++i)
	{
		CChartSerie* pS = series.GetAt(i);
		unsigned c = pS->GetPointsCount();
		if(c > maxCount)
		{
			maxCount = c;
			pSerieOfMaxCount = pS;
		}
		line = line + strSep + pS->GetName().c_str();
	}
	//标题列
	{
		TWen_USES_CONVERSION;
		LPCSTR s=TWen_CT2A(line + _T("\r\n"));
		f.Write(s,strlen(s));
	}
	for(size_t i=0; i<maxCount; i++)
	{
		line.Format(_T("%.15f"), pSerieOfMaxCount->m_vPoints.m_pPoints[i].x);
		for(int j=0; j<=series.GetUpperBound(); ++j)
		{
			CChartSerie* pS = GetSerieByIndex(j);
			unsigned c = pS->GetPointsCount();
			CString v;
			if(c > i) v.Format(_T("%.15f"), pS->m_vPoints.m_pPoints[i].y);
			line = line + strSep + v;
		}
		{
			TWen_USES_CONVERSION;
			LPCSTR s=TWen_CT2A(line + _T("\r\n"));
			f.Write(s,strlen(s));
		}
	}
	f.Close();
	MessageBox(_T("数据已保存到文件[")+file+_T("]"));
}
开发者ID:Wanghuaichen,项目名称:SignalProcess,代码行数:65,代码来源:Base_SampleChart.cpp

示例3: AdminHandler


//.........这里部分代码省略.........
					if (!strcmp(variable, "listpos")) {
						playlistpos = atoi(value);
					}
				}
				token = strtok(NULL, "&");
			}
		}
		int passok = 0;

		if (strlen(g_AdminPassword) > 0) {
			if (!strcmp(suppliedPass, g_AdminPassword)) {
				*adminFlag = 1;
				passok = 1;
			}
			else {
				*adminFlag = 0;
				passok = 0;
			}
		}

		if (passok) {
			int winampCommand = 0;
			switch (action) {
			case 2:	PlayWinamp();
					winampCommand = 1;
					break;
			case 3:	PrevWinamp();
					winampCommand = 1;
					break;
			case 4:	PauseWinamp();
					winampCommand = 1;
					break;
			case 5:	StopWinamp();
					winampCommand = 1;
					break;
			case 6:	NextWinamp();
					winampCommand = 1;
					break;
			case 7:	repopulatePlaylistCache();
					winampCommand = 1;
					break;
			}
			if (winampCommand) {
				char buf[255] = "";
				_snprintf(buf, sizeof(buf)-1, "Location: /admin.cgi?pass=%s", g_AdminPassword);
				send_headers(302, "Moved Temporarily", (char*) buf, 0, -1, -1 );
			}
		}

//	}
//    if (sscanf(request, "/admin.cgi?pass=%s&action=delete&listpos=%d", suppliedPass, &playlistpos) == 2) {
	if (action == 1) {
		if (strlen(g_AdminPassword) > 0) {

			if (!strcmp(suppliedPass, g_AdminPassword)) {
				*adminFlag = 1;
				if (playlistpos-1 <= RequestQueue.GetUpperBound()) {
					RequestQueue.RemoveAt(RequestQueue.GetUpperBound() - playlistpos + 1);
					errorCode = DELETE_ACCEPTED;
				}
				else {
					errorCode = ERR_POSITION_OUT_OF_RANGE;
				}
			}
			else {
				*adminFlag = 0;
				errorCode = ERR_BAD_PASSWORD;
			}
		}

		char	location[1024] = "";
		if (strlen(m_Referrer) > 0) {
			if (errorCode == 0) {
				_snprintf(location, sizeof(location)-1, "Location: %s", m_Referrer);
			}
			else {
				_snprintf(location, sizeof(location)-1, "Location: %s&errorCode=%d", m_Referrer, errorCode);
			}
		}
		else {
			if (errorCode == 0) {
				_snprintf(location, sizeof(location)-1, "Location: /playlist.cgi");
			}
			else {
				_snprintf(location, sizeof(location)-1, "Location: /playlist.cgi?errorCode=%d", errorCode);
			}
		}
		send_headers(302, "Moved Temporarily", (char*) location, 0, -1, -1 );
	} 
	if (strlen(g_AdminPassword) > 0) {
		if (!strcmp(suppliedPass, g_AdminPassword)) {
				*adminFlag = 1;
		}
		else {
			*adminFlag = 0;
		}
	}
	return;
//    if (sscanf(request, "/admin.cgi?pass=%s&errorCode=%d", suppliedPass, &errorCode) == 2) {
}
开发者ID:KolorKode,项目名称:Stg,代码行数:101,代码来源:Proxy.cpp

示例4: MakeReqPacket


//.........这里部分代码省略.........

				if (lBeginDate > lEndDate)
				{
					continue ;
				}

				DateRange dr;
				dr.m_nBeginDate = lBeginDate;
				dr.m_nEndDate = lEndDate;
				ayDate.Add(dr);
			}

			if (nCount == 0 && pStockDay[i].m_lDate <= nLimitTime)
			{
				break;
			}
		}

		//下载分钟线数据时按9840的倍数根往前下载,若没有最近41天的数据,则下载最近82天数据,依次类推,最多倒退41*18天
		int nLimitedDays = 0,nPermitCount = 9840;
		if (ayDate.GetCount() < 1)
		{
			if(nEarliestTime > nLimitTime && !bExistLastData) 			//加入最后一段时间
			{
				DateRange dr;
				dr.m_nBeginDate = nLimitTime;
				dr.m_nEndDate = nEarliestTime;
				ayDate.Add(dr);
			}
		}
		else
		{
			int nMaxDays = 0;
			DateRange LastDateRage = ayDate.GetAt(ayDate.GetUpperBound());
			long nPreDate = GetPreDataDate(pCode,LastDateRage.m_nBeginDate,nPeriod);
			if (nGZIndex)
				nMaxDays = 36 - 1;  //36 = (10000/240 * 240)/270
			else
				nMaxDays = 41 - 1;  //41= 10000/240

			long nEarlyLimitedDate = nLimitTime;
			if (PERIOD_TYPE_DAY != nPeriod)
			{
				nEarlyLimitedDate = GetPreDate(pStockDay[m_pTaskItem->m_localDataCount -1].m_lDate,nMaxDays,nPeriod);
				long nCheckDataCount = GetDayDataCount(pCode,nEarlyLimitedDate,nTodayTime,nPeriod);
				if (nCheckDataCount > nPermitCount)
				{
					int nSurplusCount = nCheckDataCount - nPermitCount;
					nEarlyLimitedDate = GetChangedBeginDate(pCode,nEarlyLimitedDate,nSurplusCount,nPeriod);
				}
			}
			if (nPreDate >= nEarlyLimitedDate)
			{
				DateRange dr;
				dr.m_nBeginDate = nEarlyLimitedDate > nLimitTime ? nEarlyLimitedDate : nLimitTime;
				dr.m_nEndDate = nPreDate;
				ayDate.Add(dr);
			}
		}

		CArray<DateRange,DateRange> ayDateChange;
		int nDateCount = ayDate.GetCount();
		nPermitCount = nPermitCount*(m_nReloadDegree + 1);
		for (int i = nDateCount - 1; i>= 0; i--)
		{
			DateRange dateRange = ayDate.GetAt(i);
开发者ID:hefen1,项目名称:XCaimi,代码行数:67,代码来源:HSDownloadData.cpp


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