/*
 * $Id: calEvent.h,v 1.1.1.1 2005/01/17 18:06:31 ksltuf Exp $
 *
 * Tag: $Name:  $
 *
 * See the file COPYRIGHT for copyright information
 *
 * $Log: calEvent.h,v $
 * Revision 1.1.1.1  2005/01/17 18:06:31  ksltuf
 * PIM-Plugin 0.0.4
 *
 * Revision 1.2  2004/07/05 19:00:26  ksltuf
 * Added COPYRIGHT and cvs information
 *
 *
 */


#ifndef __CALEVENT_H_
#define __CALEVENT_H_

#include <vector>

#include <vdr/tools.h>

typedef std::vector<int> tEventIds;

#define MAX_EVENT_NAME 30

enum eCalEventType { evFixedDay,
	             evWeekly,
		     evYearly,
		     evUnknown
                   };

class cCalEvent : public cListObject
{

 friend class cEventEditMenu;

 private:

  static char* _buffer;


  int _id;

  int _day;
  int _month;
  int _year;

  int _dayOfWeek;

  char *_text;

  eCalEventType _type;

  void init();

  char* toString();

 public:
  
  static int uniqueId;

  cCalEvent();
  
  cCalEvent(int day, int month, int year, char* text);
  
  cCalEvent(int day, int month, char* text);

  cCalEvent(int dayOfWeek, char* text);

  ~cCalEvent();

  // deep assignment
  cCalEvent& operator= (const cCalEvent& ev);

  bool isValid() const;

  bool isValidDay() const;

  bool isValidMonth() const;

  bool isValidYear() const;

  bool isValidDayOfWeek() const;

  bool validForDay (int day, int month, int year, int dayOfWeek);
  
  char* getText() const;

  char* getLongText() const;

  int getId() const;

  void print();

  // from cConfig
  bool Parse(const char* s);
  bool Save(FILE *f);

};

#endif
