46 if (
this == &other ) {
55 for ( i = 0; i <
args.
Num(); i++ ) {
75 if (
this == &other ) {
82 found = (
int *) _alloca16( other.
args.
Num() *
sizeof(
int ) );
83 for ( i = 0; i <
n; i++ ) {
90 for ( i = 0; i <
n; i++ ) {
91 if ( found && found[i] != -1 ) {
114 if (
this == &other ) {
119 common->
FatalError(
"idDict::TransferKeyValues: can't transfer values across a DLL boundary" );
127 for ( i = 0; i <
n; i++ ) {
153 parser.
Error(
"Expected quoted string, but found '%s'", token.
c_str() );
157 parser.
Error(
"Unexpected end of file" );
161 parser.
Warning(
"'%s' already defined", token.
c_str() );
164 Set( token, token2 );
167 parser.
Error(
"Unexpected end of file" );
185 for( i = 0; i <
n; i++ ) {
186 def = &dict->
args[
i];
204 for( i = 0; i <
args.
Num(); i++ ) {
223 for( i = 0; i <
n; i++ ) {
245 for( i = 0; i <
n; i++ ) {
263 for( i = 0; i <
args.
Num(); i++ ) {
279 if ( key ==
NULL || key[0] ==
'\0' ) {
305 found =
GetString( key, defaultString, &s );
315 bool idDict::GetInt(
const char *key,
const char *defaultString,
int &out )
const {
319 found =
GetString( key, defaultString, &s );
333 found =
GetString( key, defaultString, &s );
334 out = ( atoi( s ) != 0 );
347 if ( !defaultString ) {
348 defaultString =
"0 0 0";
351 found =
GetString( key, defaultString, &s );
353 sscanf( s,
"%f %f %f", &out.
pitch, &out.
yaw, &out.
roll );
366 if ( !defaultString ) {
367 defaultString =
"0 0 0";
370 found =
GetString( key, defaultString, &s );
372 sscanf( s,
"%f %f %f", &out.
x, &out.
y, &out.
z );
385 if ( !defaultString ) {
386 defaultString =
"0 0";
389 found =
GetString( key, defaultString, &s );
391 sscanf( s,
"%f %f", &out.
x, &out.
y );
404 if ( !defaultString ) {
405 defaultString =
"0 0 0 0";
408 found =
GetString( key, defaultString, &s );
410 sscanf( s,
"%f %f %f %f", &out.
x, &out.
y, &out.
z, &out.
w );
423 if ( !defaultString ) {
424 defaultString =
"1 0 0 0 1 0 0 0 1";
427 found =
GetString( key, defaultString, &s );
429 sscanf( s,
"%f %f %f %f %f %f %f %f %f", &out[0].
x, &out[0].
y, &out[0].
z, &out[1].x, &out[1].y, &out[1].z, &out[2].x, &out[2].y, &out[2].z );
438 static void WriteString(
const char *
s,
idFile *
f ) {
439 int len = strlen( s );
443 f->
Write( s, strlen(s) + 1 );
454 if ( key ==
NULL || key[0] ==
'\0' ) {
461 if (
args[i].GetKey().Icmp( key ) == 0 ) {
476 if ( key ==
NULL || key[0] ==
'\0' ) {
483 if (
args[
i].GetKey().Icmp( key ) == 0 ) {
501 if (
args[i].GetKey().Icmp( key ) == 0 ) {
512 for ( i = 0; i <
args.
Num(); i++ ) {
529 len = strlen( prefix );
540 for( i = start + 1; i <
args.
Num(); i++ ) {
541 if ( !
args[i].GetKey().Icmpn( prefix, len ) ) {
555 const int MAX_RANDOM_KEYS = 2048;
556 const char *list[MAX_RANDOM_KEYS];
560 for ( count = 0, kv =
MatchPrefix( prefix ); kv && count < MAX_RANDOM_KEYS; kv =
MatchPrefix( prefix, kv ) ) {
573 f->
Write( &c,
sizeof( c ) );
575 WriteString(
args[
i].GetKey().c_str(), f );
576 WriteString(
args[
i].GetValue().c_str(), f );
590 f->
Read( (
void *)&str[len], 1 );
591 if ( str[len] == 0 ) {
595 if ( len == MAX_STRING_CHARS ) {
613 f->
Read( &c,
sizeof( c ) );
615 for (
int i = 0;
i <
c;
i++ ) {
616 key = ReadString( f );
617 val = ReadString( f );
660 return (*a)->Icmp( **b );
676 for ( i = 0; i < keyStrings.
Num(); i++ ) {
695 for ( i = 0; i < valueStrings.
Num(); i++ ) {
void Error(const char *str,...) const id_attribute((format(printf
float GetFloat(const char *key, const char *defaultString="0") const
GLsizei const GLfloat * value
int GetInt(const char *key, const char *defaultString="0") const
void TransferKeyValues(idDict &other)
assert(prefInfo.fullscreenBtn)
int Cmp(const char *text) const
void Delete(const char *key)
int Next(const int index) const
const idStr & GetKey(void) const
static void ListKeys_f(const idCmdArgs &args)
void SetNum(int newnum, bool resize=true)
static idStrPool globalValues
idAngles GetAngles(const char *key, const char *defaultString=NULL) const
int FindKeyIndex(const char *key) const
const idKeyValue * MatchPrefix(const char *prefix, const idKeyValue *lastMatch=NULL) const
void WriteToFileHandle(idFile *f) const
idVec2 GetVec2(const char *key, const char *defaultString=NULL) const
int ExpectTokenString(const char *string)
void RemoveIndex(const int key, const int index)
void Set(const char *key, const char *value)
void CRC32_InitChecksum(unsigned long &crcvalue)
void Copy(const idDict &other)
int First(const int key) const
void ReadFromFileHandle(idFile *f)
int ReadToken(idToken *token)
void FreeString(const idPoolStr *poolStr)
void Sort(cmp_t *compare=(cmp_t *)&idListSortCompare< type >)
GLuint GLuint GLsizei count
ID_INLINE int idListSortCompare(const idPoolStr *const *a, const idPoolStr *const *b)
idList< idKeyValue > args
static void ListValues_f(const idCmdArgs &args)
const char * GetString(const char *key, const char *defaultString="") const
void SetDefaults(const idDict *dict)
int KeyCompare(const idKeyValue *a, const idKeyValue *b)
idVec4 GetVec4(const char *key, const char *defaultString=NULL) const
virtual void virtual void virtual void DWarning(const char *fmt,...) id_attribute((format(printf
bool GetBool(const char *key, const char *defaultString="0") const
idVec3 GetVector(const char *key, const char *defaultString=NULL) const
virtual void virtual void FatalError(const char *fmt,...) id_attribute((format(printf
virtual int Read(void *buffer, int len)
bool Parse(idParser &parser)
void void Warning(const char *str,...) const id_attribute((format(printf
size_t Allocated(void) const
static void ShowMemoryUsage_f(const idCmdArgs &args)
const idStr & GetValue(void) const
size_t Allocated(void) const
void CRC32_UpdateChecksum(unsigned long &crcvalue, const void *data, int length)
const idKeyValue * FindKey(const char *key) const
GLubyte GLubyte GLubyte a
virtual void Printf(const char *fmt,...) id_attribute((format(printf
static idStrPool globalKeys
const idPoolStr * AllocString(const char *string)
int GenerateKey(const char *string, bool caseSensitive=true) const
int Append(const type &obj)
void CRC32_FinishChecksum(unsigned long &crcvalue)
bool RemoveIndex(int index)
const char * RandomPrefix(const char *prefix, idRandom &random) const
virtual int Write(const void *buffer, int len)
const char * c_str(void) const
const idPoolStr * CopyString(const idPoolStr *poolStr)
int FindIndex(const type &obj) const
void Add(const int key, const int index)
static void Shutdown(void)
void SetCaseSensitive(bool caseSensitive)
idMat3 GetMatrix(const char *key, const char *defaultString=NULL) const
virtual void Error(const char *fmt,...) id_attribute((format(printf
size_t Allocated(void) const
idDict & operator=(const idDict &other)
static class idCommon * common