libkcal

freebusy.h
1 /*
2  This file is part of libkcal.
3 
4  Copyright (c) 2001-2003 Cornelius Schumacher <schumacher@kde.org>
5  Copyright (C) 2004 Reinhold Kainhofer <reinhold@kainhofer.com>
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Library General Public
9  License as published by the Free Software Foundation; either
10  version 2 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Library General Public License for more details.
16 
17  You should have received a copy of the GNU Library General Public License
18  along with this library; see the file COPYING.LIB. If not, write to
19  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  Boston, MA 02110-1301, USA.
21 */
22 #ifndef KCAL_FREEBUSY_H
23 #define KCAL_FREEBUSY_H
24 
25 #include <tqdatetime.h>
26 #include <tqvaluelist.h>
27 #include <tqptrlist.h>
28 
29 #include "period.h"
30 #include "calendar.h"
31 
32 #include "incidencebase.h"
33 
34 namespace KCal {
35 
36  typedef TQValueList<Period> PeriodList;
40 class LIBKCAL_EXPORT FreeBusy : public IncidenceBase
41 {
42  public:
43  FreeBusy();
44  FreeBusy( const TQDateTime &start, const TQDateTime &end );
45  FreeBusy( Calendar *calendar, const TQDateTime &start,
46  const TQDateTime &end );
47  FreeBusy( PeriodList busyPeriods );
48 
49  ~FreeBusy();
50 
51  TQCString type() const { return "FreeBusy"; }
52 
53  virtual TQDateTime dtEnd() const;
54  bool setDtEnd( const TQDateTime &end );
55 
56  PeriodList busyPeriods() const;
57 
59  void addPeriod( const TQDateTime &start, const TQDateTime &end );
60  void addPeriod( const TQDateTime &start, const Duration &dur );
64  void addPeriods( const PeriodList & );
65  void sortList();
66 
67  void merge( FreeBusy *freebusy );
68 
74  bool operator==( const FreeBusy &freebusy ) const;
75 
76  private:
77  bool accept( Visitor &v ) { return v.visit( this ); }
78  //This is used for creating a freebusy object for the current user
79  bool addLocalPeriod( const TQDateTime &start, const TQDateTime &end );
80 
81  TQDateTime mDtEnd;
82  PeriodList mBusyPeriods;
83  Calendar *mCalendar;
84 
85  class Private;
86  Private *d;
87 };
88 
89 }
90 
91 #endif
Provides the main "calendar" object class.
This is the main "calendar" object class.
Definition: calendar.h:171
This class represents a duration.
Definition: duration.h:34
This class provides information about free/busy time of a calendar user.
Definition: freebusy.h:41
This class provides the interface for a visitor of calendar components.
Definition: incidencebase.h:55
virtual bool visit(Event *)
Reimplement this function in your concrete subclass of IncidenceBase::Visitor to perform actions on a...
Definition: incidencebase.h:64
This class provides the base class common to all calendar components.
Definition: incidencebase.h:46
Namespace KCal is for global classes, objects and/or functions in libkcal.
Definition: alarm.h:38