本文整理汇总了C++中Except函数的典型用法代码示例。如果您正苦于以下问题:C++ Except函数的具体用法?C++ Except怎么用?C++ Except使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Except函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Except
int
P4ClientApi::FormatSpec( const char * type, int table )
{
if ( !specMgr.HaveSpecDef( type ) )
{
StrBuf m;
m = "No spec definition for ";
m.Append( type );
m.Append( " objects." );
return Except( "P4#format_spec", m.Text() );
}
// Got a specdef so now we can attempt to convert.
StrBuf buf;
Error e;
specMgr.SpecToString( type, table, buf, &e );
if( !e.Test() ) {
lua_pushstring( L, buf.Text() );
return 1;
}
StrBuf m;
m = "Error converting hash to a string.";
if( e.Test() ) e.Fmt( m, EF_PLAIN );
return Except( "P4#format_spec", m.Text() );
}
开发者ID:Malaar,项目名称:luaplus51-all,代码行数:27,代码来源:p4clientapi.cpp
示例2: fprintf
int P4ClientAPI::SetCharset( const char *c )
{
if( P4LUADEBUG_COMMANDS )
fprintf( stderr, "[P4] Setting charset: %s\n", c );
CharSetApi::CharSet cs = CharSetApi::NOCONV;
if ( strlen(c) > 0 ) {
cs = CharSetApi::Lookup( c );
if( cs < 0 )
{
if( exceptionLevel )
{
StrBuf m;
m = "Unknown or unsupported charset: ";
m.Append( c );
return Except( "P4.charset", m.Text() );
}
return 0;
}
}
if( CharSetApi::Granularity( cs ) != 1 ) {
return Except( "P4.charset", "P4Lua does not support a wide charset!");
}
client.SetCharset(c);
client.SetTrans( cs, cs, cs, cs );
return 1;
}
开发者ID:scw000000,项目名称:Engine,代码行数:31,代码来源:p4clientapi.cpp
示例3: Except
//--------------------------------------------------------------------------------------------------------------
//创建二维纹理
Texture* D3D9TextureManager::CreateTexture( UINT nWidth, UINT nHeight, PixelFormat ePixelFormat,
TextureUsage Type, int nNumLevels )
{
//如果为压缩纹理格式
if( ePixelFormat & PF_COMPRESS_MASK )
{
//检测指定纹理压缩格式是否可用
if( !CheckCompressFormat( ePixelFormat ) )
Except( Exception::ERR_INTERNAL_ERROR, "硬件不支持指定的纹理压缩格式,无法创建纹理。" );
if( !IsPow2( nWidth ) || !IsPow2( nHeight ) )
Except( Exception::ERR_INTERNAL_ERROR, "无法创建非 2 次幂尺寸的压缩纹理。" );
}
//获取最佳的纹理尺寸
UINT texWidth = 0;
UINT texHeight = 0;
GetBestSize( nWidth, nHeight, texWidth, texHeight );
nNumLevels = (UINT)( ( nNumLevels == -1 ) ? mDefTexLevels : nNumLevels );
Texture* pTex = new D3D9Texture( texWidth, texHeight, ePixelFormat, nNumLevels, Type );
*mTextureList.Push() = pTex;
++mNumTextures;
return pTex;
}
开发者ID:adan830,项目名称:FKEngine,代码行数:30,代码来源:D3D9TextureManager.cpp
示例4: Except
//--------------------------------------------------------------------------------------------------------------
TextSurface::TextSurface( ZOrderType eZType, OverlaySurface* pZRefOverlay, FontFace* pFont, LPCWSTR szText,
int nX, int nY, int nLineWidth, int nMaxChars, DWORD dwColor, TextureFilterType eFilterType )
:OverlaySurface ( eZType, pZRefOverlay, eFilterType )
,mpFont (pFont)
, mpText (NULL)
, mNumChars (0)
, mX (nX)
, mY (nY)
, mLineWidth (nLineWidth)
, mTextColor (dwColor)
{
if( nX + mpFont->mnMaxWidth > nLineWidth )
Except( Exception::ERR_INVALIDPARAMS, "指定平面文字行宽度过小。" );
//计算字符串长度
int nNumChars = 0;
wchar_t* pChar = (wchar_t*)szText;
while( *pChar != 0 )
{
++pChar;
++nNumChars;
}
//如果未指定最大字符数量则使用当前字符串字符数量
if( nMaxChars == 0 )
mMaxChars = nNumChars;
else if( nMaxChars < nNumChars )
Except( Exception::ERR_INVALIDPARAMS, "指定的最大字符数量小于当前文字字符数量。" );
else
mMaxChars = nMaxChars;
mNumChars = nNumChars;
//分配内存
size_t nStrLen = sizeof(wchar_t) * ( mMaxChars + 1 );
size_t nDrawLen = sizeof(FontFace::GlyphDraw) * mMaxChars;
BYTE* pMem = (BYTE*)malloc( nStrLen + nDrawLen + sizeof(OverlayVertex)*6*mMaxChars );
//复制字符串
mpText = (wchar_t*)pMem;
memcpy( mpText, szText, sizeof(wchar_t) * ( mNumChars + 1 ) );
//分配字形数据缓存
mpGlyphDraw = (FontFace::GlyphDraw*)( pMem + nStrLen );
memset( mpGlyphDraw, 0, nDrawLen );
//分配顶点数据缓存
mpVertexData = (OverlayVertex*)( pMem + nStrLen + nDrawLen );
mpVertexPtr = mpVertexData;
mNumVertex = 0;
//更新文字数据
_UpdateText();
}
开发者ID:adan830,项目名称:FKEngine,代码行数:56,代码来源:TextSurface.cpp
示例5: throw
float CNProbeSet::getIntensityContrast(double dK)
{
if ((m_fAMedianIntensity + m_fBMedianIntensity) == 0) {
throw(Except("Zero median intensities found. CEL file may be corrupted."));
}
float fContrast = (float)(sinh(dK * (m_fAMedianIntensity - m_fBMedianIntensity) / (m_fAMedianIntensity + m_fBMedianIntensity)) / sinh(dK));
if (fabs(fContrast) > 1) {
throw(Except("Can't have abs(contrast) > 1."));
}
return fContrast;
}
开发者ID:einon,项目名称:affymetrix-power-tools,代码行数:11,代码来源:CNProbeSet.cpp
示例6: Except
//--------------------------------------------------------------------------------------------------------------
//创建纹理状态
TextureState* Material::CreateTextureState( UINT nStage )
{
if( mppTextureState[nStage] != NULL )
Except( Exception::ERR_INVALIDPARAMS, "指定的纹理状态已经存在,无法重复创建。" );
if( nStage >= RenderSystem::mpSingleton->mMaxTextureNum )
Except( Exception::ERR_INTERNAL_ERROR, "无法超过支持的纹理状态最大限,创建纹理状态失败。" );
mppTextureState[nStage] = new TextureState;
return mppTextureState[nStage];
}
开发者ID:adan830,项目名称:FKEngine,代码行数:14,代码来源:Material.cpp
示例7: _SyncOperation
//--------------------------------------------------------------------------------------------------------------
//读取文件数据
void BaseFile::Read( void* pBuf, DWORD dwLen )
{
//如果最后进行的缓存操作不是读取操作
if( mLastBuffedOp != BOT_Read )
_SyncOperation();
BYTE* pDstBuf = (BYTE*)pBuf;
while( dwLen != 0 )
{
//如果缓存中已存在数据
if( mdwCachedLen != 0 )
{
//读取缓存中的剩余数据
DWORD dwCopyLen = ( dwLen < mdwCachedLen ) ? dwLen : mdwCachedLen;
memcpy( pBuf, mpCachePtr, dwCopyLen );
mdwCachedLen -= dwCopyLen;
mpCachePtr += dwCopyLen;
dwLen -= dwCopyLen;
pDstBuf += dwCopyLen;
}
//如果缓存中已不存在数据且读取长度大于等于缓存长度
else if( dwLen >= mCacheLen )
{
//直接从文件中读取数据
if( dwLen != _InternalRead( pDstBuf, dwLen ) )
Except( Exception::ERR_CANNOT_READ_FILE, STR_ERR_READ_LEN );
break;
}
//如果缓存中已不存在数据且读取长度小于缓存长度
else
{
//从文件中读取数据填充缓存
DWORD dwReadLen = _InternalRead( mpCache, mCacheLen );
if( dwReadLen < dwLen )
Except( Exception::ERR_CANNOT_READ_FILE, STR_ERR_READ_LEN );
//从缓存中读取指定长度的数据
memcpy( pDstBuf, mpCache, dwLen );
mpCachePtr = mpCache + dwLen;
mdwCachedLen = dwReadLen - dwLen;
break;
}
}
//记录最后的缓存操作类型
mLastBuffedOp = BOT_Read;
mPosition += dwLen;
}
开发者ID:adan830,项目名称:FKEngine,代码行数:54,代码来源:BaseFile.cpp
示例8: runImp
/**
* @brief Run the copy number ratio engine. The copy number ratio engine will inturn call the copy number engine.
* @param CopyNumberOptions* - The options to run with.
* @return int - 0 if successful else 1
*/
void CNReferenceEngine::runImp()
{
try
{
m_data.setEngine(m_pEngine);
uint64_t memAvail = ::getDouble(m_pEngine->getOpt("free-mem-at-start"));
if (memAvail >= (2000 * MEGABYTE))
{
m_pEngine->setOpt("mem-usage", "2000");
}
else
{
int iMemUsage = (memAvail / MEGABYTE);
m_pEngine->setOpt("mem-usage", ::getInt(iMemUsage));
}
m_data.loadAnnotation(true);
m_iProbeSetCount = m_data.getProbeSets()->getCount();
m_iExperimentCount = m_data.loadExperiments(m_pEngine->getOpt("expr-summary-file"));
if (m_iExperimentCount == 0) {throw(Except("No experiments to process."));}
if (m_iProbeSetCount == 0) {throw(Except("No probesets to process."));}
if (!determineMemoryUsage()) {return;}
if (!processData()) {return;}
m_pEngine->setOpt("sample-count", ::getInt(m_iExperimentCount));
if (!m_data.writeModelFile(m_pEngine->getOpt("reference-file"))) {return;}
if (m_pEngine->isOptDefined("wave-correction-reference-method"))
{
if ((m_pEngine->getOpt("wave-correction-reference-method") != "none") && (m_pEngine->getOpt("wave-correction-reference-method") != ""))
{
CNAnalysisMethodFactory amFactory;
CNAnalysisMethod* am = NULL;
am = amFactory.CNAnalysisMethodForString(m_pEngine->getOpt("wave-correction-reference-method"));
am->setEngine(m_pEngine);
am->run();
delete am;
}
}
if ((m_pEngine->isOptDefined("temp-reference-file")) && (m_pEngine->getOpt("temp-reference-file") != ""))
{
Fs::rm(m_pEngine->getOpt("temp-reference-file"));
}
clear();
}
catch(...) {m_data.clear(); throw;}
}
开发者ID:einon,项目名称:affymetrix-power-tools,代码行数:53,代码来源:CNReferenceEngine.cpp
示例9: Except
int P4ClientAPI::Except( const char *func, Error *e )
{
StrBuf m;
e->Fmt( &m );
return Except( func, m.Text() );
}
开发者ID:scw000000,项目名称:Engine,代码行数:7,代码来源:p4clientapi.cpp
示例10: ResetFlags
int P4ClientAPI::ConnectOrReconnect()
{
if( IsTrackMode() )
client.SetProtocol( "track", "" );
Error e;
ResetFlags();
client.Init( &e );
if ( e.Test() && exceptionLevel ) {
return Except( "P4:connect()", &e );
}
if ( e.Test() )
return 0;
// If an iterator is defined, reset the break functionality
// for the KeepAlive function
if( ui.GetHandler() != LUA_NOREF )
{
client.SetBreak( &ui );
}
SetConnected();
lua_pushboolean( L, true );
return 1;
}
开发者ID:scw000000,项目名称:Engine,代码行数:29,代码来源:p4clientapi.cpp
示例11: switch
//--------------------------------------------------------------------------------------------------------------
//建立新二叉树分割面
void BSPGenerator::_BuildNewPlane3( WORD pVerIndex[4], int nNumVer, BSPPlaneList* pNewPlane3List )
{
//根据顶点数量判断建立的三角面数量
switch (nNumVer)
{
case 3:
{
*pNewPlane3List->Push() = mpPlane3Buf + mNumFace;
mpPlane3Buf[ mNumFace++ ].SetFromPoints( mpVertexBuf, pVerIndex[0], pVerIndex[1], pVerIndex[2] );
break;
}
case 4:
{
*pNewPlane3List->Push() = mpPlane3Buf + mNumFace;
mpPlane3Buf[ mNumFace++ ].SetFromPoints( mpVertexBuf, pVerIndex[0], pVerIndex[1], pVerIndex[2] );
*pNewPlane3List->Push() = mpPlane3Buf + mNumFace;
mpPlane3Buf[ mNumFace++ ].SetFromPoints( mpVertexBuf, pVerIndex[0], pVerIndex[2], pVerIndex[3] );
break;
}
default:
Except( Exception::ERR_INTERNAL_ERROR, "三角形分割后生成的新顶点数量错误。" );
}
}
开发者ID:adan830,项目名称:FKEngine,代码行数:28,代码来源:BSPGenerator.cpp
示例12: determineMemoryUsage
/**
* Guesstimate the maximum number of probe sets we can load for all experiments.
* Guesstimate the maximum number of experiments we can load for all probe sets.
* @return bool - true if successful
*/
bool CNReferenceEngine::determineMemoryUsage()
{
int iMemUsage = m_pEngine->getOptInt("mem-usage");
int iMBUsedForProbeSetList = (int)((77 * m_iProbeSetCount) / 1000000.0);
int iMBUsedForExperimentList = (int)((58 * m_iExperimentCount) / 1000000.0);
m_iProbeSetsToProcess = (int)((((iMemUsage - iMBUsedForProbeSetList - iMBUsedForExperimentList) * 1000000.0) / 9.0) / m_iExperimentCount);
if (m_iProbeSetsToProcess <= 0) {throw(Except("Not enough memory to run application. ProbeSetsToProcess = " + ::getInt(m_iProbeSetsToProcess)));}
if (m_iProbeSetsToProcess > m_iProbeSetCount) {m_iProbeSetsToProcess = m_iProbeSetCount;}
m_iExperimentsToProcess = (int)((((iMemUsage - iMBUsedForProbeSetList - iMBUsedForExperimentList) * 1000000.0) / 9.0) / m_iProbeSetCount);
if (m_iExperimentsToProcess <= 0) {throw(Except("Not enough memory to run application. ExperimentsToProcess = " + ::getInt(m_iExperimentsToProcess)));}
if (m_iExperimentsToProcess > m_iExperimentCount) {m_iExperimentsToProcess = m_iExperimentCount;}
return true;
}
开发者ID:einon,项目名称:affymetrix-power-tools,代码行数:21,代码来源:CNReferenceEngine.cpp
示例13: Except
//-----------------------------------------------------------------------
SubEntity* Entity::getSubEntity(unsigned int index) {
if (index >= mSubEntityList.size())
Except(Exception::ERR_INVALIDPARAMS,
"Index out of bounds.",
"Entity::getSubEntity");
return mSubEntityList[index];
}
开发者ID:zgpxgame,项目名称:iEngine,代码行数:8,代码来源:Entity.cpp
示例14: dbms
Dbms* dbms()
{
if (isclient())
{
if (! tls().thedbms)
{
if (Fibers::inMain())
tls().thedbms = dbms_remote(server_ip);
else
{
try
{
tls().thedbms = dbms_remote_async(server_ip);
}
catch (const Except& e)
{
throw Except(e,
"thread failed to connect to db server: " + e.gcstr());
}
tls().thedbms->auth(Fibers::main_dbms()->token());
}
}
return tls().thedbms;
}
else
{
static Dbms* local = dbms_local();
return local;
}
}
开发者ID:leeeqian,项目名称:csuneido,代码行数:30,代码来源:dbms.cpp
示例15: GetCheckVal
// Will do is IsTypeOf T before getting and throw if types dont match
T GetCheckVal() const
{
if(IsTypeOf<T>())
return GetVal();
else
throw Except(String("GetCheckVal expected ")+typeid(T).name());
}
开发者ID:Racinettee,项目名称:TheDarknessM,代码行数:8,代码来源:LuaObj.hpp
示例16: throw_exception
static void
throw_exception (void)
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t) throw exception\n")));
throw Except ();
}
开发者ID:esohns,项目名称:ATCD,代码行数:7,代码来源:Reactor_Exceptions_Test.cpp
示例17: Except
//--------------------------------------------------------------------------------------------------------------
//设置动画信息
void AnimControl::SetAnimationInfo( UINT nNumKey, float fIntervalTime )
{
if( nNumKey == 0 || fIntervalTime == 0.0f )
Except( Exception::ERR_INVALIDPARAMS, "错误的动画帧数或帧停顿时间。" );
mNumKey = nNumKey;
mIntervalTime = fIntervalTime;
}
开发者ID:adan830,项目名称:FKEngine,代码行数:10,代码来源:AnimControl.cpp
示例18: DirectInput8Create
//--------------------------------------------------------------------------------------------------------------
//初始化输入系统
void DI8InputSystem::Initialize()
{
//创建 DirectInput8 对象
HRESULT result = DirectInput8Create( (HINSTANCE)GetModuleHandle(NULL), DIRECTINPUT_VERSION, IID_IDirectInput8,
(void**)&mpDirectInput8, NULL );
if( FAILED( result ) )
Except( Exception::ERR_INTERNAL_ERROR, "创建 DirectInput8 对象错误。" );
}
开发者ID:duzhi5368,项目名称:FKEngine,代码行数:10,代码来源:DI8InputSystem.cpp
示例19: GetFileSize
//--------------------------------------------------------------------------------------------------------------
//获取文件长度
DWORD BaseFile::GetLength()
{
DWORD dwLength = GetFileSize( mFileHandle, NULL );
if( dwLength == INVALID_FILE_SIZE )
Except( Exception::ERR_WINAPI_ERROR, "获取文件长度失败。" );
return dwLength;
}
开发者ID:adan830,项目名称:FKEngine,代码行数:10,代码来源:BaseFile.cpp
示例20: Except
//--------------------------------------------------------------------------------------------------------------
//将缓存数据写入文件
void BaseFile::Flush()
{
if( mLastBuffedOp != BOT_Write )
Except( Exception::ERR_INVALIDPARAMS,
"上次进行的缓存操作并不是写入操作,因此无法执行将缓存数据写入文件的命令。" );
if( mdwCachedLen == 0 )
return;
if( mdwCachedLen != _InternalWrite( mpCache, mdwCachedLen ) )
Except( Exception::ERR_CANNOT_WRITE_FILE, STR_ERR_WRITE_LEN );
mpCachePtr = mpCache;
mdwCachedLen = 0;
mLastBuffedOp = BOT_None;
}
开发者ID:adan830,项目名称:FKEngine,代码行数:19,代码来源:BaseFile.cpp
注:本文中的Except函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论