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


C++ Com_Filter函数代码示例

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


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

示例1: Cmd_List_f

/*
============
Cmd_List_f
============
*/
void Cmd_List_f(void)
{
	cmd_function_t *cmd;
	int            i = 0;
	char           *match;

	if (Cmd_Argc() > 1)
	{
		match = Cmd_Argv(1);
	}
	else
	{
		match = NULL;
	}

	for (cmd = cmd_functions ; cmd ; cmd = cmd->next)
	{
		if (match && !Com_Filter(match, cmd->name, qfalse))
		{
			continue;
		}

		Com_Printf("%s\n", cmd->name);
		i++;
	}
	Com_Printf("%i commands\n", i);
}
开发者ID:ptitSeb,项目名称:etlegacy,代码行数:32,代码来源:cmd.c

示例2: Sys_Error

/**
 * @brief Opens the directory and returns the first file that matches our searchrules
 * @sa Sys_FindNext
 * @sa Sys_FindClose
 */
char *Sys_FindFirst (const char *path, unsigned musthave, unsigned canhave)
{
    struct dirent *d;
    char *p;

    if (fdir)
        Sys_Error("Sys_BeginFind without close");

    Q_strncpyz(findbase, path, sizeof(findbase));

    if ((p = strrchr(findbase, '/')) != NULL) {
        *p = 0;
        Q_strncpyz(findpattern, p + 1, sizeof(findpattern));
    } else
        Q_strncpyz(findpattern, "*", sizeof(findpattern));

    if (Q_streq(findpattern, "*.*"))
        Q_strncpyz(findpattern, "*", sizeof(findpattern));

    if ((fdir = opendir(findbase)) == NULL)
        return NULL;

    while ((d = readdir(fdir)) != NULL) {
        if (!*findpattern || Com_Filter(findpattern, d->d_name)) {
            if (CompareAttributes(findbase, d->d_name, musthave, canhave)) {
                Com_sprintf(findpath, sizeof(findpath), "%s/%s", findbase, d->d_name);
                return findpath;
            }
        }
    }
    return NULL;
}
开发者ID:Qazzian,项目名称:ufoai_suspend,代码行数:37,代码来源:unix_files.cpp

示例3: Cmd_List_f

/*
============
Cmd_List_f
============
*/
void Cmd_List_f (void)
{
	cmd_function_t	*cmd = NULL;
	int				i, j;
	char			*match = NULL;

	if ( Cmd_Argc() > 1 ) {
		match = Cmd_Argv( 1 );
	}

	for ( cmd=cmd_functions, i=0, j=0;
		cmd;
		cmd=cmd->next, i++ )
	{
		if ( !cmd->name || (match && !Com_Filter( match, cmd->name, qfalse )) )
			continue;

		Com_Printf (" %s\n", cmd->name);
		j++;
	}

	Com_Printf ("\n%i total commands\n", i);
	if ( i != j )
		Com_Printf( "%i matching commands\n", j );
}
开发者ID:Aura15,项目名称:OpenJK,代码行数:30,代码来源:cmd.cpp

示例4: Cvar_List_f

/*
============
Cvar_List_f
============
*/
void Cvar_List_f( void ) {
	cvar_t *var = NULL;
	int i = 0;
	char *match = NULL;

	if ( Cmd_Argc() > 1 )
		match = Cmd_Argv( 1 );

	for ( var=cvar_vars, i=0;
		var;
		var=var->next, i++ )
	{
		if ( !var->name || (match && !Com_Filter( match, var->name, qfalse )) )
			continue;

		if (var->flags & CVAR_SERVERINFO)	Com_Printf( "S" );	else Com_Printf( " " );
		if (var->flags & CVAR_SYSTEMINFO)	Com_Printf( "s" );	else Com_Printf( " " );
		if (var->flags & CVAR_USERINFO)		Com_Printf( "U" );	else Com_Printf( " " );
		if (var->flags & CVAR_ROM)			Com_Printf( "R" );	else Com_Printf( " " );
		if (var->flags & CVAR_INIT)			Com_Printf( "I" );	else Com_Printf( " " );
		if (var->flags & CVAR_ARCHIVE)		Com_Printf( "A" );	else Com_Printf( " " );
		if (var->flags & CVAR_LATCH)		Com_Printf( "L" );	else Com_Printf( " " );
		if (var->flags & CVAR_CHEAT)		Com_Printf( "C" );	else Com_Printf( " " );
		if (var->flags & CVAR_USER_CREATED)	Com_Printf( "?" );	else Com_Printf( " " );

		Com_Printf( S_COLOR_WHITE " %s = " S_COLOR_GREY "\"" S_COLOR_WHITE "%s" S_COLOR_GREY "\"" S_COLOR_WHITE, var->name, var->string );
		if ( var->latchedString )
			Com_Printf( ", latched = " S_COLOR_GREY "\"" S_COLOR_WHITE "%s" S_COLOR_GREY "\"" S_COLOR_WHITE, var->latchedString );
		Com_Printf( "\n" );
	}

	Com_Printf( "\n%i total cvars\n", i );
	if ( i != cvar_numIndexes )
		Com_Printf( "%i cvar indexes\n", cvar_numIndexes );
}
开发者ID:TheSil,项目名称:WhoracleMod,代码行数:40,代码来源:cvar.cpp

