本文整理汇总了C++中Error::Fmt方法的典型用法代码示例。如果您正苦于以下问题:C++ Error::Fmt方法的具体用法?C++ Error::Fmt怎么用?C++ Error::Fmt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Error
的用法示例。
在下文中一共展示了Error::Fmt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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() );
}
示例2: Connect
bool Provider::Connect()
{
if ( m_IsConnected )
{
// This extra 'info' command is unfortunate but necessary
// .Dropped() can only be trusted immediately after .Run(), so do a lightweight run here to update .Dropped()'s state
class NullClient : public ClientUser
{
public:
virtual void OutputInfo( char level, const char* data ) {}
virtual void OutputError( const char* data ) {}
} nullClient;
m_Client.SetBreak( this );
m_Client.Run( "info", &nullClient );
}
if ( m_Client.Dropped() )
{
Error e;
m_Client.Final( &e );
m_IsConnected = false;
#ifdef PERFORCE_DEBUG_CONNECT
if ( e.Test() )
{
StrBuf buf;
e.Fmt( &buf, EF_PLAIN );
Log::Warning( "%s\n", buf.Text() );
}
#endif
}
if ( !m_IsConnected )
{
Error e;
m_Client.SetProtocol( "tag", "" );
m_Client.Init( &e );
m_Client.SetBreak( this );
#ifdef PERFORCE_DEBUG_CONNECT
if ( e.Test() )
{
StrBuf buf;
e.Fmt( &buf, EF_PLAIN );
Log::Warning( "%s\n", buf.Text() );
}
#endif
char buf[ 64 ];
sprintf_s( buf, sizeof(buf), "Perforce.dll" );
buf[ sizeof(buf) - 1 ] = 0;
m_Client.SetProg( buf );
bool converted = Helium::ConvertString( m_Client.GetUser().Text(), m_UserName );
HELIUM_ASSERT( converted );
converted = Helium::ConvertString( m_Client.GetClient().Text(), m_ClientName );
HELIUM_ASSERT( converted );
m_IsConnected = e.Test() == 0;
}
return m_IsConnected;
}