doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RegExp.h
Go to the documentation of this file.
1 /*
2 ===========================================================================
3 
4 Doom 3 GPL Source Code
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
6 
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
8 
9 Doom 3 Source Code is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13 
14 Doom 3 Source Code is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
21 
22 In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
23 
24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
25 
26 ===========================================================================
27 */
28 
29 #ifndef __REGEXP_H__
30 #define __REGEXP_H__
31 
32 class idWindow;
33 class idWinVar;
34 
35 class idRegister {
36 public:
37  idRegister();
38  idRegister( const char *p, int t );
39 
41  static int REGCOUNT[NUMTYPES];
42 
43  bool enabled;
44  short type;
46  int regCount;
47  unsigned short regs[4];
49 
50  void SetToRegs( float *registers );
51  void GetFromRegs( float *registers );
52  void CopyRegs( idRegister *src );
53  void Enable( bool b ) { enabled = b; }
54  void ReadFromDemoFile( idDemoFile *f );
55  void WriteToDemoFile( idDemoFile *f );
56  void WriteToSaveGame( idFile *savefile );
57  void ReadFromSaveGame( idFile *savefile );
58 };
59 
60 ID_INLINE idRegister::idRegister( void ) {
61 }
62 
63 ID_INLINE idRegister::idRegister( const char *p, int t ) {
64  name = p;
65  type = t;
66  assert( t >= 0 && t < NUMTYPES );
67  regCount = REGCOUNT[t];
68  enabled = ( type == STRING ) ? false : true;
69  var = NULL;
70 };
71 
72 ID_INLINE void idRegister::CopyRegs( idRegister *src ) {
73  regs[0] = src->regs[0];
74  regs[1] = src->regs[1];
75  regs[2] = src->regs[2];
76  regs[3] = src->regs[3];
77 }
78 
80 public:
81 
84 
85  void AddReg( const char *name, int type, idParser *src, idWindow *win, idWinVar *var );
86  void AddReg( const char *name, int type, idVec4 data, idWindow *win, idWinVar *var );
87 
88  idRegister * FindReg( const char *name );
89  void SetToRegs( float *registers );
90  void GetFromRegs( float *registers );
91  void Reset();
92  void ReadFromDemoFile( idDemoFile *f );
93  void WriteToDemoFile( idDemoFile *f );
94  void WriteToSaveGame( idFile *savefile );
95  void ReadFromSaveGame( idFile *savefile );
96 
97 private:
100 };
101 
103  regs.SetGranularity( 4 );
104  regHash.SetGranularity( 4 );
105  regHash.Clear( 32, 4 );
106 }
107 
109 }
110 
111 #endif /* !__REGEXP_H__ */
void ReadFromDemoFile(idDemoFile *f)
Definition: RegExp.cpp:348
void ReadFromDemoFile(idDemoFile *f)
Definition: RegExp.cpp:162
assert(prefInfo.fullscreenBtn)
unsigned short regs[4]
Definition: RegExp.h:47
void GetFromRegs(float *registers)
Definition: RegExp.cpp:299
void GetFromRegs(float *registers)
Definition: RegExp.cpp:105
void SetGranularity(int newgranularity)
Definition: List.h:305
void WriteToSaveGame(idFile *savefile)
Definition: RegExp.cpp:190
void Enable(bool b)
Definition: RegExp.h:53
idStr name
Definition: RegExp.h:45
GLuint GLuint GLsizei GLenum type
Definition: glext.h:2845
GLuint src
Definition: glext.h:5390
idRegister()
Definition: RegExp.h:60
void SetGranularity(const int newGranularity)
Definition: HashIndex.h:369
void AddReg(const char *name, int type, idParser *src, idWindow *win, idWinVar *var)
Definition: RegExp.cpp:249
idList< idRegister * > regs
Definition: RegExp.h:98
void ReadFromSaveGame(idFile *savefile)
Definition: RegExp.cpp:395
Definition: File.h:50
idRegister * FindReg(const char *name)
Definition: RegExp.cpp:323
Definition: Vector.h:808
void WriteToDemoFile(idDemoFile *f)
Definition: RegExp.cpp:365
void SetToRegs(float *registers)
Definition: RegExp.cpp:44
void Reset()
Definition: RegExp.cpp:338
#define NULL
Definition: Lib.h:88
idRegisterList()
Definition: RegExp.h:102
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: glext.h:2853
void ReadFromSaveGame(idFile *savefile)
Definition: RegExp.cpp:210
idWinVar * var
Definition: RegExp.h:48
GLubyte GLubyte b
Definition: glext.h:4662
void WriteToSaveGame(idFile *savefile)
Definition: RegExp.cpp:379
void SetToRegs(float *registers)
Definition: RegExp.cpp:311
void CopyRegs(idRegister *src)
Definition: RegExp.h:72
tuple f
Definition: idal.py:89
bool enabled
Definition: RegExp.h:43
const GLcharARB * name
Definition: glext.h:3629
static int REGCOUNT[NUMTYPES]
Definition: RegExp.h:41
Definition: Str.h:116
Window win
Definition: glimp.cpp:46
void Clear(void)
Definition: HashIndex.h:328
int regCount
Definition: RegExp.h:46
short type
Definition: RegExp.h:44
GLfloat GLfloat p
Definition: glext.h:4674
~idRegisterList()
Definition: RegExp.h:108
idHashIndex regHash
Definition: RegExp.h:99
GLdouble GLdouble t
Definition: glext.h:2943
void WriteToDemoFile(idDemoFile *f)
Definition: RegExp.cpp:176