示例5: Cmd_List_f

/*
============
Cmd_List_f
============
*/
static void Cmd_List_f( void ) {
	cmd_function_t  *cmd;
	int i;
	char            *match;

	if ( Cmd_Argc() > 1 ) {
		match = Cmd_Argv( 1 );
	} else {
		match = NULL;
	}

	i = 0;
	for ( cmd = cmd_functions ; cmd ; cmd = cmd->next ) {
		if ( (match && !Com_Filter( match, (char*)cmd->name, qfalse ))
		|| Cmd_GetInvokerPower() < cmd->minPower || ((cmd->minPower == 0) && Cmd_GetInvokerPower() != 100))
		{
			if(!Auth_CanPlayerUseCommand(Cmd_GetInvokerClnum(), (char*)cmd->name))
			{
				continue;
			}
		}
		Com_Printf( "%s\n", cmd->name );
		i++;
	}
	Com_Printf( "%i commands\n", i );
}
开发者ID:D4edalus,项目名称:CoD4x_Server,代码行数:31,代码来源:cmd.c

示例6: Com_FilterPath

/*
============
Com_FilterPath
============
*/
int Com_FilterPath(const char *filter, const char *name, int casesensitive)
{
	int i;
	char new_filter[MAX_QPATH];
	char new_name[MAX_QPATH];

	for (i = 0; i < MAX_QPATH-1 && filter[i]; i++) {
		if ( filter[i] == '\\' || filter[i] == ':' ) {
			new_filter[i] = '/';
		}
		else {
			new_filter[i] = filter[i];
		}
	}
	new_filter[i] = '\0';
	for (i = 0; i < MAX_QPATH-1 && name[i]; i++) {
		if ( name[i] == '\\' || name[i] == ':' ) {
			new_name[i] = '/';
		}
		else {
			new_name[i] = name[i];
		}
	}
	new_name[i] = '\0';
	return Com_Filter(new_filter, new_name, casesensitive);
}
开发者ID:Aura15,项目名称:OpenJK,代码行数:31,代码来源:common.cpp

示例7: Cvar_List_f

/*
============
Cvar_List_f
============
*/
void Cvar_List_f( void ) {
	cvar_t	*var;
	int		i;
	char	*match;

	if ( Cmd_Argc() > 1 ) {
		match = Cmd_Argv( 1 );
	} else {
		match = NULL;
	}

	i = 0;
	for (var = cvar_vars ; var ; var = var->next, i++)
	{
		if (match && !Com_Filter(match, var->name, qfalse)) continue;

		if (var->flags & CVAR_SERVERINFO) {
			Com_Printf("S");
		} else {
			Com_Printf(" ");
		}
		if (var->flags & CVAR_USERINFO) {
			Com_Printf("U");
		} else {
			Com_Printf(" ");
		}
		if (var->flags & CVAR_ROM) {
			Com_Printf("R");
		} else {
			Com_Printf(" ");
		}
		if (var->flags & CVAR_INIT) {
			Com_Printf("I");
		} else {
			Com_Printf(" ");
		}
		if (var->flags & CVAR_ARCHIVE) {
			Com_Printf("A");
		} else {
			Com_Printf(" ");
		}
		if (var->flags & CVAR_LATCH) {
			Com_Printf("L");
		} else {
			Com_Printf(" ");
		}
		if (var->flags & CVAR_CHEAT) {
			Com_Printf("C");
		} else {
			Com_Printf(" ");
		}

		Com_Printf (" %s \"%s\"\n", var->name, var->string);
	}

	Com_Printf ("\n%i total cvars\n", i);
	Com_Printf ("%i cvar indexes\n", cvar_numIndexes);
}
开发者ID:ZdrytchX,项目名称:Lolards,代码行数:63,代码来源:cvar.c

