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


C++ idStr类代码示例

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


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

示例1: GetLastWhiteSpace

/*
================
idLexer::GetLastWhiteSpace
================
*/
int idLexer::GetLastWhiteSpace( idStr &whiteSpace ) const {
	whiteSpace.Clear();
	for ( const char *p = whiteSpaceStart_p; p < whiteSpaceEnd_p; p++ ) {
		whiteSpace.Append( *p );
	}
	return whiteSpace.Length();
}
开发者ID:c4tnt,项目名称:DLR,代码行数:12,代码来源:Lexer.cpp

示例2: CleanName

/*
================
CleanName
================
*/
void CleanName( idStr &name ) {
	name.Replace( "::", "_" );
	name.Replace( " , ", "_" );
	name.Replace( "< ", "_" );
	name.Replace( " >", "_" );
	name.Replace( " ", "_" );
}
开发者ID:Deepfreeze32,项目名称:idtech4cdk,代码行数:12,代码来源:TypeInfoGen.cpp

示例3: FindItem

/*
================
CPathTreeCtrl::FindItem

Find the given path in the tree.
================
*/
HTREEITEM CPathTreeCtrl::FindItem( const idStr &pathName ) {
	int lastSlash;
	idStr path, tmpPath, itemName;
	HTREEITEM item, parentItem;

	parentItem = NULL;
	item = GetRootItem();

	lastSlash = pathName.Last( '/' );

	while( item && lastSlash > path.Length() ) {
		itemName = GetItemText( item );
		tmpPath = path + itemName;
		if ( pathName.Icmpn( tmpPath, tmpPath.Length() ) == 0 ) {
			parentItem = item;
			item = GetChildItem( item );
			path = tmpPath + "/";
		} else {
			item = GetNextSiblingItem( item );
		}
	}

	for ( item = GetChildItem( parentItem ); item; item = GetNextSiblingItem( item ) ) {
		itemName = GetItemText( item );
		if ( pathName.Icmp( path + itemName ) == 0 ) {
			return item;
		}
	}

	return NULL;
}
开发者ID:BielBdeLuna,项目名称:StormEngine2,代码行数:38,代码来源:CPathTreeCtrl.cpp

示例4: OpenFile

CZipFilePtr CZipLoader::OpenFile(const idStr& fullOSPath)
{
	DM_LOG(LC_MAINMENU, LT_DEBUG)LOGSTRING("Attempting to open file as ZIP: %s.\r", fullOSPath.c_str());
	unzFile handle = unzOpen(fullOSPath.c_str());

	return (handle != NULL) ? CZipFilePtr(new CZipFile(handle)) : CZipFilePtr();
}
开发者ID:dolanor,项目名称:TheDarkMod,代码行数:7,代码来源:ZipLoader.cpp

示例5: Sys_SaveGameCheck

/*
========================
Sys_SaveGameCheck
========================
*/
void Sys_SaveGameCheck( bool & exists, bool & autosaveExists ) {
	exists = false;
	autosaveExists = false;

	const idStr autosaveFolderStr = AddSaveFolderPrefix( SAVEGAME_AUTOSAVE_FOLDER, idSaveGameManager::PACKAGE_GAME );
	const char * autosaveFolder = autosaveFolderStr.c_str();
	const char * saveFolder = "savegame";

	if ( fileSystem->IsFolder( saveFolder, "fs_savePath" ) == FOLDER_YES ) {
		idFileList * files = fileSystem->ListFiles( saveFolder, "/" );
		const idStrList & fileList = files->GetList();

		idLib::PrintfIf( saveGame_verbose.GetBool(), "found %d savegames\n", fileList.Num() );

		for ( int i = 0; i < fileList.Num(); i++ ) {
			const char * directory = va( "%s/%s", saveFolder, fileList[i].c_str() );

			if ( fileSystem->IsFolder( directory, "fs_savePath" ) == FOLDER_YES ) {
				exists = true;
				
				idLib::PrintfIf( saveGame_verbose.GetBool(), "found savegame: %s\n", fileList[i].c_str() );

				if ( idStr::Icmp( fileList[i].c_str(), autosaveFolder ) == 0 ) {
					autosaveExists = true;
					break;
				}
			}
		}

		fileSystem->FreeFileList( files );
	}
}
开发者ID:469486139,项目名称:DOOM-3-BFG,代码行数:37,代码来源:win_savegame.cpp

