doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RegistryOptions.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 REGISTRYOPTIONS_H_
30 #define REGISTRYOPTIONS_H_
31 
33 {
34 public:
35 
36  static const int MAX_MRU_SIZE = 4;
37 
39 
40  void Init( const char *key );
41 
42  // Write the options to the registery
43  bool Save ( void );
44 
45  // Read the options from the registry
46  bool Load ( void );
47 
48  // Window placement routines
49  void SetWindowPlacement ( const char* name, HWND hwnd );
50  bool GetWindowPlacement ( const char* name, HWND hwnd );
51 
52  // List view column sizes
53  void SetColumnWidths ( const char* name, HWND list );
54  void GetColumnWidths ( const char* name, HWND list );
55 
56  // Set routines
57  void SetFloat ( const char* name, float v );
58  void SetLong ( const char* name, long v );
59  void SetBool ( const char* name, bool v );
60  void SetString ( const char* name, const char* v );
61  void SetVec4 ( const char* name, idVec4& v );
62  void SetBinary ( const char* name, const unsigned char* data, int size );
63 
64  // Get routines
65  float GetFloat ( const char* name );
66  long GetLong ( const char* name );
67  bool GetBool ( const char* name );
68  const char* GetString ( const char* name );
69  idVec4 GetVec4 ( const char* name );
70  void GetBinary ( const char* name, unsigned char* data, int size );
71 
72  // MRU related methods
73  void AddRecentFile ( const char* filename );
74  const char* GetRecentFile ( int index );
75  int GetRecentFileCount ( void );
76 
77 private:
78 
82 };
83 
84 ID_INLINE void rvRegistryOptions::SetFloat ( const char* name, float v )
85 {
86  mValues.SetFloat ( name, v );
87 }
88 
89 ID_INLINE void rvRegistryOptions::SetLong ( const char* name, long v )
90 {
91  mValues.SetInt ( name, v );
92 }
93 
94 ID_INLINE void rvRegistryOptions::SetBool ( const char* name, bool v )
95 {
96  mValues.SetBool ( name, v );
97 }
98 
99 ID_INLINE void rvRegistryOptions::SetString ( const char* name, const char* v )
100 {
101  mValues.Set ( name, v );
102 }
103 
104 ID_INLINE void rvRegistryOptions::SetVec4 ( const char* name, idVec4& v )
105 {
106  mValues.SetVec4 ( name, v );
107 }
108 
109 ID_INLINE float rvRegistryOptions::GetFloat ( const char* name )
110 {
111  return mValues.GetFloat ( name );
112 }
113 
114 ID_INLINE long rvRegistryOptions::GetLong ( const char* name )
115 {
116  return mValues.GetInt ( name );
117 }
118 
119 ID_INLINE bool rvRegistryOptions::GetBool ( const char* name )
120 {
121  return mValues.GetBool ( name );
122 }
123 
124 ID_INLINE const char* rvRegistryOptions::GetString ( const char* name )
125 {
126  return mValues.GetString ( name );
127 }
128 
129 ID_INLINE idVec4 rvRegistryOptions::GetVec4 ( const char* name )
130 {
131  return mValues.GetVec4 ( name );
132 }
133 
135 {
136  return mRecentFiles.Num ( );
137 }
138 
139 ID_INLINE const char* rvRegistryOptions::GetRecentFile ( int index )
140 {
141  return mRecentFiles[index].c_str ( );
142 }
143 
144 #endif // REGISTRYOPTIONS_H_
void SetString(const char *name, const char *v)
void SetLong(const char *name, long v)
float GetFloat(const char *key, const char *defaultString="0") const
Definition: Dict.h:248
bool GetWindowPlacement(const char *name, HWND hwnd)
int GetInt(const char *key, const char *defaultString="0") const
Definition: Dict.h:252
void SetColumnWidths(const char *name, HWND list)
void Init(const char *key)
const GLdouble * v
Definition: glext.h:2936
void SetVec4(const char *name, idVec4 &v)
idVec4 GetVec4(const char *name)
void SetBinary(const char *name, const unsigned char *data, int size)
void Set(const char *key, const char *value)
Definition: Dict.cpp:275
void SetFloat(const char *key, float val)
Definition: Dict.h:188
float GetFloat(const char *name)
GLuint index
Definition: glext.h:3476
const char * GetString(const char *key, const char *defaultString="") const
Definition: Dict.h:240
Definition: Vector.h:808
idVec4 GetVec4(const char *key, const char *defaultString=NULL) const
Definition: Dict.h:272
bool GetBool(const char *key, const char *defaultString="0") const
Definition: Dict.h:256
Definition: Dict.h:65
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: glext.h:2853
void SetBool(const char *name, bool v)
void GetColumnWidths(const char *name, HWND list)
void SetBool(const char *key, bool val)
Definition: Dict.h:196
void SetWindowPlacement(const char *name, HWND hwnd)
static const int MAX_MRU_SIZE
void SetInt(const char *key, int val)
Definition: Dict.h:192
void AddRecentFile(const char *filename)
int Num(void) const
Definition: List.h:265
bool GetBool(const char *name)
const GLcharARB * name
Definition: glext.h:3629
GLsizeiptr size
Definition: glext.h:3112
Definition: Str.h:116
void GetBinary(const char *name, unsigned char *data, int size)
int GetRecentFileCount(void)
const char * GetRecentFile(int index)
void SetVec4(const char *key, const idVec4 &val)
Definition: Dict.h:204
long GetLong(const char *name)
idList< idStr > mRecentFiles
void SetFloat(const char *name, float v)
const char * GetString(const char *name)