ScummVM API documentation
systemVariable.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef SYSTEM_VARIABLE_H
23#define SYSTEM_VARIABLE_H
24
25#include "common/scummsys.h"
26#include "common/str.h"
27
28namespace Common {
29class ReadStream;
30class WriteStream;
31} // namespace Common
32
33namespace AGDS {
34
36public:
37 virtual ~SystemVariable() {}
38
39 virtual const Common::String &getString() const = 0;
40 virtual int getInteger() const = 0;
41 virtual void setString(const Common::String &value) = 0;
42 virtual void setInteger(int value) = 0;
43 virtual void reset() = 0;
44 virtual void read(Common::ReadStream &stream) = 0;
45 virtual void write(Common::WriteStream &stream) const = 0;
46};
47
49 int _value;
50 int _defaultValue;
51
52public:
53 IntegerSystemVariable(int defaultValue = 0) : _value(defaultValue), _defaultValue(defaultValue) {
54 }
55
56 virtual const Common::String &getString() const;
57 virtual int getInteger() const;
58 virtual void setString(const Common::String &value);
59 virtual void setInteger(int value);
60 virtual void reset() {
61 _value = _defaultValue;
62 }
63 virtual void read(Common::ReadStream &stream);
64 virtual void write(Common::WriteStream &stream) const;
65};
66
68 Common::String _value;
69 Common::String _defaultValue;
70
71public:
72 StringSystemVariable(const Common::String &defaultValue = Common::String()) : _value(defaultValue), _defaultValue(defaultValue) {
73 }
74 virtual const Common::String &getString() const;
75 virtual int getInteger() const;
76 virtual void setString(const Common::String &value);
77 virtual void setInteger(int value);
78 virtual void reset() {
79 _value = _defaultValue;
80 }
81 virtual void read(Common::ReadStream &stream);
82 virtual void write(Common::WriteStream &stream) const;
83};
84
85} // End of namespace AGDS
86
87#endif /* AGDS_SYSTEM_VARIABLE_H */
Definition: systemVariable.h:48
Definition: systemVariable.h:67
Definition: systemVariable.h:35
Definition: stream.h:385
Definition: str.h:59
Definition: stream.h:77
Definition: algorithm.h:29