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


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

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


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

示例1: Except

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

示例2: 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

示例3:

bool
P4ClientApi::SetEnv( const char *var, const char *value )
{
	Error e;
	enviro->Set( var, value, &e );
	return !e.Test();
}
开发者ID:Malaar,项目名称:luaplus51-all,代码行数:7,代码来源:p4clientapi.cpp

示例4:

int
P4MergeData::RunMergeTool()
{
    Error e;
    ui->Merge( merger->GetBaseFile(), merger->GetTheirFile(),
	       merger->GetYourFile(), merger->GetResultFile(), &e );

	if( e.Test() )
		lua_pushboolean( L, false );
	else
		lua_pushboolean( L, true );
	return 1;
}
开发者ID:Malaar,项目名称:luaplus51-all,代码行数:13,代码来源:p4mergedata.cpp

示例5: TestTempDir

BOOL CTempDirPage::TestTempDir( LPCTSTR path )
{
	BOOL success=FALSE;
	CString filename(path);
	
	FileSys *pFile= FileSys::Create( (enum FileSysType) FST_BINARY );
	pFile->SetDeleteOnClose();

	// TODO: calc a unique name.  but for time being, change that
	// a user has this exact file as readonly is as likely as
	// three atoms colliding
	CString TempName;
	TempName.Format( _T("%s\\p4win.p4wintempdir.test"), path);
    pFile->Set(CharFromCString(TempName));
	Error e;
	e.Clear();
	
	// Prepare write (makes dir as required)
	pFile->MkDir( &e );
	if( !e.Test() )
	{
		// Open it
		pFile->Perms( FPM_RO );
		pFile->Open( FOM_WRITE, &e );
		pFile->Close(&e);
	}
	
	if(!e.Test())
		success=TRUE;
	
	delete pFile;
	
	if(!success)
		AfxMessageBox(IDS_TEMPORARY_FILES_DIRECTORY_NOT_WRITEABLE, MB_ICONSTOP);
	
	return success;
}
开发者ID:danieljennings,项目名称:p4win,代码行数:37,代码来源:TempDirPage.cpp

示例6: 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

示例7: s

void
ClientUserLua::OutputStat( StrDict *values )
{
	StrPtr *		spec 	= values->GetVar( "specdef" );
	StrPtr *		data 	= values->GetVar( "data" );
	StrPtr *		sf	= values->GetVar( "specFormatted" );
	StrDict *		dict	= values;
	SpecDataTable	specData;
	Error		e;

	//
	// Determine whether or not the data we've got contains a spec in one form
	// or another. 2000.1 -> 2005.1 servers supplied the form in a data variable
	// and we use the spec variable to parse the form. 2005.2 and later servers
	// supply the spec ready-parsed but set the 'specFormatted' variable to tell
	// the client what's going on. Either way, we need the specdef variable set
	// to enable spec parsing.
	//
	int			isspec	= spec && ( sf || data );

	//
	// Save the spec definition for later
	//
	if( spec )
		specMgr->AddSpecDef( cmd.Text(), spec->Text() );

	//
	// Parse any form supplied in the 'data' variable and convert it into a
	// dictionary.
	//
	if( spec && data )
	{
		// 2000.1 -> 2005.1 server's handle tagged form output by supplying the form
		// as text in the 'data' variable. We need to convert it to a dictionary
		// using the supplied spec.
		if( P4LUADEBUG_CALLS )
			fprintf( stderr, "[P4] OutputStat() - parsing form\n" );


		// Parse the form. Use the ParseNoValid() interface to prevent
		// errors caused by the use of invalid defaults for select items in
		// jobspecs.

//#if P4APIVER_ID >= 513538
		Spec s( spec->Text(), "", &e );
//#else
		//Spec s( spec->Text(), "" );
//#endif
		if( !e.Test() ) s.ParseNoValid( data->Text(), &specData, &e );
		if( e.Test() )
		{
			HandleError( &e );
			return;
		}
		dict = specData.Dict();
	}

	//
	// If what we've got is a parsed form, then we'll convert it to a P4::Spec
	// object. Otherwise it's a plain hash.
	//
	if( isspec )
	{
		if( P4LUADEBUG_CALLS )
			fprintf(stderr ,"[P4] OutputStat() - Converting to P4::Spec object\n");
		results.AddOutput( specMgr->StrDictToSpec( dict, spec ) );
		lua_pop( L, 1 );
	}
	else
	{
		if( P4LUADEBUG_CALLS )
			fprintf(stderr ,"[P4] OutputStat() - Converting to hash\n");
		results.AddOutput( specMgr->StrDictToHash( dict ) );
		lua_pop( L, 1 );
	}
}
开发者ID:Malaar,项目名称:luaplus51-all,代码行数:76,代码来源:clientuserlua.cpp

示例8: ASSERT

