本文整理汇总了C++中hm::String::IsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ String::IsEmpty方法的具体用法?C++ String::IsEmpty怎么用?C++ String::IsEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hm::String
的用法示例。
在下文中一共展示了String::IsEmpty方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetMailServer
STDMETHODIMP InterfaceUtilities::GetMailServer(BSTR EMailAddress, BSTR *MailServer)
{
try
{
HM::String sDomainName;
HM::String sEMail(EMailAddress);
sDomainName = HM::StringParser::ExtractDomain (EMailAddress);
std::vector<HM::String> saDomainNames;
HM::DNSResolver oDNSResolver;
oDNSResolver.GetEmailServers(sDomainName, saDomainNames);
HM::String sMailServer = "";
for (unsigned int i = 0; i < saDomainNames.size(); i++)
{
if (!sMailServer.IsEmpty())
sMailServer += ",";
sMailServer += saDomainNames[i];
}
*MailServer = sMailServer.AllocSysString();
return S_OK;
}
catch (...)
{
return COMError::GenerateGenericMessage();
}
}
示例2: AddRecipient
STDMETHODIMP InterfaceMessage::AddRecipient(BSTR bstrName, BSTR bstrAddress)
{
try
{
if (!m_pObject)
return GetAccessDenied();
// Add this recipent to the actual email.
HM::String sAddress(bstrAddress);
HM::String sName (bstrName);
bool recipientOK = false;
HM::RecipientParser recipientParser;
recipientParser.CreateMessageRecipientList(sAddress, m_pObject->GetRecipients(), recipientOK);
// Add this recipient to the mime message.
HM::String sThisAddress = "\"" + sName + "\"" + " <" + sAddress + ">";
HM::String sTo = _GetMessageData()->GetTo();
if (!sTo.IsEmpty())
sTo += ",";
sTo += sThisAddress;
_GetMessageData()->SetTo(sTo);
return S_OK;
}
catch (...)
{
return COMError::GenerateGenericMessage();
}
}
示例3: Connect
STDMETHODIMP InterfaceApplication::Connect()
{
try
{
HM::String sErrorMessage = HM::Application::Instance()->GetLastErrorMessage();
if (!sErrorMessage.IsEmpty())
return COMError::GenerateError(sErrorMessage);
return S_OK;
}
catch (...)
{
return COMError::GenerateGenericMessage();
}
}
示例4: Reinitialize
STDMETHODIMP InterfaceApplication::Reinitialize()
{
try
{
if (!authentication_->GetIsServerAdmin())
return authentication_->GetAccessDenied();
HM::String sErrorMessage = HM::Application::Instance()->Reinitialize();
if (!sErrorMessage.IsEmpty())
return COMError::GenerateError(sErrorMessage);
return S_OK;
}
catch (...)
{
return COMError::GenerateGenericMessage();
}
}
示例5: Save
STDMETHODIMP InterfaceMessage::Save()
{
try
{
if (!m_pObject)
return GetAccessDenied();
// Check that the message has a valid date header.
HM::String sDate = _GetMessageData()->GetSentTime();
if (sDate.IsEmpty())
{
// Date was not specified. Specify it now.
sDate = HM::Time::GetCurrentMimeDate();
_GetMessageData()->SetSentTime(sDate);
}
shared_ptr<const HM::Account> account;
if (m_pObject->GetAccountID() > 0)
{
account = HM::CacheContainer::Instance()->GetAccount(m_pObject->GetAccountID());
}
// Save the message to disk.
const HM::String fileName = HM::PersistentMessage::GetFileName(account, m_pObject);
if (!_GetMessageData()->Write(fileName))
{
return COMError::GenerateError("Unable to write to message file.");
}
// A message can be in a number of different states:
// Case 1) New message which should be delivered -> Save in file and add to database
// Case 2) New message which should be added to an existing IMAP folder -> Update message file and save to database//
// case 3) Existing message which is being delivered. -> Only update the message fil
// Case 4) Existing message in IMAP folder which should just be re-saved -> Update message file
HM::Message::State state = m_pObject->GetState();
switch (state)
{
case HM::Message::Created:
{
// Handle new message. It can either be Case 1 or Case 2. If the message is already
// connected to an account, it means that it should be stored in a specific IMAP folder
if (m_pObject->GetFolderID() == 0 && m_pObject->GetAccountID() == 0)
{
// Case 1: The message should be delivered. Change the state to delivering
m_pObject->SetState(HM::Message::Delivering);
if (!HM::PersistentMessage::SaveObject(m_pObject))
{
return COMError::GenerateError("Message could not be saved in database.");
}
HM::Application::Instance()->SubmitPendingEmail();
}
else
{
// Case 2. It's a new message but it should be added to an existing IMAP folder.
m_pObject->SetState(HM::Message::Delivered);
return _SaveNewMessageToIMAPFolder();
}
break;
}
case HM::Message::Delivering:
{
// Handle message which is being delivered. Saving in database will be taken
// care about by the delivery process. Since the file has already been updated
// on disk, there's not more for us to do here.
break;
}
case HM::Message::Delivered:
{
// The message has already been delivered. It's placed inside an account mailbox.
// All we need to do is to update it in the database.
if (!HM::PersistentMessage::SaveObject(m_pObject))
return S_FALSE;
break;
}
default:
{
// Unhandled case.
return COMError::GenerateError("The message could not be saevd. It is in an unknown state.");
}
}
return S_OK;
}
catch (...)
{
return COMError::GenerateGenericMessage();
}
}