當前位置: 首頁>>代碼示例>>C++>>正文


C++ XString::Str方法代碼示例

本文整理匯總了C++中XString::Str方法的典型用法代碼示例。如果您正苦於以下問題:C++ XString::Str方法的具體用法?C++ XString::Str怎麽用?C++ XString::Str使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在XString的用法示例。


在下文中一共展示了XString::Str方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: getDocument

//************************************
// Method:    GetDocument
// FullName:  vtPhysics::pFactory::GetDocument
// Access:    public 
// Returns:   TiXmlDocument*
// Qualifier:
// Parameter: XString filename
//************************************
TiXmlDocument* pFactory::getDocument(XString filename)
{
	

	XString fname(filename.Str());
	if ( fname.Length() )
	{
		XString fnameTest = ResolveFileName(fname.CStr());
		if ( fnameTest.Length())
		{
			TiXmlDocument* result  = new TiXmlDocument(fnameTest.Str());
			result->LoadFile(fnameTest.Str());
			result->Parse(fnameTest.Str());

			TiXmlNode* node = result->FirstChild( "vtPhysics" );
			if (!node)
			{
				GetPMan()->m_Context->OutputToConsoleEx("PFactory : Couldn't load Document : %s",filename.Str());
				return NULL;
			}else
			{
				return result;
			}
		}
	}
	return NULL;
}
開發者ID:gbaumgart,項目名稱:vt,代碼行數:35,代碼來源:pFactoryXML.cpp

示例2: OutputTestText

void CGBLStorageManagerTestBBBase::OutputTestText( CKContext *ctx, XString &text )
{
    // Write to output if we can...
    if( ctx )
    {
        ctx->SendInterfaceMessage(CKUIM_SENDNOTIFICATION, (CKDWORD)text.Str(),0,CUIK_NOTIFICATION_DEBUGMESSAGE);
		ctx->OutputToConsole(text.Str(),false);

    }
}
開發者ID:gbaumgart,項目名稱:GBL_Backup,代碼行數:10,代碼來源:GBLStorageManagerTestBBBase.cpp

示例3: StoreUser

/*
 *******************************************************************
 * Function: IGBLSMLAEAccess::StoreUser
 *
 * Description: Stores a user against an LAE. Essentially allows the given user permission
 * to participate in the given LAE. Checks whether the given user is already related to the given LAE and if
 * so, doesn't add another record.
 *
 *
 * Parameters: 
 *     CGBLLAEID laeid
 *    CGBLUserID user
 *
 * Returns: 
 *    CGBLCOError 
 *
 *******************************************************************
 */
CGBLCOError IGBLSMLAEAccess::StoreUser( CGBLLAEID laeid, CGBLUserID user )
{
    CGBLCOError   error(CGBLCOError::EGBLCOErrorType::GBLCO_OK);

    // Check we're actually connected to the server first...
	if ( !(storageManager->IsConnected()) )
	{
		error = CGBLCOError(CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL, GBLSM_ERROR_PROFILEACCESS_NO_CONNECTION_DESC, GBLSM_ERROR_PROFILEACCESS_NO_CONNECTION );
	}
    else
    {
        XString     query;
        XString     dbName;

        storageManager->GetDbName( dbName );

        // First thing we need to do is query to see whether an entry for the given user already exists...
        query = "";
        query << "SELECT UserID FROM " << dbName << ".EventUsers WHERE LAEID=" << (int)laeid << " AND UserID=" << (int)user;

        // Now execute this query and see if we have any results
        CKDataArray     *results = (CKDataArray *)storageManager->m_Context->CreateObject(CKCID_DATAARRAY,"IGBLSMLAEAccess::StoreUser", CK_OBJECTCREATION_DYNAMIC);
        storageManager->m_Context->GetCurrentLevel()->AddObject( results );

        int queryResult = storageManager->ExecuteBlockingSQL( query.Str(), results );

        if( queryResult == CGBLSMStorageManager::EGBLStorageManagerExecutionStatus::Result )
        {
            // A record already exists, we do nothing
        }
        else if( queryResult == CGBLSMStorageManager::EGBLStorageManagerExecutionStatus::NoResult )
        {
            // We need to create a record
            query = "";
            query << "INSERT INTO " << dbName << ".EventUsers (LAEID,UserID) VALUES(" << (int)laeid << "," << (int)user << ")";

            int insertResult = storageManager->ExecuteBlockingSQL( query.Str() );

            if( insertResult != CGBLSMStorageManager::EGBLStorageManagerExecutionStatus::NoResult )
            {
                error = CGBLCOError(CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL, GBLSM_ERROR_GENERAL_SQL_ERROR_DESC, GBLSM_ERROR_GENERAL_SQL_ERROR);
            }
        }
        else
        {
            error = CGBLCOError(CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL, GBLSM_ERROR_GENERAL_SQL_ERROR_DESC, GBLSM_ERROR_GENERAL_SQL_ERROR);
        }

	    storageManager->m_Context->GetCurrentLevel()->RemoveObject( results );
	    storageManager->m_Context->DestroyObject( results );
    }

	return error;
}
開發者ID:gbaumgart,項目名稱:GBL_Backup,代碼行數:72,代碼來源:GBLSMLAEAccess.cpp

