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 public:
 29     // constructor, default value is current date and time
 30     CDate();
 31     // copy constructor
 32     CDate(const CDate &date);
 33     // set user defined date at construction time
 34     CDate(unsigned int nDay,    unsigned int nMonth,    unsigned int nYear,
 35           unsigned int nHour=0, unsigned int nMinute=0, unsigned int nSecond=0)
;
 36
 37     // return class name
 38     virtual string ClassnameOf() const { return "CDate"; }
 39
 40     // show attributes
 41     virtual string Show() const;
 42     // shows all internal attributes
 43     virtual string ShowDebug() const;
 44
 45     // return today's date
 46     static void GetToday(unsigned int &nDay,  unsigned int &nMonth,  unsigned int &nYear,
 47                          unsigned int &nHour, unsigned int &nMinute, unsigned int &nSecond)
;
 48
 49     // validate a date
 50     virtual bool ClassInvariant() const;
 51     // determine whether it is a leap year
 52     static bool IsLeapYear(unsigned int nYear);
 53
 54     // copy constructors
 55     // non virtual
 56     CDate& operator = (const CDate &date);
 57     // virtual
 58     virtual bool Copy (const CBasicClass *pClass);
 59
 60     // compare two dates
 61     // non virtual
 62     bool operator == (const CDate &date) const;
 63     // virtual
 64     virtual bool EqualValue(const CBasicClass *pClass) const;
 65
 66    
 67     // set attributes, returns validility of date
 68     void SetDay   (unsigned int nDay);
 69     void SetMonth (unsigned int nMonth);
 70     void SetYear  (unsigned int nYear);
 71     void SetHour  (unsigned int nHour);
 72     void SetMinute(unsigned int nMinute);
 73     void SetSecond(unsigned int nSecond);
 74
 75     // return attributes
 76     unsigned int GetDay   () const;
 77     unsigned int GetMonth () const;
 78     unsigned int GetYear  () const;
 79     unsigned int GetHour  () const;
 80     unsigned int GetMinute() const;
 81     unsigned int GetSecond() const;
 82
 83     // constants for month's names
 84     enum { JANUARY   = 1, FEBRUARY = 2, MARCH    = 3, APRIL    = 4,
 85            MAY       = 5, JUNE     = 6, JULY     = 7, AUGUST   = 8,
 86            SEPTEMBER = 9, OCTOBER  =10, NOVEMBER =11, DECEMBER =12 };
 87
 88 private:
 89     // attributes
 90     unsigned int m_nDay;
 91     unsigned int m_nMonth;
 92     unsigned int m_nYear;
 93
 94     unsigned int m_nHour;
 95     unsigned int m_nMinute;
 96     unsigned int m_nSecond;
 97 };
 98
 99
100 #endif // !defined(AFX_DATE_H__A8EA7861_08E1_11D5_9BB7_A8652B9FDD20__INCLUDED_)
101
102