⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 base_exception.cpp

📁 270的linux说明
💻 CPP
📖 第 1 页 / 共 2 页
字号:
// GetDetailErrorInfo//==============================================================================const IntelMobileChar* IntelMobileException::GetDetailErrorInfo( const IntelMobileChar* ErrorCode ){	const IntelMobileChar* pszInfo = IntelMobileText("");//	gErrorCollection.Lock();	//gErrorMap.Lock();	if ( gExceptionInitlize == 0 )	{	/*	IntelMobileString sFile = g_sPropertyFileDirectory + g_sFileName;				USES_CONVERSION;		// basic_ifstream< TCHAR, char_traits<TCHAR> > infile( _com_util::ConvertBSTRToString((BSTR)(sFile.c_str())), ios::in );		basic_ifstream< TCHAR, char_traits<TCHAR> > infile( T2A(sFile.c_str()), ios::in );		if ( !infile )		{//			gErrorCollection.Unlock();			gErrorMap.Unlock();			return IntelMobileText("");		}					try {			TCHAR line[1000];			IntelMobileString aline;			while(infile._Ipfx())			{				infile.getline(line, 1000);				aline = line;				//infile >> line;				size_t pos = aline.find( IntelMobileText("=") );				if (pos == -1)					continue;				gErrorMap.insert( pair<IntelMobileString, IntelMobileString>( Trim(aline.substr(0, pos)), Trim(aline.substr(pos+1)) ) );//				gErrorCollection.push_back( pair<IntelMobileString, IntelMobileString>( Trim(aline.substr(0, pos)), Trim(aline.substr(pos+1)) ) );			}		}		catch(...)		{			infile.close();//			gErrorCollection.Unlock();			gErrorMap.Unlock();			return IntelMobileText("");		}		infile.close();*/		gExceptionInitlize = 1;	}			/*	if ( !gErrorMap.empty() )	{		ExceptionMap::iterator Iterator;				Iterator = gErrorMap.find( ErrorCode );		if (!(Iterator == gErrorMap.end()))		{			pszInfo = Iterator->second.c_str();		}	}	*//*	if ( gErrorCollection.size() > 0 )	{		ExceptionCollection::iterator itr;		for ( itr = gErrorCollection.begin(); itr < gErrorCollection.end(); ++itr )		{			if ( itr->first.compare(ErrorCode) == 0 ) 			{				pszInfo = itr->second.c_str();			}		}			}*/	//gErrorMap.Unlock();	// gErrorCollection.Unlock();	return pszInfo;}//==============================================================================// Trim()//==============================================================================IntelMobileString IntelMobileException::Trim(IntelMobileString src){	size_t size = src.size();//size_t i=0;	for (/*size_t i=0*/; i<size; i++)	{		if( src[i] != L' ' )			break;	}	size_t stpos = i;		size_t count = 0;	for (size_t i=size-1; i>stpos; i--)	{		if( src[i] != L' ' )			break;	}		count = i - stpos + 1;	return src.substr(stpos, count);}//==============================================================================// IML2W()//==============================================================================void IntelMobileException::IML2W(LONG lErrorCode, IntelMobileChar* code){//	TCHAR codearray[10];//	_ltow(lErrorCode, code, 16);//	code = codearray;}//==============================================================================// SetPropertyFileDirectory()//==============================================================================void IntelMobileException::SetPropertyFileDirectory(IntelMobileString& sPropertyFileDirectory){	g_sPropertyFileDirectory = sPropertyFileDirectory;}//==============================================================================// SetFileName()//==============================================================================void IntelMobileException::SetFileName(IntelMobileString& sFileName){	g_sFileName = sFileName;}//==============================================================================// GetErrorCode()//==============================================================================const IntelMobileChar* IntelMobileException::GetErrorCode() const{//    return const_cast<IntelMobileChar *>(m_sErrorCode.c_str());//	return m_sErrorCode.c_str();	return m_sErrorCode;} // GetErrorCode()//==============================================================================// GetMessage()//==============================================================================const IntelMobileChar* IntelMobileException::GetGeneralMessage() const{//    return m_sMessage.c_str();	return m_sMessage;} // GetMessage()//==============================================================================// GetSource()//==============================================================================const IntelMobileChar* IntelMobileException::GetSource() const{//    return m_sSource.c_str();	return m_sSource;} // GetSource()//==============================================================================// GetTargetSite()//==============================================================================const IntelMobileChar* IntelMobileException::GetTargetSite() const{//    return m_sTargetSite.c_str();	return m_sTargetSite;} // GetTargetSite()//==============================================================================// SetSource()//==============================================================================void IntelMobileException::SetSource( const IntelMobileChar* pszSource ){//    m_sSource = pszSource;	delete[] m_sSource;#ifdef _UNICODE    m_sSource = new IntelMobileChar[::wcslen(pszSource)+1];#else    m_sSource = new IntelMobileChar[::strlen(pszSource)+1];#endif    if ( m_sSource )    {#ifdef _UNICODE        ::wcscpy( m_sSource, pszSource ); #else        strcpy( m_sSource, pszSource ); #endif    }} // SetSource()//==============================================================================// SetSource()//==============================================================================void IntelMobileException::SetSource( const IntelMobileString& sSource ){//    m_sSource = sSource;	SetSource( sSource.c_str() );} // SetSource()//==============================================================================// SetTargetSite()//==============================================================================void IntelMobileException::SetTargetSite( const IntelMobileChar* pszSite ){//    m_sTargetSite = pszSite;	delete[] m_sTargetSite;#ifdef _UNICODE    m_sTargetSite = new IntelMobileChar[::wcslen(pszSite)+1];#else    m_sTargetSite = new IntelMobileChar[::strlen(pszSite)+1];#endif    if ( m_sTargetSite )    {#ifdef _UNICODE        ::wcscpy( m_sTargetSite, pszSite ); #else        strcpy( m_sTargetSite, pszSite ); #endif    }} // SetTargetSite()//==============================================================================// SetTargetSite()//==============================================================================void IntelMobileException::SetTargetSite( const IntelMobileString& sSite ){//    m_sTargetSite = sSite;	SetTargetSite( sSite.c_str() );} // SetTargetSite()//==============================================================================//==============================================================================// class  InvalidOperationException//==============================================================================// Default C-Tor()//==============================================================================InvalidOperationException::InvalidOperationException( const IntelMobileChar* pszSource,                                                      const IntelMobileChar* pszSite,													  const LONG lErrorCode )                         : IntelMobileException( IntelMobileText("Invalid Operation"),                                             pszSource, pszSite, lErrorCode ){}//==============================================================================// String C-Tor()//==============================================================================InvalidOperationException::InvalidOperationException( const IntelMobileString& sSource,                                                      const IntelMobileString& sSite )                         : IntelMobileException( IntelMobileText("Invalid Operation"),                                             sSource.c_str(),                                             sSite.c_str() ){}//==============================================================================// String C-Tor()//==============================================================================InvalidOperationException::InvalidOperationException( const IntelMobileString& sSource,                                                      const IntelMobileString& sSite,													  const LONG lErrorCode )                         : IntelMobileException( IntelMobileText("Invalid Operation"),                                             sSource.c_str(),                                             sSite.c_str(),											lErrorCode ){}//==============================================================================// D-Tor()//==============================================================================InvalidOperationException::~InvalidOperationException(){}//==============================================================================//==============================================================================// class  InvalidInterfaceException//==============================================================================// Default C-Tor()//==============================================================================InvalidInterfaceException::InvalidInterfaceException( const IntelMobileChar* pszSource,                                                      const IntelMobileChar* pszSite,													  const LONG lErrorCode )                         : IntelMobileException( IntelMobileText("Invalid Interface"),                                             pszSource, pszSite, lErrorCode){}//==============================================================================// String C-Tor()//==============================================================================InvalidInterfaceException::InvalidInterfaceException( const IntelMobileString& sSource,                                                      const IntelMobileString& sSite )                         : IntelMobileException( IntelMobileText("Invalid Interface"),                                             sSource.c_str(),                                             sSite.c_str() ){}//==============================================================================// String C-Tor()//==============================================================================InvalidInterfaceException::InvalidInterfaceException( const IntelMobileString& sSource,                                                      const IntelMobileString& sSite,													  const LONG lErrorCode )                         : IntelMobileException( IntelMobileText("Invalid Interface"),                                             sSource.c_str(),                                             sSite.c_str(),											lErrorCode ){}//==============================================================================//==============================================================================// D-Tor()//==============================================================================InvalidInterfaceException::~InvalidInterfaceException(){}//==============================================================================

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -