GenericList.h
From Giona
(Difference between revisions)
Line 3: | Line 3: | ||
#define GENERICLIST_H_ | #define GENERICLIST_H_ | ||
- | # | + | #include "GenericListNode.h" |
- | + | ||
- | + | ||
- | + | ||
class GenericList | class GenericList | ||
{ | { | ||
public: | public: | ||
+ | static const int GENERIC_LIST_ERR_NO = 0; | ||
+ | static const int GENERIC_LIST_ERR_NULL_NODE = 1; | ||
+ | static const int GENERIC_LIST_ERR_EMPTY_LIST = 2; | ||
+ | static const int GENERIC_LIST_ERR_NODE_NOT_FOUND = 3; | ||
+ | static const int GENERIC_LIST_ERR_OUT_OF_RANGE_INDEX = 4; | ||
+ | |||
+ | |||
GenericList(); | GenericList(); | ||
virtual ~GenericList(); | virtual ~GenericList(); | ||
- | + | bool addNode(GenericListNode *node); | |
- | + | bool inHeadNode(GenericListNode *node); | |
+ | bool deleteNode(GenericListNode *node); | ||
GenericListNode *getHead(); | GenericListNode *getHead(); | ||
+ | GenericListNode *extractHead(); | ||
+ | GenericListNode *viewNode(int idx); | ||
+ | GenericListNode *extractNode(int idx); | ||
int getLastError(); | int getLastError(); | ||
int getLength(); | int getLength(); | ||
Line 27: | Line 35: | ||
#endif /*GENERICLIST_H_*/ | #endif /*GENERICLIST_H_*/ | ||
+ | |||
</pre> | </pre> | ||
[[Category:Codice Sorgente]] | [[Category:Codice Sorgente]] |
Revision as of 11:37, 13 December 2007
#ifndef GENERICLIST_H_ #define GENERICLIST_H_ #include "GenericListNode.h" class GenericList { public: static const int GENERIC_LIST_ERR_NO = 0; static const int GENERIC_LIST_ERR_NULL_NODE = 1; static const int GENERIC_LIST_ERR_EMPTY_LIST = 2; static const int GENERIC_LIST_ERR_NODE_NOT_FOUND = 3; static const int GENERIC_LIST_ERR_OUT_OF_RANGE_INDEX = 4; GenericList(); virtual ~GenericList(); bool addNode(GenericListNode *node); bool inHeadNode(GenericListNode *node); bool deleteNode(GenericListNode *node); GenericListNode *getHead(); GenericListNode *extractHead(); GenericListNode *viewNode(int idx); GenericListNode *extractNode(int idx); int getLastError(); int getLength(); private: GenericListNode * head; int length; int lastError; void deleteList(); }; #endif /*GENERICLIST_H_*/