#ifndef Zeit_H
#define Zeit_H

#include <time.h>

#include "Betriebssystem.h"
#include "ReferenceCounter.h"

namespace Framework
{
    class Text;       //! Text.h
    class Uhrzeit;    //! From this file
    class Datum;      //! From this file
    class Zeit;       //! From this file
    class ZeitMesser; //! From this file

    //! This class stores a time of day in the form of hours, minutes and
    //! seconds
    class Uhrzeit : public virtual ReferenceCounter
    {
    private:
        __int64 stunde, minute, sekunde;
        int update();

    public:
        //! Creates a new Uhrzeit object with the default values 00:00:00
        DLLEXPORT Uhrzeit();

        //! Sets the time by copying.
        //! \param zeit The values for hour, minute and second are
        //! copied from this object.
        DLLEXPORT int setUhrzeit(Uhrzeit* zeit);
        //! Sets the time.
        //! \param stunde The hour of the new time.
        //! \param minute The minute of the new time.
        //! \param sekunde The second of the new time.
        //! \return The number of remaining days.
        //! Example: setUhrzeit( 30, 30, 30 ); return: 1, stored: 6:30:30
        DLLEXPORT int setUhrzeit(int stunde, int minute, int sekunde);
        //! Sets the time.
        //! \param format A string that determines the format of the
        //! time in (zeit). h=hour, i=minute, s=second. \param
        //! zeit A string containing the new time. \return The
        //! number of remaining days. Example: setUhrzeit( "h:i:s", "05:30:00" );
        //! Example: setUhrzeit( "h:i:s", "30:30:00" ); return: 1, stored:
        //! 6:30:00
        DLLEXPORT int setUhrzeit(const char* format, const char* zeit);
        //! Sets the time.
        //! \param format A string that determines the format of the
        //! time in (zeit). h=hour, i=minute, s=second. \param
        //! zeit A Text object containing the new time. \return The
        //! number of remaining days. Example: setUhrzeit( "h:i:s", new Text(
        //! "05:30:00" ) ); Example: setUhrzeit( "h:i:s", new Text( "30:30:00"
        //! ) ); return: 1, stored: 6:30:00
        DLLEXPORT int setUhrzeit(const char* format, Text* zeit);
        //! Sets the hour.
        //! \param stunde The hour to be stored.
        //! \return The number of remaining days.
        //! Example: setStunde( 30 ); return: 1 day, stored hours: 6
        DLLEXPORT int setStunde(int stunde);
        //! Sets the minute.
        //! \param minute The minute to be stored.
        //! \return The number of remaining days.
        //! Example: Old time: 23:50:10, setMinute( 80 ); return: 1,
        //! stored time: 01:10:10
        DLLEXPORT int setMinute(int minute);
        //! Sets the second.
        //! \param minute The second to be stored.
        //! \return The number of remaining days.
        //! Example: Old time: 23:59:10, setSekunde( 80 ); return: 1,
        //! stored time: 00:00:30
        DLLEXPORT int setSekunde(int sekunde);
        //! Calculates the sum of this and another time and stores the result.
        //! \param zeit The time whose values are to be added.
        //! \return The number of remaining days.
        //! Example: Old time: 19:40:18, plusUhrzeit( (10:05:30) ); return 1,
        //! stored time: 05:45:48
        DLLEXPORT int plusUhrzeit(Uhrzeit* zeit);
        //! Calculates the sum of this and another time and stores the result.
        //! \param stunde The hours to be added.
        //! \param minute The minutes to be added.
        //! \param sekunde The seconds to be added.
        //! \return The number of remaining days.
        //! Example: Old time: 19:40:18, plusUhrzeit( 10, 5, 30 ); return 1,
        //! stored time: 05:45:48
        DLLEXPORT int plusUhrzeit(int stunde, int minute, int sekunde);
        //! Calculates the sum of this and another time and stores the result.
        //! \param format A string that determines the format of the
        //! time in (zeit). h=hour, i=minute, s=second.
        //! \param zeit A string containing the time to add.
        //! \return The number of remaining days.
        //! Example: Old time: 19:40:18, plusUhrzeit( "h:i:s", "10:05:30" );
        //! return 1, stored time: 05:45:48
        DLLEXPORT int plusUhrzeit(const char* format, const char* zeit);
        //! Calculates the sum of this and another time and stores the result.
        //! \param format A string that determines the format of the
        //! time in (zeit). h=hour, i=minute, s=second.
        //! \param zeit A Text object containing the time to add.
        //! \return The number of remaining days.
        //! Example: Old time: 19:40:18, plusUhrzeit( "h:i:s", new Text(
        //! "10:05:30" ) ); return 1, stored time: 05:45:48
        DLLEXPORT int plusUhrzeit(const char* format, Text* zeit);
        //! Calculates the sum of this and another time and stores the result.
        //! \param stunde The hours to add.
        //! \return The number of remaining days.
        //! Example: Old time: 20:50:30, plusStunde( 10 ); return 1,
        //! stored time: 6:50:30
        DLLEXPORT int plusStunde(__int64 stunde);
        //! Calculates the sum of this and another time and stores the result.
        //! \param minute The minutes to add.
        //! \return The number of remaining days.
        //! Example: Old time: 23:50:30, plusMinute( 11 ); return 1,
        //! stored time: 00:01:30
        DLLEXPORT int plusMinute(__int64 minute);
        //! Calculates the sum of this and another time and stores the result.
        //! \param sekunde The seconds to add.
        //! \return The number of remaining days.
        //! Example: Old time: 23:59:30, plusSekunde( 40 ); return 1,
        //! stored time: 00:00:10
        DLLEXPORT int plusSekunde(__int64 sekunde);
        //! Subtracts a given time from this one and stores the result.
        //! \param zeit The time to subtract.
        //! \return The number of remaining days.
        //! Example: Old time: 10:40:18, minusUhrzeit( (19:05:30) ); return -1,
        //! stored time: 15:34:48
        DLLEXPORT int minusUhrzeit(Uhrzeit* zeit);
        //! Subtracts a given time from this one and stores the result.
        //! \param stunde The hours to subtract.
        //! \param minute The minutes to subtract.
        //! \param sekunde The seconds to subtract.
        //! \return The number of remaining days.
        //! Example: Old time: 10:40:18, minusUhrzeit( 19, 05, 30 );
        //! return -1, stored time: 15:34:48
        DLLEXPORT int minusUhrzeit(int stunde, int minute, int sekunde);
        //! Subtracts a given time from this one and stores the result.
        //! \param format A string that determines the format of the
        //! time in (zeit). h=hour, i=minute, s=second.
        //! \param zeit A string containing the time to subtract.
        //! \return The number of remaining days.
        //! Example: Old time: 10:40:18, minusUhrzeit( "h:i:s", "19:05:30" );
        //! return -1, stored time: 15:34:48
        DLLEXPORT int minusUhrzeit(const char* format, const char* zeit);
        //! Subtracts a given time from this one and stores the result.
        //! \param format A string that determines the format of the
        //! time in (zeit). h=hour, i=minute, s=second.
        //! \param zeit A Text object containing the time to subtract.
        //! \return The number of remaining days.
        //! Example: Old time: 10:40:18, minusUhrzeit( "h:i:s", new Text(
        //! "19:05:30" ) ); return -1, stored time: 15:34:48
        DLLEXPORT int minusUhrzeit(const char* format, Text* zeit);
        //! Subtracts a given time from this one and stores the result.
        //! \param stunde The hours to subtract.
        //! \return The number of remaining days.
        //! Example: Old time: 10:40:18, minusStunde( 19 ); return -1,
        //! stored time: 15:40:18
        DLLEXPORT int minusStunde(__int64 stunde);
        //! Subtracts a given time from this one and stores the result.
        //! \param minute The minutes to subtract.
        //! \return The number of remaining days.
        //! Example: Old time: 00:40:18, minusMinute( 50 ); return -1,
        //! stored time: 23:50:18
        DLLEXPORT int minusMinute(__int64 minute);
        //! Subtracts a given time from this one and stores the result.
        //! \param sekunde The seconds to subtract.
        //! \return The number of remaining days.
        //! Example: Old time: 00:00:20, minusSekunde( 50 ); return -1,
        //! stored time: 23:59:30
        DLLEXPORT int minusSekunde(__int64 sekunde);

