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


C++ tString::c_str方法代码示例

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


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

示例1: LoadResourceDirsFile

	bool cResources::LoadResourceDirsFile(const tString &asFile)
	{
		TiXmlDocument* pXmlDoc = hplNew( TiXmlDocument, (asFile.c_str()) );
		if(pXmlDoc->LoadFile()==false)
		{
			Error("Couldn't load XML file '%s'!\n",asFile.c_str());
			hplDelete( pXmlDoc);
			return false;
		}

		//Get the root.
		TiXmlElement* pRootElem = pXmlDoc->RootElement();
        
		TiXmlElement* pChildElem = pRootElem->FirstChildElement();
		for(; pChildElem != NULL; pChildElem = pChildElem->NextSiblingElement())
		{
			tString sPath = cString::ToString(pChildElem->Attribute("Path"),"");
			if(sPath==""){
				continue;
			}

			if(sPath[0]=='/' || sPath[0]=='\\') sPath = sPath.substr(1);

			AddResourceDir(sPath);
		}

		hplDelete(pXmlDoc);
		return true;
	}
开发者ID:ArchyInf,项目名称:HPL1Engine,代码行数:29,代码来源:Resources.cpp

示例2: ReceiveLeagueMessage

// called on the master server when the league message is received
void nKrawall::ReceiveLeagueMessage(const tString& message)
{
    //  con << message;

    if (message[0] == 'K')
    {
        tString killer(message.c_str()+1);
        tString victim(message.c_str()+1+killer.Len());

        MasterFrag(killer, victim);
    }
    else if (message[0] == 'R')
    {
        tString numP(message.c_str()+1);
        int pos = 1 + numP.Len();

        int numPlayers = atoi(numP);
        tArray<tString> players(numPlayers);
        for (int i = numPlayers-1; i>=0; i--)
        {
            players(i) = tString(message.c_str()+pos);
            pos += players(i).Len();
        }

        MasterRoundEnd(&players[0], numPlayers);
    }
}
开发者ID:KnIfER,项目名称:armagetron,代码行数:28,代码来源:nKrawall.cpp

示例3: CreateFromFile

	bool cSqScript::CreateFromFile(const tString& asFileName)
	{
		CScriptBuilder builder;

		builder.StartNewModule(mpScriptEngine,msModuleName.c_str());

		if(builder.AddSectionFromFile(asFileName.c_str())<0)
		{
			Error("Couldn't add script '%s'!\n",asFileName.c_str());
			return false;
		}

		if(builder.BuildModule()<0)
		{
			Error("Couldn't build script '%s'!\n",asFileName.c_str());
			Log("------- SCRIPT OUTPUT BEGIN --------------------------\n");
			mpScriptOutput->Display();
			mpScriptOutput->Clear();
			Log("------- SCRIPT OUTPUT END ----------------------------\n");
			return false;
		}
		mpScriptOutput->Clear();

		return true;
	}
开发者ID:Naddiseo,项目名称:HPL1Engine,代码行数:25,代码来源:SqScript.cpp

示例4: AddScriptVar

	bool cLowLevelSystemSDL::AddScriptVar(const tString& asVarDecl, void *pVar)
	{
		if(mpScriptEngine->RegisterGlobalProperty(asVarDecl.c_str(),pVar)<0)
		{
			Error("Couldn't add var '%s'\n",asVarDecl.c_str());
			return false;
		}

		return true;
	}
开发者ID:ArchyInf,项目名称:HPL1Engine,代码行数:10,代码来源:LowLevelSystemSDL.cpp