示例4: pWheelContactModify

void pWheel2::setWheelContactScript(int val)
{

	CKBehavior * beh  = (CKBehavior*)GetPMan()->GetContext()->GetObject(val);
	if (!beh)
		return;

	XString errMessage;
	if (!GetPMan()->checkCallbackSignature(beh,CB_OnWheelContactModify,errMessage))
	{
		xError(errMessage.Str());
		return;
	}
	
	pCallbackObject::setWheelContactScript(val);

	wheelContactModifyCallback  = new pWheelContactModify();
	wheelContactModifyCallback->setWheel(this);

	getWheelShape()->setUserWheelContactModify((NxUserWheelContactModify*)wheelContactModifyCallback);


	//----------------------------------------------------------------
	//track information about callback	
	getBody()->getCallMask().set(CB_OnWheelContactModify,true);


}
開發者ID:gbaumgart,項目名稱:vt,代碼行數:28,代碼來源:pWheel2Run.cpp

示例5:

/*
 *******************************************************************
 * Function:GBLCommon::ResourceTools::LoadFile()
 *
 *
 * Description : Loads a virtools file from a specific application handle into 
 *				 a given CKContext.
 *
 * Parameters :	ctx,			r : the virtools context
							filename, r : the filepath 
							hidden,			r : add object to the current level
							loadflags,		r : how to load.  
							targetArray,	r,w : the loaded array

 * Returns : CKObjectArray * = the loaded objects, otherwise NULL 
 *
  *******************************************************************
*/ 
CKBOOL
GBLCommon::ResourceTools::LoadFromFile(
	CKContext *ctx, 
	XString filename,
	CKBOOL hidden,
	CK_LOAD_FLAGS loadflags,
	CKObjectArray* targetArray)
{
		CKBOOL result = false;
		
		CKERROR res=CK_OK;
		if ((res=ctx->Load(filename.Str(),targetArray,loadflags))==CK_OK)
		{
			CKLevel* currentLevel=ctx->GetCurrentLevel();
			
            result =true;
			for( targetArray->Reset() ; !targetArray->EndOfList() ;  )
			{
				CKObject *tmpObj = targetArray->GetData( ctx );
			
				if (currentLevel)
				{
					currentLevel->AddObject(tmpObj);
				}

				if (hidden)
				{				
					tmpObj->ModifyObjectFlags(tmpObj->GetObjectFlags()|CK_OBJECT_PRIVATE|CK_OBJECT_NOTTOBELISTEDANDSAVED,CK_OBJECT_VISIBLE);
				}
				targetArray->Next();
			}
		}
	return result;
}
開發者ID:gbaumgart,項目名稱:GBL_Backup,代碼行數:52,代碼來源:GBLResourceTools.cpp

示例6: RemoveCIS

