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


C++ CAtlList::GetTail方法代码示例

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


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

示例1: OnInitDialog

BOOL CAuthDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	CWinApp* pApp = AfxGetApp();

	if (pApp->m_pszRegistryKey) {
		CRegKey hSecKey(pApp->GetSectionKey(IDS_R_LOGINS));

		if (hSecKey) {
			int i = 0;
			TCHAR username[256], password[256];

			for (;;) {
				DWORD unlen = _countof(username);
				DWORD pwlen = sizeof(password);
				DWORD type = REG_SZ;

				if (ERROR_SUCCESS == RegEnumValue(hSecKey, i++, username, &unlen, 0, &type, (BYTE*)password, &pwlen)) {
					m_logins[username] = DEncrypt(password);
					m_usernamectrl.AddString(username);
				} else {
					break;
				}
			}
		}
	} else {
		CAutoVectorPtr<TCHAR> buff;
		buff.Allocate(32767/sizeof(TCHAR));

		DWORD len = GetPrivateProfileSection(IDS_R_LOGINS, buff, 32767/sizeof(TCHAR), pApp->m_pszProfileName);

		TCHAR* p = buff;
		while (*p && len > 0) {
			CString str = p;
			p += str.GetLength()+1;
			len -= str.GetLength()+1;
			CAtlList<CString> sl;
			Explode(str, sl, '=', 2);

			if (sl.GetCount() == 2) {
				m_logins[sl.GetHead()] = DEncrypt(sl.GetTail());
				m_usernamectrl.AddString(sl.GetHead());
			}
		}
	}

	m_usernamectrl.SetFocus();

	return TRUE;
}
开发者ID:chinajeffery,项目名称:MPC-BE--1.2.3,代码行数:51,代码来源:AuthDlg.cpp

示例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\">";
//.........这里部分代码省略.........
开发者ID:finalpatch,项目名称:mpc-hc,代码行数:101,代码来源:WebServer.cpp

示例3: Load

bool CLibraryStream::Load(const WCHAR* fnw)
{
  Clear();

  CStringW url = CStringW(fnw);

  CAtlList<CStringW> sl;
  Explode(url, sl, ':');

  CStringW protocol = sl.RemoveHead();
  if (protocol != L"hsl") return false;

  try
  {
    yami::parameters params;

    params.set_long_long("local_channel", 37830072008705);
    params.set_string("destination", name());
    params.set_string("endpoint", YC.endpoint());

    std::auto_ptr<yami::outgoing_message> message(AGENT.send(DISCOVERY.get("dvb-source"), "dvb-source", "create_streaming_session", params));

    message->wait_for_completion();

    if (message->get_state() == yami::replied)
    {
      int session_id = message->get_reply().get_integer("session");
      params.clear();

      params.set_integer("session", session_id);

      AGENT.send(DISCOVERY.get("dvb-source"), "dvb-source", "start_streaming_session", params);
    }
    else
    {
      return false;
    }
  }
  catch (const home_system::service_not_found&)
  {
    return false;
  }

  if (sl.GetCount() != 2 || FAILED(GUIDFromCString(CString(sl.GetTail()), m_subtype)))
  {
    m_subtype = MEDIASUBTYPE_MPEG2_TRANSPORT;    // TODO: detect subtype
  }

  m_len = 0;
  while(m_len < 1048576)
  {
    yami::parameters params;
    params.set_integer("len", 65535);
    params.set_long_long("pos", m_len);
    std::auto_ptr<yami::outgoing_message> message(AGENT.send(DISCOVERY.get("dvb-source"), "dvb-source", "read", params));
    message->wait_for_completion();
    size_t len = 0;
    PBYTE buf = (PBYTE)message->get_reply().get_binary("payload", len);
    m_len += len;
    for (size_t i = 0; i < len; ++i)
    {
      m_buffer.push_back(buf[i]);
    }

    Sleep(10);
  }

  boost::thread(boost::ref(*this));

  return true;
}
开发者ID:wozio,项目名称:mpc-hc,代码行数:71,代码来源:LibraryReader.cpp

示例4: 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;
//.........这里部分代码省略.........
开发者ID:GenomeXP,项目名称:mpc-hc,代码行数:101,代码来源:WebServer.cpp

示例5: depNode

