本文整理汇总了C++中hm::String类的典型用法代码示例。如果您正苦于以下问题:C++ String类的具体用法?C++ String怎么用?C++ String使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了String类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: put_VacationMessageExpiresDate
STDMETHODIMP InterfaceAccount::put_VacationMessageExpiresDate(BSTR newVal)
{
try
{
if (!object_)
return GetAccessDenied();
HM::String string = newVal;
// Validate input date.
if (string.Left(4) == _T("0000"))
string = "";
if (string.GetLength() == 0)
string = Time::GetCurrentDate();
else if (string.GetLength() != 10 || !Time::IsValidSystemDate(string))
return COMError::GenerateError("Invalid auto-reply expiry date");
object_->SetVacationExpiresDate(string);
return S_OK;
}
catch (...)
{
return COMError::GenerateGenericMessage();
}
}
示例2: GenerateGUID
STDMETHODIMP InterfaceUtilities::GenerateGUID(BSTR *Output)
{
try
{
HM::String sOutput = HM::GUIDCreator::GetGUID();
*Output = sOutput.AllocSysString();
return S_OK;
}
catch (...)
{
return COMError::GenerateGenericMessage();
}
}
示例3:
HM::String _tagXMLEntitys::Ref2Entity( LPCTSTR estr )
{
HM::String es;
if( estr )
{
int len = _tcslen(estr);
LPTSTR esbuf = es.GetBufferSetLength( len +1);
if( esbuf )
Ref2Entity( estr, esbuf, len );
es.ReleaseBuffer();
}
return es;
}
示例4: 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();
}
}
示例5: sInput
STDMETHODIMP InterfaceUtilities::SHA256(BSTR Input, BSTR *Output)
{
try
{
HM::String sInput(Input);
HM::String sOutput = HM::Crypt::Instance()->EnCrypt(sInput, HM::Crypt::ETSHA256);
*Output = sOutput.AllocSysString();
return S_OK;
}
catch (...)
{
return COMError::GenerateGenericMessage();
}
}
示例6: get_String
STDMETHODIMP InterfaceLanguage::get_String(BSTR EnglishString, BSTR *pVal)
{
try
{
if (!language_)
return GetAccessDenied();
HM::String sText = language_->GetString(EnglishString);
*pVal = sText.AllocSysString();
return S_OK;
}
catch (...)
{
return COMError::GenerateGenericMessage();
}
}
示例7: GetAccessDenied
STDMETHODIMP
InterfaceIMAPFolder::get_Name(BSTR *pVal)
{
try
{
if (!m_pObject)
return GetAccessDenied();
HM::String sUnicode = HM::ModifiedUTF7::Decode(m_pObject->GetFolderName());
*pVal = sUnicode.AllocSysString();
return S_OK;
}
catch (...)
{
return COMError::GenerateGenericMessage();
}
}
示例8: get_Name
STDMETHODIMP InterfaceLanguage::get_Name(BSTR *pVal)
{
try
{
if (!language_)
return GetAccessDenied();
HM::String sName = language_->GetName();
*pVal = sName.AllocSysString();
return S_OK;
}
catch (...)
{
return COMError::GenerateGenericMessage();
}
}
示例9: String
HM::String _tagXMLEntitys::Entity2Ref( LPCTSTR str )
{
HM::String s;
if( str )
{
int nEntityCount = GetEntityCount(str);
if( nEntityCount == 0 )
return HM::String(str);
int len = _tcslen(str) + nEntityCount*10 ;
LPTSTR sbuf = s.GetBufferSetLength( len + 1 );
if( sbuf )
Entity2Ref( str, sbuf, len );
s.ReleaseBuffer();
}
return s;
}
示例10: get_Address
STDMETHODIMP InterfaceTCPIPPort::get_Address(BSTR *pVal)
{
try
{
if (!m_pObject)
return GetAccessDenied();
HM::String sIPAddress = m_pObject->GetAddressString();
*pVal = sIPAddress.AllocSysString();
return S_OK;
}
catch (...)
{
return COMError::GenerateGenericMessage();
}
}
示例11: SetDefaultDatabase
STDMETHODIMP InterfaceDatabase::SetDefaultDatabase(eDBtype ServerType, BSTR ServerName, long lPort, BSTR DatabaseName, BSTR Username, BSTR Password)
{
try
{
if (!GetIsServerAdmin())
return GetAccessDenied();
HM::String sEmpty;
HM::String sServerName = ServerName;
HM::String sDatabaseName = DatabaseName;
HM::String sUsername = Username;
HM::String sPassword = Password;
if (sDatabaseName.Find(_T(" ")) >= 0)
return COMError::GenerateError("The database name may not contain spaces.");
// Create a settings object for the connection ...
std::shared_ptr<HM::DatabaseSettings> pSettings = std::shared_ptr<HM::DatabaseSettings>(
new HM::DatabaseSettings(sServerName, sEmpty, sUsername, sPassword, sEmpty, sEmpty,(HM::DatabaseSettings::SQLDBType) ServerType, lPort));
// Connect to the database server.
std::shared_ptr<HM::DALConnection> pConn = HM::DALConnectionFactory::CreateConnection(pSettings);
HM::String sErrorMessage;
if (pConn->Connect(sErrorMessage) != HM::DALConnection::Connected)
return COMError::GenerateError(sErrorMessage);
// Disconnect again.
pConn->Disconnect();
ini_file_settings_->SetDatabaseDirectory("");
ini_file_settings_->SetDatabaseType((HM::DatabaseSettings::SQLDBType) ServerType);
ini_file_settings_->SetUsername(sUsername);
ini_file_settings_->SetPassword(sPassword);
ini_file_settings_->SetDatabasePort(lPort);
ini_file_settings_->SetDatabaseServer(sServerName);
ini_file_settings_->SetDatabaseName(sDatabaseName);
ini_file_settings_->SetIsInternalDatabase(ServerType == hDBTypeMSSQLCE);
return S_OK;
}
catch (...)
{
return COMError::GenerateGenericMessage();
}
}
示例12: 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();
}
}
示例13: get_RecipientAddress
STDMETHODIMP InterfaceDistributionListRecipient::get_RecipientAddress(BSTR *pVal)
{
try
{
if (!m_pObject)
return GetAccessDenied();
HM::String sVal = m_pObject->GetAddress();
*pVal = sVal.AllocSysString();
return S_OK;
}
catch (...)
{
return COMError::GenerateGenericMessage();
}
}
示例14: GenerateError
HRESULT
InterfaceDatabase::EnsureDatabaseConnectivity_()
{
db_manager_ = HM::Application::Instance()->GetDBManager();
if (!db_manager_)
{
return COMError::GenerateError("The connection to the database is not available. Please check the hMailServer error log for details.");
}
if (!db_manager_->GetIsConnected())
{
HM::String sError;
sError.Format(_T("The connection to the database is not available.\r\n%s"), HM::Application::Instance()->GetLastErrorMessage().c_str());
return COMError::GenerateError(sError);
}
return S_OK;
}
示例15: TestClamAVScanner
STDMETHODIMP InterfaceAntiVirus::TestClamAVScanner(BSTR hostname, long port, BSTR *messageText, VARIANT_BOOL *pResult)
{
try
{
if (!GetIsServerAdmin())
return GetAccessDenied();
HM::VirusScannerTester testClient;
HM::String text;
*pResult = testClient.TestClamAVConnect(hostname, port, text) ? VARIANT_TRUE : VARIANT_FALSE;
*messageText = text.AllocSysString();
return S_OK;
}
catch (...)
{
return COMError::GenerateGenericMessage();
}
}