X-Git-Url: https://git.piment-noir.org/?p=lsystem3d.git;a=blobdiff_plain;f=src%2Frule.h;fp=src%2Frule.h;h=fcef31f500de59c1e74a90d39a5540fbef175b95;hp=0000000000000000000000000000000000000000;hb=71fe848416e50bea3b6484345047b0379126508b;hpb=df45724d152972305a473c34f9a4fdda14f8ced0 diff --git a/src/rule.h b/src/rule.h new file mode 100644 index 0000000..fcef31f --- /dev/null +++ b/src/rule.h @@ -0,0 +1,130 @@ +// Copyright (C) 2006 Erik Dahlberg +// +// This file is part of LSystem3D. +// +// LSystem3D is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// LSystem3D is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with LSystem3D; if not, write to the Free Software +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + + + +#ifndef RULE_H +#define RULE_H + +#include + +using namespace std; + + + +/** + * L-system rule + */ +class Rule +{ +public: + + /** + * Constructor + */ + Rule(); + + /** + * Constructor + * @param name name of rule + * @param content content of rule + * @param probability probability of rule + */ + Rule(string name, string content, double probability); + + /** + * Constructor + * @param ruleString the rule string + */ + Rule(string ruleString); + + /** + * Destructor + */ + ~Rule(); + + /** + * Clear rule + */ + void clear(); + + /** + * Construct rule from string + * @param ruleString the rule string + */ + void fromString(string ruleString); + + /** + * Construct rule string + * @return the rule string + */ + string toString(); + + /** + * Set rule name + * @param name the name + */ + void setName(string name); + + /** + * Set rule content + * @param content the content + */ + void setContent(string content); + + /** + * Set rule probability + * @param probability the probability factor + */ + void setProbability(double probability); + + /** + * Get rule name + * @return the rule name + */ + string getName(); + + /** + * Get rule content + * @return the rule content + */ + string getContent(); + + /** + * Get rule probability + * @return the probability + */ + double getProbability(); + + /** + * Get preprocessed content + * @return the preprocessed content + */ + string getPreprocessedContent(); + +protected: + + string _name; + string _content; + double _probability; +}; + + + +#endif