diff options
author | Stijn Buys <ingar@osirion.org> | 2008-02-05 20:44:36 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-02-05 20:44:36 +0000 |
commit | a51deebd87036ceb87c77a20117977d077b771e3 (patch) | |
tree | 71217d051fe77b562cd92508fe9edb3da6b7cc7a /src/core/cvar.h | |
parent | 8ee5d47d7e1336eb69064ca31e27bbfa7d86b51e (diff) |
fixed cvar, added cvars r_width r_height r_fullscreen, added function r_restart
Diffstat (limited to 'src/core/cvar.h')
-rw-r--r-- | src/core/cvar.h | 62 |
1 files changed, 43 insertions, 19 deletions
diff --git a/src/core/cvar.h b/src/core/cvar.h index 8ad0fa1..fa04c49 100644 --- a/src/core/cvar.h +++ b/src/core/cvar.h @@ -11,40 +11,61 @@ namespace core { -/// Don't use - need a decent cvar +/// the cvar container class class Cvar_t { public: - Cvar_t(unsigned int cvarflags = 0); + Cvar_t(unsigned int cvflags = 0); - inline const std::string &value() const {return cvar_value; } - inline unsigned int flags() const { return cvar_flags; } - - Cvar_t &operator=(const char *cvarvalue); - Cvar_t &operator=(const std::string &cvarvalue); - Cvar_t &operator=(int cvarvalue); + Cvar_t &operator=(const char *other); + Cvar_t &operator=(const std::string &other); + Cvar_t &operator=(int other); + Cvar_t &operator=(float other); + inline unsigned int flags() const { return cvar_flags; } + inline float value() const { return(cvar_value); } + const std::string &text() const { return(cvar_text); } + private: - std::string cvar_value; - unsigned int cvar_flags; + std::string cvar_text; + float cvar_value; + unsigned int cvar_flags; }; /// general cvar type typedef Cvar_t *Cvar; -/// Don't use - need a decent cvar +/// the cvar registry namespace cvar { -/// create a new cvar containing a string value -Cvar set(const char *cvarname, const char *cvarvalue, int cvarflags=0); - -/// create a new cvar containing an integer value -Cvar set(const char *cvarname, int cvarvalue, int cvarflags=0); - -/// delete a cvar +/// get a cvar value from the registry +/** If the a cvar with the given name already exists in the registry, + * its value will not be changed. If the cvar does not exist, + * it will be created + */ +Cvar get(const char *name, const char *value, int flags=0); +/// get a cvar value from the registry +/** If the a cvar with the given name already exists in the registry, + * its value will not be changed. If the cvar does not exist, + * it will be created + */ +Cvar get(const char *name, int value, int flags=0); + +/// set a cvar value +/** If the a cvar with the given name already exists in the registry, + * its value will be replaced + */ +Cvar set(const char *name, const char *value, int flags=0); +/// set a cvar value +/** If the a cvar with the given name already exists in the registry, + * its value will be replaced + */ +Cvar set(const char *name, int value, int flags=0); + +/// delete a cvar from the registry void unset(const char *cvarname); -/// delete a cvar +/// delete a cvar from the registry void unset(const std::string &cvarname); /// search for a named cvar, returns 0 if not found @@ -53,6 +74,9 @@ Cvar find(const std::string &cvarname); /// search for a named cvar, returns 0 if not found Cvar find(const char *cvarname); +/// list the cvar registry +void list(); + } // namespace cvar } // namespace core |