home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / libkcal / calendarnull.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-09-10  |  8.1 KB  |  310 lines

  1. /*
  2.     This file is part of libkcal.
  3.  
  4.     Copyright (c) 2003 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.   @file calendarnull.h
  23.   A null calendar class with does nothing.
  24.  
  25.   @author Cornelius Schumacher
  26. */
  27. #ifndef KCAL_CALENDARNULL_H
  28. #define KCAL_CALENDARNULL_H
  29.  
  30. #include "calendar.h"
  31. #include "libkcal_export.h"
  32.  
  33. class KConfig;
  34.  
  35. /**
  36.    @namespace KCal
  37.    Namespace KCal is for global classes, objects and/or functions in libkcal.
  38. */
  39. namespace KCal {
  40.  
  41. /**
  42.    @class CalendarNull
  43.  
  44.    This is a null calendar class which does nothing.  It can be passed to
  45.    functions which need a calendar object when there actually isn't a real
  46.    calendar yet.  CalendarNull can be used to implement the null object
  47.    design pattern.  Instead of passing a 0 pointer and checking for 0 with
  48.    each access a CalendarNull object can be passed.
  49. */
  50. class LIBKCAL_EXPORT CalendarNull : public Calendar
  51. {
  52.   public:
  53.     /**
  54.        Constructor.
  55.     */
  56.     CalendarNull( const QString &timeZoneId );
  57.  
  58.     /**
  59.        Destructor.
  60.     */
  61.     ~CalendarNull() {}
  62.  
  63.     /**
  64.        Returns a pointer to a CalendarNull object, which is constructed
  65.        if necessary.
  66.     */
  67.     static CalendarNull *self();
  68.  
  69.     /**
  70.        Clears out the current Calendar, freeing all used memory etc.
  71.     */
  72.     void close() {}
  73.  
  74.     /**
  75.        Sync changes in memory to persistant storage.
  76.     */
  77.     void save() {}
  78.  
  79.     bool reload( const QString & ) { return true;}
  80.     
  81. // Event Specific Methods //
  82.  
  83.     /**
  84.        Insert an Evenet into the Calendar.
  85.  
  86.        First parameter is a pointer to the Event to insert.
  87.  
  88.        Returns false.
  89.     */
  90.     bool addEvent( Event * /*event*/ )
  91.       { return false; }
  92.  
  93.     /**
  94.        Remove an Event from the Calendar.
  95.  
  96.        First parameter is a pointer to the Event to remove.
  97.  
  98.        Returns false.
  99.     */
  100.     bool deleteEvent( Event * /*event*/ )
  101.       { return false; }
  102.  
  103.     /**
  104.        Return a sorted, unfiltered list of all Events for this Calendar.
  105.  
  106.        First parameter specifies the EventSortField.\n
  107.        Second parameter specifies the SortDirection.
  108.  
  109.        Returns an empty Event List.
  110.     */
  111.     Event::List rawEvents( EventSortField /*sortField*/,
  112.                            SortDirection /*sortDirection*/ )
  113.       { return Event::List(); }
  114.  
  115.     /**
  116.        Return an unfiltered list of all Events occurring within a date range.
  117.  
  118.        First parameter is the starting date.\n
  119.        Second parameter is the ending date.\n
  120.        Third parameter, if true, specifies that only Events which are
  121.        completely included within the date range are returned.
  122.  
  123.        Returns an empty Event List.
  124.     */
  125.     Event::List rawEvents( const QDate & /*start*/, const QDate & /*end*/,
  126.                            bool /*inclusive*/ )
  127.       { return Event::List(); }
  128.  
  129.     /**
  130.        Return an unfiltered list of all Events which occur on the given
  131.        timestamp.
  132.  
  133.        First parameter is a QDateTime to return unfiltered events for.
  134.  
  135.        Returns an empty Event List.
  136.     */
  137.     Event::List rawEventsForDate( const QDateTime & /*qdt*/ )
  138.       { return Event::List(); }
  139.  
  140.     /**
  141.        Return a sorted, unfiltered list of all Events which occur on the given
  142.        date.  The Events are sorted according to @a sortField and
  143.        @a sortDirection.
  144.  
  145.        First parameter is a QDate to return unfiltered Events for.\n
  146.        Second parameter specifies the EventSortField.\n
  147.        Third parameter specifies the SortDirection.
  148.  
  149.        Returns an empty Event List.
  150.     */
  151.     Event::List rawEventsForDate(
  152.       const QDate & /*date*/,
  153.       EventSortField /*sortField=EventSortUnsorted*/,
  154.       SortDirection /*sortDirection=SortDirectionAscending*/ )
  155.       { return Event::List(); }
  156.  
  157.     /**
  158.        Returns the Event associated with the given unique identifier.
  159.  
  160.        First parameter is a unique identifier string.
  161.  
  162.        Return a null Event pointer.
  163.     */
  164.     Event *event( const QString & /*uid*/ )
  165.       { return 0; }
  166.  
  167. // Todo Specific Methods //
  168.  
  169.     /**
  170.        Insert a Todo into the Calendar.
  171.  
  172.        First parameter is a pointer to the Todo to insert.
  173.  
  174.        Returns false.
  175.     */
  176.     bool addTodo( Todo * /*todo*/ )
  177.       { return false; }
  178.  
  179.     /**
  180.        Remove a Todo from the Calendar.
  181.  
  182.        First parameter is a pointer to the Todo to remove.
  183.  
  184.        Returns false.
  185.     */
  186.     bool deleteTodo( Todo * /*todo*/ )
  187.       { return false; }
  188.  
  189.     /**
  190.        Return a sorted, unfiltered list of all Todos for this Calendar.
  191.  
  192.        First parameter specifies the TodoSortField.\n
  193.        Second parameter specifies the SortDirection.
  194.  
  195.        Returns an empty Todo List.
  196.     */
  197.     Todo::List rawTodos( TodoSortField /*sortField*/,
  198.                          SortDirection /*sortDirection*/ )
  199.       { return Todo::List(); }
  200.  
  201.     /**
  202.        Return an unfiltered list of all Todos for this Calendar which
  203.        are due on the specifed date.
  204.  
  205.        First parameter is the due date to return unfiltered Todos for.
  206.  
  207.        Returns an empty Todo List.
  208.     */
  209.     Todo::List rawTodosForDate( const QDate & /*date*/ )
  210.       { return Todo::List(); }
  211.  
  212.     /**
  213.        Returns the Todo associated with the given unique identifier.
  214.  
  215.        First parameter is a unique identifier string.
  216.  
  217.        Returns a null Todo pointer.
  218.     */
  219.     Todo *todo( const QString & /*uid*/ )
  220.       { return 0; }
  221.  
  222. // Journal Specific Methods //
  223.  
  224.     /**
  225.        Insert a Journal into the Calendar.
  226.  
  227.        First parameter is a pointer to the Journal to insert.
  228.  
  229.        Returns false.
  230.     */
  231.     bool addJournal( Journal * /*journal*/ )
  232.       { return false; }
  233.  
  234.     /**
  235.        Remove a Journal from the Calendar.
  236.  
  237.        First parameter is a pointer to the Journal to remove.
  238.  
  239.        Returns false.
  240.     */
  241.     bool deleteJournal( Journal * /*journal*/ )
  242.       { return false; }
  243.  
  244.     /**
  245.        Return a sorted, filtered list of all Journals for this Calendar.
  246.  
  247.        First parameter specifies the JournalSortField.\n
  248.        Second parameterd specifies the SortDirection.
  249.  
  250.        Returns an empty Journal List.
  251.     */
  252.     Journal::List rawJournals( JournalSortField /*sortField*/,
  253.                                SortDirection /*sortDirection*/ )
  254.       { return Journal::List(); }
  255.  
  256.     /**
  257.        Return an unfiltered list of all Journals for on the specifed date.
  258.  
  259.        First parameter specifies the data to return the unfiltered Journals for.
  260.  
  261.        Returns an empty Journal List.
  262.     */
  263.     Journal::List rawJournalsForDate( const QDate & /*date*/ )
  264.       { return Journal::List(); }
  265.  
  266.     /**
  267.        Returns the Journal associated with the given unique identifier.
  268.  
  269.        First parameter is a unique identifier string.
  270.  
  271.        Returns an null Journal pointer.
  272.     */
  273.     Journal *journal( const QString & /*uid*/ )
  274.       { return 0; }
  275.  
  276. // Alarm Specific Methods //
  277.  
  278.     /**
  279.        Return a list of Alarms within a time range for this Calendar.
  280.  
  281.        First parameter is the starting timestamp.\n
  282.        Second parameter is the ending timestamp.
  283.  
  284.        Returns an empty Alarm List.
  285.     */
  286.  
  287.     Alarm::List alarms( const QDateTime & /*from*/, const QDateTime & /*to*/ )
  288.       { return Alarm::List(); }
  289.  
  290. // Observer Specific Methods //
  291.  
  292.     /**
  293.        The Observer interface. So far not implemented.
  294.        First parameter is a pointer an IncidenceBase object.
  295.     */
  296.     void incidenceUpdated( IncidenceBase * /*incidenceBase*/ ) {}
  297.  
  298.     void setTimeZoneIdViewOnly( const QString& ) {};
  299.     
  300.   private:
  301.     static CalendarNull *mSelf;
  302.  
  303.     class Private;
  304.     Private *d;
  305. };
  306.  
  307. }
  308.  
  309. #endif
  310.