54 lines
1012 B
C++
54 lines
1012 B
C++
#ifndef _BLOCK_HPP_
|
|
#define _BLOCK_HPP_
|
|
#include <assert.h>
|
|
#include <stdlib.h>
|
|
#include <mdiwin/windows.hpp>
|
|
|
|
template <class T>
|
|
class Vector;
|
|
|
|
template <class T>
|
|
class Block;
|
|
|
|
template <class T>
|
|
class Container
|
|
{
|
|
friend class Block<T>;
|
|
public:
|
|
Container<T> *Next();
|
|
void Next(Container<T> *nextItem);
|
|
private:
|
|
Container *mNext;
|
|
T *mItem;
|
|
Container();
|
|
~Container();
|
|
};
|
|
|
|
template <class T>
|
|
class Block
|
|
{
|
|
public:
|
|
typedef LONG Index;
|
|
Block(void);
|
|
virtual ~Block(void);
|
|
LONG size(void)const;
|
|
void insert(const T *item);
|
|
void insert(Block<T> &newBlock);
|
|
void remove(void);
|
|
void remove(const T *item);
|
|
void remove(Block<T> &oldBlock);
|
|
void remove(Index itemIndex);
|
|
int operator=(Block<T> &someBlock);
|
|
int operator=(Vector<T> &someVector);
|
|
T &operator[](LONG itemIndex);
|
|
private:
|
|
void synchronizeBlock(void);
|
|
LONG mSize;
|
|
LONG mLastIndexReferenced;
|
|
Container<T> *mLastObjectReferenced;
|
|
Container<T> *mLastObjectInserted;
|
|
Container<T> *mContainer;
|
|
};
|
|
#include <mdiwin/block.tpp>
|
|
#endif
|