Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

ParsedRule.h

Go to the documentation of this file.
00001 #ifndef PARSED_RULE_H_
00002 #define PARSED_RULE_H_
00003 
00004 #include "Kodu/Parsing/ParsedPhrase.h"
00005 
00006 namespace Kodu {
00007         
00008     class ParsedRule {
00009     private:
00010         unsigned int indentationLevel;
00011         unsigned int ruleNumber;
00012         unsigned int parentNumber;
00013         ParsedPhrase* condition;
00014         ParsedPhrase* action;
00015 
00016     public:
00017         //! Constructor
00018         ParsedRule()
00019           : indentationLevel(0), ruleNumber(0), parentNumber(0),
00020             condition(NULL), action(NULL)
00021         { }
00022         
00023         //! Copy Constructor
00024         explicit ParsedRule(const ParsedRule& kRule)
00025           : indentationLevel(kRule.indentationLevel), ruleNumber(kRule.ruleNumber),
00026             parentNumber(kRule.parentNumber), condition(kRule.condition), action(kRule.action)
00027         { }
00028         
00029         //! Destructor
00030         ~ParsedRule() {
00031             if (condition != NULL) {
00032                 delete condition;
00033                 condition = NULL;
00034             }
00035             if (action != NULL) {
00036                 delete action;
00037                 action = NULL;
00038             }
00039         }
00040         
00041         //! Assignment operator
00042         ParsedRule& operator=(const ParsedRule& kRule) {
00043             if (this != &kRule) {
00044                 indentationLevel = kRule.indentationLevel;
00045                 ruleNumber = kRule.ruleNumber;
00046                 parentNumber = kRule.parentNumber;
00047                 condition = kRule.condition;
00048                 action = kRule.action;
00049             }
00050             return *this;
00051         }
00052         
00053         //! Returns the action phrase
00054         ParsedPhrase* getActionPhrase();
00055         
00056         //! Returns the condition phrase
00057         ParsedPhrase* getConditionPhrase();
00058         
00059         //! Returns this rule's indentation level
00060         unsigned int getIndentationLevel();
00061         
00062         //! Returns this rule's parent number (a rule id)
00063         unsigned int getParentNumber();
00064         
00065         //! Returns this rule's id (number)
00066         unsigned int getRuleNumber();
00067         
00068         //! Sets this rule's action phrase
00069         bool setActionPhrase(ParsedPhrase* actionPhrase);
00070         
00071         //! Sets this rule's condition phrase
00072         bool setConditionPhrase(ParsedPhrase* conditionPhrase);
00073         
00074         //! Sets this rule's indentation level
00075         void setIndentationLevel(unsigned int amount);
00076         
00077         //! Sets this rule's parent number (a rule id)
00078         void setParentNumber(unsigned int parentId);
00079         
00080         //! Sets this rule's id (number)
00081         void setRuleNumber(unsigned int ruleId);
00082     };
00083 }
00084 
00085 #endif // PARSED_RULE_H_

Tekkotsu v5.1CVS
Generated Mon May 9 04:58:45 2016 by Doxygen 1.6.3