libkcal

period.cpp
1/*
2 This file is part of libkcal.
3
4 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
20*/
21
22#include <kdebug.h>
23#include <tdelocale.h>
24
25#include "period.h"
26
27using namespace KCal;
28
29Period::Period()
30{
31 mHasDuration = false;
32}
33
34Period::Period( const TQDateTime &start, const TQDateTime &end )
35{
36 mStart = start;
37 mEnd = end;
38 mHasDuration = false;
39}
40
41Period::Period( const TQDateTime &start, const Duration &duration )
42{
43 mStart = start;
44 mEnd = duration.end( start );
45 mHasDuration = true;
46}
47
48
49bool Period::operator<( const Period& other )
50{
51 return start() < other.start();
52}
53
54bool Period::operator==( const Period &other ) const
55{
56 return
57 mStart == other.mStart &&
58 mEnd == other.mEnd &&
59 mHasDuration == other.mHasDuration;
60}
61
62TQDateTime Period::start() const
63{
64 return mStart;
65}
66
67TQDateTime Period::end()const
68{
69 return mEnd;
70}
71
72Duration Period::duration()
73{
74 return Duration( mStart, mEnd );
75}
76
77bool Period::hasDuration()const
78{
79 return mHasDuration;
80}
81
82TQString KCal::Period::summary() const
83{
84 return mSummary;
85}
86
87void KCal::Period::setSummary(const TQString & summary)
88{
89 mSummary = summary;
90}
91
92TQString KCal::Period::location() const
93{
94 return mLocation;
95}
96
97void KCal::Period::setLocation(const TQString & location)
98{
99 mLocation = location;
100}
This class represents a duration.
Definition: duration.h:34
TQDateTime end(const TQDateTime &start) const
Computes a duration end time by adding the number of seconds or days in the duration to the specified...
Definition: duration.cpp:150
This class represents a period of time.
Definition: period.h:36
bool operator==(const Period &other) const
Returns true if this period is equal to the other one.
Definition: period.cpp:54
bool operator<(const Period &other)
Returns true if this element is smaller than the.
Definition: period.cpp:49
Namespace KCal is for global classes, objects and/or functions in libkcal.
Definition: alarm.h:38