1 #ifndef __COMMANDS_REGISTER_STRUCTURE__
2 #define __COMMANDS_REGISTER_STRUCTURE__
4 //------------------------------------------------------------------------------------------------------------
6 //------------------------------------------------------------------------------------------------------------
10 #include "CommandObject.h"
12 class CommandsRegisterStructure{
14 //------------------------------------------------------------------------------------------------------------
15 // Constructors & Destructors
16 //------------------------------------------------------------------------------------------------------------
20 * Creates the CommandsRegisterStructure
22 CommandsRegisterStructure();
25 * Destroys the CommandsRegisterStructure
27 ~CommandsRegisterStructure();
29 //------------------------------------------------------------------------------------------------------------
31 //------------------------------------------------------------------------------------------------------------
34 * Registers a command in the vector with no verification, is should be well constructed
35 * @param theCommand The command to register
37 void registerCommand(CommandObject * theCommand);
40 * Gets the -ACTUAL- command text
43 //std::string getActualCommandText();
46 * Gets the -LAST- command text
49 //std::string getLastCommandText();
52 * Deletes all the registered actions and reinitialize the -ACTUAL- and -LAST- iterators
57 * Moves to the the previous position the -ACTUAL- iterator
58 * @return Indicates true if it was done
60 bool moveBack_Actual();
63 * Moves to the the next position the -ACTUAL- iterator
64 * @return Indicates true if it was done
66 bool moveForward_Actual();
69 * Moves to the the previous position the -LAST- iterator
70 * @return Indicates true if it was done
75 * Moves to the the next position the -LAST- iterator
76 * @return Indicates true if it was done
78 bool moveForward_Last();
81 * Indicates if the -LAST- iterator has a next action or not
82 * @return Returns true if it has
87 * Indicates if the -ACTUAL- iterator has a next action or not
88 * @return Returns true if it has
93 * Indicates if the -LAST- iterator has a previous action or not
94 * @return Returns true if it has
96 bool hasLastPrevious();
99 * Indicates if the -ACTUAL- iterator has a previous action or not
100 * @return Returns true if it has
102 bool hasActualPrevious();
105 * Puts to point the -ACTUAL- iterator up to the -LAST- iterator.
107 void levelActualToLast();
110 * Puts to point the -LAST- iterator up to the -ACTUAL- iterator and erases automatically the actions after the
111 * referenced last and the end of the registered actions if nothing is given by parameter.
113 void levelLastToActual(bool clearingAfterLast = true);
116 * Clear all the elements in the vector bettween the -LAST- iterator and the end of the vector
118 void clearAll_afterLast();
121 * Clear all the elements in the vector bettween the -ACTUAL- iterator and the start of the vector
123 void clearAll_beforeActual();
126 * Indicates if there are actions in the vector of not
127 * @return Returns true is there are not registered actions
132 * Indicates the quantity of actions that are registered
133 * @return Returns the total amount of registered actions in the vector
135 int getCommandsCount();
138 * Gets the -ACTUAL- iterator information data pointer
139 * @return The pointer to the referenced object by the -ACTUAL- iterator
141 CommandObject * getActual_Pointer();
144 * Gets the -LAST- iterator information data pointer
145 * @return The pointer to the referenced object by the -LAST- iterator
147 CommandObject * getLast_Pointer();
150 * Gets the command at the given position
151 * @return The pointer to the referenced object by the position
153 CommandObject * getCommandAt(int position);
156 * Gets the index of the actualAction in the vector
157 * @return actualIndexToExec Is the corresponding index
159 int getActualIndex();
162 * Gets the index of the lasAction in the vector
163 * @return lasAction Is the corresponding index
168 * Sets the index of the actualAction in the vector
169 * @param newActualIndex Is the corresponding index
171 void setActualIndex(int newActualIndex);
174 * Sets the index of the lasAction in the vector
175 * @param newLasIndex Is the corresponding index
177 void setLasIndex(int newLasIndex);
180 * Gets the registered commands vector size
181 * @return Returns the vector size
183 int getRegistereCommandsCount();
186 * Gets the total registered commands
187 * @return Returns the total of commands
189 int getTotalCommandsCount();
194 //------------------------------------------------------------------------------------------------------------
196 //------------------------------------------------------------------------------------------------------------
199 //------------------------------------------------------------------------------------------------------------
201 //------------------------------------------------------------------------------------------------------------
204 * Represents the actions successfully registered
206 std::vector<CommandObject*> registeredActions;
209 * Represents the index to the actual action to execute at the registered actions vector
211 //std::vector <CommandObject*>::iterator actualAction;
212 int actualIndexToExec;
215 * Represents the index to the last action executed at the registered actions vector
217 //std::vector <CommandObject*>::iterator lastAction;