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


C++ StringToFilter函数代码示例

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


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

示例1: SVCmd_AddIP_f

/*
=================
SV_AddIP_f
=================
*/
void SVCmd_AddIP_f (void)
{
	int		i;
	
	if (gi.argc() < 3) {
#ifdef WITH_ACEBOT
		safe_cprintf 
#else
		gi.cprintf
#endif
		(NULL, PRINT_HIGH, "Usage:  addip <ip-mask>\n");
		return;
	}

	for (i=0 ; i<numipfilters ; i++)
		if (ipfilters[i].compare == 0xffffffff)
			break;		// free spot
	if (i == numipfilters)
	{
		if (numipfilters == MAX_IPFILTERS)
		{
#ifdef WITH_ACEBOT
		safe_cprintf 
#else
		gi.cprintf
#endif
			 (NULL, PRINT_HIGH, "IP filter list is full\n");
			return;
		}
		numipfilters++;
	}
	
	if (!StringToFilter (gi.argv(2), &ipfilters[i]))
		ipfilters[i].compare = 0xffffffff;
}
开发者ID:ZwS,项目名称:qudos,代码行数:40,代码来源:g_svcmds.c

示例2: SVCmd_RemoveIP_f

void
SVCmd_RemoveIP_f(void)
{
	ipfilter_t f;
	int i, j;

	if (gi.argc() < 3)
	{
		gi.cprintf(NULL, PRINT_HIGH, "Usage:  sv removeip <ip-mask>\n");
		return;
	}

	if (!StringToFilter(gi.argv(2), &f))
	{
		return;
	}

	for (i = 0; i < numipfilters; i++)
	{
		if ((ipfilters[i].mask == f.mask) &&
			(ipfilters[i].compare == f.compare))
		{
			for (j = i + 1; j < numipfilters; j++)
			{
				ipfilters[j - 1] = ipfilters[j];
			}

			numipfilters--;
			gi.cprintf(NULL, PRINT_HIGH, "Removed.\n");
			return;
		}
	}

	gi.cprintf(NULL, PRINT_HIGH, "Didn't find %s.\n", gi.argv(2));
}
开发者ID:yquake2,项目名称:rogue,代码行数:35,代码来源:g_svcmds.c

示例3: Cmd_RemoveIP_f

/*
* Cmd_RemoveIP_f
*/
static void Cmd_RemoveIP_f( void )
{
	ipfilter_t f;
	int i, j;

	if( trap_Cmd_Argc() < 2 )
	{
		G_Printf( "Usage: removeip <ip-mask>\n" );
		return;
	}

	if( !StringToFilter( trap_Cmd_Argv( 1 ), &f ) )
		return;

	for( i = 0; i < numipfilters; i++ )
		if( ipfilters[i].mask == f.mask
			&& ipfilters[i].compare == f.compare )
		{
			for( j = i+1; j < numipfilters; j++ )
				ipfilters[j-1] = ipfilters[j];
			numipfilters--;
			G_Printf( "Removed.\n" );
			return;
		}
		G_Printf( "Didn't find %s.\n", trap_Cmd_Argv( 1 ) );
}
开发者ID:Clever-Boy,项目名称:qfusion,代码行数:29,代码来源:g_svcmds.cpp

示例4: Cmd_AddIP_f

/*
* Cmd_AddIP_f
*/
static void Cmd_AddIP_f( void )
{
	int i;

	if( trap_Cmd_Argc() < 2 )
	{
		G_Printf( "Usage: addip <ip-mask> [time-mins]\n" );
		return;
	}

	for( i = 0; i < numipfilters; i++ )
		if( ipfilters[i].compare == 0xffffffff || (ipfilters[i].timeout && ipfilters[i].timeout <= game.serverTime) )
			break; // free spot
	if( i == numipfilters )
	{
		if( numipfilters == MAX_IPFILTERS )
		{
			G_Printf( "IP filter list is full\n" );
			return;
		}
		numipfilters++;
	}

	ipfilters[i].timeout = 0;
	if( !StringToFilter( trap_Cmd_Argv( 1 ), &ipfilters[i] ) )
		ipfilters[i].compare = 0xffffffff;
	else if( trap_Cmd_Argc() == 3 )
		ipfilters[i].timeout = game.serverTime + atof( trap_Cmd_Argv(2) )*60*1000;
}
开发者ID:Clever-Boy,项目名称:qfusion,代码行数:32,代码来源:g_svcmds.cpp

