本文整理汇总了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;
}
示例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();
}