/////////////////////////////////////////////////////////// // Softwarebauelemente II, Aufgabe O2.1 // // author: Stephan Brumme // last changes: February 26, 2001 #if !defined(AFX_HOUSE_H__A8EA7860_08E1_11D5_9BB7_A8652B9FDD20__INCLUDED_) #define AFX_HOUSE_H__A8EA7860_08E1_11D5_9BB7_A8652B9FDD20__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 // STL's list container #include // CRoom used as member variable #include "Room.h" // CDate used as member variable #include "Date.h" // for basic class behaviour #include "BasicClass.h" class CHouse : public CBasicClass { // define new types for using the set typedef std::list TSetOfRooms; typedef TSetOfRooms::iterator TSetCursor; typedef TSetOfRooms::const_iterator TSetConstCursor; public: // constructs a new house using its date of foundation (default: today) CHouse(const CDate& dtDateOfFoundation = CDate::GetToday()); // return class name static char* ClassnameOf() { return "CHouse"; } // display the attributes friend ostream& operator<<(ostream& mystream, const CHouse& house); // compare two houses bool operator==(const CHouse& house) const; virtual bool Equal(const CHouse* house) const; virtual bool EqualValue(const CHouse* house) const; // copy one house to another one CHouse& operator=(const CHouse &house); virtual bool Copy(const CHouse* house); // return date of foundation CDate GetDateOfFoundation() const; // return number of stored rooms int Card() const; // insert a new room into the set, TRUE if successful // will fail if room already exists bool Insert(const CRoom& room); // return first stored room, TRUE if successful bool GetFirst(CRoom& room); // return next room, TRUE if successful bool GetNext(CRoom& room); // look for a room and set cursor, TRUE if successful bool Find(const CRoom& room); // return the room the cursor points to, TRUE if successful bool GetCurrent(CRoom& room) const; // erase current room, TRUE if successful bool Scratch(); protected: // used to perform proper display in derived classes virtual ostream& OutStream(ostream& mystream, bool bDebug=false) const; private: CDate m_dtDateOfFoundation; TSetOfRooms m_Set; TSetCursor m_itCursor; }; #endif // !defined(AFX_HOUSE_H__A8EA7860_08E1_11D5_9BB7_A8652B9FDD20__INCLUDED_)