/*
 *******************************************************************
 * Function: IGBLSMConfigurationAccess::RemoveCIS
 *
 * Description: Removes a CIS and all associated CIs from persistent storage.
 *
 *
 * Parameters: 
 *    CGBLCISID cisid
 *
 * Returns: 
 *    CGBLCOError 
 *
 *******************************************************************
 */
CGBLCOError IGBLSMConfigurationAccess::RemoveCIS( CGBLCISID cisid )
{
    CGBLCOError   error(CGBLCOError::EGBLCOErrorType::GBLCO_OK);

    // Check we're actually connected to the server first...
	if ( !(storageManager->IsConnected()) )
	{
		error = CGBLCOError(CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL, GBLSM_ERROR_PROFILEACCESS_NO_CONNECTION_DESC, GBLSM_ERROR_PROFILEACCESS_NO_CONNECTION );
	}
    else
    {
        XString     query;
        XString     dbName;

        storageManager->GetDbName( dbName );

        query << "DELETE FROM " << dbName << ".ciss WHERE ID=" << (int)cisid;

        // Now execute it and check the response...
        int queryResult = storageManager->ExecuteBlockingSQL( query.Str() );

        if( queryResult != CGBLSMStorageManager::EGBLStorageManagerExecutionStatus::NoResult )
        {
            error = CGBLCOError(CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL, GBLSM_ERROR_GENERAL_SQL_ERROR_DESC, GBLSM_ERROR_GENERAL_SQL_ERROR);
        }
    }

    return error;
}
開發者ID:gbaumgart,項目名稱:GBL_Backup,代碼行數:44,代碼來源:GBLSMConfigurationAccess.cpp

示例7: RemoveUser

/*
 *******************************************************************
 * Function: IGBLSMLAEAccess::RemoveUser
 *
 * Description: Removes the association between a user and an LAE.
 *
 *
 * Parameters: 
 *     CGBLLAEID laeid
 *    CGBLUserID user
 *
 * Returns: 
 *    CGBLCOError 
 *
 *******************************************************************
 */
CGBLCOError IGBLSMLAEAccess::RemoveUser( CGBLLAEID laeid, CGBLUserID user )
{
    CGBLCOError   error(CGBLCOError::EGBLCOErrorType::GBLCO_OK);

    // Check we're actually connected to the server first...
	if ( !(storageManager->IsConnected()) )
	{
		error = CGBLCOError(CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL, GBLSM_ERROR_PROFILEACCESS_NO_CONNECTION_DESC, GBLSM_ERROR_PROFILEACCESS_NO_CONNECTION );
	}
    else
    {
        XString     query;
        XString     dbName;

        // Get the name of the DB we're using
        storageManager->GetDbName(dbName);

        // Now build the query
        query = "";
        query << "DELETE FROM " << dbName << ".EventUsers WHERE LAEID=" << (int)laeid << " AND UserID=" << (int)user;

        // Execute the query
        int     deleteResult = storageManager->ExecuteBlockingSQL( query.Str() );

        if( deleteResult != CGBLSMStorageManager::EGBLStorageManagerExecutionStatus::NoResult )
        {
            error = CGBLCOError(CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL, GBLSM_ERROR_GENERAL_SQL_ERROR_DESC, GBLSM_ERROR_GENERAL_SQL_ERROR);
        }
    }

	return error;
}
開發者ID:gbaumgart,項目名稱:GBL_Backup,代碼行數:48,代碼來源:GBLSMLAEAccess.cpp

示例8: RetrieveStateTest

