libopie PIM API Documentation

orecur.h

Go to the documentation of this file.
00001 /*
00002  * GPL from TT
00003  */
00004 
00005 #ifndef OPIE_RECUR_H
00006 #define OPIE_RECUR_H
00007 
00008 #include <sys/types.h>
00009 
00010 #include <qdatetime.h>
00011 #include <qvaluelist.h>
00012 #include <qmap.h>
00013 
00014 
00019 class ORecur {
00020 public:
00021     typedef QValueList<QDate> ExceptionList;
00022     enum RepeatType{ NoRepeat = -1, Daily, Weekly, MonthlyDay,
00023                      MonthlyDate, Yearly };
00024     enum Days { MON = 0x01, TUE = 0x02, WED = 0x04, THU = 0x08,
00025                 FRI = 0x10, SAT = 0x20, SUN = 0x40 };
00026     enum Fields{ RType = 0, RWeekdays, RPosition, RFreq, RHasEndDate, 
00027          EndDate, Created, Exceptions };
00028 
00029     ORecur();
00030     ORecur( const QMap<int, QString>& map );
00031     ORecur( const ORecur& );
00032     ~ORecur();
00033 
00034     ORecur &operator=( const ORecur& );
00035     bool operator==(const ORecur& )const;
00036 
00037     bool doesRecur()const;
00038     /* if it recurrs on that day */
00039     bool doesRecur( const QDate& );
00040     RepeatType type()const;
00041     int frequency()const;
00042     int position()const;
00043     char days()const;
00044     bool hasEndDate()const;
00045     QDate start()const;
00046     QDate endDate()const;
00047     QDateTime createdDateTime()const;
00052     bool repeatOnWeekDay( int day )const;
00053 
00057     bool nextOcurrence( const QDate& FromWhereToStart, QDate &recurDate );
00058 
00062     QString service()const;
00063 
00064     /*
00065      * reference to the exception list
00066      */
00067     ExceptionList &exceptions();
00068 
00072     int repetition()const;
00073 
00074     void setType( const RepeatType& );
00075     void setFrequency( int freq );
00076     void setPosition( int pos );
00077     void setDays( char c);
00078     void setEndDate( const QDate& dt );
00079     void setStart( const QDate& dt );
00080     void setCreatedDateTime( const QDateTime& );
00081     void setHasEndDate( bool b );
00082     void setRepitition(int );
00083 
00084     void setService( const QString& ser );
00085     
00086     QMap<int, QString> toMap() const;
00087     void fromMap( const QMap<int, QString>& map );
00088 
00089     /* almost internal */
00090     QString toString()const;
00091 private:
00092     bool p_nextOccurrence( const QDate& from, QDate& next );
00093     void deref();
00094     inline void checkOrModify();
00095 
00096     /* Converts rType to String */
00097     QString rTypeString() const;
00098     /* Returns a map to convert Stringname for RType to RepeatType */
00099     QMap<QString, RepeatType> rTypeValueConvertMap() const;
00100 
00101     class Data;
00102     Data* data;
00103     class ORecurPrivate;
00104     ORecurPrivate *d;
00105 };
00106 
00107 #endif
KDE Logo
This file is part of the documentation for OPIE Version 1.1.
Documentation copyright © 1997-2003 the KDE developers. 2003 OPIE developers
Generated on Tue Feb 10 20:25:21 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001