112 lines
2.7 KiB
C++
112 lines
2.7 KiB
C++
//## begin module.cm preserve=no
|
|
|
|
// %X% %Q% %Z% %W%
|
|
|
|
//## end module.cm
|
|
|
|
|
|
|
|
//## begin module.cp preserve=no
|
|
|
|
//## end module.cp
|
|
|
|
|
|
|
|
//## Module: List; Pseudo Package specification
|
|
|
|
//## Subsystem: Figures
|
|
|
|
//## Source file: H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\List.h
|
|
|
|
|
|
|
|
#ifndef List_h
|
|
|
|
#define List_h 1
|
|
|
|
|
|
|
|
//## begin module.additionalIncludes preserve=no
|
|
|
|
//## end module.additionalIncludes
|
|
|
|
|
|
|
|
//## begin module.includes preserve=yes
|
|
|
|
//## end module.includes
|
|
|
|
|
|
|
|
// Node
|
|
|
|
#include "H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\Node.h"
|
|
|
|
//## begin module.additionalDeclarations preserve=yes
|
|
|
|
//## end module.additionalDeclarations
|
|
|
|
|
|
|
|
|
|
|
|
//## Class: List; Parameterized Class
|
|
|
|
//## Category: Figures
|
|
|
|
//## Subsystem: Figures
|
|
|
|
//## Persistence: Transient
|
|
|
|
//## Cardinality/Multiplicity: n
|
|
|
|
|
|
|
|
template <class T>
|
|
|
|
class List
|
|
|
|
{
|
|
|
|
//## begin List.initialDeclarations preserve=yes
|
|
|
|
//## end List.initialDeclarations
|
|
|
|
|
|
|
|
public:
|
|
|
|
//## Constructors (generated)
|
|
|
|
List();
|
|
|
|
|
|
|
|
//## Destructor (generated)
|
|
|
|
~List();
|
|
|
|
|
|
|
|
|
|
|
|
//## Other Operations (specified)
|
|
|
|
//## Operation: add%937398674
|
|
|
|
// Denna sätter in grejjer i listan...
|
|
|
|
void add (int position, T item);
|
|
|
|
|
|
|
|
//## Operation: del%937398675
|
|
|
|
void del (int position);
|
|
|
|
|
|
|
|
//## Operation: isEmpty%937398676
|
|
|
|
bool isEmpty ();
|
|
|
|
|
|
|
|
//## Operation: getSize%937398677
|
|
|
|
int getSize ();
|
|
|
|
|
|
|
|
//## Operation: getItem%937398678
|
|
|
|
T getItem (int position);
|
|
|
|
|
|
|
|
// Additional Public Declarations
|
|
|
|
//## begin List.public preserve=yes
|
|
|
|
//## end List.public
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// Additional Protected Declarations
|
|
|
|
//## begin List.protected preserve=yes
|
|
|
|
//## end List.protected
|
|
|
|
|
|
|
|
private:
|
|
|
|
// Additional Private Declarations
|
|
|
|
//## begin List.private preserve=yes
|
|
|
|
//## end List.private
|
|
|
|
|
|
|
|
private: //## implementation
|
|
|
|
// Data Members for Has Relationships
|
|
|
|
|
|
|
|
//## Documentation List::head.has
|
|
|
|
//## begin List::head.has preserve=yes private: Node {1 -> 1RO}
|
|
|
|
Node<T> *head;
|
|
|
|
//## end List::head.has
|
|
|
|
|
|
|
|
// Data Members for Class Attributes
|
|
|
|
|
|
|
|
//## Attribute: size
|
|
|
|
//## begin List::size.attr preserve=no private: int {U} 0
|
|
|
|
int size;
|
|
|
|
//## end List::size.attr
|
|
|
|
|
|
|
|
// Additional Implementation Declarations
|
|
|
|
//## begin List.implementation preserve=yes
|
|
|
|
//## end List.implementation
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
//## begin List.postscript preserve=yes
|
|
|
|
//## end List.postscript
|
|
|
|
|
|
|
|
// Parameterized Class List
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//## begin module.epilog preserve=yes
|
|
|
|
#include "list.cpp"
|
|
|
|
//## end module.epilog
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|