File: Preprocessor.h

package info (click to toggle)
structure-synth 1.5.0-2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,268 kB
  • ctags: 1,966
  • sloc: cpp: 10,209; python: 164; makefile: 71; sh: 15
file content (66 lines) | stat: -rw-r--r-- 1,672 bytes parent folder | download | duplicates (9)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#pragma once

#include <QString>
#include <QList>
#include <QVector>

#include "../../SyntopiaCore/Exceptions/Exception.h"

namespace StructureSynth {
	namespace Parser {	

		class GuiParameter {
		public:
			GuiParameter(QString name) : name(name) {};
			virtual QString getName() { return name; }
		protected:
			QString name;
		};

		class FloatParameter : public GuiParameter {
		public:
			FloatParameter(QString name, double from, double to, double defaultValue) :
					GuiParameter(name), from(from), to(to), defaultValue(defaultValue) {};
			
			double getFrom() { return from; }
			double getTo() { return to; }
			double getDefaultValue() { return defaultValue; }
		private:
			double from;
			double to;
			double defaultValue;
		};

		class IntParameter : public GuiParameter {
		public:
			IntParameter(QString name, int from, int to, int defaultValue) :
					GuiParameter(name), from(from), to(to), defaultValue(defaultValue) {};
			
			int getFrom() { return from; }
			int getTo() { return to; }
			int getDefaultValue() { return defaultValue; }
		private:
			int from;
			int to;
			int defaultValue;
		};

		/// The preprocessor is responsible for expanding '#define'
		///
		class Preprocessor {

		public:
			Preprocessor() {};
			
			// The preprocess replaces 'random[2,4]' statements with random numbers.
			// This requires a seed. Using the same seed as controls the EisenScript is probably the best idea her.
			QString Process(QString input, int seed = 0);
			QVector<GuiParameter*> getParameters() { return params; }
			
		private:
			QVector<GuiParameter*> params;
		};

	}
}