~vcs-imports/wengophone/trunk

« back to all changes in this revision

Viewing changes to libs/util/util/Date.h

  • Committer: tanguy_k
  • Date: 2006-11-15 14:12:35 UTC
  • Revision ID: vcs-imports@canonical.com-20061115141235-6efc6e38eaa40ca0
* (compilation fix) OWBuild: rename portaudio to PORTAUDIO
* Libutil has only one include path now -> faster compilation
* Remove old directories
* (compilation fix) phapi: ph_msession_stopped() was a macro inside phmedia.h, now it is a standard function. Don't know why but it was not compiling under Windows using CMake

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * WengoPhone, a voice over Internet phone
 
3
 * Copyright (C) 2004-2006  Wengo
 
4
 *
 
5
 * This program is free software; you can redistribute it and/or modify
 
6
 * it under the terms of the GNU General Public License as published by
 
7
 * the Free Software Foundation; either version 2 of the License, or
 
8
 * (at your option) any later version.
 
9
 *
 
10
 * This program is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 * GNU General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU General Public License
 
16
 * along with this program; if not, write to the Free Software
 
17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
18
 */
 
19
 
 
20
#ifndef OWDATE_H
 
21
#define OWDATE_H
 
22
 
 
23
#include <util/owutildll.h>
 
24
 
 
25
#include <ctime>
 
26
#include <string>
 
27
 
 
28
/**
 
29
 * Represents a date.
 
30
 *
 
31
 * @author Philippe Bernery
 
32
 */
 
33
class Date {
 
34
        friend class DateXMLSerializer;
 
35
public:
 
36
 
 
37
        /**
 
38
         * Creates a date with the current time.
 
39
         */
 
40
        OWUTIL_API Date();
 
41
 
 
42
        /**
 
43
         * Copy constructor.
 
44
         */
 
45
        OWUTIL_API Date(const Date & date);
 
46
 
 
47
        /**
 
48
         * Creates a date from a day a month and a year.
 
49
         *
 
50
         * @param day day of the date
 
51
         * @param month month of the date
 
52
         * @param year year of the date
 
53
         */
 
54
        OWUTIL_API Date(unsigned day, unsigned month, unsigned year);
 
55
 
 
56
        OWUTIL_API ~Date();
 
57
 
 
58
        OWUTIL_API bool operator==(const Date & date) const;
 
59
 
 
60
        /**
 
61
         * @return the day number of the date. Day range: 1-31.
 
62
         */
 
63
        OWUTIL_API unsigned getDay() const;
 
64
 
 
65
        /**
 
66
         * Sets the date day.
 
67
         *
 
68
         * @see getDay()
 
69
         */
 
70
        OWUTIL_API void setDay(unsigned day);
 
71
 
 
72
        /**
 
73
         * @return the month number of the date. Month range: 1-12.
 
74
         */
 
75
        OWUTIL_API unsigned getMonth() const;
 
76
 
 
77
        /**
 
78
         * Sets the date month.
 
79
         *
 
80
         * @see getMonth()
 
81
         */
 
82
        OWUTIL_API void setMonth(unsigned month);
 
83
 
 
84
        /**
 
85
         * Gets the date year. Year range: 0-infinite.
 
86
         */
 
87
        OWUTIL_API unsigned getYear() const;
 
88
 
 
89
        /**
 
90
         * Sets date year.
 
91
         *
 
92
         * @see getYear()
 
93
         */
 
94
        OWUTIL_API void setYear(unsigned year);
 
95
 
 
96
        /**
 
97
         * @return a string representing the date. (e.g: "dd/mm/yyyy")
 
98
         */
 
99
        OWUTIL_API std::string toString() const;
 
100
 
 
101
private:
 
102
        unsigned _day;
 
103
        unsigned _month;
 
104
        unsigned _year;
 
105
};
 
106
 
 
107
#endif  //OWDATE_H