home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2006 March / Gamestar_82_2006-03_dvd.iso / DVDStar / Editace / quake4_sdkv10.exe / source / idlib / LangDict.h < prev    next >
C/C++ Source or Header  |  2005-11-14  |  1KB  |  51 lines

  1.  
  2. #ifndef __LANGDICT_H__
  3. #define __LANGDICT_H__
  4.  
  5. /*
  6. ===============================================================================
  7.  
  8.     Simple dictionary specifically for the localized string tables.
  9.  
  10. ===============================================================================
  11. */
  12.  
  13. class idLangKeyValue {
  14. public:
  15.     idStr                    key;
  16.     idStr                    value;
  17. };
  18.  
  19. class idLangDict {
  20. public:
  21.                             idLangDict( void );
  22.                             ~idLangDict( void );
  23.  
  24.     void                    Clear( void );
  25.     bool                    Load( const char *fileName, bool clear = true );
  26.     void                    Save( const char *fileName );
  27.  
  28.     const char *            AddString( const char *str );
  29.     const char *            GetString( const char *str ) const;
  30.  
  31.                             // adds the value and key as passed (doesn't generate a "#str_xxxxxx" key or ensure the key/value pair is unique)
  32.     void                    AddKeyVal( const char *key, const char *val );
  33.  
  34.     int                        GetNumKeyVals( void ) const;
  35.     const idLangKeyValue *    GetKeyVal( int i ) const;
  36.  
  37.     void                    SetBaseID(int id) { baseID = id; };
  38.  
  39. private:
  40.     idList<idLangKeyValue>    args;
  41.     idHashIndex                hash;
  42.  
  43.     bool                    ExcludeString( const char *str ) const;
  44.     int                        GetNextId( void ) const;
  45.     int                        GetHashKey( const char *str ) const;
  46.  
  47.     int                        baseID;
  48. };
  49.  
  50. #endif /* !__LANGDICT_H__ */
  51.