Minor cleanup.
[lsystem3d.git] / src / rule.h
CommitLineData
71fe8484 1// Copyright (C) 2006 Erik Dahlberg
2//
3// This file is part of LSystem3D.
4//
5// LSystem3D is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// LSystem3D is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with LSystem3D; if not, write to the Free Software
17// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
19
20
21
22#ifndef RULE_H
23#define RULE_H
24
25#include <string>
26
27using namespace std;
28
29
30
31/**
32 * L-system rule
33 */
34class Rule
35{
36public:
37
38 /**
39 * Constructor
40 */
41 Rule();
42
43 /**
44 * Constructor
45 * @param name name of rule
46 * @param content content of rule
47 * @param probability probability of rule
48 */
49 Rule(string name, string content, double probability);
50
51 /**
52 * Constructor
53 * @param ruleString the rule string
54 */
55 Rule(string ruleString);
56
57 /**
58 * Destructor
59 */
60 ~Rule();
61
68a7b857 62
71fe8484 63 /**
64 * Clear rule
65 */
66 void clear();
67
68 /**
69 * Construct rule from string
70 * @param ruleString the rule string
71 */
72 void fromString(string ruleString);
73
74 /**
75 * Construct rule string
76 * @return the rule string
77 */
78 string toString();
79
68a7b857 80
71fe8484 81 /**
82 * Set rule name
83 * @param name the name
84 */
85 void setName(string name);
86
87 /**
88 * Set rule content
89 * @param content the content
90 */
91 void setContent(string content);
92
93 /**
94 * Set rule probability
95 * @param probability the probability factor
96 */
97 void setProbability(double probability);
98
68a7b857 99
71fe8484 100 /**
101 * Get rule name
102 * @return the rule name
103 */
104 string getName();
105
106 /**
107 * Get rule content
108 * @return the rule content
109 */
110 string getContent();
111
112 /**
113 * Get rule probability
114 * @return the probability
115 */
116 double getProbability();
117
118 /**
119 * Get preprocessed content
120 * @return the preprocessed content
121 */
122 string getPreprocessedContent();
123
124protected:
125
126 string _name;
127 string _content;
128 double _probability;
129};
130
131
132
133#endif