示例5: AddIP

/*
=================
AddIP
=================
*/
void AddIP(ipFilterList_t *ipFilterList, const char *str)
{
	int i;

	for (i = 0; i < ipFilterList->numIPFilters; i++)
	{
		if (ipFilterList->ipFilters[i].compare == 0xffffffff)
		{
			break;      // free spot
		}
	}

	if (i == ipFilterList->numIPFilters)
	{
		if (ipFilterList->numIPFilters == MAX_IPFILTERS)
		{
			G_Printf("IP filter list is full\n");
			return;
		}
		ipFilterList->numIPFilters++;
	}

	if (!StringToFilter(str, &ipFilterList->ipFilters[i]))
	{
		ipFilterList->ipFilters[i].compare = 0xffffffffu;
	}

	UpdateIPBans(ipFilterList);
}
开发者ID:vishen,项目名称:etlegacy,代码行数:34,代码来源:g_svcmds.c

示例6: G_AddXPBackup

void G_AddXPBackup( gentity_t* ent ) {
	int i;
	int best = -1;
	int besttime;
	const char* str;
	char userinfo[MAX_INFO_STRING];

	trap_GetUserinfo( ent - g_entities, userinfo, sizeof( userinfo ) );
	str = Info_ValueForKey( userinfo, "ip" );

	for( i = 0; i < MAX_XPSTORAGEITEMS; i++ ) {
		if( !ipXPStorage.ipFilters[ i ].timeadded ) {
			best = i;
			break;
		}

		if( best == -1 || ipXPStorage.ipFilters[ i ].timeadded < besttime ) {
			besttime = ipXPStorage.ipFilters[ i ].timeadded;
			best = i;
			continue;
		}
	}

	ipXPStorage.ipFilters[ best ].timeadded = level.time;
	if( !StringToFilter( str, &ipXPStorage.ipFilters[ best ].filter ) ) {
		ipXPStorage.ipFilters[ best ].filter.compare = 0xffffffffu;
	}

	for( i = 0; i < SK_NUM_SKILLS; i++ ) {
		ipXPStorage.ipFilters[ best ].skills[ i ] = ent->client->sess.skillpoints[ i ];
	}
}
开发者ID:chegestar,项目名称:omni-bot,代码行数:32,代码来源:g_svcmds.c

示例7: SVCmd_AddIP_f

void
SVCmd_AddIP_f(void)
{
	int i;

	if (gi.argc() < 3)
	{
		gi.cprintf(NULL, PRINT_HIGH, "Usage:  addip <ip-mask>\n");
		return;
	}

	for (i = 0; i < numipfilters; i++)
	{
		if (ipfilters[i].compare == 0xffffffff)
		{
			break; /* free spot */
		}
	}

	if (i == numipfilters)
	{
		if (numipfilters == MAX_IPFILTERS)
		{
			gi.cprintf(NULL, PRINT_HIGH, "IP filter list is full\n");
			return;
		}

		numipfilters++;
	}

	if (!StringToFilter(gi.argv(2), &ipfilters[i]))
	{
		ipfilters[i].compare = 0xffffffff;
	}
}
开发者ID:yquake2,项目名称:rogue,代码行数:35,代码来源:g_svcmds.c

示例8: Svcmd_RemoveIP_f