void GBLStorageManagerStateTestBB::RetrieveStateTest( CKContext *ctx )
{
    XString         outputStr;
    XString         data;

    outputStr.Format( "Calling RetrieveState( %d, &<data>, %d, %d )", (int)testUserID, (int)testLAEID, componentID );
    OutputTestText( ctx, outputStr );

    StartTimeMeasure();
	CGBLCOError res = pInterface->RetrieveState( testUserID, &data, testLAEID, componentID );
	StopAndOutputTimeMeasure( ctx );

    outputStr.Format( "RetrieveState result: %s", (const char*)res );
	OutputTestText( ctx, outputStr );

	if (res == CGBLCOError::EGBLCOErrorType::GBLCO_OK)
    {
        outputStr.Format( "State data retrieved: %s", data.Str() );
        OutputTestText( ctx, outputStr );

        if( testData == data )
		    OutputTestText( ctx, XString("TEST PASSED") );
        else
            OutputTestText( ctx, XString("Retrieved data doesn't match saved data\r\nTEST FAILED") );
    }
	else
		OutputTestText( ctx, XString("TEST FAILED") );
}
開發者ID:gbaumgart,項目名稱:GBL_Backup,代碼行數:28,代碼來源:GBLStorageManagerStateTestBB.cpp

示例9: CGBLCOError

CGBLCOError 
GBLCommon::ResourceTools::SaveObject(
	CKBeObject*beo,
	XString filename)
{
	if (!beo)
	{
		return CGBLCOError(CGBLCOError::GBLCO_LOCAL,"Invalid Object",GBL_ERROR_ID_GBL_COMMON);
	}

	//todo : adding checks for saving ability 
	if(!filename.Length())
	{
		return CGBLCOError(CGBLCOError::GBLCO_LOCAL,"No path specified",GBL_ERROR_ID_GBL_COMMON);
	}
	
	CKERROR res = CK_OK;
    
	CKObjectArray* oa = CreateCKObjectArray();
	oa->InsertAt(beo->GetID());
	res = beo->GetCKContext()->Save(filename.Str(),oa,0xFFFFFFFF,NULL);
	DeleteCKObjectArray(oa);
	
	return CGBLCOError(CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL,CKErrorToString(res),GBL_ERROR_ID_GBL_COMMON);
}
開發者ID:gbaumgart,項目名稱:GBL_Backup,代碼行數:25,代碼來源:GBLResourceTools.cpp

示例10: StopAndShowTimeMeasure

void CGBLStorageManagerTestBBBase::StopAndShowTimeMeasure(ofstream &_trace, float &totalTime)
{
    float executionTime = TimeDiff();
	totalTime += executionTime;
	XString disp = "";
	disp << executionTime;
	_trace << "Execution time: " << disp.Str() << " seconds" <<endl;
}
開發者ID:gbaumgart,項目名稱:GBL_Backup,代碼行數:8,代碼來源:GBLStorageManagerTestBBBase.cpp

示例11: InitInstance

/*
 *******************************************************************
 * Function: CKERROR InitInstance( CKContext* theContext )
 *
 * Description : If no manager is used in the plugin these functions 
 *               are optional and can be exported. Virtools will call 
 *               'InitInstance' when loading the behavior library and 
 *               'ExitInstance' when unloading it. It is a good place 
 *               to perform Attributes Types declaration, registering new 
 *               enums or new parameter types.
 *		
 * Parameters : CKContext* theContext
 *    
 *
 * Returns : CKERROR
 *
 *******************************************************************
 */
