• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ tString类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

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


示例2: ExtractConnectionInformation

// *****************************************************************************
// *
// * ExtractConnectionInformation()
// *
// * Accepted formats
// *    - armagetronad://<server>[:<port>]
// *    - <server>[:<port>]
// *
// *****************************************************************************
//!
//! @raw            raw commandline string
//! @servername     store extracted servername here
//! @port           store port here
//!
// *****************************************************************************
void ExtractConnectionInformation( tString &raw, tString &servername, tString &port )
{
    // BUG: case sensitive
    if ( raw.StartsWith("armagetronad://") )
    {
        raw.RemoveSubStr(0, 15);
    }

    int portStart = strcspn( raw, ":" );
    // Is a port given?
    if ( portStart != raw.Len() - 1 )
    {
        servername = raw.SubStr( 0, portStart );
        port       = raw.SubStr( portStart + 1 );
    }
    else
    {
        servername = raw;
        port       = "4534";
    }
}
开发者ID:KnIfER,项目名称:armagetron,代码行数:36,代码来源:gCommandLineJumpStart.cpp


示例3: hplNew

	void iLight3D::LoadXMLProperties(const tString asFile)
	{
		tString sPath = mpFileSearcher->GetFilePath(asFile);
		if(sPath != "")
		{
			TiXmlDocument *pDoc = hplNew( TiXmlDocument,(sPath.c_str()) );
			if(pDoc->LoadFile())
			{
				TiXmlElement *pRootElem = pDoc->RootElement();

                TiXmlElement *pMainElem = pRootElem->FirstChildElement("MAIN");
				if(pMainElem!=NULL)
				{
					mbCastShadows = cString::ToBool(pMainElem->Attribute("CastsShadows"),mbCastShadows);

					mDiffuseColor.a = cString::ToFloat(pMainElem->Attribute("Specular"),mDiffuseColor.a);

					tString sFalloffImage = cString::ToString(pMainElem->Attribute("FalloffImage"),"");
					iTexture *pTexture = mpTextureManager->Create1D(sFalloffImage,false);
					if(pTexture) SetFalloffMap(pTexture);

					ExtraXMLProperties(pMainElem);
				}
				else
				{
					Error("Cannot find main element in %s\n",asFile.c_str());
				}
			}
			else
			{
				Error("Couldn't load file '%s'\n",asFile.c_str());
			}
			hplDelete(pDoc);
		}
		else
		{
			Error("Couldn't find file '%s'\n",asFile.c_str());
		}

	}
开发者ID:DirtYiCE,项目名称:HPL1Engine,代码行数:40,代码来源:Light3D.cpp


示例4: MayRequirePassword

bool nKrawall::MayRequirePassword(tString& adress, unsigned int port)
{
    return true;
    // TODO: Check for krawall adress

    if (adress.Len() < 4)
        return false;

    if (!strncmp(adress, "127.", 4))
        return true;

    return false;
}
开发者ID:KnIfER,项目名称:armagetron,代码行数:13,代码来源:nKrawall.cpp


