infostring.c File Reference

Info string handling. More...

#include "../common/common.h"
#include "infostring.h"
Include dependency graph for infostring.c:

Go to the source code of this file.

Functions

const char * Info_ValueForKey (const char *s, const char *key)
 Searches the string for the given key and returns the associated value, or an empty string.
const char * Info_BoolForKey (const char *s, const char *key)
int Info_IntegerForKey (const char *s, const char *key)
void Info_RemoveKey (char *s, const char *key)
 Searches through s for key and remove is.
qboolean Info_Validate (const char *s)
 Some characters are illegal in info strings because they can mess up the server's parsing.
void Info_SetValueForKeyAsInteger (char *s, const size_t size, const char *key, const int value)
void Info_SetValueForKey (char *s, const size_t size, const char *key, const char *value)
 Adds a new entry into string with given value.
void Info_Print (const char *s)
 Prints info strings (like userinfo or serverinfo - CVAR_USERINFO, CVAR_SERVERINFO).

Detailed Description

Info string handling.

Definition in file infostring.c.


Function Documentation

const char* Info_BoolForKey ( const char *  s,
const char *  key 
)

Definition at line 77 of file infostring.c.

References Info_ValueForKey().

Referenced by CL_ParseServerInfoMessage().

int Info_IntegerForKey ( const char *  s,
const char *  key 
)

Definition at line 85 of file infostring.c.

References Info_ValueForKey().

Referenced by CL_ParseTeamInfoMessage().

void Info_Print ( const char *  s  ) 

Prints info strings (like userinfo or serverinfo - CVAR_USERINFO, CVAR_SERVERINFO).

Definition at line 215 of file infostring.c.

References Com_Printf(), and key.

Referenced by CL_UserInfo_f(), SV_Serverinfo_f(), SV_ShowServerinfo_f(), and SV_UserInfo_f().

void Info_RemoveKey ( char *  s,
const char *  key 
)

Searches through s for key and remove is.

Parameters:
[in] s String to search key in
[in] key String to search for in s
See also:
Info_SetValueForKey

Definition at line 96 of file infostring.c.

Referenced by Info_SetValueForKey().

void Info_SetValueForKey ( char *  s,
const size_t  size,
const char *  key,
const char *  value 
)

Adds a new entry into string with given value.

Note:
Removed any old version of the key
Parameters:
[out] s The target info string
[in] size The size of s
[in] key The key to set
[in] value The value to set for the given key
See also:
Info_RemoveKey
Info_SetValueForKeyAsInteger

Definition at line 173 of file infostring.c.

References Com_Printf(), Com_sprintf(), Info_RemoveKey(), MAX_INFO_KEY, MAX_INFO_STRING, MAX_INFO_VALUE, Q_strcat(), Q_strncpyz(), and STRINGIFY.

Referenced by Cvar_BitInfo(), G_ClientConnect(), Info_SetValueForKeyAsInteger(), SVC_DirectConnect(), SVC_Info(), and SVC_TeamInfo().

void Info_SetValueForKeyAsInteger ( char *  s,
const size_t  size,
const char *  key,
const int  value 
)
See also:
Info_SetValueForKey

Definition at line 158 of file infostring.c.

References Info_SetValueForKey(), and va().

Referenced by G_SetTeamForPlayer(), SVC_Info(), and SVC_TeamInfo().

qboolean Info_Validate ( const char *  s  ) 

Some characters are illegal in info strings because they can mess up the server's parsing.

Definition at line 146 of file infostring.c.

References qfalse, and qtrue.

Referenced by G_ClientUserinfoChanged().

const char* Info_ValueForKey ( const char *  s,
const char *  key 
)

Searches the string for the given key and returns the associated value, or an empty string.

Parameters:
[in] s The string you want to extract the keyvalue from
[in] key The key you want to extract the value for
See also:
Info_SetValueForKey
Returns:
The value or empty string - never NULL
Todo:
Not thread safe

Definition at line 39 of file infostring.c.

References Q_strcasecmp.

Referenced by CL_ParseServerInfoMessage(), CL_ParseTeamInfoMessage(), CL_ProcessPingReply(), G_ClientConnect(), G_ClientGetTeamNumPref(), G_ClientUserinfoChanged(), Info_BoolForKey(), Info_IntegerForKey(), SV_UserinfoChanged(), and SVC_DirectConnect().


Generated by  doxygen 1.6.2