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


C++ shared_ptr::Command方法代码示例

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


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

示例1: IMAPResult

   IMAPResult
   IMAPCommandCOPY::ExecuteCommand(boost::shared_ptr<IMAPConnection> pConnection, boost::shared_ptr<IMAPCommandArgument> pArgument)
   {
      if (!pConnection->IsAuthenticated())
         return IMAPResult(IMAPResult::ResultNo, "Authenticate first");
      
      if (!pConnection->GetCurrentFolder())
         return IMAPResult(IMAPResult::ResultNo, "No folder selected.");

      boost::shared_ptr<IMAPCopy> pCopy = boost::shared_ptr<IMAPCopy>(new IMAPCopy());
      pCopy->SetIsUID(false);

      String sResponse; 

      boost::shared_ptr<IMAPSimpleCommandParser> pParser = boost::shared_ptr<IMAPSimpleCommandParser>(new IMAPSimpleCommandParser());
      pParser->Parse(pArgument);
      if (pParser->ParamCount() != 2)
         return IMAPResult(IMAPResult::ResultBad, "Command requires 2 parameters.\r\n");

      String sMailNo = pParser->GetParamValue(pArgument, 0);
      String sFolderName = pParser->GetParamValue(pArgument, 1);

      pArgument->Command("\"" + sFolderName + "\"");

      // We should check if the folder exists. If not, notify user with trycreate
      boost::shared_ptr<IMAPFolder> pFolder = pConnection->GetFolderByFullPath(sFolderName);

      if (!pFolder)
      {
         // Nope, doesn't exist.
         return IMAPResult(IMAPResult::ResultNo, "Can't find mailbox with that name.\r\n");
      }

      IMAPResult result = pCopy->DoForMails(pConnection, sMailNo, pArgument);

      if (result.GetResult() == IMAPResult::ResultOK)
          pConnection->SendAsciiData(pArgument->Tag() + " OK COPY completed\r\n");

      return result;
   }
开发者ID:bogri5520,项目名称:hMailServer,代码行数:40,代码来源:IMAPCommandCopy.cpp

示例2: OR

   IMAPResult 
   IMAPSearchParser::ParseCommand(boost::shared_ptr<IMAPCommandArgument> pArgument, bool bIsSort)
   {
      // Replace literals in the command.
      boost::shared_ptr<IMAPSimpleCommandParser> pSimpleParser = boost::shared_ptr<IMAPSimpleCommandParser> (new IMAPSimpleCommandParser);

      if (bIsSort)
      {
         pSimpleParser->Parse(pArgument);
         pSimpleParser->UnliteralData();

         boost::shared_ptr<IMAPSimpleWord> pSort = pSimpleParser->Word(0);
         if (pSort->Paranthezied())
         {
            m_pSortParser = boost::shared_ptr<IMAPSortParser>(new IMAPSortParser);
            m_pSortParser->Parse(pSort->Value());
         }

         // Trim away the SORT part of the SEARCH expresson 
         // since we only care about SEARCH below.
         String tempString = pArgument->Command();

         if (tempString.Find(_T(")")) > 0)
            tempString = tempString.Mid(tempString.Find(_T(")"))+2);

         pArgument->Command(tempString);
      }

      /* 
         Remove all parenthesis outside of strings. Some IMAP
         clients sends parenthesis, some doesn't. We remove
         them here to prevent the behaviors from differing.

         It should be safe to do this, since
            Criteria1 OR (Criteria2 Criteria 3)
         means the same as
            Criteria1 OR Criteria2 Criteria 3
      */

      String resultString;
      const String inputString = pArgument->Command();
      bool insideString = false;
      for (int i = 0; i < inputString.GetLength(); i++)
      {
         wchar_t curChar = inputString.GetAt(i);

         switch (curChar)
         {
         case '"':
            insideString = !insideString;
            break;
         case '(':
         case ')':
            if (!insideString)
               continue;
         }

         resultString += curChar;
      }

      // Replace literals in the command.
      pSimpleParser = boost::shared_ptr<IMAPSimpleCommandParser> (new IMAPSimpleCommandParser);
      pArgument->Command(resultString);

      pSimpleParser->Parse(pArgument);
      pSimpleParser->UnliteralData();

      boost::shared_ptr<IMAPSearchCriteria> pCriteria = boost::shared_ptr<IMAPSearchCriteria> (new IMAPSearchCriteria);

      int currentWord = 0;
      IMAPResult result = _ParseSegment(pSimpleParser, currentWord, pCriteria, 0);
      if (result.GetResult() != IMAPResult::ResultOK)
         return result;

      m_pResultCriteria = pCriteria;

      return IMAPResult();
   }
开发者ID:bogri5520,项目名称:hMailServer,代码行数:78,代码来源:IMAPSearchParser.cpp


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