#ifndef _TEST_PAGE_HPP_ #define _TEST_PAGE_HPP_ #ifndef _COMMON_SMARTPOINTER_HPP_ #include #endif #ifndef __SGI_STL_VECTOR_H #include #endif typedef vector CharRow; typedef vector AttributeRow; typedef vector PageData; typedef vector PageAttributes; typedef SmartPointer CharRowPointer; typedef SmartPointer AttributeRowPointer; typedef SmartPointer PageDataPointer; typedef SmartPointer PageAttributesPointer; class PurePage { public: enum{InitialRows=25,InitialCols=80}; enum State{Created=0x0001,Updated=0x0002,Clear=0x0004,Published=0x0008}; PurePage(unsigned rows=InitialRows,unsigned cols=InitialCols); PurePage(const PurePage &somePurePage); virtual ~PurePage(); PurePage &operator=(const PurePage &somePurePage); bool operator==(const PurePage &somePurePage)const; unsigned getRows(void); unsigned getCols(void); bool getAt(unsigned row,unsigned col,char &charData,Attribute &attribute); bool getAt(unsigned row,CharRowPointer &charRowPointer,AttributeRowPointer &attributeRowPointer); bool setAt(unsigned row,unsigned col,char &charData); bool setAt(unsigned row,CharRowPointer &charRowPointer,AttributeRowPointer &attributeRowPointer); bool queryState(State state)const; void setState(State state); void clearState(State state); void clearPage(void); private: void createPage(unsigned rows,unsigned cols); bool copyPage(PurePage &purePage); unsigned mRows; unsigned mCols; int mState; PageData mPageData; PageAttributes mPageAttributes; }; inline PurePage::PurePage(unsigned rows,unsigned cols) { createPage(rows,cols); setState(Created); } inline PurePage::PurePage(const PurePage &somePurePage) { *this=somePurePage; } inline PurePage::~PurePage() { } inline PurePage &PurePage::operator=(const PurePage &somePurePage) { copyPage(somePurePage); return *this; } inline bool PurePage::operator==(const PurePage &somePurePage)const { return false; } inline unsigned PurePage::getRows(void) { return mRows; } inline unsigned PurePage::getCols(void) { return mCols; } inline bool PurePage::getAt(unsigned row,unsigned col,char &charData,Attribute &attribute) { return false; } inline bool PurePage::getAt(unsigned row,CharRowPointer &charRowPointer,AttributeRowPointer &attributeRowPointer) { return false; } inline bool PurePage::setAt(unsigned row,unsigned col,char &charData) { return false; } inline bool PurePage::setAt(unsigned row,CharRowPointer &charRowPointer,AttributeRowPointer &attributeRowPointer) { return false; } inline void PurePage::setState(State state) { mState|=int(state); } inline void PurePage::clearState(State state) { mState|=int(~state); } inline bool PurePage::queryState(State state)const { return mState&state; } inline void PurePage::createPage(unsigned rows,unsigned cols) { unsigned row; unsigned col; mPageData.empty(); mPageAttributes.empty(); for(row=0;row