Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
blob: 8ad0fa1e7272c20ee312f9fa95684e03619fb1c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
   core/cvar.h
   This file is part of the Osirion project and is distributed under 
   the terms of the GNU General Public License version 2 
*/

#ifndef __INCLUDED_CORE_CVAR_H__
#define __INCLUDED_CORE_CVAR_H__

#include <string>

namespace core {

/// Don't use - need a decent cvar
class Cvar_t {
public:
	Cvar_t(unsigned int cvarflags = 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);

private:
	std::string cvar_value;
	unsigned int cvar_flags;
};

/// general cvar type
typedef Cvar_t *Cvar;

/// Don't use - need a decent cvar
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
void unset(const char *cvarname);

/// delete a cvar
void unset(const std::string &cvarname);

/// search for a named cvar, returns 0 if not found
Cvar find(const std::string &cvarname);

/// search for a named cvar, returns 0 if not found
Cvar find(const char *cvarname);

} // namespace cvar

} // namespace core

#endif // __INCLUDED_CORE_CVAR_H__