CKERROR InitInstance( CKContext* theContext )
{
    new CGBLProfileManager( theContext );

    CKParameterManager* pm = theContext->GetParameterManager();

    //--- TODO: A Delete function needs to be registered, until then these will leak!
    CKParameterTypeDesc pProfile;
    pProfile.Guid = GUID_PROFILE_ID;
    pProfile.DerivedFrom = CKGUID(0,0);
    pProfile.TypeName = "TGBLProfileID";
    pProfile.DefaultSize = sizeof(CGBLProfileID);
    pProfile.CreateDefaultFunction	= CKProfileCreator;
    pProfile.StringFunction		= CKProfileStringFunc;
    //pProfile.UICreatorFunction		=
    pm->RegisterParameterType(&pProfile);

    CKParameterTypeDesc pTeam;
    pTeam.Guid = GUID_TEAM_ID;
    pTeam.DerivedFrom = GUID_PROFILE_ID;
    pTeam.TypeName = "TGBLTeamID";
    pTeam.DefaultSize = sizeof(CGBLTeamID);
    pTeam.CreateDefaultFunction	= CKTeamCreator;
    pTeam.StringFunction		= CKProfileStringFunc;
    //pTeam.UICreatorFunction		=
    pm->RegisterParameterType(&pTeam);

    CKParameterTypeDesc pUser;
    pUser.Guid = GUID_USER_ID;
    pUser.DerivedFrom = GUID_PROFILE_ID;
    pUser.TypeName = "TGBLUserID";
    pUser.DefaultSize = sizeof(CGBLUserID);
    pUser.CreateDefaultFunction	= CKUserCreator;
    pUser.StringFunction		= CKProfileStringFunc;
    //pUser.UICreatorFunction		=
    pm->RegisterParameterType(&pUser);

    // Prevent designer from creating a Profile ID as this is an invalid type.
    CKParameterTypeDesc* param_type;
    param_type = pm->GetParameterTypeDescription(GUID_PROFILE_ID);
    if (param_type) param_type->dwFlags|=CKPARAMETERTYPE_HIDDEN;

    CGBLTypeHandler THandler(theContext);
    XString typeList;
    THandler.GetTypesList(typeList);
    pm->RegisterNewEnum(EGBLProfileFieldTypeGUID,
        "EGBLProfileFieldType",
        typeList.Str());

    pm->RegisterNewEnum(EGBLUserTypeGUID,
        "EGBLUserType",
        "Player=0,Facilitator=1");

    return CK_OK;
}
開發者ID:gbaumgart,項目名稱:GBL_Backup,代碼行數:73,代碼來源:GBLProfileManagerPlugin.cpp

示例12: RetrieveCI

/*
 *******************************************************************
 * Function: IGBLSMConfigurationAccess::RetrieveCI
 *
 * Description: Retrieves the CI data associated with the record identified
 * by the given CI ID
 *
 *
 * Parameters: 
 *     int *flags
 *    XString *type
 *    XString *realValue
 *    XString *name
 *    XString *description
 *    XString *defaultValue
 *    CGBLCIID ciid
 *
 * Returns: 
 *    CGBLCOError 
 *
 *******************************************************************
 */
CGBLCOError IGBLSMConfigurationAccess::RetrieveCI( int *flags, XString *type, XString *realValue, XString *name, XString *description, XString *defaultValue, CGBLCIID ciid )
{
    CGBLCOError error(CGBLCOError::EGBLCOErrorType::GBLCO_OK);

    // Check we're actually connected to the server first...
	if ( !(storageManager->IsConnected()) )
	{
		error = CGBLCOError(CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL, GBLSM_ERROR_PROFILEACCESS_NO_CONNECTION_DESC, GBLSM_ERROR_PROFILEACCESS_NO_CONNECTION );
	}
    else
    {
        // Build the query we need to retrieve the LAE
        XString         query;
        XString         dbName;

        storageManager->GetDbName(dbName);

        query = "";
        query << "SELECT DefaultValue,Description,Flags,Name,RealValue,Type FROM " << dbName << ".cis WHERE CIID=" << (int)ciid;

        // Create a temporary array to store the results in
        CKDataArray *results = (CKDataArray *)storageManager->m_Context->CreateObject(CKCID_DATAARRAY,"IGBLSMLAEAccess::RetrieveLAE", CK_OBJECTCREATION_DYNAMIC);
        storageManager->m_Context->GetCurrentLevel()->AddObject( results );

        // Execute the query
        int queryResult = storageManager->ExecuteBlockingSQL( query.Str(), results );

        if( queryResult == CGBLSMStorageManager::EGBLStorageManagerExecutionStatus::Result )
        {
            // Excellent, we've got the record back. Now we need to get the various bits of data into the passed arguments
            CGBLSMUtils::ElementToXstring( 0, 0, results, defaultValue );
            CGBLSMUtils::ElementToXstring( 0, 1, results, description );
            results->GetElementValue( 0, 2, flags );
            CGBLSMUtils::ElementToXstring( 0, 3, results, name );
            CGBLSMUtils::ElementToXstring( 0, 4, results, realValue );
            CGBLSMUtils::ElementToXstring( 0, 5, results, type );
        }
        else if( queryResult == CGBLSMStorageManager::EGBLStorageManagerExecutionStatus::NoResult )
        {
            // Ok, no results were returned, this must mean a bad laeid
            error = CGBLCOError( CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL, GBLSM_ERROR_GENERAL_INCORRECT_PARAM_DESC, GBLSM_ERROR_GENERAL_INCORRECT_PARAM );
        }
        else
        {
            // Something else went wrong
            error = CGBLCOError(CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL, GBLSM_ERROR_GENERAL_SQL_ERROR_DESC, GBLSM_ERROR_GENERAL_SQL_ERROR);
        }
		storageManager->m_Context->GetCurrentLevel()->RemoveObject(results);
		storageManager->m_Context->DestroyObject(results);
    }

	return error;
}
開發者ID:gbaumgart,項目名稱:GBL_Backup,代碼行數:75,代碼來源:GBLSMConfigurationAccess.cpp

