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 (6.8k)
House.h (2.3k)
O3_2.cpp (737 bytes)
Room.cpp (2.9k)
Room.h (1.5k)


binaries:
Release/O3_2.exe (132.0k)


website:
more info here
studies/bauelemente/Softwarebauelemente-CodeO3-2/Date.h
download file

  1 ///////////////////////////////////////////////////////////
  2 // Softwarebauelemente II, Aufgabe O3.1
  3 //
  4 // author: Stephan Brumme
  5 // last changes: May 15, 2001
  6
  7 #if !defined(AFX_DATE_H__A8EA7861_08E1_11D5_9BB7_A8652B9FDD20__INCLUDED_)
  8 #define AFX_DATE_H__A8EA7861_08E1_11D5_9BB7_A8652B9FDD20__INCLUDED_
  9
 10 #if _MSC_VER > 1000
 11 #pragma once
 12 #endif // _MSC_VER > 1000
 13
 14
 15 // for basic class behaviour
 16 #include "BasicClass.h"
 17
 18 #include <string>
 19 using namespace std;
 20
 21 ///////////////////////////////////////////////////////////
 22 // the CDate class is based upon the Gregorian calender
 23 // it DOES work for year between ca. 1600 and <2^31
 24 // no year validation is performed
 25 //
 26 // general order of parameters: dd/mm/yyyy hh:mm:ss
 27 class CDate : public CBasicClass
 28 {
 29 public:
 30     // constructor, default value is current date and time
 31     CDate();
 32     // copy constructor
 33     CDate(const CDate &date);
 34     // set user defined date at construction time
 35     CDate(unsigned int nDay,    unsigned int nMonth,    unsigned int nYear,
 36           unsigned int nHour=0, unsigned int nMinute=0, unsigned int nSecond=0)
;
 37
 38     // return class name
 39     virtual string ClassnameOf() const { return "CDate"; }
 40
 41     // show attributes
 42     virtual string Show() const;
 43     // shows all internal attributes
 44     virtual string ShowDebug() const;
 45
 46     // return today's date
 47     static void GetToday(unsigned int &nDay,  unsigned int &nMonth,  unsigned int &nYear,
 48                          unsigned int &nHour, unsigned int &nMinute, unsigned int &nSecond)
;
 49
 50     // validate a date
 51     virtual bool ClassInvariant() const;
 52     // determine whether it is a leap year
 53     static bool IsLeapYear(unsigned int nYear);
 54
 55     // copy constructors
 56     // non virtual
 57     CDate& operator = (const CDate &date);
 58     // virtual
 59     virtual bool Copy (const CBasicClass *pClass);
 60
 61     // compare two dates
 62     // non virtual
 63     bool operator == (const CDate &date) const;
 64     // virtual
 65     virtual bool EqualValue(const CBasicClass *pClass) const;
 66
 67    
 68     // set attributes, returns validility of date
 69     void SetDay   (unsigned int nDay);
 70     void SetMonth (unsigned int nMonth);
 71     void SetYear  (unsigned int nYear);
 72     void SetHour  (unsigned int nHour);
 73     void SetMinute(unsigned int nMinute);
 74     void SetSecond(unsigned int nSecond);
 75
 76     // return attributes
 77     unsigned int GetDay   () const;
 78     unsigned int GetMonth () const;
 79     unsigned int GetYear  () const;
 80     unsigned int GetHour  () const;
 81     unsigned int GetMinute() const;
 82     unsigned int GetSecond() const;
 83
 84     // constants for month's names
 85     enum { JANUARY   = 1, FEBRUARY = 2, MARCH    = 3, APRIL    = 4,
 86            MAY       = 5, JUNE     = 6, JULY     = 7, AUGUST   = 8,
 87            SEPTEMBER = 9, OCTOBER  =10, NOVEMBER =11, DECEMBER =12 };
 88
 89 private:
 90     // attributes
 91     unsigned int m_nDay;
 92     unsigned int m_nMonth;
 93     unsigned int m_nYear;
 94
 95     unsigned int m_nHour;
 96     unsigned int m_nMinute;
 97     unsigned int m_nSecond;
 98 };
 99
100
101 #endif // !defined(AFX_DATE_H__A8EA7861_08E1_11D5_9BB7_A8652B9FDD20__INCLUDED_)
102