// Create from an fstat result set.
BOOL CP4FileStats::Create(StrDict *client)
{
	int i;
	StrPtr *str;
	Error err;

	// Get the depot name
	str= client->GetVar( "depotFile", &err);		// name in depot
    ASSERT(str || err.Test());
    if(err.Test())
        goto badFile;
	m_DepotPath = CharToCString(str->Value());

	// If the client path exists, note that file is in client view
	str= client->GetVar( "clientFile" );
    if(str)
	{
		m_ClientPath = CharToCString(str->Value());
		m_ClientPath.Replace(_T('/'), _T('\\'));
	}
	else
    {
        // need to determine if the client path doesn't exist or doesn't translate
        // we can't handle the no translation case.
		CString txt = FormatError(&err);
		if(txt.Find(_T("No Translation")) == 0)
            goto badFile;

        // there is no client path
        m_ClientPath=_T("");
    }

	// Concatenate a list of all other users with the file open
    {
        char varName[] = "otherOpen   ";
	    char varNam2[] = "otherAction   ";
	    for(m_OtherOpens=m_OtherOpenAction=0; m_OtherOpens < 100; m_OtherOpens++)
	    {
		    _itoa(m_OtherOpens, varName+9, 10);
		    if( (str=client->GetVar( varName )) == 0 )
			    break;
		    else
		    {
			    if(m_OtherOpens==0)
				    m_OtherUsers = CharToCString(str->Value());
			    else
			    {
				    m_OtherUsers+=_T("/");
				    m_OtherUsers+=CharToCString(str->Value());
			    }
			    if (m_OtherOpenAction != F_DELETE)
			    {
				    _itoa(m_OtherOpens, varNam2+11, 10);
				    if ( (str=client->GetVar( varNam2 )) != 0)
				    {
						m_OtherOpenAction = actionByName(CharToCString(str->Value()));
				    }
			    }
		    }
	    }
    }

	if(	(str= client->GetVar( "headRev" )) != NULL)
		m_HeadRev=atol(str->Value());
	if( (str= client->GetVar( "haveRev" )) != NULL)
		m_HaveRev=atol(str->Value());
	if( (str= client->GetVar( "change" )) != NULL)
		m_OpenChangeNum=atol(str->Value());
	if( (str= client->GetVar( "headChange" )) != NULL)
		m_HeadChangeNum=atol(str->Value());
	if( (str= client->GetVar( "headTime" )) != NULL)
		m_HeadTime=atol(str->Value());
	
	if( (str= client->GetVar( "ourLock" )) != NULL)
		m_MyLock=TRUE;
	
	if( (str= client->GetVar( "otherLock" )) != NULL)
		m_OtherLock=TRUE;
	

	if( (str= client->GetVar( "type" )) != NULL)
		m_Type= CharToCString(str->Value());

	if( (str= client->GetVar( "headType" )) != NULL)
		m_HeadType= CharToCString(str->Value());

	if( (str= client->GetVar( "headAction" )) != NULL)
	{
		m_HeadAction = actionByName(CharToCString(str->Value()));
	}
	ASSERT(client->GetVar("headAction")==NULL || m_HeadAction);

	if( (str= client->GetVar( "action" )) != NULL)
	{
		m_MyOpenAction = actionByName(CharToCString(str->Value()));
	}
	ASSERT(client->GetVar("action")==NULL || m_MyOpenAction);
	if (!m_HaveRev && !m_HeadRev && (m_MyOpenAction == F_ADD || m_MyOpenAction == F_BRANCH))
		m_HaveRev = 1;
//.........这里部分代码省略.........
开发者ID:jtilander,项目名称:niftyp4win,代码行数:101,代码来源:P4FileStats.cpp

示例9: OutputStat

void PythonClientUser::OutputStat( StrDict *values )
{
    EnsurePythonLock guard;
    
    StrPtr *		spec 	= values->GetVar( "specdef" );
    StrPtr *		data 	= values->GetVar( "data" );
    StrPtr *		sf	= values->GetVar( "specFormatted" );
    StrDict *		dict	= values;
    SpecDataTable	specData;
    Error		e;

    //
    // Determine whether or not the data we've got contains a spec in one form
    // or another. 2000.1 -> 2005.1 servers supplied the form in a data variable
    // and we use the spec variable to parse the form. 2005.2 and later servers
    // supply the spec ready-parsed but set the 'specFormatted' variable to tell 
    // the client what's going on. Either way, we need the specdef variable set
    // to enable spec parsing.
    //
    int			isspec	= spec && ( sf || data );

    //
    // Save the spec definition for later 
    //
    if( spec )
	specMgr->AddSpecDef( cmd.Text(), spec->Text() );

    //
    // Parse any form supplied in the 'data' variable and convert it into a 
    // dictionary.
    //
    if( spec && data )
    {
	// 2000.1 -> 2005.1 server's handle tagged form output by supplying the form
	// as text in the 'data' variable. We need to convert it to a dictionary
	// using the supplied spec.
	if( P4PYDBG_CALLS )
	    cerr << "[P4] OutputStat() - parsing form" << endl;

	// Parse the form. Use the ParseNoValid() interface to prevent
	// errors caused by the use of invalid defaults for select items in
	// jobspecs.

	Spec s( spec->Text(), "", &e );

	if( !e.Test() ) s.ParseNoValid( data->Text(), &specData, &e );
	if( e.Test() )
	{
	    HandleError( &e );
	    return;
	}
	dict = specData.Dict();
    }

    //
    // If what we've got is a parsed form, then we'll convert it to a P4::Spec
    // object. Otherwise it's a plain dict.
    //
    PyObject * r = 0;

    if( isspec )
    {
	if( P4PYDBG_CALLS )
	    cerr << "[P4] OutputStat() - Converting to P4::Spec object" << endl;
	r = specMgr->StrDictToSpec( dict, spec );
    }
    else
    {
	if( P4PYDBG_CALLS )
	    cerr << "[P4] OutputStat() - Converting to dict" << endl;
	r = specMgr->StrDictToDict( dict );
    }

    ProcessOutput("outputStat", r );
}
开发者ID:azakk,项目名称:p4python,代码行数:75,代码来源:PythonClientUser.cpp


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