示例5: CreateFromFile

	bool cSoundEntityData::CreateFromFile(const tString &a_sFile)
	{
		tString sType;
		TiXmlDocument *pDoc = efeNew(TiXmlDocument, ());
		if (pDoc->LoadFile(a_sFile.c_str()) == false)
		{
			Error("Couldn't load '%s'!\n", a_sFile.c_str());
			efeDelete(pDoc);
			return false;
		}

		TiXmlElement *pRootElem = pDoc->FirstChildElement();

		TiXmlElement *pMainElem = pRootElem->FirstChildElement("MAIN");
		if (pMainElem == NULL)
		{
			Error("Couldn't find MAIN element in '%s'!\n", a_sFile.c_str());
			efeDelete(pDoc);
			return false;
		}

		m_sMainSound = cString::ToString(pMainElem->Attribute("MainSound"),"");
		m_sStartSound = cString::ToString(pMainElem->Attribute("StartSound"),"");
		m_sStopSound = cString::ToString(pMainElem->Attribute("StopSound"),"");

		TiXmlElement *pPropElem = pRootElem->FirstChildElement("PROPERTIES");
		if (pPropElem == NULL)
		{
			Error("Couldn't find PROPERTIES element in '%s'!\n", a_sFile.c_str());
			efeDelete(pDoc);
			return false;
		}
		m_bUse3D = cString::ToBool(pPropElem->Attribute("Use3D"),true);
		m_bLoop = cString::ToBool(pPropElem->Attribute("Loop"),true);
		m_bStream = cString::ToBool(pPropElem->Attribute("Stream"),true);

		m_bBlockable = cString::ToBool(pPropElem->Attribute("Blockable"),false);
		m_fBlockVolumeMul = cString::ToFloat(pPropElem->Attribute("BlockVolumeMul"),0.6f);

		m_fVolume = cString::ToFloat(pPropElem->Attribute("Volume"),1);
		m_fMaxDistance = cString::ToFloat(pPropElem->Attribute("MaxDistance"),1);
		m_fMinDistance = cString::ToFloat(pPropElem->Attribute("MinDistance"),1);

		m_bFadeStart = cString::ToBool(pPropElem->Attribute("FadeStart"),true);
		m_bFadeStop = cString::ToBool(pPropElem->Attribute("FadeStop"),true);

		m_fRandom = cString::ToFloat(pPropElem->Attribute("Random"),1);
		m_fInterval = cString::ToFloat(pPropElem->Attribute("Interval"),0);

		m_lPriority = cString::ToInt(pPropElem->Attribute("Priority"),0);
		
		efeDelete(pDoc);

		return true;
	}
开发者ID:MIFOZ,项目名称:EFE-Engine,代码行数:55,代码来源:SoundEntityData.cpp

示例6: AddScriptFunc

	bool cLowLevelSystemSDL::AddScriptFunc(const tString& asFuncDecl, void* pFunc, int callConv)
	{
		if(mpScriptEngine->RegisterGlobalFunction(asFuncDecl.c_str(),
												asFUNCTION(pFunc),callConv)<0)
		{
			Error("Couldn't add func '%s'\n",asFuncDecl.c_str());
			return false;
		}

		return true;
	}
开发者ID:ArchyInf,项目名称:HPL1Engine,代码行数:11,代码来源:LowLevelSystemSDL.cpp

