00001 #ifndef _VCARD_VCAL_H
00002 #define _VCARD_VCAL_H
00003
00004 #include "GToken.h"
00005 #include "GDateTime.h"
00006 #include "ScribeDefs.h"
00007 #include "GMap.h"
00008
00009 #define FIELD_PERMISSIONS 2000
00010
00011 class VObject
00012 {
00013 public:
00014
00015 bool CanDirty;
00016
00017 VObject()
00018 {
00019 CanDirty = true;
00020 }
00021
00022
00023 virtual bool SetField(int Field, int n ) = 0;
00024 virtual bool SetField(int Field, double n ) = 0;
00025 virtual bool SetField(int Field, char *n ) = 0;
00026 virtual bool SetField(int Field, GDateTime &n ) = 0;
00027 virtual bool GetField(int Field, int &n ) = 0;
00028 virtual bool GetField(int Field, double &n ) = 0;
00029 virtual bool GetField(int Field, char *&n ) = 0;
00030 virtual bool GetField(int Field, GDateTime &n ) = 0;
00031
00032
00033
00034
00035 virtual bool GetAttendees(List<VObject> &a) { return false; }
00036 virtual VObject *CreateAttendee() { return 0; }
00037 };
00038
00039 class VIo
00040 {
00041 protected:
00042 List<char> Object;
00043 GToken Var;
00044 GToken Type;
00045 GToken Value;
00046 GMap<char*,char*> Variables;
00047
00048 bool IsTyped();
00049 bool IsEncoded();
00050 bool IsBeginEnd();
00051 bool IsVar(char *a, char *b = 0);
00052 bool IsType(char *type);
00053 bool IsValue(char *value);
00054 bool IsObject(char *Obj);
00055
00056 bool ParseDate(GDateTime &out, char *in);
00057 bool ParseDuration(GDateTime &Out, int &Sign, char *In);
00058
00059 void Fold(GStringPipe &o, char *i);
00060 char *Unfold(char *In);
00061 char *UnMultiLine(char *In);
00062
00063 public:
00064 ~VIo();
00065 };
00066
00067 class VCard : public VIo
00068 {
00069 VObject *c;
00070
00071 public:
00072 VCard(VObject *t)
00073 {
00074 c = t;
00075 }
00076
00077 bool Import(char *Text);
00078 char *Export();
00079 };
00080
00081 class VCal : public VIo
00082 {
00083 VObject *c;
00084
00085 public:
00086 VCal(VObject *t)
00087 {
00088 c = t;
00089 }
00090
00091 bool Import(char *Text);
00092 char *Export();
00093 };
00094
00095 #endif