Build, if that was not necessary blame cartman who told me "sure" :-D
[kdepim.git] / libkcal / calendarnull.h
blobaa82be28da02f2e263e37909e3c07bbf69efde29
1 /*
2 This file is part of libkcal.
4 Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
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.
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.
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., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA.
21 #ifndef KCAL_CALENDARNULL_H
22 #define KCAL_CALENDARNULL_H
24 #include "calendar.h"
26 class KConfig;
28 namespace KCal {
30 /**
31 This is a null calendar object which does nothing. It can be passed to
32 functions which need a calendar object when there actually isn't a real
33 calendar yet. CalendarNull can be used to implement the null object design
34 pattern. Instead of passing a 0 pointer and checking for 0 with each access
35 a CalendarNull object can be passed.
37 class CalendarNull : public Calendar
39 public:
40 CalendarNull() {}
41 ~CalendarNull() {}
43 static CalendarNull *self();
45 void incidenceUpdated( IncidenceBase * ) {}
47 void close() {}
48 void save() {}
50 bool addEvent( Event * ) { return false; }
51 void deleteEvent( Event * ) {}
52 Event *event( const QString & ) { return 0; }
53 Event::List rawEvents( EventSortField, SortDirection ) { return Event::List(); }
54 Event::List rawEvents( const QDate &, const QDate &, bool ) { return Event::List(); }
55 Event::List rawEventsForDate( const QDateTime & ) { return Event::List(); }
56 Event::List rawEventsForDate( const QDate &, bool ) { return Event::List(); }
58 bool addTodo( Todo * ) { return false; }
59 void deleteTodo( Todo * ) {}
60 Todo *todo( const QString & ) { return 0; }
61 Todo::List rawTodos( TodoSortField, SortDirection ) { return Todo::List(); }
62 Todo::List rawTodosForDate( const QDate & ) { return Todo::List(); }
64 bool addJournal( Journal * ) { return false; }
65 void deleteJournal( Journal * ) {}
66 Journal *journal( const QString & ) { return 0; }
67 Journal::List rawJournals( JournalSortField, SortDirection ) { return Journal::List(); }
68 Journal::List rawJournalsForDate( const QDate & ) { return Journal::List(); }
70 Alarm::List alarms( const QDateTime &, const QDateTime & ) { return Alarm::List(); }
72 private:
73 static CalendarNull *mSelf;
75 class Private;
76 Private *d;
81 #endif