00001 #ifndef _VCARD_VCAL_H
00002 #define _VCARD_VCAL_H
00003
00004 #include "ScribeDefs.h"
00005 #include "Store3.h"
00006 #include "GToken.h"
00007
00008 #define FIELD_PERMISSIONS 2000
00009
00010 class VIoPriv;
00011 class VIo
00012 {
00013 protected:
00014 class TypesList : public GArray<GAutoString>
00015 {
00016 public:
00017 TypesList(char *init = 0)
00018 {
00019 if (init)
00020 {
00021 GToken t(init, ",");
00022 for (int i=0; i<t.Length(); i++)
00023 New().Reset(NewStr(t[i]));
00024 }
00025 }
00026
00027 bool Find(char *s)
00028 {
00029 for (int i=0; i<Length(); i++)
00030 {
00031 if (stricmp((*this)[i], s) == 0)
00032 return true;
00033 }
00034 return false;
00035 }
00036
00037 void Empty()
00038 {
00039 Length(0);
00040 }
00041 };
00042
00043 VIoPriv *d;
00044
00045 bool ParseDate(GDateTime &out, char *in);
00046 bool ParseDuration(GDateTime &Out, int &Sign, char *In);
00047
00048 void Fold(GStreamI &o, char *i, int pre_chars = 0);
00049 char *Unfold(char *In);
00050 char *UnMultiLine(char *In);
00051
00052 bool ReadField(GStreamI &s, char **Name, TypesList *Type, char **Data);
00053 void WriteField(GStreamI &s, char *Name, TypesList *Type, char *Data);
00054
00055 public:
00056 VIo();
00057 ~VIo();
00058 };
00059
00060 class VCard : public VIo
00061 {
00062 public:
00063 bool Import(GDataPropI *c, GStreamI *s);
00064 bool Export(GDataPropI *c, GStreamI *s);
00065 };
00066
00067 class VCal : public VIo
00068 {
00069 public:
00070 bool Import(GDataPropI *c, GStreamI *s);
00071 bool Export(GDataPropI *c, GStreamI *s);
00072 };
00073
00074 #endif