sources:
BasicClass.h (1.4k)
C1_2.cpp (604 bytes)
CashOffice.cpp (3.8k)
CashOffice.h (1.8k)
Date.cpp (6.0k)
Date.h (2.9k)
Exception.cpp (2.5k)
Exception.h (1.4k)
House.cpp (6.8k)
House.h (2.5k)
Room.cpp (3.0k)
Room.h (1.6k)


binaries:
Release/C1_2.exe (140.0k)


website:
more info here
studies/bauelemente/Softwarebauelemente-CodeC1-2/House.h
download file

  1 ///////////////////////////////////////////////////////////
  2 // Softwarebauelemente II, Aufgabe C1.2
  3 //
  4 // author: Stephan Brumme
  5 // last changes: July 3, 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 <set>
 18
 19 // CRoom used as member variable
 20 #include "Room.h"
 21 // CDate used as member variable
 22 #include "Date.h"
 23 // template used to compare two objects
 24 #include "MyLess.tli"
 25
 26
 27 // disable compiler warning (too long names)
 28 #pragma warning (disable: 4786)
 29
 30
 31 class CHouse : public CBasicClass {
 32     // define new types for using the set
 33 // typedef set<CRoom> TSetOfRooms;
 34     typedef set<CRoom, MyLess<CRoom> >  TSetOfRooms;
 35     typedef TSetOfRooms::iterator       TSetCursor;
 36     typedef TSetOfRooms::const_iterator TSetConstCursor;
 37
 38 public:
 39     // constructs a new house using its date of foundation (default: today)
 40     CHouse();
 41     CHouse(const CHouse& house);
 42     CHouse(const CDate& dtDateOfFoundation);
 43
 44     // return class name
 45     virtual string ClassnameOf() const { return "CHouse"; }
 46
 47     // display the attributes
 48     virtual string Show() const;
 49     // only for internal purposes !
 50     virtual string ShowDebug() const;
 51    
 52     // validate a house
 53     virtual bool ClassInvariant() const;
 54
 55     // compare two houses
 56     bool operator==(const CHouse& house) const;
 57     virtual bool EqualValue(const CBasicClass* pClass) const;
 58
 59     // copy one house to another one
 60     CHouse&  operator=(const CHouse &house);
 61     virtual bool Copy(const CBasicClass* pClass);
 62
 63     // return date of foundation
 64     CDate GetDateOfFoundation() const;
 65     // return number of stored rooms
 66     int Card() const;
 67
 68     // insert a new room into the set, TRUE if successful
 69     // will fail if room already exists
 70     bool Insert(const CRoom& room);
 71     // return first stored room, TRUE if successful
 72     bool GetFirst(CRoom& room);
 73     // return next room, TRUE if successful
 74     bool GetNext(CRoom& room);
 75     // look for a room and set cursor, TRUE if successful
 76     bool Find(const CRoom& room);
 77     // return the room the cursor points to, TRUE if successful
 78     bool GetCurrent(CRoom& room) const;
 79     // erase current room, TRUE if successful
 80     bool Scratch();
 81
 82 private:
 83     CDate m_dtDateOfFoundation;
 84
 85     TSetOfRooms m_Set;
 86     TSetCursor  m_itCursor;
 87 };
 88
 89 #endif // !defined(AFX_HOUSE_H__A8EA7860_08E1_11D5_9BB7_A8652B9FDD20__INCLUDED_)
 90
 91