        //! Returns the hour.
        DLLEXPORT int getStunde() const;
        //! Returns the minute.
        DLLEXPORT int getMinute() const;
        //! Returns the second.
        DLLEXPORT int getSekunde() const;
        //! Returns the time formatted as text.
        //! \param format A string that determines the format of the
        //! returned time. h=hour, i=minute, s=second.
        //! Example: Time: 5:40:39, getUhrzeit( "h:i:s" ); return: "5:40:39"
        DLLEXPORT Text* getUhrzeit(const char* format) const;
        //! Checks if the time equals zeit.
        //! \param zeit The time to compare with.
        //! \return (true) if both times are equal. (false) if they
        //! are not equal.
        DLLEXPORT bool istGleich(Uhrzeit* zeit) const;
        //! Checks if the time equals zeit.
        //! \param format A string that determines the format of the
        //! time in (zeit). h=hour, i=minute, s=second. \param
        //! zeit A string containing the other time. \return
        //! (true) if both times are equal. (false) if they
        //! are not equal.
        DLLEXPORT bool istGleich(const char* format, const char* zeit) const;
        //! Checks if the time equals zeit.
        //! \param format A string that determines the format of the
        //! time in (zeit). h=hour, i=minute, s=second. \param
        //! zeit A Text object containing the other time.
        //! \return (true) if both times are equal. (false) if they
        //! are not equal.
        DLLEXPORT bool istGleich(const char* format, Text* zeit) const;
        //! Checks if the time equals the given time. Does not validate
        //! whether the given time is a valid time of day.
        //! \param stunde The hours of the time to check.
        //! \param minute The minutes of the time to check.
        //! \param sekunde The seconds of the time to check.
        //! \return (true) if both times are equal. (false) if they
        //! are not equal.
        DLLEXPORT bool istGleich(int stunde, int minute, int sekunde) const;
        //! Checks if the hour equals the given hour.
        //! \param stunde The hour to check.
        //! \return (true) if the hours are equal. (false) if they
        //! are not equal.
        DLLEXPORT bool stundeGleich(int stunde) const;
        //! Checks if the minute equals the given minute.
        //! \param minute The minute to check.
        //! \return (true) if the minutes are equal. (false) if they
        //! are not equal.
        DLLEXPORT bool minuteGleich(int minute) const;
        //! Checks if the second equals the given second.
        //! \param sekunde The second to check.
        //! \return (true) if the seconds are equal. (false) if they
        //! are not equal.
        DLLEXPORT bool sekundeGleich(int sekunde) const;
        //! Checks if the time is less than zeit.
        //! \param zeit The time to check against.
        //! \return (true) if the stored time is less than the given
        //! time. (false) otherwise.
        //! Example: (5:30:00).istKleiner( (10:40:29) ); return true
        DLLEXPORT bool istKleiner(Uhrzeit* zeit) const;
        //! Checks if the time is less than the given time.
        //! \param stunde The hours of the time to check.
        //! \param minute The minutes of the time to check.
        //! \param sekunde The seconds of the time to check.
        //! \return (true) if the stored time is less than the given
        //! time. (false) otherwise.
        //! Example: (5:30:00).istKleiner( 10, 40, 29 ); return true
        DLLEXPORT bool istKleiner(int stunde, int minute, int sekunde) const;
        //! Checks if the time is less than the given time.
        //! \param format A string that determines the format of the
        //! time in (zeit). h=hour, i=minute, s=second. \param
        //! zeit A string containing the other time. \return
        //! (true) if the stored time is less than the given
        //! time. (false) otherwise.
        //! Example: (5:30:00).istKleiner( "h:i:s", "10:40:29" ); return true
        DLLEXPORT bool istKleiner(const char* format, const char* zeit) const;
        //! Checks if the time is less than the given time.
        //! \param format A string that determines the format of the
        //! time in (zeit). h=hour, i=minute, s=second. \param
        //! zeit A Text object containing the other time.
        //! \return (true) if the stored time is less than the given
        //! time. (false) otherwise.
        DLLEXPORT bool istKleiner(const char* format, Text* zeit) const;
        //! Checks if the time is greater than zeit.
        //! \param zeit The time to check against.
        //! \return (true) if the stored time is greater than the given
        //! time. (false) otherwise.
        //! Example: (5:30:00).istLater( (10:40:29) ); return false
        DLLEXPORT bool istLater(Uhrzeit* zeit) const;
        //! Checks if the time is greater than the given time.
        //! \param stunde The hours of the time to check.
        //! \param minute The minutes of the time to check.
        //! \param sekunde The seconds of the time to check.
        //! \return (true) if the stored time is greater than the given
        //! time. (false) otherwise.
        //! Example: (5:30:00).istLater( 10, 40, 29 ); return false
        DLLEXPORT bool istLater(int stunde, int minute, int sekunde) const;
        //! Checks if the time is greater than the given time.
        //! \param format A string that determines the format of the
        //! time in (zeit). h=hour, i=minute, s=second. \param
        //! zeit A string containing the other time. \return
        //! (true) if the stored time is greater than the given
        //! time. (false) otherwise.
        //! Example: (5:30:00).istLater( "h:i:s", "10:40:29" ); return false
        DLLEXPORT bool istLater(const char* format, const char* zeit) const;
        //! Checks if the time is greater than the given time.
        //! \param format A string that determines the format of the
        //! time in (zeit). h=hour, i=minute, s=second. \param
        //! zeit A Text object containing the other time.
        //! \return (true) if the stored time is greater than the given
        //! time. (false) otherwise.
        //! Example: (5:30:00).istLater( "h:i:s", "10:40:29" ); return false
        DLLEXPORT bool istLater(const char* format, Text* zeit) const;
    };