示例6: Init

/*
============
idAASLocal::Init
============
*/
bool idAASLocal::Init( const idStr &mapName, unsigned int mapFileCRC ) {
	if ( file && mapName.Icmp( file->GetName() ) == 0 && mapFileCRC == file->GetCRC() ) {
		gameLocal.Printf( "Keeping %s\n", file->GetName() );
		RemoveAllObstacles();
	}
	else {
		Shutdown();

		file = AASFileManager->LoadAAS( mapName, mapFileCRC );
		if ( !file ) {
			common->DWarning( "Couldn't load AAS file: '%s'", mapName.c_str() );
			return false;
		}
// RAVEN BEGIN
// rhummer: Check if this is a dummy file, since it really has no valid data dump it.
		else if ( file->IsDummyFile( mapFileCRC ) ) {
			AASFileManager->FreeAAS( file );
			file = NULL;
			return false;
		}
// RAVEN END
		SetupRouting();
	}
	return true;
}
开发者ID:AliKalkandelen,项目名称:quake4,代码行数:30,代码来源:AAS.cpp

示例7: BuildDeclText

void DialogEntityDefEditor::BuildDeclText( idStr &declText )
{
	CString declName;
	declNameEdit.GetWindowText(declName);
	CString inherit;
	inheritCombo.GetWindowText(inherit);
	CString spawnclass;
	spawnclassCombo.GetWindowText(spawnclass);

	declText = "entityDef " + declName + "\r{\r";
	declText += "\"inherit\"\t\t\t\"" + inherit + "\"\r";
	declText += "\"spawnclass\"\t\t\t\"" + spawnclass + "\"\r";
	for (int i=0; i<keyValsList.GetCount(); i++) {
		CPropertyItem* pItem = (CPropertyItem*)keyValsList.GetItemDataPtr(i);
		if (pItem) {
			// Items with a * in front are inherited and shouldn't be written out
			if (pItem->m_propName[0] == '*') {
				break;
			}
			declText += "\"" + pItem->m_propName + "\"\t\t\t\"" + pItem->m_curValue + "\"\r";
		}
	}
	declText += "}\r";

	declText.Replace( "\r", "\r\n" );
	declText.Insert( "\r\n\r\n", 0 );
	declText.StripTrailing( "\r\n" );
}
开发者ID:,项目名称:,代码行数:28,代码来源:

示例8: AnimIsApplicable

bool IdleAnimationTask::AnimIsApplicable(idAI* owner, const idStr& animName)
{
	int torsoAnimNum = owner->GetAnim(ANIMCHANNEL_TORSO, animName);

	if (torsoAnimNum == 0)
	{
		gameLocal.Warning("Could not find anim %s on entity %s", animName.c_str(), owner->name.c_str());
		DM_LOG(LC_AI, LT_ERROR)LOGSTRING("Could not find anim %s on entity %s\r", animName.c_str(), owner->name.c_str());

		return false;
	}

	// Check if this anim interferes with random head turning
	if ( owner->GetMemory().currentlyHeadTurning && AnimHasNoHeadTurnFlag(owner, torsoAnimNum) )
	{
//		gameLocal.Printf("Inhibited idle animation %s, since random head turning is active.\n", animName.c_str());

		// Cannot play this one at this point
		return false;
	}

	// grayman #3182 - Check if this anim plays a voice bark, which would interfere with ongoing voice barks
	if ( owner->GetMemory().currentlyBarking && AnimHasVoiceFlag(owner, animName) )
	{
//		gameLocal.Printf("Inhibited idle animation %s, since barking is active.\n", animName.c_str());

		// Cannot play this one at this point
		return false;
	}

	// OK
	return true; 
}
开发者ID:ProfessorKaos64,项目名称:tdm,代码行数:33,代码来源:IdleAnimationTask.cpp