/*
=================
Svcmd_RemoveIP_f
=================
*/
void Svcmd_RemoveIP_f (void)
{
    ipFilter_t	f;
    int			i;
    char		str[MAX_TOKEN_CHARS];

    if ( trap_Argc() < 2 ) {
        G_Printf("Usage:  sv removeip <ip-mask>\n");
        return;
    }

    trap_Argv( 1, str, sizeof( str ) );

    if (!StringToFilter (str, &f))
        return;

    for (i=0 ; i<numIPFilters ; i++) {
        if (ipFilters[i].mask == f.mask	&&
                ipFilters[i].compare == f.compare) {
            ipFilters[i].compare = 0xffffffffu;
            G_Printf ("Removed.\n");

            UpdateIPBans();
            return;
        }
    }

    G_Printf ( "Didn't find %s.\n", str );
}
开发者ID:PadWorld-Entertainment,项目名称:wop-gamesource,代码行数:34,代码来源:g_svcmds.c

示例9: G_LoadIPBans

void G_LoadIPBans( void )
{//load in all the banned IPs
	int		i, len;
	char	*p, *token;
	fileHandle_t fh;
	char	banIPBuffer[MAX_IPFILTERS*32];			//	The list of file names read in
	char	banIPFile[MAX_QPATH];

	len = trap_FS_FOpenFile("banip.txt", &fh, FS_READ);
	if ( !fh )
	{
		G_Printf ( "G_LoadBanIP - ERROR: can't open banip.txt\n" );
		return;
	}
	
	trap_FS_Read(banIPBuffer, len, fh);
	banIPBuffer[len] = 0;
	trap_FS_FCloseFile(fh);
	p = banIPBuffer;
	COM_BeginParseSession(banIPFile);

	//had to change this to compile linux
	token = COM_ParseExt( (const char **) &p, qtrue );
	if ( token )
	{
		numIPFilters = atoi(token);

		for ( i = 0 ; i < numIPFilters ; i++ ) 
		{
			//had to change this to compile linux
			token = COM_ParseExt( (const char **) &p, qtrue );
			if ( token )
			{//have an ip
				if ( !Q_stricmp("unused",token) )
				{
					ipFilters[i].compare = 0xffffffffu;
				}
				else
				{
					StringToFilter(token,&ipFilters[i]);
				}
			}
			else
			{
				break;
			}
		}
	}
}
开发者ID:mehmehsomeone,项目名称:OpenRP,代码行数:49,代码来源:g_svcmds.cpp

示例10: SV_RemoveIP_f

/*
=================
SV_RemoveIP_f
=================
*/
void SV_RemoveIP_f (void)
{
	ipfilter_t	f;
	int			i, j;

	if (!StringToFilter (Cmd_Argv(1), &f))
		return;
	for (i=0 ; i<numipfilters ; i++)
		if (ipfilters[i].mask == f.mask
		&& ipfilters[i].compare == f.compare)
		{
			for (j=i+1 ; j<numipfilters ; j++)
				ipfilters[j-1] = ipfilters[j];
			numipfilters--;
			Com_Printf ("Removed.\n");
			return;
		}
	Com_Printf ("Didn't find %s.\n", Cmd_Argv(1));
}
开发者ID:matatk,项目名称:agrip,代码行数:24,代码来源:sv_main.c

示例11: AddIP

/*
=================
AddIP
=================
*/
static void AddIP( char *str ) {
	int i;

	for ( i=0; i<numIPFilters; i++ ) {
		if ( ipFilters[i].compare == 0xFFFFFFFFu )
			break; // free spot
	}
	if ( i == numIPFilters ) {
		if ( numIPFilters == MAX_IPFILTERS ) {
			trap->Print( "IP filter list is full\n" );
			return;
		}
		numIPFilters++;
	}

	if ( !StringToFilter( str, &ipFilters[i] ) )
		ipFilters[i].compare = 0xFFFFFFFFu;

	UpdateIPBans();
}
开发者ID:Yberion,项目名称:stats_mod,代码行数:25,代码来源:g_svcmds.c