    //! This class stores a date in the form of year, month and day
    class Datum : public virtual ReferenceCounter
    {
    private:
        int jahr, monat, tag;
        int* maxTage;
        void update();

    public:
        //! Creates a new Datum object with the default values 0.0.0.
        DLLEXPORT Datum();
        //! Deletes the date.
        DLLEXPORT ~Datum();

        //! Sets the date by copying.
        //! \param datum The date to store.
        DLLEXPORT void setDatum(Datum* datum);
        //! Sets the date to the given values.
        //! \param jahr The year of the new date.
        //! \param monat The month of the new date.
        //! \param tag The day of the new date.
        DLLEXPORT void setDatum(int jahr, int monat, int tag);
        //! Sets the date to the given value.
        //! \param format A string specifying the format of the
        //! date in (datum). y=year, m=month, d=day. \param datum
        //! A string containing the new date.
        //! Example: setDatum( "y-m-d", "2016-01-25" );
        DLLEXPORT void setDatum(const char* format, const char* datum);
        //! Sets the date to the given value.
        //! \param format A string specifying the format of the
        //! date in (datum). y=year, m=month, d=day. \param datum
        //! A Text object containing the new date.
        //! Example: setDatum( "y-m-d", new Text( "2016-01-25" ) );
        DLLEXPORT void setDatum(const char* format, Text* datum);
        //! Changes the year of the date.
        //! \param jahr The new year.
        DLLEXPORT void setJahr(int jahr);
        //! Changes the month of the date.
        //! \param monat The new month.
        DLLEXPORT void setMonat(int monat);
        //! Changes the day of the date.
        //! \param tag The new day.
        DLLEXPORT void setTag(int tag);
        //! Adds the given date to the current date and stores the result.
        //! \param datum The date to add.
        //! Example: ( 1.11.1995 ).plusDatum( ( 5.2.7 ) ); new date: 6.1.2003
        DLLEXPORT void plusDatum(Datum* datum);
        //! Adds the given date to the current date and stores the result.
        //! \param jahr The year to add. \param monat The month to add.
        //! \param tag The day to add.
        //! Example: ( 1.11.1995 ).plusDatum( 7, 2, 5 ); new date: 6.1.2003
        DLLEXPORT void plusDatum(int jahr, int monat, int tag);
        //! Adds the given date to the current date and stores the result.
        //! \param format A string specifying the format of the
        //! date in (datum). y=year, m=month, d=day.
        //! \param datum A string containing the date to add.
        //! Example: ( 1.11.1995 ).plusDatum( "d.m.y", "5.2.7" );
        //! new date: 6.1.2003
        DLLEXPORT void plusDatum(const char* format, const char* datum);
        //! Adds the given date to the current date and stores the result.
        //! \param format A string specifying the format of the
        //! date in (datum). y=year, m=month, d=day.
        //! \param datum A Text object containing the date to add.
        //! Example: ( 1.11.1995 ).plusDatum( "d.m.y", new Text(
        //! "5.2.7" ) ); new date: 6.1.2003
        DLLEXPORT void plusDatum(const char* format, Text* datum);
        //! Adds the given year to the current date and stores the result.
        //! \param jahr The year to add.
        //! Example: ( 1.11.1995 ).plusJahr( 21 ); new date: 1.11.2016
        DLLEXPORT void plusJahr(int jahr);
        //! Adds the given month to the current date and stores the result.
        //! \param monat The month to add.
        //! Example: ( 1.11.1995 ).plusMonat( 13 ); new date: 1.12.1996
        DLLEXPORT void plusMonat(int monat);
        //! Adds the given day to the current date and stores the result.
        //! \param tag The day to add.
        //! Example: ( 1.1.2000 ).plusTag( 32 ); new date: 2.2.2000
        DLLEXPORT void plusTag(int tag);
        //! Subtracts the given date from the current date and stores the result.
        //! \param datum The date to subtract.
        //! Example: ( 2.12.1996 ).minusDatum( ( 1.1.1 ) ); new date: 1.11.1995
        DLLEXPORT void minusDatum(Datum* datum);
        //! Subtracts the given date from the current date and stores the result.
        //! \param jahr The year to subtract. \param monat The month to subtract.
        //! \param tag The day to subtract.
        //! Example: ( 2.12.1996 ).minusDatum( 1, 1, 1 ); new date: 1.11.1995
        DLLEXPORT void minusDatum(int jahr, int monat, int tag);
        //! Subtracts the given date from the current date and stores the result.
        //! \param format A string specifying the format of the
        //! date in (datum). y=year, m=month, d=day.
        //! \param datum A string containing the date to subtract.
        //! Example: ( 2.12.1996 ).minusDatum( "d.m.y", "1.1.1" );
        //! new date: 1.11.1995
        DLLEXPORT void minusDatum(const char* format, const char* datum);
        //! Subtracts the given date from the current date and stores the result.
        //! \param format A string specifying the format of the
        //! date in (datum). y=year, m=month, d=day.
        //! \param datum A Text object containing the date to subtract.
        //! Example: ( 2.12.1996 ).minusDatum( "d.m.y", new Text(
        //! "1.1.1" ) ); new date: 1.11.1995
        DLLEXPORT void minusDatum(const char* format, Text* datum);
        //! Subtracts the given year from the current date and stores the result.
        //! \param jahr The year to subtract.
        //! Example: ( 1.11.1996 ).minusJahr( 1 ); new date: 1.11.1995
        DLLEXPORT void minusJahr(int jahr);
        //! Subtracts the given month from the current date and stores the result.
        //! \param monat The month to subtract.
        //! Example: ( 1.12.1996 ).minusMonat( 13 ); new date: 1.11.1995
        DLLEXPORT void minusMonat(int monat);
        //! Subtracts the given day from the current date and stores the result.
        //! \param tag The day to subtract.
        //! Example: ( 5.2.2016 ).minusTag( 11 ); new date: 25.1.2016
        DLLEXPORT void minusTag(int tag);

        //! Returns the year.
        DLLEXPORT int getJahr() const;
        //! Returns the month.
        DLLEXPORT int getMonat() const;
        //! Returns the day.
        DLLEXPORT int getTag() const;
        //! Returns the date as a Text object.
        //! \param format A string specifying the format of the
        //! returned date. y=year, m=month, d=day.
        //! Example: ( 1.11.1995 ).getDatum( "y-m-d" ); return: "1995-11-1"
        DLLEXPORT Text* getDatum(const char* format) const;
        //! Checks if the date equals the given date.
        //! \param datum The date to check.
        //! \return (true) if the given date matches the stored one.
        //! (false) otherwise.
        DLLEXPORT bool istGleich(Datum* datum) const;
        //! Checks if the date equals the given date.
        //! \param format A string specifying the format of the
        //! date in (datum). y=year, m=month, d=day. \param datum
        //! A string containing the date to check. \return
        //! (true) if the given date matches the stored one.
        //! (false) otherwise.
        //! Example: ( 1.11.1995 ).istGleich( "y-m-d", "1995-11-1" ); return: true
        DLLEXPORT bool istGleich(const char* format, const char* datum) const;
        //! Checks if the date equals the given date.
        //! \param format A string specifying the format of the
        //! date in (datum). y=year, m=month, d=day. \param datum
        //! A Text object containing the date to check.
        //! \return (true) if the given date matches the stored one.
        //! (false) otherwise.
        //! Example: ( 1.11.1995 ).istGleich( "y-m-d", new Text( "1995-11-1" ) ); return: true
        DLLEXPORT bool istGleich(const char* format, Text* datum) const;
        //! Checks if the date equals the given date.
        //! \param jahr The year of the date to check.
        //! \param monat The month of the date to check.
        //! \param tag The day of the date to check.
        //! \return (true) if the given date matches the stored one.
        //! (false) otherwise.
        //! Example: ( 1.11.1995 ).istGleich( 1995, 11, 1 ); return: true
        DLLEXPORT bool istGleich(int jahr, int monat, int tag) const;
        //! Checks if the year equals the given year.
        //! \param jahr The year to check.
        //! \return (true) if the given year matches the stored one.
        //! (false) otherwise.
        DLLEXPORT bool jahrGleich(int jahr) const;
        //! Checks if the month equals the given month.
        //! \param monat The month to check.
        //! \return (true) if the given month matches the stored one.
        //! (false) otherwise.
        DLLEXPORT bool monatGleich(int monat) const;
        //! Checks if the day equals the given day.
        //! \param tag The day to check.
        //! \return (true) if the given day matches the stored one.
        //! (false) otherwise.
        DLLEXPORT bool tagGleich(int tag) const;
        //! Checks if the stored date is less than the given one.
        //! \param datum The date to check.
        //! \return (true) if the stored date is before the given one.
        //! (false) otherwise.
        //! Example: ( 1.11.1995 ).istKleiner( ( 23.1.2016 ) ); return true
        DLLEXPORT bool istKleiner(Datum* datum) const;
        //! Checks if the stored date is less than the given one.
        //! \param jahr The year of the date to check.
        //! \param monat The month of the date to check.
        //! \param tag The day of the date to check.
        //! \return (true) if the stored date is before the given one.
        //! (false) otherwise.
        //! Example: ( 1.11.1995 ).istKleiner( 2016, 1, 23 ); return true
        DLLEXPORT bool istKleiner(int jahr, int monat, int tag) const;
        //! Checks if the stored date is less than the given one.
        //! \param format A string specifying the format of the
        //! date in (datum). y=year, m=month, d=day. \param datum
        //! A string containing the date to check. \return
        //! (true) if the stored date is before the given one.
        //! (false) otherwise.
        //! Example: ( 1.11.1995 ).istKleiner( "y, m, d", "2016, 1, 23" ); return true
        DLLEXPORT bool istKleiner(const char* format, const char* datum) const;
        //! Checks if the stored date is less than the given one.
        //! \param format A string specifying the format of the
        //! date in (datum). y=year, m=month, d=day. \param datum
        //! A Text object containing the date to check.
        //! \return (true) if the stored date is before the given one.
        //! (false) otherwise.
        //! Example: ( 1.11.1995 ).istKleiner( "y, m, d", new Text( "2016, 1, 23" ) ); return true
        DLLEXPORT bool istKleiner(const char* format, Text* datum) const;
        //! Checks if the stored date is greater than the given one.
        //! \param datum The date to check.
        //! \return (true) if the stored date is after the given one.
        //! (false) otherwise.
        //! Example: ( 1.11.1995 ).istLater( ( 23.1.2016 ) ); return false
        DLLEXPORT bool istLater(Datum* datum) const;
        //! Checks if the stored date is greater than the given one.
        //! \param jahr The year of the date to check.
        //! \param monat The month of the date to check.
        //! \param tag The day of the date to check.
        //! \return (true) if the stored date is after the given one.
        //! (false) otherwise.
        //! Example: ( 1.11.1995 ).istLater( 2016, 1, 23 ); return false
        DLLEXPORT bool istLater(int jahr, int monat, int tag) const;
        //! Checks if the stored date is greater than the given one.
        //! \param format A string specifying the format of the
        //! date in (datum). y=year, m=month, d=day. \param datum
        //! A string containing the date to check. \return
        //! (true) if the stored date is after the given one.
        //! (false) otherwise.
        //! Example: ( 1.11.1995 ).istLater( "y, m, d", "2016, 1, 23" ); return false
        DLLEXPORT bool istLater(const char* format, const char* datum) const;
        //! Checks if the stored date is greater than the given one.
        //! \param format A string specifying the format of the
        //! date in (datum). y=year, m=month, d=day. \param datum
        //! A Text object containing the date to check.
        //! \return (true) if the stored date is after the given one.
        //! (false) otherwise.
        //! Example: ( 1.11.1995 ).istLater( "y, m, d", new Text( "2016, 1, 23" ) ); return true
        DLLEXPORT bool istLater(const char* format, Text* datum) const;
    };

    //! This class combines the Datum and Uhrzeit classes and thus stores
    //! a timestamp with year, month, day, hour, minute and second
    class Zeit : public virtual ReferenceCounter
    {
    private:
        Datum* datum;
        Uhrzeit* uhrzeit;

    public:
        //! Creates a new Zeit with the default values 0.0.0 0:0:0.
        DLLEXPORT Zeit();
        //! Creates a new Zeit with the elapsed seconds since 1970.
        DLLEXPORT Zeit(__int64 timestamp);
        //! Deletes the current object.
        DLLEXPORT ~Zeit();
        //! Changes the stored time by copying the values from (zeit).
        //! \param zeit The new time.
        DLLEXPORT void setZeit(Zeit* zeit);
        //! Changes the stored time.
        //! \param jahr The new year.
        //! \param monat The new month.
        //! \param tag The new day.
        //! \param stunde The new hour.
        //! \param minute The new minute.
        //! \param sekunde The new second.
        DLLEXPORT void setZeit(
            int jahr, int monat, int tag, int stunde, int minute, int sekunde);
        //! Changes the stored time.
        //! \param format A string specifying the format of the new
        //! time in (zeit). y=year, m=month, d=day, h=hour,
        //! i=minute, s=second. \param zeit A string containing the new
        //! time. Example: setZeit( "y-m-d h:i:s", "2016-1-25 21:59:30" );
        DLLEXPORT void setZeit(const char* format, const char* zeit);
        //! Changes the stored time.
        //! \param format A string specifying the format of the new
        //! time in (zeit). y=year, m=month, d=day, h=hour,
        //! i=minute, s=second. \param zeit A Text object containing the
        //! new time. Example: setZeit( "y-m-d h:i:s", new Text(
        //! "2016-1-25 21:59:30" ) );
        DLLEXPORT void setZeit(const char* format, Text* zeit);
        //! Changes the stored year.
        //! \param jahr The new year.
        DLLEXPORT void setJahr(int jahr);
        //! Changes the stored month.
        //! \param monat The new month.
        DLLEXPORT void setMonat(int monat);
        //! Changes the stored day.
        //! \param tag The new day.
        DLLEXPORT void setTag(int tag);
        //! Changes the stored hour.
        //! \param stunde The new hour.
        DLLEXPORT void setStunde(int stunde);
        //! Changes the stored minute.
        //! \param minute The new minute.
        DLLEXPORT void setMinute(int minute);
        //! Changes the stored second.
        //! \param sekunde The new second.
        DLLEXPORT void setSekunde(int sekunde);
        //! Adds the given time and stores the result.
        //! \param zeit The time to add.
        DLLEXPORT void plusZeit(Zeit* zeit);
        //! Adds the given time and stores the result.
        //! \param jahr The year to add.
        //! \param monat The month to add.
        //! \param tag The day to add.
        //! \param stunde The hour to add.
        //! \param minute The minute to add.
        //! \param sekunde The second to add.
        DLLEXPORT void plusZeit(
            int jahr, int monat, int tag, int stunde, int minute, int sekunde);
        //! Adds the given time and stores the result.
        //! \param format A string specifying the format of the
        //! time in (zeit). y=year, m=month, d=day, h=hour,
        //! i=minute, s=second. \param zeit A string containing the
        //! time to add.
        DLLEXPORT void plusZeit(const char* format, const char* zeit);
        //! Adds the given time and stores the result.
        //! \param format A string specifying the format of the
        //! time in (zeit). y=year, m=month, d=day, h=hour,
        //! i=minute, s=second. \param zeit A Text object containing the
        //! time to add.
        DLLEXPORT void plusZeit(const char* format, Text* zeit);
        //! Adds the given time and stores the result.
        //! \param jahr The year to add.
        DLLEXPORT void plusJahr(int jahr);
        //! Adds the given time and stores the result.
        //! \param monat The month to add.
        DLLEXPORT void plusMonat(int monat);
        //! Adds the given time and stores the result.
        //! \param tag The day to add.
        DLLEXPORT void plusTag(int tag);
        //! Adds the given time and stores the result.
        //! \param stunde The hour to add.
        DLLEXPORT void plusStunde(__int64 stunde);
        //! Adds the given time and stores the result.
        //! \param minute The minute to add.
        DLLEXPORT void plusMinute(__int64 minute);
        //! Adds the given time and stores the result.
        //! \param sekunde The second to add.
        DLLEXPORT void plusSekunde(__int64 sekunde);
        //! Subtracts the given time and stores the result.
        //! \param zeit The time to subtract.
        DLLEXPORT void minusZeit(Zeit* zeit);
        //! Subtracts the given time and stores the result.
        //! \param jahr The year to subtract.
        //! \param monat The month to subtract.
        //! \param tag The day to subtract.
        //! \param stunde The hour to subtract.
        //! \param minute The minute to subtract.
        //! \param sekunde The second to subtract.
        DLLEXPORT void minusZeit(
            int jahr, int monat, int tag, int stunde, int minute, int sekunde);
        //! Subtracts the given time and stores the result.
        //! \param format A string specifying the format of the
        //! time in (zeit). y=year, m=month, d=day, h=hour,
        //! i=minute, s=second. \param zeit A string containing the
        //! time to subtract.
        DLLEXPORT void minusZeit(const char* format, const char* zeit);
        //! Subtracts the given time and stores the result.
        //! \param format A string specifying the format of the
        //! time in (zeit). y=year, m=month, d=day, h=hour,
        //! i=minute, s=second. \param zeit A Text object containing the
        //! time to subtract.
        DLLEXPORT void minusZeit(const char* format, Text* zeit);
        //! Subtracts the given time and stores the result.
        //! \param jahr The year to subtract.
        DLLEXPORT void minusJahr(int jahr);
        //! Subtracts the given time and stores the result.
        //! \param monat The month to subtract.
        DLLEXPORT void minusMonat(int monat);
        //! Subtracts the given time and stores the result.
        //! \param tag The day to subtract.
        DLLEXPORT void minusTag(int tag);
        //! Subtracts the given time and stores the result.
        //! \param stunde The hour to subtract.
        DLLEXPORT void minusStunde(__int64 stunde);
        //! Subtracts the given time and stores the result.
        //! \param minute The minute to subtract.
        DLLEXPORT void minusMinute(__int64 minute);
        //! Subtracts the given time and stores the result.
        //! \param sekunde The second to subtract.
        DLLEXPORT void minusSekunde(__int64 sekunde);
        //! Returns the stored time as text.
        //! \param format A string specifying the format of the
        //! returned time. y=year, m=month, d=day, h=hour,
        //! i=minute, s=second.
        DLLEXPORT Text* getZeit(const char* format) const;
        //! Checks if the time equals the given time.
        //! \param zeit The time to check.
        //! \return (true) if the times are equal. (false) otherwise.
        DLLEXPORT bool istGleich(Zeit* zeit) const;
        //! Checks if the time equals the given time.
        //! \param format A string specifying the format of the
        //! time in (zeit). y=year, m=month, d=day, h=hour,
        //! i=minute, s=second. \param zeit A string containing the
        //! time to check. \return (true) if the times are equal.
        //! (false) otherwise.
        DLLEXPORT bool istGleich(const char* format, const char* zeit) const;
        //! Checks if the time equals the given time.
        //! \param format A string specifying the format of the
        //! time in (zeit). y=year, m=month, d=day, h=hour,
        //! i=minute, s=second. \param zeit A Text object containing the
        //! time to check. \return (true) if the times are equal.
        //! (false) otherwise.
        DLLEXPORT bool istGleich(const char* format, Text* zeit) const;
        //! Checks if the time equals the given time.
        //! \param jahr The year to check.
        //! \param monat The month to check.
        //! \param tag The day to check.
        //! \param stunde The hour to check.
        //! \param minute The minute to check.
        //! \param sekunde The second to check.
        //! \return (true) if the times are equal. (false) otherwise.
        DLLEXPORT bool istGleich(int jahr,
            int monat,
            int tag,
            int stunde,
            int minute,
            int sekunde) const;
        //! Returns the object storing the date with increased reference counter.
        DLLEXPORT Datum* getDatum() const;
        //! Returns the object storing the date without increased reference counter.
        DLLEXPORT Datum* zDatum() const;
        //! Returns the object storing the time of day with increased reference counter.
        DLLEXPORT Uhrzeit* getUhrzeit() const;
        //! Returns the object storing the time of day without increased reference counter.
        DLLEXPORT Uhrzeit* zUhrzeit() const;
        //! Checks if the stored time is less than the given time.
        //! \param zeit The time to check. \return (true)
        //! if the stored time is before the given time. (false)
        //! otherwise.
        DLLEXPORT bool istKleiner(Zeit* zeit) const;
        //! Checks if the stored time is less than the given time.
        //! \param jahr The year to check. \param monat The
        //! month to check. \param tag The day to check.
        //! \param stunde The hour to check. \param minute The
        //! minute to check. \param sekunde The second to check.
        //! \return (true) if the stored time is before the given time.
        //! (false) otherwise.
        DLLEXPORT bool istKleiner(int jahr,
            int monat,
            int tag,
            int stunde,
            int minute,
            int sekunde) const;
        //! Checks if the stored time is less than the given time.
        //! \param format A string specifying the format of the
        //! time in (zeit). y=year, m=month, d=day, h=hour,
        //! i=minute, s=second. \param zeit A string containing the
        //! time to check. \return (true) if the stored time is before
        //! the given time. (false) otherwise.
        DLLEXPORT bool istKleiner(const char* format, const char* zeit) const;
        //! Checks if the stored time is less than the given time.
        //! \param format A string specifying the format of the
        //! time in (zeit). y=year, m=month, d=day, h=hour,
        //! i=minute, s=second. \param zeit A Text object containing the
        //! time to check. \return (true) if the stored time is before
        //! the given time. (false) otherwise.
        DLLEXPORT bool istKleiner(const char* format, Text* zeit) const;
        //! Checks if the stored time is greater than the given time.
        //! \param zeit The time to check. \return (true)
        //! if the stored time is after the given time. (false)
        //! otherwise.
        DLLEXPORT bool istLater(Zeit* zeit) const;
        //! Checks if the stored time is greater than the given time.
        //! \param jahr The year to check. \param monat The
        //! month to check. \param tag The day to check.
        //! \param stunde The hour to check. \param minute The
        //! minute to check. \param sekunde The second to check.
        //! \return (true) if the stored time is after the given time.
        //! (false) otherwise.
        DLLEXPORT bool istLater(int jahr,
            int monat,
            int tag,
            int stunde,
            int minute,
            int sekunde) const;
        //! Checks if the stored time is greater than the given time.
        //! \param format A string specifying the format of the
        //! time in (zeit). y=year, m=month, d=day, h=hour,
        //! i=minute, s=second. \param zeit A string containing the
        //! time to check. \return (true) if the stored time is after
        //! the given time. (false) otherwise.
        DLLEXPORT bool istLater(const char* format, const char* zeit) const;
        //! Checks if the stored time is greater than the given time.
        //! \param format A string specifying the format of the
        //! time in (zeit). y=year, m=month, d=day, h=hour,
        //! i=minute, s=second. \param zeit A Text object containing the
        //! time to check. \return (true) if the stored time is after
        //! the given time. (false) otherwise.
        DLLEXPORT bool istLater(const char* format, Text* zeit) const;
    };

    //! Diese Klasse kann messen, wie viel Zeit zwischen zwei Zeitpunkten
    //! verstrichen ist
    class ZeitMesser : public virtual ReferenceCounter
    {
    private:
        double start;
        double ende;
        double messung;

    public:
        //! Erzeugt ein neues ZeitMesser Zeichnung
        DLLEXPORT ZeitMesser();
        //! Loescht das aktuelle Zeichnung
        DLLEXPORT ~ZeitMesser();
        //! legt den Startpunkt des zeitstoppens fest
        DLLEXPORT void messungStart();
        //! legt des Endpunkt der Zeitmessung fest
        DLLEXPORT void messungEnde();
        //! gibt den Abstand zwischen start und ende der Messung in Sekunden
        //! zurueck
        DLLEXPORT double getSekunden() const;
        //! gibt den Abstand zwischen start und ende der Messung in Minuten
        //! zurueck
        DLLEXPORT double getMinuten() const;
        //! gibt den Abstand zwischen start und ende der Messung in Stunden
        //! zurueck
        DLLEXPORT double getStunden() const;
        //! gibt true zurueck, wenn aktuell eine MEssung laeuft
        DLLEXPORT bool isMeasuring() const;
    };

    //! gibt die aktuelle Uhrzeit zurueck.
    DLLEXPORT Uhrzeit* getUhrzeit();
    //! gibt das aktuelle Datum zurueck.
    DLLEXPORT Datum* getDatum();
    //! gibt die aktuelle Zeit( Datum und Uhrzeit ) zurueck.
    DLLEXPORT Zeit* getZeit();
    //! prueft, ob jahr ein Schaltjahr ist.
    //! \param jahr Das zu ueberpruefende Jahr.
    //! \return (true), wenn das uebergebene jahr ein Schaltjahr ist. (false)
    //! sonst.
    DLLEXPORT bool istSchaltjahr(int jahr);
} // namespace Framework

#endif