示例8: Svcmd_EntityList_f

void  Svcmd_EntityList_f()
{
    int       entityNum;
    int i;
    int currentEntityCount;
    gentity_t *displayedEntity;
    char* filter;

    displayedEntity = g_entities;

    if(trap_Argc() > 1)
    {
        filter = ConcatArgs( 1 );
    }
    else
    {
        filter = nullptr;
    }

    for ( entityNum = 0, currentEntityCount = 0; entityNum < level.num_entities; entityNum++, displayedEntity++ )
    {
        if ( !displayedEntity->inuse )
        {
            continue;
        }
        currentEntityCount++;

        if(filter && !Com_Filter(filter, displayedEntity->classname, false) )
        {
            for (i = 0; i < MAX_ENTITY_ALIASES && displayedEntity->names[i]; ++i)
            {
                if( Com_Filter(filter, displayedEntity->names[i], false) )
                {
                    PrintEntityOverviewLine( displayedEntity );
                    break;
                }
            }
            continue;
        }
        PrintEntityOverviewLine( displayedEntity );
    }

    G_Printf( "A total of %i entities are currently in use.\n", currentEntityCount);
}
开发者ID:BlueMustache,项目名称:Unvanquished,代码行数:44,代码来源:sg_svcmds.cpp

示例9: Cmd_List_f

static void Cmd_List_f()
{
	const char* match = (Cmd_Argc() > 1) ? Cmd_Argv(1) : NULL;

	int i = 0;
	for (const cmd_function_t* cmd = cmd_functions; cmd; cmd = cmd->next) {
		if (match && !Com_Filter(match, cmd->name))
			continue;
		Com_Printf( "%s\n", cmd->name );
		++i;
	}

	Com_Printf( "%i commands\n", i );
}
开发者ID:ShaneIsley,项目名称:challengeq3,代码行数:14,代码来源:cmd.cpp

示例10: while

/**
 * @brief Returns the next file of the already opened directory (Sys_FindFirst) that matches our search mask
 * @sa Sys_FindClose
 * @sa Sys_FindFirst
 * @sa static var findpattern
 */
char *Sys_FindNext (unsigned musthave, unsigned canhave)
{
    struct dirent *d;

    if (fdir == NULL)
        return NULL;
    while ((d = readdir(fdir)) != NULL) {
        if (!*findpattern || Com_Filter(findpattern, d->d_name)) {
            if (CompareAttributes(findbase, d->d_name, musthave, canhave)) {
                Com_sprintf(findpath, sizeof(findpath), "%s/%s", findbase, d->d_name);
                return findpath;
            }
        }
    }
    return NULL;
}
开发者ID:Qazzian,项目名称:ufoai_suspend,代码行数:22,代码来源:unix_files.cpp

示例11: Cmd_AliasList_f

/*
============
Cmd_AliasList_f
============
*/
void Cmd_AliasList_f (void)
{
	cmd_alias_t	*alias;
	int			i;
	char		*match;

	if (Cmd_Argc() > 1)
		match = Cmd_Argv( 1 );
	else
		match = NULL;

	i = 0;
	for (alias = cmd_aliases; alias; alias = alias->next)
	{
		if (match && !Com_Filter(match, alias->name, false))
			continue;
		Com_Printf ("%s ==> %s\n", alias->name, alias->exec);
		i++;
	}
	Com_Printf ("%i aliases\n", i);
}
开发者ID:TheDushan,项目名称:OpenWolf,代码行数:26,代码来源:cmd.cpp

示例12: Sys_ListFilteredFiles

void Sys_ListFilteredFiles (const char *basedir, const char *subdirs, const char *filter, linkedList_t **list)
{
    char search[MAX_OSPATH], newsubdirs[MAX_OSPATH];
    char filename[MAX_OSPATH];
    DIR *directory;
    struct dirent *d;
    struct stat st;

    if (subdirs[0] != '\0') {
        Com_sprintf(search, sizeof(search), "%s/%s", basedir, subdirs);
    } else {
        Com_sprintf(search, sizeof(search), "%s", basedir);
    }

    if ((directory = opendir(search)) == NULL)
        return;

    while ((d = readdir(directory)) != NULL) {
        Com_sprintf(filename, sizeof(filename), "%s/%s", search, d->d_name);
        if (stat(filename, &st) == -1)
            continue;

        if (st.st_mode & S_IFDIR) {
            if (Q_strcasecmp(d->d_name, ".") && Q_strcasecmp(d->d_name, "..")) {
                if (subdirs[0] != '\0') {
                    Com_sprintf(newsubdirs, sizeof(newsubdirs), "%s/%s", subdirs, d->d_name);
                } else {
                    Com_sprintf(newsubdirs, sizeof(newsubdirs), "%s", d->d_name);
                }
                Sys_ListFilteredFiles(basedir, newsubdirs, filter, list);
            }
        }
        Com_sprintf(filename, sizeof(filename), "%s/%s", subdirs, d->d_name);
        if (!Com_Filter(filter, filename))
            continue;
        LIST_AddString(list, filename);
    }

    closedir(directory);
}
开发者ID:Qazzian,项目名称:ufoai_suspend,代码行数:40,代码来源:unix_files.cpp