示例5: AddPortal

	bool cPortalContainer::AddPortal(cPortal *apPortal, tString asSector)
	{
		tSectorMapIt it = m_mapSectors.find(asSector);
		if(it == m_mapSectors.end()){
			Warning("Sector %s not found!\n",asSector.c_str());
			return false;
		}

		cSector *pSector = it->second;

		pSector->AddPortal(apPortal);

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


示例6: hplDelete

	bool cResources::SetLanguageFile(const tString &asFile)
	{
		if(mpLanguageFile){
			hplDelete(mpLanguageFile);
			mpLanguageFile = NULL;
		}

		tString asPath = mpFileSearcher->GetFilePath(asFile);
		if(asPath=="")
		{
			Error("Couldn't load language file '%s'\n",asFile.c_str());
			return false;
		}

		mpLanguageFile = hplNew( cLanguageFile, (this) );

		return mpLanguageFile->LoadFromFile(asPath);
	}
开发者ID:ArchyInf,项目名称:HPL1Engine,代码行数:18,代码来源:Resources.cpp


示例7: se_EscapeColors

/**
 * Example: se_EscapeColors( "0xfff000" ) -> "#fff000"
 * 
 * @param s The string to escape
 * @return A string with color codes escaped.
 */
static tString se_EscapeColors( const tString & s )
{
    tString ret;
    
    int size = s.Size();
    for ( int i = 0; i < size; i++ )
    {
        if ( s[i] == '0' && size - i >= 2 && s[i + 1] == 'x' )
        {
            ret << '#';
            i++;
        }
        else
        {
            ret << s[i];
        }
    }
    return ret;
}
开发者ID:KnIfER,项目名称:armagetron,代码行数:25,代码来源:eChat.cpp


示例8: LoadFromFile

bool CPluginHandle::LoadFromFile(const tString &asPath)
{
	msPrevPath = asPath;
	
	if(!(mpHandle = LibUtil::LoadLibrary(asPath.c_str())))
		return false;
	
	CreateInterfaceFn fnCreateInterface = Sys_GetFactory((CSysModule*)mpHandle);
	if(fnCreateInterface)
	{
		if(!(mpCallbacks = (IEnginePlugin*)fnCreateInterface(MGT_ENGINEPLUGIN_INTERFACE_VERSION, nullptr)))
			return false;
		
		if(!mpCallbacks->Load(mfnModuleFactory))
			return false;
		
		mpCallbacks->GetInfo(*mpInfo);
	};
	
	return true;
};
开发者ID:Xash3DMagenta,项目名称:magenta_core,代码行数:21,代码来源:PluginHandle.cpp


示例9: Preload

	void cSoundEntityManager::Preload(const tString& asFile)
	{
		cSoundEntityData *pData = CreateSoundEntity(asFile);
		if(pData == NULL) {
			Warning("Couldn't preload sound '%s'\n",asFile.c_str());
			return;
		}

		if(pData->GetMainSoundName() != ""){
			iSoundChannel *pChannel = mpSound->GetSoundHandler()->CreateChannel(pData->GetMainSoundName(),0);
			if(pChannel) hplDelete(pChannel);
		}
		if(pData->GetStartSoundName() != ""){
			iSoundChannel *pChannel = mpSound->GetSoundHandler()->CreateChannel(pData->GetStartSoundName(),0);
			if(pChannel) hplDelete(pChannel);
		}
		if(pData->GetStopSoundName() != ""){
			iSoundChannel *pChannel = mpSound->GetSoundHandler()->CreateChannel(pData->GetStopSoundName(),0);
			if(pChannel) hplDelete(pChannel);
		}
	}
开发者ID:ArchyInf,项目名称:HPL1Engine,代码行数:21,代码来源:SoundEntityManager.cpp


示例10: AddToSector

	bool cPortalContainer::AddToSector(iRenderable *apRenderable,tString asSector)
	{
		tSectorMapIt it = m_mapSectors.find(asSector);
		if(it == m_mapSectors.end()){
			Warning("Sector %s not found!\n",asSector.c_str());
			return false;
		}

		cSector *pSector = it->second;

		pSector->m_setStaticObjects.insert(apRenderable);
		
		//Setting the sector is useful for some culling.
		apRenderable->GetRenderContainerDataList()->push_back(pSector);

		//Set center sector.
		apRenderable->SetCurrentSector(pSector);
		
		cVector3f vObjectMax = apRenderable->GetBoundingVolume()->GetMax();
		cVector3f vObjectMin = apRenderable->GetBoundingVolume()->GetMin();

		cVector3f vMin = pSector->mBV.GetLocalMin();
		cVector3f vMax = pSector->mBV.GetLocalMax();
		
		//Check if the bounding volume should be expanded.
		if(vMax.x < vObjectMax.x) vMax.x = vObjectMax.x;
		if(vMax.y < vObjectMax.y) vMax.y = vObjectMax.y;
		if(vMax.z < vObjectMax.z) vMax.z = vObjectMax.z;

		if(vMin.x > vObjectMin.x) vMin.x = vObjectMin.x;
		if(vMin.y > vObjectMin.y) vMin.y = vObjectMin.y;
		if(vMin.z > vObjectMin.z) vMin.z = vObjectMin.z;
		
		pSector->mBV.SetLocalMinMax(vMin, vMax);
		//Quick fix for thin stuff. (not working it seems)
		//pSector->mBV.SetLocalMinMax(vMin - cVector3f(0.1f), vMax+cVector3f(0.1f));

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


示例11: DevMsg

// loading from gamefolder/gameinfo.txt or gamefolder/liblist.gam
// (currently loading from liblist is unsupported by this method - using the handler method to convert)
bool CGameInfo::LoadFromFile(const tString &asPath)
{
	DevMsg(eMsgType_Info, "Trying to load game info from %s...", asPath.c_str());
	
	dictionary *pGameInfoDict = iniparser_load(asPath.c_str());
	
	if(!pGameInfoDict)
	{
		DevMsg(eMsgMsg_Error, "Can't find game info file \"%s\"!", asPath.c_str());
		return false;
	};
	
	// setup default values
	/*
	GameInfo->gamefolder = gamedir;
	
	VectorSet(GameInfo->client_mins[0],   0,   0,  0 );
	VectorSet(GameInfo->client_mins[1], -16, -16, -36);
	VectorSet(GameInfo->client_mins[2], -32, -32, -32);
	VectorSet(GameInfo->client_mins[3], -16, -16, -18);
	
	VectorSet(GameInfo->client_maxs[0],   0,   0,  0 );
	VectorSet(GameInfo->client_maxs[1],  16,  16,  36);
	VectorSet(GameInfo->client_maxs[2],  32,  32,  32);
	VectorSet(GameInfo->client_maxs[3],  16,  16,  18);
	*/
	
	msBaseDir = iniparser_getstring(pGameInfoDict, "basedir", "");
	msFallDir = iniparser_getstring(pGameInfoDict, "fallback_dir", ""); // GameInfo->falldir[0] = '\0';
	msGameDir = iniparser_getstring(pGameInfoDict, "gamedir", "");
	msTitle = iniparser_getstring(pGameInfoDict, "title", "New Game");
	msSPEntName = iniparser_getstring(pGameInfoDict, "sp_entity", "info_player_start");
	msMPEntName = iniparser_getstring(pGameInfoDict, "mp_entity", "info_player_deathmatch");
	msGameLib = iniparser_getstring(pGameInfoDict, "gamedll", "dlls/hl.dll");
	msGameLibPath = iniparser_getstring(pGameInfoDict, "dllpath", "cl_dlls");
	msStartMap = iniparser_getstring(pGameInfoDict, "startmap", "");
	/*else if(token == "startmap")
	{
		pfile = COM_ParseFile(pfile, GameInfo->startmap);
		mpFileSystem->StripExtension(GameInfo->startmap); // HQ2: Amen has extension .bsp
	}*/
	msTrainMap = iniparser_getstring(pGameInfoDict, "trainmap", "");
	/*else if(token == "trainmap")
	{
		pfile = COM_ParseFile(pfile, GameInfo->trainmap);
		mpFileSystem->StripExtension(GameInfo->trainmap); // HQ2: Amen has extension .bsp
	}*/
	msIconPath = iniparser_getstring(pGameInfoDict, "icon", "game.ico");
	/*else if(token == "icon")
	{
		pfile = COM_ParseFile(pfile, GameInfo->iconpath);
		mpFileSystem->DefaultExtension(GameInfo->iconpath, ".ico");
	}*/
	msGameURL = iniparser_getstring(pGameInfoDict, "url_info", "");
	msUpdateURL = iniparser_getstring(pGameInfoDict, "url_update", "");
	msType = iniparser_getstring(pGameInfoDict, "type", "");
	msDate = iniparser_getstring(pGameInfoDict, "date", "");
	mfVersion = iniparser_getdouble(pGameInfoDict, "version", 1.0f);
	mnSize = iniparser_getint(pGameInfoDict, "size", 0);
	mnMaxEdicts = clamp(600, iniparser_getint(pGameInfoDict, "max_edicts", 900), 4096);
	mnMaxTempEnts = clamp(300, iniparser_getint(pGameInfoDict, "max_tempents", 500), 2048);
	mnMaxBeams = clamp(64, iniparser_getint(pGameInfoDict, "max_beams", 128), 512);
	mnMaxParticles = clamp(1024, iniparser_getint(pGameInfoDict, "max_particles", 4096), 131072);
	
	// Todo: finalize it
	tString sGameMode = iniparser_getstring(pGameInfoDict, "gamemode", "");
	
	if(sGameMode == "singleplayer_only")
		mnGameMode = 1;
	else if(sGameMode == "multiplayer_only")
		mnGameMode = 2;
	
	mbSecure = iniparser_getboolean(pGameInfoDict, "secure", 0) ? true : false;
	mbNoModels = iniparser_getboolean(pGameInfoDict, "nomodels", 0) ? true : false;
	mnSoundClipDist = iniparser_getint(pGameInfoDict, "soundclip_dist", 1536);
	
	// Todo: implement vector parsing
		else if(!strnicmp(token, "hull", 4))
开发者ID:Xash3DMagenta,项目名称:magenta_core,代码行数:80,代码来源:GameInfo.cpp


示例12: SetWindowCaption

	void SetWindowCaption(const tString &asName)
	{
		SDL_WM_SetCaption(asName.c_str(),"");
	}
开发者ID:ArchyInf,项目名称:HPL1Engine,代码行数:4,代码来源:LowLevelSystemSDL.cpp


示例13: Debug

void Debug(tString str){
	GetSingleton<IrrApp>()->accessDevice()->setWindowCaption(str.c_str());
}
开发者ID:nitmic,项目名称:GameBaseLib,代码行数:3,代码来源:Debug.cpp


示例14: LoadSimple

bool cMapHandler::LoadSimple(const tString &asFile, bool abLoadEntities)
{	
	tString sMapName = cString::ToLowerCase(cString::SetFileExt(asFile,""));
	cWorld3D *pWorld=NULL;

    DestroyAll();
	mpInit->mpGame->GetSound()->GetSoundHandler()->StopAll(eSoundDest_World);
	mpInit->mpGame->GetSound()->Update(1.0f/60.0f);

    mpInit->mpGame->GetGraphics()->GetRenderer3D()->SetAmbientColor(cColor(0,1)); 
	
	cWorld3D *pOldWorld = mpScene->GetWorld3D();

	//Haptic
	if(mpInit->mbHasHaptics)
		mpInit->mpGame->GetHaptic()->GetLowLevel()->DestroyAllShapes();

	//Delete all sound entities
	if(pOldWorld)
	{
		pOldWorld->DestroyAllSoundEntities();
	}
	
	//Set the current map.
	msCurrentMap = sMapName;

	if(abLoadEntities==false)
	{
		pWorld = mpScene->LoadWorld3D(asFile,true,	eWorldLoadFlag_NoGameEntities);
													//eWorldLoadFlag_NoLights | 
													//eWorldLoadFlag_NoEntities |
													//eWorldLoadFlag_NoGameEntities);
		if(pWorld==NULL){
			Error("Couldn't load map '%s'\n",asFile.c_str());	
			return false;
		}
		mpInit->mpSaveHandler->LoadData(msCurrentMap);
		mpInit->mpGame->GetResources()->GetSoundManager()->DestroyUnused(mpInit->mlMaxSoundDataNum);
		mpInit->mpGame->GetResources()->GetParticleManager()->DestroyUnused(mpInit->mlMaxPSDataNum);
	}
	else
	{
		pWorld = mpScene->LoadWorld3D(asFile,true,0);
		mpInit->mpGame->GetResources()->GetSoundManager()->DestroyUnused(mpInit->mlMaxSoundDataNum);
		mpInit->mpGame->GetResources()->GetParticleManager()->DestroyUnused(mpInit->mlMaxPSDataNum);

		if(pWorld==NULL){
			Error("Couldn't load map '%s'\n",asFile.c_str());	
			return false;
		}
	}

	//Destroy old world, if there is any.
	if(pOldWorld)
	{
		mpScene->DestroyWorld3D(pOldWorld);
	}

		
	//Set physics update
	if(pWorld->GetPhysicsWorld())pWorld->GetPhysicsWorld()->SetMaxTimeStep(mpInit->mfMaxPhysicsTimeStep);

	//OnMapLoad for all entities
	tGameEntityMapIt GIt = m_mapGameEntities.begin();
	for(; GIt != m_mapGameEntities.end(); ++GIt)
	{
		iGameEntity *pEntity = GIt->second;

		pEntity->OnWorldLoad();
	}

	//OnMapLoad for player
	mpInit->mpPlayer->OnWorldLoad();

	mpInit->mpGame->ResetLogicTimer();
	
	//Physics set up
	pWorld->GetPhysicsWorld()->SetAccuracyLevel(mpInit->mPhysicsAccuracy);

	return true;
}
开发者ID:ArchyInf,项目名称:PenumbraOverture,代码行数:81,代码来源:MapHandler.cpp


示例15: Load

bool cMapHandler::Load(const tString &asFile,const tString& asStartPos)
{
	tString sMapName = cString::ToLowerCase(cString::SetFileExt(asFile,""));
	cWorld3D *pWorld=NULL;
	cWorld3D *pLastMap = NULL;
	bool bFirstTime = false;
	double fTimeSinceVisit=0;

#ifdef DEMO_VERSION
	glNumOfLoads++;
	if(glNumOfLoads > 5){
		CreateMessageBoxW(	_W("Demo not playable any more!\n"),
							_W("The limits of the demo have been exceeded!\n"));
		exit(0);
	}
#endif
	
	unsigned long lStartTime = mpInit->mpGame->GetSystem()->GetLowLevel()->GetTime();

	if(sMapName != msCurrentMap)
	{
		////////////////////////////////////////
		// DESTRUCTION OF STUFF NOT SAVED //////

		//remove all local timer
		//RemoveLocalTimers();

		//Exit script
		if(mpScene->GetWorld3D())
		{
			//OnMapLoad for all entities
			tGameEntityMapIt GIt = m_mapGameEntities.begin();
			for(; GIt != m_mapGameEntities.end(); ++GIt)
			{
				iGameEntity *pEntity = GIt->second;

				pEntity->OnWorldExit();
			}

			mpScene->GetWorld3D()->GetScript()->Run("OnExit()");
			
			pLastMap = mpScene->GetWorld3D();
		}

		mpInit->mpMusicHandler->OnWorldExit();
		//Destroy the player objects so they are no saved.
		mpInit->mpPlayer->OnWorldExit();
		mpInit->mpPlayerHands->OnWorldExit();
		mpInit->mpGameMessageHandler->OnWorldExit();

		////////////////////////////////////////
		// SAVING /////////////////////////////

		//Save the map
		if(msCurrentMap != "" && mpScene->GetWorld3D() != NULL)
		{
			mpInit->mpSaveHandler->SaveData(msCurrentMap);
		}
		
		msCurrentMap = sMapName;

		////////////////////////////////////////
		// DESTRUCTION OF SAVED STUFF //////////

		mpInit->mpInventory->ClearCallbacks();

		//Reset the rendering.
		mpInit->mpGame->GetGraphics()->GetRenderer3D()->SetAmbientColor(cColor(0,1));
		mpInit->mpGame->GetGraphics()->GetRenderer3D()->SetSkyBoxActive(false);
		mpInit->mpGame->GetGraphics()->GetRenderer3D()->SetFogActive(false);

		//Remove all current objects
		mpInit->mbDestroyGraphics =false;
		DestroyAll();
		mpInit->mbDestroyGraphics =true;
		
		//Destroy all sound entities on previous map.
		if(mpScene->GetWorld3D())
		{
			mpScene->GetWorld3D()->DestroyAllSoundEntities();
		}
		
		mpInit->mpPlayer->ClearCollideScripts();

		//Stop all sound
		mpInit->mpGame->GetSound()->GetSoundHandler()->StopAll(eSoundDest_World);
		mpInit->mpGame->GetSound()->Update(1.0f/60.0f);

		//Destroy Haptic shapes
		if(mpInit->mbHasHaptics)
			mpInit->mpGame->GetHaptic()->GetLowLevel()->DestroyAllShapes();
		
		////////////////////////////////////////
		// LOAD THE MAP ////////////////////////

		//Load 
		if(mpScene->HasLoadedWorld(asFile))
		{
			//Log("-------- Loaded NOT first time! ----------------\n");
			pWorld = mpScene->LoadWorld3D(asFile,true,	eWorldLoadFlag_NoGameEntities);
//.........这里部分代码省略.........
开发者ID:ArchyInf,项目名称:PenumbraOverture,代码行数:101,代码来源:MapHandler.cpp


示例16: GetFuncHandle

	int cSqScript::GetFuncHandle(const tString& asFunc)
	{
		return mpScriptEngine->GetFunctionIDByName(msModuleName.c_str(),asFunc.c_str());
	}
开发者ID:ArchyInf,项目名称:HPL1Engine,代码行数:4,代码来源:SqScript.cpp


示例17: Run

	bool cSqScript::Run(const tString& asFuncLine)
	{
		mpScriptEngine->ExecuteString(msModuleName.c_str(), asFuncLine.c_str());

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


示例18: GetFuncHandle

	int cSqScript::GetFuncHandle(const tString& asFunc)
	{
		return mpScriptEngine->GetModule(msModuleName.c_str(),asGM_CREATE_IF_NOT_EXISTS)->GetFunctionIdByName(asFunc.c_str());
	}
开发者ID:Naddiseo,项目名称:HPL1Engine,代码行数:4,代码来源:SqScript.cpp


示例19: Run

	bool cSqScript::Run(const tString& asFuncLine)
	{
		ExecuteString(mpScriptEngine, asFuncLine.c_str(),mpScriptEngine->GetModule(msModuleName.c_str(),asGM_ONLY_IF_EXISTS),mpContext);

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


示例20: se_StartsWithColorCode

/**
 * Example: se_StartsWithColorCode( "0xfff000asdf" ) -> true
 * 
 * @return Does the string start with a color code?
 */
static bool se_StartsWithColorCode( const tString & s )
{
    return s.StartsWith( "0x" );
}
开发者ID:KnIfER,项目名称:armagetron,代码行数:9,代码来源:eChat.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ tTJSVariant类代码示例发布时间:2022-05-31
下一篇:
C++ tSpiInformation类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap