sources:
BasicClass.h (1.4k)
CashOffice.cpp (3.6k)
CashOffice.h (1.7k)
Date.cpp (6.0k)
Date.h (2.9k)
Exception.cpp (2.5k)
Exception.h (1.4k)
House.cpp (7.5k)
House.h (2.5k)
O3_5.cpp (577 bytes)
Room.cpp (2.9k)
Room.h (1.5k)


binaries:
Release/O3_5.exe (132.0k)


website:
more info here
studies/bauelemente/Softwarebauelemente-CodeO3-5/House.h
download file

  1 ///////////////////////////////////////////////////////////
  2 // Softwarebauelemente II, Aufgabe O3.5
  3 //
  4 // author: Stephan Brumme
  5 // last changes: June 27, 2001
  6
  7 #if !defined(AFX_HOUSE_H__A8EA7860_08E1_11D5_9BB7_A8652B9FDD20__INCLUDED_)
  8 #define AFX_HOUSE_H__A8EA7860_08E1_11D5_9BB7_A8652B9FDD20__INCLUDED_
  9
 10
 11 #if _MSC_VER > 1000
 12 #pragma once
 13 #endif // _MSC_VER > 1000
 14
 15
 16 // STL's list container
 17 #include <list>
 18
 19 // CRoom used as member variable
 20 #include "Room.h"
 21 // CDate used as member variable
 22 #include "Date.h"
 23
 24
 25 class CHouse : public CBasicClass {
 26     // define new types for using the set
 27     typedef list<CRoom>                 TSetOfRooms;
 28     typedef TSetOfRooms::iterator       TSetCursor;
 29     typedef TSetOfRooms::const_iterator TSetConstCursor;
 30
 31     // my own iterator
 32     typedef void (*TIteratorFunc) (CRoom*);
 33
 34 public:
 35     // constructs a new house using its date of foundation (default: today)
 36     CHouse();
 37     CHouse(const CHouse& house);
 38     CHouse(const CDate& dtDateOfFoundation);
 39
 40     // return class name
 41     virtual string ClassnameOf() const { return "CHouse"; }
 42
 43     // display the attributes
 44     virtual string Show() const;
 45     // only for internal purposes !
 46     virtual string ShowDebug() const;
 47    
 48     // validate a house
 49     virtual bool ClassInvariant() const;
 50
 51     // compare two houses
 52     bool operator==(const CHouse& house) const;
 53     virtual bool EqualValue(const CBasicClass* pClass) const;
 54
 55     // copy one house to another one
 56     CHouse&  operator=(const CHouse &house);
 57     virtual bool Copy(const CBasicClass* pClass);
 58
 59     // return date of foundation
 60     CDate GetDateOfFoundation() const;
 61     // return number of stored rooms
 62     int Card() const;
 63
 64     // insert a new room into the set, TRUE if successful
 65     // will fail if room already exists
 66     bool Insert(const CRoom& room);
 67     // return first stored room, TRUE if successful
 68     bool GetFirst(CRoom& room);
 69     // return next room, TRUE if successful
 70     bool GetNext(CRoom& room);
 71     // look for a room and set cursor, TRUE if successful
 72     bool Find(const CRoom& room);
 73     // return the room the cursor points to, TRUE if successful
 74     bool GetCurrent(CRoom& room) const;
 75     // erase current room, TRUE if successful
 76     bool Scratch();
 77
 78     // iterate through the set
 79     void ForEachDo(const TIteratorFunc iterator);
 80     // show elements by calling ForEachDo
 81     string ShowUsingForEachDo() const;
 82
 83 private:
 84     CDate m_dtDateOfFoundation;
 85
 86     TSetOfRooms m_Set;
 87     TSetCursor  m_itCursor;
 88 };
 89
 90 #endif // !defined(AFX_HOUSE_H__A8EA7860_08E1_11D5_9BB7_A8652B9FDD20__INCLUDED_)
 91
 92