示例12: SV_AddIP_f

/*
=================
SV_AddIP_f
=================
*/
void SV_AddIP_f (void)
{
	int		i;
	
	for (i=0 ; i<numipfilters ; i++)
		if (ipfilters[i].compare == 0xffffffff)
			break;		// free spot
	if (i == numipfilters)
	{
		if (numipfilters == MAX_IPFILTERS)
		{
			Com_Printf ("IP filter list is full\n");
			return;
		}
		numipfilters++;
	}
	
	if (!StringToFilter (Cmd_Argv(1), &ipfilters[i]))
		ipfilters[i].compare = 0xffffffff;
}
开发者ID:matatk,项目名称:agrip,代码行数:25,代码来源:sv_main.c

示例13: AddIP

/*
=================
AddIP
=================
*/
static void AddIP( char *str ) {
	int i;

	for ( i = 0 ; i < numIPFilters ; i++ )
		if ( ipFilters[i].compare == 0xffffffff ) {
			break;
		}               // free spot
	if ( i == numIPFilters ) {
		if ( numIPFilters == MAX_IPFILTERS ) {
			G_Printf( "IP filter list is full\n" );
			return;
		}
		numIPFilters++;
	}

	if ( !StringToFilter( str, &ipFilters[i] ) ) {
		ipFilters[i].compare = 0xffffffffu;
	}

	UpdateIPBans();
}
开发者ID:Justasic,项目名称:RTCW-MP,代码行数:26,代码来源:g_svcmds.c

示例14: SVCmd_RemoveIP_f

/*
=================
SV_RemoveIP_f
=================
*/
void SVCmd_RemoveIP_f (void)
{
	ipfilter_t	f;
	int			i, j;

	if (gi.argc() < 3) {
#ifdef WITH_ACEBOT
		safe_cprintf 
#else
		gi.cprintf
#endif
		(NULL, PRINT_HIGH, "Usage:  sv removeip <ip-mask>\n");
		return;
	}

	if (!StringToFilter (gi.argv(2), &f))
		return;

	for (i=0 ; i<numipfilters ; i++)
		if (ipfilters[i].mask == f.mask
		&& ipfilters[i].compare == f.compare)
		{
			for (j=i+1 ; j<numipfilters ; j++)
				ipfilters[j-1] = ipfilters[j];
			numipfilters--;
#ifdef WITH_ACEBOT
		safe_cprintf 
#else
		gi.cprintf
#endif
			 (NULL, PRINT_HIGH, "Removed.\n");
			return;
		}
#ifdef WITH_ACEBOT
		safe_cprintf 
#else
		gi.cprintf
#endif
	 (NULL, PRINT_HIGH, "Didn't find %s.\n", gi.argv(2));
}
开发者ID:ZwS,项目名称:qudos,代码行数:45,代码来源:g_svcmds.c

示例15: SVCmd_RemoveIP_f

/**
 * @sa SVCmd_AddIP_f
 */
static void SVCmd_RemoveIP_f (void)
{
	if (gi.Cmd_Argc() < 3) {
		gi.DPrintf("Usage: %s <ip-mask>\n", gi.Cmd_Argv(1));
		return;
	}

	ipfilter_t f;

	if (!StringToFilter(gi.Cmd_Argv(2), &f))
		return;

	for (int i = 0; i < numipfilters; i++)
		if (ipfilters[i].mask == f.mask && ipfilters[i].compare == f.compare) {
			for (int j = i + 1; j < numipfilters; j++)
				ipfilters[j - 1] = ipfilters[j];
			numipfilters--;
			gi.DPrintf("Removed.\n");
			return;
		}
	gi.DPrintf("Didn't find %s.\n", gi.Cmd_Argv(2));
}
开发者ID:ArkyRomania,项目名称:ufoai,代码行数:25,代码来源:g_svcmds.cpp


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