示例7: CreateFromFile

	bool cOpenALSoundEnvironment::CreateFromFile(const tString &asFile)
	{
		tString strType;
		TiXmlDocument doc;
		if (!doc.LoadFile(asFile.c_str()))
			return false;

		TiXmlElement* pMain = doc.FirstChildElement("SoundEnvironment")->FirstChildElement("Main");
		if (pMain)
		{
			strType = pMain->Attribute("Type");
			mstrName = pMain->Attribute("Name");
		}


		float* pfTemp;

		TiXmlElement* pParams = doc.FirstChildElement("SoundEnvironment")->FirstChildElement("Parameters");

		if ( (pParams == NULL) || (strType.compare("OpenAL")!=0) )
		{
			doc.Clear();
			return false;
		}

		mfDensity = cString::ToFloat(pParams->Attribute("Density"),0);
		mfDiffusion = cString::ToFloat(pParams->Attribute("Diffusion"),0);
		mfGain = cString::ToFloat(pParams->Attribute("Gain"),0);
		mfGainHF = cString::ToFloat(pParams->Attribute("GainHF"),0);
		mfGainLF = cString::ToFloat(pParams->Attribute("GainLF"),0);
		mfDecayTime = cString::ToFloat(pParams->Attribute("DecayTime"),0);
		mfDecayHFRatio = cString::ToFloat (pParams->Attribute("DecayHFRatio"),0);
		mfDecayLFRatio = cString::ToFloat (pParams->Attribute("DecayLFRatio"),0);
		mfReflectionsGain = cString::ToFloat(pParams->Attribute("ReflectionsGain"),0);
		mfReflectionsDelay = cString::ToFloat(pParams->Attribute("ReflectionsDelay"),0);
		pfTemp = cString::ToVector3f(pParams->Attribute("ReflectionsPan"),cVector3f(0)).v;
		mfReflectionsPan[0] = pfTemp[0];
		mfReflectionsPan[1] = pfTemp[1];
		mfReflectionsPan[2] = pfTemp[2];
		mfLateReverbGain = cString::ToFloat(pParams->Attribute("LateReverbGain"),0);
		mfLateReverbDelay = cString::ToFloat(pParams->Attribute("LateReverbDelay"),0);
		pfTemp = cString::ToVector3f(pParams->Attribute("LateReverbPan"),cVector3f(0)).v;
		mfLateReverbPan[0] = pfTemp[0];
		mfLateReverbPan[1] = pfTemp[1];
		mfLateReverbPan[2] = pfTemp[2];
		mfEchoTime = cString::ToFloat(pParams->Attribute("EchoTime"),0);
		mfEchoDepth = cString::ToFloat(pParams->Attribute("EchoDepth"),0);
		mfModulationTime = cString::ToFloat(pParams->Attribute("ModulationTime"),0);
		mfModulationDepth = cString::ToFloat(pParams->Attribute("ModulationDepth"),0);
		mfAirAbsorptionGainHF = cString::ToFloat(pParams->Attribute("AirAbsorptionGainHF"),0);
		mfHFReference = cString::ToFloat(pParams->Attribute("HFReference"),0);
		mfLFReference = cString::ToFloat(pParams->Attribute("LFReference"),0);
		mfRoomRolloffFactor =cString::ToFloat(pParams->Attribute("RoomRolloffFactor"),0);
		mbDecayHFLimit = cString::ToInt(pParams->Attribute("DecayHFLimit"),0);

		doc.Clear();
		pParams = NULL;

		return true;
	}
开发者ID:FrictionalGames,项目名称:HPL1Engine,代码行数:60,代码来源:OpenALSoundEnvironment.cpp

示例8: AddResourceDir

	/**
	 * \todo File searcher should check so if the dir is allready added and if so return false and not add
	 * \param &asDir 
	 * \param &asMask 
	 * \return 
	 */
	bool cResources::AddResourceDir(const tString &asDir, const tString &asMask)
	{
		mpFileSearcher->AddDirectory(asDir, asMask);
		if(iResourceBase::GetLogCreateAndDelete())
			Log(" Added resource directory '%s'\n",asDir.c_str());
		return true;
	}
开发者ID:ArchyInf,项目名称:HPL1Engine,代码行数:13,代码来源:Resources.cpp

示例9: LoadLibraryA

 //---------------------------------------------load
 bool SharedLibraryImplWIN32::loadLibrary(const tString& sFilename)
 {
   m_aInstance = LoadLibraryA(sFilename.c_str());
   if(!m_aInstance)
     return false;
   return true;
 }
开发者ID:cbastuck,项目名称:clay,代码行数:8,代码来源:SharedLibraryImpl_WIN32.cpp

示例10: RemoveCollideScript

void iGameEntity::RemoveCollideScript(eGameCollideScriptType aType,const tString &asEntity)
{
	tGameCollideScriptMapIt it = m_mapCollideCallbacks.find(asEntity);
	if(it != m_mapCollideCallbacks.end())
	{
		cGameCollideScript *pCallback = it->second;

		pCallback->msFuncName[aType] = "";
		//if there are no functions left, erase
		if(pCallback->msFuncName[0]=="" && pCallback->msFuncName[1]=="" && pCallback->msFuncName[2]=="")
		{
			if(mbUpdatingCollisionCallbacks)
			{
				pCallback->mbDeleteMe = true;
			}
			else
			{
				hplDelete( pCallback );
				m_mapCollideCallbacks.erase(it);
			}
		}
	}
	else
	{
		Warning("Entity '%s' callback doesn't exist in '%s'\n",asEntity.c_str(),msName.c_str());
	}
}
开发者ID:ArchyInf,项目名称:PenumbraOverture,代码行数:27,代码来源:GameEntity.cpp