//THIS FUNCTION IS QUITE COMPLICATED BECAUSE 
//IT HAS TO DEAL WITH MAYA NAME MANGLING!
//tokenize the path.
//add each token into the element list which tracks the attributes and indices
//for each entry added make sure there are no parents left out from maya name mangling.
//after the list is populated and missing elements area added 
//we reiterate and produce the final result.
MPlug		FxInternal::DecodePlug(const CStringA& plugStr)
{

	MPlug result;
	MFnDependencyNode depNode(GetSite());

	CAtlList<PathDecodeElement> elementList;

	//tokenize the path
	int iLastPos=0;
	int iThisPos=0;
	CStringA subStr;
	while( iLastPos= iThisPos, 
		subStr=plugStr.Tokenize(".[]", iThisPos), 
		iThisPos != -1 )
	{
		//char lastChar= subStr[iLastPos];
		//char thisChar= subStr[iThisPos];

		//are we looking at a named portion?
		if(iLastPos == 0 
			|| plugStr[iLastPos-1]=='.'
			|| (plugStr[iLastPos-1]==']' && plugStr[iLastPos]=='.'))
		{
			//if the name is length zero then it must be the case when 
			// you do last[#].  The situation is caused by  the sequence "]."
			//if we dont have a name we can skip since only 1d arrays are allowed.

			if(subStr.GetLength() > 0)
			{
		
				//everything we add is going to be based on the current tail.
				//because we are adding parents, as we find parents we can continue
				//to add them to this position so that they will order themselves properly
				POSITION insertPos= elementList.GetTailPosition();

				//calculate the cancel condition.
				//it is the current tail's object if a tail exists otherwise NULL
				//NULL indicates go all the way to the root
				MObject cancelObj= MObject::kNullObj;
				if(elementList.GetCount() > 0)
				{
					cancelObj= elementList.GetTail().Attribute.object();
				}


				//get the object we are currently working with
				MObject thisObj= depNode.attribute(subStr.GetString());
				if(thisObj.isNull())
					return MPlug();//Critical element of the path was not found...return NULL


				//add it to the list so that we have something to insertBefore
				elementList.AddTail();
				elementList.GetTail().Name= subStr;
				elementList.GetTail().Attribute.setObject(thisObj);



				//walk through all of the parents until we reach cancel condition.
				//we can add  the current element onto the list in the same way.
				for( MFnAttribute itrAttr( elementList.GetTail().Attribute.parent() );
					!itrAttr.object().isNull()  && (cancelObj != itrAttr.object());
					itrAttr.setObject(itrAttr.parent()))
				{
					PathDecodeElement element;
					element.Attribute.setObject( itrAttr.object() );

					//we change the position so that the grandparent is inserted before the parent
					insertPos= elementList.InsertBefore( insertPos, element);
				}
			}
		}
		//are we looking at a numbered portion?
		else if(plugStr[iLastPos-1]=='[' && plugStr[iThisPos-1]==']')
		{
			//if so change the array index.
			elementList.GetTail().IsArray= true;
			elementList.GetTail().Index = atoi( subStr.GetString() );
		}
		else
			DXCC_ASSERT(false);//VERY POORLY FORMED STRING

	}

	//produce the result plug off of the elementList.
	bool first= true;
	for(POSITION pos= elementList.GetHeadPosition();
		pos != NULL;
		elementList.GetNext(pos))
	{
		PathDecodeElement& element= elementList.GetAt(pos);

//.........这里部分代码省略.........
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:101,代码来源:FxInternal.cpp

示例6: ATLASSERT

   // Define the list
   CAtlList<int> myList;

   // Add elements to the tail
   myList.AddTail(1);
   myList.AddTail(2);
   myList.AddTail(3);

   // Confirm the current head of the list
   ATLASSERT(myList.GetHead() == 1);

   // Confirm the current tail of the list
   ATLASSERT(myList.GetTail() == 3);   
开发者ID:terryjintry,项目名称:OLSource1,代码行数:13,代码来源:catllist--addtail_1.cpp

示例7: Dump

void SZYamlDocument::Dump(CString& strText, int nDumpIndent/* = SZYAML_DUMP_INDENT*/)
{
    POSITION pos = m_YamlItemList.GetHeadPosition();
    struct _KeyStackNode 
    {
        _KeyStackNode()
            : nIndent(0)
            , nChildIndent(0)
            , bIsList(FALSE)
        {
        }
        int nIndent;
        int nChildIndent;
        CString strKey;
        BOOL bIsList;
    };
    CAtlList<_KeyStackNode> listKeyStack;
    int nLastIndent = -1;
    BOOL bListItem = FALSE, bPrintThisLine = TRUE;
    CString strLine;

    strText = _T("");

    while (pos)
    {
        _YamlItem &item = m_YamlItemList.GetAt(pos);

        if (listKeyStack.IsEmpty())
            bListItem = FALSE;
        else
            bListItem = listKeyStack.GetTail().bIsList;

        if (item.nIndent == nLastIndent + 1)
        {
            _KeyStackNode &newkey = listKeyStack.GetAt(listKeyStack.AddTail());
            POSITION posNext = _GetNextPos(pos, TRUE);

            newkey.nIndent = item.nIndent;
            newkey.strKey = item.node.Key();
            newkey.bIsList = (posNext != NULL);
        }
        else if (item.nIndent == nLastIndent)
        {
            _KeyStackNode &newkey = listKeyStack.GetTail();
            POSITION posNext = _GetNextPos(pos, TRUE);

            newkey.nIndent = item.nIndent;
            newkey.strKey = item.node.Key();
            newkey.bIsList = (posNext != NULL);
        }
        else if (item.nIndent < nLastIndent)
        {
            for (nLastIndent -= item.nIndent; nLastIndent > 0; -- nLastIndent)
                listKeyStack.RemoveTail();

            if (listKeyStack.IsEmpty())
                bPrintThisLine = TRUE;
            else
            {
                _KeyStackNode &newkey = listKeyStack.GetTail();

                newkey.nIndent = item.nIndent;
                if (newkey.strKey != item.node.Key())
                {
                    newkey.strKey = item.node.Key();
                    POSITION posNext = _GetNextPos(pos, TRUE);
                    newkey.bIsList = (posNext != NULL);
                }
                else
                    bPrintThisLine = !newkey.bIsList;
            }
        }

#ifdef _SZYAML_DEBUG_TRACE
        { // Trace Key Stack
            kconsole::printf(_T("  "));

            for (POSITION pos = listKeyStack.GetHeadPosition(); pos != NULL; listKeyStack.GetNext(pos))
            {
                _KeyStackNode key = listKeyStack.GetAt(pos);
                kconsole::settextcolor(TRUE, TRUE, TRUE, FALSE);
                kconsole::printf(_T("(%d, '%s', %d)"), key.nIndent, key.strKey, key.bIsList);
                kconsole::settextcolor(TRUE, TRUE, TRUE, TRUE);
            }

            kconsole::printf(_T("\r\n"));
        }
#endif

        // 这里对不确定长度的%s不使用Format,是因为MIN_CRT的格式化输出限制长度为1024,见atlstr.h
        // by bbcallen 2009-07-02
        if (bPrintThisLine)
        {
            if (bListItem)
            {
                strLine.Format(
                    _T("%s-%s"),  
                    CString(_T(' '), (item.nIndent - 1) * nDumpIndent),  
                    CString(_T(' '), nDumpIndent - 1)
                    );
//.........这里部分代码省略.........
开发者ID:6520874,项目名称:pcmanager,代码行数:101,代码来源:szyaml.cpp

示例8: Load

BOOL SZYamlDocument::Load(LPCTSTR lpszText)
{
    BOOL bResult = FALSE;
    BOOL bNotFinish = TRUE;
    CString strText = lpszText, strLine, strKey, strValue;
    int nThisLinePos = 0, nNextLinePos = 0, nColonPos = 0;
    int nIndent = 0, nLineNum = 1;
    struct _KeyStackNode 
    {
        _KeyStackNode()
            : nIndent(0)
            , nChildIndent(0)
            , bIsList(FALSE)
        {
        }
        int nIndent;
        int nChildIndent;
        CString strKey;
        BOOL bIsList;
    };
    CAtlList<_KeyStackNode> listKeyStack;
    BOOL bNewChild = FALSE, bIsListItem = FALSE;

    m_YamlItemList.RemoveAll();

    if (!lpszText)
        goto Exit0;

    while (bNotFinish)
    {
        nNextLinePos = strText.Find(_T('\n'), nThisLinePos);
        if (-1 == nNextLinePos)
        {
            bNotFinish = FALSE;
            strLine = strText.Mid(nThisLinePos);
        }
        else
            strLine = strText.Mid(nThisLinePos, nNextLinePos - nThisLinePos);

        nIndent = 0;

        // Get indent
        while (_T(' ') == strLine[nIndent])
            nIndent ++;

        nColonPos = strLine.Find(_T(':'));

        strKey = strLine.Left(nColonPos).Trim();
        strValue = strLine.Mid(nColonPos + 1).Trim();

        if (_T('-') == strKey[0])
        {
            int nIndentMore = 1;

            while (_T(' ') == strKey[nIndentMore])
                nIndentMore ++;

            nIndent += nIndentMore;

            strKey = strKey.Mid(nIndentMore);

            bIsListItem = TRUE;
        }
        else
            bIsListItem = FALSE;

        if (bNewChild)
        {
            _KeyStackNode &LastKey = listKeyStack.GetTail();
            LastKey.nChildIndent = nIndent;

            if (bIsListItem)
                LastKey.bIsList = TRUE;

#ifdef _SZYAML_DEBUG_TRACE
            { // Trace Key Stack
                kconsole::printf(_T("  "));

                for (POSITION pos = listKeyStack.GetHeadPosition(); pos != NULL; listKeyStack.GetNext(pos))
                {
                    _KeyStackNode key = listKeyStack.GetAt(pos);
                    kconsole::printf(_T("(%d, '%s', %d)"), key.nChildIndent, key.strKey, key.bIsList);
                }

                kconsole::printf(_T("\r\n"));
            }
#endif
        }

        strLine = strLine.Mid(nIndent);

        if (strLine.IsEmpty())
            continue;

        while (!listKeyStack.IsEmpty())
        {
            _KeyStackNode &LastKey = listKeyStack.GetTail();
            if (LastKey.nChildIndent == nIndent)
                break;

//.........这里部分代码省略.........
开发者ID:6520874,项目名称:pcmanager,代码行数:101,代码来源:szyaml.cpp


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