示例13: RetrieveCIS

/*
 *******************************************************************
 * Function: IGBLSMConfigurationAccess::RetrieveCIS
 *
 * Description: Retrieves the CIS data associated with the record identified
 * by the given CIS ID
 *
 *
 * Parameters: 
 *     XString *name
 *    bool *isDefault
 *    CGBLCISID cisid
 *
 * Returns: 
 *    CGBLCOError 
 *
 *******************************************************************
 */
CGBLCOError IGBLSMConfigurationAccess::RetrieveCIS( XString *name, bool *isDefault, CGBLCISID cisid )
{
    CGBLCOError   error(CGBLCOError::EGBLCOErrorType::GBLCO_OK);

    // Check we're actually connected to the server first...
	if ( !(storageManager->IsConnected()) )
	{
		error = CGBLCOError(CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL, GBLSM_ERROR_PROFILEACCESS_NO_CONNECTION_DESC, GBLSM_ERROR_PROFILEACCESS_NO_CONNECTION );
	}
    else
    {
        XString         query;
        XString         dbName;

        storageManager->GetDbName( dbName );

        query << "SELECT Name, IsDefault FROM " << dbName << ".ciss WHERE ID=" << (int)cisid;

        // Now create a temporary array to hold the query results
        CKDataArray *   resultsArray = (CKDataArray*)storageManager->m_Context->CreateObject( CKCID_DATAARRAY, "IGBLSMConfigurationAccess::RetrieveCISID", CK_OBJECTCREATION_DYNAMIC );
	    storageManager->m_Context->GetCurrentLevel()->AddObject( resultsArray );

        // Execute the query
        int queryRes = storageManager->ExecuteBlockingSQL( query.Str(), resultsArray );

        if( queryRes == CGBLSMStorageManager::EGBLStorageManagerExecutionStatus::Result )
        {
            // Get the values out of the array
            CGBLSMUtils::ElementToXstring( 0, 0, resultsArray, name );

            int     defaultValueAsInt;
            resultsArray->GetElementValue( 0, 1, (void*)&defaultValueAsInt );
            *isDefault = (defaultValueAsInt != 0);
        }
        else if( queryRes == CGBLSMStorageManager::EGBLStorageManagerExecutionStatus::NoResult )
        {
            error = CGBLCOError( CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL, GBLSM_ERROR_GENERAL_INCORRECT_PARAM_DESC, GBLSM_ERROR_GENERAL_INCORRECT_PARAM );
        }
        else
        {
            error = CGBLCOError(CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL, GBLSM_ERROR_GENERAL_SQL_ERROR_DESC, GBLSM_ERROR_GENERAL_SQL_ERROR);
        }

        // Remove and destory the temporary array
        //storageManager->m_Context->GetCurrentLevel()->RemoveObject( resultsArray );
        //storageManager->m_Context->DestroyObject( resultsArray );
    }

    return error;
}
開發者ID:gbaumgart,項目名稱:GBL_Backup,代碼行數:68,代碼來源:GBLSMConfigurationAccess.cpp

