varconf  1.0.2
dyntypes.h
1 /*
2  * dyntypes.h - interface for dynamically derived value container class types
3  * Copyright (C) 2001, Ron Steinke
4  * (C) 2001-2005 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_DYNTYPES_H
28 #define VARCONF_DYNTYPES_H
29 
30 #include <varconf/variable.h>
31 #include <varconf/dynbase.h>
32 
33 #include <string>
34 
35 namespace varconf {
36 namespace dynvar {
37 
38 class Concat : public Base {
39 public:
40  Concat() : Base(), m_v1(0), m_v2(0) {}
41  Concat(const Variable& one, const Variable& two) : Base(), m_v1(one), m_v2(two) {}
42  Concat(const Concat& c) : Base(c), m_v1(c.m_v1), m_v2(c.m_v2) {}
43 
44  virtual ~Concat();
45 
46  Concat& operator=(const Concat& c);
47 
48 protected:
49 
50  virtual void set_val();
51 
52 private:
53 
54  Variable m_v1, m_v2;
55 };
56 
57 class Ternary : public Base {
58 public:
59  Ternary() : Base(), m_test(0), m_true(0), m_false(0) {}
60  Ternary(const Variable& test, const Variable& true_val, const Variable& false_val)
61  : Base(), m_test(test), m_true(true_val), m_false(false_val) {}
62  Ternary(const Ternary& t) : Base(t), m_test(t.m_test), m_true(t.m_true),
63  m_false(t.m_false) {}
64 
65  virtual ~Ternary();
66 
67  Ternary& operator=(const Ternary& t);
68 
69 protected:
70 
71  virtual void set_val();
72 
73 private:
74 
75  Variable m_test, m_true, m_false;
76 };
77 
78 class Item : public Base {
79 public:
80  Item() : Base(), m_section(""), m_key("") {}
81  Item(const Item& d) : Base(d), m_section(d.m_section), m_key(d.m_key) {}
82  Item(const std::string section, const std::string key)
83  : Base(), m_section(section), m_key(key) {}
84 
85  virtual ~Item();
86 
87  Item& operator=(const Item & i);
88 
89  void assign(const Variable & v, Scope scope);
90 
91 protected:
92 
93  virtual void set_val();
94 
95 private:
96 
97  std::string m_section, m_key;
98 
99 };
100 
101 }} // namespace varconf::dynvar
102 
103 #endif
Definition: dyntypes.h:57
Definition: variable.h:149
Definition: dynbase.h:37
Definition: dyntypes.h:38
Definition: config.cpp:96
Definition: dyntypes.h:78