blob: 8b3f7a426e69467a2430fe88a79e384eaaf3a5ea (
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
|
#ifndef VARIABLES_H
#define VARIABLES_H
#include <boost/intrusive_ptr.hpp>
#include <boost/optional.hpp>
#include <stdint.h>
#include <glibmm/ustring.h>
#include <libxml++/nodes/element.h>
#include <libxml++/attribute.h>
#include "intrusivePtrBase.h"
#include <boost/variant.hpp>
class RowUser;
typedef boost::variant<Glib::ustring, unsigned int, long int> VariableType;
class VariableImpl : public virtual IntrusivePtrBase {
public:
virtual const Glib::ustring & value() const = 0;
protected:
VariableImpl(const Glib::ustring & src);
virtual ~VariableImpl() = 0;
const Glib::ustring source;
Glib::ustring name;
boost::optional<Glib::ustring> defaultValue;
};
class Variable {
public:
typedef boost::intrusive_ptr<VariableImpl> VariableImplPtr;
Variable(const xmlpp::Attribute *);
Variable(const xmlpp::Element *);
Variable(const Glib::ustring & s);
static Variable makeParent(const Glib::ustring & name, unsigned int depth);
operator const Glib::ustring & () const { return var->value(); }
const Glib::ustring & operator()() const { return var->value(); }
const Glib::ustring * operator->() const { return &var->value(); }
private:
Variable(VariableImpl *);
friend class VariableParse;
static VariableImplPtr create(const Glib::ustring & s, RowUser * dep = NULL);
VariableImplPtr var;
};
#endif
|