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 {
 27     // define new types for using the set
 28     typedef list<CRoom>                 TSetOfRooms;
 29     typedef TSetOfRooms::iterator       TSetCursor;
 30     typedef TSetOfRooms::const_iterator TSetConstCursor;
 31
 32     // my own iterator
 33     typedef void (*TIteratorFunc) (CRoom*);
 34
 35 public:
 36     // constructs a new house using its date of foundation (default: today)
 37     CHouse();
 38     CHouse(const CHouse& house);
 39     CHouse(const CDate& dtDateOfFoundation);
 40
 41     // return class name
 42     virtual string ClassnameOf() const { return "CHouse"; }
 43
 44     // display the attributes
 45     virtual string Show() const;
 46     // only for internal purposes !
 47     virtual string ShowDebug() const;
 48    
 49     // validate a house
 50     virtual bool ClassInvariant() const;
 51
 52     // compare two houses
 53     bool operator==(const CHouse& house) const;
 54     virtual bool EqualValue(const CBasicClass* pClass) const;
 55
 56     // copy one house to another one
 57     CHouse&  operator=(const CHouse &house);
 58     virtual bool Copy(const CBasicClass* pClass);
 59
 60     // return date of foundation
 61     CDate GetDateOfFoundation() const;
 62     // return number of stored rooms
 63     int Card() const;
 64
 65     // insert a new room into the set, TRUE if successful
 66     // will fail if room already exists
 67     bool Insert(const CRoom& room);
 68     // return first stored room, TRUE if successful
 69     bool GetFirst(CRoom& room);
 70     // return next room, TRUE if successful
 71     bool GetNext(CRoom& room);
 72     // look for a room and set cursor, TRUE if successful
 73     bool Find(const CRoom& room);
 74     // return the room the cursor points to, TRUE if successful
 75     bool GetCurrent(CRoom& room) const;
 76     // erase current room, TRUE if successful
 77     bool Scratch();
 78
 79     // iterate through the set
 80     void ForEachDo(const TIteratorFunc iterator);
 81     // show elements by calling ForEachDo
 82     string ShowUsingForEachDo() const;
 83
 84 private:
 85     CDate m_dtDateOfFoundation;
 86
 87     TSetOfRooms m_Set;
 88     TSetCursor  m_itCursor;
 89 };
 90
 91 #endif // !defined(AFX_HOUSE_H__A8EA7860_08E1_11D5_9BB7_A8652B9FDD20__INCLUDED_)
 92