示例14: _getEnumDescription

XString pFactory::_getEnumDescription(const TiXmlDocument *doc, XString identifier)
{

	if (!doc)
	{
		return XString("");
	}

	XString result("None=0");
	int counter = 1;


	/************************************************************************/
	/* try to load settings from xml :                                                                      */
	/************************************************************************/
	if ( doc)
	{
		const TiXmlElement *root = getFirstDocElement(doc->RootElement());
		for (const TiXmlNode *child = root->FirstChild(); child; child = child->NextSibling() )
		{
			if ( (child->Type() == TiXmlNode::ELEMENT))
			{
				XString name = child->Value();

				if (!strcmp(child->Value(), identifier.Str() ) )
				{

					const TiXmlElement *sube = (const TiXmlElement*)child;

					const char* matName  = NULL;
					matName = sube->Attribute("name");
					if (matName && strlen(matName))
					{
						if (result.Length())
						{
							result << ",";
						}
						result << matName;
						result << "=" << counter;
						counter ++;
					}
				}
			}
		}
	}

	return result;

}
開發者ID:gbaumgart,項目名稱:vt,代碼行數:49,代碼來源:pFactoryXML.cpp

示例15: GetNextArgument

/*
*******************************************************************
* Function: int CGBLBuildCommand::GetNextArgument (CKParameter* nextArgument,CKBehavior* targetBB, const CKBehaviorContext& behaviorContext)
*
* Description : This function sets corresponding outputs with requested argument's 
*				name, type and if the type of arguments is TGBLFCStringFromList, it also
*				provides designer specified list array with GetDesignerSpecifiedList output.
*
* Parameters :
*    behaviourContext    r   Behavior context reference, which gives 
*                            access to frequently used global objects 
*                            ( context, level, manager, etc... )
*
*	nextArgument	    r	Required argument to have parameters provided by the command
*
*	targetBB			r	Target GBLWaitForCommand building block
*
* Returns : int, The return value is 0 if no error occured or -1 on error 
*
*******************************************************************
*/
int CGBLBuildCommand::GetNextArgument (CKParameter* nextArgument,CKBehavior* targetBB, const CKBehaviorContext& behaviorContext)
{
	CKBehavior* behavior = behaviorContext.Behavior;
	CKContext*  context = behaviorContext.Context;

	XString typeName = context->GetParameterManager()->ParameterTypeToName(nextArgument->GetType());
	XString argumentName = nextArgument->GetName();

	if (typeName == "TGBLFCStringFromList")
	{
		int inputs = targetBB->GetInputParameterCount();

		for (int i=0; i<inputs; i++)
		{
			CKParameterIn *parameterInput = targetBB->GetInputParameter(i);

			if ( argumentName == parameterInput->GetName() )
			{
				CKParameterOut *parameterOutput = behavior->GetOutputParameter(EGBLBuildCommandParamOutputs::GetDesignerSpecifiedList);

				context->OutputToConsole(context->GetParameterManager()->ParameterTypeToName(parameterOutput->GetType()), FALSE);
				context->OutputToConsole(context->GetParameterManager()->ParameterTypeToName(parameterInput->GetType()), FALSE);
				
				parameterOutput->CopyValue (parameterInput->GetDirectSource());
				break;
			}
		}
	}

	behavior->SetOutputParameterValue (EGBLBuildCommandParamOutputs::GetArgumentType, typeName.Str(), strlen (typeName.Str()) + 1 );
	behavior->SetOutputParameterValue (EGBLBuildCommandParamOutputs::GetArgumentName, argumentName.Str(), strlen (argumentName.Str()) + 1 );

	behavior->ActivateOutput (EGBLBuildCommandBehOutputs::GetNextParameterValue);

	return 0;
}
開發者ID:gbaumgart,項目名稱:GBL_Backup,代碼行數:57,代碼來源:GBLBuildCommand.cpp


注:本文中的XString::Str方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。