summaryrefslogtreecommitdiff
path: root/project2/common/variables/literal.h
blob: 8c120b65c5e1c17d2aa61cfa6053c3ecd68b9ada (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
#ifndef VARIABLES_MODLITERAL_H
#define VARIABLES_MODLITERAL_H

#include "../variables.h"
#include <list>

class VariableLiteral : public VariableImpl {
	public:
		VariableLiteral(const Glib::ustring & src, const VT_typeID format = DefaultType);
		VariableLiteral(ScriptNodePtr);
		virtual VariableType value(ExecContext * ec) const;
		class Part;
		typedef boost::intrusive_ptr<Part> PartCPtr;
		typedef std::list<PartCPtr> Vals;

		class Part : public IntrusivePtrBase {
			public:
				virtual void appendTo(ExecContext *, Glib::ustring & str) const = 0;
				virtual VariableType value(ExecContext *) const = 0;
		};
		class TextPart : public Part {
			public:
				TextPart(const Glib::ustring & e);
				void appendTo(ExecContext *, Glib::ustring & str) const;
				VariableType value(ExecContext *) const;
				const Glib::ustring txt;
		};
		class VarPart : public Part, public Variable {
			public:
				VarPart(ScriptNodePtr e);
				void appendTo(ExecContext *, Glib::ustring & str) const;
				VariableType value(ExecContext *) const;
		};
	private:
		VariableType val;
		Vals vals;
};

#endif