示例9: idStr

void CModInfo::GetMissionTitles(idStr missionTitles)
{
	if (modName.IsEmpty())
	{
		return;
	}

	int startIndex = 0;
	idStr start = "Mission 1 Title: ";
	idStr end   = "Mission 2 Title: ";
	int endIndex = missionTitles.Find(end.c_str(), true); // grayman #3733
	bool finished = false;
	for ( int i = 1 ; ; i++ )
	{
		idStr title = idStr(missionTitles, startIndex, endIndex); // grayman #3733
		Strip(start.c_str(), title);
		_missionTitles.Append(title);
		start = end;
		startIndex = endIndex;
		if (finished)
		{
			break;
		}
		end = va("Mission %d Title: ",i+2);
		endIndex = missionTitles.Find(end.c_str(), true, startIndex); // grayman #3733
		if (endIndex < 0)
		{
			endIndex = missionTitles.Length();
			finished = true;
		}
	}
}
开发者ID:jaredmitch,项目名称:executable,代码行数:32,代码来源:ModInfo.cpp

示例10: Sys_GetPath

bool Sys_GetPath(sysPath_t type, idStr &path) {
    char buf[MAX_OSPATH];
    struct _stat st;
    idStr s;

    switch(type) {
    case PATH_BASE:
        // try <path to exe>/base first
        if (Sys_GetPath(PATH_EXE, path)) {
            path.StripFilename();

            s = path;
            s.AppendPath(BASE_GAMEDIR);
            if (_stat(s.c_str(), &st) != -1 && st.st_mode & _S_IFDIR)
                return true;

            common->Warning("base path '%s' does not exits", s.c_str());
        }

        // fallback to vanilla doom3 cd install
        if (GetRegistryPath(buf, sizeof(buf), L"SOFTWARE\\id\\Doom 3", L"InstallPath") > 0) {
            path = buf;
            return true;
        }

        // fallback to steam doom3 install
        if (GetRegistryPath(buf, sizeof(buf), L"SOFTWARE\\Valve\\Steam", L"InstallPath") > 0) {
            path = buf;
            path.AppendPath("steamapps\\common\\doom 3");

            if (_stat(path.c_str(), &st) != -1 && st.st_mode & _S_IFDIR)
                return true;
        }

        common->Warning("vanilla doom3 path not found");

        return false;

    case PATH_CONFIG:
    case PATH_SAVE:
        if (GetHomeDir(buf, sizeof(buf)) < 1) {
            Sys_Error("ERROR: Couldn't get dir to home path");
            return false;
        }

        path = buf;
        return true;

    case PATH_EXE:
        GetModuleFileName(NULL, buf, sizeof(buf) - 1);
        path = buf;
        path.BackSlashesToSlashes();
        return true;
    }

    return false;
}
开发者ID:kevindqc,项目名称:utl,代码行数:57,代码来源:win_main.cpp

示例11: GetDemoNameInfo

/*
============
sdGameRulesStopWatch::GetDemoNameInfo
============
*/
const char* sdGameRulesStopWatch::GetDemoNameInfo( void ) {
	static idStr demoNameBuffer;
	if ( progression == GP_FIRST_MATCH ) {
		demoNameBuffer = va( "stopwatch_first" );
	} else {
		demoNameBuffer = va( "stopwatch_second" );
	}
	return demoNameBuffer.c_str();
}
开发者ID:,项目名称:,代码行数:14,代码来源:

示例12: PushState

void Mind::PushState( const idStr &stateName ) {
	// Get a new state with the given name
	StatePtr newState = StateLibrary::Instance().CreateInstance( stateName.c_str() );
	if( newState != NULL ) {
		PushState( newState );
	} else {
		gameLocal.Error( "Mind: Could not push state %s", stateName.c_str() );
	}
}
开发者ID:SL987654,项目名称:The-Darkmod-Experimental,代码行数:9,代码来源:Mind.cpp

