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

  1. #include "precompiled.h"
  2. #pragma hdrstop
  3. #include "LexerFactory.h"
  4.  
  5. LexerFactory::~LexerFactory()
  6. {
  7. }
  8.  
  9. Lexer *LexerFactory::MakeLexer(char const * const filename, int flags, bool OSPath)
  10. {
  11.     return new Lexer(filename, flags | GetReadBinary() | GetWriteBinary(), OSPath);
  12. }
  13.  
  14. Lexer *LexerFactory::MakeLexer(int flags)
  15. {
  16.     return new Lexer(flags | GetReadBinary() | GetWriteBinary());
  17. }
  18.  
  19. Lexer *LexerFactory::MakeLexer( char const * const ptr, int length, char const * const name, int flags)
  20. {
  21.     return new Lexer(ptr, length, name, flags | GetWriteBinary() | GetReadBinary());
  22. }
  23.  
  24. int LexerFactory::GetReadBinary() 
  25.     if(cvarSystem->GetCVarBool("com_binaryRead")) 
  26.     {
  27.         return LEXFL_READBINARY; 
  28.     }
  29.     else 
  30.     {
  31.         return 0; 
  32.     }
  33. }
  34.  
  35. int LexerFactory::GetWriteBinary() 
  36.     int ret=0;
  37.     int writeBinary = cvarSystem->GetCVarInteger("com_binaryWrite");
  38.     switch(writeBinary)
  39.     {
  40.     case 0:
  41.         break;
  42.     case 1:
  43.         ret = LEXFL_WRITEBINARY;
  44.         break;
  45.     case 2:
  46.         ret = LEXFL_WRITEBINARY | LEXFL_BYTESWAP;
  47.         break;
  48.     }
  49.  
  50.     return ret;
  51. }
  52.