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


C++ Error::Fmt方法代码示例

本文整理汇总了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() );
}
开发者ID:Malaar,项目名称:luaplus51-all,代码行数:27,代码来源:p4clientapi.cpp

示例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;
}
开发者ID:euler0,项目名称:Helium,代码行数:67,代码来源:P4Provider.cpp


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