示例13: Cmd_ListPower_f

static void Cmd_ListPower_f() {

	cmd_function_t  *cmd;
	int i, hidden, j, l;
	char            *match;

	if ( Cmd_Argc() > 1 ) {
		match = Cmd_Argv( 1 );
	} else {
		match = NULL;
	}

	i = 0;
	hidden = 0;
	for ( cmd = cmd_functions ; cmd ; cmd = cmd->next ) {
		if ( (match && !Com_Filter( match, (char*)cmd->name, qfalse ))) {
			continue;
		}
		if(cmd->minPower == 100 || cmd->minPower == 0){
			hidden++;
			continue;
		}
		Com_Printf ("%s", cmd->name );

		l = 24 - strlen(cmd->name);
		j = 0;

		do
		{
			Com_Printf (" ");
			j++;
		} while(j < l);

		Com_Printf( "%d\n", cmd->minPower );
		i++;
	}
	Com_Printf( "\n%i commands with specified power settings are shown\n", i );
	Com_Printf( "%i commands are hidden because the required power level for those commands is set to 100 or 0\n", hidden );
	Com_Printf( "Type cmdlist to get a complete list of all commands\n");
}
开发者ID:BraXi,项目名称:CoD4X18-Server,代码行数:40,代码来源:cmd.c

示例14: Cmd_List_f

/*
============
Cmd_List_f
============
*/
void Cmd_List_f (void)
{
	cmd_function_t	*cmd;
	int				i;
	char			*match;

	if ( Cmd_Argc() > 1 ) {
		match = Cmd_Argv( 1 );
	} else {
		match = NULL;
	}

	i = 0;
	for ( int c = 0; c < CMD_MAX_NUM; ++c )
	{
		cmd = cmd_functions + c;
		if (match && !Com_Filter(match, cmd->name, qfalse)) continue;
		Com_Printf ("%s\n", cmd->name);
		i++;
	}
	Com_Printf ("%i commands\n", i);
}
开发者ID:bdwakefield,项目名称:OpenJK,代码行数:27,代码来源:cmd.cpp

示例15: Sys_ListFilteredFiles

void Sys_ListFilteredFiles (const char* basedir, const char* subdirs, const char* filter, linkedList_t** list)
{
	char search[MAX_OSPATH], newsubdirs[MAX_OSPATH];
	char filename[MAX_OSPATH];
	int findhandle;
	struct _wfinddata_t findinfo;

	if (subdirs[0] != '\0') {
		Com_sprintf(search, sizeof(search), "%s\\%s\\*", basedir, subdirs);
	} else {
		Com_sprintf(search, sizeof(search), "%s\\*", basedir);
	}

	Sys_Utf8ToUtf16(search, wfindpath, lengthof(wfindpath));
	findhandle = _wfindfirst(wfindpath, &findinfo);
	if (findhandle == -1)
		return;

	do {
		Sys_Utf16ToUtf8(findinfo.name, findname, sizeof(findname));
		if (findinfo.attrib & _A_SUBDIR) {
			if (Q_strcasecmp(findname, ".") && Q_strcasecmp(findname, "..")) {
				if (subdirs[0] != '\0') {
					Com_sprintf(newsubdirs, sizeof(newsubdirs), "%s\\%s", subdirs, findname);
				} else {
					Com_sprintf(newsubdirs, sizeof(newsubdirs), "%s", findname);
				}
				Sys_ListFilteredFiles(basedir, newsubdirs, filter, list);
			}
		}
		Com_sprintf(filename, sizeof(filename), "%s\\%s", subdirs, findname);
		if (!Com_Filter(filter, filename))
			continue;
		LIST_AddString(list, filename);
	} while (_wfindnext(findhandle, &findinfo) != -1);

	_findclose(findhandle);
}
开发者ID:stavrossk,项目名称:ufoai,代码行数:38,代码来源:win_shared.cpp


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