本文整理汇总了C++中CAtlList::RemoveAt方法的典型用法代码示例。如果您正苦于以下问题:C++ CAtlList::RemoveAt方法的具体用法?C++ CAtlList::RemoveAt怎么用?C++ CAtlList::RemoveAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAtlList
的用法示例。
在下文中一共展示了CAtlList::RemoveAt方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddPoint
void CEllipseCenterGroup::AddPoint(CAtlList<EllipseCenter>& centers, IntersectFunction intersect, int x, int y)
{
POSITION pos = centers.GetTailPosition();
while (pos) {
POSITION posCur = pos;
auto& center = centers.GetPrev(pos);
int dyIntersect = intersect(x - center.x, y - center.y);
if (dyIntersect != CEllipse::NO_INTERSECT_INNER) {
int yIntersect = (dyIntersect == CEllipse::NO_INTERSECT_OUTER) ? (y - m_pEllipse->GetYRadius() - 1) : (center.y + dyIntersect);
if (yIntersect < center.yStopDrawing) {
center.yStopDrawing = yIntersect;
if (pos && center.yStopDrawing <= centers.GetAt(pos).yStopDrawing) {
centers.RemoveAt(posCur);
}
} else {
break;
}
}
}
auto& center = centers.GetAt(centers.AddTail());
center.x = x;
center.y = y;
center.yStopDrawing = y + m_pEllipse->GetYRadius();
}
示例2: OnRequest
void CWebServer::OnRequest(CWebClientSocket* pClient, CStringA& hdr, CStringA& body)
{
CPath p(pClient->m_path);
CStringA ext = p.GetExtension().MakeLower();
CStringA mime;
if (ext.IsEmpty()) {
mime = "text/html";
} else {
m_mimes.Lookup(ext, mime);
}
hdr = "HTTP/1.0 200 OK\r\n";
bool fHandled = false, fCGI = false;
if (!fHandled && m_webroot.IsDirectory()) {
CStringA tmphdr;
fHandled = fCGI = CallCGI(pClient, tmphdr, body, mime);
if (fHandled) {
tmphdr.Replace("\r\n", "\n");
CAtlList<CStringA> hdrlines;
ExplodeMin(tmphdr, hdrlines, '\n');
POSITION pos = hdrlines.GetHeadPosition();
while (pos) {
POSITION cur = pos;
CAtlList<CStringA> sl;
CStringA key = Explode(hdrlines.GetNext(pos), sl, ':', 2);
if (sl.GetCount() < 2) {
continue;
}
key.Trim().MakeLower();
if (key == "content-type") {
mime = sl.GetTail().Trim();
hdrlines.RemoveAt(cur);
} else if (key == "content-length") {
hdrlines.RemoveAt(cur);
}
}
tmphdr = Implode(hdrlines, '\n');
tmphdr.Replace("\n", "\r\n");
hdr += tmphdr + "\r\n";
}
}
RequestHandler rh = NULL;
if (!fHandled && m_internalpages.Lookup(pClient->m_path, rh) && (pClient->*rh)(hdr, body, mime)) {
if (mime.IsEmpty()) {
mime = "text/html";
}
CString redir;
if (pClient->m_get.Lookup(_T("redir"), redir)
|| pClient->m_post.Lookup(_T("redir"), redir)) {
if (redir.IsEmpty()) {
redir = '/';
}
hdr =
"HTTP/1.0 302 Found\r\n"
"Location: " + CStringA(redir) + "\r\n";
return;
}
fHandled = true;
}
if (!fHandled && m_webroot.IsDirectory()) {
fHandled = LoadPage(0, body, pClient->m_path);
}
UINT resid;
CStringA res;
if (!fHandled && m_downloads.Lookup(pClient->m_path, resid)
&& (LoadResource(resid, res, _T("FILE")) || LoadResource(resid, res, _T("PNG")))) {
if (mime.IsEmpty()) {
mime = "application/octet-stream";
}
memcpy(body.GetBufferSetLength(res.GetLength()), res.GetBuffer(), res.GetLength());
fHandled = true;
}
if (!fHandled) {
hdr = mime == "text/html"
? "HTTP/1.0 301 Moved Permanently\r\n" "Location: /404.html\r\n"
: "HTTP/1.0 404 Not Found\r\n";
return;
}
if ((mime == "text/html" || mime == "text/javascript") && !fCGI) {
if (mime == "text/html") {
hdr +=
"Expires: Thu, 19 Nov 1981 08:52:00 GMT\r\n"
"Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0\r\n"
"Pragma: no-cache\r\n";
CStringA debug;
if (AfxGetAppSettings().fWebServerPrintDebugInfo) {
debug += "<br><hr>\r\n";
debug += "<div id=\"debug\">";
//.........这里部分代码省略.........
示例3: OnRequest
void CWebServer::OnRequest(CWebClientSocket* pClient, CStringA& hdr, CStringA& body)
{
CPath p(AToT(pClient->m_path));
CStringA ext = p.GetExtension().MakeLower();
CStringA mime;
if (ext.IsEmpty()) {
mime = "text/html";
} else {
m_mimes.Lookup(ext, mime);
}
hdr = "HTTP/1.0 200 OK\r\n";
bool fHandled = false, fCGI = false;
if (!fHandled && m_webroot.IsDirectory()) {
CStringA tmphdr;
fHandled = fCGI = CallCGI(pClient, tmphdr, body, mime);
if (fHandled) {
tmphdr.Replace("\r\n", "\n");
CAtlList<CStringA> hdrlines;
ExplodeMin(tmphdr, hdrlines, '\n');
POSITION pos = hdrlines.GetHeadPosition();
while (pos) {
POSITION cur = pos;
CAtlList<CStringA> sl;
CStringA key = Explode(hdrlines.GetNext(pos), sl, ':', 2);
if (sl.GetCount() < 2) {
continue;
}
key.Trim().MakeLower();
if (key == "content-type") {
mime = sl.GetTail().Trim();
hdrlines.RemoveAt(cur);
} else if (key == "content-length") {
hdrlines.RemoveAt(cur);
}
}
tmphdr = Implode(hdrlines, "\r\n");
hdr += tmphdr + "\r\n";
}
}
RequestHandler rh = NULL;
if (!fHandled && m_internalpages.Lookup(pClient->m_path, rh) && (pClient->*rh)(hdr, body, mime)) {
if (mime.IsEmpty()) {
mime = "text/html";
}
CString redir;
if (pClient->m_get.Lookup("redir", redir)
|| pClient->m_post.Lookup("redir", redir)) {
if (redir.IsEmpty()) {
redir = '/';
}
hdr =
"HTTP/1.0 302 Found\r\n"
"Location: " + CStringA(redir) + "\r\n";
return;
}
fHandled = true;
}
if (!fHandled && m_webroot.IsDirectory()) {
fHandled = LoadPage(0, body, UTF8To16(pClient->m_path));
}
UINT resid;
if (!fHandled && m_downloads.Lookup(pClient->m_path, resid)
&& (LoadResource(resid, body, _T("FILE")) || LoadResource(resid, body, _T("PNG")))) {
if (mime.IsEmpty()) {
mime = "application/octet-stream";
}
fHandled = true;
}
if (!fHandled) {
hdr = mime == "text/html"
? "HTTP/1.0 301 Moved Permanently\r\n" "Location: /404.html\r\n"
: "HTTP/1.0 404 Not Found\r\n";
return;
}
if ((mime == "text/html" || mime == "text/javascript") && !fCGI) {
if (mime == "text/html") {
hdr +=
"Expires: Thu, 19 Nov 1981 08:52:00 GMT\r\n"
"Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0\r\n"
"Pragma: no-cache\r\n";
CStringA debug;
if (AfxGetAppSettings().fWebServerPrintDebugInfo) {
debug += "<br><hr>\r\n";
debug += "<div id=\"debug\">";
CStringA key;
POSITION pos;
//.........这里部分代码省略.........
示例4: GetAutoDestDirFromSize
BOOL bigfilehelper::GetAutoDestDirFromSize(CString& strDir)
{
BOOL retval = FALSE;
CAtlArray<TCHAR> buffer;
TCHAR* pBuffer = NULL;
DWORD dwSize;
CAtlList<CString> logicalDrvs;
CString strDrv;
POSITION pos = NULL;
POSITION max_size_pos = NULL;
ULONGLONG uMaxSize = 0;
DWORD dwSectorsPerCluster;
DWORD dwBytesPerSector;
DWORD dwNumberOfFreeClusters;
DWORD dwTotalNumberOfClusters;
CString strSysDrv;
TCHAR szVolName[MAX_PATH+1] = { 0 };
TCHAR szFileSystem[MAX_PATH+1] = { 0 };
BOOL fRetCode;
SetErrorMode(SEM_NOOPENFILEERRORBOX | SEM_FAILCRITICALERRORS);
if (!GetSystemDrive(strSysDrv))
goto clean0;
buffer.SetCount(512);
pBuffer = buffer.GetData();
dwSize = (DWORD)buffer.GetCount();
memset(pBuffer, 0, dwSize * sizeof(TCHAR));
dwSize = GetLogicalDriveStrings(dwSize, buffer.GetData());
if (dwSize > 2)
{
strDrv = pBuffer;
logicalDrvs.AddTail(strDrv);
for (DWORD i = 3; i < dwSize; ++i)
{
if (pBuffer[i] != 0 && pBuffer[i - 1] == 0)
{
strDrv = pBuffer + i;
logicalDrvs.AddTail(strDrv);
}
}
}
pos = logicalDrvs.GetHeadPosition();
while (pos)
{
POSITION current = pos;
CString _drv = logicalDrvs.GetNext(pos);
_drv.MakeLower();
if (_drv == _T("a:\\") || _drv == _T("b:\\"))
{
logicalDrvs.RemoveAt(current);
continue;
}
UINT uType = GetDriveType(_drv);
if (uType != DRIVE_FIXED &&
uType != DRIVE_REMOVABLE)
{
logicalDrvs.RemoveAt(current);
continue;
}
if (strSysDrv.CompareNoCase(_drv)==0)
{
logicalDrvs.RemoveAt(current);
continue;
}
RtlZeroMemory(szVolName, sizeof(szVolName));
RtlZeroMemory(szFileSystem, sizeof(szFileSystem));
fRetCode = GetVolumeInformation(
_drv,
szVolName,
MAX_PATH+1,
NULL,
NULL,
NULL,
szFileSystem,
MAX_PATH+1
);
if (!fRetCode)
{
logicalDrvs.RemoveAt(current);
continue;
}
}
pos = logicalDrvs.GetHeadPosition();
while (pos)
{
POSITION current = pos;
const CString& _drv = logicalDrvs.GetNext(pos);
BOOL fRetCode = GetDiskFreeSpace(
_drv,
&dwSectorsPerCluster,
&dwBytesPerSector,
//.........这里部分代码省略.........
示例5: tryRealUpdate
void cupdatenetlib::tryRealUpdate(BOOL bNoWaiting){
struct szaMoveFile
{
CString szMoveSrcFile;
CString szMoveDestFile;
};
CAtlList<szaMoveFile> szaMoveFiles;
for(int i = 0; i < m_UpdateFileArray.GetCount(); i++){
//if(szaLists.GetCount() < (i+LFILETOTALPARMS)){ break; }
UpdateInfo* pInfo = (UpdateInfo*) m_UpdateFileArray.GetAt(i);
CString szSetupPath = pInfo->strPath;
//SVP_LogMsg5(L"Move %s %d",szSetupPath ,pInfo->bReadyToCopy );
if (szSetupPath.CompareNoCase( _T("splayer.exe")) == 0){
if(!svpToolBox.ifFileExist(szBasePath + szSetupPath) ){
if (svpToolBox.ifFileExist(szBasePath + _T("mplayerc.exe")))
szSetupPath = _T("mplayerc.exe");
else if (svpToolBox.ifFileExist(szBasePath + _T("svplayer.exe")))
szSetupPath = _T("svplayer.exe");
else
szSetupPath = _T("splayer.exe");
}
}
bool bUpdateThis = pInfo->bReadyToCopy ? true : false;
if(bUpdateThis){
//if not match download
szaMoveFile mFiles;
mFiles.szMoveSrcFile = szUpdfilesPath + pInfo->strTempName ;
mFiles.szMoveDestFile = szBasePath + szSetupPath;
szaMoveFiles.AddTail(mFiles);
// while( MoveFileEx( szUpdfilesPath + szaLists.GetAt(i+LFILETMPATH) , szBasePath + szSetupPath , MOVEFILE_COPY_ALLOWED|MOVEFILE_REPLACE_EXISTING|MOVEFILE_WRITE_THROUGH) == 0 ){
// Sleep(50000);
// }
}
}
BOOL bFirstRound = true;
while(1){
POSITION pos = szaMoveFiles.GetHeadPosition();
if(!pos){ break;}
bWaiting = TRUE;
while(pos){
szaMoveFile mFiles;
POSITION orgPos = pos;
mFiles = szaMoveFiles.GetNext(pos);
if(!svpToolBox.ifFileExist(mFiles.szMoveSrcFile)){
szaMoveFiles.RemoveAt(orgPos);
continue;
}
svpToolBox.CreatDirForFile(mFiles.szMoveDestFile);
SetFileAttributes(mFiles.szMoveDestFile , FILE_ATTRIBUTE_NORMAL);
//SVP_LogMsg5(L"Move %s %s", mFiles.szMoveSrcFile , mFiles.szMoveDestFile );
if( MoveFileEx( mFiles.szMoveSrcFile , mFiles.szMoveDestFile , MOVEFILE_COPY_ALLOWED|MOVEFILE_REPLACE_EXISTING|MOVEFILE_WRITE_THROUGH) == 0 && bFirstRound){
// only use MOVEFILE_DELAY_UNTIL_REBOOT on FirstRound
MoveFileEx( mFiles.szMoveSrcFile , mFiles.szMoveDestFile , /*MOVEFILE_COPY_ALLOWED|*/MOVEFILE_REPLACE_EXISTING|MOVEFILE_DELAY_UNTIL_REBOOT) ;
}
/*
if(mFiles.szMoveDestFile.Right(11).CompareNoCase(_T("Updater.exe")) == 0){
szaMoveFiles.RemoveAt(orgPos);
continue;
}
SVP_LogMsg5(mFiles.szMoveDestFile.Right(11));*/
}
bFirstRound = FALSE;
Sleep(1500);
if(bNoWaiting)
break;
}
bWaiting = FALSE;
}
示例6: ValidateItem
static BOOL ValidateItem(int index, BOOL bNewState, BOOL bDisplayErrors)
{
ServiceItem* pSvcItem = NULL;
LVITEM truc = {};
truc.mask = LVIF_PARAM;
truc.iItem = index;
ListView_GetItem(hServicesListCtrl, &truc);
// The lParam member must be valid.
pSvcItem = reinterpret_cast<ServiceItem*>(truc.lParam);
if (!pSvcItem)
return FALSE;
//
// Allow modifications only if the service is not a required service for the system,
// or allow only the activation of a disabled required service.
//
BOOL bOldState = !!(ListView_GetCheckState(hServicesListCtrl, truc.iItem /* == index */) % 2);
if ( !pSvcItem->m_bIsRequired ||
(pSvcItem->m_bIsRequired && !pSvcItem->m_bIsEnabled && bOldState == FALSE && bNewState == TRUE) )
{
if (bOldState == bNewState)
return FALSE;
ListView_SetCheckState(hServicesListCtrl, index, bNewState);
if (pSvcItem->m_bIsEnabled) // Enabled service.
{
if (bNewState == FALSE) // To be deactivated.
{
userModificationsList.AddTail(pSvcItem->m_lpszSvcName);
}
else if (bNewState == TRUE) // To be reactivated
{
POSITION it = userModificationsList.Find(pSvcItem->m_lpszSvcName);
if (it)
{
userModificationsList.RemoveAt(it);
}
else
{
OutputDebugString(_T("(1) \"WTF: What The Fukhurmajalmahamadahaldeliya ?!\" (The Dictator, Sacha Baron Cohen)\n"));
}
}
}
else // Disabled service.
{
if (bNewState == TRUE) // To be activated.
{
userModificationsList.AddTail(pSvcItem->m_lpszSvcName);
}
else if (bNewState == FALSE) // To be redeactivated
{
POSITION it = userModificationsList.Find(pSvcItem->m_lpszSvcName);
if (it)
{
userModificationsList.RemoveAt(it);
}
else
{
OutputDebugString(_T("(2) \"WTF: What The Fukhurmajalmahamadahaldeliya ?!\" (The Dictator, Sacha Baron Cohen)\n"));
}
}
}
return TRUE;
}
else
{
if (bDisplayErrors)
{
DialogBoxW(hInst, MAKEINTRESOURCEW(IDD_REQUIRED_SERVICES_DISABLING_DIALOG), hServicesPage /* hMainWnd */, RequiredServicesDisablingDialogWndProc);
}
return FALSE;
}
}