varconf 1.0.3
Configuration library for the Worldforge system.
dynbase.h
1/*
2 * dynbase.h - interface for dynamically derived value container class
3 * Copyright (C) 2001, Ron Steinke
4 * (C) 2003-2004 Alistair Riddoch
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 * Contact: Joseph Zupko
21 * jaz147@psu.edu
22 *
23 * 189 Reese St.
24 * Old Forge, PA 18518
25 */
26
27#ifndef VARCONF_DYNBASE_H
28#define VARCONF_DYNBASE_H
29
30#include "variable.h"
31
32#include <string>
33
34namespace varconf {
35namespace dynvar {
36
37class Base : public VarBase {
38public:
39 Base() : VarBase(), m_looping(false) {}
40 // Don't copy m_looping
41 Base(const Base& d) : sigc::trackable(d), VarBase(d), m_looping(false) {}
42
43 ~Base() override;
44
45 Base& operator= (const Base& b);
46
47 // Don't call the const versions of these functions
48 // for VarBase
49
50private: // Does making these private do anything?
51 friend std::ostream& operator<<(std::ostream& out, const Base& v);
52 friend bool operator ==(const Base& one, const VarBase& two);
53 friend bool operator ==(const VarBase& one, const Base& two);
54 friend bool operator ==(const Base& one, const Base& two);
55public:
56
57 // The real versions
58
59 friend std::ostream& operator<<(std::ostream& out, Base& v);
60 friend bool operator ==(Base& one, const VarBase& two);
61 friend bool operator ==(const VarBase& one, Base& two);
62 friend bool operator ==(Base& one, Base& two);
63
64 friend bool operator ==(Base& one, const VarArray& two) {return false;}
65 friend bool operator ==(const VarArray& one, Base& two) {return false;}
66
67 virtual operator bool();
68 virtual operator int();
69 virtual operator double();
70 virtual operator std::string();
71
72 bool is_bool() override;
73 bool is_int() override;
74 bool is_double() override;
75 bool is_string() override;
76
77protected:
78
79 virtual void set_val() = 0;
80
81private:
82
83 void call_set_val();
84
85 bool m_looping;
86};
87
88}} // namespace varconf::dynvar
89
90#endif