示例11: AddCollideScript

void iGameEntity::AddCollideScript(eGameCollideScriptType aType,const tString &asFunc, const tString &asEntity)
{
	cGameCollideScript *pCallback;

	//Check if the function already exist
	tGameCollideScriptMapIt it = m_mapCollideCallbacks.find(asEntity);
	if(it != m_mapCollideCallbacks.end())
	{
		pCallback = it->second;	
	}
	else
	{
		pCallback = hplNew(  cGameCollideScript, () );
		
		//Get the entity
		iGameEntity *pEntity = mpInit->mpMapHandler->GetGameEntity(asEntity);
		if(pEntity==NULL)
		{
			Warning("Couldn't find entity '%s'\n",asEntity.c_str());
			hplDelete( pCallback );
			return;
		}
		
		//Set the entity
        pCallback->mpEntity = pEntity;
		
		//Add to container
		m_mapCollideCallbacks.insert(tGameCollideScriptMap::value_type(asEntity,pCallback));
	}
	
	pCallback->msFuncName[aType] = asFunc;	
}
开发者ID:ArchyInf,项目名称:PenumbraOverture,代码行数:32,代码来源:GameEntity.cpp

示例12: iGameEntity

cGameLamp::cGameLamp(cInit *apInit,const tString& asName) : iGameEntity(apInit,asName)
{
	mType = eGameEntityType_Lamp;
    mbHasInteraction = true;

	mbLit = true;
	mfMaxInteractDist = 2.1f;

	mfAlpha = 1;
	mfTurnOnTime = 2;
	mfTurnOffTime = 1;

	mbInteractOff = true;
	mbInteractOn = true;

	msTurnOnSound = "";
	msTurnOffSound = "";

	msOnItem = "";
	msOffItem = "";

	mpOffMaterial = NULL;
	mpOnMaterial = NULL;

	mpSubMesh = NULL;

	mbSaveLights = false;

	mOpenILLight = new openil::IL_LightSource();

	Log("Game lamp %s created\n", asName.c_str());
}
开发者ID:jorgeas80,项目名称:PenumbraOverture,代码行数:32,代码来源:GameLamp.cpp

示例13: tStringToString

 void tStringToString(std::string& strDest, const tString& tstrSrc)
 {
	 char* pszStr = NULL;
	 T2C(&pszStr, tstrSrc.c_str());
	 strDest = pszStr;
	 SAFE_ARRYDELETE(pszStr);
 }
开发者ID:wyrover,项目名称:IMClient,代码行数:7,代码来源:Global.cpp

示例14: BrokenScramblePassword

// scramble a password locally (so it does not have to be stored on disk)
void nKrawall::BrokenScramblePassword(const tString& password,
                                      nScrambledPassword &scrambled)
{
    md5_state_t state;
    md5_init(&state);
    md5_append(&state, (md5_byte_t const *)(password.c_str()), password.Len());
    md5_finish(&state, scrambled.content);
}
开发者ID:KnIfER,项目名称:armagetron,代码行数:9,代码来源:nKrawall.cpp

示例15: CPPUnitReporter

		explicit CPPUnitReporter(const tString &filename = _T("testResult.xml"))
			: failedTests_(),
			passedTests_(),
			filename_(filename),
			stream_(new tOfstream(filename_.c_str()))
		{
			if( !stream_->good()) 
				throw TutError(_T("Cannot open output file `") + filename_ + _T("`"));
		}
开发者ID:chenyu2202863,项目名称:smart_cpp_lib,代码行数:9,代码来源:tut_cppunit_reporter.hpp


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