Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

ParsedPhrase.h

Go to the documentation of this file.
00001 #ifndef PARSED_PHRASE_H_
00002 #define PARSED_PHRASE_H_
00003 
00004 // C++ Library
00005 #include <vector>
00006 
00007 // Kodu Library
00008 #include "Kodu/General/GeneralFncs.h"
00009 #include "Kodu/Parsing/Token.h"
00010 
00011 namespace Kodu {
00012     
00013     //! Phrase class
00014     class ParsedPhrase {
00015     private:
00016         TokenBase* head;                    //!< The condition/action type that was parsed from the text file
00017         std::vector<TokenBase*> modifiers;  //!< The modifiers for *head
00018         
00019     public:
00020         //! Constructor
00021         ParsedPhrase()
00022           : head(NULL), modifiers()
00023         { }
00024         
00025         //! Copy constructor
00026         explicit ParsedPhrase(const ParsedPhrase& kPhrase)
00027           : head(kPhrase.head), modifiers(kPhrase.modifiers)
00028         { }
00029 
00030         //! Destructor
00031         ~ParsedPhrase() {
00032             if (head != NULL) {
00033                 delete head;
00034                 head = NULL;
00035             }
00036             GeneralFncs::destroyAllPtrsInVector(modifiers);
00037         }
00038         
00039         //! Assignment operator
00040         ParsedPhrase& operator=(const ParsedPhrase& kPhrase) {
00041             if (this != &kPhrase) {
00042                 head = kPhrase.head;
00043                 modifiers = kPhrase.modifiers;
00044             }
00045             return *this;
00046         }
00047 
00048         //! Returns the head of the Phrase
00049         TokenBase* getPhraseHead();
00050 
00051         //! Returns the modifiers of the Phrase
00052         std::vector<TokenBase*>& getPhraseModifiers();
00053         
00054         //! Sets the head
00055         bool setPhraseHead(TokenBase* _head);
00056         
00057         //! Sets the modifiers
00058         bool setPhraseModifiers(const std::vector<TokenBase*>&);
00059     };
00060 }
00061 
00062 #endif // PARSED_PHRASE_H_

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