示例13: defined

/*
========================
idKeyInput::LocalizedKeyName
========================
*/
const char* idKeyInput::LocalizedKeyName( keyNum_t keynum )
{
	// RB
#if defined(_WIN32)
	// DG TODO: move this into a win32 Sys_GetKeyName()
	if( keynum < K_JOY1 )
	{
		// On the PC, we want to turn the scan code in to a key label that matches the currently selected keyboard layout
		unsigned char keystate[256] = { 0 };
		WCHAR temp[5];
		
		int scancode = ( int )keynum;
		int vkey = MapVirtualKey( keynum, MAPVK_VSC_TO_VK_EX );
		int result = -1;
		while( result < 0 )
		{
			result = ToUnicode( vkey, scancode, keystate, temp, sizeof( temp ) / sizeof( temp[0] ), 0 );
		}
		if( result > 0 && temp[0] > ' ' && iswprint( temp[0] ) )
		{
			static idStr bindStr;
			bindStr.Empty();
			bindStr.AppendUTF8Char( temp[0] );
			return bindStr;
		}
	}
#else // DG: for !Windows I introduced Sys_GetKeyName() to get key label for current keyboard layout
	
	const char* ret = nullptr;
	
	if( keynum < K_JOY1 ) // only for keyboard keys, not joystick or mouse
	{
		ret = Sys_GetKeyName( keynum );
	}
	
	if( ret != NULL )
	{
		return ret;
	}
#endif
	
	// check for a key string
	for( keyname_t* kn = keynames; kn->name; kn++ )
	{
		if( keynum == kn->keynum )
		{
			return idLocalization::GetString( kn->strId );
		}
	}
	return "????";
	// RB/DG end
}
开发者ID:Yetta1,项目名称:OpenTechBFG,代码行数:57,代码来源:KeyInput.cpp

示例14: GetDeclName

/*
================
DialogDeclBrowser::GetDeclName
================
*/
void DialogDeclBrowser::GetDeclName( HTREEITEM item, idStr &typeName, idStr &declName ) const {
	HTREEITEM parent;
	idStr itemName;

	declName.Clear();
	for( parent = declTree.GetParentItem( item ); parent; parent = declTree.GetParentItem( parent ) ) {
		itemName = declTree.GetItemText( item );
		declName = itemName + "/" + declName;
		item = parent;
	}
	declName.Strip( '/' );
	typeName = declTree.GetItemText( item );
}
开发者ID:albertz,项目名称:iodoom3,代码行数:18,代码来源:DialogDeclBrowser.cpp

示例15: Sym_GetFuncInfo

/*
==================
Sym_GetFuncInfo
==================
*/
void Sym_GetFuncInfo( long addr, idStr &module, idStr &funcName )
{
    MEMORY_BASIC_INFORMATION mbi;
    module_t *m;
    symbol_t *s;

    VirtualQuery( (void*)addr, &mbi, sizeof(mbi) );

    for ( m = modules; m != NULL; m = m->next )
    {
        if ( m->address == (int) mbi.AllocationBase )
        {
            break;
        }
    }
    if ( !m )
    {
        Sym_Init( addr );
        m = modules;
    }

    for ( s = m->symbols; s != NULL; s = s->next )
    {
        if ( s->address == addr )
        {

            char undName[MAX_STRING_CHARS];
            if ( UnDecorateSymbolName( s->name, undName, sizeof(undName), UNDECORATE_FLAGS ) )
            {
                funcName = undName;
            }
            else
            {
                funcName = s->name;
            }
            for ( int i = 0; i < funcName.Length(); i++ )
            {
                if ( funcName[i] == '(' )
                {
                    funcName.CapLength( i );
                    break;
                }
            }
            module = m->name;
            return;
        }
    }

    sprintf( funcName, "0x%08x", addr );
    module = "";
}
开发者ID:revelator,项目名称:Revelator-Doom3,代码行数:56,代码来源:win_shared.cpp


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