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


C++ String::Format方法代码示例

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


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

示例1: UtilGetFileNameByMessageID

STDMETHODIMP InterfaceDatabase::UtilGetFileNameByMessageID(hyper lMessageID, BSTR *Output)
{
   try
   {
      if (!GetIsServerAdmin())
         return GetAccessDenied();
   
      HRESULT hRes = EnsureDatabaseConnectivity_();
      if (hRes != S_OK)
         return hRes;
   
      HM::String sSQL;
      sSQL.Format(_T("select messagefilename from hm_messages where messageid = %d"), lMessageID);
   
      std::shared_ptr<HM::DALRecordset> pRS = db_manager_->OpenRecordset(HM::SQLCommand(sSQL));
      if (!pRS)
         return S_OK;
   
      HM::String sRetVal = "";
      if (!pRS->IsEOF())
         sRetVal = pRS->GetStringValue("messagefilename");
   
   
      *Output = sRetVal.AllocSysString();
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
开发者ID:AimaTeam-hehai,项目名称:hmailserver,代码行数:32,代码来源:InterfaceDatabase.cpp

示例2: 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;
}
开发者ID:AimaTeam-hehai,项目名称:hmailserver,代码行数:19,代码来源:InterfaceDatabase.cpp

示例3: Load

// <?xml version='1.0'?>
// <TAG attr1="value1" attr2='value2' attr3=value3 >
// </TAG>
// or
// <TAG />
//        ^- return pointer
//========================================================
// Name   : Load
// Desc   : load xml plain text for xml document
// Param  : pszXml - plain xml text
//          pi = parser information
// Return : advanced string pointer  (error return NULL)
//--------------------------------------------------------
// Coder    Date                      Desc
// bro      2002-10-29
//========================================================
LPTSTR _tagXMLDocument::Load( LPCTSTR pszXml, LPPARSEINFO pi /*= NULL*/ )
{
	LPXNode node = new XNode;
	node->parent = (LPXNode)this;
	node->type = XNODE_ELEMENT;
	node->doc = this;
	LPTSTR end;
	
	if( pi == NULL )
		pi = &parse_info;

	if( (end = node->Load( pszXml, pi )) == NULL )
	{
		delete node;
		
      if (pi->erorr_occur == true)
      {
         // This error should be logged.
         HM::String sErrorMessage;
         sErrorMessage.Format(_T("The XML data stream contains formatting errors. Code: %d, Error: %s"), pi->error_code, pi->error_string); 
         
         HM::ErrorManager::Instance()->ReportError(HM::ErrorManager::Medium, 4229, "_tagXMLDocument::Load", sErrorMessage);
      }
      
      return NULL;
	}

	childs.push_back( node );

	// Load Other Node after </Tag>(pi, comment, CDATA etc)
	LPTSTR ret;
	bool bRet = false;
	ret = LoadOtherNodes( node, &bRet, end, pi );
	if( ret != NULL ) 
		end = ret;

	return end;
}
开发者ID:Bill48105,项目名称:hmailserver,代码行数:54,代码来源:XMLite.cpp


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