This commit is contained in:
dmose%mozilla.org 1999-11-02 06:13:48 +00:00
Родитель 5ba3f2f0b9
Коммит 2492d0cbd2
369 изменённых файлов: 0 добавлений и 93185 удалений

Просмотреть файл

@ -1,311 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2
-*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* capi.h
*
* sman
* 30-Jun-98
*/
#ifndef __JULIAN_LOCAL_CAPI_H
#define __JULIAN_LOCAL_CAPI_H
#include "jdefines.h"
#include <unistring.h>
#include "nscore.h"
#include "nscalexport.h"
typedef void* CAPISession;
typedef void* CAPIHandle;
typedef void* CAPIStream;
typedef long CAPIStatus;
#define CAPI_THISINSTANCE 1
#define CAPI_THISANDPRIOR 2
#define CAPI_THISANDFUTURE 3
#define CAPI_CALLBACK_CONTINUE 0
#define CAPI_CALLBACK_DONE -1
#if 0
#define CAPI_ERR_OK 0
#define CAPI_ERR_CALLBACK 1
#define CAPI_ERR_COMP_NOT_FOUND 2
#define CAPI_ERR_CORRUPT_HANDLE 3
#define CAPI_ERR_CORRUPT_SESSION 4
#define CAPI_ERR_CORRUPT_STREAM 5
#define CAPI_ERR_DATE 6
#define CAPI_ERR_DATE_RANGE 7
#define CAPI_ERR_EXPIRED 8
#define CAPI_ERR_FLAGS 9
#define CAPI_ERR_HOST 10
#define CAPI_ERR_INTERNAL 11
#define CAPI_ERR_IO 12
#define CAPI_ERR_NO_MEMORY 13
#define CAPI_ERR_NOT_IMPLEMENTED 14
#define CAPI_ERR_NULL_PARAMETER 15
#define CAPI_ERR_PROPERTIES_BLOCKED 16
#define CAPI_ERR_REQUIRED_PROPERTY_MISSING 17
#define CAPI_ERR_SECURITY 18
#define CAPI_ERR_SERVER 19
#define CAPI_ERR_UID 20
#define CAPI_ERR_USERNAME_PASSWORD 21
#endif
typedef int (*CAPICallback)(
void* pData, /* i: caller-defined data, the value */
/* supplied in CAPI_SetStreamCallbacks */
char* pBuf, /* i: buffer to read or write */
size_t iSize, /* i: the number of characters in pBuf */
size_t* piTransferred); /* o: the number of characters from pBuf that */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
NS_CALENDAR CAPIStatus CAPI_Capabilities(
const char** ppsVal, /* o: a string describing the capabilities */
const char* psHost, /* i: server host */
long lFlags ); /* i: bit flags (none at this time; set to 0) */
/* were processed. */
NS_CALENDAR CAPIStatus CAPI_DeleteEvent(
CAPISession s, /* i: login session handle */
CAPIHandle* pH, /* i: list of CAPIHandles for delete */
int iHandleCount, /* i: number of valid handles in ppH */
long lFlags, /* i: bit flags (none at this time; set to 0) */
char* psUID, /* i: UID of the event to delete */
char* dtRecurrenceID, /* i: recurrence-id, NULL means ignore */
int iModifier); /* i: one of CAPI_THISINSTANCE, */
/* CAPI_THISANDPRIOR, CAPI_THISANDFUTURE */
/* only valid if recurrence-id is non-NULL */
NS_CALENDAR CAPIStatus CAPI_DestroyHandles(
CAPISession s, /* i: login session handle */
CAPIHandle* pHList, /* i: pointer to a list of handles to destroy */
int iHandleCount, /* i: number of valid handles in pHList */
long lFlags); /* i: bit flags (none at this time; set to 0) */
NS_CALENDAR CAPIStatus CAPI_DestroyStreams(
CAPISession s, /* i: login session handle */
CAPIStream* pS, /* i: array of streams to destroy */
int iCount, /* i: number of valid handles in ppH */
long lFlags); /* i: bit flags (none at this time; set to 0) */
NS_CALENDAR CAPIStatus CAPI_FetchEventsByAlarmRange(
CAPISession s, /* i: login session handle */
CAPIHandle* pH, /* i: list of CAPIHandles for Fetch */
int iHandleCount, /* i: number of valid handles in ppH */
long lFlags, /* i: bit flags (none at this time; set to 0) */
char* dStart, /* i: range start time, ex: "19980704T080000Z" */
char* dEnd, /* i: range end time, ex: "19980704T180000Z" */
char** ppsPropList, /* i: list of properties to return in events */
int iPropCount, /* i: number of properties in *ppsPropList */
CAPIStream stream); /* i: stream to which solution set will be written */
NS_CALENDAR CAPIStatus CAPI_FetchEventsByID(
CAPISession s, /* i: login session handle */
CAPIHandle h, /* i: calendar from which to fetch events */
long lFlags, /* i: bit flags (none at this time; set to 0) */
char* psUID, /* i: UID of the event to fetch */
char* dtRecurrenceID, /* i: recurrence-id, NULL means ignore */
int iModifier, /* i: one of CAPI_THISINSTANCE, */
/* CAPI_THISANDPRIOR, CAPI_THISANDFUTURE */
/* only valid if recurrence-id is non-NULL */
char** ppsPropList, /* i: list of properties returned in events */
int iPropCount, /* i: number of properties in the list */
CAPIStream stream); /* i: stream to which solution set will be written */
NS_CALENDAR CAPIStatus CAPI_FetchEventsByRange(
CAPISession s, /* i: login session handle */
CAPIHandle* pH, /* i: list of CAPIHandles for fetch */
int iHandleCount, /* i: number of valid handles in ppH */
long lFlags, /* i: bit flags (none at this time; set to 0) */
char* dStart, /* i: range start time */
char* dEnd, /* i: range end time */
char** ppsPropList, /* i: list of properties returned in events */
int iPropCount, /* i: number of properties in the list */
CAPIStream stream); /* i: stream to which solution set will be written */
NS_CALENDAR CAPIStatus CAPI_GetHandle(
CAPISession s, /* i: login session handle */
char* u, /* i: user as defined in Login */
long lFlags, /* i: bit flags (none at this time; set to 0) */
CAPIHandle* pH); /* o: handle */
NS_CALENDAR CAPIStatus CAPI_Logoff(
CAPISession* s, /* io: session from login */
long lFlags); /* i: bit flags (none at this time; set to 0) */
NS_CALENDAR CAPIStatus CAPI_Logon(
const char* psUser, /* i: Calendar store (and ":extra" information ) */
const char* psPassword, /* i: password for sUser */
const char* psHost, /* i: calendar server host (and :port) */
long lFlags, /* i: bit flags (none at this time; set to 0) */
CAPISession* pSession); /* o: the session */
NS_CALENDAR CAPIStatus CAPI_SetStreamCallbacks (
CAPISession s, /* i: login session handle */
CAPIStream* pStream, /* io: The stream to modify */
CAPICallback pfnSndCallback,/* i: Snd iCalendar data */
void* userDataSnd, /* i: a user supplied value */
CAPICallback pfnRcvCallback,/* i: Rcv iCalendar data */
void* userDataRcv, /* i: a user supplied value */
long lFlags ); /* i: bit flags (none at this time; set to 0) */
NS_CALENDAR CAPIStatus CAPI_StoreEvent(
CAPISession s, /* i: login session handle */
CAPIHandle* pH, /* i: list of CAPIHandles for store */
int iHandleCount, /* i: number of valid handles in pH */
long lFlags, /* i: bit flags (none at this time; set to 0) */
CAPIStream stream ); /* i: stream for reading data to store */
/*
* NETSCAPE EXTENSIONS TO CAPI
*/
NS_CALENDAR CAPIStatus CAPI_LogonCurl(
const char* psCurl, /* i: Calendar store (and ":extra" information ) */
const char* psPassword, /* i: password for sUser */
long lFlags, /* i: bit flags (none at this time; set to 0) */
CAPISession* pSession); /* o: the session */
#ifdef __cplusplus
}
#endif
/* The ok error */
#define CAPI_ERR_OK ((CAPIStatus) 0x00)
/* Masks for checking for fields of error codes */
#define CAPI_ERRMASK_MODE_FIELD ((CAPIStatus) 0xFF << 24)
#define CAPI_ERRMASK_TYPE_FIELD ((CAPIStatus) 0x1F << 19)
#define CAPI_ERRMASK_ERR1_FIELD ((CAPIStatus) 0x1F << 14)
#define CAPI_ERRMASK_ERR2_FIELD ((CAPIStatus) 0x3F << 8)
#define CAPI_ERRMASK_VENDOR_FIELD ((CAPIStatus) 0xFF)
/* Masks for checking for errors at various levels */
#define CAPI_ERRMASK_TYPE ((CAPIStatus) CAPI_ERRMASK_TYPE_FIELD)
#define CAPI_ERRMASK_ERR1 ((CAPIStatus) CAPI_ERRMASK_TYPE + CAPI_ERRMASK_ERR1_FIELD)
#define CAPI_ERRMASK_ERR2 ((CAPIStatus) CAPI_ERRMASK_ERR1 + CAPI_ERRMASK_ERR2_FIELD)
#define CAPI_ERRMASK_VENDOR ((CAPIStatus) CAPI_ERRMASK_ERR2 + CAPI_ERRMASK_VENDOR_FIELD)
/* The non fatal error bit */
#define CAPI_ERRMODE_FATAL ((CAPIStatus) 0x1 << 24))
/* The various error types (field 2) */
#define CAPI_ERRTYPE_DATA ((CAPIStatus) 0x1 << 19)
#define CAPI_ERRTYPE_SERVICE ((CAPIStatus) 0x2 << 19)
#define CAPI_ERRTYPE_API ((CAPIStatus) 0x3 << 19)
#define CAPI_ERRTYPE_SECURITY ((CAPIStatus) 0x4 << 19)
#define CAPI_ERRTYPE_LIBRARY ((CAPIStatus) 0x5 << 19)
/* Data errors */
/* field 3 values */
#define CAPI_ERR1_ICAL ((CAPIStatus) CAPI_ERRTYPE_DATA + (0x1 << 14 ))
#define CAPI_ERR1_MIME ((CAPIStatus) CAPI_ERRTYPE_DATA + (0x2 << 14 ))
#define CAPI_ERR1_DATE ((CAPIStatus) CAPI_ERRTYPE_DATA + (0x3 << 14 ))
#define CAPI_ERR1_ID ((CAPIStatus) CAPI_ERRTYPE_DATA + (0x4 << 14 ))
/* field 4 values */
#define CAPI_ERR2_MIME_NONE ((CAPIStatus) CAPI_ERR1_MIME + (0x1 << 8))
#define CAPI_ERR2_MIME_NOICAL ((CAPIStatus) CAPI_ERR1_MIME + (0x2 << 8))
#define CAPI_ERR2_DATE_RANGE ((CAPIStatus) CAPI_ERR1_DATE + (0x1 << 8))
#define CAPI_ERR2_DATE_FORMAT ((CAPIStatus) CAPI_ERR1_DATE + (0x2 << 8))
#define CAPI_ERR2_ID_USERID ((CAPIStatus) CAPI_ERR1_ID + (0x1 << 8))
#define CAPI_ERR2_ID_HOSTNAME ((CAPIStatus) CAPI_ERR1_ID + (0x2 << 8))
/* field 5 values (Vendor specific errors) */
#define CAPI_ERR_IDUSERID_INIFILE ((CAPIStatus) CAPI_ERR2_ID_USERID + 0x01)
#define CAPI_ERR_IDUSERID_FORMAT ((CAPIStatus) CAPI_ERR2_ID_USERID + 0x02)
#define CAPI_ERR_IDUSERID_NONE ((CAPIStatus) CAPI_ERR2_ID_USERID + 0x03)
#define CAPI_ERR_IDUSERID_MANY ((CAPIStatus) CAPI_ERR2_ID_USERID + 0x04)
#define CAPI_ERR_IDUSERID_NODE ((CAPIStatus) CAPI_ERR2_ID_USERID + 0x05)
/*
* Service errors
*/
/* field 3 values */
#define CAPI_ERR1_MEMORY ((CAPIStatus) CAPI_ERRTYPE_SERVICE + (0x1 << 14 ))
#define CAPI_ERR1_FILE ((CAPIStatus) CAPI_ERRTYPE_SERVICE + (0x2 << 14 ))
#define CAPI_ERR1_NETWORK ((CAPIStatus) CAPI_ERRTYPE_SERVICE + (0x3 << 14 ))
/* field 4 values */
#define CAPI_ERR2_NETWORK_TIMEOUT ((CAPIStatus) CAPI_ERR1_NETWORK + (0x1 << 8))
/*
* API errors
*/
/* field 3 values */
#define CAPI_ERR1_FLAGS ((CAPIStatus) CAPI_ERRTYPE_API + (0x1 << 14))
#define CAPI_ERR1_NULLPARAM ((CAPIStatus) CAPI_ERRTYPE_API + (0x2 << 14))
#define CAPI_ERR1_CALLBACK ((CAPIStatus) CAPI_ERRTYPE_API + (0x3 << 14))
#define CAPI_ERR1_HANDLE ((CAPIStatus) CAPI_ERRTYPE_API + (0x4 << 14))
#define CAPI_ERR1_SESSION ((CAPIStatus) CAPI_ERRTYPE_API + (0x5 << 14))
#define CAPI_ERR1_STREAM ((CAPIStatus) CAPI_ERRTYPE_API + (0x6 << 14))
/* field 4 values */
#define CAPI_ERR2_HANDLE_NULL ((CAPIStatus) CAPI_ERR1_HANDLE + (0x1 << 8))
#define CAPI_ERR2_HANDLE_BAD ((CAPIStatus) CAPI_ERR1_HANDLE + (0x2 << 8))
#define CAPI_ERR2_SESSION_NULL ((CAPIStatus) CAPI_ERR1_SESSION + (0x1 << 8))
#define CAPI_ERR2_SESSION_BAD ((CAPIStatus) CAPI_ERR1_SESSION + (0x2 << 8))
#define CAPI_ERR2_STREAM_NULL ((CAPIStatus) CAPI_ERR1_STREAM + (0x1 << 8))
#define CAPI_ERR2_STREAM_BAD ((CAPIStatus) CAPI_ERR1_STREAM + (0x2 << 8))
/*
* Security errors
*/
/* field 3 values */
#define CAPI_ERR1_READ ((CAPIStatus) CAPI_ERRTYPE_SECURITY + (0x1 << 14))
#define CAPI_ERR1_WRITE ((CAPIStatus) CAPI_ERRTYPE_SECURITY + (0x2 << 14))
/* field 4 values */
#define CAPI_ERR2_READ_PROPS ((CAPIStatus) CAPI_ERR1_READ + (0x1 << 8))
#define CAPI_ERR2_WRITE_AGENDA ((CAPIStatus) CAPI_ERR1_WRITE + (0x1 << 8))
#define CAPI_ERR2_WRITE_EVENT ((CAPIStatus) CAPI_ERR1_WRITE + (0x2 << 8))
/*
* Library errors
*/
/* field 3 values */
#define CAPI_ERR1_INTERNAL ((CAPIStatus) CAPI_ERRTYPE_LIBRARY + (0x1 << 14))
#define CAPI_ERR1_IMPLENTATION ((CAPIStatus) CAPI_ERRTYPE_LIBRARY + (0x2 << 14))
/* field 4 values */
#define CAPI_ERR2_INTERNALEXPIRY ((CAPIStatus) CAPI_ERR_INTERNAL + (0x1 << 8))
#endif /* __JULIAN_LOCAL_CAPI_H */

Просмотреть файл

@ -1,60 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2
-*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/**
*** Private CAPI header file.
*** Defines the opaque types.
**/
#ifndef __JULIAN_PRIVATE_CAPI_H
#define __JULIAN_PRIVATE_CAPI_H
#include "nsString.h"
#include "xp_mcom.h"
#include "jdefines.h"
#include "julnstr.h"
#include "nspr.h"
#include "plstr.h"
#include "nsCurlParser.h"
typedef struct
{
nsCurlParser* pCurl;
char* psUser; /* i: Calendar store (and ":extra" information ) */
char* psPassword; /* i: password for sUser */
char* psHost; /* i: calendar server host (and :port) */
} PCAPISESSION;
typedef struct
{
PCAPISESSION *pSession;
char* psFile;
nsCurlParser* pCurl;
} PCAPIHANDLE;
typedef struct
{
CAPICallback pfnSndCallback; /* i: Snd iCalendar data */
void* pCallerSndDataBuf; /* i: Data buffer pointer Snd function */
void* userDataRcv; /* i: a user supplied value */
CAPICallback pfnRcvCallback; /* i: Rcv iCalendar data */
void* userDataSnd; /* i: a user supplied value */
long lFlags; /* i: bit flags (none at this time; set to 0) */
} PCAPIStream;
#endif /* __JULIAN_PRIVATE_CAPI_H */

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,106 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef _JULIAN_FORMS_H
#define _JULIAN_FORMS_H
#include "julianform.h"
#include "julnstr.h"
class JULIAN_PUBLIC JulianServerProxy
{
public:
ICalComponent* ic;
JulianServerProxy() {};
virtual ~JulianServerProxy() {};
ICalComponent* getByUid(char *uid) { return ic; };
void setICal(ICalComponent* i) { ic = i; };
};
#include "formFactory.h"
typedef struct
{
char* type;
char* data;
} form_data_combo;
class JULIAN_PUBLIC JulianForm
{
private:
JulianString htmlForm;
char* mimedata;
char buttonLabel[2048];
NSCalendar* imipCal;
pJulian_Form_Callback_Struct JulianForm_CallBacks;
/* added 7-7-98 */
static XP_Bool ms_bFoundNLSDataDirectory;
JulianFormFactory* jff;
public:
JulianForm();
virtual ~JulianForm();
int32 refcount; /* Who's looking at this */
int32 formDataCount; /* number of pointers in formData */
PRMonitor * my_monitor;
/* number of possible pointers in formData */
#define formDataIndex 10
form_data_combo formData[formDataIndex]; /* a pointer to an array of pointers that point to a type/data string */
char* contextName;
XP_Bool StartHTML();
char* getHTMLForm(XP_Bool Want_Detail, NET_StreamClass *this_stream = nil);
void setMimeData(char *mimedata);
void setCallbacks(pJulian_Form_Callback_Struct callBacks) { JulianForm_CallBacks = callBacks; };
pJulian_Form_Callback_Struct getCallbacks() { return JulianForm_CallBacks; };
void setCalendar(NSCalendar* newCal) { imipCal = newCal; }
NSCalendar * getCalendar() { return imipCal; }
JulianPtrArray * getEvents() { if (imipCal) { return imipCal->getEvents(); } else return 0; }
/* added 7-7-98 */
static void setFoundNLSDataDirectory(XP_Bool bFound) { ms_bFoundNLSDataDirectory = bFound; }
static XP_Bool isFoundNLSDataDirectory() { return ms_bFoundNLSDataDirectory; }
MWContext* getContext() { return (*JulianForm_CallBacks->FindNamedContextInList)((*JulianForm_CallBacks->FindSomeContext)(), contextName); }
XP_Bool hasComment() { return getComment() != nil; }
char* getComment();
char* getDelTo();
char* getLabel() { return buttonLabel; }
void setLabel(char *newlabel) { if (newlabel) XP_STRCPY(buttonLabel, newlabel); if (getCallbacks() && getCallbacks()->PlusToSpace) (*getCallbacks()->PlusToSpace)(buttonLabel); }
};
XP_BEGIN_PROTOS
JulianForm* jform_CreateNewForm (char *calendar_mime_data, pJulian_Form_Callback_Struct callbacks, XP_Bool bFoundNLSDataDirectory);
void jform_DeleteForm (JulianForm *jf);
char* jform_GetForm (JulianForm *jf);
void jform_CallBack (JulianForm *jf, char *type);
XP_END_PROTOS
#endif

Просмотреть файл

@ -1,530 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef _JULIAN_FormFactory_H
#define _JULIAN_FormFactory_H
#include "jdefines.h"
#include "julnstr.h"
class JulianForm;
#if defined(XP_PC)
#pragma warning ( disable : 4251 )
#endif
const int32 jff_clip_events = 50;
class JULIAN_PUBLIC JulianFormFactory
{
friend class JulianForm;
public:
JulianFormFactory();
JulianFormFactory(NSCalendar& imipCal);
JulianFormFactory(NSCalendar& imipCal, JulianServerProxy* jsp);
JulianFormFactory(NSCalendar& imipCal, JulianForm& hostForm, pJulian_Form_Callback_Struct callbacks);
/*
** Call init before calling getHTML()
*/
void init();
virtual ~JulianFormFactory();
/*
** Returns a new UnicodeString with html that is intended to be enclosed in a real html file.
** Call is responable for disposing of the returned UnicodeString.
*/
XP_Bool getHTML(JulianString* htmlstorage, XP_Bool want_detail = FALSE);
XP_Bool getHTML(JulianString* OutString, NET_StreamClass *this_stream, XP_Bool want_detail = FALSE);
/*
** Sets the base NSCalendar.
*/
void setNSCalendar(NSCalendar& newCalendar) { firstCalendar = &newCalendar; }
/*
** These are the different form button types. The call back url will list
** as it's first thing the type = the name.
*/
static JulianString Buttons_Details_Type;
static JulianString Buttons_Add_Type;
static JulianString Buttons_Close_Type;
static JulianString Buttons_Accept_Type;
static JulianString Buttons_Decline_Type;
static JulianString Buttons_Tentative_Type;
static JulianString Buttons_SendFB_Type;
static JulianString Buttons_SendRefresh_Type;
static JulianString Buttons_DelTo_Type;
static JulianString CommentsFieldName;
static JulianString DelToFieldName;
static JulianString SubjectSep;
private:
NSCalendar* firstCalendar; // Base NSCalendar
ICalComponent* thisICalComp; // Current vEnvent or vFreeBusy that is being made into html
ICalComponent* serverICalComp; // Current Database Version vEnvent or vFreeBusy that is being made into html
XP_Bool detail;
JulianString* s; // Holds the html that is being built up.
JulianForm* jf;
JulianServerProxy* ServerProxy; // How to get to the server
int32 maxical; // # of vevetns otr vfreebusy in the array
int32 aref_count; // For muiltevent table of contents
int32 aref2_count; // For muiltevent each form. must be in sync with aref_count
pJulian_Form_Callback_Struct cb;// How to call code to create urls for the buttons
NET_StreamClass *outStream; // Could be streamed output. Optional
XP_Bool do_capi_login; // Default is not to ask for capi login info
// Use by the freebusy table. In order.
enum FB_State {
Empty_State,
Free_State,
XParam_State,
Busy_State
};
nsCalDuration MinutesPerSlot;
int32 SlotsPerHour;
XP_Bool displayTimeZone;
int32 scaleType; // 1 = days 1 to 31, 2 = hours 0 to 24
int32 slotsacross;
int32 hoursToDisplay; // 1 to 24. default is 24 hours
FB_State state; // For free, busy, skip state
FB_State new_state;
int32 count;
JulianString tz;
JulianString uTemp;
JulianString lineFormat;
char* TimeHour_HTML;
int32 start_hour;
int32 end_hour;
DateTime start;
DateTime end;
TimeZone* default_tz;
Period* p;
Freebusy* fb;
int32 fbIndex;
int32 pIndex;
JulianPtrArray* pv;
JulianPtrArray* fbv;
// These bools show what types of ical objects are being used in this message
XP_Bool isEvent;
XP_Bool isFreeBusy;
void SetDetail(XP_Bool newDetail) { detail = newDetail; };
XP_Bool isDetail() { return detail;};
XP_Bool isPreProcessed(JulianString& icalpropstr) { return (ICalPreProcess.IndexOf(icalpropstr.GetBuffer(), 0) >= 0); };
XP_Bool isPostProcessed(JulianString& icalpropstr) { return (ICalPostProcess.IndexOf(icalpropstr.GetBuffer(), 0) >= 0); };
JulianString * doARef(JulianString& refText, JulianString& refTarget, JulianString* outputString);
JulianString * doFont(JulianString& fontText, JulianString* outputString);
JulianString * doItalic(JulianString& ItalicText, JulianString* outputString);
JulianString * doBold(JulianString& BoldText, JulianString* outputString);
JulianString * doBold(char* BoldText, JulianString* outputString);
void doAddHTML(UnicodeString & moreHtml) { char*y = moreHtml.toCString(""); if (y) {*s += y; delete y;} flush_stream(); };
void doAddHTML(JulianString & moreHtml) { *s += moreHtml; flush_stream();};
void doAddHTML(JulianString * moreHtml) { *s +=*moreHtml; flush_stream();};
void doAddHTML(char* moreHtml) { *s += moreHtml; flush_stream();};
int32 flush_stream();
void doPreProcessing(char* icalpropstr);
void doPreProcessingDateTime(JulianString & icalpropstr, XP_Bool allday, DateTime &start, DateTime &end, ICalComponent &ic);
void doPreProcessingAttend(ICalComponent &ic);
void doPreProcessingOrganizer(ICalComponent &ic);
void doDifferenceProcessing(JulianString icalpropstr);
void doDifferenceProcessingAttendees();
void doHeaderMuiltStart();
void doHeaderMuilt();
void doHeaderMuiltEnd();
void doProps(int32 labelCount, JulianString labels[], int32 dataCount, JulianString data[]);
void doHeader(JulianString HeaderText);
void doClose();
void doStatus();
void doSingleTableLine(JulianString & labelString, JulianString & dataString, XP_Bool addSpacer = TRUE);
void doCommentText();
JulianString doCreateButton(JulianString InputType, JulianString ButtonName, XP_Bool addtextField = FALSE);
void doAddGroupButton(JulianString GroupButton_HTML);
void doAddButton(JulianString SingleButton_HTML);
void doMakeFreeBusyTable();
void HandleError();
void HandlePublishVEvent();
void HandlePublishVFreeBusy(XP_Bool isPublish);
void HandleRequestVEvent();
void HandleRequestVFreeBusy();
void HandleEventReplyVEvent();
void HandleEventCancelVEvent();
void HandleEventRefreshRequestVEvent();
void HandleEventCounterPropVEvent();
void HandleDeclineCounterVEvent();
char* getJulianErrorString(int32 ErrorNum);
/* Table Utils Functions */
void addLegend();
void addTimeZone();
void addMajorScale();
void addMinorScale();
void addTicksScale();
/*void emptyRow();*/
void makeHourFBTable();
void makeDaysFBTable();
void DaysLineInc(DateTime* dtTime);
void MonthLineInc(DateTime* dtTime);
void LineInc(DateTime* dtTime);
int32 LineCheck(DateTime& baseTime, DateTime& checkTime, DateTime& checkTimeEnd);
void enterState(FB_State newState, XP_Bool forse);
void checkPeriodBounds(DateTime& startofslot, DateTime& endofslot);
Period* getNextPeriod();
int32 getFBType();
JulianString MoreErrors;
JulianString TooManyEvents;
JulianString error0;
JulianString error1;
JulianString error2;
JulianString error3;
JulianString error4;
JulianString error5;
JulianString error6;
JulianString error7;
static char* Start_HTML;
static char* End_HTML;
static char* Props_Head_HTML;
static char* Props_HTML_Before_Label;
static char* Props_HTML_After_Label;
static char* Props_HTML_After_Data;
static char* Props_HTML_Empty_Label;
static char* Props_End_HTML;
static char* General_Header_Start_HTML;
static char* General_Header_Status_HTML;
static char* General_Header_End_HTML;
static char* Head2_HTML;
static char* Italic_Start_HTML;
static char* Italic_End_HTML;
static char* Bold_Start_HTML;
static char* Bold_End_HTML;
static char* Aref_Start_HTML;
static char* Aref_End_HTML;
static char* ArefTag_End_HTML;
static char* nbsp;
static char* Accepted_Gif_HTML;
static char* Declined_Gif_HTML;
static char* Delegated_Gif_HTML;
static char* NeedsAction_Gif_HTML;
static char* Question_Gif_HTML;
static char* Line_3_HTML;
static char* Cell_Start_HTML;
static char* Cell_End_HTML;
static char* Font_Fixed_Start_HTML;
static char* Font_Fixed_End_HTML;
static char* Line_Break_HTML;
static char* Start_Font;
static char* Start_BIG_Font;
static char* End_Font;
static char* Buttons_Single_Start_HTML;
static char* Buttons_Single_Mid_HTML;
static char* Buttons_Single_End_HTML;
static char* Buttons_Text_End_HTML;
JulianString Buttons_Details_Label;
JulianString Buttons_Add_Label;
JulianString Buttons_Close_Label;
JulianString Buttons_Accept_Label;
JulianString Buttons_AcceptAll_Label;
JulianString Buttons_Update_Label;
JulianString Buttons_Decline_Label;
JulianString Buttons_Tentative_Label;
JulianString Buttons_SendFB_Label;
JulianString Buttons_SendRefresh_Label;
JulianString Buttons_DelTo_Label;
static char* Buttons_SaveDel_HTML;
static char* Buttons_GroupStart_HTML;
static char* Buttons_GroupEnd_HTML;
static char* Buttons_GroupSingleStart_HTML;
static char* Buttons_GroupSingleEnd_HTML;
static char* Text_Label_Start_HTML;
static JulianString Text_Label;
static char* Text_Label_End_HTML;
static char* Text_Field_HTML;
static JulianString ICalPreProcess;
static JulianString ICalPostProcess;
JulianString EventInSchedule;
JulianString EventNotInSchedule;
JulianString EventConflict;
JulianString EventNote;
JulianString EventError;
JulianString EventTest;
JulianString Text_To;
JulianString Text_AllDay;
JulianString Text_StartOn;
JulianString Text_Was;
JulianString MuiltEvent;
JulianString WhenStr;
JulianString WhatStr;
JulianString MuiltEvent_Header_HTML;
JulianString MuiltFB_Header_HTML;
char* String_What;
char* String_When;
char* String_Location;
char* String_Organizer;
char* String_Status;
char* String_Priority;
char* String_Categories;
char* String_Resources;
char* String_Attachments ;
char* String_Alarms;
char* String_Created ;
char* String_Last_Modified;
char* String_Sent;
char* String_UID ;
/*
** Free/Busy Table
*/
static char* FBT_Start_HTML;
static char* FBT_End_HTML;
static char* FBT_NewRow_HTML;
static char* FBT_EndRow_HTML;
static char* FBT_TimeHead_HTML;
static char* FBT_TimeHeadEnd_HTML;
static char* FBT_TimeHour_HTML;
static char* FBT_TimeHourEnd_HTML;
static char* FBT_TD_HourColor_HTML;
static char* FBT_TD_HourColorEnd_HTML;
static char* FBT_TD_MinuteColor_HTML;
static char* FBT_TD_MinuteColorEnd_HTML;
static char* FBT_TDOffsetCell_HTML;
static char* FBT_TickLong_HTML;
static char* FBT_TickShort_HTML;
static char* FBT_TimeMin_HTML;
static char* FBT_TimeMinEnd_HTML;
static char* FBT_HourStart;
static char* FBT_HourEnd;
static char* FBT_DayStart_HTML;
static char* FBT_DayEnd_HTML;
static char* FBT_DayEmptyCell_HTML;
static char* FBT_DayFreeCell_HTML;
static char* FBT_DayBusyCell_HTML;
static char* FBT_DayXParamCell_HTML;
static char* FBT_EmptyRow_HTML;
static char* FBT_DayXColFreeCell_HTML;
static char* FBT_DayXColBusyCell_HTML;
static char* FBT_DayXColEmptyCell_HTML;
static char* FBT_DayXXParamCell_HTML;
static char* FBT_MonthFormat;
static char* FBT_TickDaySetting;
static char* FBT_Legend_Start_HTML;
static char* FBT_Legend_Text1_HTML;
static char* FBT_Legend_Text2_HTML;
static char* FBT_Legend_Text3_HTML;
static char* FBT_Legend_Text4_HTML;
static char* FBT_Legend_Text5_HTML;
static char* FBT_Legend_TextEnd_HTML;
static char* FBT_Legend_End_HTML;
JulianString FBT_Legend_Title;
JulianString FBT_Legend_Free;
JulianString FBT_Legend_Busy;
JulianString FBT_Legend_Unknown;
JulianString FBT_Legend_xparam;
JulianString FBT_AM;
JulianString FBT_PM;
static char* FBT_TickMark1;
static char* FBT_TickMark2;
static char* FBT_TickMark3;
static char* FBT_TickMark4;
static char* FBT_TickSetting;
static char* FBT_TickOffset;
static char* FBT_DayFormat;
/*
** Error
*/
char* error_Header_HTML;
static int32 error_Fields_Labels_Length;
static JulianString error_Fields_Labels[];
static int32 error_Fields_Data_HTML_Length;
static JulianString error_Fields_Data_HTML[];
static char* error_End_HTML ;
/*
** Publish
*/
char* publish_Header_HTML;
static int32 publish_Fields_Labels_Length;
static JulianString publish_Fields_Labels[];
static int32 publish_Fields_Data_HTML_Length;
static JulianString publish_Fields_Data_HTML[];
static char* publish_End_HTML;
/*
** Publish Detail
*/
static int32 publish_D_Fields_Labels_Length;
static JulianString publish_D_Fields_Labels[];
static int32 publish_D_Fields_Data_HTML_Length;
static JulianString publish_D_Fields_Data_HTML[];
/*
** Publish VFreeBusy
*/
char* publishFB_Header_HTML;
char* replyFB_Header_HTML;
static int32 publishFB_Fields_Labels_Length;
static JulianString publishFB_Fields_Labels[];
static int32 publishFB_Fields_Data_HTML_Length;
static JulianString publishFB_Fields_Data_HTML[];
static char* publishFB_End_HTML;
/*
** Publish VFreeBusy Detail
*/
static int32 publishFB_D_Fields_Labels_Length;
static JulianString publishFB_D_Fields_Labels[];
static int32 publishFB_D_Fields_Data_HTML_Length;
static JulianString publishFB_D_Fields_Data_HTML[];
/*
** Request
*/
char* request_Header_HTML;
static int32 request_Fields_Labels_Length;
static JulianString request_Fields_Labels[];
static int32 request_Fields_Data_HTML_Length;
static JulianString request_Fields_Data_HTML[];
static char* request_End_HTML;
/*
** Request Detail
*/
static int32 request_D_Fields_Labels_Length;
static JulianString request_D_Fields_Labels[];
static int32 request_D_Fields_Data_HTML_Length;
static JulianString request_D_Fields_Data_HTML[];
/*
** Request VFreeBusy
*/
char* request_FB_Header_HTML;
static int32 request_FB_Fields_Labels_Length;
static JulianString request_FB_Fields_Labels[];
static int32 request_FB_Fields_Data_HTML_Length;
static JulianString request_FB_Fields_Data_HTML[];
static char* request_FB_End_HTML;
/*
** Request VFreeBusy Detail
*/
char* request_D_FB_Header_HTML;
static int32 request_D_FB_Fields_Labels_Length;
static JulianString request_D_FB_Fields_Labels[];
static int32 request_D_FB_Fields_Data_HTML_Length;
static JulianString request_D_FB_Fields_Data_HTML[];
static char* request_D_FB_End_HTML;
/*
** Event Reply
*/
char* eventreply_Header_HTML;
static int32 eventreply_Fields_Labels_Length;
static JulianString eventreply_Fields_Labels[];
static int32 eventreply_Fields_Data_HTML_Length;
static JulianString eventreply_Fields_Data_HTML[];
static char* eventreply_End_HTML;
/*
** Event Reply Detail
*/
static int32 eventreply_D_Fields_Labels_Length;
static JulianString eventreply_D_Fields_Labels[];
static int32 eventreply_D_Fields_Data_HTML_Length;
static JulianString eventreply_D_Fields_Data_HTML[];
/*
** Event Cancel
*/
char* eventcancel_Header_HTML;
static int32 eventcancel_Fields_Labels_Length;
static JulianString eventcancel_Fields_Labels[];
static int32 eventcancel_Fields_Data_HTML_Length;
static JulianString eventcancel_Fields_Data_HTML[];
static char* eventcancel_End_HTML;
/*
** Event Cancel Detail
*/
static int32 eventcancel_D_Fields_Labels_Length;
static JulianString eventcancel_D_Fields_Labels[];
static int32 eventcancel_D_Fields_Data_HTML_Length;
static JulianString eventcancel_D_Fields_Data_HTML[];
/*
** Event Refresh Request
*/
char* eventrefreshreg_Header_HTML;
static int32 eventrefreshreg_Fields_Labels_Length;
static JulianString eventrefreshreg_Fields_Labels[];
static int32 eventrefreshreg_Fields_Data_HTML_Length;
static JulianString eventrefreshreg_Fields_Data_HTML[];
static char* eventrefreshreg_End_HTML;
/*
** Event Refresh Request Detail
*/
static int32 eventrefreshreg_D_Fields_Labels_Length;
static JulianString eventrefreshreg_D_Fields_Labels[];
static int32 eventrefreshreg_D_Fields_Data_HTML_Length;
static JulianString eventrefreshreg_D_Fields_Data_HTML[];
/*
** Event Counter Proposal
*/
char* eventcounterprop_Header_HTML;
/*
** Event Deline Counter
*/
char* eventdelinecounter_Header_HTML;
static int32 eventdelinecounter_Fields_Labels_Length;
static JulianString eventdelinecounter_Fields_Labels[];
static int32 eventdelinecounter_Fields_Data_HTML_Length;
static JulianString eventdelinecounter_Fields_Data_HTML[];
};
#if defined(XP_PC)
#pragma warning ( default : 4251 )
#endif
#endif

Просмотреть файл

@ -1,166 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef _JULIANFORM_H
#define _JULIANFORM_H
#include "jdefines.h"
#include "netcburl.h"
#include "fe_proto.h"
XP_BEGIN_PROTOS
typedef struct Julian_Form_Callback_Struct
{
/*
** callbackurl should be set to NET_CallbackURLCreate(), it's
** in netcburl.h. Can also be set to nil.
*/
char* (*callbackurl)(NET_CallbackURLFunc func, void* closure);
/*
** callbackurlfree should be set to NET_CallbackURLFree(), it's
** in netcburl.h. Can also be set to nil.
*/
int (*callbackurlfree)(NET_CallbackURLFunc func, void* closure);
/*
** Should Link to NET_ParseURL()
*/
char* (*ParseURL)(const char *url, int wanted);
/*
** Should Link to FE_MakeNewWindow()
*/
MWContext* (*MakeNewWindow)(MWContext *old_context, URL_Struct *url, char *window_name, Chrome *chrome);
/*
** Should Link to NET_CreateURLStruct ();
*/
URL_Struct* (*CreateURLStruct) (const char *url, NET_ReloadMethod force_reload);
/*
** Should Link to PA_BeginParseMDL()
*/
NET_StreamClass* (*BeginParseMDL) (FO_Present_Types format_out, void *init_data, URL_Struct *anchor, MWContext *window_id);
/*
** Should Link to NET_SACopy()
*/
char* (*SACopy) (char **dest, const char *src);
/*
** Should Link to NET_SendMessageUnattended(). Added by John Sun 4-22-98.
*/
int (*SendMessageUnattended) (MWContext* context, char* to, char* subject, char* otherheaders, char* body);
/*
** Should Link to FE_DestroyWindow. Added by John Sun 4-22-98.
*/
void (*DestroyWindow) (MWContext* context);
/*
** Should Link to FE_RaiseWindow.
*/
void (*RaiseWindow) (MWContext* context);
/*
** Should Link to Current MWContext.
*/
MWContext* my_context;
/*
** Should Link to XP_GetString.
*/
char* (*GetString) (int i);
/*
** Should Link to XP_FindSomeContext()
*/
MWContext* (*FindSomeContext)();
/*
** Should Link to XP_FindNamedContextInList()
*/
MWContext* (*FindNamedContextInList)(MWContext* context, char *name);
/*
** Should Link to PREF_CopyCharPref()
*/
int (*CopyCharPref)(const char *pref, char ** return_buf);
/*
** Should Link to NET_UnEscape()
*/
char* (*UnEscape)(char *str);
/*
** Should Link to NET_PlusToSpace()
*/
void (*PlusToSpace)(char *str);
/*
** Should Link to PREF_SetCharPref()
*/
int (*SetCharPref)(const char *pref, const char* buf);
/*
** Should Link to FE_PromptUsernameAndPassword()
*/
Bool (*PromptUsernameAndPassword)(MWContext* window_id, char* message, char** username, char** password);
/*
** Should Link to LO_ProcessTag().
*/
intn (*ProcessTag)(void *data_object, PA_Tag *tag, intn status);
#if defined(XP_WIN)||defined(XP_UNIX)
/*
** Should link to FEU_GetJulianPath. Get the path to the Julian directory. Added by John Sun 5-14-98.
*/
void (*GetJulianPath) (char ** julianPath, void * emptyArg);
#endif
/*
** Should Link to PREF_GetBoolPref()
*/
int (*BoolPref)(const char *pref, XP_Bool * return_val);
/*
** Should Link to PREF_GetIntPref()
*/
int (*IntPref)(const char *pref, int32 * return_int);
} Julian_Form_Callback_Struct, *pJulian_Form_Callback_Struct;
/*
** Caller disposes of callbacks.
*/
XP_Bool JULIAN_PUBLIC jf_Initialize(pJulian_Form_Callback_Struct callbacks);
void JULIAN_PUBLIC *jf_New(char *calendar_mime_data, XP_Bool bFoundNLSDataDirectory);
void JULIAN_PUBLIC jf_Destroy(void *instdata);
void JULIAN_PUBLIC jf_Shutdown(void);
char JULIAN_PUBLIC *jf_getForm(void *instdata);
void JULIAN_PUBLIC jf_setDetail(int detail_form);
void JULIAN_PUBLIC jf_callback(void *instdata, char* url, URL_Struct *URL_s);
void JULIAN_PUBLIC jf_detail_callback(void *instdata, char *url, URL_Struct *URL_s);
XP_END_PROTOS
#endif

Просмотреть файл

@ -1,920 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "jdefines.h"
#include "julnstr.h"
#include <calendar.h>
#include <gregocal.h>
#include <datefmt.h>
#include <time.h>
#include <unistring.h>
#include "smpdtfmt.h"
#include <simpletz.h>
#include "datetime.h"
#include "jutility.h"
#include "duration.h"
#include "attendee.h"
#include "vevent.h"
#include "icalsrdr.h"
#include "icalfrdr.h"
#include "prprty.h"
#include "icalprm.h"
#include "freebusy.h"
#include "vfrbsy.h"
#include "nscal.h"
#include "keyword.h"
#include "txnobjfy.h"
#include "user.h"
#include "txnobj.h"
#include "jlog.h"
#include "uri.h"
#include "xp.h"
#include "prmon.h"
#include "form.h"
static void julian_handle_close(JulianForm *jf);
#ifdef OSF1
void julian_handle_accept(JulianForm *jf, int newStatus);
#else
void julian_handle_accept(JulianForm *jf, Attendee::STATUS newStatus);
#endif
static void julian_handle_moredetail(JulianForm *jf);
static void julian_send_response(JulianString& subject, JulianPtrArray& recipients, JulianString& LoginName, JulianForm& jf, NSCalendar& calendar);
static void julian_send_response_with_events(JulianString& subject, JulianPtrArray& recipients, JulianString& LoginName, JulianForm& jf, NSCalendar& calendar, JulianPtrArray * events);
static void julian_add_new_event_to_send(JulianPtrArray * vvEventsToSend, TimeBasedEvent * eventToSend);
static XP_Bool julian_events_comments_and_attendees_match(TimeBasedEvent * a, TimeBasedEvent * b);
static void julian_fill_in_delegatedToVector(char * deltonames, JulianPtrArray * vDelegatedToFillIn);
static void Julian_ClearLoginInfo();
static int Julian_GetLoginInfo(JulianForm& jf, MWContext* context, char** url, char** password);
#define julian_pref_name "calendar.login_url"
XP_Bool JulianForm::ms_bFoundNLSDataDirectory = FALSE;
JulianForm *jform_CreateNewForm(char *calendar_mime_data, pJulian_Form_Callback_Struct callbacks,
XP_Bool bFoundNLSDataDirectory)
{
JulianForm *jf = new JulianForm();
if (jf)
{
jf->refcount = 1;
jf->setMimeData(calendar_mime_data);
jf->setCallbacks(callbacks);
JulianForm::setFoundNLSDataDirectory(bFoundNLSDataDirectory);
}
return jf;
}
void jform_DeleteForm(JulianForm *jf)
{
if (jf)
{
jf->refcount--;
if (jf->refcount == 0)
{
delete jf;
}
}
}
char* jform_GetForm(JulianForm *jf)
{
jf->StartHTML();
return jf->getHTMLForm(FALSE);
}
void jform_CallBack(JulianForm *jf, char *type)
{
char* button_type;
char* button_type2;
char* button_data;
form_data_combo fdc;
int32 x;
PR_EnterMonitor(jf->my_monitor);
/*
** type contains the html form string for this.
** The gernal format is ? type = label or name = data
** The last thing in this list is the button that started
** this.
*/
button_type = XP_STRCHR(type, '?');
button_type++; // Skip ?. Now points to type
while (TRUE)
{
button_type2 = XP_STRCHR(button_type, '=');
if (button_type2)
{
*button_type2++ = '\0';
button_data = button_type2; // Points to data part
button_type2 = XP_STRCHR(button_type2, '&');
} else {
button_data = nil;
button_type2 = nil;
}
if (button_type2)
{
*button_type2++ = '\0';
}
fdc.type = button_type;
fdc.data = button_data;
jf->formData[jf->formDataCount] = fdc;
jf->formDataCount++;
if (!button_type2 || (jf->formDataCount > formDataIndex))
break;
else
button_type = button_type2;
}
for (x=0; x < jf->formDataCount; x++)
{
button_type = jf->formData[x].type;
jf->setLabel( button_data = jf->formData[x].data );
if (!JulianFormFactory::Buttons_Details_Type.CompareTo(button_type))
{
julian_handle_moredetail(jf);
} else
if (!JulianFormFactory::Buttons_Accept_Type.CompareTo(button_type))
{
julian_handle_accept(jf, Attendee::STATUS_ACCEPTED);
} else
if (!JulianFormFactory::Buttons_Add_Type.CompareTo(button_type))
{
julian_handle_accept(jf, Attendee::STATUS_ACCEPTED);
} else
if (!JulianFormFactory::Buttons_Close_Type.CompareTo(button_type))
{
julian_handle_close(jf);
} else
if (!JulianFormFactory::Buttons_Decline_Type.CompareTo(button_type))
{
julian_handle_accept(jf, Attendee::STATUS_DECLINED);
} else
if (!JulianFormFactory::Buttons_Tentative_Type.CompareTo(button_type))
{
julian_handle_accept(jf, Attendee::STATUS_TENTATIVE);
} else
if (!JulianFormFactory::Buttons_SendFB_Type.CompareTo(button_type))
{
} else
if (!JulianFormFactory::Buttons_SendRefresh_Type.CompareTo(button_type))
{
} else
if (!JulianFormFactory::Buttons_DelTo_Type.CompareTo(button_type))
{
julian_handle_accept(jf, Attendee::STATUS_DELEGATED);
}
}
PR_ExitMonitor(jf->my_monitor);
}
/**
*** JulianForm Class
***
*** This is the c++ interface to JulianFormFactory
***
**/
JulianForm::JulianForm()
{
mimedata = nil;
imipCal = nil;
jff = nil;
contextName = "Julian:More Details";
formDataCount = 0;
my_monitor = PR_NewMonitor();
}
JulianForm::~JulianForm()
{
if (FALSE && imipCal)
{
if (imipCal->getLog())
delete imipCal->getLog();
delete imipCal;
imipCal = nil;
}
if (jff)
{
delete jff;
}
if (my_monitor) PR_DestroyMonitor(my_monitor);
}
XP_Bool
JulianForm::StartHTML()
{
JulianString u;
UnicodeString ust;
if (imipCal == NULL)
{
ICalReader *tfr = (ICalReader *) new ICalStringReader(mimedata);
mimedata = nil;
if (tfr)
{
JLog * log = new JLog();
if (!ms_bFoundNLSDataDirectory)
{
if (log != 0)
{
// TODO: finish
//log->log("ERROR: Can't find REQUIRED NLS Data Directory\n");
}
}
imipCal = new NSCalendar(log);
ust = u.GetBuffer();
if (imipCal) imipCal->parse(tfr, ust);
delete tfr;
}
return TRUE;
}
return FALSE;
}
char*
JulianForm::getHTMLForm(XP_Bool Want_Detail, NET_StreamClass *this_stream)
{
if (imipCal != nil)
{
if ((jff = new JulianFormFactory(*imipCal, *this, getCallbacks())) != nil)
{
htmlForm = ""; // Empty it
jff->init();
jff->getHTML(&htmlForm, this_stream, Want_Detail);
}
}
char* t2 = (char*) XP_ALLOC(htmlForm.GetStrlen() + 1);
if (t2) strcpy(t2, htmlForm.GetBuffer());
return t2;
}
void
JulianForm::setMimeData(char *NewMimeData)
{
if (NewMimeData)
{
mimedata = NewMimeData;
}
}
char*
JulianForm::getComment()
{
for (int32 x=0; x < formDataCount; x++)
{
if (!JulianFormFactory::CommentsFieldName.CompareTo(formData[x].type))
{
(*getCallbacks()->PlusToSpace)(formData[x].data);
(*getCallbacks()->UnEscape) (formData[x].data);
return formData[x].data;
}
}
return nil;
}
char*
JulianForm::getDelTo()
{
for (int32 x=0; x < formDataCount; x++)
{
char* temp;
temp = PR_smprintf( "%s", formData[x].type); // Where is a pr_strcpy??
if (temp)
{
(*getCallbacks()->PlusToSpace)(temp);
if (!XP_STRCMP(jff->Buttons_DelTo_Label.GetBuffer(), temp))
{
(*getCallbacks()->PlusToSpace)(formData[x].data);
(*getCallbacks()->UnEscape) (formData[x].data);
return formData[x].data;
}
PR_DELETE(temp);
}
}
return nil;
}
void
julian_handle_close(JulianForm *jf)
{
MWContext* cx = nil;
if ((cx = jf->getContext()) != nil)
{
(*jf->getCallbacks()->DestroyWindow)(cx);
}
}
void
julian_handle_moredetail(JulianForm *jf)
{
MWContext* cx = nil;
char* newhtml = NULL;
NET_StreamClass* stream = nil;
URL_Struct* url = nil;
if (jf->getCallbacks() == nil ||
jf->getCallbacks()->CreateURLStruct == nil)
return;
url = (*jf->getCallbacks()->CreateURLStruct)("internal_url://", NET_RESIZE_RELOAD);
if (url)
{
url->internal_url = TRUE;
(*jf->getCallbacks()->SACopy)(&(url->content_type), TEXT_HTML);
// Look to see if we already made a window for this
if ((cx = jf->getContext()) != nil)
{
(*jf->getCallbacks()->RaiseWindow)(cx);
}
//
// If the more details window isn't there,
// make one
//
if (!cx)
{
Chrome* customChrome = XP_NEW_ZAP(Chrome);
/* make the window */
if (customChrome)
{
customChrome->show_scrollbar = TRUE; /* TRUE to show scrollbars on window */
customChrome->allow_resize = TRUE; /* TRUE to allow resize of windows */
customChrome->allow_close = TRUE; /* TRUE to allow window to be closed */
customChrome->disable_commands = TRUE; /* TRUE if user has set hot-keys / menus off */
customChrome->restricted_target = TRUE; /* TRUE if window is off-limits for opening links into */
}
cx = (*jf->getCallbacks()->MakeNewWindow)((*jf->getCallbacks()->FindSomeContext)(), nil, jf->contextName, customChrome);
}
if (cx)
{
static PA_InitData data;
/* make a netlib stream to display in the window */
data.output_func = jf->getCallbacks()->ProcessTag;
stream = (*jf->getCallbacks()->BeginParseMDL)(FO_CACHE_AND_VIEW_SOURCE | FO_CACHE_AND_PRESENT_INLINE, &data, url, cx);
if (stream)
{
jf->StartHTML();
jf->getHTMLForm(TRUE, stream);
(*stream->complete) (stream->data_object);
XP_FREE(stream);
}
}
}
}
void
julian_send_response_with_events(JulianString& subject, JulianPtrArray& recipients, JulianString& LoginName, JulianForm& jf, NSCalendar& calendar, JulianPtrArray * events)
{
TransactionObject::ETxnErrorCode txnStatus;
TransactionObject* txnObj;
JulianPtrArray* capiModifiers = 0;
if (jf.getCallbacks() == nil ||
jf.getCallbacks()->FindSomeContext == nil)
return;
MWContext* this_context = (*jf.getCallbacks()->FindSomeContext)();
capiModifiers = new JulianPtrArray();
if (capiModifiers)
{
UnicodeString usMeUri = LoginName.GetBuffer();
URI meUri(usMeUri);
User* uFrom = new User(usMeUri, meUri.getName());
char *capurl = NULL, *passwd = NULL;
UnicodeString uSubject;
UnicodeString uLoginName;
XP_Bool do_capi_login = FALSE; /* Default is not to ask for capi login info */
if (jf.getCallbacks()->BoolPref)
(*jf.getCallbacks()->BoolPref)("calendar.capi.enabled", &do_capi_login);
if (do_capi_login &&
Julian_GetLoginInfo(jf, this_context, &capurl, &passwd) > 0)
{
char* calUser = "";
char* calHost = "";
char* calNode = "10000";
char* temp;
// Skip pass "capi://", if it is there
if (XP_STRSTR(capurl, "://"))
{
capurl = XP_STRSTR(capurl, "://");
capurl += 3;
}
// Break apart the user and host:node parts
temp = XP_STRSTR(capurl, "/");
if (temp)
{
calUser = temp;
*(calUser) = '\0';
calUser++;
calHost = capurl;
}
// Break apart the host and node parts
temp = XP_STRSTR(calHost, ":");
if (temp)
{
calNode = temp;
*(calNode++) = '\0';
}
// Currently the URL login form is as follows:
// capi://host:node/login
// i.e.
// capi://calendar-1.mcom.com:10000/John Sun
// TODO: this may change.
uFrom->setRealName(calUser);
uFrom->setCAPIInfo(calUser, passwd, calHost, calNode);
if (0)
{
if (passwd) XP_FREE(passwd);
if (capurl) XP_FREE(capurl);
}
}
uSubject = subject.GetBuffer();
uLoginName = LoginName.GetBuffer();
txnObj = TransactionObjectFactory::Make(calendar, *(events),
*uFrom, recipients, uSubject, *capiModifiers,
&jf, this_context, uLoginName);
if (txnObj != 0)
{
txnObj->execute(0, txnStatus);
delete txnObj; txnObj = 0;
}
if (uFrom) delete uFrom;
delete capiModifiers;
}
// If more details windows, then close it
// Only if there were no problems
if (txnStatus == TransactionObject::TR_OK)
{
if (jf.getContext())
{
julian_handle_close(&jf);
}
}
}
void
julian_send_response(JulianString& subject, JulianPtrArray& recipients, JulianString& LoginName, JulianForm& jf, NSCalendar& calendar)
{
julian_send_response_with_events(subject, recipients, LoginName, jf, calendar, calendar.getEvents());
}
void
julian_fill_in_delegatedToVector(char * deltonames,
JulianPtrArray * vDelegatedToFillIn)
{
if (0 != vDelegatedToFillIn)
{
UnicodeString mailto = "MAILTO:";
UnicodeString del_name;
char * nextname;
while (*deltonames)
{
del_name = mailto;
nextname = deltonames;
while (nextname && *nextname && *nextname != ' ')
{
nextname++;
}
if (*nextname)
{
*nextname = '\0';
nextname++;
}
del_name += deltonames;
vDelegatedToFillIn->Add(new UnicodeString(del_name));
if (!(*nextname))
{
// Last one
break;
}
else
{
deltonames = nextname;
}
}
}
}
XP_Bool
julian_events_comments_and_attendees_match(TimeBasedEvent * a, TimeBasedEvent * b)
{
if (a != 0 && b != 0)
{
// comments must match and attendees must match
if (a->getComment() != 0 && b->getComment() == 0)
return FALSE;
if (a->getComment() == 0 && b->getComment() != 0)
return FALSE;
if (a->getComment() != 0 && b->getComment() != 0)
{
if (a->getComment()->GetSize() != b->getComment()->GetSize())
return FALSE;
// only compare 1st comment in vector
if (a->getComment()->GetSize() > 0 && b->getComment()->GetSize() > 0)
{
ICalProperty * iua = 0;
ICalProperty * iub = 0;
UnicodeString ua, ub;
iua = (ICalProperty *) a->getComment()->GetAt(0);
iub = (ICalProperty *) b->getComment()->GetAt(0);
ua = *((UnicodeString *) iua->getValue());
ub = *((UnicodeString *) iub->getValue());
if (ua != ub)
return FALSE;
}
}
if (a->getAttendees() != 0 && b->getAttendees() == 0)
return FALSE;
if (a->getAttendees() == 0 && b->getAttendees() != 0)
return FALSE;
if (a->getAttendees() != 0 && b->getAttendees() != 0)
{
if (a->getAttendees()->GetSize() != b->getAttendees()->GetSize())
return FALSE;
t_int32 i;
Attendee * attA = 0;
Attendee * attB = 0;
for (i = 0; i < a->getAttendees()->GetSize(); i++)
{
attA = (Attendee *) a->getAttendees()->GetAt(i);
attB = (Attendee *) b->getAttendees()->GetAt(i);
if (attA->getName() != attB->getName())
return FALSE;
if (attA->getStatus() != attB->getStatus())
return FALSE;
}
}
return TRUE;
}
return FALSE;
}
void
julian_add_new_event_to_send(JulianPtrArray * vvEventsToSend, TimeBasedEvent * eventToSend)
{
if (vvEventsToSend != 0)
{
XP_Bool bFound = FALSE;
int32 i;
JulianPtrArray * vEventsToSend = 0;
TimeBasedEvent * event;
for (i = 0; i < vvEventsToSend->GetSize(); i++)
{
vEventsToSend = (JulianPtrArray *) vvEventsToSend->GetAt(i);
if (vEventsToSend != 0 && vEventsToSend->GetSize() > 0)
{
event = (TimeBasedEvent *) vEventsToSend->GetAt(0);
if (julian_events_comments_and_attendees_match(event, eventToSend))
{
vEventsToSend->Add(eventToSend);
bFound = TRUE;
break;
}
}
}
if (!bFound)
{
JulianPtrArray * evtVctrToAdd = new JulianPtrArray();
if (evtVctrToAdd != 0)
{
evtVctrToAdd->Add(eventToSend);
vvEventsToSend->Add(evtVctrToAdd);
}
}
}
}
void
#ifdef OSF1
julian_handle_accept(JulianForm *jf, int newStatus)
#else
julian_handle_accept(JulianForm *jf, Attendee::STATUS newStatus)
#endif
{
NSCalendar* imipCal = jf->getCalendar();
ICalComponent* component;
JulianString orgName;
char* name = nil;
JulianString nameU;
JulianString subject = JulianString(jf->getLabel());
UnicodeString uTemp;
int32 i;
int32 j;
int32 k;
// this should be set to the logged in user
// TODO: make it efficient
// TRY to minimize number of calls to julian_send_response_with_events.
if (jf->getCallbacks()->CopyCharPref)
(*jf->getCallbacks()->CopyCharPref)("mail.identity.useremail", &name);
if (name)
{
nameU = "MAILTO:";
nameU += name;
}
if (imipCal->getEvents() != 0)
{
XP_Bool firstTime = TRUE;
// process events to send
UnicodeString uName = nameU.GetBuffer();
JulianPtrArray * vDelegatedTo = 0;
char * deltonames = 0;
char * cOrgName = 0;
char * cSummary = 0;
XP_Bool bDontSend = FALSE;
JulianPtrArray * recipients = 0;
TimeBasedEvent * tbe;
// The overall strategy
// Create a vector of vector of events (vvEventsToReply).
// This vector is used to minimize the number of send_response calls (which sends email).
// Events with the same comments and attendees(status and name) are placed in the same bucket.
// Events in the same bucket are send in the same email message.
// Thus I minimize the number of sends response calls.
//
// Foreach event in calendar,
// setAttendeeStatus for this user to newStatus
// setComment from comment text-field
// setDTSTAMP
// if (first event in calendar) set subject to its summary.
// add event to vvEventsToReply
// Foreach vector in vvEventsToReply
// send REPLY message to ORGANIZER
// if (delegated status)
// send DELEGATE-REQUEST message to DELEGATEEs
//
JulianPtrArray * vvEventsToReply = new JulianPtrArray();
for (i = 0; i < imipCal->getEvents()->GetSize(); i++)
{
component = (ICalComponent *) imipCal->getEvents()->GetAt(i);
if (component->GetType() == ICalComponent::ICAL_COMPONENT_VEVENT)
{
tbe = (TimeBasedEvent *) component;
// Set org
if (orgName.GetStrlen() == 0)
{
if (tbe->getOrganizer().size() > 0)
{
cOrgName = (tbe->getOrganizer()).toCString("");
if (0 != cOrgName)
orgName = cOrgName;
}
}
if (newStatus == Attendee::STATUS_DELEGATED)
{
deltonames = jf->getDelTo();
if ((0 != deltonames) && (XP_STRLEN(deltonames) > 0))
{
vDelegatedTo = new JulianPtrArray();
if (0 != vDelegatedTo)
julian_fill_in_delegatedToVector(deltonames, vDelegatedTo);
}
}
tbe->setAttendeeStatusInt(uName, newStatus, vDelegatedTo);
if (jf->hasComment())
{
tbe->setNewComments(jf->getComment());
}
tbe->stamp();
if (i == 0)
{
// only print subject once and use first summary.
subject += JulianFormFactory::SubjectSep;
cSummary = (tbe->getSummary()).toCString("");
subject += cSummary;
}
julian_add_new_event_to_send(vvEventsToReply, tbe);
if (vDelegatedTo != 0)
{
ICalComponent::deleteUnicodeStringVector(vDelegatedTo);
delete vDelegatedTo; vDelegatedTo = 0;
}
}
}
JulianPtrArray * vEventsToReply = 0;
JulianPtrArray * replyRecipients = new JulianPtrArray();
t_int32 method = imipCal->getMethod();
// setup reply recipients to contain only organizer
if (replyRecipients != 0)
{
if (method != NSCalendar::METHOD_PUBLISH)
{
UnicodeString usOrgName = orgName.GetBuffer();
URI orgUri(usOrgName);
User* uToOrg = new User(usOrgName, orgUri.getName());
replyRecipients->Add(uToOrg);
}
}
for (i = 0; i < vvEventsToReply->GetSize(); i++)
{
vEventsToReply = (JulianPtrArray *) vvEventsToReply->GetAt(i);
// send reply
recipients = replyRecipients;
imipCal->setMethod(NSCalendar::METHOD_REPLY);
julian_send_response_with_events(subject, *recipients, nameU, *jf, *imipCal, vEventsToReply);
recipients = 0;
// send delegate request message if necessary
if (newStatus == Attendee::STATUS_DELEGATED &&
method == NSCalendar::METHOD_REQUEST)
{
deltonames = jf->getDelTo();
if ((0 != deltonames) && (XP_STRLEN(deltonames) > 0))
{
vDelegatedTo = new JulianPtrArray();
if (0 != vDelegatedTo)
julian_fill_in_delegatedToVector(deltonames, vDelegatedTo);
else
bDontSend = TRUE;
}
else
{
bDontSend = TRUE;
}
if (!bDontSend)
{
recipients = new JulianPtrArray();
if (recipients != 0)
{
PR_ASSERT(vDelegatedTo != 0 && vDelegatedTo->GetSize() > 0);
User * userDelegate = 0;
for (j = 0; j < vDelegatedTo->GetSize(); j++)
{
uTemp = *((UnicodeString *) vDelegatedTo->GetAt(j));
URI delUri(uTemp);
userDelegate = new User(uTemp, delUri.getName());
for (k = 0; k < vEventsToReply->GetSize(); k++)
{
component = (ICalComponent *) vEventsToReply->GetAt(k);
#ifdef OSF1
((TimeBasedEvent *)component)->setAttendeeStatusInt(uTemp, 0);
#else
((TimeBasedEvent *)component)->setAttendeeStatusInt(uTemp, Attendee::STATUS_NEEDSACTION);
#endif
}
recipients->Add(userDelegate);
}
imipCal->setMethod(NSCalendar::METHOD_REQUEST);
julian_send_response_with_events(subject, *recipients, nameU, *jf, *imipCal, vEventsToReply);
User::deleteUserVector(recipients);
delete recipients; recipients = 0;
}
}
if (vDelegatedTo != 0)
{
ICalComponent::deleteUnicodeStringVector(vDelegatedTo);
delete vDelegatedTo; vDelegatedTo = 0;
}
}
}
// delete allocated objects.
if (cOrgName != 0)
{
delete [] cOrgName; cOrgName = 0;
}
if (cSummary != 0)
{
delete [] cSummary; cSummary = 0;
}
if (0 != replyRecipients)
{
User::deleteUserVector(replyRecipients);
delete replyRecipients; replyRecipients = 0;
}
for (i = vvEventsToReply->GetSize() -1; i >= 0; i--)
{
vEventsToReply = (JulianPtrArray *) vvEventsToReply->GetAt(i);
ICalComponent::deleteICalComponentVector(vEventsToReply);
delete vEventsToReply; vEventsToReply = 0;
}
delete vvEventsToReply; vvEventsToReply = 0;
}
if (name) XP_FREE(name);
}
void
Julian_ClearLoginInfo()
{
}
int
Julian_GetLoginInfo(JulianForm& jf, MWContext* context, char** url, char** password) {
static char* lastCalPwd = NULL;
char* defaultUrl;
int status = -2;
if (jf.getCallbacks() &&
jf.getCallbacks()->CopyCharPref)
status = (*jf.getCallbacks()->CopyCharPref)(julian_pref_name, &defaultUrl);
// -1 is pref isn't there, which will be a normal case for us
// Any other neg number is some other bad error so bail.
if (status < -1) return status;
*url = defaultUrl;
*password = NULL;
if (lastCalPwd != NULL)
{
*password = XP_STRDUP(lastCalPwd);
if (*password == NULL) return 0 /*MK_OUT_OF_MEMORY*/;
return 1;
}
if (!(*context->funcs->PromptUsernameAndPassword)
(context,
// XP_GetString(JULIAN_LOGIN_PROMPT),
"Enter capi url and password",
url,
password))
{
*url = NULL;
*password = NULL;
status = -1;
} else {
if (jf.getCallbacks() &&
jf.getCallbacks()->SetCharPref)
{
(*jf.getCallbacks()->SetCharPref)(julian_pref_name, *url);
}
lastCalPwd = XP_STRDUP(*password);
status = 1;
}
XP_FREE(defaultUrl);
return status;
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,127 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include <xp_mcom.h>
#include "jdefines.h"
#include "julianform.h"
#include "nlsloc.h"
#ifdef XP_WIN32
/*#include "stdafx.h"*/
/*#include "feutil.h"*/
#endif
extern void* jform_CreateNewForm(char *, pJulian_Form_Callback_Struct, XP_Bool);
extern void jform_DeleteForm(void *);
extern char* jform_GetForm(void *);
extern void jform_CallBack(void *, void *);
pJulian_Form_Callback_Struct JulianForm_CallBacks;
XP_Bool bCallbacksSet = PR_FALSE ;
XP_Bool jf_Initialize(pJulian_Form_Callback_Struct callbacks)
{
/* for some reason I have to do this little trick to get things to work */
char * julian = NULL;
char buf[1024];
julian = &(buf[0]);
JulianForm_CallBacks = XP_NEW_ZAP(Julian_Form_Callback_Struct);
if (JulianForm_CallBacks && callbacks)
{
*JulianForm_CallBacks = *callbacks;
}
#if defined(XP_WIN)||defined(XP_UNIX)
if (JulianForm_CallBacks && callbacks && callbacks->GetJulianPath)
{
bCallbacksSet = PR_TRUE ;
/* set the NLS locale30 path to the location of the locale30 from the registry */
JulianForm_CallBacks->GetJulianPath(&julian, (void *)sizeof(buf));
/* use path if it exist, otherwise you NS_NLS_DATADIRECTORY env var if it exists */
/* if neither exists return FALSE */
if (JXP_ACCESS(julian, 0) != -1)
{
NLS_Initialize(NULL, julian);
return TRUE;
}
else
{
char * nlsDDir = getenv("NS_NLS_DATADIRECTORY");
if (nlsDDir == 0)
return FALSE;
else
{
if (JXP_ACCESS(nlsDDir, 0) == -1)
return FALSE;
else
return TRUE;
}
}
}
#endif
return FALSE;
}
void *jf_New(char *calendar_mime_data, XP_Bool bFoundNLSDataDirectory)
{
return jform_CreateNewForm(calendar_mime_data, JulianForm_CallBacks, bFoundNLSDataDirectory);
}
void jf_Destroy(void *instdata)
{
jform_DeleteForm(instdata);
}
void jf_Shutdown()
{
XP_FREEIF(JulianForm_CallBacks);
}
char *jf_getForm(void *instdata)
{
return jform_GetForm(instdata);
}
void jf_setDetail(int detail_form)
{
}
/* rhp - needed to add third parameter for other mime related calls */
void jf_callback(void *instdata, char *url, URL_Struct *URL_s)
{
if (instdata && url)
{
jform_CallBack(instdata, url);
}
}
/* rhp - needed to add third parameter for other mime related calls */
/* For some unknown reason there can only be one call back funtion/
** instdate per button
*/
void jf_detail_callback(void *instdata, char *url, URL_Struct *URL_s)
{
if (instdata && url)
{
jform_CallBack(instdata, url);
}
}

Просмотреть файл

@ -1,757 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* attendee.h
* John Sun
* 2/6/98 4:33:43 PM
*/
#ifndef __ATTENDEE_H_
#define __ATTENDEE_H_
#include "ptrarray.h"
#include "icalcomp.h"
#include "prprty.h"
#include "jlog.h"
#include "datetime.h"
#include "nscalcoreicalexp.h"
/**
* The Attendee class encapsulates the data in the iCalendar
* ATTENDEE property. This class must implement the interface defined
* by the ICalProperty abstract class. The keyword parameters in Attendee
* are stored as t_int32. Other parameters are stored as UnicodeStrings
* or as JulianPtrArray's of UnicodeStrings.
*/
class NS_CAL_CORE_ICAL Attendee : public ICalProperty
{
private:
/**
* For now, hide default constructor.
* Currently must pass in a Log object to create an Attendee.
*/
Attendee();
public:
/* enums of attendee keywords */
/** Enumeration of ROLE parameter*/
enum ROLE {
/*ROLE_ATTENDEE = 0, ROLE_ORGANIZER = 1, ROLE_OWNER = 2,
ROLE_DELEGATE = 3, ROLE_LENGTH = 4,
ROLE_CHAIR = 0, ROLE_PARTICIPANT = 1, ROLE_NON_PARTICIPANT = 2,
ROLE_LENGTH = 3, ROLE_INVALID = -1*/
ROLE_REQ_PARTICIPANT = 0, ROLE_CHAIR = 1, ROLE_OPT_PARTICIPANT = 2,
ROLE_NON_PARTICIPANT = 3,
ROLE_XPARAMVAL = 4, ROLE_LENGTH = 5, ROLE_INVALID = -1
};
/** Enumeration of CUTYPE parameter*/
enum TYPE {
TYPE_INDIVIDUAL = 0, TYPE_GROUP = 1,
TYPE_RESOURCE = 2, TYPE_ROOM = 3, TYPE_UNKNOWN = 4,
TYPE_XPARAMVAL = 5,
TYPE_LENGTH = 6, TYPE_INVALID = -1
};
/** Enumeration of PARTSTAT parameter*/
enum STATUS {
/* For VEVENT, VTODO, VJOURNAL */
STATUS_NEEDSACTION = 0, STATUS_XPARAMVAL = 1,
STATUS_ACCEPTED = 2, STATUS_DECLINED = 3,
/* For VEVENT and VTODO only */
STATUS_TENTATIVE = 4,
STATUS_DELEGATED = 5,
/* For VTODO only */
STATUS_COMPLETED = 6, STATUS_INPROCESS = 7,
STATUS_LENGTH = 8, STATUS_INVALID = -1
};
/**
* Is the status variable valid for this component type. For example,
* if compType is VEVENT and status is INPROCESS, return FALSE.
* But if compType is VTODO and status is INPROCESS, return TRUE.
* @param compType component type
* @param status status
*
* @return TRUE if valid status for compType, FALSE otherwise
*/
static t_bool isValidStatus(ICalComponent::ICAL_COMPONENT compType, Attendee::STATUS status);
/** Enumeration of RSVP parameter */
enum RSVP {
RSVP_FALSE = 0, RSVP_TRUE = 1,
RSVP_LENGTH = 2, RSVP_INVALID = -1
};
/** Enumeration of EXPECT parameter */
enum EXPECT {
EXPECT_FYI = 0, EXPECT_REQUIRE = 1, EXPECT_REQUEST = 2,
/*EXPECT_IMMEDIATE = 3, EXPECT_LENGTH = 4, */
EXPECT_LENGTH = 3, EXPECT_INVALID = -1
};
/** Enumeration of all keyword properties in an Attendee */
enum PROPS {
PROPS_ROLE = 0, PROPS_TYPE = 1,
PROPS_STATUS = 2, PROPS_RSVP = 3,
PROPS_EXPECT = 4
};
/**
* Converts ROLE string to a ROLE enumeration
* @param sRole role string
*
* @return ROLE that represents that string
*/
static Attendee::ROLE stringToRole(UnicodeString & sRole);
/**
* Converts CUTYPE string to a TYPE enumeration
* @param sType type string
*
* @return TYPE that represents that string
*/
static Attendee::TYPE stringToType(UnicodeString & sType);
/**
* Converts PARTSTAT string to a AT_PARSTAT enumeration
* @param sStatus status string
*
* @return STATUS that represents that string
*/
static Attendee::STATUS stringToStatus(UnicodeString & sStatus);
/**
* Converts RSVP string to a RSVP enumeration
* @param sRSVP rsvp string
*
* @return RSVP that represents that string
*/
static Attendee::RSVP stringToRSVP(UnicodeString & sRSVP);
/**
* Converts EXPECT string to a EXPECT enumeration
* @param sExpect expect string
*
* @return EXPECT that represents that string
*/
static Attendee::EXPECT stringToExpect(UnicodeString & sExpect);
/**
* Converts ROLE to string. If bad role, return default (REQ_PARTICIPANT).
* @param role ROLE enumeration
* @param out output role string
*
* @return output role string (out)
*/
static UnicodeString & roleToString(Attendee::ROLE role, UnicodeString & out);
/**
* Converts TYPE to string. If bad type, return default (INDIVIDUAL).
* @param type TYPE enumeration
* @param out output type string
*
* @return output type string (out)
*/
static UnicodeString & typeToString(Attendee::TYPE type, UnicodeString & out);
/**
* Converts STATUS to string. If bad status, return default (NEEDS-ACTION).
* @param status STATUS enumeration
* @param out output partstat string
*
* @return output partstat string (out)
*/
static UnicodeString & statusToString(Attendee::STATUS status, UnicodeString & out);
/**
* Converts RSVP to string. If bad rsvp, return default (FALSE).
* @param rsvp RSVP enumeration
* @param out output rsvp string
*
* @return output rsvp string (out)
*/
static UnicodeString & rsvpToString(Attendee::RSVP rsvp, UnicodeString & out);
/**
* Converts EXPECT to string. If bad expect, return default (FYI).
* @param expect EXPECT enumeration
* @param out output expect string
*
* @return output expect string (out)
*/
static UnicodeString & expectToString(Attendee::EXPECT expect, UnicodeString & out);
/**
* Constructor. Also sets log file to write errors to.
* @param ICalComponent::ICAL_COMPONENT componentType
* @param initLog log file to write errors to
*/
Attendee(ICalComponent::ICAL_COMPONENT componentType, JLog * initLog = 0);
/**
* Destructor
*/
~Attendee();
/**
* Factory method that returns a new default Attendee
*
* @return static Attendee *
*/
static Attendee * getDefault(ICalComponent::ICAL_COMPONENT compType,
JLog * initLog = 0);
/**
* Given attendee name and parameters, populates Attendee
* data members.
* @param propVal attendee name
* @param parameters attendee parameters
*
*/
void parse(UnicodeString & propVal, JulianPtrArray * parameters = 0);
/**
* Sets parameter with name paramName with value paramVal.
* For MEMBER, DELEGATED-TO, DELEGATED-FROM, DIR, SENT-BY, the
* double quotes are stripped. THE MAILTO: is not stripped.
*
* @param paramName parameter name to set
* @param paramVal new value of parameter
*/
void setParam(UnicodeString & paramName, UnicodeString & paramVal);
/**
* convert a character to the content of a parameter in
* human-readable string format
*
* @param c a character represents a parameter
* @return parameter in a human-readable string
*/
UnicodeString toStringChar(t_int32 c);
/**
* Return the first attendee in vAttendees with the name matching sAttendee.
* @param vAttendees vector of attendees
* @param sAttendee attendee name to look for
*
* @return first Attendee with name sAttendee, 0 if not found.
*/
static Attendee * getAttendee(JulianPtrArray * vAttendees, UnicodeString sAttendee);
/*---------- To satisfy ICalProperty interface ----------*/
/**
* Sets parameters.
* @param parameters vector of parameters to set
*
*/
virtual void setParameters(JulianPtrArray * parameters);
/**
* Return value of property. Never use. Use getName().
*
* @return value of property
*/
virtual void * getValue() const { PR_ASSERT(FALSE); return (void*) (&m_sName); }
/**
* Sets value of property. Never use. Use setName().
* @param value new value of property
*
*/
virtual void setValue(void * value) { PR_ASSERT(FALSE); if (value) {}} ;
/**
* Returns a clone of this property.
* @param initLog the log file for clone to write to
*
* @return clone of this ICalProperty object
*/
virtual ICalProperty * clone(JLog * initLog);
/**
* Checks whether this property is valid or not. Must have MAILTO: in
* front of attendee name to be valid.
*
* @return TRUE if property is valid, FALSE otherwise
*/
virtual t_bool isValid();
/**
* Return property to human-readable string.
* @param dateFmt formatting string
* @param out output human-readable string
*
* @return output human-readable string (out)
*/
virtual UnicodeString & toString(UnicodeString & strFmt, UnicodeString & out);
/**
* Return property to human-readable string.
* @param out output human-readable string
*
* @return output human-readable string (out)
*/
virtual UnicodeString & toString(UnicodeString & out);
/**
* Return property to iCal property string.
* @param out output iCal string
*
* @return output iCal string (out)
*/
virtual UnicodeString & toICALString(UnicodeString & out);
/**
* Return property to iCal property string. Inserts sProp to
* front of output string. sProp should be the property name of this
* property.
* @param sProp property name to append to insert at front of out
* @param out output iCal string with sProp in front
*
* @return output iCal string with sProp in front (out)
*/
virtual UnicodeString & toICALString(UnicodeString & sProp, UnicodeString & out);
/*----------End of ICalProperty interface----------*/
/* ---- GETTERS AND SETTERS ---- */
/**
* Sets Attendee name.
* @param sName new Attendee name
*
*/
void setName(UnicodeString sName);
/**
* Returns Attendee name.
*
* @return Attendee name
*/
UnicodeString getName() const { return m_sName; }
/**
* Sets ROLE.
* @param i new ROLE value
*
*/
void setRole(Attendee::ROLE i) { m_iRole = i; }
/**
* Sets TYPE.
* @param i new TYPE value
*
*/
void setType(Attendee::TYPE i) { m_iType = i; }
/**
* Sets STATUS.
* @param i new STATUS value
*
*/
void setStatus(Attendee::STATUS i) { m_iStatus = i; }
/**
* Sets RSVP.
* @param i new RSVP value
*
*/
void setRSVP(Attendee::RSVP i) { m_iRSVP = i; }
/**
* Sets EXPECT.
* @param i new EXPECT value
*
*/
void setExpect(Attendee::EXPECT i) { m_iExpect = i; }
/**
* Returns ROLE value.
*
* @return ROLE value
*/
Attendee::ROLE getRole() const { return (Attendee::ROLE) m_iRole; }
/**
* Returns TYPE value.
*
* @return TYPE value
*/
Attendee::TYPE getType() const { return (Attendee::TYPE) m_iType; }
/**
* Returns STATUS value.
*
* @return STATUS value
*/
Attendee::STATUS getStatus() const { return (Attendee::STATUS) m_iStatus; }
/**
* Returns RSVP value.
*
* @return RSVP value
*/
Attendee::RSVP getRSVP() const { return (Attendee::RSVP) m_iRSVP; }
/**
* Returns EXPECT value.
*
* @return EXPECT value
*/
Attendee::EXPECT getExpect() const { return (Attendee::EXPECT) m_iExpect; }
/**
* Add a name to the Delegated-To vector.
* @param sDelegatedTo name to add to delegated-to vector
*/
void addDelegatedTo(UnicodeString sDelegatedTo);
/**
* Add a name to the Delegated-From vector.
* @param sDelegatedFrom name to add to delegated-from vector
*/
void addDelegatedFrom(UnicodeString sDelegatedFrom);
/**
* Add a name to the Member vector.
* @param sMember name to add to member vector
*/
void addMember(UnicodeString sMember);
/**
* Return ptr to Delegated-To vector
*
* @return Delegated-To vector
*/
JulianPtrArray * getDelegatedTo() const { return m_vsDelegatedTo; }
/**
* Return ptr to Delegated-From vector
*
* @return Delegated-From vector
*/
JulianPtrArray * getDelegatedFrom() const { return m_vsDelegatedFrom; }
/**
* Return ptr to Member vector
*
* @return Member vector
*/
JulianPtrArray * getMember() const { return m_vsMember; }
/**
* Return CN (common-name) value
*
* @return CN value
*/
UnicodeString getCN() const { return m_CN; }
/**
* Return Language value
*
* @return Language value
*/
UnicodeString getLanguage() const { return m_Language; }
/**
* Return DIR (location of directory info) value
*
* @return DIR value
*/
UnicodeString getDir() const { return m_Dir; }
/**
* Return SENT-BY (calendar user acting on behalf of the attendee) value
*
* @return SENT-BY value
*/
UnicodeString getSentBy() const { return m_SentBy; }
/**
* Set CN (common-name) value
* @param new CN value
*/
void setCN(UnicodeString u) { m_CN = u; }
/**
* Set Language value
* @param new Language value
*/
void setLanguage(UnicodeString u) { m_Language = u; }
/**
* Set DIR (location of directory info) value
* @param new DIR value
*/
void setDir(UnicodeString u) { m_Dir = u; }
/**
* Set SENT-BY (calendar user acting on behalf of the attendee) value
* @param new SENT-BY value
*/
void setSentBy(UnicodeString u) { m_SentBy = u; }
void setDTStamp(DateTime d) { m_DTStamp = d; }
void setSequence(t_int32 i) { m_Sequence = i; }
/* list the default values for properties
(always to 0th element of enumeration) */
/** the default ROLE value */
static const t_int32 ms_iDEFAULT_ROLE;
/** the default TYPE value */
static const t_int32 ms_iDEFAULT_TYPE;
/** the default STATUS value */
static const t_int32 ms_iDEFAULT_STATUS;
/** the default RSVP value */
static const t_int32 ms_iDEFAULT_RSVP;
/** the default EXPECT value*/
static const t_int32 ms_iDEFAULT_EXPECT;
/* ---- END OF PUBLIC STATIC DATA ---- */
private:
/**
* Copy constructor
* @param Attendee & that
*/
Attendee(Attendee & that);
/**
* Fixes data-members are so that they are valid. If properties
* are invalid, then it will set it to defaults.
*/
void selfCheck();
/**
* Fixes keyword property so that it is valid. If property is
* invalid (param is out of range), then set property to default value.
* @param prop keyword property to check
* @param t_int32 param current value of keyword property
*/
void selfCheckHelper(Attendee::PROPS prop, t_int32 param);
/**
* helper in parsing delegated-to, delegated-from, member
*/
void addParamValList(UnicodeString & paramValList,
t_int32 hashCode);
/**
* format string to print Attendee with PARTSTAT NOT
* set to NEEDS-ACTION.
* @return output formatted iCal Attendee string
*/
UnicodeString formatDoneAction();
#if 0
/**
* format string to print Attendee with PARTSTAT NOT
* set to NEEDS-ACTION and Delegated-To of attendee.
* @return output formatted iCal Attendee string
*/
UnicodeString formatDoneDelegateToOnly();
/**
* format string to print Attendee with PARTSTAT NOT
* set to NEEDS-ACTION and Delegated-From of attendee.
* @return output formatted iCal Attendee string
*/
UnicodeString formatDoneDelegateFromOnly();
#endif
/* BELOW METHODS ALL ARE NEEDS ACTION */
/* no need for %S, assumed to be NEEDS-ACTION */
/**
* format string to print Attendee with PARTSTAT
* set to NEEDS-ACTION.
* @return output formatted iCal Attendee string
*/
UnicodeString formatNeedsAction();
#if 0
/**
* format string to print Attendee with PARTSTAT
* set to NEEDS-ACTION and Delegated-To of attendee.
* @return output formatted iCal Attendee string
*/
UnicodeString formatDelegateToOnly();
/**
* format string to print Attendee with PARTSTAT
* set to NEEDS-ACTION and Delegated-From of attendee.
* @return output formatted iCal Attendee string
*/
UnicodeString formatDelegateFromOnly();
#endif
/**
* Method that takes a format string and returns
* the correctly formatted iCal Attendee string
* @param strFmt format string
*
* @return output formatted iCal Attendee string
*/
UnicodeString format(UnicodeString strFmt);
/**
* Method that takes a character and returns parameter
* in iCal output format.
* @param c character representing parameter to print
*
* @return parameter in iCal output format
*/
UnicodeString formatChar(t_int32 c);
/**
* Strip double quotest from the beginning and end of string
* if it has double-quotes at beginning and end.
* @param u string to strip double-quotes from
*/
/*static void stripDoubleQuotes(UnicodeString & u);*/
/**
* Inserts double quotes at start and end of string if
* string != "".
* @param us string to add double-quotes to
*
* @return string with double-quotes at start, end (us)
*/
/*static UnicodeString & addDoubleQuotes(UnicodeString & us);*/
/**
* Prints each element in a vector of MAILTO:'s
* (i.e. member,delegated-to,delegated-from).
* @param propName name of property (i.e. MEMBER)
* @param mailto vector of MAILTO: to print
* @param out output string
*
* @return output string (out)
*/
UnicodeString & printMailToVector(UnicodeString & propName,
JulianPtrArray * mailto, UnicodeString & out);
/* ---- PRIVATE STATIC DATA ---- */
/* characters for printing Attendee parameters */
static const t_int32 ms_cAttendeeName;/* = 'N';*/
static const t_int32 ms_cAttendeeRole;/* = 'R';*/
static const t_int32 ms_cAttendeeStatus;/* = 'S';*/
static const t_int32 ms_cAttendeeRSVP;/* = 'V';*/
static const t_int32 ms_cAttendeeType;/* = 'T';*/
static const t_int32 ms_cAttendeeExpect;/* = 'E';*/
static const t_int32 ms_cAttendeeDelegatedTo;/* = 'D';*/
static const t_int32 ms_cAttendeeDelegatedFrom;/* = 'd';*/
static const t_int32 ms_cAttendeeMember;/* = 'M';*/
static const t_int32 ms_cAttendeeDir; /* = 'l'; 'el'*/
static const t_int32 ms_cAttendeeSentBy;/* = 's';*/
static const t_int32 ms_cAttendeeCN;/* = 'C';*/
static const t_int32 ms_cAttendeeLanguage;/* = 'm';*/
static const t_int32 ms_cAttendeeDisplayName;/* = 'z';*/
/* ---- END OF PRIVATE STATIC DATA ---- */
/* ---- PRIVATE DATA MEMBERS ---- */
/**
* the name of the Attendee. Whatever is to the right of the colon
* the name must be a URL. Field must be filled to be valid Attendee.
*/
UnicodeString m_sName;
/** ptr to log file to write errors to */
JLog * m_Log;
/** the attendee's role value. Default is REQ_PARTICIPANT. */
t_int32 m_iRole;
/** the attendee's type value. Default is INDIVIDUAL. */
t_int32 m_iType;
/** the attendee's status value. Default is NEEDS-ACTION. */
t_int32 m_iStatus;
/** the attendee's RSVP value. Default is FALSE. */
t_int32 m_iRSVP;
/** the attendee's expect value. Default is FYI.*/
t_int32 m_iExpect;
/**
* the list of members the attendee belongs to
* each element in members must be a MAILTO:
*/
JulianPtrArray * m_vsMember;
/**
* the list of delegated-to attendees.
* each element in delegated-to must be a MAILTO:
*/
JulianPtrArray * m_vsDelegatedTo;
/**
* the list of delegated-from attendees.
* each element in delegated-from must be a MAILTO:
*/
JulianPtrArray * m_vsDelegatedFrom;
/* added newer properties 3-23-98 */
/** the common name of attendee. Optional, default is "". */
UnicodeString m_CN;
/** the language of the common name of the attendee. Optional, default is "". */
UnicodeString m_Language;
/** the MAILTO: of a calendar user acting on behalf of the attendee.
* Optional, default is "".
*/
UnicodeString m_SentBy;
/** the location of the Attendee's directory information.
* Optional, default is "". */
UnicodeString m_Dir;
/** the type of the attendee status: STATUS depends on this */
ICalComponent::ICAL_COMPONENT m_ComponentType;
DateTime m_DTStamp;
t_int32 m_Sequence;
/* ---- END OF DATA MEMBERS ---- */
};
#endif /* __ATTENDEE_H_ */

Просмотреть файл

@ -1,120 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* bprprty.h
* John Sun
* 2/12/98 3:31:14 PM
*/
#include <unistring.h>
#include "sdprprty.h"
#ifndef __BOOLEANPROPERTY_H_
#define __BOOLEANPROPERTY_H_
/**
* BooleanProperty is a subclass of StandardProperty. It implements the ICalProperty
* interface for ICAL properties with TYPE=BOOLEAN.
*/
class BooleanProperty: public StandardProperty
{
private:
/** the boolean value of property */
t_bool m_Boolean;
/**
* Default constructor
*/
BooleanProperty();
/**
* Copy constructor
* @param that property to copy
*/
BooleanProperty(const BooleanProperty & that);
public:
/**
* Constructor that sets value of property to contents of value
* and makes a copy of the contents of parameters ptr.
* @param value value of property
* @param parameters parameters of property
*/
BooleanProperty(t_bool value, JulianPtrArray * parameters);
/**
* Destructor
*/
~BooleanProperty();
/**
* Return the value of the property
* @return void * ptr to value of the property
*/
virtual void * getValue() const;
/**
* Set the value of the property
* @param value the value to set property to
*/
virtual void setValue(void * value);
/**
* Returns a clone of this property. Clients are responsible for deleting
* the returned object.
*
* @return a clone of this property.
*/
virtual ICalProperty * clone(JLog * initLog);
/**
* Return TRUE if property is valid, FALSE otherwise
*
* @return TRUE if is valid, FALSE otherwise
*/
virtual t_bool isValid();
/**
* Return a string in human-readable form of the property.
* @param out contains output human-readable string
*
* @return the property in its human-readable string format
*/
virtual UnicodeString & toString(UnicodeString & out);
/**
* Return a string in human-readable form of the property.
* @param dateFmt format string options
* @param out contains output human-readable string
*
* @return the property in its human-readable string format
*/
virtual UnicodeString & toString(UnicodeString & dateFmt, UnicodeString & out);
/**
* Return the property's string in the ICAL format.
* @param out contains output ICAL string
*
* @return the property in its ICAL string format
*/
virtual UnicodeString & toExportString(UnicodeString & out);
};
#endif /* __BOOLEANPROPERTY_H_ */

Просмотреть файл

@ -1,124 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* bydmgntr.h
* John Sun
* 2/3/98 3:06:20 PM
*/
#ifndef __BYDAYMONTHLYGENERATOR_H_
#define __BYDAYMONTHLYGENERATOR_H_
#include "dategntr.h"
#include "rrday.h"
/**
* The ByDayMonthlyGenerator class generates dates for the
* BYDAY tag w/ a MONTHLY frequency.
*
* @see DateGenerator
*/
class ByDayMonthlyGenerator : public DateGenerator
{
public:
/**
* Default Constructor
*/
ByDayMonthlyGenerator();
/**
* Destructor
*/
~ByDayMonthlyGenerator() {}
/*---------------------------------------------------------------------*/
/* --- DateGenerator interface --- */
/**
* Returns the interval for which the generator represents.
* @return the interval (DAILY)
*/
virtual t_int32 getInterval() const;
/**
* Fills in dateVector with DateTime objects that correspond to the
* parameters and start value and the until value.
* DateTime generated should be after start's value and before until's
* value. If until is invalid, ignore it.
*
* @param start the date from which to begin generating recurrences
* @param dateVector storage for the generated dates
* @param until the end date for the recurrence
*
* @return TRUE if until date boundary was reached, FALSE otherwise
*/
virtual t_bool generate(DateTime * start,
JulianPtrArray & dateVector, DateTime * until);
/**
* Sets the week start parameter.
* @param param the week start value
*/
virtual void setParams(t_int32 param) { m_iWkSt = param; }
/**
* Sets the RRDay parameters.
* @param params[] the list of RRDay to set to
* @param length the length of params[]
* @see RRDay
*/
virtual void setRDay(RRDay params[], t_int32 length)
{
m_aiParams = params;
m_iParamsLen = length;
}
/**
* Determines if a generator has been set active.
* Usually tests if parameters have been set or not.
*
* @return TRUE if parameters set, FALSE otherwise.
*/
virtual t_bool active() { return (m_aiParams != 0); }
/* --- End of DateGenerator interface --- */
/*---------------------------------------------------------------------*/
private:
/**
* ptr to array of RRDay objects
* @see RRDay
*/
RRDay * m_aiParams;
/**
* week start value
* @see Calendar
*/
t_int32 m_iWkSt;
};
#endif /* __BYDAYMONTHLYGENERATOR_H_ */

Просмотреть файл

@ -1,120 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* bydwgntr.h
* John Sun
* 2/3/98 3:00:42 PM
*/
#ifndef __BYDAYWEEKLYGENERATOR_H_
#define __BYDAYWEEKLYGENERATOR_H_
#include "dategntr.h"
#include "rrday.h"
/**
* The ByDayWeeklyGenerator class generates dates for the
* BYDAY tag w/ a Weekly frequency.
*
* @see DateGenerator
*/
class ByDayWeeklyGenerator : public DateGenerator
{
public:
/**
* Default Constructor
*/
ByDayWeeklyGenerator();
/**
* Destructor
*/
~ByDayWeeklyGenerator() {}
/*---------------------------------------------------------------------*/
/* --- DateGenerator interface --- */
/**
* Returns the interval for which the generator represents.
* @return the interval (DAILY)
*/
virtual t_int32 getInterval() const;
/**
* Fills in dateVector with DateTime objects that correspond to the
* parameters and start value and the until value.
* DateTime generated should be after start's value and before until's
* value. If until is invalid, ignore it.
*
* @param start the date from which to begin generating recurrences
* @param dateVector storage for the generated dates
* @param until the end date for the recurrence
*
* @return TRUE if until date boundary was reached, FALSE otherwise
*/
virtual t_bool generate(DateTime * start, JulianPtrArray & dateVector, DateTime * until);
/**
* Sets the week start parameter.
* @param param the week start value
*/
virtual void setParams(t_int32 param) { m_iWkSt = param; }
/**
* Sets the RRDay parameters.
* @param params[] the list of RRDay to set to
* @param length the length of params[]
* @see RRDay
*/
virtual void setRDay(RRDay params[], t_int32 length)
{
m_aiParams = params;
m_iParamsLen = length;
}
/**
* Determines if a generator has been set active.
* Usually tests if parameters have been set or not.
*
* @return TRUE if parameters set, FALSE otherwise.
*/
virtual t_bool active() { return (m_aiParams != 0); }
/* --- End of DateGenerator interface --- */
/*---------------------------------------------------------------------*/
private:
/**
* ptr to array of RRDay objects
* @see RRDay
*/
RRDay * m_aiParams;
/**
* week start value
* @see Calendar
*/
t_int32 m_iWkSt;
};
#endif /* __BYDAYWEEKLYGENERATOR_H_ */

Просмотреть файл

@ -1,118 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* bydygntr.h
* John Sun
* 2/3/98 3:10:39 PM
*/
#ifndef __BYDAYYEARLYGENERATOR_H_
#define __BYDAYYEARLYGENERATOR_H_
#include "dategntr.h"
#include "rrday.h"
/**
* The ByDayYearlyGenerator class generates dates for the
* BYDAY tag w/ a YEARLY frequency.
*
* @see DateGenerator
*/
class ByDayYearlyGenerator : public DateGenerator
{
public:
/**
* Default Constructor
*/
ByDayYearlyGenerator();
/**
* Destructor
*/
~ByDayYearlyGenerator() {}
/*---------------------------------------------------------------------*/
/* --- DateGenerator interface --- */
/**
* Returns the interval for which the generator represents.
* @return the interval (DAILY)
*/
virtual t_int32 getInterval() const;
/**
* Fills in dateVector with DateTime objects that correspond to the
* parameters and start value and the until value.
* DateTime generated should be after start's value and before until's
* value. If until is invalid, ignore it.
*
* @param start the date from which to begin generating recurrences
* @param dateVector storage for the generated dates
* @param until the end date for the recurrence
*
* @return TRUE if until date boundary was reached, FALSE otherwise
*/
virtual t_bool generate(DateTime * start, JulianPtrArray & dateVector, DateTime * until);
/**
* Sets the week start parameter.
* @param param the week start value
*/
void setParams(t_int32 param) { m_iWkSt = param; }
/**
* Sets the RRDay parameters.
* @param params[] the list of RRDay to set to
* @param length the length of params[]
* @see RRDay
*/
virtual void setRDay(RRDay params[], t_int32 length)
{
m_aiParams = params;
m_iParamsLen = length;
}
/**
* Determines if a generator has been set active.
* Usually tests if parameters have been set or not.
*
* @return TRUE if parameters set, FALSE otherwise.
*/
virtual t_bool active() { return (m_aiParams != 0); }
/* --- End of DateGenerator interface --- */
/*---------------------------------------------------------------------*/
private:
/**
* ptr to array of RRDay objects
* @see RRDay
*/
RRDay * m_aiParams;
/**
* week start value
* @see Calendar
*/
t_int32 m_iWkSt;
};
#endif /* __BYDAYYEARLYGENERATOR_H_ */

Просмотреть файл

@ -1,104 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* byhgntr.h
* John Sun
* 2/3/98 3:13:16 PM
*/
#ifndef __BYHOURGENERATOR_H_
#define __BYHOURGENERATOR_H_
#include "dategntr.h"
/**
* The ByHourGenerator class generates dates for the BYHOUR tag.
*
* @see DateGenerator
*/
class ByHourGenerator : public DateGenerator
{
public:
/**
* Default Constructor
*/
ByHourGenerator();
/**
* Destructor
*/
~ByHourGenerator() {}
/*---------------------------------------------------------------------*/
/* --- DateGenerator interface --- */
/**
* Returns the interval for which the generator represents.
* @return the interval (HOURLY)
*/
virtual t_int32 getInterval() const;
/**
* Fills in dateVector with DateTime objects that correspond to the
* parameters and start value and the until value.
* DateTime generated should be after start's value and before until's
* value. If until is invalid, ignore it.
*
* @param start the date from which to begin generating recurrences
* @param dateVector storage for the generated dates
* @param until the end date for the recurrence
*
* @return TRUE if until date boundary was reached, FALSE otherwise
*/
virtual t_bool generate(DateTime * start, JulianPtrArray & dateVector, DateTime * until);
/**
* Sets the hour (i.e. -23 - +23) parameters.
* @param params[] the list of hours to set to
* @param length the length of params[]
*/
virtual void setParamsArray(t_int32 params[], t_int32 length)
{
m_aiParams = params;
m_iParamsLen = length;
}
/**
* Determines if a generator has been set active.
* Usually tests if parameters have been set or not.
*
* @return TRUE if parameters set, FALSE otherwise.
*/
virtual t_bool active()
{
return (m_aiParams != 0);
}
/* --- End of DateGenerator interface --- */
/*---------------------------------------------------------------------*/
private:
/** hour parameters */
t_int32 * m_aiParams;
};
#endif /* __BYHOURGENERATOR_H_ */

Просмотреть файл

@ -1,103 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* bymdgntr.h
* John Sun
* 2/3/98 3:19:58 PM
*/
#ifndef __BYMONTHDAYGENERATOR_H_
#define __BYMONTHDAYGENERATOR_H_
#include "dategntr.h"
/**
* The ByMonthDayGenerator class generates dates for the BYMONTHDAY tag.
*
* @see DateGenerator
*/
class ByMonthDayGenerator : public DateGenerator
{
public:
/**
* Default Constructor
*/
ByMonthDayGenerator();
/**
* Destructor
*/
~ByMonthDayGenerator() {}
/*---------------------------------------------------------------------*/
/* --- DateGenerator interface --- */
/**
* Returns the interval for which the generator represents.
* @return the interval (DAILY)
*/
virtual t_int32 getInterval() const;
/**
* Fills in dateVector with DateTime objects that correspond to the
* parameters and start value and the until value.
* DateTime generated should be after start's value and before until's
* value. If until is invalid, ignore it.
*
* @param start the date from which to begin generating recurrences
* @param dateVector storage for the generated dates
* @param until the end date for the recurrence
*
* @return TRUE if until date boundary was reached, FALSE otherwise
*/
virtual t_bool generate(DateTime * start, JulianPtrArray & dateVector, DateTime * until);
/**
* Sets the dates in month (i.e. -31 - +31) parameters.
* @param params[] the list of dates in month to set to
* @param length the length of params[]
*/
virtual void setParamsArray(t_int32 params[], t_int32 length)
{
m_aiParams = params;
m_iParamsLen = length;
}
/**
* Determines if a generator has been set active.
* Usually tests if parameters have been set or not.
*
* @return TRUE if parameters set, FALSE otherwise.
*/
virtual t_bool active() { return (m_aiParams != 0); }
/* --- End of DateGenerator interface --- */
/*---------------------------------------------------------------------*/
private:
/** dates in month parameters */
t_int32 * m_aiParams;
};
#endif /* __BYMONTHDAYGENERATOR_H_ */

Просмотреть файл

@ -1,102 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* bymgntr.h
* John Sun
* 2/3/98 2:59:55 PM
*/
#ifndef __BYMINUTEGENERATOR_H_
#define __BYMINUTEGENERATOR_H_
#include "dategntr.h"
/**
* The ByMinuteGenerator class generates dates for the BYMINUTE tag.
*
* @see DateGenerator
*/
class ByMinuteGenerator : public DateGenerator
{
public:
/**
* Default Constructor
*/
ByMinuteGenerator();
/**
* Destructor
*/
~ByMinuteGenerator() {}
/*---------------------------------------------------------------------*/
/* --- DateGenerator interface --- */
/**
* Returns the interval for which the generator represents.
* @return the interval (MINUTELY)
*/
virtual t_int32 getInterval() const;
/**
* Fills in dateVector with DateTime objects that correspond to the
* parameters and start value and the until value.
* DateTime generated should be after start's value and before until's
* value. If until is invalid, ignore it.
*
* @param start the date from which to begin generating recurrences
* @param dateVector storage for the generated dates
* @param until the end date for the recurrence
*
* @return TRUE if until date boundary was reached, FALSE otherwise
*/
virtual t_bool generate(DateTime * start, JulianPtrArray & dateVector, DateTime * until);
/**
* Sets the minute (i.e. -59 - +59) parameters.
* @param params[] the list of minutes to set to
* @param length the length of params[]
*/
virtual void setParamsArray(t_int32 params[], t_int32 length)
{
m_aiParams = params;
m_iParamsLen = length;
}
/**
* Determines if a generator has been set active.
* Usually tests if parameters have been set or not.
*
* @return TRUE if parameters set, FALSE otherwise.
*/
virtual t_bool active() { return (m_aiParams != 0); }
/* --- End of DateGenerator interface --- */
/*---------------------------------------------------------------------*/
private:
/** minute parameters */
t_int32 * m_aiParams;
};
#endif /* __BYMINUTEGENERATOR_H_ */

Просмотреть файл

@ -1,103 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* bymogntr.h
* John Sun
* 2/3/98 3:19:43 PM
*/
#ifndef __BYMONTHGENERATOR_H_
#define __BYMONTHGENERATOR_H_
#include "dategntr.h"
/**
* The ByMonthGenerator class generates dates for the BYMONTH tag.
*
* @see DateGenerator
*/
class ByMonthGenerator : public DateGenerator
{
public:
/**
* Default Constructor
*/
ByMonthGenerator();
/**
* Destructor
*/
~ByMonthGenerator() {}
/*---------------------------------------------------------------------*/
/* --- DateGenerator interface --- */
/**
* Returns the interval for which the generator represents.
* @return the interval (MONTHLY)
*/
virtual t_int32 getInterval() const;
/**
* Fills in dateVector with DateTime objects that correspond to the
* parameters and start value and the until value.
* DateTime generated should be after start's value and before until's
* value. If until is invalid, ignore it.
*
* @param start the date from which to begin generating recurrences
* @param dateVector storage for the generated dates
* @param until the end date for the recurrence
*
* @return TRUE if until date boundary was reached, FALSE otherwise
*/
virtual t_bool generate(DateTime * start, JulianPtrArray & dateVector, DateTime * until);
/**
* Sets the month (i.e. -12 - +12) parameters.
* @param params[] the list of months to set to
* @param length the length of params[]
*/
virtual void setParamsArray(t_int32 params[], t_int32 length)
{
m_aiParams = params;
m_iParamsLen = length;
}
/**
* Determines if a generator has been set active.
* Usually tests if parameters have been set or not.
*
* @return TRUE if parameters set, FALSE otherwise.
*/
virtual t_bool active() { return (m_aiParams != 0); }
/* --- End of DateGenerator interface --- */
/*---------------------------------------------------------------------*/
private:
/** month parameters */
t_int32 * m_aiParams;
};
#endif /* __BYMONTHGENERATOR_H_ */

Просмотреть файл

@ -1,101 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* bywngntr.h
* John Sun
* 2/3/98 3:19:13 PM
*/
#ifndef __BYWEEKNOGENERATOR_H_
#define __BYWEEKNOGENERATOR_H_
#include "dategntr.h"
/**
* The ByWeekNoGenerator class generates dates for the BYWEEKNO tag.
*
* @see DateGenerator
*/
class ByWeekNoGenerator : public DateGenerator
{
public:
/**
* Default Constructor
*/
ByWeekNoGenerator();
/**
* Destructor
*/
~ByWeekNoGenerator() {}
/*---------------------------------------------------------------------*/
/* --- DateGenerator interface --- */
/**
* Returns the interval for which the generator represents.
* @return the interval (WEEKLY)
*/
virtual t_int32 getInterval() const;
/**
* Fills in dateVector with DateTime objects that correspond to the
* parameters and start value and the until value.
* DateTime generated should be after start's value and before until's
* value. If until is invalid, ignore it.
*
* @param start the date from which to begin generating recurrences
* @param dateVector storage for the generated dates
* @param until the end date for the recurrence
*
* @return TRUE if until date boundary was reached, FALSE otherwise
*/
virtual t_bool generate(DateTime * start, JulianPtrArray & dateVector, DateTime * until);
/**
* Sets the week number (i.e. -53 - +53) parameters.
* @param params[] the list of weeks to set to
* @param length the length of params[]
*/
virtual void setParamsArray(t_int32 params[], t_int32 length)
{
m_aiParams = params;
m_iParamsLen = length;
}
/**
* Determines if a generator has been set active.
* Usually tests if parameters have been set or not.
*
* @return TRUE if parameters set, FALSE otherwise.
*/
virtual t_bool active() { return (m_aiParams != 0); }
/* --- End of DateGenerator interface --- */
/*---------------------------------------------------------------------*/
private:
/** week parameters */
t_int32 * m_aiParams;
};
#endif /* __BYWEEKNOGENERATOR_H_ */

Просмотреть файл

@ -1,102 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* byydgntr.h
* John Sun
* 2/3/98 3:41:44 PM
*/
#ifndef __BYYEARDAYGENERATOR_H_
#define __BYYEARDAYGENERATOR_H_
#include "dategntr.h"
/**
* The ByYearDayGenerator class generates dates for the BYYEARDAY tag.
*
* @see DateGenerator
*/
class ByYearDayGenerator : public DateGenerator
{
public:
/**
* Default Constructor
*/
ByYearDayGenerator();
/**
* Destructor
*/
~ByYearDayGenerator() {}
/*---------------------------------------------------------------------*/
/* --- DateGenerator interface --- */
/**
* Returns the interval for which the generator represents.
* @return the interval (DAILY)
*/
virtual t_int32 getInterval() const;
/**
* Fills in dateVector with DateTime objects that correspond to the
* parameters and start value and the until value.
* DateTime generated should be after start's value and before until's
* value. If until is invalid, ignore it.
*
* @param start the date from which to begin generating recurrences
* @param dateVector storage for the generated dates
* @param until the end date for the recurrence
*
* @return TRUE if until date boundary was reached, FALSE otherwise
*/
virtual t_bool generate(DateTime * start, JulianPtrArray & dateVector, DateTime * until);
/**
* Sets the dates in year (i.e. -366 - +366) parameters.
* @param params[] the list of dates in year to set to
* @param length the length of params[]
*/
virtual void setParamsArray(t_int32 params[], t_int32 length)
{
m_aiParams = params;
m_iParamsLen = length;
}
/**
* Determines if a generator has been set active.
* Usually tests if parameters have been set or not.
*
* @return TRUE if parameters set, FALSE otherwise.
*/
virtual t_bool active() { return (m_aiParams != 0); }
/* --- End of DateGenerator interface --- */
/*---------------------------------------------------------------------*/
private:
/** dates in year parameters */
t_int32 * m_aiParams;
};
#endif /* __BYYEARDAYGENERATOR_H_ */

Просмотреть файл

@ -1,170 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* capiredr.h
* John Sun
* 4/16/98 3:31:51 PM
*/
#ifndef __ICALCAPIREADER_H_
#define __ICALCAPIREADER_H_
/*#ifdef XP_WIN
#ifndef CAPI_READY
#define CAPI_READY
#endif
#endif*/
#include "jdefines.h"
#include <unistring.h>
#include "ptrarray.h"
#include "icalredr.h"
#include "prmon.h"
#include "jutility.h"
/**
* ICalCAPIReader is a subclass of ICalReader. It implements
* the ICalReader interface to work with CAPI callback method
* to parse from stream.
* Uses multiple threads.
*/
class ICalCAPIReader
{
private:
/*-----------------------------
** MEMBERS
**---------------------------*/
/* current buffer of iCal information,
* when CAPI has information to return to
* the buffer, it must append to this buffer
* when no more full-lines can be made from the
* buffer, block on the monitor. Will be
* notified when CAPI gets back more information
*/
char * m_Buffer;
t_int32 m_BufferSize;
t_bool m_Init;
t_int32 m_Mark;
t_int32 m_ChunkMark;
t_int32 m_Pos;
t_int32 m_ChunkIndex;
/** encoding of stream */
nsCalUtility::MimeEncoding m_Encoding;
JulianPtrArray * m_Chunks;
static const t_int32 m_MAXBUFFERSIZE;
static const t_int32 m_NOMORECHUNKS;
/* finished getting input from CAPI callback */
t_bool m_bFinished;
PRMonitor * m_Monitor;
/*-----------------------------
** PRIVATE METHODS
**---------------------------*/
UnicodeString & createLine(t_int32 oldPos, t_int32 oldChunkIndex,
t_int32 newPos, t_int32 newChunkIndex, UnicodeString & aLine);
static void deleteUnicodeStringVector(JulianPtrArray * stringVector);
ICalCAPIReader();
public:
/*-----------------------------
** CONSTRUCTORS and DESTRUCTORS
**---------------------------*/
ICalCAPIReader(PRMonitor * monitor,
nsCalUtility::MimeEncoding encoding = nsCalUtility::MimeEncoding_7bit);
virtual ~ICalCAPIReader();
/*-----------------------------
** ACCESSORS (GET AND SET)
**---------------------------*/
virtual void * getMonitor() { return m_Monitor; }
void setFinished() { m_bFinished = TRUE; }
void setEncoding(nsCalUtility::MimeEncoding encoding) { m_Encoding = encoding; }
t_bool isFinished() const { return m_bFinished; }
/**
* Sets a the buffer to read from.
* Appends the m_Buffer.
*/
/*virtual void setBuffer(const char * capiChunk);*/
/**
* Don't delete u until this object is deleted.
* @param UnicodeString * u
*
* @return void
*/
void AddChunk(UnicodeString * u);
/*-----------------------------
** UTILITIES
**---------------------------*/
void mark() { m_Mark = m_Pos; m_ChunkMark = m_ChunkIndex;}
void reset() { m_Pos = m_Mark; m_ChunkIndex = m_ChunkMark;}
/**
* Read next character from file.
*
* @param status, return 1 if no more characters
* @return next character of string
*/
virtual t_int8 read(ErrorCode & status);
/**
* Read the next ICAL full line of the file. The definition
* of a full ICAL line can be found in the ICAL spec.
* Basically, a line followed by a CRLF and a space character
* signifies that the next line is a continuation of the previous line.
* Uses the readLine, read methods.
*
* @param aLine, returns next full line of string
* @param status, return 1 if no more lines
*
* @return next full line of string
*/
virtual UnicodeString & readFullLine(UnicodeString & aLine, ErrorCode & status, t_int32 i = 0);
/**
* Read next line of file. A line is defined to be
* characters terminated by either a '\n', '\r' or "\r\n".
* @param aLine, return next line of string
* @param status, return 1 if no more lines
*
* @return next line of string
*/
virtual UnicodeString & readLine(UnicodeString & aLine, ErrorCode & status);
public:
/*virtual UnicodeString & readLineZero(UnicodeString & aLine, ErrorCode & status);*/
};
#endif /* __ICALCAPIREADER_H_ */

Просмотреть файл

@ -1,166 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* dategntr.h
* John Sun
* 2/3/98 2:57:44 PM
*/
#ifndef __DATEGENERATOR_H_
#define __DATEGENERATOR_H_
#include <assert.h>
#include "nspr.h"
#include "ptypes.h"
#include "datetime.h"
#include "ptrarray.h"
#include "rrday.h"
/**
* The DateGenerator class defines an interface that provides a basic
* call structure for a BYxxx tag.
* DateGenerators are combined in the context of a Recurrence object
* to create more specialized and versatile date recurrences.
*
* @see DateGenerator
*/
class DateGenerator
{
public:
/**
* Virtual Destructor.
*/
virtual ~DateGenerator() {}
/**
* Returns the interval for which the generator spans.
* (i.e. a year, a month, a week, etc)
*
* @return the generator's interval
*/
t_int32 getSpan() const { return m_iSpan; }
/**
* Sets the generation interval.
* (i.e. minutely, hourly, daily, weekly, monthly, yearly)
* @param span span value to set to.
*/
void setSpan(t_int32 span) { m_iSpan = span; }
/*---------------------------------------------------------------------*/
/* --- DateGenerator interface --- */
/**
* Pure virtual. Returns the interval for which the generator represents.
* @return the interval (DAILY)
*/
virtual t_int32 getInterval() const { PR_ASSERT(FALSE); return -1;}
/**
* Pure virtual. Fills in dateVector with DateTime objects that correspond to the
* parameters and start value and the until value.
* DateTime generated should be after start's value and before until's
* value. If until is invalid, ignore it.
*
* @param start the date from which to begin generating recurrences
* @param dateVector storage for the generated dates
* @param until the end date for the recurrence
*
* @return TRUE if until date boundary was reached, FALSE otherwise
*/
virtual t_bool generate(DateTime * startDate,
JulianPtrArray & dateVector, DateTime * until)
{
/* PR_ASSERT(FALSE); */
if (startDate) {}
if (until) {}
if (dateVector.GetSize() == 0) {}
return FALSE;
}
/**
* Pure virtual. A general method to set a single parameter.
* Usually sets the week start parameter.
* @param param the week start value
*/
virtual void setParams(t_int32 param)
{
if (param == 0) {}
}
/**
* Pure virtual. A general method to set a list of parameters.
* @param params[] a list of parameters
* @param length the length of params[]
*
*/
virtual void setParamsArray(t_int32 params[], t_int32 length)
{
if (params != 0) {}
if (length == 0) {}
}
/**
* A general method to set a list of lists of parameters for a <code>DateGenerator</code>.
*/
virtual void setRDay(RRDay params[], t_int32 length)
{
/* PR_ASSERT(FALSE); */
if (params != 0) {}
if (length == 0) {}
}
/**
* Pure virtual. Determines if a generator has been set active.
* Usually tests if parameters have been set or not.
*
* @return TRUE if generator is active, FALSE otherwise.
*/
virtual t_bool active() { PR_ASSERT(FALSE); return FALSE; }
/* --- End of DateGenerator interface --- */
/*---------------------------------------------------------------------*/
protected:
/**
* Constructor sets span, parameters length.
* @param span initial span value
* @param paramsLen initial parameters length value
*/
DateGenerator(t_int32 span, t_int32 paramsLen = 0);
/** span value */
t_int32 m_iSpan;
/** parameters length */
t_int32 m_iParamsLen;
private:
/** hide default constructor */
DateGenerator();
};
#endif /* __DATEGENERATOR_H_ */

Просмотреть файл

@ -1,110 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* deftgntr.h
* John Sun
* 2/3/98 3:46:49 PM
*/
#ifndef __DEFAULTGENERATOR_H_
#define __DEFAULTGENERATOR_H_
#include "dategntr.h"
/**
* The DefaultGenerator class generates dates for rules w/o BYxxx tags.
*
* @see DateGenerator
*/
class DefaultGenerator : public DateGenerator
{
public:
/**
* Default Constructor
*/
DefaultGenerator();
/**
* Destructor
*/
~DefaultGenerator() {}
/*---------------------------------------------------------------------*/
/* --- DateGenerator interface --- */
/**
* Returns the interval for which the generator represents.
* @return the interval (MONTHLY)
*/
virtual t_int32 getInterval() const;
/**
* Fills in dateVector with DateTime objects that correspond to the
* parameters and start value and the until value.
* DateTime generated should be after start's value and before until's
* value. If until is invalid, ignore it.
*
* @param start the date from which to begin generating recurrences
* @param dateVector storage for the generated dates
* @param until the end date for the recurrence
*
* @return TRUE if until date boundary was reached, FALSE otherwise
*/
virtual t_bool generate(DateTime * start, JulianPtrArray & dateVector, DateTime * until);
/**
* Sets the week start parameter.
* @param param the week start value
*/
virtual void setParams(t_int32 param) { m_iSpan = m_aiParams[2] = param; }
/**
* Sets the span, count, interval parameters. TODO: move to the .cpp file.
* @param params[] the list of parameters to set to
* @param length the length of params[]
*/
virtual void setParamsArray(t_int32 params[], t_int32 length)
{
isActive = TRUE;
t_int32 i;
for (i = 0; i < length; i++)
m_aiParams[i] = params[i];
}
/**
* Determines if a generator has been set active.
*
* @return TRUE if isActive in On, FALSE otherwise
*/
virtual t_bool active() { return isActive; }
/* --- End of DateGenerator interface --- */
/*---------------------------------------------------------------------*/
private:
/** whether generator's parameters have been set by client */
t_bool isActive;
/** contains span, interval, count as parameters */
t_int32 m_aiParams[3];
};
#endif /* __DEFAULTGENERATOR_H_ */

Просмотреть файл

@ -1,153 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* dprprty.h
* John Sun
* 2/12/98 3:16:32 PM
*/
#include <unistring.h>
#include "sdprprty.h"
#include "datetime.h"
#ifndef __DATETIMEPROPERTY_H_
#define __DATETIMEPROPERTY_H_
/**
* DateTimeProperty is a subclass of StandardProperty. It implements the ICalProperty
* interface for ICAL properties with TYPE=DATETIME or TYPE=DATE.
*/
class DateTimeProperty: public StandardProperty
{
private:
/** the DateTime value of the property */
DateTime m_DateTime;
/**
* Default constructor
*/
DateTimeProperty();
/**
* Copy constructor
* @param that property to copy
*/
DateTimeProperty(const DateTimeProperty & that);
public:
/**
* Constructor that sets value of property to contents of value
* and makes a copy of the contents of parameters ptr.
* @param value value of property
* @param parameters parameters of property
*/
DateTimeProperty(DateTime value, JulianPtrArray * parameters);
/**
* Destructor
*/
~DateTimeProperty();
/**
* Return the value of the property
* @return void * ptr to value of the property
*/
virtual void * getValue() const;
/**
* Set the value of the property
* @param value the value to set property to
*/
virtual void setValue(void * value);
/**
* Returns a clone of this property. Clients are responsible for deleting
* the returned object.
*
* @return a clone of this property.
*/
virtual ICalProperty * clone(JLog * initLog);
/**
* Return TRUE if property is valid, FALSE otherwise
*
* @return TRUE if is valid, FALSE otherwise
*/
virtual t_bool isValid();
/**
* Return a string in human-readable form of the property.
* @param out contains output human-readable string
*
* @return the property in its human-readable string format
*/
virtual UnicodeString & toString(UnicodeString & out);
/**
* Return a string in human-readable form of the property. For DateTimes,
* dateFmt would contain the a DateFormat string (i.e "MM/dd/yy hh:mm:ss a").
* @param dateFmt format string options
* @param out contains output human-readable string
*
* @return the property in its human-readable string format
*/
virtual UnicodeString & toString(UnicodeString & dateFmt, UnicodeString & out);
/**
* Return the property's string in the ICAL format. For DateTimes, this
* would be the ISO8601 UTC date format of the datetime (i.e. 19971110T112233Z).
* @param out contains output ICAL string
*
* @return the property in its ICAL string format
*/
virtual UnicodeString & toExportString(UnicodeString & out);
/**
* Returns the property's ICAL format strings,
* to output string of the form
* :value or ;param1;param2;param3(etc.):value
* ONLY: DateTimeProperty overrides this
* (This is too handle NOT printing VALUE and TZID parameters)
*
* @param out output ICAL string
*
* @return output ICAL string (out)
*/
UnicodeString & toICALString(UnicodeString & out);
/**
* Returns the property's ICAL format strings, inserting
* sProp (property name) to output string of the form
* sProp:value or sProp;param1;param2;param3(etc.):value
* ONLY: DateTimeProperty overrides this
* (This is too handle NOT printing VALUE and TZID parameters)
*
* @param sProp property name of property
* @param out output ICAL string
*
* @return output ICAL string (out)
*/
UnicodeString & toICALString(UnicodeString & sProp,
UnicodeString & out);
};
#endif /* __DATETIMEPROPERTY_H_ */

Просмотреть файл

@ -1,121 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* duprprty.h
* John Sun
* 2/12/98 3:37:06 PM
*/
#include <unistring.h>
#include "sdprprty.h"
#include "duration.h"
#ifndef __DURATIONPROPERTY_H_
#define __DURATIONPROPERTY_H_
/**
* DurationProperty is a subclass of StandardProperty. It implements the ICalProperty
* interface for ICAL properties with TYPE=DURATION.
*/
class DurationProperty: public StandardProperty
{
private:
/** the nsCalDuration value of the property */
nsCalDuration m_Duration;
/**
* Default constructor
*/
DurationProperty();
/**
* Copy constructor
* @param that property to copy
*/
DurationProperty(const DurationProperty & that);
public:
/**
* Constructor that sets value of property to contents of value
* and makes a copy of the contents of parameters ptr.
* @param value value of property
* @param parameters parameters of property
*/
DurationProperty(nsCalDuration value, JulianPtrArray * parameters);
/**
* Destructor
*/
~DurationProperty();
/**
* Return the value of the property
* @return void * ptr to value of the property
*/
virtual void * getValue() const;
/**
* Set the value of the property
* @param value the value to set property to
*/
virtual void setValue(void * value);
/**
* Returns a clone of this property. Clients are responsible for deleting
* the returned object.
*
* @return a clone of this property.
*/
virtual ICalProperty * clone(JLog * initLog);
/**
* Return TRUE if property is valid, FALSE otherwise
*
* @return TRUE if is valid, FALSE otherwise
*/
virtual t_bool isValid();
/**
* Return a string in human-readable form of the property.
* @param out contains output human-readable string
*
* @return the property in its human-readable string format
*/
virtual UnicodeString & toString(UnicodeString & out);
/**
* Return a string in human-readable form of the property.
* @param dateFmt format string options
* @param out contains output human-readable string
*
* @return the property in its human-readable string format
*/
virtual UnicodeString & toString(UnicodeString & dateFmt, UnicodeString & out);
/**
* Return the property's string in the ICAL format.
* @param out contains output ICAL string
*
* @return the property in its ICAL string format
*/
virtual UnicodeString & toExportString(UnicodeString & out);
};
#endif /* __DURATIONPROPERTY_H_ */

Просмотреть файл

@ -1,435 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* freebusy.h
* John Sun
* 2/18/98 1:35:51 PM
*/
#ifndef __FREEBUSY_H_
#define __FREEBUSY_H_
#include <unistring.h>
#include "datetime.h"
#include "period.h"
#include "prprty.h"
#include "jlog.h"
#include "julnstr.h"
/**
* The Freebusy class encapsulates the data in the iCalendar
* FREEBUSY property. A Freebusy contains two parameters, a TYPE and BSTAT
* parameters. These are repesented by the enumerations (FB_TYPE).
* (FB_STATUS ifdef'd out 4-28-98).
* The Freebusy must contain periods, which are contained in a vector of periods.
*/
class Freebusy: public ICalProperty
{
public:
/* 4-28-98 combine TYPE and STATUS into just TYPE */
#if 0
/** enumeration of TYPE parameters */
enum FB_TYPE{FB_TYPE_BUSY = 0, FB_TYPE_FREE = 1,
FB_TYPE_LENGTH = 2, FB_TYPE_INVALID = -1
};
/** enumeration of BSTAT parameters */
enum FB_STATUS{FB_STATUS_BUSY = 0, FB_STATUS_UNAVAILABLE = 1,
FB_STATUS_TENTATIVE = 2,
FB_STATUS_LENGTH = 3, FB_STATUS_INVALID = -1
};
/** list acceptable keywords properties in a FREEBUSY */
enum FB_PROPS{FB_PROPS_TYPE = 0, FB_PROPS_STATUS};
#else
/** enumeration of TYPE parameters */
enum FB_TYPE{FB_TYPE_BUSY = 0, FB_TYPE_FREE = 1,
FB_TYPE_BUSY_UNAVAILABLE = 2, FB_TYPE_BUSY_TENTATIVE = 3,
FB_TYPE_XPARAMVAL = 4,
FB_TYPE_LENGTH = 5, FB_TYPE_INVALID = -1};
/** list acceptable keywords properties in a FREEBUSY */
enum FB_PROPS{FB_PROPS_TYPE = 0};
#endif
/**
* Converts TYPE string to a FB_TYPE enumeration value
* @param sType type string
*
* @return FB_TYPE that represents that string
*/
static Freebusy::FB_TYPE stringToType(UnicodeString & sType);
/**
* Converts FB_TYPE to string. If bad type, return default (BUSY).
* @param type FB_TYPE enumeration value
* @param out output type string
*
* @return output type string (out)
*/
static UnicodeString & typeToString(Freebusy::FB_TYPE type, UnicodeString & out);
#if 0
/**
* Converts BSTAT string to a FB_STATUS enumeration
* @param sStatus status string
*
* @return FB_STATUS that represents that string
*/
static Freebusy::FB_STATUS stringToStatus(UnicodeString & sType);
/**
* Converts FB_STATUS to string. If bad status, return default (BUSY).
* @param attstat FB_STATUS enumeration value
* @param out output BSTAT string
*
* @return output BSTAT string (out)
*/
static UnicodeString & statusToString(Freebusy::FB_STATUS status, UnicodeString & out);
#endif
private:
#if 0
/** default FB_STATUS value */
static const t_int32 ms_iDEFAULT_STATUS;
#endif
/** default FB_TYPE value */
static const t_int32 ms_iDEFAULT_TYPE;
/* DATA-MEMBERS */
/* storing type and status as ints instead of strings */
/** type value. Default is FB_TYPE_BUSY. */
t_int32 m_Type;
#if 0
/** bstat value. Default is FB_STATUS_BUSY. */
t_int32 m_Status;
#endif
/** vector of freebusy periods */
JulianPtrArray * m_vPeriod;
/** ptr to log file to write errors to */
JLog * m_Log;
JulianString m_sCurl; /* cal url where this curl is stored, may be an empty string */
/* characters for printing Freebusy parameters */
static const t_int32 ms_cFreebusyType;/* = 'T';*/
static const t_int32 ms_cFreebusyPeriod;/* = 'P';*/
#if 0
static const t_int32 ms_cFreebusyStatus;/* = 'S';*/
#endif
/* -- private methods -- */
/**
* convert a character to the content of a parameter in
* human-readable string format
*
* @param c a character represents a parameter
* @return parameter in a string
*/
UnicodeString & toStringChar(t_int32 c, UnicodeString & out);
/**
* Helper method to parse a string of periods.
* @param s string containing periods
* @param vTimeZones vector of timezones (usually 0)
*/
void parsePeriod(UnicodeString & s, JulianPtrArray * vTimeZones);
/**
* Sets parameter with name paramName with value paramVal.
* @param paramName parameter name to set
* @param paramVal new value of parameter
*/
void setParam(UnicodeString & paramName, UnicodeString & paramVal);
/**
* Fixes data-members are so that they are valid. If properties
* are invalid, then it will set it to defaults.
*/
void selfCheck();
/**
* Sets default value for property
* @param prop property to set default value
*/
void setDefaultProps(Freebusy::FB_PROPS prop);
/**
* Sort the periods vector by the starting time of periods.
*/
void sortPeriods();
/**
* Sort the periods vector by the ending time of the periods.
*/
void sortPeriodsByEndTime();
#if 0
/**
* Default constructor. Hide from clients.
*/
Freebusy();
#endif
/**
* Copy constructor.
* @param that Freebusy to copy
*/
Freebusy(Freebusy & that);
public:
/**
* Constructor. Also sets log file to write errors to.
* @param initLog log file to write errors to
*/
Freebusy(JLog * initLog = 0);
/**
* Destructor
*/
~Freebusy();
/*---------- To satisfy ICalProperty interface ----------*/
/**
* Sets parameters.
* @param parameters vector of parameters to set
*
*/
virtual void setParameters(JulianPtrArray * parameters);
/**
* Return value of property. Never use. Use getPeriod().
*
* @return value of property
*/
virtual void * getValue() const { PR_ASSERT(FALSE); return 0; }
/**
* Sets value of property. Never use. Use addPeriod().
* @param value new value of property
*
*/
virtual void setValue(void * value) {PR_ASSERT(FALSE); if(value){} }
/**
* Returns a clone of this property.
* @param initLog the log file for clone to write to
*
* @return clone of this ICalProperty object
*/
virtual ICalProperty * clone(JLog * initLog);
/**
* Checks whether this property is valid or not. Period vector size
* must be greater than 0 to be TRUE.
*
* @return TRUE if property is valid, FALSE otherwise
*/
virtual t_bool isValid();
/**
* Return property to human-readable string.
* @param dateFmt formatting string
* @param out output human-readable string
*
* @return output human-readable string (out)
*/
virtual UnicodeString & toString(UnicodeString & strFmt, UnicodeString & out);
/**
* Return property to human-readable string.
* @param out output human-readable string
*
* @return output human-readable string (out)
*/
virtual UnicodeString & toString(UnicodeString & out);
/**
* Return property to iCal property string.
* @param out output iCal string
*
* @return output iCal string (out)
*/
virtual UnicodeString & toICALString(UnicodeString & out);
/**
* Return property to iCal property string. Inserts sProp to
* front of output string. sProp should be the property name of this
* property.
* @param sProp property name to append to insert at front of out
* @param out output iCal string with sProp in front
*
* @return output iCal string with sProp in front (out)
*/
virtual UnicodeString & toICALString(UnicodeString & sProp, UnicodeString & out);
/*----------End of ICalProperty interface----------*/
/**
* Returns FB_TYPE value.
*
* @return FB_TYPE value
*/
Freebusy::FB_TYPE getType() const { return (Freebusy::FB_TYPE) m_Type; }
/**
* Sets FB_TYPE.
* @param i new FB_TYPE value
*
*/
void setType(FB_TYPE type) {m_Type = type;}
#if 0
/**
* Returns FB_STATUS value.
*
* @return FB_STATUS value
*/
Freebusy::FB_STATUS getStatus() const { return (Freebusy::FB_STATUS) m_Status; }
/**
* Sets FB_STATUS.
* @param i new FB_STATUS value
*
*/
void setStatus(FB_STATUS status) {m_Status = status;}
#endif
/**
* Return vector of periods.
*
* @return vector of periods
*/
JulianPtrArray * getPeriod() const { return m_vPeriod; }
/**
* Adds a period to period vector. It makes a copy of the period.
* So client must delete p. Freebusy does NOT take ownership of p.
* @param p period to add to vector
*/
void addPeriod(Period * p);
/**
* Adds each period in argument vector to this Freebusy's
* period vector
* @param periods vector of periods to add
*/
void addAllPeriods(JulianPtrArray * periods);
/*
void removePeriod(Period *p)
{
PR_ASSERT(p != 0);
PR_ASSERT(m_vPeriod != 0);
m_vPeriod->Remove(p);
delete p;
}
*/
/**
* Return starting time of first period chronologically.
*
* @return starting time of first period.
*/
DateTime startOfFreebusyPeriod();
/**
* Return ending time of last period chronologically.
*
* @return starting time of first period.
*/
DateTime endOfFreebusyPeriod();
/**
* Parse a Freebusy property line and populate data.
* @param in line to parse.
*/
void parse(UnicodeString & in);
/**
* Given freebusy period values in string, parameters, and timezones
* populates Freebusy data members.
* @param propVal freebusy period string
* @param parameters freebusy parameters
* @param vTimeZones vector of timezones to adjust dates to
*
*/
void parse(UnicodeString & sPeriods, JulianPtrArray * parameters,
JulianPtrArray * vTimeZones = 0);
/**
* Compresses overlapping periods in vector.
*/
void normalizePeriods();
/**
* Compare method to pass into JulianPtrArray::QuickSort method.
* Currently compares against first period in a vs. first period in b.
* @param a first freebusy
* @param b second freebusy
*
* @return ComparePeriods(a[0], b[0])
*/
static int CompareFreebusy(const void * a, const void * b);
/**
* Check if two freebusy objects have the same TYPE and BSTAT. If they
* have the same TYPE and BSTAT, return TRUE, otherwise return FALSE.
* @param f1 first freebusy
* @param f2 second freebusy
*
* @return TRUE if TYPE and BSTAT are same in both freebusy, FALSE otherwise
*/
static t_bool HasSameParams(Freebusy * f1, Freebusy * f2);
protected:
/**
* Returns the curl associated with this nsCalendar. The
* curl points to the calendar store where components in
* this nsCalendar are to be stored. It is required
* for an nsCalendar to have an associated curl if any
* of its components will be persisted in a calendar store.
*
* @return a JulianString containing the curl
*/
JulianString getCurl() const {return m_sCurl;}
/**
* Set the default curl for this nsCalendar.
*/
void setCurl(const char* ps) {m_sCurl = ps;}
/**
* Set the default curl for this nsCalendar.
*/
void setCurl(const JulianString& s) {m_sCurl = s;}
};
#endif /* __FREEBUSY_H_ */

Просмотреть файл

@ -1,124 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the 'NPL'); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an 'AS IS' basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* functbl.h
* John Sun
* 7/27/98 1:57:12 PM
*/
#include "valarm.h"
#include "tmbevent.h"
#include "tzpart.h"
#include "vevent.h"
#include "vfrbsy.h"
#include "vtodo.h"
#ifndef __JULIANFUNCTIONTABLE_H_
#define __JULIANFUNCTIONTABLE_H_
/**
* These structs are used by
* classes that need to contain ICalProperty's to
* quickly find the function to store data-members.
* Its keeps a hashCode and a ptr to a store-property
* function
*/
typedef struct
{
t_int32 hashCode;
VAlarm::SetOp op;
void set(t_int32 i, VAlarm::SetOp sOp) { hashCode = i; op = sOp; }
} VAlarmStoreTable;
typedef struct
{
t_int32 hashCode;
TimeBasedEvent::SetOp op;
void set(t_int32 i, TimeBasedEvent::SetOp sOp) { hashCode = i; op = sOp; }
} TimeBasedEventStoreTable;
typedef struct
{
t_int32 hashCode;
TZPart::SetOp op;
void set(t_int32 i, TZPart::SetOp sOp) { hashCode = i; op = sOp; }
} TZPartStoreTable;
typedef struct
{
t_int32 hashCode;
VEvent::SetOp op;
void set(t_int32 i, VEvent::SetOp sOp) { hashCode = i; op = sOp; }
} VEventStoreTable;
typedef struct
{
t_int32 hashCode;
VFreebusy::SetOp op;
void set(t_int32 i, VFreebusy::SetOp sOp) { hashCode = i; op = sOp; }
} VFreebusyStoreTable;
typedef struct
{
t_int32 hashCode;
VTodo::SetOp op;
void set(t_int32 i, VTodo::SetOp sOp) { hashCode = i; op = sOp; }
} VTodoStoreTable;
class JulianFunctionTable
{
private:
/*-----------------------------
** MEMBERS
**---------------------------*/
static JulianFunctionTable * m_Instance;
/*-----------------------------
** PRIVATE METHODS
**---------------------------*/
JulianFunctionTable();
public:
/*-----------------------------
** CONSTRUCTORS and DESTRUCTORS
**---------------------------*/
~JulianFunctionTable();
static JulianFunctionTable * Instance();
/* VAlarm storeData function table */
VAlarmStoreTable alarmStoreTable[10];
TimeBasedEventStoreTable tbeStoreTable[25];
TZPartStoreTable tzStoreTable[8];
VEventStoreTable veStoreTable[8];
/* VFreebusyStoreTable vfStoreTable[16]; */
VFreebusyStoreTable vfStoreTable[15];
VTodoStoreTable vtStoreTable[9];
/*-----------------------------
** ACCESSORS (GET AND SET)
**---------------------------*/
/*-----------------------------
** UTILITIES
**---------------------------*/
/*-----------------------------
** STATIC METHODS
**---------------------------*/
/*-----------------------------
** OVERLOADED OPERATORS
**---------------------------*/
};
#endif /* __JULIANFUNCTIONTABLE_H_ */

Просмотреть файл

@ -1,516 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* icalcomp.h
* John Sun
* 2/5/98 2:57:16 PM
*/
#include <unistring.h>
#include "ptrarray.h"
#include "icalredr.h"
#include "prprty.h"
#include "jutility.h"
#include "datetime.h"
#include "jlog.h"
#include "nscalcoreicalexp.h"
#ifndef __ICALCOMPONENT_H_
#define __ICALCOMPONENT_H_
/**
* ICalComponent defines a Calendar Component in iCal. A calendar
* component can contain iCalendar properties as well as
* other iCalendar components.
* Examples of iCalendar components include VEvent, VTodo,
* VJournal, VFreebusy, VTimeZone, and VAlarms.
* TZPart, althought not an iCal component, subclasses from
* ICalComponent.
*/
class NS_CAL_CORE_ICAL ICalComponent
{
protected:
/**
* Constructor. Hide from clients except subclasses.
*/
ICalComponent();
public:
/**
* An enumeration of Calendar Components. TZPart is not
* actually a Calendar component. However, it is useful to add
* it here because it implements this class' interface.
*/
enum ICAL_COMPONENT
{
ICAL_COMPONENT_VEVENT = 0,
ICAL_COMPONENT_VTODO = 1,
ICAL_COMPONENT_VJOURNAL = 2,
ICAL_COMPONENT_VFREEBUSY = 3,
ICAL_COMPONENT_VTIMEZONE = 4,
ICAL_COMPONENT_VALARM = 5,
ICAL_COMPONENT_TZPART = 6
};
/**
* Converts ICAL_COMPONENT to string. If bad ic, then return "".
* @param ICAL_COMPONENT ic
*
* @return output name of component
*/
static UnicodeString componentToString(ICAL_COMPONENT ic);
static ICAL_COMPONENT stringToComponent(UnicodeString & s, t_bool & error);
/**
* Destructor.
*
* @return virtual
*/
virtual ~ICalComponent();
/* -- Start of ICALComponent interface (PURE VIRTUAL METHODS)-- */
/**
* The parse method is the standard interface for ICalComponent
* subclasses to parse from an ICalReader object
* and from the ITIP method type (i.e. PUBLISH, REQUEST, CANCEL, etc.).
* The method type can be set to \"\" if there is no method to be loaded.
* Also accepts a vector of VTimeZone objects to apply to
* the DateTime properties of the component.
* TODO: maybe instead of passing a UnicodeString for method, why not a enum METHOD
* 4-2-98: Added bIgnoreBeginError. If desired to start parsing in Component level,
* it is useful to ignore first "BEGIN:". Setting bIgnoreBeginError to TRUE allows for
* this.
*
* @param brFile ICalReader to load from
* @param sMethod method of component (i.e. PUBLISH, REQUEST, REPLY)
* @param parseStatus return parse error status string (normally return "OK")
* @param vTimeZones vector of VTimeZones to apply to datetimes
* @param bIgnoreBeginError TRUE = ignore first "BEGIN:VEVENT", FALSE otherwise
* @param encoding the encoding of the stream, default is 7bit.
*
* @return parse error status string (parseStatus)
*/
virtual UnicodeString & parse(ICalReader * brFile, UnicodeString & sMethod,
UnicodeString & parseStatus, JulianPtrArray * vTimeZones = 0,
t_bool bIgnoreBeginError = FALSE, nsCalUtility::MimeEncoding encoding =
nsCalUtility::MimeEncoding_7bit)
{
PR_ASSERT(FALSE);
if (brFile != NULL && vTimeZones != NULL
&& sMethod.size() > 0 && parseStatus.size() > 0 && bIgnoreBeginError)
{}
return parseStatus;
}
/**
* Returns a clone of this object
* @param initLog log file to write errors to
*
* @return clone of this object
*/
virtual ICalComponent * clone(JLog * initLog) { PR_ASSERT(FALSE); if (initLog) {} return 0; }
/**
* Return TRUE if component is valid, FALSE otherwise
*
* @return TRUE if is valid, FALSE otherwise
*/
virtual t_bool isValid() { PR_ASSERT(FALSE); return FALSE; }
/**
* Print all contents of ICalComponent to iCal export format.
*
* @return string containing iCal export format of ICalComponent
*/
virtual UnicodeString toICALString() { PR_ASSERT(FALSE); return "";}
/**
* Print all contents of ICalComponent to iCal export format, depending
* on attendee name, attendee delegated-to, and where to include recurrence-id or not
*
* @param method method name (REQUEST,PUBLISH, etc.)
* @param name attendee name to filter with
* @param isRecurring TRUE = no recurrenceid, FALSE = include recurrenceid
*
* @return string containing iCal export format of ICalComponent
*/
virtual UnicodeString toICALString(UnicodeString method, UnicodeString name,
t_bool isRecurring)
{
PR_ASSERT(FALSE);
if (method.size() == 0 && name.size() == 0 && isRecurring)
{}
return "";
}
/**
* Print all contents of ICalComponent to human-readable string.
*
* @return string containing human-readable format of ICalComponent
*/
virtual UnicodeString toString() {PR_ASSERT(FALSE); return "";}
/**
* Depending on character passed in, returns a string that represents
* the ICAL export string of that property that the character represents, if
* other paramaters not null, then print out information is filtered in several ways
* Attendee print out can be filtered so that only attendee with certain name is printed
* also, can print out the relevant attendees in a delegation message
* (ie. owner, delegate-to, delegate-from)
*
* @param c char of what property to print
* @param sFilterAttendee name of attendee to print
* @param bDelegateRequest TRUE if a delegate request, FALSE if not
* @return ICAL export format of that property
*/
virtual UnicodeString formatChar(t_int32 c,
UnicodeString sFilterAttendee,
t_bool delegateRequest = FALSE)
{
PR_ASSERT(FALSE);
#if 0
if (c == 8 || sFilterAttendee.size() == 0 || delegateRequest) {}
#endif
return "";
}
/**
* convert a character to the content of a property in string
* human-readable format
* @param c a character represents a property
* @param dateFmt for formatting datetimes
*
* @return property in human-readable string
*/
virtual UnicodeString toStringChar(t_int32 c, UnicodeString & dateFmt)
{
PR_ASSERT(FALSE);
#if 0 /* fix HPUX build busgage - this is dead code anyway - alecf 4/30/98 */
if (c == 8) {}
#endif
return "";
#if 0
if (dateFmt.size() > 0) {}
#endif
}
/**
* Returns the ICAL_COMPONENT enumeration value of this ICalComponent.
* Each ICalComponent subclass must return a unique ICAL_COMPONENT value.
*
* @return ICAL_COMPONENT value of this component
*/
virtual ICAL_COMPONENT GetType() const { PR_ASSERT(FALSE); return ICAL_COMPONENT_VEVENT; }
/**
* Update the private property data-members with updatedComponent's
* property data-members.
* Usually, overwriting data-members should only occur if updatedComponent
* is more recent than the current component.
* Return TRUE if component was changed, FALSE otherwise
* @param ICalComponent * updatedComponent
*
* @return virtual t_bool
*/
virtual t_bool updateComponent(ICalComponent * updatedComponent)
{
PR_ASSERT(FALSE);
return FALSE;
}
/* -- End of ICALComponent PURE VIRTUAL interface -- */
/*-------------------------------------------------------------------*/
/* NOT PURE
* TRYING TO MERGE SIMILARITIES IN VFREEBUSY AND TIMEBASEDEVENT TOGETHER
*/
/**
* Check if this component matches a UID and a sequence number.
* TimeBasedEvent and VFreebusy should override this method.
* @param sUID uid to look for
* @param iSeqNo sequence number to look for
*
* @return TRUE if match, FALSE otherwise
*/
virtual t_bool MatchUID_seqNO(UnicodeString sUID, t_int32 iSeqNo = -1)
{
/* NOTE: remove later, just to get rid of compiler warnings */
if (sUID.size() > 0 && iSeqNo > 0) {}
return FALSE;
}
/**
* Return the UID of this component. TimeBasedEvent and VFreebusy
* should override this method.
*
* @return the UID of this component.
*/
virtual UnicodeString getUID() const { return ""; }
/**
* Return the sequence number of this component.
* TimeBasedEvent and VFreebusy should override this method.
*
* @return the sequence number of this component.
*/
virtual t_int32 getSequence() const { return -1; }
/*---------------------------------------------------------------------*/
/* -- End of ICALComponent interface -- */
/**
* Given a component name, a component format string, print the component in
* following manner with properties specified by the format string. It does
* this by calling abstract formatChar method.
* (i.e. sComponentName = VEVENT)
*
* BEGIN:VEVENT
* DTSTART:19980331T112233Z (properties dependent on format string)
* ...
* END:VEVENT
*
* Optionally, the caller may pass in an sFilterAttendee and delegateRequest args.
* If sFilterAttendee != "", then filter on sFilterAttendee, meaning that
* only the attendee with the name sFilterAttendee should be printed. If the
* delegateRequest is set to TRUE,
* also print attendees who are delegates or related-to the delegates.
* @param sComponentName name of ICalComponent
* @param strFmt property format string
* @param sFilterAttendee attendee to filter on
* @param delegateRequest whether to print delegates
*
* @return iCal export string of component
*/
UnicodeString format(UnicodeString & sComponentName, UnicodeString & strFmt,
UnicodeString sFilterAttendee, t_bool delegateRequest = FALSE);
/**
* Given a format string, prints the component to human-readable format
* with properties specified by format string. It does this by calling
* abstract toStringChar method.
* @param strFmt property format string
*
* @return human-readable string of component
*/
UnicodeString toStringFmt(UnicodeString & strFmt);
/* STATIC METHODS */
/**
* Returns the keyletter representing that property
* For example, if propertyName = "DTSTART", outLetter would return 'B'
* and return boolean would be TRUE.
* return FALSE if property not found.
* @param UnicodeString & propertyName
* @param t_int32 & outLetter
*
* @return static t_bool
*/
static t_bool propertyNameToKeyLetter(UnicodeString & propertyName,
t_int32 & outLetter);
/**
* Given a ptr to an array of properties strings (char *) and the count
* create the iCal formatting string for those properties and return
* it in out.
* If ppsPropList is null or iPropCount is 0, then
* return the string of all properties and alarms.
* @param char ** ppsPropList
* @param t_int32 iPropCount
* @param UnicodeString & out
*
* @return static UnicodeString
*/
static UnicodeString & makeFormatString(char ** ppsPropList, t_int32 iPropCount,
UnicodeString & out);
/**
* Cleanup vector of UnicodeString objects. Delete each UnicodeString
* in vector.
* @param strings vector of elements to delete from
*/
static void deleteUnicodeStringVector(JulianPtrArray * stringVector);
/**
* Cleanup vector of ICalComponent objects. Delete each ICalComponent
* in vector
* @param strings vector of elements to delete from
*/
static void deleteICalComponentVector(JulianPtrArray * componentVector);
/**
* Clones each ICalComponent element in the toClone vector and put clone in
* the out vector
* @param JulianPtrArray * out
* @param JulianPtrArray * toClone
*
* @return static void
*/
static void cloneICalComponentVector(JulianPtrArray * out, JulianPtrArray * toClone);
#if 0
/**
* Sets the ICalProperty in dateTimePropertyPtr to have
* a value on inVal and paramter value on inParameters
* @param ICalProperty ** dateTimePropertyPtr
* @param DateTime inVal
* @param JulianPtrArray * inParameters
*
* @return static void
*/
static void setDateTimeValue(ICalProperty ** dateTimePropertyPtr,
DateTime inVal, JulianPtrArray * inParameters);
/**
* Return the value of the dateTimePropertyPtr in outVal
* @param ICalProperty ** dateTimePropertyPtr
* @param DateTime & outVal
*
* @return static void
*/
static void getDateTimeValue(ICalProperty ** dateTimePropertyPtr,
DateTime & outVal);
/**
* Sets the ICalProperty in stringPropertyPtr to have
* a value on inVal and paramter value on inParameters
* @param ICalProperty ** stringPropertyPtr
* @param UnicodeString inVal
* @param JulianPtrArray * inParameters
*
* @return static void
*/
static void setStringValue(ICalProperty ** stringPropertyPtr,
UnicodeString inVal, JulianPtrArray * inParameters);
/**
* Return the value of the stringPropertyPtr in outVal
* @param ICalProperty ** stringPropertyPtr
* @param UnicodeString & outVal
*
* @return static void
*/
static void getStringValue(ICalProperty ** stringPropertyPtr,
UnicodeString & outVal);
/**
* Sets the ICalProperty in integerPropertyPtr to have
* a value on inVal and paramter value on inParameters
* @param ICalProperty ** integerTimePropertyPtr
* @param t_int32 inVal
* @param JulianPtrArray * inParameters
*
* @return static void
*/
static void setIntegerValue(ICalProperty ** integerPropertyPtr,
t_int32 inVal, JulianPtrArray * inParameters);
/**
* Return the value of the integerPropertyPtr in outVal
* @param ICalProperty ** integerPropertyPtr
* @param t_int32 & outVal
*
* @return static void
*/
static void getIntegerValue(ICalProperty ** integerPropertyPtr,
t_int32 & outVal);
#endif
protected:
/* replace current vector with contents in replaceVctr */
/* don't overwrite if replaceVctr is empty and bForceOverwriteOnEmpty is FALSE */
/**
* Replace the ICalProperty contents of propertyVctrPtr with the ICalProperty
* elements in replaceVctr. This means delete all ICalProperty elements in
* (*propertyVctrPtr), then clone each element in replaceVctr and add to
* (*propertyVctrPtr). If however replaceVctr is empty, don't delete current
* elements unless bForceOverwriteOnEmpty flag is ON. (see below)
* If bAddInsteadOfOverwrite is TRUE, don't delete all ICalProperty elements,
* just add all elements in replaceVctr to propertyVctrPtr
* If bForceOverwriteOnEmpty is TRUE, delete all ICalProperty elements even if
* replaceVctr is empty or NULL.
* @param JulianPtrArray ** propertyVctrPtr
* @param JulianPtrArray * replaceVctr
* @param t_bool bAddInsteadOfOverwrite = FALSE
* @param t_bool bForceOverwriteOnEmpty = FALSE
*
* @return static void
*/
static void internalSetPropertyVctr(JulianPtrArray ** propertyVctrPtr,
JulianPtrArray * replaceVctr, t_bool bAddInsteadOfOverwrite = FALSE,
t_bool bForceOverwriteOnEmpty = FALSE);
/**
* Replace the XToken contents of xTokensVctrPtr with the XToken
* elements in replaceVctr. This means delete all XToken elements in
* (*xTokensVctrPtr), then clone each element in replaceVctr and add to
* (*xTokensVctrPtr). If however replaceVctr is empty, don't delete current
* elements unless bForceOverwriteOnEmpty flag is ON. (see below)
* If bAddInsteadOfOverwrite is TRUE, don't delete all XToken elements,
* just add all elements in replaceVctr to xTokensVctrPtr
* If bForceOverwriteOnEmpty is TRUE, delete all XToken elements even if
* replaceVctr is empty or NULL.
* @param JulianPtrArray ** xTokensVctrPtr
* @param JulianPtrArray * replaceVctr
* @param t_bool bAddInsteadOfOverwrite = FALSE
* @param t_bool bForceOverwriteOnEmpty = FALSE
*
* @return static void
*/
static void internalSetXTokensVctr(JulianPtrArray ** xTokensVctrPtr,
JulianPtrArray * replaceVctr, t_bool bAddInsteadOfOverwrite = FALSE,
t_bool bForceOverwriteOnEmpty = FALSE);
/**
* Replace the ICalProperty in (*propertyPtr) to with replaceProp.
* This means delete the current ICalProperty and cloning replaceProp
* and setting (*propertyPtr) to clone.
* If replaceProp == NULL, don't delete current ICalProperty.
* However, if bForceOverwriteOnEmpty is TRUE, delete current ICalProperty
* even if replaceProp is NULL.
* @param ICalProperty ** propertyPtr
* @param ICalProperty * replaceProp
* @param t_bool bForceOverwriteOnEmpty = FALSE
*
* @return static void
*/
static void internalSetProperty(ICalProperty ** propertyPtr,
ICalProperty * replaceProp, t_bool bForceOverwriteOnEmpty = FALSE);
};
#endif /* __ICALCOMPONENT_H_ */

Просмотреть файл

@ -1,108 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* icalfrdr.h
* John Sun
* 2/10/98 11:37:48 PM
*/
#include <stdlib.h>
#include <stdio.h>
#include <unistring.h>
#include "nscalcoreicalexp.h"
#ifndef __ICALFILEREADER_H_
#define __ICALFILEREADER_H_
/**
* ICalFileReader is a subclass of ICalReader. It implements the
* ICalReader interface to work with files.
* TODO: handle QuotedPrintable
*/
class NS_CAL_CORE_ICAL ICalFileReader
{
private:
/** filename of file */
const char * m_filename;
/** ptr to file */
FILE * m_file;
/** buffer to contain current line, assumed to be less than 1024 bytes */
char m_pBuffer[1024];
private:
/**
* Default constructor. Made private to hide from clients.
*/
ICalFileReader();
public:
/**
* Constructor. Clients should call this to create ICalFileReader
* objects to read ICAL objects from a file.
* Opens file for reading.
*
* @param filename filename of target file
* @param status set to 1 if can't open file
*/
ICalFileReader(char * filename, ErrorCode & status);
/**
* Destructor. Also closes file.
*/
virtual ~ICalFileReader();
/**
* Read next character from file.
*
* @param status, return 1 if no more characters
* @return next character of string
*/
virtual t_int8 read(ErrorCode & status);
/**
* Read next line of file. A line is defined to be
* characters terminated by either a '\n', '\r' or "\r\n".
* @param aLine, return next line of string
* @param status, return 1 if no more lines
*
* @return next line of string
*/
virtual UnicodeString & readLine(UnicodeString & aLine, ErrorCode & status);
/**
* Read the next ICAL full line of the file. The definition
* of a full ICAL line can be found in the ICAL spec.
* Basically, a line followed by a CRLF and a space character
* signifies that the next line is a continuation of the previous line.
* Uses the readLine, read methods.
*
* @param aLine, returns next full line of string
* @param status, return 1 if no more lines
*
* @return next full line of string
*/
virtual UnicodeString & readFullLine(UnicodeString & aLine, ErrorCode & status, t_int32 i = 0);
};
#endif /* __ICALFILEREADER_H_ */

Просмотреть файл

@ -1,138 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* icalprm.h
* John Sun
* 2/10/98 3:41:52 PM
*/
#include <unistring.h>
#include "ptrarray.h"
#ifndef __ICALPARAMETER_H_
#define __ICALPARAMETER_H_
/**
* This is a simple class holding ICAL parameters in an ICalProperty.
* NOTE: this class may eventually become abstract
* since it limits only to have one parameter value,
* so multiple parameter value aren't allowed
* also only allows for string parameter values
*/
class ICalParameter
{
private:
/** the parameter name of the parameter */
UnicodeString m_ParameterName;
/** the parameter value of the parameter */
UnicodeString m_ParameterValue;
public:
/** default constructor, returns ("","") */
ICalParameter();
/**
* Copy constructor
* @param that ICalParameter to copy
*/
ICalParameter(ICalParameter & that);
/**
* Normal constructor
* @param parameterName initial parameter name
* @param parameterValue initial parameter value
*/
ICalParameter(const UnicodeString & parameterName,
const UnicodeString & parameterValue);
/**
* Returns a copy of this ICalParameter. Clients responsible
* for de-allocating returned ICalParameter *.
*
* @return a clone of this ICalParameter
*/
ICalParameter * clone();
/**
* Sets the parameter name.
* @param parameterName new parameter name
*/
void setParameterName(const UnicodeString & parameterName);
/**
* Sets the parameter value.
* @param parameterValue new parameter value
*/
void setParameterValue(const UnicodeString & parameterValue);
/**
* Return parameter name
* @param retName return storage for parameter name
*
* @return retName (storage for parameter name)
*/
UnicodeString & getParameterName(UnicodeString & retName) const;
/**
* Return parameter value
* @param retValue return storage for parameter value
*
* @return retValue (storage for parameter value)
*/
UnicodeString & getParameterValue(UnicodeString & retValue) const;
/**
* Returns parameter in string of form ";PARAMETERNAME=PARAMETERVALUE
* @param result output string
*
* @return result (output string)
*/
UnicodeString & toICALString(UnicodeString & result) const;
/**
* Assignment operator.
* @param d ICalParameter to assign to.
*
* @return
*/
const ICalParameter & operator=(const ICalParameter & d);
/**
* Searches parameters for a first occurrence of ICalParameter with
* parameter name equal to paramName. Returns the value of parameter
* in retVal. Returns "", if no match.
* @param paramName parameter name to look for
* @param retVal return value of parameter
* @param parameters parameters to search from
*
* @return retVal (value of parameter)
*/
static UnicodeString & GetParameterFromVector(UnicodeString & paramName,
UnicodeString & retVal, JulianPtrArray * parameters);
};
#endif /* __ICALPARAMETER_H_ */

Просмотреть файл

@ -1,118 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* icalredr.h
* John Sun
* 2/10/98 11:33:55 AM
*/
#include "jdefines.h"
#include <unistring.h>
#include "nscalcoreicalexp.h"
#ifndef __ICALREADER_H_
#define __ICALREADER_H_
/**
* ICalReader is an abstract class that defines an interface for
* reading iCalendar objects from a data source. All methods in
* this class are defined to be pure virtual methods. Currently, this
* data source can be a string (ICalStringReader) or a file (ICalFileReader).
* The interface defined allows for the reading of a character, a line, and a full-line.
* A full-line is defined by the iCal Content-Line definition.
* For clients, object acts like an input stream of UnicodeString data.
*/
class NS_CAL_CORE_ICAL ICalReader
{
protected:
/**
* Hide constructor from clients.
*/
ICalReader();
public:
virtual ~ICalReader() {}
/**
* Pure virtual. Read the next character from the data.
* @param status return status > 0 if failure in reading character
*
* @return next character in data
*/
virtual t_int8 read(ErrorCode & status)
{
PR_ASSERT(FALSE);
if (status == 0) {}
return -1;
}
/**
* Pure virtual. Read the next line from the data. A line
* is defined to be characters terminated by a '\n', '\r', or '\n\r'.
* @param aLine placeholder to return next line
* @param status return status > 0 if failure in reading line
*
* @return aLine (next line)
*/
virtual UnicodeString & readLine(UnicodeString & aLine, ErrorCode & status)
{
PR_ASSERT(FALSE);
if (status == 0) {}
if (aLine.size() == 0) {}
return aLine;
}
/**
* Pure virtual. Read the next full-line from the data. A full-line
* is defined by the iCalendar Content-Line definition.
* @param aLine placeholder to return next full-line
* @param status return status > 0 if failure in reading full-line
*
* @return aLine (next full-line)
*/
virtual UnicodeString & readFullLine(UnicodeString & aLine, ErrorCode & status, t_int32 i = 0)
{
PR_ASSERT(FALSE);
if (status == 0) {}
if (aLine.size() == 0) {}
return aLine;
}
/**
* Sets a the buffer to read from. This method should only be overwritten by
* the ICalCAPIReader class. (4-16-98)
*/
virtual void setBuffer(const char * capiChunk)
{
if (capiChunk != 0) {}
}
virtual void * getMonitor() { return 0; }
/* static methods */
static t_bool isHex(t_int8 aToken);
static t_int8 convertHex(char fToken, char sToken);
static UnicodeString & convertQuotedPrintableString(UnicodeString & stringToConvert);
};
#endif /* __ICALREADER_H_ */

Просмотреть файл

@ -1,130 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* icalsrdr.h
* John Sun
* 2/10/98 11:37:39 AM
*/
#include <unistring.h>
#include "icalredr.h"
#include "jutility.h"
#include "nscalcoreicalexp.h"
#ifndef __ICALSTRINGREADER_H_
#define __ICALSTRINGREADER_H_
/**
* ICalStringReader is a subclass of ICalReader. It implements the
* ICalReader interface to work with strings (const char *).
* DO NOT delete the char * object for which the object is constructed with.
TODO: remove Unistring dependency. There is a bug if the
target string is encoded with 2byte character. If so, then the
m_pos and m_length variables are wrong. Currently, I will assume that
all const char * passed in will be us-ascii 8-bit chars
*/
#if defined(XP_PC)
#pragma warning ( disable : 4275 )
#endif
class NS_CAL_CORE_ICAL ICalStringReader: public ICalReader
{
private:
/** BUG:?? used to extract substring. Dangerous if encoded */
UnicodeString m_unistring;
/** string: do not delete outside */
const char * m_string;
/** length of string */
t_int32 m_length;
/** current position in string */
t_int32 m_pos;
/** last marked position of string */
t_int32 m_mark;
/** encoding of stream */
nsCalUtility::MimeEncoding m_Encoding;
/**
* Default constructor. Made private to hide from clients.
*/
ICalStringReader();
public:
/**
* Creates object to read ICAL objects from a string.
* @param string string to read from
*/
ICalStringReader(const char * string,
nsCalUtility::MimeEncoding encoding = nsCalUtility::MimeEncoding_7bit);
/**
* Mark current position in string
*/
void mark();
/**
* Reset position to last mark
*/
void reset();
/**
* Read next character of string.
*
* @param status, return 1 if no more characters
* @return next character of string
*/
virtual t_int8 read(ErrorCode & status);
/**
* Read next line of string. A line is defined to be
* characters terminated by either a '\n', '\r' or "\r\n".
* @param aLine, return next line of string
* @param status, return 1 if no more lines
*
* @return next line of string
*/
virtual UnicodeString & readLine(UnicodeString & aLine, ErrorCode & status);
/**
* Read the next ICAL full line of the string. The definition
* of a full ICAL line can be found in the ICAL spec.
* Basically, a line followed by a CRLF and a space character
* signifies that the next line is a continuation of the previous line.
* Uses the readLine, read methods.
*
* @param aLine, returns next full line of string
* @param status, return 1 if no more lines
*
* @return next full line of string
*/
virtual UnicodeString & readFullLine(UnicodeString & aLine, ErrorCode & status, t_int32 i = 0);
};
#if defined(XP_PC)
#pragma warning ( default : 4275 )
#endif
#endif /* __ICALSTRINGREADER_H_ */

Просмотреть файл

@ -1,65 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* icompfy.h
* John Sun
* 2/20/98 10:44:52 AM
*/
#include "icalcomp.h"
#include "jlog.h"
#ifndef __ICALCOMPONENTFACTORY_H_
#define __ICALCOMPONENTFACTORY_H_
/**
* ICalComponentFactory is a factory class that creates
* ICalComponent instances.
*
* @see ICalComponent
*/
class ICalComponentFactory
{
private:
/**
* Hide default constructor from use.
*/
ICalComponentFactory();
public:
/**
* Factory method that creates ICalComponent objects.
* Clients are responsible for calling parse method
* to populate the returned ICalComponent.
* Clients are also responsible for de-allocating
* return ICalComponent.
* TODO: instead of passing string, why not pass a enum.
*
* @param name the name of the ICalComponent
* @param initLog the log of the ICalComponent
*
* @return ptr to the newly created ICalComponent object
* @see ICalComponent
*/
static ICalComponent * Make(UnicodeString & name, JLog * initLog);
};
#endif /* __ICALCOMPONENTFACTORY_H_ */

Просмотреть файл

@ -1,121 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* iprprty.h
* John Sun
* 2/12/98 3:26:51 PM
*/
#include <unistring.h>
#include "sdprprty.h"
#ifndef __INTEGERPROPERTY_H_
#define __INTEGERPROPERTY_H_
/**
* IntegerProperty is a subclass of StandardProperty. It implements the ICalProperty
* interface for ICAL properties with TYPE=INTEGER.
*/
class IntegerProperty: public StandardProperty
{
private:
/** the Integer value of the property */
t_int32 m_Integer;
/**
* Default constructor
*/
IntegerProperty();
/**
* Copy constructor
* @param that property to copy
*/
IntegerProperty(const IntegerProperty & that);
public:
/**
* Constructor that sets value of property to contents of value
* and makes a copy of the contents of parameters ptr.
* @param value value of property
* @param parameters parameters of property
*/
IntegerProperty(t_int32 value, JulianPtrArray * parameters);
/**
* Destructor
*/
~IntegerProperty();
/**
* Return the value of the property
* @return void * ptr to value of the property
*/
virtual void * getValue() const;
/**
* Set the value of the property
* @param value the value to set property to
*/
virtual void setValue(void * value);
/**
* Returns a clone of this property. Clients are responsible for deleting
* the returned object.
*
* @return a clone of this property.
*/
virtual ICalProperty * clone(JLog * initLog);
/**
* Return TRUE if property is valid, FALSE otherwise
*
* @return TRUE if is valid, FALSE otherwise
*/
virtual t_bool isValid();
/**
* Return a string in human-readable form of the property.
* @param out contains output human-readable string
*
* @return the property in its human-readable string format
*/
virtual UnicodeString & toString(UnicodeString & out);
/**
* Return a string in human-readable form of the property.
* @param dateFmt format string options
* @param out contains output human-readable string
*
* @return the property in its human-readable string format
*/
virtual UnicodeString & toString(UnicodeString & dateFmt, UnicodeString & out);
/**
* Return the property's string in the ICAL format.
* @param out contains output ICAL string
*
* @return the property in its ICAL string format
*/
virtual UnicodeString & toExportString(UnicodeString & out);
};
#endif /* __INTEGERPROPERTY_H_ */

Просмотреть файл

@ -1,90 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* jparser.h
* John Sun
* 4/28/98 10:45:21 AM
*/
#ifndef __JULIANPARSER_H_
#define __JULIANPARSER_H_
#include "ptrarray.h"
#include "icalredr.h"
#include "capiredr.h"
#include "jutility.h"
#include "nspr.h"
/**
* This class will be removed later. It is a hack I created to
* parse the MIME-message from the CS&T server fetch results.
* I will try to extract the iCalendar information from it.
* I will need to handle multi-threaded parsing somehow as well.
*/
class JulianParser
{
private:
/*char * m_Buffer;*/
static nsCalUtility::MimeEncoding stringToEncodingType(UnicodeString & propVal);
JulianPtrArray * m_OutCalendars;
ICalCAPIReader * m_Reader;
t_bool m_bParseStarted;
t_bool m_bParseFinished;
PRThread * m_Thread;
public:
JulianParser();
JulianParser(ICalCAPIReader * reader, JulianPtrArray * outCalendars,
PRThread * thread);
/*
void setBuffer(char * buf)
{
strcat(m_Buffer, buf);
}
*/
t_bool isParseStarted() const { return m_bParseStarted; }
void setParseStarted() { m_bParseStarted = TRUE; }
t_bool isParseFinished() const { return m_bParseFinished; }
void setParseFinished() { m_bParseFinished = TRUE; }
ICalCAPIReader * getReader() const { return m_Reader; }
PRThread * getThread() const { return m_Thread; }
void ParseCalendars(ICalReader * reader,
JulianPtrArray * outCalendars);
void ParseCalendars();
};
#ifdef XP_CPLUSPLUS
extern "C"{
#endif
void jparser_ParseCalendarsZero(void * jp, void *);
#ifdef XP_CPLUSPLUS
}
#endif
#endif /* __JULIANPARSER_H_ */

Просмотреть файл

@ -1,50 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsCalAttendeeProperty_h___
#define nsCalAttendeeProperty_h___
#include "nsCalProperty.h"
#include "attendee.h"
class NS_CAL_CORE_ICAL nsCalAttendeeProperty : public nsCalProperty
{
public:
nsCalAttendeeProperty();
~nsCalAttendeeProperty();
public:
NS_DECL_ISUPPORTS
NS_IMETHOD Init();
NS_IMETHOD SetParameter(nsString & aKey, nsString & aValue);
NS_IMETHOD_(JulianPtrArray *) GetParameters();
NS_IMETHOD SetParameters(JulianPtrArray * parameters);
NS_IMETHOD_(void *) GetValue() const;
NS_IMETHOD SetValue(void * value);
NS_IMETHOD_(nsICalProperty *) Clone();
NS_IMETHOD_(PRBool) IsValid();
NS_IMETHOD_(nsString &) ToString(nsString & out);
NS_IMETHOD_(nsString &) ToICALString(nsString & out);
NS_IMETHOD_(nsString &) ToICALString(nsString & sProp, nsString & out);
};
#endif

Просмотреть файл

@ -1,70 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsCalDateTimeProperty_h___
#define nsCalDateTimeProperty_h___
#include "jdefines.h"
#include "nsICalProperty.h"
#include "nsICalICalendarParserObject.h"
#include "nsCalStandardProperty.h"
#include "jdefines.h"
#include "dprprty.h"
#include "nscalcoreicalexp.h"
/*
* XPCOM wrapper around non-XPCOM julian classes DateTimeProperty
* TODO: XXX: XPCOM julian classes and remove them
*/
class NS_CAL_CORE_ICAL nsCalDateTimeProperty : public nsCalStandardProperty
{
public:
nsCalDateTimeProperty();
NS_DECL_ISUPPORTS
NS_IMETHOD Init();
/* nsICalProperty */
NS_IMETHOD_(void *) GetValue() const;
NS_IMETHOD SetValue(void * value);
NS_IMETHOD_(nsICalProperty *) Clone();
NS_IMETHOD_(PRBool) IsValid();
NS_IMETHOD_(nsString &) ToString(nsString & out);
NS_IMETHOD_(nsString &) ToICALString(nsString & out);
NS_IMETHOD_(nsString &) ToICALString(nsString & sProp, nsString & out);
/* nsICalStandardProperty */
NS_IMETHOD_(nsString &) toExportString(nsString & out);
protected:
~nsCalDateTimeProperty();
};
#endif

Просмотреть файл

@ -1,79 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsDurationProperty_h___
#define nsDurationProperty_h___
#include "nsICalProperty.h"
#include "nsICalStandardProperty.h"
#include "jdefines.h"
#include "prprty.h"
#include "sprprty.h"
#include "nscalcoreicalexp.h"
/*
* XPCOM wrapper around non-XPCOM julian classes DurationProperty
* TODO: XXX: XPCOM julian classes and remove them
*/
class NS_CAL_CORE_ICAL nsDurationProperty : public nsICalProperty,
public nsICalStandardProperty,
public nsICalICalendarParserObject
{
public:
nsDurationProperty();
NS_DECL_ISUPPORTS
NS_IMETHOD Init();
/* nsICalICalendarParserObject */
NS_IMETHOD SetParameter(nsString & aKey, nsString & aValue);
/* nsICalProperty */
NS_IMETHOD SetParameters(JulianPtrArray * parameters) = 0;
NS_IMETHOD_(void *) GetValue() const = 0;
NS_IMETHOD SetValue(void * value) const = 0;
NS_IMETHOD_(nsICalProperty *) Clone() = 0;
NS_IMETHOD_(PRBool) IsValid() = 0;
NS_IMETHOD_(nsString &) ToString(nsString & out) = 0;
NS_IMETHOD_(nsString &) ToICALString(nsString & out) = 0;
NS_IMETHOD_(nsString &) ToICALString(nsString & sProp, nsString & out) = 0;
/* nsICalStandardProperty */
NS_IMETHOD AddParameter(nsICalParameter * parameter) = 0;
NS_IMETHOD_(nsString &) toExportString(nsString & out) = 0;
NS_IMETHOD Parse(nsString & in);
protected:
~nsCalendar();
private:
DurationProperty * mDurationProperty;
};
#endif

Просмотреть файл

@ -1,64 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsCalICalendarComponent_h___
#define nsCalICalendarComponent_h___
#include "jdefines.h"
#include "nsICalICalendarComponent.h"
#include "nsICalICalendarContainer.h"
#include "nsICalProperty.h"
#include "nsICalICalendarParserObject.h"
#include "icalcomp.h"
class NS_CAL_CORE_ICAL nsCalICalendarComponent: public nsICalICalendarComponent,
public nsICalICalendarContainer,
public nsICalICalendarParserObject
{
protected:
nsCalICalendarComponent();
~nsCalICalendarComponent();
public:
NS_IMETHOD Init();
NS_DECL_ISUPPORTS
/* nsICalICalendarParserObject */
NS_IMETHOD SetParameter(nsString & aKey, nsString & aValue);
NS_IMETHOD_(PRBool) StoreProperty(nsCalICalendarTag tag, nsICalProperty * prop,
JulianPtrArray * vTimeZones);
protected:
ICalComponent * mICalComponent;
};
#endif

Просмотреть файл

@ -1,71 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsCalIntegerProperty_h___
#define nsCalIntegerProperty_h___
#include "jdefines.h"
#include "nsICalProperty.h"
#include "nsICalICalendarParserObject.h"
#include "nsCalStandardProperty.h"
#include "jdefines.h"
#include "prprty.h"
#include "sprprty.h"
#include "nscalcoreicalexp.h"
/*
* XPCOM wrapper around non-XPCOM julian classes CalStringProperty
* TODO: XXX: XPCOM julian classes and remove them
*/
class NS_CAL_CORE_ICAL nsCalIntegerProperty : public nsCalStandardProperty
{
public:
nsCalIntegerProperty();
NS_DECL_ISUPPORTS
NS_IMETHOD Init();
/* nsICalProperty */
NS_IMETHOD_(void *) GetValue() const;
NS_IMETHOD SetValue(void * value);
NS_IMETHOD_(nsICalProperty *) Clone();
NS_IMETHOD_(PRBool) IsValid();
NS_IMETHOD_(nsString &) ToString(nsString & out);
NS_IMETHOD_(nsString &) ToICALString(nsString & out);
NS_IMETHOD_(nsString &) ToICALString(nsString & sProp, nsString & out);
/* nsICalStandardProperty */
NS_IMETHOD_(nsString &) toExportString(nsString & out);
protected:
~nsCalIntegerProperty();
};
#endif

Просмотреть файл

@ -1,54 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsCalProperty_h___
#define nsCalProperty_h___
#include "nsICalProperty.h"
#include "nsICalICalendarParserObject.h"
#include "sdprprty.h"
class NS_CAL_CORE_ICAL nsCalProperty : public nsICalProperty,
public nsICalICalendarParserObject
{
public:
nsCalProperty();
~nsCalProperty();
public:
NS_DECL_ISUPPORTS
NS_IMETHOD Init();
/* nsICalICalendarParserObject */
NS_IMETHOD SetParameter(nsString & aKey, nsString & aValue) = 0;
/* nsICalStandardProperty */
NS_IMETHOD_(JulianPtrArray *) GetParameters() = 0;
NS_IMETHOD SetParameters(JulianPtrArray * parameters) = 0;
NS_IMETHOD_(ICalProperty *) GetICalProperty() const;
protected:
ICalProperty * mICalProperty;
};
#endif

Просмотреть файл

@ -1,56 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsCalStandardProperty_h___
#define nsCalStandardProperty_h___
#include "nsCalProperty.h"
#include "nsICalStandardProperty.h"
#include "sdprprty.h"
class NS_CAL_CORE_ICAL nsCalStandardProperty : public nsCalProperty,
public nsICalStandardProperty
{
public:
nsCalStandardProperty();
~nsCalStandardProperty();
public:
NS_DECL_ISUPPORTS
NS_IMETHOD Init();
/* nsICalICalendarParserObject */
NS_IMETHOD SetParameter(nsString & aKey, nsString & aValue);
/* nsICalStandardProperty */
NS_IMETHOD_(JulianPtrArray *) GetParameters();
NS_IMETHOD SetParameters(JulianPtrArray * parameters);
NS_IMETHOD AddParameter(nsString & aKey, nsString & aValue);
NS_IMETHOD AddParameter(ICalParameter * parameter);
NS_IMETHOD Parse(nsString & in);
};
#endif

Просмотреть файл

@ -1,70 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsCalStringProperty_h___
#define nsCalStringProperty_h___
#include "jdefines.h"
#include "nsICalProperty.h"
#include "nsICalICalendarParserObject.h"
#include "nsCalStandardProperty.h"
#include "jdefines.h"
#include "sprprty.h"
#include "nscalcoreicalexp.h"
/*
* XPCOM wrapper around non-XPCOM julian classes CalStringProperty
* TODO: XXX: XPCOM julian classes and remove them
*/
class NS_CAL_CORE_ICAL nsCalStringProperty : public nsCalStandardProperty
{
public:
nsCalStringProperty();
NS_DECL_ISUPPORTS
NS_IMETHOD Init();
/* nsICalProperty */
NS_IMETHOD_(void *) GetValue() const;
NS_IMETHOD SetValue(void * value);
NS_IMETHOD_(nsICalProperty *) Clone();
NS_IMETHOD_(PRBool) IsValid();
NS_IMETHOD_(nsString &) ToString(nsString & out);
NS_IMETHOD_(nsString &) ToICALString(nsString & out);
NS_IMETHOD_(nsString &) ToICALString(nsString & sProp, nsString & out);
/* nsICalStandardProperty */
NS_IMETHOD_(nsString &) toExportString(nsString & out);
protected:
~nsCalStringProperty();
};
#endif

Просмотреть файл

@ -1,87 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsCalTimeBasedEvent_h___
#define nsCalTimeBasedEvent_h___
#include "jdefines.h"
#include "nsCalICalendarComponent.h"
#include "nsICalTimeBasedEvent.h"
#include "nsICalProperty.h"
#include "tmbevent.h"
#include "nscalcoreicalexp.h"
class NS_CAL_CORE_ICAL nsCalTimeBasedEvent: public nsCalICalendarComponent,
public nsICalTimeBasedEvent
{
protected:
nsCalTimeBasedEvent();
~nsCalTimeBasedEvent();
public:
NS_IMETHOD Init();
NS_DECL_ISUPPORTS
// nsICalTimeBasedEvent
/*
NS_IMETHOD_(nsIDateTime *) GetDTStart() const;
NS_IMETHOD SetDTStart(nsIDateTime *, JulianPtrArray * parameters = 0);
NS_IMETHOD SetDTStartProperty(nsICalDateTimeProperty * property);
*/
NS_IMETHOD_(PRInt32) GetSequence() const;
NS_IMETHOD SetSequence(PRInt32 i, JulianPtrArray * parameters = 0);
NS_IMETHOD SetSequenceProperty(nsICalProperty * property);
NS_IMETHOD AddAttachProperty(nsICalProperty * property);
NS_IMETHOD AddAttendeeProperty(nsICalProperty * property);
NS_IMETHOD AddCategoriesProperty(nsICalProperty * property);
NS_IMETHOD SetClassProperty(nsICalProperty * property);
NS_IMETHOD AddCommentProperty(nsICalProperty * property);
NS_IMETHOD AddContactProperty(nsICalProperty * property);
NS_IMETHOD SetCreatedProperty(nsICalProperty * property);
NS_IMETHOD SetDescriptionProperty(nsICalProperty * property);
NS_IMETHOD SetDTStartProperty(nsICalProperty * property);
NS_IMETHOD SetDTStampProperty(nsICalProperty * property);
NS_IMETHOD AddExDateProperty(nsICalProperty * property);
NS_IMETHOD AddExRuleProperty(nsICalProperty * property);
NS_IMETHOD SetLastModifiedProperty(nsICalProperty * property);
NS_IMETHOD SetOrganizerProperty(nsICalProperty * property);
NS_IMETHOD AddRDateProperty(nsICalProperty * property);
NS_IMETHOD AddRRuleProperty(nsICalProperty * property);
NS_IMETHOD SetRecurrenceIDProperty(nsICalProperty * property);
NS_IMETHOD AddRelatedToProperty(nsICalProperty * property);
NS_IMETHOD AddRequestStatusProperty(nsICalProperty * property);
NS_IMETHOD SetStatusProperty(nsICalProperty * property);
NS_IMETHOD SetSummaryProperty(nsICalProperty * property);
NS_IMETHOD SetUIDProperty(nsICalProperty * property);
NS_IMETHOD SetURLProperty(nsICalProperty * property);
NS_IMETHOD_(PRBool) StoreProperty(nsCalICalendarTag tag, nsICalProperty * prop,
JulianPtrArray * vTimeZones);
NS_IMETHOD SelfCheck();
};
#endif

Просмотреть файл

@ -1,66 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsCalVEvent_h___
#define nsCalVEvent_h___
#include "nsCalTimeBasedEvent.h"
#include "nsICalVEvent.h"
#include "vevent.h"
#include "datetime.h"
class NS_CAL_CORE_ICAL nsCalVEvent: public nsCalTimeBasedEvent,
public nsICalVEvent
{
public:
nsCalVEvent();
NS_DECL_ISUPPORTS
NS_IMETHOD Init();
NS_IMETHOD SetParameter(nsString & aKey, nsString & aValue);
// nsICalVEvent
NS_IMETHOD_(DateTime) GetDTEnd() const;
NS_IMETHOD SetDTEnd(DateTime d, JulianPtrArray * parameters);
NS_IMETHOD SetDTEndProperty(nsICalProperty * property);
NS_IMETHOD SetGEOProperty(nsICalProperty * property);
NS_IMETHOD SetLocationProperty(nsICalProperty * property);
NS_IMETHOD SetPriorityProperty(nsICalProperty * property);
NS_IMETHOD SetTranspProperty(nsICalProperty * property);
//NS_IMETHOD SetDurationProperty(nsICalProperty * property);
NS_IMETHOD AddResourcesProperty(nsICalProperty * property);
NS_IMETHOD_(PRBool) StoreProperty(nsCalICalendarTag tag, nsICalProperty * prop,
JulianPtrArray * vTimeZones);
NS_IMETHOD_(VEvent *) GetICalEvent();
NS_IMETHOD_(PRBool) IsValid();
protected:
~nsCalVEvent();
};
#endif

Просмотреть файл

@ -1,86 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsCalendar_h___
#define nsCalendar_h___
#include "jdefines.h"
#include "nsICalendar.h"
#include "nsICalICalendarParserObject.h"
#include "nsICalICalendarContainer.h"
#include "nscal.h"
#include "nscalcoreicalexp.h"
class NS_CAL_CORE_ICAL nsCalendar : public nsICalendar,
public nsICalICalendarContainer,
public nsICalICalendarParserObject
{
public:
nsCalendar();
NS_DECL_ISUPPORTS
/* nsICalICalendarParserObject */
NS_IMETHOD Init();
NS_IMETHOD SetParameter(nsString & aKey, nsString & aValue);
/* nsICalendar */
NS_IMETHOD_(UnicodeString) GetCalScale() const;
NS_IMETHOD SetCalScale(UnicodeString s, JulianPtrArray * parameters = 0);
NS_IMETHOD SetCalScaleProperty(nsICalProperty * property);
//NS_IMETHOD_(nsICalProperty *) GetCalScaleProperty() const;
NS_IMETHOD_(UnicodeString) GetVersion() const;
NS_IMETHOD SetVersion(UnicodeString s, JulianPtrArray * parameters = 0);
NS_IMETHOD SetVersionProperty(nsICalProperty * property);
//NS_IMETHOD_(nsICalProperty *) GetVersionProperty() const;
NS_IMETHOD_(UnicodeString) GetProdid() const;
NS_IMETHOD SetProdid(UnicodeString s, JulianPtrArray * parameters = 0);
NS_IMETHOD SetProdidProperty(nsICalProperty * property);
//NS_IMETHOD_(nsICalProperty *) GetProdidProperty() const;
NS_IMETHOD_(PRInt32) GetMethod() const;
NS_IMETHOD SetMethod(PRInt32 i);
NS_IMETHOD SetMethodProperty(nsICalProperty * property);
NS_IMETHOD AddEvent(nsICalVEvent * event);
NS_IMETHOD_(PRBool) StoreProperty(nsCalICalendarTag tag, nsICalProperty * prop,
JulianPtrArray * vTimeZones);
NS_IMETHOD_(NSCalendar *) GetNSCalendar() const;
protected:
~nsCalendar();
private:
NSCalendar * mCalendar;
};
#endif /* nsCalendar_h___ */

Просмотреть файл

@ -1,833 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* nscal.h
* John Sun
* 2/18/98 1:35:06 PM
*/
/*
* Updated 9/24/98 sman
* We need to be able to append a list of events: AddEventList
*/
#ifndef __NSCALENDAR_H_
#define __NSCALENDAR_H_
#include <unistring.h>
#include "ptrarray.h"
#include "prprty.h"
#include "icalredr.h"
#include "icalcomp.h"
#include "vevent.h"
#include "vtodo.h"
#include "vjournal.h"
#include "vfrbsy.h"
#include "jutility.h"
#include "julnstr.h"
#include "nscalcoreicalexp.h"
/**
* NSCalendar encapsulates a iCalendar calendar object. An NSCalendar
* may contain Calendar Components such as VEvent, VTodo, VJournal,
* VFreebusy and VTimeZones. It also contains the METHOD
* PRODID, VERSION, and CALSCALE properties. (NAME, SOURCE removed 4-28-98).
*/
class NS_CAL_CORE_ICAL NSCalendar
{
private:
#if 0
/**
* Default constructor. Hide from clients.
*/
NSCalendar();
#endif
public:
/*static const UnicodeString ms_asMETHODS[];*/
/**
* An enumeration of ITIP methods.
*/
enum METHOD{METHOD_PUBLISH = 0, METHOD_REQUEST = 1,
METHOD_REPLY = 2, METHOD_CANCEL = 3, METHOD_REFRESH = 4,
METHOD_COUNTER = 5, METHOD_DECLINECOUNTER = 6, METHOD_ADD = 7,
METHOD_LENGTH= 8, METHOD_INVALID = -1};
/**
* Converts ITIP method in string to the METHOD enumeration.
* @param UnicodeString & method
*
* @return static NSCalendar::METHOD
*/
static NSCalendar::METHOD stringToMethod(UnicodeString & method);
/**
* Converts METHOD to string. A method not publish through add
* returns "". (i.e. METHOD_LENGTH, METHOD_INVALID).
* @param NSCalendar::METHOD method
* @param UnicodeString & out
*
* @return static UnicodeString
*/
static UnicodeString & methodToString(NSCalendar::METHOD method, UnicodeString & out);
enum JOURNAL_METHOD{
JOURNAL_METHOD_PUBLISH = METHOD_PUBLISH,
JOURNAL_METHOD_CANCEL= METHOD_CANCEL,
JOURNAL_METHOD_REFRESH = METHOD_REFRESH,
JOURNAL_METHOD_LENGTH = 3, JOURNAL_METHOD_INVALID = -1
};
enum FREEBUSY_METHOD{
FREEBUSY_METHOD_PUBLISH = METHOD_PUBLISH,
FREEBUSY_METHOD_REQUEST = METHOD_REQUEST,
FREEBUSY_METHOD_REPLY = METHOD_REPLY,
FREEBUSY_METHOD_LENGTH = 3, FREEBUSY_METHOD_INVALID = -1
};
enum SPECIAL_METHOD{
SPECIAL_METHOD_DELEGATE = 0,
SPECIAL_METHOD_LENGTH = 1, SPECIAL_METHOD_INVALID = -1
};
enum METHOD_PROPS{PROPS_METHOD = 0, PROPS_JOURNAL_METHOD = 1,
PROPS_FREEBUSY_METHOD = 2, PROPS_SPECIAL_METHOD = 3};
enum CALSCALE{CALSCALE_GREGORIAN = 0,
CALSCALE_LENGTH = 1, CALSCALE_INVALID = -1};
/* -- METHODS -- */
/**
* Constructor. Creates NSCalendar with initial logfile initLog.
* @param JLog * initLog = 0
*/
NSCalendar(JLog * initLog = 0);
/*NSCalendar(User u);*/
/**
* Copy constructor
* @param NSCalendar & that
*/
NSCalendar(NSCalendar & that);
/**
* Destructor
*/
~NSCalendar();
/**
* Export this calendar to a file with filename. If error occurred,
* return false in status boolean.
* TODO: test it
*/
void export(const char * filename, t_bool & status);
/**
* clone this NSCalendar
* TODO: test it
*/
NSCalendar * clone(JLog * initLog);
/* CALSCALE */
UnicodeString getCalScale() const;
void setCalScale(UnicodeString s, JulianPtrArray * parameters = 0);
ICalProperty * getCalScaleProperty() const { return m_CalScale; }
/* VERSION */
UnicodeString getVersion() const;
void setVersion(UnicodeString s, JulianPtrArray * parameters = 0);
ICalProperty * getVersionProperty() const { return m_Version; }
/* PRODID */
UnicodeString getProdid() const;
void setProdid(UnicodeString s, JulianPtrArray * parameters = 0);
ICalProperty * getProdidProperty() const { return m_Prodid; }
#if 0
/* SOURCE */
UnicodeString getSource() const;
void setSource(UnicodeString s, JulianPtrArray * parameters = 0);
ICalProperty * getSourceProperty() const { return m_Source; }
/* NAME */
UnicodeString getName() const;
void setName(UnicodeString s, JulianPtrArray * parameters = 0);
ICalProperty * getNameProperty() const { return m_Name; }
#endif
/* METHOD: NOTE: Method is not an ICalProperty, but saved as an NSCalendar::METHOD */
void setMethod(NSCalendar::METHOD i) { m_iMethod = i; }
NSCalendar::METHOD getMethod() const { return (NSCalendar::METHOD) m_iMethod; }
/* XTOKENS: NOTE: a vector of strings, not a vector of ICalProperties */
void addXTokens(UnicodeString s);
JulianPtrArray * getXTokens() const { return m_XTokensVctr; }
/** getter and setter for when events were last updated from server */
void setEventsLastUpdatedFromServer(DateTime d) { m_EventsLastUpdatedFromServer = d; }
DateTime getEventsLastUpdatedFromServer() { return m_EventsLastUpdatedFromServer; }
/** getter for when events span */
DateTime getEventsSpanStart() { return m_EventsSpanStart; }
DateTime getEventsSpanEnd() { return m_EventsSpanEnd; }
/**
* Given an ICalReader object, parse the stream to populate this NSCalendar.
* In the process of parsing, the NSCalendar may create subcomponents
* such as VEvent, VTodo, VJournal, VTimeZone, and VFreebusy.
* If stream came from a file, store filename (NOTE: may remove later).
*
* @param brFile ICalReader stream object to parse from
* @param fileName filename of stream if stream is from a file
* @param encoding the encoding of the stream, default is 7bit.
*
*/
void parse(ICalReader * brFile, UnicodeString & fileName,
nsCalUtility::MimeEncoding encoding = nsCalUtility::MimeEncoding_7bit);
/**
* Returns the error log.
*
* @return JLog*
*/
JLog* getLog() const { return m_Log; };
/**
* Return the vector of nsCalLogErrors on this ICalComponent:
* Return 0 if ic is not in this calendar.
* Return 0 if ic has no error vector.
* Do not deallocate returned vector. Returns a ptr to vector, not a new vector.
* @param ICalComponent * ic
*
* @return JulianPtrArray *
*/
JulianPtrArray * getLogVector(ICalComponent * ic);
/**
* Return the vector of nsCalLogErrors on this calendar.
* Return 0 if this calendar has no error vector.
* Do not deallocate returned vector. Returns a ptr to vector, not a new vector.
*/
JulianPtrArray * getLogVector();
/**
* Returns the curl associated with this nsCalendar. The
* curl points to the calendar store where components in
* this nsCalendar are to be stored. It is required
* for an nsCalendar to have an associated curl if any
* of its components will be persisted in a calendar store.
*
* @return a JulianString containing the curl
*/
JulianString getCurl() const {return m_sCurl;}
/**
* Set the default curl for this nsCalendar.
*/
void setCurl(const char* ps) {m_sCurl = ps;}
/**
* Set the default curl for this nsCalendar.
*/
void setCurl(const JulianString& s) {m_sCurl = s;}
/**
* Returns calendar in a human-readable format to a string.
*
* @return UnicodeString
*/
UnicodeString toString();
/**
* Returns the header information of this calendar in a string reference. The header
* information is defined to be the calendar properties such as
* method, version, prodid, calscale, name, and source.
* @param UnicodeString & sResult
*
* @return UnicodeString &
*/
UnicodeString & createCalendarHeader(UnicodeString & sResult);
/**
* Returns calendar in ICAL format to a string.
*
* @return UnicodeString
*/
UnicodeString toICALString();
/**
* Returns calendar in ICAL format to a string with the component pattern
* specified.
*
* @return UnicodeString
*/
UnicodeString toFilteredICALString(UnicodeString componentPattern);
/**
* Create a VFreebusy object with the correct freebusy periods
* depending on the current VEvent vector. The start and end time
* of the VFreebusy will defined from the start and end parameters.
* Clients must delete returned object.
* @param start start time of VFreebusy
* @param end end time of VFreebusy
*
* @return new VFreebusy representing freebusy time from [start-end]
*/
VFreebusy * createVFreebusy(DateTime start, DateTime end);
/**
* Fill in a VFreebusy object with the correct freebusy periods
* depending on the current VEvent vector. The start and end time
* of the VFreebusy will defined from the DTSTART and DTEND values
* of the VFreebusy.
* @param VFreebusy * toFillIn
*/
void calculateVFreebusy(VFreebusy * toFillIn);
/**
* Return the first VFreebusy with a specified UID and sequence no.
* If sequence number set to -1, just search on UID.
* @param sUID target UID to look for
* @param iSeqNo target seqNo to look for
*
* @return first VFreebusy matching uid, sequence number.
*/
VFreebusy * getVFreebusy(UnicodeString sUID, t_int32 iSeqNo = -1);
/*VFreebusy * getVFreebusy(JulianPtrArray * out, DateTime start, DateTime end);*/
/**
* Return the first VEvent with a specified UID and sequence no.
* If sequence number set to -1, just search on UID.
* @param sUID target UID to look for
* @param iSeqNo target seqNo to look for
*
* @return first VEvent matching uid, sequence number.
*/
VEvent * getEvent(UnicodeString sUID, t_int32 iSeqNo = -1);
/**
* Return the first VTodo with a specified UID and sequence no.
* If sequence number set to -1, just search on UID.
* @param sUID target UID to look for
* @param iSeqNo target seqNo to look for
*
* @return first VTodo matching uid, sequence number.
*/
VTodo * getTodo(UnicodeString sUID, t_int32 iSeqNo = -1);
/**
* Return the first VJournal with a specified UID and sequence no.
* If sequence number set to -1, just search on UID.
* @param sUID target UID to look for
* @param iSeqNo target seqNo to look for
*
* @return first VJournal matching uid, sequence number.
*/
VJournal * getJournal(UnicodeString sUID, t_int32 iSeqNo = -1);
/**
* Add the ICalComponent to the vector of Events.
* NOTE: doesn't add clone of v, but actually ptr to v, so don't deallocate
* this may change later
* NOTE: changed from VEvent * v to ICalComponent * v.
* @param v VEvent to add
*/
void addEvent(ICalComponent * v);
/**
* Append the supplied vector of events to this NSCalendar's
* event list. Note that it does not clone the events. It simply
* adds the pointer to the events to the event list.
* @param pEventList the list of events to add...
*/
void addEventList(JulianPtrArray *pEventList);
/**
* Add the ICalComponent to the vector of Todos.
* NOTE: doesn't add clone of v, but actually ptr to v, so don't deallocate
* this may change later
* NOTE: changed from VTodo * v to ICalComponent * v.
* @param v VTodo to add
*/
void addTodo(ICalComponent * v);
/**
* Add the ICalComponent to the vector of Journals.
* NOTE: doesn't add clone of v, but actually ptr to v, so don't deallocate
* this may change later
* NOTE: changed from VJournal * v to ICalComponent * v.
* @param v VJournal to add
*/
void addJournal(ICalComponent * v);
/**
* Add the ICalComponent to the vector of VFreebusy.
* NOTE: doesn't add clone of v, but actually ptr to v, so don't deallocate
* this may change later
* NOTE: changed from VFreebusy * v to ICalComponent * v.
* @param v VFreebusy to add
*/
void addVFreebusy(ICalComponent * v);
/**
* Add the ICalComponent to the vector of VTimeZone.
* NOTE: doesn't add clone of v, but actually ptr to v, so don't deallocate
* this may change later
* NOTE: changed from VTimezone * v to ICalComponent * v.
* @param v VTimeZone to add
*/
void addTimeZone(ICalComponent * v);
/**
* Return ptr to vector of events
* @return ptr to vector of events
*/
JulianPtrArray * getEvents() const { return m_VEventVctr; }
/**
* XXX: Temp hack.
* This is used to remove the ownership of the vector of events
* from this calendar to nobody. It does this by returning
* the pointer to m_VEventVctr, then setting the internal value
* of m_VEventVctr to 0. Thus when this NSCalendar is destroyed
* the vector of events is not.
* The caller now owns the vector of events and must delete it
* and its VEvent contents.
* This method should be called only when moving events from
* one calendar to another.
*
* @return the pointer to the vector of events
*/
JulianPtrArray * changeEventsOwnership();
/**
* Return ptr to vector of vfreebusies
* @return ptr to vector of vfreebusies
*/
JulianPtrArray * getVFreebusy() const { return m_VFreebusyVctr; }
/**
* Return ptr to vector of todos
* @return ptr to vector of todos
*/
JulianPtrArray * getTodos() const { return m_VTodoVctr; }
/**
* Return ptr to vector of journals
* @return ptr to vector of journals
*/
JulianPtrArray * getJournals() const { return m_VJournalVctr; }
/**
* Return ptr to vector of timezones
* @return ptr to vector of timezones
*/
JulianPtrArray * getTimeZones() const { return m_VTimeZoneVctr; }
/**
* Given a vector of components, and the type of the component, prints
* each component in vector to its default human-readable string value
* Each string is appended to resulting string and is returned in out.
* For debugging uses.
* @param components vector of components to print
* @param sType type of component in string
* @param out resulting output string
*
* @return output string (out)
*/
static UnicodeString & debugPrintComponentVector(JulianPtrArray * components,
const UnicodeString sType, UnicodeString & out);
/**
* Fills is the vector retUID with a list of unique uids for this component type
* client must delete contents of retUID.
* @param fillin
*
* @return void
*/
void getUniqueUIDs(JulianPtrArray * retUID, ICalComponent::ICAL_COMPONENT type);
/**
* Fills in out with VEvents with UID equal to sUID, client must
* delete contents of events
* @param XPPtrArray * out
* @param UnicodeString & sUID
*
* @return void
*/
void getEvents(JulianPtrArray * out, UnicodeString & sUID);
/**
* Fetch events by (uid, rec-id, modifier).
* set rec-id to "" if no rec-id. set modifier to "" if no
* modifier.
*
* @param JulianPtrArray * out
* @param UnicodeString & sUID
* @param UnicodeString & sRecurrenceID
* @param UnicodeString & sModifier
*
* @return void
*/
void getEventsByComponentID(JulianPtrArray * out, UnicodeString & sUID,
UnicodeString & sRecurrenceID, UnicodeString & sModifier);
/**
* Get events by date range, adds ptr to out, not clones of ptrs.
*/
void getEventsByRange(JulianPtrArray * out, DateTime start, DateTime end);
/**
* Fills in out with VTodos with UID equal to sUID, client must
* delete contents of events
* @param XPPtrArray * out
* @param UnicodeString & sUID
*
* @return void
*/
void getTodos(JulianPtrArray * out, UnicodeString & sUID);
/**
* Fills in out with VJournals with UID equal to sUID, client must
* delete contents of events
* @param XPPtrArray * out
* @param UnicodeString & sUID
*
* @return void
*/
void getJournals(JulianPtrArray * out, UnicodeString & sUID);
/**
* Sorts vector of components by UID,
* passing in type to decide which vector to sort
* @param type component type of vector (VEVENT, VTODO, etc.)
*/
void sortComponentsByUID(ICalComponent::ICAL_COMPONENT type);
/**
* Sorts vector of components by DTSTART value,
* passing in type to decide which vector to sort
* @param type component type of vector (VEVENT, VTODO, etc.)
*/
void sortComponentsByDTStart(ICalComponent::ICAL_COMPONENT type);
protected:
/**
* Populates property data members. Does this by taking contents of
* property value and storing in appropriate property, with
* parameters also being stored. Basically a big switch statement
* on the property name.
* @param strLine current parsed line
* @param propName property name
* @param propVal property value
* @param parameters parameters of property
*
* @return TRUE (TODO: may remove later)
*/
t_bool storeData(UnicodeString & strLine, UnicodeString & propName,
UnicodeString & propVal, JulianPtrArray * parameters);
/*void selfCheck();*/
/**
* Helper method that expands the VEvent, VTodo, and VJournal
* vectors.
*
* @return void
*/
void expandAllComponents();
private:
/**
* Add component with type to correct vector. For example,
* if type == ICAL_COMPONENT_VEVENT, then add to event vector.
* Return TRUE if component was updated with component already in store,
* otherwise return FALSE if component had to be added to store.
* @param ic component to add
* @param type type of component
* @return TRUE if component was updated, FALSE if component was added
*/
t_bool addComponentWithType(ICalComponent * ic,
ICalComponent::ICAL_COMPONENT type);
#if 0
/**
* Adds a vector of components with type to correct vector.
* Make sure all elements in components vector have
* component type equal to type.
* @param components vector of components
* @param type type of all components in vector
*/
void addComponentsWithType(JulianPtrArray * components,
ICalComponent::ICAL_COMPONENT type);
#endif
/**
* Expand each component in vector of TimeBasedEvents
* with component type = type.
* @param v vector of TimeBasedEvents
* @param type type of all components in vector
*/
void expandTBEVector(JulianPtrArray * v,
ICalComponent::ICAL_COMPONENT type);
/**
* Expand a TimeBasedEvent with component type = type
* @param e TimeBasedEvent to expand
* @param type component type of TimeBasedEvent
*/
void expandComponent(TimeBasedEvent * e,
ICalComponent::ICAL_COMPONENT type);
/**
* Helper method sorts ICalComponents by UID.
* Only applicable for VEvent, VTodo, VJournal, VFreebusy
* vectors.
* @param components vector of components to sort
* @param type type of all components in vector
*/
static void sortComponentsByUIDHelper(JulianPtrArray * components,
ICalComponent::ICAL_COMPONENT type);
/**
* Helper method sorts ICalComponents by DTSTART.
* Only applicable for VEvent, VTodo, VJournal, VFreebusy
* vectors.
* @param components vector of components to sort
* @param type type of all components in vector
*/
static void sortComponentsByDTStartHelper(JulianPtrArray * components,
ICalComponent::ICAL_COMPONENT type);
/**
* Fills in retUID vector with all unique UIDs found in components vector.
* Does this by sorting components vector by UID, then marching down.
* vector. O(nlogn + n).
* @param retUID fill in with all unique UIDs
* @param components vector of components to look through
* @param type type of all components in vector.
*/
static void getUniqueUIDsHelper(JulianPtrArray * retUID,
JulianPtrArray * components, ICalComponent::ICAL_COMPONENT type);
#if 0
/**
* Fills in out vector with ICalComponents with UID = uid and
* with GetType() == type.
* @param out fill in with components with uid, type match
* @param uid target UID
* @param type target component type
*/
void getComponentsWithType(JulianPtrArray * out, UnicodeString & uid,
ICalComponent::ICAL_COMPONENT type);
#endif
/**
* Fetch components by (uid, rec-id, modifier).
* set rec-id to "" if no rec-id. set modifier to "" if no
* modifier.
*
* @param JulianPtrArray * out
* @param UnicodeString & sUID
* @param UnicodeString & sRecurrenceID
* @param UnicodeString & sModifier
*
* @return void
*/
void getTBEWithTypeByComponentID(JulianPtrArray * out, UnicodeString & sUID,
UnicodeString & sRecurrenceID, UnicodeString & sModifier,
ICalComponent::ICAL_COMPONENT type);
/**
* Fills in out with TimeBasedEvents with the following
* if sRecurrenceID.isValid()
* {
* if sModifier == NONE, just get components that match (uid, recid)
* else if sModifier = THISANDPRIOR, get components that match (uid, recid, THISANDPRIOR)
* else if sModifier = THISANDFUTURE, get components that match (uid, recid, THISANDFUTURE)
*
* }
* else
* call getComponents(out, components, sUID);
*
* @param JulianPtrArray * out
* @param JulianPtrArray * component
* @param UnicodeString & sUID
* @param UnicodeString & sRecurrenceID
* @param UnicodeString & sModifier
*
* @return void
*/
void getTBEByComponentID(JulianPtrArray * out,
JulianPtrArray * component, UnicodeString & sUID,
UnicodeString & sRecurrenceID, UnicodeString & sModifier);
/**
* Fills in out with ICalComponents with UID = sUID.
* NOTE: clients NOT responsible for deleting components (passing actual ptr)
* @param out fill in with components with uid = sUID
* @param components vector of components to look through
* @param sUID target UID
*/
static void getComponents(JulianPtrArray * out, JulianPtrArray * components,
UnicodeString & sUID);
/**
* return the ICalComponent that matches the uid and sequence #
*/
/**
* Return the ICalComponent that matches the UID and sequence number.
* If sequence number is -1, then just match on UID.
* @param vTBE vector of components to look through
* @param sUID target UID
* @param iSeqNo target sequence number
*
* @return first ICalComponent matching UID, iSeqNo.
*/
static ICalComponent * getComponent(JulianPtrArray * vTBE,
UnicodeString & sUID, t_int32 iSeqNo = -1);
/**
* Prints each component in components vector to ICAL export string
* and append result to out. Resulting output string contains
* all component's iCal export string.
* @param components vector of components to print in ICAL
* @param out output string
*
* @return output string (out)
*/
static UnicodeString & printComponentVector(JulianPtrArray * components,
UnicodeString & out);
/**
* Prints each component in components vector to ICAL export string
* to file f. Resulting output string contains all component's iCal export string.
* @param components vector of components to print in ICAL
* @param f FILE to print to
* @return TRUE if written OK, FALSE otherwise.
*/
static t_bool printComponentVectorToFile(JulianPtrArray * components, FILE * f);
public:
/**
* Prints each component in components vector to ICAL export string
* and append result to out. Resulting output string contains
* events with filtered properties depending on strFmt.
* all component's iCal export string.
* @param components vector of components to print in ICAL
* @param strFmt component formatting string to apply
* @param out output string
*
* @return output string (out)
*/
static UnicodeString & printFilteredComponentVector(JulianPtrArray * components,
UnicodeString & strFmt, UnicodeString & out);
private:
/**
* Helper method. Fills in Freebusy object f with periods representing
* free and busy time periods of this calendar from start to end time.
* Calculates periods by looking through event vector and using
* events with TRANSP = OPAQUE.
* @param f Freebusy object to fill in with periods
* @param start start of freebusy period
* @param end end of freebusy period
*/
void createVFreebusyHelper(Freebusy * f, DateTime start, DateTime end);
public:
/**
* update the m_EventsSpanStart and m_EventsSpanEnd members
* taking into account new VEvent.
*/
void updateEventsRange(VEvent * v);
/**
* caller of FetchEventsByRange must be able to set the known
* event range span. There may not have been any events in
* the database within a range. If ther are, the events do not
* necessarily span the full range. In any case, we need to be
* able to update known limits on the event range...
* -sman 10/12/98
* @param DTStart Known good start time
* @param DTEnd Known good stop time
*/
void updateEventsRange(DateTime DTStart, DateTime DTEnd);
private:
/* -- private data members -- */
/* parsing flags */
static t_bool m_bLoadMultipleCalendars;
static t_bool m_bSmartLoading;
/* vector of calendar components */
JulianPtrArray * m_VJournalVctr;
JulianPtrArray * m_VEventVctr;
JulianPtrArray * m_VTodoVctr;
JulianPtrArray * m_VTimeZoneVctr;
JulianPtrArray * m_VFreebusyVctr;
/* vector of x-tokens */
JulianPtrArray * m_XTokensVctr;
/* NSCalendar properties */
ICalProperty * m_CalScale;
ICalProperty * m_Version;
ICalProperty * m_Prodid;
#if 0
ICalProperty * m_Source;
ICalProperty * m_Name;
#endif
/*ICalProperty * m_Method;
UnicodeString & m_Method;*/
/** method is stored as int */
t_int32 m_iMethod;
/* log file pointer */
JLog * m_Log;
/**
* the timestamp of the last time these events were updated
*/
DateTime m_EventsLastUpdatedFromServer;
/**
* the start of end time range of events.
*/
DateTime m_EventsSpanStart;
DateTime m_EventsSpanEnd;
JulianString m_sCurl; /* cal url to calendar store for this calendar */
};
#endif /* __NSCALENDAR_H_ */

Просмотреть файл

@ -1,93 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nscalcoreicalCIID_h__
#define nscalcoreicalCIID_h__
#include "nsISupports.h"
#include "nsIFactory.h"
#include "nsRepository.h"
// 2b502840-646e-11d2-943c-006008268c31
#define NS_CALICALENDARVCALENDAR_CID \
{ 0x2b502840, 0x646e, 0x11d2, \
{0x94, 0x3c, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31} }
//8cda7330-646e-11d2-943c-006008268c31
#define NS_CALICALENDARVEVENT_CID \
{ 0x8cda7330, 0x646e, 0x11d2, \
{0x94, 0x3c, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31} }
//904609a0-646e-11d2-943c-006008268c31
#define NS_CALICALENDARVTODO_CID \
{ 0x904609a0, 0x646e, 0x11d2, \
{0x94, 0x3c, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31} }
//9101fdb0-646e-11d2-943c-006008268c31
#define NS_CALICALENDARVJOURNAL_CID \
{ 0x9101fdb0, 0x646e, 0x11d2, \
{0x94, 0x3c, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31} }
//9177a720-646e-11d2-943c-006008268c31
#define NS_CALICALENDARVFREEBUSY_CID \
{ 0x9177a720, 0x646e, 0x11d2, \
{0x94, 0x3c, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31} }
//91ad22b0-646e-11d2-943c-006008268c31
#define NS_CALICALENDARVTIMEZONE_CID \
{ 0x91ad22b0, 0x646e, 0x11d2, \
{0x94, 0x3c, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31} }
//91d97320-646e-11d2-943c-006008268c31
#define NS_CALICALENDARVALARM_CID \
{ 0x91d97320, 0x646e, 0x11d2, \
{0x94, 0x3c, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31} }
//9205c390-646e-11d2-943c-006008268c31
#define NS_CALDATETIMEPROPERTY_CID \
{ 0x9205c390, 0x646e, 0x11d2, \
{ 0x94, 0x3c, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31} }
//92352260-646e-11d2-943c-006008268c31
#define NS_CALSTRINGPROPERTY_CID \
{ 0x92352260, 0x646e, 0x11d2, \
{ 0x94, 0x3c, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31} }
//925cdd40-646e-11d2-943c-006008268c31
#define NS_CALINTEGERPROPERTY_CID \
{ 0x925cdd40, 0x646e, 0x11d2, \
{ 0x94, 0x3c, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31} }
//9287a680-646e-11d2-943c-006008268c31
#define NS_CALICALENDARTIMEBASEDEVENT_CID \
{ 0x9287a680, 0x646e, 0x11d2, \
{0x94, 0x3c, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31} }
//92b3f6f0-646e-11d2-943c-006008268c31
#define NS_CALATTENDEEPROPERTY_CID \
{ 0x92b3f6f0, 0x646e, 0x11d2, \
{ 0x94, 0x3c, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31} }
//92dec030-646e-11d2-943c-006008268c31
//9329a060-646e-11d2-943c-006008268c31
#endif

Просмотреть файл

@ -1,30 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nscalcoreicalexp_h__
#define nscalcoreicalexp_h__
#include "nscore.h"
#ifdef _IMPL_NS_CAL_CORE_ICAL
#define NS_CAL_CORE_ICAL NS_EXPORT
#else
#define NS_CAL_CORE_ICAL NS_IMPORT
#endif
#endif /* nscalcoreicalexp_h__ */

Просмотреть файл

@ -1,273 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* orgnzr.h
* John Sun
* 4/7/98 11:16:49 AM
*/
#ifndef __NSCALORGANIZER_H_
#define __NSCALORGANIZER_H_
#include "jlog.h"
#include "prprty.h"
/**
* Encapsulates a Calendar Component's organizer.
* Similar to the Attendee property, but doesn't
* have as much state.
*/
class nsCalOrganizer : public ICalProperty
{
private:
/*-----------------------------
** MEMBERS
**---------------------------*/
/**
* the name of the nsCalOrganizer. Whatever is to the right of the colon
* the name must be a URL. Field must be filled to be valid Attendee.
*/
UnicodeString m_Name;
/** the common name of attendee. Optional, default is "". */
UnicodeString m_CN;
/** the MAILTO: of a calendar user acting on behalf of the attendee.
* Optional, default is "".
*/
UnicodeString m_SentBy;
/** the location of the Attendee's directory information.
* Optional, default is "". */
UnicodeString m_Dir;
/** the language of the common name of the attendee. Optional, default is "". */
UnicodeString m_Language;
/** ptr to log file to write errors to */
JLog * m_Log;
static const t_int32 ms_cnsCalOrganizerName;/* = 'N';*/
static const t_int32 ms_cnsCalOrganizerDir; /* = 'l'; 'el'*/
static const t_int32 ms_cnsCalOrganizerSentBy;/* = 's';*/
static const t_int32 ms_cnsCalOrganizerCN;/* = 'C';*/
static const t_int32 ms_cnsCalOrganizerLanguage;/* = 'm';*/
static const t_int32 ms_cnsCalOrganizerDisplayName;/* = 'z';*/
/*-----------------------------
** PRIVATE METHODS
**---------------------------*/
nsCalOrganizer(nsCalOrganizer & that);
public:
/*-----------------------------
** CONSTRUCTORS and DESTRUCTORS
**---------------------------*/
nsCalOrganizer(JLog * initLog = 0);
~nsCalOrganizer();
/*---------- To satisfy ICalProperty interface ----------*/
/**
* Sets parameters.
* @param parameters vector of parameters to set
*
*/
virtual void setParameters(JulianPtrArray * parameters);
/**
* Return value of property. Never use. Use getName().
*
* @return value of property
*/
virtual void * getValue() const;
/**
* Sets value of property. Never use. Use setName().
* @param value new value of property
*
*/
virtual void setValue(void * value);
/**
* Returns a clone of this property.
* @param initLog the log file for clone to write to
*
* @return clone of this ICalProperty object
*/
virtual ICalProperty * clone(JLog * initLog);
/**
* Checks whether this property is valid or not. Must have MAILTO: in
* front of attendee name to be valid.
*
* @return TRUE if property is valid, FALSE otherwise
*/
virtual t_bool isValid();
/**
* Return property to human-readable string.
* @param dateFmt formatting string
* @param out output human-readable string
*
* @return output human-readable string (out)
*/
virtual UnicodeString & toString(UnicodeString & strFmt, UnicodeString & out);
/**
* Return property to human-readable string.
* @param out output human-readable string
*
* @return output human-readable string (out)
*/
virtual UnicodeString & toString(UnicodeString & out);
/**
* Return property to iCal property string.
* @param out output iCal string
*
* @return output iCal string (out)
*/
virtual UnicodeString & toICALString(UnicodeString & out);
/**
* Return property to iCal property string. Inserts sProp to
* front of output string. sProp should be the property name of this
* property.
* @param sProp property name to append to insert at front of out
* @param out output iCal string with sProp in front
*
* @return output iCal string with sProp in front (out)
*/
virtual UnicodeString & toICALString(UnicodeString & sProp, UnicodeString & out);
/*----------End of ICalProperty interface----------*/
/*-----------------------------
** ACCESSORS (GET AND SET)
**---------------------------*/
/**
* Sets nsCalOrganizer name.
* @param sName new Attendee name
*
*/
void setName(UnicodeString sName);
/**
* Returns nsCalOrganizer name.
*
* @return Attendee name
*/
UnicodeString getName() const { return m_Name; }
/**
* Set CN (common-name) value
* @param new CN value
*/
void setCN(UnicodeString u) { m_CN = u; }
/**
* Set Language value
* @param new Language value
*/
void setLanguage(UnicodeString u) { m_Language = u; }
/**
* Set DIR (location of directory info) value
* @param new DIR value
*/
void setDir(UnicodeString u) { m_Dir = u; }
/**
* Set SENT-BY (calendar user acting on behalf of the attendee) value
* @param new SENT-BY value
*/
void setSentBy(UnicodeString u) { m_SentBy = u; }
/**
* Return CN (common-name) value
*
* @return CN value
*/
UnicodeString getCN() const { return m_CN; }
/**
* Return Language value
*
* @return Language value
*/
UnicodeString getLanguage() const { return m_Language; }
/**
* Return DIR (location of directory info) value
*
* @return DIR value
*/
UnicodeString getDir() const { return m_Dir; }
/**
* Return SENT-BY (calendar user acting on behalf of the organizer) value
*
* @return SENT-BY value
*/
UnicodeString getSentBy() const { return m_SentBy; }
/*-----------------------------
** UTILITIES
**---------------------------*/
/**
* Given attendee name and parameters, populates Attendee
* data members.
* @param propVal attendee name
* @param parameters attendee parameters
*
*/
void parse(UnicodeString & propVal, JulianPtrArray * parameters = 0);
/**
* Sets parameter with name paramName with value paramVal.
* For MEMBER, DELEGATED-TO, DELEGATED-FROM, DIR, SENT-BY, the
* double quotes are stripped. THE MAILTO: is not stripped.
*
* @param paramName parameter name to set
* @param paramVal new value of parameter
*/
void setParam(UnicodeString & paramName, UnicodeString & paramVal);
/**
* convert a character to the content of a parameter in
* human-readable string format
*
* @param c a character represents a parameter
* @return parameter in a human-readable string
*/
UnicodeString toStringChar(t_int32 c);
/*-----------------------------
** STATIC METHODS
**---------------------------*/
/*-----------------------------
** OVERLOADED OPERATORS
**---------------------------*/
};
#endif /* __NSCALORGANIZER_H_ */

Просмотреть файл

@ -1,319 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* period.h
* John Sun
* 1/29/98 11:16:33 AM
*/
#ifndef __PERIOD_H_
#define __PERIOD_H_
#include "datetime.h"
#include "duration.h"
#include "ptrarray.h"
class Period
{
private:
/*-----------------------------
** MEMBERS
**---------------------------*/
/** the starting time of the period */
DateTime m_DTStart;
/** the ending time of the period */
DateTime m_DTEnd;
/** the duration of the period */
nsCalDuration m_Duration;
/*-----------------------------
** PRIVATE METHODS
**---------------------------*/
/**
* Parses an iCal Period string and
* populates date members.
* @param us iCal Period string
*/
void parse(UnicodeString & us);
/** checks period's data members */
void selfCheck();
/** create invalid period */
void createInvalidPeriod();
/**
* Helper method to get a part of period string.
* If bStart is TRUE, get the start string part,
* else get end string part.
* @param sPeriod period string
* @param bStart start or end
* @param out output start or end string
*
* @return output start or end string (out)
*/
static UnicodeString & getTimeString(UnicodeString & sPeriod,
t_bool bStart, UnicodeString & out);
public:
/**
* Retuns ending time regardless if dtend is invalid.
* If DTEnd is invalid, will then add duration to start to
* get ending time.
* @param d output ending datetime
*
* @return ouptu ending datetime (d)
*/
DateTime & getEndingTime(DateTime & d);
/**
* Constructor. Creates invalid period.
*/
Period();
/**
* Copy constructor.
* @param that period to copy
*/
Period(Period & that);
/**
* Constructor. Creates period by parsing string.
* @param us string to parse
*/
Period(UnicodeString & us);
/**
* Destructor.
*/
~Period();
/**
* Return start time.
*
* @return DateTime
*/
DateTime getStart() { return m_DTStart; }
/**
* Return dtend (may be invalid).
*
* @return DateTime
*/
DateTime getEnd() { return m_DTEnd; }
/**
* Return duration (may be invalid).
*
* @return nsCalDuration
*/
nsCalDuration getDuration() { return m_Duration; }
/**
* Set start time
* @param d new start value
*/
void setStart(DateTime d);
/**
* Set end time
* @param d new end value
*/
void setEnd(DateTime d);
/**
* Set duration
* @param d new duration value
*/
void setDuration(nsCalDuration d);
/**
* Set period by passing string.
* @param us string to parse.
*/
void setPeriodString(UnicodeString & us);
/* UTILITIES */
/**
* Return if this period is valid. A valid period must have a
* valid start datetime and a valid end datetime or a valid duration time.
* and the end time must be after the start time.
*
* @return TRUE if valid, FALSE otherwise
*/
t_bool isValid();
/**
* Return if this period intersects start, end range
* @param start start of target range
* @param end end of target range
*
* @return TRUE if in range, FALSE otherwise
*/
t_bool isIntersecting(DateTime & start, DateTime & end);
/**
* Return if this period intersects period range
* @param p target range
*
* @return TRUE if in range, FALSE otherwise
*/
t_bool isIntersecting(Period & p);
/**
* Return if this period is completely inside start, end range
* @param start start of target range
* @param end end of target range
*
* @return TRUE if completely inside range, FALSE otherwise
*/
t_bool isInside(DateTime & start, DateTime & end);
/**
* Return if this period is completely inside period range
* @param p target range
*
* @return TRUE if in range, FALSE otherwise
*/
t_bool isInside(Period & p);
/**
* Returns period in human readable format of "start - end".
*
* @return output string
*/
UnicodeString toString();
/**
* Returns period in iCal period format of "start/end", where
* start is UTC ISO8601 datetime format and end is either
* a UTC IS08601 datetime format or an iCal nsCalDuration string.
*
* @return output string
*/
UnicodeString toICALString();
/* STATIC METHODS */
/**
* Checks whether periods are connected. Connected means that the
* two periods combined form one block of time. Returns TRUE if
* p1 and p2 are connected, FALSE otherwise.
* @param p1 first period
* @param p2 second period
*
* @return TRUE if p1,p2 are connected, FALSE otherwise
*/
static t_bool IsConnectedPeriods(Period & p1, Period & p2);
/**
* Returns the union of two periods in outPer, if possible.
* If the union of the two-periods is not possible in one period
* (i.e. inPer1, inPer2 are disjoint) then return an invalid period.
* @param inPer1 first period
* @param inPer2 second period
* @param outPer return union of inPer1, inPer2.
* Invalid if inPer1,inPer are disjoint
*/
static void Union(Period & inPer1, Period & inPer2, Period & outPer);
/**
* Returns the intersection of this period with the range
* (start,end) into outPer if possible. If the
* intersection is null (i.e. inPer1, [start, end) are disjoint)
* then return an invalid period in outPer.
* @param iPer1 a period
* @param start start of range
* @param end end of range
* @param outPer output intersection of iPer1 with (start,end) range
*
*/
static void Intersection(Period & iPer1, DateTime & start, DateTime & end, Period & outPer);
/**
* Fill in vector out with periods inside inPer that are outside of
* (start, end) range. This simulates logical subtraction of periods
* @param inPer a period
* @param start start of range
* @param end end of range
* @param out output vector of periods inside inPer but outside (start,end)
*
*/
static void SubtractedPeriod(Period & inPer, DateTime & start, DateTime & end, JulianPtrArray * out);
/**
* Checks to see if u is a parseable iCal Period string. Return TRUE
* if parseable, FALSE otherwise.
* @param u target period string
*
* @return TRUE if parseable iCal Period, FALSE otherwise.
*/
static t_bool IsParseable(UnicodeString & u);
/**
* Gets starting time string from sPeriod.
* @param sPeriod input period string
* @param out output starting time string
*
* @return output starting time string (out)
*/
static UnicodeString & getStartTimeString(UnicodeString & sPeriod, UnicodeString & out);
/**
* Gets ending time string from sPeriod. Ending time maybe a
* duration string or a datetime string
* @param sPeriod input period string
* @param out output ending time string
*
* @return output ending time string (out)
*/
static UnicodeString & getEndTimeString(UnicodeString & sPeriod, UnicodeString & out);
/**
* Compares periods by their starting time. Used
* to pass into JulianPtrArray::QuickSort method.
* @param a ptr to first period
* @param b ptr to second period
*
* @return compareTo(a.start, b.start)
*/
static int ComparePeriods(const void * a, const void * b);
/**
* Compares periods by their ending time. Used
* to pass into JulianPtrArray::QuickSort method.
* @param a ptr to first period
* @param b ptr to second period
*
* @return compareTo(a.getEndingTime(), b.getEndingTime())
*/
static int ComparePeriodsByEndTime(const void * a, const void * b);
};
#endif /* __PERIOD_H_ */

Просмотреть файл

@ -1,124 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* pprprty.h
* John Sun
* 2/12/98 4:20:47 PM
*/
#include <unistring.h>
#include "sdprprty.h"
#include "period.h"
#ifndef __PERIODPROPERTY_H_
#define __PERIODPROPERTY_H_
/**
* PeriodProperty is a subclass of StandardProperty. It implements the ICalProperty
* interface for ICAL properties with TYPE=PERIOD.
*/
class PeriodProperty: public StandardProperty
{
private:
/** the Period value of the property */
Period * m_Period;
/**
* Default constructor
*/
PeriodProperty();
/**
* Copy constructor
* @param that property to copy
*/
PeriodProperty(const PeriodProperty & that);
public:
/**
* Constructor that sets value of property to contents of value
* and makes a copy of the contents of parameters ptr.
* @param value value of property
* @param parameters parameters of property
*/
PeriodProperty(Period * value, JulianPtrArray * parameters);
/**
* Destructor
*/
~PeriodProperty();
/**
* Return the value of the property
* @return void * ptr to value of the property
*/
virtual void * getValue() const;
/**
* Set the value of the property
* @param value the value to set property to
*/
virtual void setValue(void * value);
/**
* Returns a clone of this property. Clients are responsible for deleting
* the returned object.
*
* @return a clone of this property.
*/
virtual ICalProperty * clone(JLog * initLog);
/**
* Return TRUE if property is valid, FALSE otherwise
*
* @return TRUE if is valid, FALSE otherwise
*/
virtual t_bool isValid();
/**
* Return a string in human-readable form of the property.
* @param out contains output human-readable string
*
* @return the property in its human-readable string format
*/
virtual UnicodeString & toString(UnicodeString & out);
/**
* Return a string in human-readable form of the property.
* @param dateFmt format string options
* @param out contains output human-readable string
*
* @return the property in its human-readable string format
*/
virtual UnicodeString & toString(UnicodeString & dateFmt, UnicodeString & out);
/**
* Return the property's string in the ICAL format.
* @param out contains output ICAL string
*
* @return the property in its ICAL string format
*/
virtual UnicodeString & toExportString(UnicodeString & out);
};
#endif /* __PERIODPROPERTY_H_ */

Просмотреть файл

@ -1,411 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* prprty.h
* John Sun
* 2/10/98 4:03:56 PM
*/
#include <unistring.h>
#include "jdefines.h"
#include "ptrarray.h"
#include "icalprm.h"
#include "jatom.h"
#include "jlog.h"
#include "nscalcoreicalexp.h"
#ifndef __ICALPROPERTY_H_
#define __ICALPROPERTY_H_
/**
* The ICalProperty class defines the interface for methods that
* all iCal Calendar properties must implement. Also defines some
* static helper methods.
*/
class NS_CAL_CORE_ICAL ICalProperty
{
public:
/** Enumeration defines ICalProperty types */
enum PropertyTypes{TEXT, DATETIME, INTEGER, PERIOD, DURATION, BOOLEAN};
protected:
/**
* Default constructor. Hide from clients.
* Only subclasses allowed to use it.
*/
ICalProperty();
/**
* Copy constructor.
* @param that ICalProperty to copy
*/
ICalProperty(ICalProperty & that);
public:
/**
* Virtual Destructor.
*/
virtual ~ICalProperty() {}
/* -- interface of methods that subclasses must implement (pure-virtual) -- */
/**
* Sets parameters.
* @param parameters vector of parameters to set
*
*/
virtual void setParameters(JulianPtrArray * parameters)
{ PR_ASSERT(FALSE); if (parameters) {} }
/**
* Return value of property
*
* @return value of property
*/
virtual void * getValue() const { PR_ASSERT(FALSE); return 0;}
/**
* Sets value of property.
* @param value new value of property
*
*/
virtual void setValue(void * value) { PR_ASSERT(FALSE); if (value != 0) {} ; }
/**
* Returns a clone of this property.
* @param initLog the log file for clone to write to
*
* @return clone of this ICalProperty object
*/
virtual ICalProperty * clone(JLog * initLog)
{ PR_ASSERT(FALSE); if (initLog) {} return 0; }
/**
* Checks whether this property is valid or not
*
* @return TRUE if property is valid, FALSE otherwise
*/
virtual t_bool isValid() { PR_ASSERT(FALSE); return FALSE; }
/**
* Return property to human-readable string.
* @param dateFmt formatting string
* @param out output human-readable string
*
* @return output human-readable string (out)
*/
virtual UnicodeString & toString(UnicodeString & dateFmt,
UnicodeString & out)
{ PR_ASSERT(FALSE); if (dateFmt.size() > 0) {} ; return out; }
/**
* Return property to human-readable string.
* @param out output human-readable string
*
* @return output human-readable string (out)
*/
virtual UnicodeString & toString(UnicodeString & out)
{ PR_ASSERT(FALSE); return out; }
/**
* Return property to iCal property string.
* @param out output iCal string
*
* @return output iCal string (out)
*/
virtual UnicodeString & toICALString(UnicodeString & out) { PR_ASSERT(FALSE); return out; }
/**
* Return property to iCal property string. Inserts sProp to
* front of output string. sProp should be the property name of this
* property.
* @param sProp property name to append to insert at front of out
* @param out output iCal string with sProp in front
*
* @return output iCal string with sProp in front (out)
*/
virtual UnicodeString & toICALString(UnicodeString & sProp,
UnicodeString & out)
{ PR_ASSERT(FALSE); if (sProp.size() > 0) {} return out; }
#if 0
virtual UnicodeString & getParameterValue(UnicodeString & paramName, /* IN */
UnicodeString & paramVal, ErrorCode & status) /* OUT, OUT */
{
PR_ASSERT(FALSE); if (paramName.size() > 0 && paramVal.size() > 0 &&
status) {}
return paramVal;
}
virtual void setParameter(UnicodeString & paramName, UnicodeString & paramValue)
{
PR_ASSERT(FALSE); if (paramName.size() > 0 && paramValue.size() > 0) {}
}
void parse(UnicodeString & in) { PR_ASSERT(FALSE); if (in.size() > 0) {}}
#endif
/* -- END of interface of methods that subclasses must implement (pure-virtual) -- */
/*----------------------------
** STATIC METHODS
**--------------------------*/
/**
* Given propertyName, propertyValue, and parameters, returns the following string
* - propertyName:parameters[0];parameters[1]...:propertyValue
* @param sProp the property name
* @param sVal the property value
* @param parameters the parameters
* @param retVal the output string
* @return retVal (the output string)
*/
static UnicodeString & propertyToICALString(UnicodeString & sProp, UnicodeString & sVal,
JulianPtrArray * parameters, UnicodeString & retVal);
/**
* prints string parameters to ICAL export format
* @param sParam parameter name
* @param sVal string parameter value
* @param out output string
*
* @return output string (out)
*/
static UnicodeString & parameterToCalString(UnicodeString sParam,
UnicodeString & sVal, UnicodeString & out);
/**
* prints string parameters to ICAL export format
* @param sParam parameter name
* @param v vector of strings parameter value
* @param out output string
*
* @return output string (out)
*/
static UnicodeString & parameterVToCalString(UnicodeString param,
JulianPtrArray * v, UnicodeString & out);
/**
* Prints the property to ICAL format of form
* propName;property.parameters:property.value.
* A null property returns "".
* @param propName property name
* @param property ICalProperty to print
* @param retVal output string
*
* @return output string (retVal)
*/
static UnicodeString & propertyToICALString(UnicodeString & propName,
ICalProperty * property, UnicodeString & retVal);
/**
* Prints the properties to ICAL format of form
* propName;property1.parameters:property1.value.
* propName;property2.parameters:property2.value.
* propName;property3.parameters:property3.value.
* A null property returns "".
* @param propName property name
* @param properties vector of ICalProperty's to print
* @param retVal output string
*
* @return output string (retVal)
*/
static UnicodeString & propertyVectorToICALString(UnicodeString & propName,
JulianPtrArray * properties, UnicodeString & retVal);
/**
* Prints the strings to output. Used for printing X-Tokens
* @param strings vector of UnicodeStrings to print
* @param retVal output string
*
* @return output string (retVal)
*/
static UnicodeString & vectorToICALString(JulianPtrArray * strings, UnicodeString & retVal);
/**
* Prints the property to human-readable format. If property is null return "".
* @param property ICalProperty to print
* @param dateFmt Formatting string to pass to property
* @param retVal output string
*
* @return output string (retVal)
*/
static UnicodeString & propertyToString(ICalProperty * property, UnicodeString & dateFmt,
UnicodeString & retVal);
/**
* Prints the property to human-readable format. If property is null return "".
* @param property ICalProperty to print
* @param retVal Formatting string to pass to property
*
* @return output string (retVal)
*/
static UnicodeString & propertyToString(ICalProperty * property, UnicodeString & retVal);
/**
* Prints each ICalProperty in properties to human-readable format.
* @param properties vector of ICalProperty's to print
* @param retVal output string
*
* @return output string (retVal)
*/
static UnicodeString & propertyVectorToString(JulianPtrArray * properties,
UnicodeString & retVal);
/**
* Prints each ICalProperty in properties to human-readable format.
* @param properties vector of ICalProperty's to print
* @param dateFmt Formatting string to pass to property
* @param retVal output string
*
* @return static UnicodeString
*/
static UnicodeString & propertyVectorToString(JulianPtrArray * properties,
UnicodeString & dateFmt, UnicodeString & retVal);
#if 0
/**
* Given a property name, a parameter name and parameter value,
* make sure that the parameter name is valid for the property.
* Doesn't do anything for the ATTENDEE, FREEBUSY, Recurrence-ID special
* properties.
* @param propName property name
* @param paramName parameter name
* @param paramVal parameter value
*
* @return TRUE if parameter name is valid for property, FALSE otherwise
*/
static t_bool checkParam(UnicodeString & propName, UnicodeString & paramName,
UnicodeString & paramVal);
#endif
/**
* Given a vector of ICalParameters, an array of valid parameter names,
* and the size of array, return TRUE if all parameters are in the range,
* otherwise return FALSE.
* @param parameters vector of ICalParameter's
* @param validParamNameRange[] array of valid parameter name atoms
* @param validParamNameRangeSize size of validParamNameRange[]
*
* @return TRUE if all parameters in range, FALSE otherwise.
*/
static t_bool CheckParams(JulianPtrArray * parameters,
JAtom validParamNameRange[],
t_int32 validParamNameRangeSize);
/**
* 7-23-98: TODO: eliminate passing in validValueRange and validValueRangeSize
* now checks for VALUE, ENCOIDNG, RELTYPE values.
* TODO: check RELATED
* given a vector of ICalParameters, an array of valid parameter names,
* and the size of array, an array of valid parameter values for the valueParamName
* type(usually VALUE, but can be RELTYPE),
* return TRUE if all parameters are in the range and the VALUE parameter value
* is in the validValueRange. Otherwise return FALSE;
* @param parameters vector of ICalParameter's
* @param validParamNameRange[] array of valid parameter name atoms
* @param validParamNameRangeSize size of validParamNameRange[]
* @param validValueRange[] array of valid parameter value atoms
* @param validValueRangeSize size of validValudRange[]
*
* @return TRUE if all parameter name and value in range, FALSE otherwise
*/
static t_bool CheckParamsWithValueRangeCheck(JulianPtrArray * parameters,
JAtom validParamNameRange[],
t_int32 validParamNameRangeSize,
JAtom validValueRange[],
t_int32 validValueRangeSize);
/**
* Parse a line of iCal input and return output into outName, outVal,
* and fill in parameters vector with parsed parameters of line.
* @param aLine input iCal line
* @param outName output property name
* @param outVal output property value
* @param parameters fill-in vector of parameters
*/
static void parsePropertyLine(UnicodeString & aLine,
UnicodeString & outName, UnicodeString & outVal,
JulianPtrArray * parameters);
/**
* Trims UnicodeStrings. The UnicodeString::trim() method
* seems to only trim space-separators(ASCII 12 and ' ').
* This method also trims line-seperators(ASCII 13).
* @param string to trim.
*
* @return trimmed string in s
*/
static UnicodeString & Trim(UnicodeString & s);
/**
* Cleanup method. Deletes each ICalParameter object in vector.
* Doesn't delete actual vector though.
* @param parameters vector of ICalParameter objects
*
*/
static void deleteICalParameterVector(JulianPtrArray * parameters);
/**
* Cleanup method. Deletes each ICalProperty object in vector.
* Doesn't delete actual vector though.
* @param parameters vector of ICalProperty objects
*
*/static void deleteICalPropertyVector(JulianPtrArray * properties);
/**
* Cleanup method. Deletes each Period object in vector.
* Doesn't delete actual vector though.
* @param parameters vector of Period objects
*
*/
static void deletePeriodVector(JulianPtrArray * periods);
static UnicodeString & multiLineFormat(UnicodeString & s);
static t_bool IsXToken(UnicodeString & s);
/**
* Fills out vector with the clone of each ICalProperty in
* the propertiesToClone vector.
* @param propertiesToClone vector of properties to clone
* @param out output vector of clones
* @param initLog log file for clones to write to
*
*/
static void CloneICalPropertyVector(JulianPtrArray * propertiesToClone, JulianPtrArray * out,
JLog * initLog);
/**
* Fills out vector with the clone of each UnicodeString in
* the stringsToClone vector.
* @param stringsToClone vector of strings to clone
* @param out output vector of clones of strings
*
*/
static void CloneUnicodeStringVector(JulianPtrArray * stringsToClone, JulianPtrArray * out);
};
#endif /* __ICALPROPERTY_H_ */

Просмотреть файл

@ -1,67 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* prprtyfy.h
* John Sun
* 2/12/98 5:17:48 PM
*/
#include "prprty.h"
#ifndef __ICALPROPERTYFACTORY_H_
#define __ICALPROPERTYFACTORY_H_
/**
* ICalPropertyFactory is a factory class that creates
* ICalProperty instances.
*
* @see ICalProperty
*/
class ICalPropertyFactory
{
private:
/**
* Hide default constructor from use.
*/
ICalPropertyFactory();
public:
/**
* Factory method that creates ICalProperty objects.
* Clients should call this method to create ICalProperty
* objects. Clients are responsible for de-allocating returned
* object.
*
* @param aType the type of ICALProperty
* @param value the initial value of the property
* @param parameters the initial parameters of the property
*
* @return ptr to the newly created ICalProperty object
* @see ICalProperty
*/
static ICalProperty * Make(ICalProperty::PropertyTypes aType,
void * value, JulianPtrArray * parameters);
};
#endif /* __ICALPROPERTYFACTORY_H_ */

Просмотреть файл

@ -1,530 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* rcrrence.h
* John Sun
* 2/2/98 10:45:13 AM
*/
#ifndef __RECURRENCE_H_
#define __RECURRENCE_H_
#include "datetime.h"
#include "duration.h"
#include "rrday.h"
#include "ptrarray.h"
#include "jutility.h"
#include "dategntr.h"
#include "bymgntr.h"
#include "byhgntr.h"
#include "bywngntr.h"
#include "byydgntr.h"
#include "bymogntr.h"
#include "bymdgntr.h"
#include "bydygntr.h"
#include "bydwgntr.h"
#include "bydmgntr.h"
#include "deftgntr.h"
#include "jlog.h"
//#define JULIAN_DEBUGGING_RECURRENCE 1
class Recurrence
{
public:
/* moved the Recurrence Type constants to nsCalUtility. */
#if 0
/**
* Creates a Recurrence object specified by the given string.
*
* @param startDate the start time of the first recurrence
* @param stopDate the end time of the first recurrence
* @param duration the time between start and stopdate
* @param ruleString the recurrence rule string to parse
*/
Recurrence(DateTime startDate, DateTime stopDate, nsCalDuration * duration,
UnicodeString & ruleString);
/**
* Creates a Recurrence object specified by the given string.
*
* @param startDate the start time of the first recurrence
* @param duration the time between start and stopdate
* @param ruleString the recurrence rule string to parse
*/
Recurrence(DateTime startDate, nsCalDuration * duration, UnicodeString & ruleString);
#endif
/**
* Creates a Recurrence object specified by the given string.
*
* @param startDate the start time of the first recurrence
* @param ruleString the recurrence rule string to parse
*/
Recurrence(DateTime startDate, UnicodeString & ruleString);
/**
* Destructor
*/
~Recurrence();
/**
* Checks if recurrence rule is valid. Validity is checked during parsing.
*
* @return TRUE if valid rule, FALSE otherwise
*/
t_bool isValid() const;
/*static void toPatternOut(JulianPtrArray * srr, JulianPtrArray * ser,
JulianPtrArray * srd, JulianPtrArray * sed);*/
/**
* The same functionality as enforce except it works with a vector of strings.
* @param startDate start time of recurrence
* @param srr vector of RRULE strings
* @param ser vector of EXRULE strings
* @param srd vector of RDATE strings
* @param sed vector of EXDATE strings
* @param bound number of dates to be produced
* @param out vector containing generated dates
*
*/
static void stringEnforce(DateTime startDate, JulianPtrArray * srr,
JulianPtrArray * ser, JulianPtrArray * srd, JulianPtrArray * sed,
t_int32 bound, JulianPtrArray * out, JLog * log);
/**
* The enforce method handles two lists of recurrences which specifies rules for defining
* occurrence dates and rules for defining exclusion dates. The method appropriately
* generates all the dates and returns a list with all excluded dates removed.
*
* A fearful function that forcefully fathoms the fullness of a few recurrences.
*
* @param rr a vector of recurrence rules (Recurrence objects)
* @param er a vector of exclusion rules (Recurrence objects)
* @param rd a vector of explicit recurrence dates (DateTime objects)
* @param ed a vector of explicit exclusion dates (DateTime objects)
* @param bound number of dates to be produced
*/
static void enforce(JulianPtrArray * rr, JulianPtrArray * er, JulianPtrArray * rd,
JulianPtrArray * ed, t_int32 bound, JulianPtrArray * out, JLog * log);
/**
* Unzips a recurrence rule (i.e., produces a set of dates which the recurrence represents) to a certain
* number of dates inside of a given timezone.
*
* @param bound the number of dates to produce
* @param out vector containing generated dates
* @param bAddStartDate always adds first date to out vector
*/
void unzip(t_int32 bound, JulianPtrArray * out, JLog * log, t_bool
bAddStartDate = TRUE);
/**
* Converts iCal Recurrence Day string to Calendar::EDaysOfWeek value
* @param s recurrence day string
* @param error output if bad day value
*
* @return the Calendar::EDaysOfWeek value of s
*/
static t_int32 stringToDay(UnicodeString & s, t_bool & error);
/* index into m_GntrVctr of appropriate generator */
static const t_int32 ms_iByMinuteGntrIndex;
static const t_int32 ms_iByHourGntrIndex;
static const t_int32 ms_iByWeekNoGntrIndex;
static const t_int32 ms_iByYearDayGntrIndex;
static const t_int32 ms_iByMonthGntrIndex;
static const t_int32 ms_iByMonthDayGntrIndex;
static const t_int32 ms_iByDayYearlyGntrIndex;
static const t_int32 ms_iByDayMonthlyGntrIndex;
static const t_int32 ms_iByDayWeeklyGntrIndex;
static const t_int32 ms_iDefaultGntrIndex;
static const t_int32 ms_iGntrSize;
private:
/* Hide default constructor */
Recurrence();
/* The ordering of this array represents the recursive structure through which dates
* will be determined. the first array contains tags which operate over a year, the
* second those which operate over a month, the third a week, etc.
*/
static const t_int32 * ms_aaiGenOrder[];
/* Generator order of each span. There are six spans. */
static const t_int32 ms_aiGenOrderZero[];
static const t_int32 ms_aiGenOrderOne[];
static const t_int32 ms_aiGenOrderTwo[];
static const t_int32 ms_aiGenOrderThree[];
static const t_int32 ms_aiGenOrderFour[];
static const t_int32 ms_aiGenOrderFive[];
/* length of each generator order array */
static const t_int32 ms_GenOrderLen;
static const t_int32 ms_GenOrderZeroLen;
static const t_int32 ms_GenOrderOneLen;
static const t_int32 ms_GenOrderTwoLen;
static const t_int32 ms_GenOrderThreeLen;
static const t_int32 ms_GenOrderFourLen;
static const t_int32 ms_GenOrderFiveLen;
/*-----------------------------
** MEMBERS
**---------------------------*/
/** variable to specify unset value */
static const t_int32 ms_iUNSET;
/* Variables that correspond directly to properties defined in the spec */
t_int32 m_iType; /* init to nsCalUtility::RT_NONE */
nsCalDuration * m_Interval; /* init to NULL */
t_int32 m_iCount; /* init to ms_iUNSET */
t_int32 m_iWkSt; /* init to Calendar::MONDAY */
DateTime m_Until; /* init to Invalid DateTime */
/* ByDay contains an array of day, integer pairs. days are specified from the standard Java
calendar object, IE, Calendar.MONDAY. the integer specifies the nth instance of that day
of the week. if all instances are specified (ie, BYDAY=FR), then the integer value is
left to zero. */
RRDay * m_aaiByDay;
/* ptr to parameters for each generator */
t_int32 * m_aiByMinute;
t_int32 * m_aiByHour;
t_int32 * m_aiByMonthDay;
t_int32 * m_aiByYearDay;
t_int32 * m_aiBySetPos;
t_int32 * m_aiByWeekNo;
t_int32 * m_aiByMonth;
/* the bysetpos length */
t_int32 m_iBySetPosLen;
/* vector of generators, order is extremely important! */
JulianPtrArray * m_GntrVctr;
/* Individual GENERATORS */
ByMinuteGenerator * ms_ByMinuteGntr;
ByHourGenerator * ms_ByHourGntr;
ByWeekNoGenerator * ms_ByWeekNoGntr;
ByYearDayGenerator * ms_ByYearDayGntr;
ByMonthGenerator * ms_ByMonthGntr;
ByMonthDayGenerator * ms_ByMonthDayGntr;
ByDayYearlyGenerator * ms_ByDayYearlyGntr;
ByDayMonthlyGenerator * ms_ByDayMonthlyGntr;
ByDayWeeklyGenerator * ms_ByDayWeeklyGntr;
DefaultGenerator * ms_DefaultGntr;
/* Number of active generators */
t_int32 m_iActiveGenerators; /* init to 0 */
/* Variables for storing DTSTART, DTEND and DURATION */
DateTime m_StartDate;
DateTime m_StopDate;
nsCalDuration * m_Duration; /* init to NULL */
/* cache validity */
t_bool m_bParseValid;
/*-----------------------------
** METHODS
**---------------------------*/
/* initializes data */
void init();
/**
* Helper method. Breaks recurrence rule strings into parameters
* and fills parameters vector with parameters.
* @param strLine recurrence rule string
* @param parameters vector to fill in with recurrence parameters
*
*/
void parsePropertyLine(UnicodeString & strLine, JulianPtrArray * parameters);
/**
* Parses Recurrence rule string, populates data members, generators'
* parameters. Returns TRUE if recurrence parse went OK, FALSE
* if there was a failure. A failure sets m_bParseValid to FALSE.
* @param s recurrence rule string
*
* @return TRUE if rule is valid, FALSE otherwise
*/
t_bool parse(UnicodeString & s);
/**
* Cleanup method takes vector of dates and make sure output number
* in less than length and start value is included.
* If bAddStartDate = TRUE, always add the start date to the out
* vector, otherwise don't add the start date to the out vector.
* @param vDatesIn input vector of dates
* @param length number of dates to be produced
* @param out output vector of dates
* @param bAddStartDate TRUE = adds first date to out vector
*
*/
void cleanup(JulianPtrArray * vDatesIn, t_int32 length,
JulianPtrArray * out, t_bool bAddStartDate);
/**
* Sets interval to i, depending on m_iType. For example,
* if m_iType is set to nsCalUtility::RT_YEARLY and i is 2,
* then the interval is every 2 years.
* @param i value of interval w/respect to m_iType
*/
void internalSetInterval(t_int32 i);
/**
* Used for resetting a date value that is floating somewhere in an
* interval, to the beginning of that interval. Depends upon the
* initial date, the recurrence interval type, the week start date, and
* the state of other active generators.
*
* Example: type = MONTHLY, s = Jul 15, 1997 10:15 PM PDT
* resets to Jul 1, 1997 10:15 PM PDT
* if the BYHOUR and BYMINUTE tags are active it
* will further be clocked back to
* Jul 1, 1997 12:00 AM PDT
* @param t date value to reset
* @param type current interval type
* @param wkSt week start value
*
*/
void reset(DateTime & t, t_int32 type, t_int32 wkSt);
/**
* Removes dates in vDates that do not follow BYSETPOS rule.
* Usually, this involves deleting almost every date except 1
* from vDates.
* @param vDates vector of dates.
*
*/
void handleSetPos(JulianPtrArray * vDates);
/*-----------------------------
** STATIC METHODS
**---------------------------*/
/**
* Tokenizes string with delimeters and puts tokens in vectorToFillIn
* @param s string to tokenize
* @param strDelim string delimeters
* @param vectorToFillIn output vector of tokens to fill in
*
*/
static void parseDelimited(UnicodeString & s, UnicodeString & strDelim,
JulianPtrArray * vectorToFillIn);
/**
* Verifies that each element in v is within the bounds of
* [lowerBound,upperBound) (inclusive). If bZero is TRUE, then
* 0 is NOT a valid value, otherwise 0 is a valid value. If
* there is an error, log the error message and set bParseError
* to TRUE. Each valid element is added to the output list.
* The return size of the list is retSize
* @param v vector of string element
* @param lowerBound lowerbound of valid range
* @param upperBound upperbound of valid range
* @param error log error message
* @param retSize output size of parameter list
* @param bParseError output parse error boolean
* @param bZero TRUE is 0 OK, FALSE if 0 not OK
*
* @return ptr to t_int32 (list of gntr parameter elements)
*/
static t_int32 * verifyIntList(JulianPtrArray * v, t_int32 lowerBound,
t_int32 upperBound, UnicodeString & error, t_int32 & retSize,
t_bool & bParseError, t_bool bZero = FALSE);
/**
* Verifies that each element in v is a valid day element.
* A day element is of form (-5MO) where the last two letters
* must be a recurrence day string with a optional modifier in front.
* Depending of the type variable the modifier can be
* from -53 to 53 for type=RT_YEARLY and -5 to 5 for type=RT_MONTHLY.
* Each valid element is added to the output RRDay list.
* The return size of the list is retSize.
* @param v vector of string elements
* @param type interval type
* @param retSize output size of RRDay list
* @param bParseError output parse error boolean
*
* @return ptr to RRDay * (list of RRDay objects)
*/
static RRDay * createByDayList(JulianPtrArray * v, t_int32 type,
t_int32 & retSize, t_bool & bParseError);
/**
* Helper method gets the day and modifier from the string in.
* @param in string to get day, modifier from
* @param day output Calendar::EDaysOfWeek
* @param modifier output day modifier
* @param bParseError output parse error boolean
*
*/
static void createByDayListHelper(UnicodeString & in, t_int32 & day,
t_int32 & modifier, t_bool & bParseError);
/**
* Cleanup vector of UnicodeString objects. Delete each UnicodeString
* in vector.
* @param strings vector of elements to delete from
*/
static void deleteUnicodeStringVector(JulianPtrArray * strings);
public:
/**
* Cleanup vector of DateTime objects. Delete each DateTime in vector.
* @param strings vector of elements to delete from
*/
static void deleteDateTimeVector(JulianPtrArray * datetimes);
/**
* Cleanup vector of Recurrence objects. Delete each Recurrence
* in vector
* @param strings vector of elements to delete from
*/
static void deleteRecurrenceVector(JulianPtrArray * recurrences);
private:
/**
* Cleanup vector of vector of DateTime objects. Delete each
* DateTime in each vector in vector
* @param strings vector of elements to delete from
*/
static void deleteDateTimeVectorVector(JulianPtrArray * vDatetimes);
/**
* Cleanup vector of ICalParameter objects. Delete each ICalParameter
* from vector.
* @param strings vector of elements to delete from
*/
static void deleteICalParameterVector(JulianPtrArray * parameters);
#if 0
static void copyDateTimesInto(JulianPtrArray * from, DateTime * to);
#endif
/**
* Converts frequency string (i.e. YEARLY, WEEKLY, DAILY, etc.)
* to Recurrence type constant.
* @param s input iCal frequency string
* @param bParseError output parse error boolean
*
* @return output recurrence type
*/
static t_int32 stringToType(UnicodeString & s, t_bool & bParseError);
/**
* Gets the length of the Generator Order Array given an index
* to the array
* @param genOrderIndex index in to generator order array
*
* @return length of m_GntrVctr[genOrderIndex]
*/
static t_int32 getGenOrderIndexLength(t_int32 genOrderIndex);
/**
* Concatentates a vector of vector of dates into a vector of dates.
* @param vvIn input vector of vector of dates
* @param vOut output vector of dates with vvIn's dates added in
*
*/
static void concat(JulianPtrArray * vvIn, JulianPtrArray * vOut);
/**
* Replaces the contents of vOut with the contents of vvIn
* @param vvIn input vector of vector of dates
* @param vOut output vector of dates with vvIn's dates replacing old dates
*
* @return static void
*/
static void replace(JulianPtrArray * vvIn, JulianPtrArray * vOut);
/**
* Removes dates in vDatesOut that are not in vDatesIn.
* @param vDatesOut output vector of dates that are also in vDatesIn
* @param vDatesIn input vector of dates
*
*/
static void intersectOutList(JulianPtrArray * vDatesOut, JulianPtrArray * vDatesIn);
/**
* Subtract or intersects date lists. If subtract is TRUE, then
* subtract lists vvDates[1..n] from vvDates[0]. If intersects mode
* intersect lists vvDates[0...n]. Resulting dates vector goes into
* out.
*
* @param vvDates vector of vector of dates
* @param subtract subtract = TRUE or intersect = FALSE mode
* @param out output resulting dates vector
*
*/
static void intersectDateList(JulianPtrArray * vvDates, t_bool subtract,
JulianPtrArray * out);
/**
* Checks whether datetimes vector contains date. To contain date
* means containing a date with the same year, month, day, hour, minute and second.
* It does not have to have the same millesecond value.
* @param datetimes vector of dates to check for date
* @param date target date to look for
*
* @return TRUE if date is in datetimes, FALSE otherwise.
*/
static t_bool contains(JulianPtrArray * datetimes, DateTime * date);
/**
* Eliminates duplicate datetime object from datetimes
* @param datetimes vector to remove duplicates from
*
*/
static void eliminateDuplicates(JulianPtrArray * datetimes);
#if JULIAN_DEBUGGING_RECURRENCE
/**
* DEBUGGING method to print out datetime elements in a vector
* @param x datetime vector
* @param name debug name of vector
*
*/
static void TRACE_DATETIMEVECTOR(JulianPtrArray * x, char * name);
/**
* DEBUGGING method to print out elements in a vector of vector of datetimes
* @param x vector of vector of datetimes
* @param name debug name of vector
*
*/
static void TRACE_DATETIMEVECTORVECTOR(JulianPtrArray * x, char * name);
#endif
};
#endif /* __RECURRENCE_H_ */

Просмотреть файл

@ -1,242 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* recid.h
* John Sun
* 3/20/98 5:08:46 PM
*/
#ifndef __RECURRENCEID_H_
#define __RECURRENCEID_H_
#include <unistring.h>
#include "datetime.h"
#include "prprty.h"
#include "jlog.h"
/**
* nsCalRecurrenceID implements the RecurrenceID property. The RecurrenceID
* must have a DateTime value. It can optionally have a RANGE value set to
* THISANDPRIOR or THISANDFUTURE. A RecurrenceID without a RANGE has its
* range value set to NONE.
* The nsCalRecurrenceID must implement the ICalProperty interface.
*
* @see ICalProperty
*/
class nsCalRecurrenceID : public ICalProperty
{
public:
/** an enumeration of the RANGE parameter */
enum RANGE{RANGE_NONE = 0, RANGE_THISANDPRIOR = 1, RANGE_THISANDFUTURE = 2};
private:
/*-----------------------------
** MEMBERS
**---------------------------*/
/** range parameter value */
nsCalRecurrenceID::RANGE m_Range;
/** datetime value */
DateTime m_DateTime;
/** log to write errors to */
JLog * m_Log;
/*-----------------------------
** PRIVATE METHODS
**---------------------------*/
/**
* Sets parameter with name paramName with value paramVal.
* @param paramName parameter name to set
* @param paramVal new value of parameter
*
*/
void setParam(UnicodeString & paramName, UnicodeString & paramVal);
#if 0
/* hide constructor from clients */
nsCalRecurrenceID();
#endif
/**
* Copy constructor.
* @param that nsCalRecurrenceID to copy
*/
nsCalRecurrenceID(nsCalRecurrenceID & that);
public:
/*-----------------------------
** CONSTRUCTORS and DESTRUCTORS
**---------------------------*/
/**
* Constructor. Create a RecurrenceID with log set to initLog
* @param initLog log file to write errors to
*/
nsCalRecurrenceID(JLog * initLog = 0);
/**
* Constructor. Create a RecurrenceID with log set to initLog
* @param datetime initial DateTime value
* @param initLog log file to write errors to
* @param range initial RANGE value
*/
nsCalRecurrenceID(DateTime datetime, JLog * initLog, RANGE range = RANGE_NONE);
/**
* Destructor
*/
~nsCalRecurrenceID();
/*-----------------------------
** ACCESSORS (GET AND SET)
**---------------------------*/
/**
* Returns RANGE value.
*
* @return current RANGE value
*/
nsCalRecurrenceID::RANGE getRange() const { return m_Range; }
/**
* Sets RANGE value
* @param range new range value
*
*/
void setRange(nsCalRecurrenceID::RANGE range) { m_Range = range; }
/**
* Sets DateTime value.
* @param d new DateTime value
*
*/
void setDateTime(DateTime d) { m_DateTime = d; }
/**
* Returns DateTime value
*
* @return current DateTime value
*/
DateTime getDateTime() { return m_DateTime; }
/*---------- To satisfy ICalProperty interface ----------*/
/**
* Sets parameters.
* @param parameters vector of parameters to set
*
*/
virtual void setParameters(JulianPtrArray * parameters);
/**
* Return value of property. Never use. Use getDateTime().
*
* @return value of property
*/
virtual void * getValue() const;
/**
* Sets value of property. Never use. Use setDateTime().
* @param value new value of property
*
*/
virtual void setValue(void * value);
/**
* Returns a clone of this property.
* @param initLog the log file for clone to write to
*
* @return clone of this ICalProperty object
*/
virtual ICalProperty * clone(JLog * initLog);
/**
* Checks whether this property is valid or not. DateTime value
* must be valid in order to be TRUE.
*
* @return TRUE if property is valid, FALSE otherwise
*/
virtual t_bool isValid();
/**
* Return property to human-readable string.
* @param dateFmt formatting string
* @param out output human-readable string
*
* @return output human-readable string (out)
*/
virtual UnicodeString & toString(UnicodeString & strFmt, UnicodeString & out);
/**
* Return property to human-readable string.
* @param out output human-readable string
*
* @return output human-readable string (out)
*/
virtual UnicodeString & toString(UnicodeString & out);
/**
* Return property to iCal property string.
* @param out output iCal string
*
* @return output iCal string (out)
*/
virtual UnicodeString & toICALString(UnicodeString & out);
/**
* Return property to iCal property string. Inserts sProp to
* front of output string. sProp should be the property name of this
* property.
* @param sProp property name to append to insert at front of out
* @param out output iCal string with sProp in front
*
* @return output iCal string with sProp in front (out)
*/
virtual UnicodeString & toICALString(UnicodeString & sProp, UnicodeString & out);
/*----------End of ICalProperty interface----------*/
/*-----------------------------
** STATIC METHODS
**---------------------------*/
/**
* Converts string to RANGE enumeration. Returns NONE if error.
* @param sRange range string
*
* @return RANGE enumeration value of sRange
*/
static nsCalRecurrenceID::RANGE stringToRange(UnicodeString & sRange);
/**
* Converts RANGE to string. Returns "" for NONE.
* @param range RANGE value
* @param out output range string
*
* @return output range string
*/
static UnicodeString & rangeToString(nsCalRecurrenceID::RANGE range, UnicodeString & out);
};
#endif /* __RECURRENCEID_H_ */

Просмотреть файл

@ -1,94 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* rrday.h
* John Sun
* 2/4/98 7:54:41 PM
*/
#ifndef __RRDAY_H_
#define __RRDAY_H_
#include <assert.h>
#include <ptypes.h>
/**
* RRDay encapsulates a day for recurrence handling
* fields[0] is the value of the day (i.e Calendar::SUNDAY, ...
* Calendar::SATURDAY). fields[1] is the number of the day.
* Thus if this is the 1st Sunday, then fields[1] = 1;
* If this is the last Sunday, then fields[1] = -1;
*/
class RRDay
{
public:
/** the fields */
t_int32 fields[2];
/** Default constructor */
RRDay();
/** Destructor */
~RRDay() {}
/**
* Constructor. Sets fields to aDay, aModifier
* @param aDay day of week value
* @param aModifier modifier
*/
RRDay(t_int32 aDay, t_int32 aModifier);
/**
* Return index into fields.
* @param index index of field to get
*
* @return value of fields[index]
*/
t_int32 operator[](t_int32 index) const;
/**
* Assignment operator.
* @param that RRDay to assign to
*/
void operator=(RRDay & that);
/**
* Equality operator.
* @param that RRDay to compare to
*
* @return TRUE if equal, FALSE otherwise.
*/
t_bool operator==(RRDay & that);
/**
* Inequality operator.
* @param that RRDay to compare to
*
* @return TRUE if NOT equal, FALSE otherwise.
*/
t_bool operator!=(RRDay & that);
};
#endif /* __RRDAY_H_ */

Просмотреть файл

@ -1,197 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* sdprprty.h
* John Sun
* 3/2/98 9:37:03 AM
*/
#include "prprty.h"
#include "icalprm.h"
#include <unistring.h>
#ifndef __STANDARDPROPERTY_H_
#define __STANDARDPROPERTY_H_
/**
* StandardProperty is an abstract class that encapsulates the similar state of the
* BooleanProperty, DateTimeProperty, DurationProperty, IntegerProperty,
* PeriodProperty, and StringProperty classes.
* This mainly includes holding the ICAL parameters in a JulianPtrArray.
* It also defines a few methods to set, get, print parameters.
*/
class StandardProperty: public ICalProperty
{
protected:
/** the parameters list of the property */
JulianPtrArray * m_vParameters;
#if 0
/** ptr to log. Don't delete it */
JLog * m_Log;
#endif
/**
* Add a parameter to the parameter list
* @param parameter parameter to add
*/
void addParameter(ICalParameter * parameter);
/**
* Constructor. Hidden from clients.
*/
StandardProperty();
/**
* Constructor. Makes copy of parameters.
* @param parameters parameter array to copy
*/
StandardProperty(JulianPtrArray * parameters);
public:
/**
* Virtual destructor deletes parameters.
*/
virtual ~StandardProperty();
/*---------------------------------------------------------------------*/
/*-- ICALPROPERTY interface --*/
/**
* Pure virtual method. Return the value of the property
* @return void * ptr to value of the property
*/
virtual void * getValue() const { PR_ASSERT(FALSE); return 0;}
/**
* Pure virtual method. Set the value of the property
* @param value the value to set property to
*/
virtual void setValue(void * value) { PR_ASSERT(FALSE); if (value != 0) {} ; }
/**
* Pure virtual method. Returns a clone of this property.
* Clients are responsible for deleting the returned object.
*
* @return a clone of this property.
*/
virtual ICalProperty * clone(JLog * initLog) { PR_ASSERT(FALSE); if (initLog) {} return 0; }
/**
* Pure virtual method. Return TRUE if property is valid, FALSE otherwise
*
* @return TRUE if is valid, FALSE otherwise
*/
virtual t_bool isValid() { PR_ASSERT(FALSE); return FALSE; }
/**
* Pure virtual method. Return a string in human-readable form of the property.
* @param out contains output human-readable string
*
* @return the property in its human-readable string format
*/
virtual UnicodeString & toString(UnicodeString & dateFmt,
UnicodeString & out)
{ PR_ASSERT(FALSE); if (dateFmt.size() > 0) {} ; return out; }
/**
* Pure virtual method. Return a string in human-readable form of the property.
* @param dateFmt format string options
* @param out contains output human-readable string
*
* @return the property in its human-readable string format
*/
virtual UnicodeString & toString(UnicodeString & out) { PR_ASSERT(FALSE); return out; }
/*-- End of ICALPROPERTY interface --*/
/*---------------------------------------------------------------------*/
/**
* Pure virtual method. Return the property's string in the ICAL format.
* @param out contains output ICAL string
*
* @return the property in its ICAL string format
*/
virtual UnicodeString & toExportString(UnicodeString & out) { PR_ASSERT(FALSE); return out; }
/**
* Given a parameter name, return the parameter value in paramVal.
* Return a status of 1 if paramName not found in parameters array.
* @param paramName input parameter name
* @param paramVal output parameter value if found
* @param status ZERO_ERROR if OK, 1 is empty parameters, 2 is not found
*
* @return output parameter value (paramVal)
*/
UnicodeString & getParameterValue(UnicodeString & paramName, /* IN */
UnicodeString & paramVal, ErrorCode & status); /* OUT, OUT */
/*void setParameter(UnicodeString & paramName, UnicodeString & paramValue)*/
/**
* Parse a line and populate data.
* @param in line to parse.
*/
void parse(UnicodeString & in);
/**
* Copies contents of parameters into this property's parameters
* array.
* @param parameters parameters to copy
*/
void setParameters(JulianPtrArray * parameters);
/*
virtual void setParameter(UnicodeString & paramName, UnicodeString & paramValue)
{
PR_ASSERT(FALSE); if (paramName.size() > 0 && paramValue.size() > 0) {}
}
*/
/**
* Returns the property's ICAL format strings,
* to output string of the form
* :value or ;param1;param2;param3(etc.):value
* ONLY: DateTimeProperty overrides this
* (This is too handle NOT printing VALUE and TZID parameters)
*
* @param out output ICAL string
*
* @return output ICAL string (out)
*/
virtual UnicodeString & toICALString(UnicodeString & out);
/**
* Returns the property's ICAL format strings, inserting
* sProp (property name) to output string of the form
* sProp:value or sProp;param1;param2;param3(etc.):value
* ONLY: DateTimeProperty overrides this
* (This is too handle NOT printing VALUE and TZID parameters)
*
* @param sProp property name of property
* @param out output ICAL string
*
* @return output ICAL string (out)
*/
virtual UnicodeString & toICALString(UnicodeString & sProp,
UnicodeString & out);
};
#endif /* __STANDARDPROPERTY_H_ */

Просмотреть файл

@ -1,120 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* sprprty.h
* John Sun
* 2/10/98 4:53:11 PM
*/
#include <unistring.h>
#include "sdprprty.h"
#ifndef __STRINGPROPERTY_H_
#define __STRINGPROPERTY_H_
/**
* StringProperty is a subclass of StandardProperty. It implements the ICalProperty
* interface for ICAL properties with TYPE=TEXT.
*/
class StringProperty: public StandardProperty
{
private:
/** the String value of the property */
UnicodeString m_string;
/**
* Default constructor
*/
StringProperty();
/**
* Copy constructor
* @param that property to copy
*/
StringProperty(const StringProperty & that);
public:
/**
* Constructor that sets value of property to contents of value
* and makes a copy of the contents of parameters ptr.
* @param value value of property
* @param parameters parameters of property
*/
StringProperty(UnicodeString value, JulianPtrArray * parameters);
/**
* Destructor
*/
~StringProperty();
/**
* Return the value of the property
* @return void * ptr to value of the property
*/
virtual void * getValue() const;
/**
* Set the value of the property
* @param value the value to set property to
*/
virtual void setValue(void * value);
/**
* Returns a clone of this property. Clients are responsible for deleting
* the returned object.
*
* @return a clone of this property.
*/
virtual ICalProperty * clone(JLog * initLog);
/**
* Return TRUE if property is valid, FALSE otherwise
*
* @return TRUE if is valid, FALSE otherwise
*/
virtual t_bool isValid();
/**
* Return a string in human-readable form of the property.
* @param out contains output human-readable string
*
* @return the property in its human-readable string format
*/
virtual UnicodeString & toString(UnicodeString & out);
/**
* Return a string in human-readable form of the property.
* @param dateFmt format string options
* @param out contains output human-readable string
*
* @return the property in its human-readable string format
*/
virtual UnicodeString & toString(UnicodeString & dateFmt, UnicodeString & out);
/**
* Return the property's string in the ICAL format.
* @param out contains output ICAL string
*
* @return the property in its ICAL string format
*/
virtual UnicodeString & toExportString(UnicodeString & out);
};
#endif /* __STRINGPROPERTY_H_ */

Просмотреть файл

@ -1,23 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/* This is a dummy file so that we can compile our windows
** projects with precompiled headers...
**
** It must be here, but you can just ignore it.
*/

Просмотреть файл

@ -1,955 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* tmbevent.h
* John Sun
* 2/6/98 2:59:24 AM
*
* modified: 8/31/98 sman - added curl support
*/
#ifndef __TIMEBASEDEVENT_H_
#define __TIMEBASEDEVENT_H_
#include "ptrarray.h"
#include "datetime.h"
#include "attendee.h"
#include "icalredr.h"
#include "prprty.h"
#include "duration.h"
#include "jlog.h"
#include "valarm.h"
#include "julnstr.h"
#include "nscalcoreicalexp.h"
/**
* TimeBasedEvent is the superclass of VEvent, VTodo, and VJournal.
* It encapsulates the similar state between the 3 classes. This
* includes recurrence handling, Alarm handling, as well as containing
* all properties that exist in all three properties.
* NOTE: No ownership taken anymore. (always pass by value)
*/
class NS_CAL_CORE_ICAL TimeBasedEvent : public ICalComponent
{
protected:
#if 0
/**
* Default Constructor. Hide from clients.
*/
TimeBasedEvent();
#endif
/**
* Copy constructor.
* @param that TimeBasedEvent to copy.
*/
TimeBasedEvent(TimeBasedEvent & that);
public:
/*TimeBasedEvent(NSCalendar parent);*/
/**
* Returns the curl associated with this nsCalendar. The
* curl points to the calendar store where components in
* this nsCalendar are to be stored. It is required
* for an nsCalendar to have an associated curl if any
* of its components will be persisted in a calendar store.
*
* @return a JulianString containing the curl
*/
JulianString getCurl() const {return m_sCurl;}
/**
* Set the default curl for this nsCalendar.
*/
void setCurl(const char* ps) {m_sCurl = ps;}
/**
* Set the default curl for this nsCalendar.
*/
void setCurl(const JulianString& s) {m_sCurl = s;}
/**
* Constructor. Create TimeBasedEvent with initial log file set to initLog.
* @param initLog initial log file pointer
*/
TimeBasedEvent(JLog * initLog = 0);
/**
* Destructor.
*/
virtual ~TimeBasedEvent();
/**
* Pure virtual method. Calculate difference from start, end time
* For VEvent, this would be DTEnd - DTStart.
*
* @return virtual Date
*/
virtual Date difference() { PR_ASSERT(FALSE); return 0; }
/**
* set RSVP on all attendees set to TRUE
*/
/*void rsvpAll();*/
/**
* Set each attendee's status parameter to needs action (except owner)
*/
/*void needsAction();*/
/*UnicodeString getOrganizer();*/
/*UnicodeString getOwner();*/
/*UnicodeString toString(UnicodeString strFmt);*/
/* -- Start of ICALComponent interface -- */
/**
* The parse method is the standard interface for ICalComponent
* subclasses to parse from an ICalReader object
* and from the ITIP method type (i.e. PUBLISH, REQUEST, CANCEL, etc.).
* The method type can be set to \"\" if there is no method to be loaded.
* Also accepts a vector of VTimeZone objects to apply to
* the DateTime properties of the component.
* 4-2-98: Added bIgnoreBeginError. If desired to start parsing in Component level,
* it is useful to ignore first "BEGIN:". Setting bIgnoreBeginError to TRUE allows for
* this.
*
* @param brFile ICalReader to load from
* @param sType name of component (i.e. VEVENT, VTODO, VTIMEZONE)
* @param parseStatus return parse error status string (normally return "OK")
* @param vTimeZones vector of VTimeZones to apply to datetimes
* @param bIgnoreBeginError TRUE = ignore first "BEGIN:VEVENT", FALSE otherwise
* @param encoding the encoding of the stream, default is 7bit.
*
* @return parse error status string (parseStatus)
*/
virtual UnicodeString & parse(ICalReader * brFile, UnicodeString & sMethod,
UnicodeString & parseStatus, JulianPtrArray * vTimeZones = 0,
t_bool bIgnoreBeginError = FALSE, nsCalUtility::MimeEncoding encoding =
nsCalUtility::MimeEncoding_7bit)
{
PR_ASSERT(FALSE);
if (brFile != NULL && vTimeZones != NULL && sMethod.size() > 0
&& parseStatus.size() > 0 && bIgnoreBeginError && encoding > 0)
{
}
return parseStatus;
}
/**
* Returns a clone of this object
* @param initLog log file to write errors to
*
* @return clone of this object
*/
virtual ICalComponent * clone(JLog * initLog) { PR_ASSERT(FALSE); if (initLog) {} return 0; }
/**
* Return TRUE if component is valid, FALSE otherwise
*
* @return TRUE if is valid, FALSE otherwise
*/
virtual t_bool isValid();
/**
* Print all contents of ICalComponent to iCal export format.
*
* @return string containing iCal export format of ICalComponent
*/
UnicodeString toICALString();
/*UnicodeString toICALString(UnicodeString sMethod);*/
/**
* Print all contents of ICalComponent to iCal export format, depending
* on attendee name, attendee delegated-to, and where to include recurrence-id or not
*
* @param method method name (REQUEST,PUBLISH, etc.)
* @param name attendee name to filter with
* @param isRecurring TRUE = no recurrenceid, FALSE = include recurrenceid
*
* @return string containing iCal export format of ICalComponent
*/
UnicodeString toICALString(UnicodeString sMethod,
UnicodeString sName, t_bool isRecurring = FALSE);
/**
* Depending on character passed in, returns a string that represents
* the ICAL export string of that property that the character represents, if
* other paramaters not null, then print out information is filtered in several ways
* Attendee print out can be filtered so that only attendee with certain name is printed
* also, can print out the relevant attendees in a delegation message
* (ie. owner, delegate-to, delegate-from)
*
* @param c char of what property to print
* @param sFilterAttendee name of attendee to print
* @param bDelegateRequest TRUE if a delegate request, FALSE if not
* @return ICAL export format of that property
*/
virtual UnicodeString formatChar(t_int32 c, UnicodeString sFilterAttendee,
t_bool delegateRequest = FALSE);
/**
* convert a character to the content of a property in string
* human-readable format
* @param c a character represents a property
* @param dateFmt for formatting datetimes
*
* @return property in human-readable string
*/
virtual UnicodeString toStringChar(t_int32 c, UnicodeString & dateFmt);
/**
* Returns the ICAL_COMPONENT enumeration value of this ICalComponent.
* Each ICalComponent subclass must return a unique ICAL_COMPONENT value.
*
* @return ICAL_COMPONENT value of this component
*/
virtual ICAL_COMPONENT GetType() const { PR_ASSERT(FALSE); return ICAL_COMPONENT_VEVENT; }
/* OVERRIDES ICalComponent::MatchUID_seqNO */
/**
* check if this event matches the given UID and sequence number
* @return TRUE if this event matches the given UID and sequence number, FALSE otherwise
*/
virtual t_bool MatchUID_seqNO(UnicodeString uid, t_int32 iSeqNo);
/* -- Start of ICALComponent interface -- */
/**
* Pure virtual method used as wrapper to ICalComponent::format method.
* @param strFmt iCal format string
* @param sFilterAttendee attendee to filter
* @param delegateRequest delegate request = TRUE, FALSE otherwise
*
* @return output iCal formatted export string
*/
virtual UnicodeString formatHelper(UnicodeString & strFmt,
UnicodeString sFilterAttendee, t_bool delegateRequest = FALSE)
{
PR_ASSERT(FALSE);
if (strFmt.size() == 0 && sFilterAttendee.size() == 0 && delegateRequest) {}
return "";
}
/**
* Parse the TimeBasedEvent from a ICalReader object, given the component name in sType.
* Takes in a method name since, this affects whether event is valid or not.
* Also takes in vector of timezones to apply to datetimes with TZID values.
* The bIgnoreBeginError flag is used to ignore the first BEGIN:VEVENT(VTODO,VJOURNAL).
* This is useful when this method is called somewhere besides the NSCalendar::parse().
* For example, when receiving data a from CAPI, it returns events, not calendars.
* So to parse event, the first BEGIN:VEVENT should be ignored.
* If then parse terminates correctly with an END:VEVENT(VTODO, VJOURNAL) then parseStatus
* is set to OK and returned. However is an incorrect termination of parse occurs,
* then parseStatus returns the cause of the incorrect termination. An incorrect
* termination of parse can occur if the parse reaches an "END:VCALENDAR" before and
* "END:VEVENT" for example. In this case, parseStatus would return "END:VCALENDAR".
* Other incorrect termination causes are a "BEGIN:VCALENDAR", or another "BEGIN:VEVENT"
* (TODO: finish incorrect termination handling).
*
* @param sType component name (i.e. VEVENT, VTODO, VJOURNAL)
* @param brFile ICalReader object to parse from
* @param sMethod calendar method name (PUBLISH, REQUEST, etc.)
* @param parseStatus return OK if no error, otherwise an error
* @param vTimeZones vector of timezones to apply to datetimes
* @param bIgnoreBeginError if parsing just a vevent (not from an calendar, set to TRUE)
* @param encoding the encoding of the stream, default is 7bit.
*
* @return parseStatus (OK if no error, otherwise an error)
*/
UnicodeString & parseType(UnicodeString & sType, ICalReader * brFile,
UnicodeString & sMethod, UnicodeString & parseStatus, JulianPtrArray * vTimeZones,
t_bool bIgnoreBeginError = FALSE,
nsCalUtility::MimeEncoding encoding = nsCalUtility::MimeEncoding_7bit);
/**
* Prints properties of an CANCEL message, specifically
*
* @return a string with COMMENT, DTSTAMP, STATUS, STATUS=CANCELLED, SEQUENCE, UID properties
*/
virtual UnicodeString cancelMessage() { PR_ASSERT(FALSE); return ""; }
/**
* Prints properties of an REQUEST message
* @return string with request message required properties
*/
virtual UnicodeString requestMessage() { PR_ASSERT(FALSE); return ""; }
/**
* Prints properties of an REQUEST message except Recur-id
* @return string with request message required properties
*/
virtual UnicodeString requestRecurMessage() { PR_ASSERT(FALSE); return ""; }
/**
* Prints properties of an COUNTER message
* @return string with counter message required properties
*/
virtual UnicodeString counterMessage() { PR_ASSERT(FALSE); return ""; }
/**
* Prints properties of an DECLINECOUNTER message
* @return string with decline-counter message required properties
*/
virtual UnicodeString declineCounterMessage() { PR_ASSERT(FALSE); return ""; }
/**
* Prints properties of an ADD message
* @return string with add message required properties
*/
virtual UnicodeString addMessage() { PR_ASSERT(FALSE); return ""; }
/**
* Prints properties of an REFRESH message
* @param sAttendeeFilter name of requestor of refresh
* @return string with refresh message required properties
*/
virtual UnicodeString refreshMessage(UnicodeString sAttendeeFilter)
{
PR_ASSERT(FALSE);
if (sAttendeeFilter.size() > 0) {} return "";
}
/**
* Prints properties of an ALL PROPERTIES message (for debugging method)
* @return string with all properties
*/
virtual UnicodeString allMessage() { PR_ASSERT(FALSE); return ""; }
/**
* Prints properties of an REPLY message
* @param sAttendeeFilter name of replier
* @return string with reply message required properties
*/
virtual UnicodeString replyMessage(UnicodeString sAttendeeFilter)
{
PR_ASSERT(FALSE);
if (sAttendeeFilter.size() > 0) {} return "";
}
/**
* Prints properties of an PUBLISH message
* @return string with publish message required properties
*/
virtual UnicodeString publishMessage() { PR_ASSERT(FALSE); return ""; }
/**
* Prints properties of an PUBLISH message except recur-id
* @return string with publish message required properties
*/
virtual UnicodeString publishRecurMessage() { PR_ASSERT(FALSE); return ""; }
/* -- delegate methods -- */
/*
virtual UnicodeString delegateRequestMessage(UnicodeString sAttendeeFilter,
UnicodeString sDelegateTo, t_bool bRecur = FALSE);
*/
/*
{
PR_ASSERT(FALSE);
if (sAttendeeFilter.size() > 0) {return ""; }
if (sDelegateTo.size() > 0 && t_bool) {return ""; }
return "";
}
*/
/*
virtual UnicodeString delegateRequestRecurMessage(UnicodeString sAttendeeFilter,
UnicodeString sDelegateTo, t_bool bRecur)
{
PR_ASSERT(FALSE);
if (sAttendeeFilter.size() > 0) {return ""; }
return "";
}
*/
/*
virtual UnicodeString delegateReplyMessage(UnicodeString sAttendeeFilter,
UnicodeString sDelegateTo, t_bool bRecur = FALSE);
*/
/*
{
PR_ASSERT(FALSE);
if (sAttendeeFilter.size() > 0) {return ""; }
if (sDelegateTo.size() > 0 && t_bool) {return ""; }
return "";
}
*/
/*
virtual UnicodeString delegateReplyRecurMessage(UnicodeString sAttendeeFilter,
UnicodeString sDelegateTo, t_bool bRecur)
{
PR_ASSERT(FALSE);
if (sAttendeeFilter.size() > 0) {return ""; }
return "";
}
*/
#if 0
static void setDateTimeValue(ICalProperty ** dateTimePropertyPtr,
DateTime inVal, JulianPtrArray * inParameters);
static void getDateTimeValue(ICalProperty ** dateTimePropertyPtr, DateTime & outVal);
#endif
/* -- Getters and Setters -- */
/**
* Return TRUE if event is an anniversary event, FALSE otherwise.
* An anniversary event is an event that does not represent a
* scheduled amount of time, but more of a daily reminder.
* During parsing, this is set when the VALUE=DATE is parsed
* on the DTSTART property. An anniversary event can span multiple
* days. See spec for better definition.
*
* @return TRUE if anniversary event, FALSE otherwise
*/
t_bool isAllDayEvent() { return m_bAllDayEvent; }
void setAllDayEvent(t_bool b) { m_bAllDayEvent = b; }
/* --- Getters and Setters ---*/
/* LAST-MODIFIED */
DateTime getLastModified() const;
void setLastModified(DateTime s, JulianPtrArray * parameters = 0);
ICalProperty * getLastModifiedProperty() const { return m_LastModified; }
/* CREATED */
DateTime getCreated() const;
void setCreated(DateTime s, JulianPtrArray * parameters = 0);
ICalProperty * getCreatedProperty() const { return m_Created; }
/* DTSTAMP */
DateTime getDTStamp() const;
void setDTStamp(DateTime s, JulianPtrArray * parameters = 0);
ICalProperty * getDTStampProperty() const { return m_DTStamp; }
/* DTSTART */
DateTime getDTStart() const;
void setDTStart(DateTime s, JulianPtrArray * parameters = 0);
ICalProperty * getDTStartProperty() const { return m_DTStart; }
/* DESCRIPTION */
UnicodeString getDescription() const;
void setDescription(UnicodeString s, JulianPtrArray * parameters = 0);
ICalProperty * getDescriptionProperty() const { return m_Description; }
/* URL */
UnicodeString getURL() const;
void setURL(UnicodeString s, JulianPtrArray * parameters = 0);
ICalProperty * getURLProperty() const { return m_URL; }
/* SUMMARY */
UnicodeString getSummary() const;
void setSummary(UnicodeString s, JulianPtrArray * parameters = 0);
ICalProperty * getSummaryProperty() const { return m_Summary; }
/* CLASS */
UnicodeString getClass() const;
void setClass(UnicodeString s, JulianPtrArray * parameters = 0);
ICalProperty * getClassProperty() const { return m_Class; }
/* STATUS */
UnicodeString getStatus() const;
void setStatus(UnicodeString s, JulianPtrArray * parameters = 0);
ICalProperty * getStatusProperty() const { return m_Status; }
/* REQUESTSTATUS */
/* UnicodeString getRequestStatus() const;
void setRequestStatus(UnicodeString s, JulianPtrArray * parameters = 0);
ICalProperty * getRequestStatusProperty() const { return m_RequestStatus; }*/
void addRequestStatus(UnicodeString s, JulianPtrArray * parameters = 0);
void addRequestStatusProperty(ICalProperty * prop);
JulianPtrArray * getRequestStatus() const { return m_RequestStatusVctr; }
/* UID */
virtual UnicodeString getUID() const;
void setUID(UnicodeString s, JulianPtrArray * parameters = 0);
ICalProperty * getUIDProperty() const { return m_UID; }
/* SEQUENCE */
virtual t_int32 getSequence() const;
void setSequence(t_int32 i, JulianPtrArray * parameters = 0);
ICalProperty * getSequenceProperty() const { return m_Sequence; }
/* COMMENT */
void addComment(UnicodeString s, JulianPtrArray * parameters = 0);
void addCommentProperty(ICalProperty * prop);
JulianPtrArray * getComment() const { return m_CommentVctr; }
/* remove all previous comments, then adds new comment s */
void setNewComments(UnicodeString s);
/* ATTACH */
void addAttach(UnicodeString s, JulianPtrArray * parameters = 0);
void addAttachProperty(ICalProperty * prop);
JulianPtrArray * getAttach() const { return m_AttachVctr; }
/* RELATED-TO (not a vector anymore, now just a property) */
void addRelatedTo(UnicodeString s, JulianPtrArray * parameters = 0);
void addRelatedToProperty(ICalProperty * prop);
JulianPtrArray * getRelatedTo() const { return m_RelatedToVctr; }
/* CONTACT */
void addContact(UnicodeString s, JulianPtrArray * parameters = 0);
void addContactProperty(ICalProperty * prop);
JulianPtrArray * getContact() const { return m_ContactVctr; }
/* RDATE */
void addRDate(UnicodeString s, JulianPtrArray * parameters = 0);
void addRDateProperty(ICalProperty * prop);
JulianPtrArray * getRDates() const { return m_RDateVctr; }
/* EXDATE */
void addExDate(UnicodeString s, JulianPtrArray * parameters = 0);
void addExDateProperty(ICalProperty * prop);
JulianPtrArray * getExDates() const { return m_ExDateVctr; }
/* CATEGORIES */
void addCategories(UnicodeString s, JulianPtrArray * parameters = 0);
void addCategoriesProperty(ICalProperty * prop);
JulianPtrArray * getCategories() const { return m_CategoriesVctr; }
void addCategoriesPropertyVector(UnicodeString & propVal, JulianPtrArray * parameters);
/* ORGANIZER */
UnicodeString getOrganizer() const;
void setOrganizer(UnicodeString s, JulianPtrArray * parameters = 0);
ICalProperty * getOrganizerProperty() const { return m_Organizer; }
/* RECURRENCEID */
ICalProperty * getRecurrenceIDProperty() const { return m_RecurrenceID; }
void setRecurrenceID(DateTime d, JulianPtrArray * parameters = 0);
DateTime getRecurrenceID() const;
/* XTOKENS: NOTE: a vector of strings, not a vector of ICalProperties */
void addXTokens(UnicodeString s);
JulianPtrArray * getXTokens() const { return m_XTokensVctr; }
/* EXRULE: NOTE: a vector of strings, not a vector of ICalProperties */
void addExRuleString(UnicodeString s);
JulianPtrArray * getExRules() const { return m_ExRuleVctr; }
/* RRULE: NOTE: a vector of strings, not a vector of ICalProperties */
void addRRuleString(UnicodeString s);
JulianPtrArray * getRRules() const { return m_RRuleVctr; }
/* ATTENDEE */
void addAttendee(Attendee * a);
JulianPtrArray * getAttendees() const { return m_AttendeesVctr ; }
/*---------------------------------------------------------------------*/
/* ALARMS */
JulianPtrArray * getAlarms() const { return m_AlarmsVctr ; }
void addAlarm(VAlarm * a);
/* ORIGSTART */
void setOrigStart(DateTime d) { m_origDTStart = d; }
DateTime getOrigStart() { return m_origDTStart; }
/* MYORIGSTART */
void setMyOrigStart(DateTime d) { m_origMyDTStart = d; }
DateTime getMyOrigStart() { return m_origMyDTStart; }
/* METHOD */
void setMethod(UnicodeString & s);
UnicodeString & getMethod() { return m_sMethod; }
/* BOUND */
t_int32 getBound() const { return ms_iBound; }
void setBound(t_int32 i) { ms_iBound = i; }
/**
* Set DTStamp to current date time.
*/
void stamp();
/**
* Return the Attendee in attendee vector with name equal
* to sAttendee. Return 0 if no attendee with that name.
* @param sAttendee name of attendee
*
* @return Attendee whose name is sAttendee, 0 if not found
*/
Attendee * getAttendee(UnicodeString sAttendee);
/**
* Checks is this component is expandable. An expandable component
* is a component that has something in the RRULE or RDATE vector
* and does NOT have a RecurrenceID.
*
* @return TRUE if is expandable component, FALSE otherwise.
*/
t_bool isExpandableEvent() const;
/**
* Helper method. Pure virtual method. Used by subclasses to
* populate recurrence-dependent data. For example, a recurring
* VEvent needs to have DTEnd calculated from recurring
* DTStart. VEvent will overwrite method set DTEnd correctly.
* Abstract difference() method is used to calculate ldiff.
* Need to pass vector of RDate periods in case end value must
* be adjusted in RDATE is a PERIOD value.
* @param start recurrence instance starting time
* @param ldiff abstract difference value
* @param vPer vector of RDate periods
*/
virtual void populateDatesHelper(DateTime start, Date ldiff, JulianPtrArray * vPer)
{
PR_ASSERT(FALSE); if(start.getTime() > ldiff && vPer) {}
}
/**
* takes the vector of rrule, rdate, exrule, and exdates, dtstart,
* and bound and returns a vector of generated recurrence events in vOut.
* Does this in two parts
* The first part generates a vector of DateTimes that represent
* the dates of the recurrence.
* The second part takes these dates and creates an event with them.
* @param vOut fill-in vector with generated recurrence events
* @param vTimeZones vector of timezones
*/
void createRecurrenceEvents(JulianPtrArray * vOut,
JulianPtrArray * vTimeZones);
/*
void addDelegate(UnicodeString & sAttendeeFilter,
UnicodeString & sDelegateTo);
*/
/**
* Sets Attendee with the name sAttendeeFilter to status.
* If the status is Delegated, then adds each element in delegatedTo
* to the delegatedTo vector of that attendee.
* If that attendee does not exist in the attendee list, then add
* a new Attendee to the attendee list with his/her PARTSTAT set to status.
* @param sAttendeeFilter attendee to set status on
* @param status status to set
* @param delegatedTo vector of delegatedTo names to set to
*/
void setAttendeeStatus(UnicodeString & sAttendeeFilter, Attendee::STATUS status,
JulianPtrArray * delegatedTo = 0);
void setAttendeeStatusInt(UnicodeString & sAttendeeFilter, t_int32 status,
JulianPtrArray * delegatedTo = 0);
/**
* TODO: doesn't do smart overriding for now, does simple overwrite
* Updates this component with the data from the updatedComponent.
* This method must be overridden by subclasses.
* If updatedComponent is older that current compoenent, don't update current component
* How:
* make sure (UID, RecurID) pair are same.
* if sequence number of updatedComponent if greater that this.sequence ||
* if sequence numbers are equal and update.DTSTAMP > this.DTSTAMP
* update properties
* else
* do nothing.
* Return TRUE if component was changed, FALSE otherwise
*
*/
t_bool updateComponent(ICalComponent * updatedComponent);
/**
* Helper method called by updateComponent to actually replace
* the property data-members with updatedComponent's data-members.
* @param ICalComponent * updatedComponent
*
* @return virtual void
*/
virtual void updateComponentHelper(TimeBasedEvent * updatedComponent);
/**
* Compare TimeBasedEvents by UID. Used by JulianPtrArray::QuickSort method.
* @param a first TimeBasedEvent
* @param b second TimeBasedEvent
*
* @return a.getUID().compareTo(b.getUID())
*/
static int CompareTimeBasedEventsByUID(const void * a, const void * b);
/**
* Compare TimeBasedEvents by DTSTART. Used by JulianPtrArray::QuickSort method.
* @param a first TimeBasedEvent
* @param b second TimeBasedEvent
*
* @return a.getDTSTART().compareTo(b.getDTSTART())
*/
static int CompareTimeBasedEventsByDTStart(const void * a, const void * b);
protected:
/**
* store the data, depending on property name, property value
* parameter names, parameter values, and the current line.
* subclasses should overwrite this method, but call this method
* to handle most properties. If this method returns FALSE, subclass
* then should handles specific properties of that class.
*
* @param strLine current line to process
* @param propName name of property
* @param propVal value of property
* @param parameters property's parameters
* @param vTimeZones vector of timezones
* @return TRUE if line was handled, FALSE otherwise
*/
virtual t_bool storeData(UnicodeString & strLine,
UnicodeString & propName, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
public:
typedef void (TimeBasedEvent::*SetOp) (UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
/* Clients should NOT call below methods */
void storeAttach(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeAttendees(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeCategories(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeClass(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeComment(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeContact(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeCreated(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeDescription(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeDTStart(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeDTStamp(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeExDate(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeExRule(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeLastModified(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeOrganizer(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeRDate(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeRRule(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeRecurrenceID(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeRelatedTo(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeRequestStatus(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeSequence(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeStatus(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeSummary(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeUID(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeURL(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void ApplyStoreOp(void (TimeBasedEvent::*op) (UnicodeString & strLine,
UnicodeString & propVal, JulianPtrArray * parameters, JulianPtrArray * vTimeZones),
UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones)
{
(this->*op)(strLine, propVal, parameters, vTimeZones);
}
protected:
/**
* Sets default data. Currently does following:
* 1) Sets Summary to first 60 characters of Description if Summary is empty.
* 2) Sets sequence number to 0 if sequence number is less than 0.
* 3) Sets CLASS to PUBLIC if Class is empty or out of range.
*/
virtual void selfCheck();
/*
void checkRecurrence();
virtual void checkRange();
void setDefaultProps(UnicodeString sPropName);
*/
private:
/**
* Generates vector of DateTimes representing dates of
* recurrence. Does this given starting time, vector of rrule,
* rdate, exrule, exdate and bound. Also takes optional
* timezones vector to adjust rdate, exdate and rrule, exrule
* (TODO: make rrules, exrules use timezones)
* and a log file to log recurrence errors.
* Used by createRecurrenceEvents method.
* @param vOut output vector of dates of recurrence
* @param start starting time of recurrence
* @param vRRules vector of RRULES (UnicodeString)
* @param vExRules vector of EXRULES (UnicodeString)
* @param vRDatesProp vector of RDATES (ICalProperty)
* @param vExDatesProp vector of EXDATES (ICalProperty)
* @param iBound bound value
* @param vTimeZones vector of timezones
* @param log log file
*/
static void generateDates(JulianPtrArray * vOut, DateTime start,
JulianPtrArray * vRRules, JulianPtrArray * vExRules,
JulianPtrArray * vRDatesProp, JulianPtrArray * vExDatesProp, t_int32 iBound,
JulianPtrArray * vTimeZones = 0, JLog * log = 0);
/**
* Takes in either RDate or ExDate ICalProperty vector, and fills in vOut with
* DateTime strings from vector. Also applies TimeZone information to
* strings when necessary. A flag to check if vector is RDate or ExDate
* is necessary because RDate can have Period, Date info, while ExDate cannot.
* For example, if RDate vector contains RDATE;TZID=America/New-York:19971110T070000,
* then bIsRDate must be TRUE (caller responsible for this), and vOut contains
* the string "19971110T120000Z" (note timezones is applied).
* Used by generateDates method.
* @param vOut output vector of DateTime strings
* @param vDateProp ICalProperty vector to split.
* @param bIsRDate whether vector if RDate or EXDate
* @param vTimeZones vector of timezones
*/
static void splitDates(JulianPtrArray * vOut,
JulianPtrArray * vDateProp, t_bool bIsRDate,
JulianPtrArray * vTimeZones);
/*
JulianPtrArray * getPeriodDatesHelper(JulianPtrArray * vDates);
JulianPtrArray * getPeriodDates(JulianPtrArray * vTimeZones);
*/
/**
* Takes RDate vector and returns all strings of RDates that are
* of PERIOD value. For example if RDATE;VALUE=PERIOD:19971110T112233Z/PT1H,
* return the string "19971110T112233Z/PT1H".
* @param out output vector of strings of PERIOD RDates
*/
void getPeriodRDates(JulianPtrArray * out);
/**
* Takes vector of recurrences dates and generates recurrence events in vOut.
* Used by createRecurrenceEvents method.
* @param vOut output vector of recurrence events
* @param dates vector of recurrence dates
* @param origStart starting time of original compressed event
* @param vTimeZones vector of timezones
*/
void populateDates(JulianPtrArray * vOut, JulianPtrArray * dates,
DateTime origStart, JulianPtrArray * vTimeZones);
/**
* Returns TRUE if this TimeBasedEvent's ID is the same as the component's
* ID. ID is represented as the (UID, RecurrenceID) pair.
* If UID's on this and component do NOT match return FALSE;
* If there is no RecurrenceID on this TBE and component and UID matches,
* return TRUE;
* If there is a RecurrenceID on EITHER this or component, if both have
* RecurrenceID and they MATCH return TRUE. if don't match return FALSE.
* If one has RecurrenceID and other doesn't return FALSE.
* @param TimeBasedEvent * component
*
* @return t_bool
*/
t_bool isExactMatchingID(TimeBasedEvent * component);
#if 0
/**
* Returns TRUE if this component is more recent than component.
* Rules To define recent:
* Returns compare(Sequence Num) else if equal
* Returns compare(DTSTAMP)
*
* @param TimeBasedEvent * component
*
* @return t_bool
*/
t_bool isMoreRecent(TimeBasedEvent * component);
#endif
/* -- DATA MEMBERS */
protected:
/* log file ptr */
JLog * m_Log;
JulianString m_sCurl; /* the calendar url of this component, identifies its cal store */
private:
/* recurrence bound value */
static t_int32 ms_iBound;
/* method name of calendar */
UnicodeString m_sMethod;
/* file loaded from */
UnicodeString m_sFileName;
/* DTStart of first instance of a recurrence */
DateTime m_origDTStart;
/* DTStart of my instance of a recurrence */
DateTime m_origMyDTStart;
/* TRUE = Anniversary event, default is FALSE */
t_bool m_bAllDayEvent;
/*------------ SUBCOMPONENTS ---------------*/
JulianPtrArray * m_AlarmsVctr;
/*------------ PROPERTIES --- (VALUE VALUE TYPES in COMMENTS) -------------------------*/
JulianPtrArray * m_AttachVctr; /* URL */
JulianPtrArray * m_AttendeesVctr; /* CAL-ADDRESS */
JulianPtrArray * m_CategoriesVctr; /* TEXT */
ICalProperty * m_Class; /* class keyword */
JulianPtrArray * m_CommentVctr; /* TEXT */
JulianPtrArray * m_ContactVctr; /* TEXT OR URL */
ICalProperty * m_Created; /* DATETIME */
ICalProperty * m_Description; /* TEXT */
ICalProperty * m_DTStart; /* DATETIME OR DATE */
ICalProperty * m_DTStamp; /* DATETIME */
JulianPtrArray * m_ExDateVctr; /* DATETIME */
JulianPtrArray * m_ExRuleVctr; /* RECURRENCE */
ICalProperty * m_LastModified; /* DATETIME */
ICalProperty * m_Organizer; /* CAL-ADDRESS */
JulianPtrArray * m_RDateVctr; /* DATETIME, DATE, OR PERIOD */
JulianPtrArray * m_RRuleVctr; /* RECURRENCE */
ICalProperty * m_RecurrenceID; /* DATETIME */
JulianPtrArray * m_RelatedToVctr; /* TEXT (must be a UID) */
/*ICalProperty * m_RequestStatus; */
JulianPtrArray * m_RequestStatusVctr; /* 3digit number, error Description UnicodeString, optional exception text */
ICalProperty * m_Sequence; /* INTEGER >= 0 */
ICalProperty * m_Status; /* status keyword */
ICalProperty * m_Summary; /* TEXT */
ICalProperty * m_UID; /* TEXT */
ICalProperty * m_URL; /* TEXT OR URL */
JulianPtrArray * m_XTokensVctr; /* TEXT */
/*------------ END PROPERTIES ------------------------------------------*/
};
#endif /* __TIMEBASEDEVENT_H_ */

Просмотреть файл

@ -1,393 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* tzpart.h
* John Sun
* 2/24/98 9:48:53 AM
*/
#ifndef __TZPART_H_
#define __TZPART_H_
#include <unistring.h>
#include "icalcomp.h"
#include "datetime.h"
/**
* Implements the standardc and daylightc parts of an iCal VTimeZone object.
*/
class TZPart: public ICalComponent
{
private:
#if 0
/**
* Default constructor. Hide from clients.
*/
TZPart();
#endif
protected:
/**
* Copy constructor.
* @param that TZPart to copy
*/
TZPart(TZPart & that);
public:
/**
* Create TZPart, passing in a logfile.
* @param initLog log file to write errors to
*/
TZPart(JLog * initLog = 0);
/**
* Destructor
*/
~TZPart();
/* -- Start of ICALComponent interface -- */
/**
* The parse method is the standard interface for ICalComponent
* subclasses to parse from an ICalReader object
* and from the ITIP method type (i.e. PUBLISH, REQUEST, CANCEL, etc.).
* The method type can be set to \"\" if there is no method to be loaded.
* Also accepts a vector of VTimeZone objects to apply to
* the DateTime properties of the component.
* 4-2-98: Added bIgnoreBeginError. If desired to start parsing in Component level,
* it is useful to ignore first "BEGIN:". Setting bIgnoreBeginError to TRUE allows for
* this.
*
* @param brFile ICalReader to load from
* @param sType name of component (i.e. VEVENT, VTODO, VTIMEZONE)
* @param parseStatus return parse error status string (normally return "OK")
* @param vTimeZones vector of VTimeZones to apply to datetimes
* @param bIgnoreBeginError TRUE = ignore first "BEGIN:DAYLIGHT(STANDARD)", FALSE otherwise
* @param encoding the encoding of the stream, default is 7bit.
*
* @return parse error status string (parseStatus)
*/
virtual UnicodeString & parse(ICalReader * brFile, UnicodeString & sType,
UnicodeString & parseStatus, JulianPtrArray * vTimeZones = 0,
t_bool bIgnoreBeginError = FALSE,
nsCalUtility::MimeEncoding encoding = nsCalUtility::MimeEncoding_7bit);
/**
* Returns a clone of this object
* @param initLog log file to write errors to
*
* @return clone of this object
*/
virtual ICalComponent * clone(JLog * initLog);
/**
* Return TRUE if component is valid, FALSE otherwise
*
* @return TRUE if is valid, FALSE otherwise
*/
virtual t_bool isValid();
/**
* Print all contents of ICalComponent to iCal export format.
*
* @return string containing iCal export format of ICalComponent
*/
virtual UnicodeString toICALString();
/**
* Print all contents of ICalComponent to iCal export format, depending
* on attendee name, attendee delegated-to, and where to include recurrence-id or not
*
* @param method method name (REQUEST,PUBLISH, etc.)
* @param name attendee name to filter with
* @param isRecurring TRUE = no recurrenceid, FALSE = include recurrenceid
*
* @return string containing iCal export format of ICalComponent
*/
virtual UnicodeString toICALString(UnicodeString method, UnicodeString name,
t_bool isRecurring);
/**
* Print all contents of ICalComponent to human-readable string.
*
* @return string containing human-readable format of ICalComponent
*/
virtual UnicodeString toString();
/**
* Depending on character passed in, returns a string that represents
* the ICAL export string of that property that the character represents, if
* other paramaters not null, then print out information is filtered in several ways
* Attendee print out can be filtered so that only attendee with certain name is printed
* also, can print out the relevant attendees in a delegation message
* (ie. owner, delegate-to, delegate-from)
*
* @param c char of what property to print
* @param sFilterAttendee name of attendee to print
* @param bDelegateRequest TRUE if a delegate request, FALSE if not
* @return ICAL export format of that property
*/
virtual UnicodeString formatChar(t_int32 c, UnicodeString sFilterAttendee,
t_bool delegateRequest = FALSE);
/**
* convert a character to the content of a property in string
* human-readable format
* @param c a character represents a property
* @param dateFmt for formatting datetimes
*
* @return property in human-readable string
*/
virtual UnicodeString toStringChar(t_int32 c, UnicodeString & dateFmt);
/**
* Returns the ICAL_COMPONENT enumeration value of this ICalComponent.
* Each ICalComponent subclass must return a unique ICAL_COMPONENT value.
*
* @return ICAL_COMPONENT value of this component
*/
virtual ICAL_COMPONENT GetType() const { return ICAL_COMPONENT_TZPART; }
/**
* Update the private property data-members with updatedComponent's
* property data-members.
* Usually, overwriting data-members should only occur if updatedComponent
* is more recent than the current component.
* Return TRUE if component was changed, FALSE otherwise
* @param ICalComponent * updatedComponent
*
* @return virtual t_bool
*/
virtual t_bool updateComponent(ICalComponent * updatedComponent);
/* -- End of ICALComponent interface -- */
/* COMMENT */
void addComment(UnicodeString s, JulianPtrArray * parameters = 0);
void addCommentProperty(ICalProperty * prop);
JulianPtrArray * getComment() const { return m_CommentVctr; }
/* TZNAME */
void addTZName(UnicodeString s, JulianPtrArray * parameters = 0);
void addTZNameProperty(ICalProperty * prop);
JulianPtrArray * getTZName() const { return m_TZNameVctr; }
/* DTSTART */
DateTime getDTStart() const;
void setDTStart(DateTime s, JulianPtrArray * parameters = 0);
ICalProperty * getDTStartProperty() const { return m_DTStart; }
/* RDATE */
DateTime getRDate() const;
void setRDate(DateTime s, JulianPtrArray * parameters = 0);
ICalProperty * getRDateProperty() const { return m_RDate; }
/* RRULE */
UnicodeString getRRule() const;
void setRRule(UnicodeString s, JulianPtrArray * parameters = 0);
ICalProperty * getRRuleProperty() const { return m_RRule; }
/* TZOFFSETTO */
UnicodeString getTZOffsetTo() const;
void setTZOffsetTo(UnicodeString s, JulianPtrArray * parameters = 0);
ICalProperty * getTZOffsetToProperty() const { return m_TZOffsetTo; }
/* TZOFFSETFROM */
UnicodeString getTZOffsetFrom() const;
void setTZOffsetFrom(UnicodeString s, JulianPtrArray * parameters = 0);
ICalProperty * getTZOffsetFromProperty() const { return m_TZOffsetFrom; }
/* XTOKENS: NOTE: a vector of strings, not a vector of ICalProperties */
void addXTokens(UnicodeString s);
JulianPtrArray * getXTokens() const { return m_XTokensVctr; }
/* NAME (DAYLIGHT OR STANDARD) */
UnicodeString getName() const { return m_Name; }
void setName(UnicodeString s);
/**
* Return start month value of timezone part start time. 0-based
*
* @return start month value (0-11)
*/
t_int32 getMonth() const { return m_StartMonth; }
/**
* Return start day of week in month value of timezone part start time.
* Usually -1 or 1.
* @return start day of week in month (-5 to 5)
*/
t_int32 getDayOfWeekInMonth() const { return m_StartWeek; }
/**
* Return start day of timezone part start time.
* Usually Calendar::SUNDAY
* @return start day value (Calendar::SUNDAY - Calendar::SATURDAY)
* @see Calendar
*/
t_int32 getDay() const { return m_StartDay; }
/**
* Return starting time in milliseconds of timezone part start time.
* For example, if start time is 2AM, then return 7200000.
*
* @return start time value in milliseconds
*/
t_int32 getStartTime() const { return m_StartTime; }
/**
* Return expiration date of TimeZone part, if returned value is
* invalid, then no expiration date.
*
* @return expiration date, invalid means no expiration date
*/
DateTime getUntil() { return m_Until; }
/* TODO: move later */
static float UTCOffsetToFloat(UnicodeString & utcOffset);
private:
/**
* Helper method called by updateComponent to actually replace
* the property data-members with updatedComponent's data-members.
* @param TZPart * updatedComponent
*
* @return virtual void
*/
void updateComponentHelper(TZPart * updatedComponent);
/**
* Selfcheck data members. Currently does nothing
*/
void selfCheck();
/**
* store the data, depending on property name, property value
* parameter names, parameter values, and the current line
*
* @param strLine current line to process
* @param propName name of property
* @param propVal value of property
* @param parameters property's parameters
* @param vTimeZones vector of timezones
*/
void storeData(UnicodeString & strLine, UnicodeString & propName,
UnicodeString & propVal, JulianPtrArray * parameters);
public:
typedef void (TZPart::*SetOp) (UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
/* Clients should NOT call below methods */
void storeComment(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeTZName(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeDTStart(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeRDate(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeRRule(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeTZOffsetTo(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeTZOffsetFrom(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void ApplyStoreOp(void (TZPart::*op) (UnicodeString & strLine,
UnicodeString & propVal, JulianPtrArray * parameters, JulianPtrArray * vTimeZones),
UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones)
{
(this->*op)(strLine, propVal, parameters, vTimeZones);
}
private:
/**
* Takes RRULE value and generates startmonth, startday, startweek, starttime
* and until. Return TRUE if parse went OK, FALSE if error occurred.
*
* @return TRUE if parse went OK, FALSE if error occurred.
*/
t_bool parseRRule();
/**
* Takes RDATE value and generates startmonth, startday, startweek.
*/
void parseRDate();
#if 0
/**
* Given data members, generates timezone critical information
* (start month,day,week,time,until). Calls either parseRRule or
* parseRDate to do this. If error in parse, return FALSE, else
* return TRUE.
*
* @return TRUE if parse went OK, FALSE if error occurred
*/
t_bool parseRule();
#endif
/* -- DATA MEMBERS -- */
/*static UnicodeString m_strDefaultFmt;
static UnicodeString ms_sAllMessage;*/
/* for RRULE timezones */
t_int32 m_StartMonth;
t_int32 m_StartDay;
t_int32 m_StartWeek;
t_int32 m_StartTime;
/* used to print out DTStart back */
t_int32 m_iStartYear;
t_int32 m_iStartMonth;
t_int32 m_iStartDay;
t_int32 m_iStartHour;
t_int32 m_iStartMinute;
t_int32 m_iStartSecond;
/* used to print out RDate back */
t_int32 m_iRDateYear;
t_int32 m_iRDateMonth;
t_int32 m_iRDateDay;
t_int32 m_iRDateHour;
t_int32 m_iRDateMinute;
t_int32 m_iRDateSecond;
DateTime m_Until;
UnicodeString m_Name; /* STANDARD or DAYLIGHT */
JulianPtrArray * m_CommentVctr;
JulianPtrArray * m_TZNameVctr;
ICalProperty * m_DTStart;
ICalProperty * m_RDate;
ICalProperty * m_RRule;
ICalProperty * m_TZOffsetTo;
ICalProperty * m_TZOffsetFrom;
JulianPtrArray * m_XTokensVctr; /* TEXT */
JLog * m_Log;
};
#endif /* __TZPART_H_ */

Просмотреть файл

@ -1,108 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* unistrto.h
* John Sun
* 2/3/98 12:07:00 PM
*/
#ifndef __UNICODESTRINGTOKENIZER_H_
#define __UNICODESTRINGTOKENIZER_H_
#include <unistring.h>
#include "ptypes.h"
/**
* A simple string tokenizer class for UnicodeString.
* It is modeled after the java.util.StringTokenizer class
* and uses a similar subset of Java's API.
*/
class UnicodeStringTokenizer
{
private:
/** current position in string */
t_int32 m_CurrentPosition;
/** maximum position in string */
t_int32 m_MaxPosition;
/** the string to tokenize */
UnicodeString m_String;
/** the string delimeters for seperating tokens */
UnicodeString m_StringDelimeters;
/** Skips delimeters. */
void skipDelimeters();
public:
/**
* Constructor.
* @param str string to tokenize
* @param delim string delimeters
*/
UnicodeStringTokenizer(UnicodeString & str, UnicodeString & delim);
#if 0
/**
* Constructor. Sets default delimeters to whitespace characters.
* Strongly recommend using other constructor.
* @param str string to tokenize
*/
UnicodeStringTokenizer(UnicodeString & str);
#endif
/**
* Tests if there are more tokens available from this string
*
* @return TRUE if more tokens, FALSE otherwise
*/
t_bool hasMoreTokens();
/**
* Returns next token in out if available. If no more tokens
* status is set to 1.
* @param out next available token output
* @param status status error, 1 is ran-out-of-tokens, 0 is OK
*
* @return next available token (out)
*/
UnicodeString & nextToken(UnicodeString & out, ErrorCode & status);
#if 0
/**
* Returns next token in out if available. If no more tokens
* status is set to 1. Also sets delimeters to delim for further tokenizing.
* @param out next available token output
* @param delim the new delimeters
* @param status status error, 1 is ran-out-of-tokens, 0 is OK
*
* @return next available token (out)
*/
UnicodeString & nextToken(UnicodeString & out, UnicodeString & sDelim, ErrorCode & status);
#endif
};
#endif /* __UNICODESTRINGTOKENIZER_H_ */

Просмотреть файл

@ -1,101 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* uri.h
* John Sun
* 4/3/98 11:27:52 AM
*/
#ifndef __URI_H_
#define __URI_H_
#include <unistring.h>
/**
* URI encapsulates the ICAL URI data-type. The URI data-type
* is used to identify values that contain a uniform resource
* identifier (URI) type of reference to the property value.
*/
class URI
{
private:
/*-----------------------------
** MEMBERS
**---------------------------*/
/** URL string */
UnicodeString m_URI;
public:
/*-----------------------------
** CONSTRUCTORS and DESTRUCTORS
**---------------------------*/
/**
* Default constructor makes string "".
*/
URI();
/** creates a URI with full URI */
URI(UnicodeString fulluri);
URI(char * fulluri);
/*-----------------------------
** ACCESSORS (GET AND SET)
**---------------------------*/
/**
* returns full uri string
* (i.e. http://host1.com/my-report.txt, mailto:a@acme.com)
*
* @return the full uri string
*/
UnicodeString getFullURI() { return m_URI; }
/** return protocol name (i.e. Mailto:, http:, ftp:) */
/*UnicodeString getProtocol();*/
/**
* return name (right side of ':' in full uri)
* (i.e. host1.com/my-report.txt, a@acme.com)
*
* @return the return name
*/
UnicodeString getName();
/**
* set full uri string
* @param uri new full URI string
*/
void setFullURI(UnicodeString uri) { m_URI = uri; }
/**
* Checks whether string is a URI.
* For now just checks if a colon exists in string and
* it does not start with a colon.
* Thus: yoadfs:fdsaf is a valid URL.
* @param UnicodeString & s
*
* @return static t_bool
*/
static t_bool IsValidURI(UnicodeString & s);
};
#endif /* __URI_H_ */

Просмотреть файл

@ -1,377 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the 'NPL'); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an 'AS IS' basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* valarm.h
* John Sun
* 7/22/98 10:34:34 AM
*/
#ifndef __VALARM_H_
#define __VALARM_H_
#include <unistring.h>
#include "datetime.h"
#include "ptrarray.h"
#include "jlog.h"
#include "icalcomp.h"
#include "attendee.h"
#include "keyword.h"
#include "nscalcoreicalexp.h"
class NS_CAL_CORE_ICAL VAlarm: public ICalComponent
{
public:
/** an enumeration of the ACTION parameter */
/* default is audio */
enum ACTION
{
ACTION_AUDIO = 0,
ACTION_DISPLAY = 1,
ACTION_EMAIL = 2,
ACTION_PROCEDURE = 3,
ACTION_INVALID = -1
};
private:
/*-----------------------------
** MEMBERS
**---------------------------*/
JLog * m_Log;
/* -- properties in ALL action types -- */
/*ICalProperty * m_Action;*/
ACTION m_Action;
/* as a duration */
ICalProperty * m_Trigger;
/* as a datetime */
DateTime m_TriggerDateTime;
/* duration and repeat are optional */
ICalProperty * m_Duration;
ICalProperty * m_Repeat;
JulianPtrArray * m_XTokensVctr;
/* -- end ALL action types properties -- */
/* used in more that one action type but not all */
JulianPtrArray * m_AttachVctr;
ICalProperty * m_Description;
/* audio props */
/* always ONLY one attachment */
/* NO description */
/* display props */
/* NO attachments */
/* One description */
/* email props */
/* any number of attachments */
/* One description */
/* at least one attendee */
JulianPtrArray * m_AttendeesVctr;
ICalProperty * m_Summary;
/* procedure props */
/* always ONLY one attachment */
/* Zero or One description */
/*-----------------------------
** PRIVATE METHODS
**---------------------------*/
/**
* Creates NLS TimeZone from start month,day,week,time,until.
* TODO: possible bug, may need to call everytime before calling getNLSTimeZone().
*/
void selfCheck();
/**
* store the data, depending on property name, property value
* parameter names, parameter values, and the current line.
*
* @param strLine current line to process
* @param propName name of property
* @param propVal value of property
* @param parameters property's parameters
* @param vTimeZones vector of timezones
* @return TRUE if line was handled, FALSE otherwise
*/
void storeData(UnicodeString & strLine,
UnicodeString & propName, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
/**
* Helper method called by updateComponent to actually replace
* the property data-members with updatedComponent's data-members.
* @param VTimeZone * updatedComponent
*
* @return virtual void
*/
void updateComponentHelper(VAlarm * updatedComponent);
public:
typedef void (VAlarm::*SetOp) (UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
/* Clients should not call these methods even though they are not public */
void storeAction(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeAttach(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeAttendee(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeDescription(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeDuration(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeRepeat(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeSummary(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeTrigger(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void ApplyStoreOp(void (VAlarm::*op) (UnicodeString & strLine,
UnicodeString & propVal, JulianPtrArray * parameters, JulianPtrArray * vTimeZones),
UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones)
{
(this->*op)(strLine, propVal, parameters, vTimeZones);
}
private:
#if 0
VAlarm();
#endif
protected:
VAlarm(VAlarm & that);
public:
/*-----------------------------
** CONSTRUCTORS and DESTRUCTORS
**---------------------------*/
VAlarm(JLog * initLog = 0);
virtual ~VAlarm();
/* -- Start of ICALComponent interface -- */
/**
* The parse method is the standard interface for ICalComponent
* subclasses to parse from an ICalReader object
* and from the ITIP method type (i.e. PUBLISH, REQUEST, CANCEL, etc.).
* The method type can be set to \"\" if there is no method to be loaded.
* Also accepts a vector of VTimeZone objects to apply to
* the DateTime properties of the component.
* 4-2-98: Added bIgnoreBeginError. If desired to start parsing in Component level,
* it is useful to ignore first "BEGIN:". Setting bIgnoreBeginError to TRUE allows for
* this.
*
* @param brFile ICalReader to load from
* @param sType name of component (VTIMEZONE)
* @param parseStatus return parse error status string (normally return "OK")
* @param vTimeZones vector of VTimeZones to apply to datetimes
* @param bIgnoreBeginError TRUE = ignore first "BEGIN:VTIMEZONE", FALSE otherwise
* @param encoding the encoding of the stream, default is 7bit.
*
* @return parse error status string (parseStatus)
*/
virtual UnicodeString & parse(ICalReader * brFile, UnicodeString & sType,
UnicodeString & parseStatus, JulianPtrArray * vTimeZones = 0,
t_bool bIgnoreBeginError = FALSE,
nsCalUtility::MimeEncoding encoding = nsCalUtility::MimeEncoding_7bit);
/**
* Returns a clone of this object
* @param initLog log file to write errors to
*
* @return clone of this object
*/
virtual ICalComponent * clone(JLog * initLog);
/**
* Return TRUE if component is valid, FALSE otherwise
*
* @return TRUE if is valid, FALSE otherwise
*/
virtual t_bool isValid();
/**
* Print all contents of ICalComponent to iCal export format.
*
* @return string containing iCal export format of ICalComponent
*/
virtual UnicodeString toICALString();
/**
* Print all contents of ICalComponent to iCal export format, depending
* on attendee name, attendee delegated-to, and where to include recurrence-id or not
*
* @param method method name (REQUEST,PUBLISH, etc.)
* @param name attendee name to filter with
* @param isRecurring TRUE = no recurrenceid, FALSE = include recurrenceid
*
* @return string containing iCal export format of ICalComponent
*/
virtual UnicodeString toICALString(UnicodeString method, UnicodeString name,
t_bool isRecurring);
/**
* Print all contents of ICalComponent to human-readable string.
*
* @return string containing human-readable format of ICalComponent
*/
virtual UnicodeString toString();
/**
* Depending on character passed in, returns a string that represents
* the ICAL export string of that property that the character represents, if
* other paramaters not null, then print out information is filtered in several ways
* Attendee print out can be filtered so that only attendee with certain name is printed
* also, can print out the relevant attendees in a delegation message
* (ie. owner, delegate-to, delegate-from)
*
* @param c char of what property to print
* @param sFilterAttendee name of attendee to print
* @param bDelegateRequest TRUE if a delegate request, FALSE if not
* @return ICAL export format of that property
*/
virtual UnicodeString formatChar(t_int32 c, UnicodeString sFilterAttendee,
t_bool delegateRequest = FALSE);
/**
* convert a character to the content of a property in string
* human-readable format
* @param c a character represents a property
* @param dateFmt for formatting datetimes
*
* @return property in human-readable string
*/
virtual UnicodeString toStringChar(t_int32 c, UnicodeString & dateFmt);
/**
* Returns the ICAL_COMPONENT enumeration value of this ICalComponent.
* Each ICalComponent subclass must return a unique ICAL_COMPONENT value.
*
* @return ICAL_COMPONENT value of this component
*/
virtual ICAL_COMPONENT GetType() const { return ICAL_COMPONENT_VALARM; }
/**
* Update the private property data-members with updatedComponent's
* property data-members.
* Usually, overwriting data-members should only occur if updatedComponent
* is more recent than the current component.
* Return TRUE if component was changed, FALSE otherwise
* @param ICalComponent * updatedComponent
*
* @return virtual t_bool
*/
virtual t_bool updateComponent(ICalComponent * updatedComponent);
/* -- End of ICALComponent interface -- */
/*-----------------------------
** ACCESSORS (GET AND SET)
**---------------------------*/
VAlarm::ACTION getAction() const { return m_Action; }
void setAction(VAlarm::ACTION action) { m_Action = action; }
/* nsCalDuration */
nsCalDuration getDuration() const;
void setDuration(nsCalDuration s, JulianPtrArray * parameters = 0);
ICalProperty * getDurationProperty() const { return m_Duration; }
/* Repeat */
t_int32 getRepeat() const;
void setRepeat(t_int32 i, JulianPtrArray * parameters = 0);
ICalProperty * getRepeatProperty() const { return m_Repeat; }
/* Trigger */
/* can be date-time or duration */
nsCalDuration getTriggerAsDuration() const;
void setTriggerAsDuration(nsCalDuration s, JulianPtrArray * parameters = 0);
void setTriggerAsDateTime(DateTime s);
ICalProperty * getTriggerProperty() const { return m_Trigger; }
DateTime getTriggerAsDateTime(DateTime startTime) const;
/* Description */
UnicodeString getDescription() const;
void setDescription(UnicodeString s, JulianPtrArray * parameters = 0);
ICalProperty * getDescriptionProperty() const { return m_Description; }
/* SUMMARY */
UnicodeString getSummary() const;
void setSummary(UnicodeString s, JulianPtrArray * parameters = 0);
ICalProperty * getSummaryProperty() const { return m_Summary; }
/* ATTACH */
void addAttach(UnicodeString s, JulianPtrArray * parameters = 0);
void addAttachProperty(ICalProperty * prop);
JulianPtrArray * getAttach() const { return m_AttachVctr; }
/* XTOKENS: NOTE: a vector of strings, not a vector of ICalProperties */
void addXTokens(UnicodeString s);
JulianPtrArray * getXTokens() const { return m_XTokensVctr; }
/* ATTENDEES */
void addAttendee(Attendee * a);
JulianPtrArray * getAttendees() const { return m_AttendeesVctr ; }
/* JLOG */
JLog * getLog() const { return m_Log; }
/*-----------------------------
** UTILITIES
**---------------------------*/
/*-----------------------------
** STATIC METHODS
**---------------------------*/
/**
* Converts string to ACTION enumeration. Returns AUDIO if error.
* @param sAction action string
*
* @return ACTION enumeration value of sAction
*/
static VAlarm::ACTION stringToAction(UnicodeString & sAction);
/**
* Converts ACTION to string.
* @param action action value
* @param out output action string
*
* @return output action string
*/
static UnicodeString & actionToString(VAlarm::ACTION action, UnicodeString & out);
/*-----------------------------
** OVERLOADED OPERATORS
**---------------------------*/
};
#endif /* __VALARM_H_ */

Просмотреть файл

@ -1,334 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* vevent.h
* John Sun
* 2/9/98 10:50:22 PM
*/
#ifndef __VEVENT_H_
#define __VEVENT_H_
#include "datetime.h"
#include "duration.h"
#include "ptrarray.h"
#include "tmbevent.h"
#include "jlog.h"
#include "nscalcoreicalexp.h"
class NS_CAL_CORE_ICAL VEvent : public TimeBasedEvent
{
private:
#if 0
VEvent();
#endif
protected:
/**
* Copy constructor.
* @param that VEvent to copy.
*/
VEvent(VEvent & that);
public:
/**
* Constructor. Create VEvent with initial log file set to initLog.
* @param initLog initial log file pointer
*/
VEvent(JLog * initLog = 0);
/**
* Destructor.
*/
~VEvent();
/* -- Start of ICALComponent interface -- */
/**
* The parse method is the standard interface for ICalComponent
* subclasses to parse from an ICalReader object
* and from the ITIP method type (i.e. PUBLISH, REQUEST, CANCEL, etc.).
* The method type can be set to \"\" if there is no method to be loaded.
* Also accepts a vector of VTimeZone objects to apply to
* the DateTime properties of the component.
* 4-2-98: Added bIgnoreBeginError. If desired to start parsing in Component level,
* it is useful to ignore first "BEGIN:". Setting bIgnoreBeginError to TRUE allows for
* this.
*
* @param brFile ICalReader to load from
* @param sType name of component (i.e. VEVENT, VTODO, VTIMEZONE)
* @param parseStatus return parse error status string (normally return "OK")
* @param vTimeZones vector of VTimeZones to apply to datetimes
* @param bIgnoreBeginError TRUE = ignore first "BEGIN:VEVENT", FALSE otherwise
* @param encoding the encoding of the stream, default is 7bit.
*
* @return parse error status string (parseStatus)
*/
UnicodeString & parse(ICalReader * brFile, UnicodeString & sMethod,
UnicodeString & parseStatus, JulianPtrArray * vTimeZones = 0,
t_bool bIgnoreBeginError = FALSE,
nsCalUtility::MimeEncoding encoding = nsCalUtility::MimeEncoding_7bit);
/**
* Returns a clone of this object
* @param initLog log file to write errors to
*
* @return clone of this object
*/
virtual ICalComponent * clone(JLog * initLog);
/**
* Return TRUE if component is valid, FALSE otherwise
*
* @return TRUE if is valid, FALSE otherwise
*/
t_bool isValid();
/**
* Print all contents of ICalComponent to human-readable string.
*
* @return string containing human-readable format of ICalComponent
*/
virtual UnicodeString toString();
/**
* Depending on character passed in, returns a string that represents
* the ICAL export string of that property that the character represents, if
* other paramaters not null, then print out information is filtered in several ways
* Attendee print out can be filtered so that only attendee with certain name is printed
* also, can print out the relevant attendees in a delegation message
* (ie. owner, delegate-to, delegate-from)
*
* @param c char of what property to print
* @param sFilterAttendee name of attendee to print
* @param bDelegateRequest TRUE if a delegate request, FALSE if not
* @return ICAL export format of that property
*/
virtual UnicodeString formatChar(t_int32 c,
UnicodeString sFilterAttendee, t_bool delegateRequest = FALSE);
/**
* convert a character to the content of a property in string
* human-readable format
* @param c a character represents a property
* @param dateFmt for formatting datetimes
*
* @return property in human-readable string
*/
virtual UnicodeString toStringChar(t_int32 c, UnicodeString & dateFmt);
/**
* Returns the ICAL_COMPONENT enumeration value of this ICalComponent.
* Each ICalComponent subclass must return a unique ICAL_COMPONENT value.
*
* @return ICAL_COMPONENT value of this component
*/
virtual ICAL_COMPONENT GetType() const { return ICAL_COMPONENT_VEVENT ; }
/* -- End of ICALComponent interface -- */
/**
* Overridden virtual method used as wrapper to ICalComponent::format method.
* @param strFmt iCal format string
* @param sFilterAttendee attendee to filter
* @param delegateRequest delegate request = TRUE, FALSE otherwise
*
* @return output iCal formatted export string
*/
virtual UnicodeString formatHelper(UnicodeString & strFmt,
UnicodeString sFilterAttendee, t_bool delegateRequest = FALSE);
/**
* Helper method. Overriden virtual method. Used by subclasses to
* populate recurrence-dependent data. For example, a recurring
* VEvent needs to have DTEnd calculated from recurring
* DTStart. VEvent will overwrite method set DTEnd correctly.
* Abstract difference() method is used to calculate ldiff.
* Need to pass vector of RDate periods in case end value must
* be adjusted in RDATE is a PERIOD value.
* @param start recurrence instance starting time
* @param ldiff abstract difference value
* @param vPer vector of RDate periods
*/
void populateDatesHelper(DateTime start, Date ldiff, JulianPtrArray * vPer);
/* overridden message methods */
virtual UnicodeString cancelMessage();
virtual UnicodeString requestMessage();
virtual UnicodeString requestRecurMessage();
virtual UnicodeString counterMessage();
virtual UnicodeString declineCounterMessage();
virtual UnicodeString addMessage();
virtual UnicodeString refreshMessage(UnicodeString sAttendeeFilter);
virtual UnicodeString allMessage();
virtual UnicodeString replyMessage(UnicodeString sAttendeeFilter);
virtual UnicodeString publishMessage();
virtual UnicodeString publishRecurMessage();
/**
* Overridden method. Calculate difference from start, end time
* For VEvent, this would be DTEnd - DTStart.
* For VTodo, this would be Due - DTStart.
*
* @return virtual Date
*/
Date difference();
/**
* Sets default human-readable event format pattern to s.
* @param s new event format pattern
*/
static void setDefaultFmt(UnicodeString s);
/* ------------------------------------
* SET/GET DATA MEMBER
*-------------------------------------*/
/* DTEND */
DateTime getDTEnd() const;
void setDTEnd(DateTime s, JulianPtrArray * parameters = 0);
ICalProperty * getDTEndProperty() const { return m_DTEnd; }
/* DURATION */
nsCalDuration getDuration() const;
void setDuration(nsCalDuration s, JulianPtrArray * parameters = 0);
/*ICalProperty * getDurationProperty() const { return m_Duration; }*/
/* GEO */
UnicodeString getGEO() const;
void setGEO(UnicodeString s, JulianPtrArray * parameters = 0);
ICalProperty * getGEOProperty() const { return m_GEO; }
/* LOCATION */
UnicodeString getLocation() const;
void setLocation(UnicodeString s, JulianPtrArray * parameters = 0);
ICalProperty * getLocationProperty() const { return m_Location; }
/* PRIORITY */
t_int32 getPriority() const;
void setPriority(t_int32 i, JulianPtrArray * parameters = 0);
ICalProperty * getPriorityProperty() const { return m_Priority; }
/* TRANSP */
UnicodeString getTransp() const;
void setTransp(UnicodeString s, JulianPtrArray * parameters = 0);
ICalProperty * getTranspProperty() const { return m_Transp; }
/* RESOURCES */
void addResources(UnicodeString s, JulianPtrArray * parameters = 0);
void addResourcesProperty(ICalProperty * prop);
JulianPtrArray * getResources() const { return m_ResourcesVctr; }
void addResourcesPropertyVector(UnicodeString & propVal, JulianPtrArray * parameters);
/* MYORIGEND */
void setMyOrigEnd(DateTime d) { m_origMyDTEnd = d; }
DateTime getMyOrigEnd() { return m_origMyDTEnd; }
/* ORIGEND */
void setOrigEnd(DateTime d) { m_origDTEnd = d; }
DateTime getOrigEnd() { return m_origDTEnd; }
virtual void updateComponentHelper(TimeBasedEvent * updatedComponent);
private:
/**
* store the data, depending on property name, property value
* parameter names, parameter values, and the current line.
* If this method returns FALSE, property not valid.
*
* @param strLine current line to process
* @param propName name of property
* @param propVal value of property
* @param parameters property's parameters
* @param vTimeZones vector of timezones
* @return TRUE if property handled, FALSE otherwise
*/
t_bool storeData(UnicodeString & strLine,
UnicodeString & propName, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
public:
typedef void (VEvent::*SetOp) (UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
/* Clients should NOT call below methods */
void storeDTEnd(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeDuration(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeGEO(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeLocation(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storePriority(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeResources(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeTransp(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void ApplyStoreOp(void (VEvent::*op) (UnicodeString & strLine,
UnicodeString & propVal, JulianPtrArray * parameters, JulianPtrArray * vTimeZones),
UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones)
{
(this->*op)(strLine, propVal, parameters, vTimeZones);
}
private:
/**
* Sets default data. Currently does following:
* 1) Sets DTEnd to correct value, depending on DURATION, DTSTART
* (see spec on rules)
* 2) Sets TRANSP to TRANSPARENT if anniversary event
*/
void selfCheck();
/*void setDefaultProps(UnicodeString propName);*/
/* -- MEMBERS -- */
/* DTEnd of first instance of a recurrence */
DateTime m_origDTEnd;
/* DTEnd of my instance of a recurrence */
DateTime m_origMyDTEnd;
/** used for initial parse only to calculate first DTEnd, then discarded */
nsCalDuration * m_TempDuration;
/*-------------------------------------------------
* DATA MEMBER (to augment TimeBasedEvent)
*------------------------------------------------*/
ICalProperty * m_DTEnd; /* DATETIME */
ICalProperty * m_GEO; /* geographic position (two floats)*/
ICalProperty * m_Location; /* TEXT */
ICalProperty * m_Priority; /* INTEGER >= 0 */
JulianPtrArray * m_ResourcesVctr; /* TEXT */
ICalProperty * m_Transp; /* transparency keyword */
};
#endif /* __VEVENT_H_ */

Просмотреть файл

@ -1,549 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* vfrbsy.h
* John Sun
* 2/19/98 4:17:54 PM
*/
#ifndef __VFREEBUSY_H_
#define __VFREEBUSY_H_
#include <unistring.h>
#include "datetime.h"
#include "duration.h"
#include "period.h"
#include "icalcomp.h"
#include "attendee.h"
#include "freebusy.h"
#include "jlog.h"
class VFreebusy : public ICalComponent
{
private:
#if 0
/**
* Default Constructor. Hide from clients.
*/
VFreebusy();
#endif
protected:
/**
* Checks private data members so they are valid.
* Sets default data. Currently does following:
* 1) Sets DTEnd to correct value, depending on DURATION, DTSTART
* (see spec on rules)
*/
void selfCheck();
/*public static VFreebusy * createVFreebusy(UnicodeString & string);*/
/**
* store the data, depending on property name, property value
* parameter names, parameter values, and the current line.
* If this method returns FALSE, property not valid.
*
* @param strLine current line to process
* @param propName name of property
* @param propVal value of property
* @param parameters property's parameters
* @param vTimeZones vector of timezones
* @return TRUE if property handled, FALSE otherwise
*/
t_bool storeData(UnicodeString & strLine, UnicodeString & propName,
UnicodeString & propVal, JulianPtrArray * parameters,
JulianPtrArray * vTimeZones);
public:
typedef void (VFreebusy::*SetOp) (UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
/* Clients should NOT call below methods */
void storeAttendees(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeComment(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeContact(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
/*
void storeCreated(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
*/
void storeDuration(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeDTEnd(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeDTStart(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeDTStamp(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeFreebusy(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeLastModified(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeOrganizer(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeRequestStatus(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeSequence(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeUID(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeURL(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void ApplyStoreOp(void (VFreebusy::*op) (UnicodeString & strLine,
UnicodeString & propVal, JulianPtrArray * parameters, JulianPtrArray * vTimeZones),
UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones)
{
(this->*op)(strLine, propVal, parameters, vTimeZones);
}
protected:
UnicodeString formatHelper(UnicodeString & strFmt,
UnicodeString sFilterAttendee);
/**
* Sorts vector of Freebusy periods by start time.
*/
void sortFreebusy();
/**
* Given a vector of Freebusy objects,
* combines freebusy objects that have the same params
* by calling the Freebusy::HasSameParams method.
*/
static void combineSameFreebusies(JulianPtrArray * freebusies);
/**
* Given a vector of Freebusy objects,
* compress each Freebusy in the vector.
* By compressing, periods with overlapping times and same type
* are combined. Calls Freebusy::normalizePeriods.
*/
static void compressFreebusies(JulianPtrArray * freebusies);
/**
* Takes freebusy vector
* Merges single-period Freebusy objects that are consecutive
* into one single-period Freebusy objects
*
* Alters the freebusy vector from
* FB1: p1, p2, p3
* FB2: p4, p5
* FB3: p6, p7
* to
* FB1: p1
* FB2: p2
* FB3: p3
* FB4: p4
* FB5: p5
* FB6: p6
* FB7: p7
* where FB1-7 will be sorted chronologically by start and normalized
*/
void mergeSinglePeriodFreebusies();
/**
* Given a vector of Freebusy objects,
* unzips each freebusy object.
* Unzipping means the following
* Given:
* FB1: pA, pB, pC
* FB2: pD, pE, pF
* FB3: pG, pH
* unzipping leads to:
* FB1: pA
* FB2: pB
* FB3: pC
* FB4: pD
* ../etc.
*/
void unzipFreebusies();
/**
* Adds extra FREE freebusy objects to fill periods of time
* that specify are not covered by the current freebusy objects
* in the freebusy vector.
*/
void addExtraFreePeriodFreebusies(JulianPtrArray * freebusies);
#if 0
/**
* Debug printing of Freebusy vector
*/
static void DEBUG_printFreebusyVector(const char * message, JulianPtrArray * freebusies);
#endif
/**
* TODO: doesn't do smart overriding for now, does simple overwrite
* Helper method called by updateComponent to actually replace
* the property data-members with updatedComponent's data-members.
* @param VFreebusy * updatedComponent
*
* @return virtual void
*/
void updateComponentHelper(VFreebusy * updatedComponent);
#if 0
/**
* Returns TRUE if this component is more recent than component.
* Rules To define recent:
* Returns compare(Sequence Num) else if equal
* Returns compare(DTSTAMP)
*
* @param VFreebusy * component
*
* @return t_bool
*/
t_bool isMoreRecent(VFreebusy * component);
#endif
/**
* Copy constructor.
* @param that VFreebusy to copy
*/
VFreebusy(VFreebusy & that);
public:
/**
* Constructor. Creates VFreebusy with initial log file initLog.
* @param JLog * initLog = 0
*/
VFreebusy(JLog * initLog = 0);
/**
* Destructor.
*/
~VFreebusy();
/* -- Start of ICALComponent interface -- */
/**
* The parse method is the standard interface for ICalComponent
* subclasses to parse from an ICalReader object
* and from the ITIP method type (i.e. PUBLISH, REQUEST, CANCEL, etc.).
* The method type can be set to \"\" if there is no method to be loaded.
* Also accepts a vector of VTimeZone objects to apply to
* the DateTime properties of the component.
* 4-2-98: Added bIgnoreBeginError. If desired to start parsing in Component level,
* it is useful to ignore first "BEGIN:". Setting bIgnoreBeginError to TRUE allows for
* this.
*
* @param brFile ICalReader to load from
* @param sType name of component (i.e. VEVENT, VTODO, VTIMEZONE)
* @param parseStatus return parse error status string (normally return "OK")
* @param vTimeZones vector of VTimeZones to apply to datetimes
* @param bIgnoreBeginError TRUE = ignore first "BEGIN:VFREEBUSY", FALSE otherwise
* @param encoding the encoding of the stream, default is 7bit.
*
* @return parse error status string (parseStatus)
*/
virtual UnicodeString & parse(ICalReader * brFile, UnicodeString & method,
UnicodeString & parseStatus, JulianPtrArray * vTimeZones = 0,
t_bool bIgnoreBeginError = FALSE,
nsCalUtility::MimeEncoding encoding = nsCalUtility::MimeEncoding_7bit);
/**
* Returns a clone of this object
* @param initLog log file to write errors to
*
* @return clone of this object
*/
virtual ICalComponent * clone(JLog * initLog);
/**
* Return TRUE if component is valid, FALSE otherwise
*
* @return TRUE if is valid, FALSE otherwise
*/
virtual t_bool isValid();
/**
* Print all contents of ICalComponent to iCal export format.
*
* @return string containing iCal export format of ICalComponent
*/
virtual UnicodeString toICALString();
/**
* Print all contents of ICalComponent to iCal export format, depending
* on attendee name, attendee delegated-to, and where to include recurrence-id or not
*
* @param method method name (REQUEST,PUBLISH, etc.)
* @param name attendee name to filter with
* @param isRecurring TRUE = no recurrenceid, FALSE = include recurrenceid
*
* @return string containing iCal export format of ICalComponent
*/
virtual UnicodeString toICALString(UnicodeString method, UnicodeString name,
t_bool isRecurring = FALSE);
/**
* Print all contents of ICalComponent to human-readable string.
*
* @return string containing human-readable format of ICalComponent
*/
virtual UnicodeString toString();
/**
* Depending on character passed in, returns a string that represents
* the ICAL export string of that property that the character represents, if
* other paramaters not null, then print out information is filtered in several ways
* Attendee print out can be filtered so that only attendee with certain name is printed
* also, can print out the relevant attendees in a delegation message
* (ie. owner, delegate-to, delegate-from)
*
* @param c char of what property to print
* @param sFilterAttendee name of attendee to print
* @param bDelegateRequest TRUE if a delegate request, FALSE if not
* @return ICAL export format of that property
*/
virtual UnicodeString formatChar(t_int32 c, UnicodeString sFilterAttendee,
t_bool delegateRequest = FALSE);
/**
* convert a character to the content of a property in string
* human-readable format
* @param c a character represents a property
* @param dateFmt for formatting datetimes
*
* @return property in human-readable string
*/
virtual UnicodeString toStringChar(t_int32 c, UnicodeString & dateFmt);
/**
* Returns the ICAL_COMPONENT enumeration value of this ICalComponent.
* Each ICalComponent subclass must return a unique ICAL_COMPONENT value.
*
* @return ICAL_COMPONENT value of this component
*/
virtual ICAL_COMPONENT GetType() const { return ICAL_COMPONENT_VFREEBUSY; }
/**
* Update the private property data-members with updatedComponent's
* property data-members.
* Usually, overwriting data-members should only occur if updatedComponent
* is more recent than the current component.
* Return TRUE if component was changed, FALSE otherwise
* @param ICalComponent * updatedComponent
*
* @return virtual t_bool
*/
virtual t_bool updateComponent(ICalComponent * updatedComponent);
/* OVERRIDES ICalComponent::MatchUID_seqNO */
virtual t_bool MatchUID_seqNO(UnicodeString uid, t_int32 iSeqNo);
/* -- End of ICALComponent interface -- */
/* -- GETTERS AND SETTERS -- */
/* ATTENDEE */
void addAttendee(Attendee * a);
JulianPtrArray * getAttendees() const { return m_AttendeesVctr ; }
/* COMMENT */
void addComment(UnicodeString s, JulianPtrArray * parameters = 0);
void addCommentProperty(ICalProperty * prop);
JulianPtrArray * getComment() const { return m_CommentVctr; }
/* CREATED */
/*
DateTime getCreated() const;
void setCreated(DateTime s, JulianPtrArray * parameters = 0);
ICalProperty * getCreatedProperty() const { return m_Created; }
*/
/* DURATION */
nsCalDuration getDuration() const;
void setDuration(nsCalDuration s, JulianPtrArray * parameters = 0);
/* ICalProperty * getDurationProperty() const { return m_Duration; } */
/* DTSTART */
DateTime getDTStart() const;
void setDTStart(DateTime s, JulianPtrArray * parameters = 0);
ICalProperty * getDTStartProperty() const { return m_DTStart; }
/* DTSTAMP */
DateTime getDTStamp() const;
void setDTStamp(DateTime s, JulianPtrArray * parameters = 0);
ICalProperty * getDTStampProperty() const { return m_DTStamp; }
/* DTEND */
DateTime getDTEnd() const;
void setDTEnd(DateTime s, JulianPtrArray * parameters = 0);
ICalProperty * getDTEndProperty() const { return m_DTEnd; }
/* FREEBUSY */
void addFreebusy(Freebusy * f);
JulianPtrArray * getFreebusy() const { return m_FreebusyVctr ; }
void removeAllFreebusy();
/* LAST-MODIFIED */
DateTime getLastModified() const;
void setLastModified(DateTime s, JulianPtrArray * parameters = 0);
ICalProperty * getLastModifiedProperty() const { return m_LastModified; }
/* ORGANIZER */
UnicodeString getOrganizer() const;
void setOrganizer(UnicodeString s, JulianPtrArray * parameters = 0);
ICalProperty * getOrganizerProperty() const { return m_Organizer; }
/* RELATED-TO */
/*void addRelatedTo(UnicodeString s, JulianPtrArray * parameters = 0);
void addRelatedToProperty(ICalProperty * prop);
JulianPtrArray * getRelatedTo() const { return m_RelatedToVctr; }*/
/* CONTACT */
void addContact(UnicodeString s, JulianPtrArray * parameters = 0);
void addContactProperty(ICalProperty * prop);
JulianPtrArray * getContact() const { return m_ContactVctr; }
/* REQUEST-STATUS */
/*
UnicodeString getRequestStatus() const;
void setRequestStatus(UnicodeString s, JulianPtrArray * parameters = 0);
ICalProperty * getRequestStatusProperty() const { return m_RequestStatus; }
*/
void addRequestStatus(UnicodeString s, JulianPtrArray * parameters = 0);
void addRequestStatusProperty(ICalProperty * prop);
JulianPtrArray * getRequestStatus() const { return m_RequestStatusVctr; }
/* SEQUENCE */
t_int32 getSequence() const;
void setSequence(t_int32 i, JulianPtrArray * parameters = 0);
ICalProperty * getSequenceProperty() const { return m_Sequence; }
/* UID */
UnicodeString getUID() const;
void setUID(UnicodeString s, JulianPtrArray * parameters = 0);
ICalProperty * getUIDProperty() const { return m_UID; }
/* URL */
/*void addURL(UnicodeString s, JulianPtrArray * parameters = 0);
void addURLProperty(ICalProperty * prop);
JulianPtrArray * getURL() const { return m_URLVctr; }*/
UnicodeString getURL() const;
void setURL(UnicodeString s, JulianPtrArray * parameters = 0);
ICalProperty * getURLProperty() const { return m_URL; }
/* XTOKENS: NOTE: a vector of strings, not a vector of ICalProperties */
void addXTokens(UnicodeString s);
JulianPtrArray * getXTokens() const { return m_XTokensVctr; }
/* Method */
void setMethod(UnicodeString & s) { m_sMethod = s; }
UnicodeString & getMethod() { return m_sMethod; }
#if 0
/**
* Sets Attendee with the name sAttendeeFilter to status.
* If the status is Delegated, then adds each element in delegatedTo
* to the delegatedTo vector of that attendee.
* If that attendee does not exist in the attendee list, then add
* a new Attendee to the attendee list with his/her PARTSTAT set to status.
* @param sAttendeeFilter attendee to set status on
* @param status status to set
* @param delegatedTo vector of delegatedTo names to set to
*/
void setAttendeeStatus(UnicodeString & sAttendeeFilter, Attendee::STATUS status,
JulianPtrArray * delegatedTo = 0);
#endif
/**
* Return the Attendee in attendee vector with name equal
* to sAttendee. Return 0 if no attendee with that name.
* @param sAttendee name of attendee
*
* @return Attendee whose name is sAttendee, 0 if not found
*/
Attendee * getAttendee(UnicodeString sAttendee);
/**
* Sets DTStamp to current time value.
*/
void stamp();
/*void update(VFreebusy * vfUpdated);*/
/*t_bool IsIntersectingTimePeriod(DateTime start, DateTime end);*/
/**
* Takes Freebusy vector and break it up into sorted combined freebusy periods.
*/
void normalize();
/**
* Compare VFreebusy by UID. Used by JulianPtrArray::QuickSort method.
* @param a first VFreebusy
* @param b second VFreebusy
*
* @return a.getUID().compareTo(b.getUID())
*/
static int CompareVFreebusyByUID(const void * a, const void * b);
/**
* Compare VFreebusy by DTSTART. Used by JulianPtrArray::QuickSort method.
* @param a first VFreebusy
* @param b second VFreebusy
*
* @return a.getDTSTART().compareTo(b.getDTSTART())
*/
static int CompareVFreebusyByDTStart(const void * a, const void * b);
private:
UnicodeString m_sMethod;
/** used for initial parse only to calculate first DTEnd, then discarded */
nsCalDuration * m_TempDuration;
/* -- MEMBERS -- */
JulianPtrArray * m_AttendeesVctr;
JulianPtrArray * m_CommentVctr;
JulianPtrArray * m_ContactVctr; /* TEXT OR URL */
/*ICalProperty * m_Created;*/
/*ICalProperty * m_Duration;*/
ICalProperty * m_DTEnd;
ICalProperty * m_DTStart;
ICalProperty * m_DTStamp;
JulianPtrArray * m_FreebusyVctr;
ICalProperty * m_LastModified;
ICalProperty * m_Organizer;
/*ICalProperty * m_RequestStatus;*/
JulianPtrArray * m_RequestStatusVctr;
/*JulianPtrArray * m_RelatedToVctr;*/
ICalProperty * m_Sequence;
ICalProperty * m_UID;
/*JulianPtrArray * m_URLVctr;*/
ICalProperty * m_URL;
JulianPtrArray * m_XTokensVctr;
/*NSCalendar m_Parent;*/
JLog * m_Log;
};
#endif /* __VFREEBUSY_H_ */

Просмотреть файл

@ -1,244 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* vjournal.h
* John Sun
* 4/23/98 10:24:32 AM
*/
#ifndef __VJOURNAL_H_
#define __VJOURNAL_H_
#include "datetime.h"
#include "ptrarray.h"
#include "tmbevent.h"
#include "jlog.h"
#include "nscalcoreicalexp.h"
class NS_CAL_CORE_ICAL VJournal: public TimeBasedEvent
{
private:
/*-----------------------------
** MEMBERS
**---------------------------*/
/*-----------------------------
** PRIVATE METHODS
**---------------------------*/
/**
* store the data, depending on property name, property value
* parameter names, parameter values, and the current line.
* If this method returns FALSE, property not valid.
*
* @param strLine current line to process
* @param propName name of property
* @param propVal value of property
* @param parameters property's parameters
* @param vTimeZones vector of timezones
* @return TRUE if property handled, FALSE otherwise
*/
t_bool storeData(UnicodeString & strLine,
UnicodeString & propName, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
/**
* Sets default data. Currently does following:
* 1) Sets DTEnd to correct value, depending on DURATION, DTSTART
* (see spec on rules)
* 2) Sets TRANSP to TRANSPARENT if anniversary event
*/
void selfCheck();
/**
* Copy constructor.
* @param that VJournal to copy.
*/
VJournal(VJournal & that);
public:
/*-----------------------------
** CONSTRUCTORS and DESTRUCTORS
**---------------------------*/
/**
* Constructor. Create VJournal with initial log file set to initLog.
* @param initLog initial log file pointer
*/
VJournal(JLog * initLog = 0);
/**
* Destructor.
*/
~VJournal();
/* -- Start of ICALComponent interface -- */
/**
* The parse method is the standard interface for ICalComponent
* subclasses to parse from an ICalReader object
* and from the ITIP method type (i.e. PUBLISH, REQUEST, CANCEL, etc.).
* The method type can be set to \"\" if there is no method to be loaded.
* Also accepts a vector of VTimeZone objects to apply to
* the DateTime properties of the component.
* 4-2-98: Added bIgnoreBeginError. If desired to start parsing in Component level,
* it is useful to ignore first "BEGIN:". Setting bIgnoreBeginError to TRUE allows for
* this.
*
* @param brFile ICalReader to load from
* @param sType name of component (VJOURNAL)
* @param parseStatus return parse error status string (normally return "OK")
* @param vTimeZones vector of VTimeZones to apply to datetimes
* @param bIgnoreBeginError TRUE = ignore first "BEGIN:VJOURNAL", FALSE otherwise
* @param encoding the encoding of the stream, default is 7bit.
*
* @return parse error status string (parseStatus)
*/
UnicodeString & parse(ICalReader * brFile, UnicodeString & sMethod,
UnicodeString & parseStatus, JulianPtrArray * vTimeZones = 0,
t_bool bIgnoreBeginError = FALSE,
nsCalUtility::MimeEncoding encoding = nsCalUtility::MimeEncoding_7bit);
/**
* Returns a clone of this object
* @param initLog log file to write errors to
*
* @return clone of this object
*/
virtual ICalComponent * clone(JLog * initLog);
/**
* Return TRUE if component is valid, FALSE otherwise
*
* @return TRUE if is valid, FALSE otherwise
*/
t_bool isValid();
/**
* Print all contents of ICalComponent to human-readable string.
*
* @return string containing human-readable format of ICalComponent
*/
virtual UnicodeString toString();
/**
* Depending on character passed in, returns a string that represents
* the ICAL export string of that property that the character represents, if
* other paramaters not null, then print out information is filtered in several ways
* Attendee print out can be filtered so that only attendee with certain name is printed
* also, can print out the relevant attendees in a delegation message
* (ie. owner, delegate-to, delegate-from)
*
* @param c char of what property to print
* @param sFilterAttendee name of attendee to print
* @param bDelegateRequest TRUE if a delegate request, FALSE if not
* @return ICAL export format of that property
*/
virtual UnicodeString formatChar(t_int32 c,
UnicodeString sFilterAttendee, t_bool delegateRequest = FALSE);
/**
* convert a character to the content of a property in string
* human-readable format
* @param c a character represents a property
* @param dateFmt for formatting datetimes
*
* @return property in human-readable string
*/
virtual UnicodeString toStringChar(t_int32 c, UnicodeString & dateFmt);
/**
* Returns the ICAL_COMPONENT enumeration value of this ICalComponent.
* Each ICalComponent subclass must return a unique ICAL_COMPONENT value.
*
* @return ICAL_COMPONENT value of this component
*/
virtual ICAL_COMPONENT GetType() const { return ICAL_COMPONENT_VJOURNAL; }
/* -- End of ICALComponent interface -- */
/**
* Overridden virtual method used as wrapper to ICalComponent::format method.
* @param strFmt iCal format string
* @param sFilterAttendee attendee to filter
* @param delegateRequest delegate request = TRUE, FALSE otherwise
*
* @return output iCal formatted export string
*/
virtual UnicodeString formatHelper(UnicodeString & strFmt,
UnicodeString sFilterAttendee, t_bool delegateRequest = FALSE);
/**
* Helper method. Overriden virtual method. Used by subclasses to
* populate recurrence-dependent data. For example, a recurring
* VJournal needs to have DTEnd calculated from recurring
* DTStart. VJournal will overwrite method set DTEnd correctly.
* Abstract difference() method is used to calculate ldiff.
* Need to pass vector of RDate periods in case end value must
* be adjusted in RDATE is a PERIOD value.
* @param start recurrence instance starting time
* @param ldiff abstract difference value
* @param vPer vector of RDate periods
*/
void populateDatesHelper(DateTime start, Date ldiff, JulianPtrArray * vPer);
/* overridden message methods */
virtual UnicodeString cancelMessage();
virtual UnicodeString requestMessage();
virtual UnicodeString requestRecurMessage();
virtual UnicodeString counterMessage();
virtual UnicodeString declineCounterMessage();
virtual UnicodeString addMessage();
virtual UnicodeString refreshMessage(UnicodeString sAttendeeFilter);
virtual UnicodeString allMessage();
virtual UnicodeString replyMessage(UnicodeString sAttendeeFilter);
virtual UnicodeString publishMessage();
virtual UnicodeString publishRecurMessage();
/**
* Overridden method. Calculate difference from start, end time
* For VJournal, this would 0.
*
* @return virtual Date
*/
Date difference();
/**
* Sets default human-readable event format pattern to s.
* @param s new event format pattern
*/
static void setDefaultFmt(UnicodeString s);
/*-----------------------------
** ACCESSORS (GET AND SET)
**---------------------------*/
/*-----------------------------
** UTILITIES
**---------------------------*/
virtual void updateComponentHelper(TimeBasedEvent * updatedComponent);
/*-----------------------------
** STATIC METHODS
**---------------------------*/
/*-----------------------------
** OVERLOADED OPERATORS
**---------------------------*/
};
#endif /* __VJOURNAL_H_ */

Просмотреть файл

@ -1,317 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* vtimezne.h
* John Sun
* 2/24/98 2:28:21 PM
*/
#ifndef __VTIMEZONE_H_
#define __VTIMEZONE_H_
#include <unistring.h>
#include <timezone.h>
#include <simpletz.h>
#include "icalcomp.h"
#include "tzpart.h"
#include "jlog.h"
class VTimeZone : public ICalComponent
{
private:
#if 0
/**
* Default constructor. Hide from clients.
*/
VTimeZone();
#endif
protected:
/**
* Copy constructor.
* @param that VTimeZone to copy
*/
VTimeZone(VTimeZone & that);
public:
/**
* Constructor. Creates VTimeZone with initial log file initLog.
* @param initLog initial log file pointer
*/
VTimeZone(JLog * initLog = 0);
/**
* Destructor.
*/
~VTimeZone();
/* -- Start of ICALComponent interface -- */
/**
* The parse method is the standard interface for ICalComponent
* subclasses to parse from an ICalReader object
* and from the ITIP method type (i.e. PUBLISH, REQUEST, CANCEL, etc.).
* The method type can be set to \"\" if there is no method to be loaded.
* Also accepts a vector of VTimeZone objects to apply to
* the DateTime properties of the component.
* 4-2-98: Added bIgnoreBeginError. If desired to start parsing in Component level,
* it is useful to ignore first "BEGIN:". Setting bIgnoreBeginError to TRUE allows for
* this.
*
* @param brFile ICalReader to load from
* @param sType name of component (VTIMEZONE)
* @param parseStatus return parse error status string (normally return "OK")
* @param vTimeZones vector of VTimeZones to apply to datetimes
* @param bIgnoreBeginError TRUE = ignore first "BEGIN:VTIMEZONE", FALSE otherwise
* @param encoding the encoding of the stream, default is 7bit.
*
* @return parse error status string (parseStatus)
*/
virtual UnicodeString & parse(ICalReader * brFile, UnicodeString & sType,
UnicodeString & parseStatus, JulianPtrArray * vTimeZones = 0,
t_bool bIgnoreBeginError = FALSE,
nsCalUtility::MimeEncoding encoding = nsCalUtility::MimeEncoding_7bit);
/**
* Returns a clone of this object
* @param initLog log file to write errors to
*
* @return clone of this object
*/
virtual ICalComponent * clone(JLog * initLog);
/**
* Return TRUE if component is valid, FALSE otherwise
*
* @return TRUE if is valid, FALSE otherwise
*/
virtual t_bool isValid();
/**
* Print all contents of ICalComponent to iCal export format.
*
* @return string containing iCal export format of ICalComponent
*/
virtual UnicodeString toICALString();
/**
* Print all contents of ICalComponent to iCal export format, depending
* on attendee name, attendee delegated-to, and where to include recurrence-id or not
*
* @param method method name (REQUEST,PUBLISH, etc.)
* @param name attendee name to filter with
* @param isRecurring TRUE = no recurrenceid, FALSE = include recurrenceid
*
* @return string containing iCal export format of ICalComponent
*/
virtual UnicodeString toICALString(UnicodeString method, UnicodeString name,
t_bool isRecurring);
/**
* Print all contents of ICalComponent to human-readable string.
*
* @return string containing human-readable format of ICalComponent
*/
virtual UnicodeString toString();
/**
* Depending on character passed in, returns a string that represents
* the ICAL export string of that property that the character represents, if
* other paramaters not null, then print out information is filtered in several ways
* Attendee print out can be filtered so that only attendee with certain name is printed
* also, can print out the relevant attendees in a delegation message
* (ie. owner, delegate-to, delegate-from)
*
* @param c char of what property to print
* @param sFilterAttendee name of attendee to print
* @param bDelegateRequest TRUE if a delegate request, FALSE if not
* @return ICAL export format of that property
*/
virtual UnicodeString formatChar(t_int32 c, UnicodeString sFilterAttendee,
t_bool delegateRequest = FALSE);
/**
* convert a character to the content of a property in string
* human-readable format
* @param c a character represents a property
* @param dateFmt for formatting datetimes
*
* @return property in human-readable string
*/
virtual UnicodeString toStringChar(t_int32 c, UnicodeString & dateFmt);
/**
* Returns the ICAL_COMPONENT enumeration value of this ICalComponent.
* Each ICalComponent subclass must return a unique ICAL_COMPONENT value.
*
* @return ICAL_COMPONENT value of this component
*/
virtual ICAL_COMPONENT GetType() const { return ICAL_COMPONENT_VTIMEZONE; }
/**
* Update the private property data-members with updatedComponent's
* property data-members.
* Usually, overwriting data-members should only occur if updatedComponent
* is more recent than the current component.
* Return TRUE if component was changed, FALSE otherwise
* @param ICalComponent * updatedComponent
*
* @return virtual t_bool
*/
virtual t_bool updateComponent(ICalComponent * updatedComponent);
/* -- End of ICALComponent interface -- */
/* -- GETTERS AND SETTERS -- */
/**
* Return the STANDARD TimeZone part of this VTimeZone.
*
* @return ptr to STANDARD TZPart
*/
TZPart * getStandardPart();
/**
* Return the DAYLIGHT TimeZone part of this VTimeZone.
*
* @return ptr to DAYLIGHT TZPart
*/
TZPart * getDaylightPart();
/**
* Return pointer to vector of TZParts
*
* @return pointer to vector of TZParts.
*/
JulianPtrArray * getTZParts() const { return m_TZPartVctr; };
/* TZPART */
void addTZPart(TZPart * part);
TZPart * getPart(UnicodeString & u);
/* TZID */
UnicodeString getTZID() const;
void setTZID(UnicodeString s, JulianPtrArray * parameters = 0);
ICalProperty * getTZIDProperty() const { return m_TZID; }
/* LastModified */
DateTime getLastModified() const;
void setLastModified(DateTime s, JulianPtrArray * parameters = 0);
ICalProperty * getLastModifiedProperty() const { return m_LastModified; }
/* TZURL */
UnicodeString getTZURL() const;
void setTZURL(UnicodeString s, JulianPtrArray * parameters = 0);
ICalProperty * getTZURLProperty() const { return m_TZURL; }
/* XTOKENS: NOTE: a vector of strings, not a vector of ICalProperties */
void addXTokens(UnicodeString s);
JulianPtrArray * getXTokens() const { return m_XTokensVctr; }
/**
* Given vector of timezones, search for VTimeZone with TZID equal to id.
* Return 0 if not found.
* @param id TZID to look for
* @param timezones vector of timezones to search through
*
* @return first matching VTimeZone in vector, 0 if not found
*/
static VTimeZone * getTimeZone(UnicodeString & id, JulianPtrArray * timezones);
/**
* Given a DateTime string, a vector of timezones, and a vector of
* ICalParameters, apply a timezone to the string if there is a TZID
* in the parameters vector.
* For example, if time = "19971110T112233", timezones has a EST timezone,
* and TZID = EST, then the method would return the datetime for time with
* the EST timezone applied to it.
* @param time datetime string to apply timezone to
* @param vTimeZones vector of timezones
* @param parameters parameters to search for TZID
*
* @return DateTime representing time with timezone applied to it.
*/
static DateTime DateTimeApplyTimeZone(UnicodeString & time,
JulianPtrArray * vTimeZones, JulianPtrArray * parameters);
/**
* Return the libnls TimeZone that represents this VTimeZone object.
* @return pointer to TimeZone
*/
TimeZone * getNLSTimeZone() const { return (TimeZone *) &*m_NLSTimeZone; }
private:
/**
* selfcheck data-members, and calls createNLSTimeZone().
*/
void selfCheck();
/**
* Creates NLS TimeZone from start month,day,week,time,until.
* TODO: possible bug, may need to call everytime before calling getNLSTimeZone().
*/
void createNLSTimeZone();
/**
* store the data, depending on property name, property value
* parameter names, parameter values, and the current line.
*
* @param strLine current line to process
* @param propName name of property
* @param propVal value of property
* @param parameters property's parameters
*/
void storeData(UnicodeString & strLine, UnicodeString & propName,
UnicodeString & propVal, JulianPtrArray * parameters);
/**
* Helper method called by updateComponent to actually replace
* the property data-members with updatedComponent's data-members.
* @param VTimeZone * updatedComponent
*
* @return virtual void
*/
void updateComponentHelper(VTimeZone * updatedComponent);
/* whether VTimeZone has more that two parts, currently must
* have exactly two parts (DAYLIGHT AND STANDARD)
*/
static t_bool ms_bMORE_THAN_TWO_TZPARTS;
/* -- MEMBERS -- */
/*TimeZone * m_NLSTimeZone;*/
SimpleTimeZone *m_NLSTimeZone;
JulianPtrArray * m_TZPartVctr;
ICalProperty * m_TZID;
ICalProperty * m_LastModified;
ICalProperty * m_TZURL;
JulianPtrArray * m_XTokensVctr; /* TEXT */
JLog * m_Log;
};
#endif /* __VTIMEZONE_H_ */

Просмотреть файл

@ -1,348 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* vtodo.h
* John Sun
* 4/22/98 3:25:47 PM
*/
#ifndef __VTODO_H_
#define __VTODO_H_
#include "datetime.h"
#include "ptrarray.h"
#include "tmbevent.h"
#include "jlog.h"
#include "nscalcoreicalexp.h"
class NS_CAL_CORE_ICAL VTodo : public TimeBasedEvent
{
private:
/*-----------------------------
** MEMBERS
**---------------------------*/
/* Due of first instance of a recurrence */
DateTime m_origDue;
/* Due of my instance of a recurrence */
DateTime m_origMyDue;
/** used for initial parse only to calculate first Due, then discarded */
nsCalDuration * m_TempDuration;
/*-------------------------------------------------
* DATA MEMBER (to augment TimeBasedEvent)
*------------------------------------------------*/
ICalProperty * m_Completed; /* DATETIME */
ICalProperty * m_Due; /* DATETIME */
ICalProperty * m_GEO; /* geographic position (two floats)*/
ICalProperty * m_Location; /* TEXT */
ICalProperty * m_PercentComplete; /* INTEGER [0-100] */
ICalProperty * m_Priority; /* INTEGER >= 0 */
JulianPtrArray * m_ResourcesVctr; /* TEXT */
/*-----------------------------
** PRIVATE METHODS
**---------------------------*/
/**
* store the data, depending on property name, property value
* parameter names, parameter values, and the current line.
* If this method returns FALSE, property not valid.
*
* @param strLine current line to process
* @param propName name of property
* @param propVal value of property
* @param parameters property's parameters
* @param vTimeZones vector of timezones
* @return TRUE if property handled, FALSE otherwise
*/
t_bool storeData(UnicodeString & strLine,
UnicodeString & propName, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
public:
typedef void (VTodo::*SetOp) (UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeCompleted(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeDue(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeDuration(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeGEO(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeLocation(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storePercentComplete(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storePriority(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void storeResources(UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones);
void ApplyStoreOp(void (VTodo::*op) (UnicodeString & strLine,
UnicodeString & propVal, JulianPtrArray * parameters, JulianPtrArray * vTimeZones),
UnicodeString & strLine, UnicodeString & propVal,
JulianPtrArray * parameters, JulianPtrArray * vTimeZones)
{
(this->*op)(strLine, propVal, parameters, vTimeZones);
}
private:
/**
* Sets default data. Currently does following:
* 1) Sets DTEnd to correct value, depending on DURATION, DTSTART
* (see spec on rules)
* 2) Sets TRANSP to TRANSPARENT if anniversary event
*/
void selfCheck();
/**
* Copy constructor.
* @param that VTodo to copy.
*/
VTodo(VTodo & that);
public:
/*-----------------------------
** CONSTRUCTORS and DESTRUCTORS
**---------------------------*/
/**
* Constructor. Create VTodo with initial log file set to initLog.
* @param initLog initial log file pointer
*/
VTodo(JLog * initLog = 0);
/**
* Destructor.
*/
~VTodo();
/* -- Start of ICALComponent interface -- */
/**
* The parse method is the standard interface for ICalComponent
* subclasses to parse from an ICalReader object
* and from the ITIP method type (i.e. PUBLISH, REQUEST, CANCEL, etc.).
* The method type can be set to \"\" if there is no method to be loaded.
* Also accepts a vector of VTimeZone objects to apply to
* the DateTime properties of the component.
* 4-2-98: Added bIgnoreBeginError. If desired to start parsing in Component level,
* it is useful to ignore first "BEGIN:". Setting bIgnoreBeginError to TRUE allows for
* this.
*
* @param brFile ICalReader to load from
* @param sType name of component (VTODO)
* @param parseStatus return parse error status string (normally return "OK")
* @param vTimeZones vector of VTimeZones to apply to datetimes
* @param bIgnoreBeginError TRUE = ignore first "BEGIN:VTODO", FALSE otherwise
* @param encoding the encoding of the stream, default is 7bit.
*
* @return parse error status string (parseStatus)
*/
UnicodeString & parse(ICalReader * brFile, UnicodeString & sMethod,
UnicodeString & parseStatus, JulianPtrArray * vTimeZones = 0,
t_bool bIgnoreBeginError = FALSE,
nsCalUtility::MimeEncoding encoding = nsCalUtility::MimeEncoding_7bit);
/**
* Returns a clone of this object
* @param initLog log file to write errors to
*
* @return clone of this object
*/
virtual ICalComponent * clone(JLog * initLog);
/**
* Return TRUE if component is valid, FALSE otherwise
*
* @return TRUE if is valid, FALSE otherwise
*/
t_bool isValid();
/**
* Print all contents of ICalComponent to human-readable string.
*
* @return string containing human-readable format of ICalComponent
*/
virtual UnicodeString toString();
/**
* Depending on character passed in, returns a string that represents
* the ICAL export string of that property that the character represents, if
* other paramaters not null, then print out information is filtered in several ways
* Attendee print out can be filtered so that only attendee with certain name is printed
* also, can print out the relevant attendees in a delegation message
* (ie. owner, delegate-to, delegate-from)
*
* @param c char of what property to print
* @param sFilterAttendee name of attendee to print
* @param bDelegateRequest TRUE if a delegate request, FALSE if not
* @return ICAL export format of that property
*/
virtual UnicodeString formatChar(t_int32 c,
UnicodeString sFilterAttendee, t_bool delegateRequest = FALSE);
/**
* convert a character to the content of a property in string
* human-readable format
* @param c a character represents a property
* @param dateFmt for formatting datetimes
*
* @return property in human-readable string
*/
virtual UnicodeString toStringChar(t_int32 c, UnicodeString & dateFmt);
/**
* Returns the ICAL_COMPONENT enumeration value of this ICalComponent.
* Each ICalComponent subclass must return a unique ICAL_COMPONENT value.
*
* @return ICAL_COMPONENT value of this component
*/
virtual ICAL_COMPONENT GetType() const { return ICAL_COMPONENT_VTODO ; }
/* -- End of ICALComponent interface -- */
/**
* Overridden virtual method used as wrapper to ICalComponent::format method.
* @param strFmt iCal format string
* @param sFilterAttendee attendee to filter
* @param delegateRequest delegate request = TRUE, FALSE otherwise
*
* @return output iCal formatted export string
*/
virtual UnicodeString formatHelper(UnicodeString & strFmt,
UnicodeString sFilterAttendee, t_bool delegateRequest = FALSE);
/**
* Helper method. Overriden virtual method. Used by subclasses to
* populate recurrence-dependent data. For example, a recurring
* VTodo needs to have DTEnd calculated from recurring
* DTStart. VTodo will overwrite method set DTEnd correctly.
* Abstract difference() method is used to calculate ldiff.
* Need to pass vector of RDate periods in case end value must
* be adjusted in RDATE is a PERIOD value.
* @param start recurrence instance starting time
* @param ldiff abstract difference value
* @param vPer vector of RDate periods
*/
void populateDatesHelper(DateTime start, Date ldiff, JulianPtrArray * vPer);
/* overridden message methods */
virtual UnicodeString cancelMessage();
virtual UnicodeString requestMessage();
virtual UnicodeString requestRecurMessage();
virtual UnicodeString counterMessage();
virtual UnicodeString declineCounterMessage();
virtual UnicodeString addMessage();
virtual UnicodeString refreshMessage(UnicodeString sAttendeeFilter);
virtual UnicodeString allMessage();
virtual UnicodeString replyMessage(UnicodeString sAttendeeFilter);
virtual UnicodeString publishMessage();
virtual UnicodeString publishRecurMessage();
/**
* Overridden method. Calculate difference from start, end time
* For VTodo, this would be Due - DTStart.
*
* @return virtual Date
*/
Date difference();
/**
* Sets default human-readable event format pattern to s.
* @param s new event format pattern
*/
static void setDefaultFmt(UnicodeString s);
/*-----------------------------
** ACCESSORS (GET AND SET)
**---------------------------*/
/* COMPLETED */
DateTime getCompleted() const;
void setCompleted(DateTime s, JulianPtrArray * parameters = 0);
ICalProperty * getCompletedProperty() const { return m_Completed; }
/* DUE */
DateTime getDue() const;
void setDue(DateTime s, JulianPtrArray * parameters = 0);
ICalProperty * getDueProperty() const { return m_Due; }
/* DURATION */
nsCalDuration getDuration() const;
void setDuration(nsCalDuration s, JulianPtrArray * parameters = 0);
/*ICalProperty * getDurationProperty() const { return m_Duration; }*/
/* GEO */
UnicodeString getGEO() const;
void setGEO(UnicodeString s, JulianPtrArray * parameters = 0);
ICalProperty * getGEOProperty() const { return m_GEO; }
/* LOCATION */
UnicodeString getLocation() const;
void setLocation(UnicodeString s, JulianPtrArray * parameters = 0);
ICalProperty * getLocationProperty() const { return m_Location; }
/* PERCENT-COMPLETE */
virtual t_int32 getPercentComplete() const;
void setPercentComplete(t_int32 i, JulianPtrArray * parameters = 0);
ICalProperty * getPercentCompleteProperty() const { return m_PercentComplete; }
/* PRIORITY */
t_int32 getPriority() const;
void setPriority(t_int32 i, JulianPtrArray * parameters = 0);
ICalProperty * getPriorityProperty() const { return m_Priority; }
/* RESOURCES */
void addResources(UnicodeString s, JulianPtrArray * parameters = 0);
void addResourcesProperty(ICalProperty * prop);
JulianPtrArray * getResources() const { return m_ResourcesVctr; }
void addResourcesPropertyVector(UnicodeString & propVal, JulianPtrArray * parameters);
/* MYORIGDUE */
void setMyOrigDue(DateTime d) { m_origMyDue = d; }
DateTime getMyOrigDue() { return m_origMyDue; }
/* ORIGDUE */
void setOrigDue(DateTime d) { m_origDue = d; }
DateTime getOrigDue() { return m_origDue; }
/*-----------------------------
** UTILITIES
**---------------------------*/
virtual void updateComponentHelper(TimeBasedEvent * updatedComponent);
/*-----------------------------
** STATIC METHODS
**---------------------------*/
/*-----------------------------
** OVERLOADED OPERATORS
**---------------------------*/
};
#endif /* __VTODO_H_ */

Просмотреть файл

@ -1,37 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsICalICalendarComponent_h___
#define nsICalICalendarComponent_h___
//21965b60-6912-11d2-943d-006008268c31
#define NS_ICALICALENDARCOMPONENT_IID \
{ 0x21965b60, 0x6912, 0x11d2, \
{ 0x94, 0x3d, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31 } }
#include "nsISupports.h"
class nsICalICalendarComponent : public nsISupports
{
public:
NS_IMETHOD Init() = 0;
NS_IMETHOD_(PRBool) IsValid() = 0;
};
#endif

Просмотреть файл

@ -1,54 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsICalICalendarContainer_h___
#define nsICalICalendarContainer_h___
#include "nsISupports.h"
#include "nsCalICalendarTags.h"
#include "nsICalProperty.h"
#include "ptrarray.h"
// 1ed5e9f0-6912-11d2-943d-006008268c31
#define NS_ICALICALENDARCONTAINER_IID \
{ 0x1ed5e9f0, 0x6912, 0x11d2, \
{0x94, 0x3d, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31} }
/* VCALENDAR, VEVENT, VTODO, VJOURNAL, VTIMEZONE, VFREEBUSY, VALARM should implement this */
class nsICalICalendarContainer : public nsISupports
{
public:
/**
* Initialize the CALICALENDARContainer
* @result The result of the initialization, NS_Ok if no errors
*/
NS_IMETHOD Init() = 0;
// for now
NS_IMETHOD_(PRBool) StoreProperty(nsCalICalendarTag tag, nsICalProperty * prop,
JulianPtrArray * vTimeZones) = 0;
};
#endif /* nsICALICalendarContainer_h___ */

Просмотреть файл

@ -1,60 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsICalProperty_h___
#define nsICalProperty_h___
#include "nsISupports.h"
#include "nsString.h"
#include "ptrarray.h"
#include "prprty.h"
//1d950490-6912-11d2-943d-006008268c31
#define NS_ICALPROPERTY_IID \
{ 0x1d950490, 0x6912, 0x11d2, \
{ 0x94, 0x3d, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31 } }
// todo: xpcom UnicodeString, JulianPtrArray or use something else (nsIVector, nsString)
class nsICalProperty : public nsISupports
{
public:
NS_IMETHOD Init() = 0;
NS_IMETHOD SetParameters(JulianPtrArray * parameters) = 0;
NS_IMETHOD_(JulianPtrArray *) GetParameters() = 0;
NS_IMETHOD_(void *) GetValue() const = 0;
NS_IMETHOD SetValue(void * value) = 0;
NS_IMETHOD_(nsICalProperty *) Clone() = 0;
NS_IMETHOD_(PRBool) IsValid() = 0;
NS_IMETHOD_(nsString &) ToString(nsString & out) = 0;
NS_IMETHOD_(nsString &) ToICALString(nsString & out) = 0;
NS_IMETHOD_(nsString &) ToICALString(nsString & sProp, nsString & out) = 0;
NS_IMETHOD_(ICalProperty *) GetICalProperty() const = 0;
};
#endif

Просмотреть файл

@ -1,56 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsICalStandardProperty_h___
#define nsICalStandardProperty_h___
#include "nsISupports.h"
#include "nsString.h"
#include "ptrarray.h"
#include "icalprm.h"
// 1e2012a0-6912-11d2-943d-006008268c31
#define NS_ICALSTANDARDPROPERTY_IID \
{ 0x1e2012a0, 0x6912, 0x11d2, \
{ 0x94, 0x3d, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31 } }
// todo: xpcom UnicodeString, JulianPtrArray or use something else (nsIVector, nsString)
class nsICalStandardProperty : public nsISupports
{
public:
NS_IMETHOD Init() = 0;
NS_IMETHOD SetParameters(JulianPtrArray * parameters) = 0;
NS_IMETHOD AddParameter(ICalParameter * parameter) = 0;
NS_IMETHOD Parse(nsString & in) = 0;
// no static methods for now
};
#endif

Просмотреть файл

@ -1,56 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsICalTimeBasedEvent_h___
#define nsICalTimeBasedEvent_h___
#include "nsISupports.h"
#include "nsICalProperty.h"
#include "ptrarray.h"
#include "unistring.h"
//208f8720-6912-11d2-943d-006008268c31
#define NS_ICALTIMEBASEDEVENT_IID \
{ 0x208f8720, 0x6912, 0x11d2, \
{ 0x94, 0x3d, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31 } }
class nsICalTimeBasedEvent : public nsISupports
{
public:
NS_IMETHOD Init() = 0;
// for now.
/*
NS_IMETHOD_(nsIDateTime *) GetDTStart() const = 0;
NS_IMETHOD SetDTStart(nsIDateTime * d, JulianPtrArray * parameters) = 0;
NS_IMETHOD SetDTStartProperty(nsICalDateTimeProperty * property) = 0;
*/
NS_IMETHOD_(PRInt32) GetSequence() const = 0;
NS_IMETHOD SetSequence(PRInt32 i, JulianPtrArray * parameters) = 0;
NS_IMETHOD SetSequenceProperty(nsICalProperty * property) = 0;
NS_IMETHOD SelfCheck() = 0;
};
#endif

Просмотреть файл

@ -1,48 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsICalVEvent_h___
#define nsICalVEvent_h___
#include "nsISupports.h"
#include "vevent.h"
//20355f10-6912-11d2-943d-006008268c31
#define NS_ICALVEVENT_IID \
{ 0x20355f10, 0x6912, 0x11d2, \
{ 0x94, 0x3d, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31 } }
class nsICalVEvent : public nsISupports
{
public:
// for now.
NS_IMETHOD_(DateTime) GetDTEnd() const = 0;
NS_IMETHOD SetDTEnd(DateTime d, JulianPtrArray * parameters) = 0;
NS_IMETHOD SetDTEndProperty(nsICalProperty * property) = 0;
NS_IMETHOD_(VEvent *) GetICalEvent() = 0;
NS_IMETHOD_(PRBool) IsValid() = 0;
};
#endif

Просмотреть файл

@ -1,142 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsICalendar_h___
#define nsICalendar_h___
#include "nsISupports.h"
//#include "nsString.h"
#include "unistring.h"
#include "ptrarray.h"
#include "nscal.h"
#include "nsICalProperty.h"
//#include "nsICalStringProperty.h"
#include "nsICalVEvent.h"
//1cc84170-6912-11d2-943d-006008268c31
#define NS_ICALENDAR_IID \
{ 0x1cc84170, 0x6912, 0x11d2, \
{ 0x94, 0x3d, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31 } }
// todo: xpcom UnicodeString, JulianPtrArray or use something else (nsIVector, nsString)
class nsICalendar : public nsISupports
{
public:
NS_IMETHOD Init() = 0;
/*
NS_IMETHOD Export(const char * filename, t_bool & status) = 0;
NS_IMETHOD_(nsICalendar *) Clone() = 0;
*/
NS_IMETHOD_(UnicodeString) GetCalScale() const = 0;
NS_IMETHOD SetCalScale(UnicodeString s, JulianPtrArray * parameters) = 0;
//NS_IMETHOD SetCalScaleProperty(nsICalStringProperty * property) = 0;
//NS_IMETHOD_(nsICalProperty *) GetCalScaleProperty() const = 0;
NS_IMETHOD_(UnicodeString) GetVersion() const = 0;
NS_IMETHOD SetVersion(UnicodeString s, JulianPtrArray * parameters) = 0;
NS_IMETHOD SetVersionProperty(nsICalProperty * property) = 0;
//NS_IMETHOD_(nsICalProperty *) GetVersionProperty() const = 0;
NS_IMETHOD_(UnicodeString) GetProdid() const = 0;
NS_IMETHOD SetProdid(UnicodeString s, JulianPtrArray * parameters) = 0;
//NS_IMETHOD_(nsICalProperty *) GetProdidProperty() const = 0;
NS_IMETHOD SetMethod(PRInt32 i) = 0;
NS_IMETHOD_(PRInt32) GetMethod() const = 0;
NS_IMETHOD AddEvent(nsICalVEvent * event) = 0;
NS_IMETHOD_(NSCalendar *) GetNSCalendar() const = 0;
/*
NS_IMETHOD AddXTokens(UnicodeString s) = 0;
NS_IMETHOD_(JulianPtrArray *) GetXTokens() const = 0;
NS_IMETHOD SetEventsLastUpdatedFromServer(nsIDateTime d) = 0;
NS_IMETHOD_(nsIDateTime) GetEventsLastUpdatedFromServer() = 0;
NS_IMETHOD_(nsIDateTime) GetEventsSpanStart() = 0;
NS_IMETHOD_(nsIDateTime) GetEventsSpanEnd() = 0;
// todo: xpcom JLog&& ICalComponent
//NS_IMETHOD_(nsICalLog*) GetLog() = 0;
//NS_IMETHOD_(JulianPtrArray *) GetLogVector(nsICalICalendarComponent * ic);
//NS_IMETHOD_(JulianPtrArray *) GetLogVector();
NS_IMETHOD_(nsString &) GetCurl() const = 0;
NS_IMETHOD SetCurl(const char* ps) = 0;
NS_IMETHOD SetCurl(const nsString& s) = 0;
NS_IMETHOD_(UnicodeString) ToString() = 0;
NS_IMETHOD_(UnicodeString &) CreateCalendarHeader(UnicodeString & sResult);
NS_IMETHOD_(UnicodeString) ToICALString() = 0;
NS_IMETHOD_(UnicodeString) ToFilteredICALString(UnicodeString componentPattern) = 0;
NS_IMETHOD_(nsICalVFreebusy *) CreateVFreebusy(nsIDateTime start, nsIDateTime end) = 0;
NS_IMETHOD CalculateVFreebusy(nsICalVFreebusy * toFillIn) = 0;
NS_IMETHOD_(nsICalVFreebusy *) GetVFreebusy(UnicodeString sUID, PRInt32 iSeqNo) = 0;
NS_IMETHOD_(nsICalVFreebusy *) GetEvent(UnicodeString sUID, PRInt32 iSeqNo) = 0;
NS_IMETHOD_(nsICalVFreebusy *) GetTodo(UnicodeString sUID, PRInt32 iSeqNo) = 0;
NS_IMETHOD_(nsICalVFreebusy *) GetJournal(UnicodeString sUID, PRInt32 iSeqNo) = 0;
NS_IMETHOD AddEvent(nsICalICalendarComponent * i) = 0;
NS_IMETHOD AddTodo(nsICalICalendarComponent * i) = 0;
NS_IMETHOD AddJournal(nsICalICalendarComponent * i) = 0;
NS_IMETHOD AddVFreebusy(nsICalICalendarComponent * i) = 0;
NS_IMETHOD AddTimeZone(nsICalICalendarComponent * i) = 0;
NS_IMETHOD AddEventList(JulianPtrArray * v) = 0;
NS_IMETHOD_(JulianPtrArray *) GetEvents() const = 0;
NS_IMETHOD_(JulianPtrArray *) ChangeEventsOwnership() = 0;
NS_IMETHOD_(JulianPtrArray *) GetTodos() const = 0;
NS_IMETHOD_(JulianPtrArray *) GetJournals() const = 0;
NS_IMETHOD_(JulianPtrArray *) GetVFreebusies() const = 0;
NS_IMETHOD_(JulianPtrArray *) GetTimeZones() const = 0;
NS_IMETHOD GetUniqueUIDs(JulianPtrArray * retUID, PRInt32 iCalComponentType);
NS_IMETHOD GetEvents(JulianPtrArray * out, UnicodeString & sUID) const = 0;
NS_IMETHOD GetTodos(JulianPtrArray * out, UnicodeString & sUID) const = 0;
NS_IMETHOD GetJournals(JulianPtrArray * out, UnicodeString & sUID) const = 0;
NS_IMETHOD GetEventsByComponentID(JulianPtrArray * out, UnicodeString & sUID,
UnicodeString & sRecurrenceID,
UnicodeString & sModifier) const = 0;
NS_IMETHOD GetEventsByRange(JulianPtrArray * out,
nsIDateTime start, nsIDateTime end) const = 0;
NS_IMETHOD SortComponentsByDTStart(PRInt32 iCalComponentType);
NS_IMETHOD SortComponentsByUID(PRInt32 iCalComponentType);
NS_IMETHOD UpdateEventsRange(nsICalVEvent * v) = 0;
NS_IMETHOD UpdateEventsRange(nsIDateTime ds, nsIDateTime de) = 0;
*/
};
#endif

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,118 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
// bprprty.cpp
// John Sun
// 3:34 PM February 12 1998
#include "stdafx.h"
#include "jdefines.h"
#include "bprprty.h"
#include "prprty.h"
//---------------------------------------------------------------------
// private never use
BooleanProperty::BooleanProperty()
{
PR_ASSERT(FALSE);
}
//---------------------------------------------------------------------
BooleanProperty::BooleanProperty(const BooleanProperty & that)
{
m_Boolean = that.m_Boolean;
setParameters(that.m_vParameters);
}
//---------------------------------------------------------------------
BooleanProperty::BooleanProperty(t_bool value, JulianPtrArray * parameters)
: StandardProperty(parameters)
{
m_Boolean = value;
}
//---------------------------------------------------------------------
BooleanProperty::~BooleanProperty()
{
}
//---------------------------------------------------------------------
void * BooleanProperty::getValue() const
{
return (void *) &m_Boolean;
}
//---------------------------------------------------------------------
void BooleanProperty::setValue(void * value)
{
PR_ASSERT(value != 0);
if (value != 0)
{
m_Boolean = *((t_bool *) value);
}
}
//---------------------------------------------------------------------
ICalProperty * BooleanProperty::clone(JLog * initLog)
{
if (initLog) {} // NOTE: Remove later to avoid warnings
return new BooleanProperty(*this);
}
//---------------------------------------------------------------------
t_bool BooleanProperty::isValid()
{
return TRUE;
}
//---------------------------------------------------------------------
UnicodeString & BooleanProperty::toString(UnicodeString & out)
{
if (m_Boolean)
out = "TRUE";
else
out = "FALSE";
return out;
}
//---------------------------------------------------------------------
UnicodeString &
BooleanProperty::toString(UnicodeString & dateFmt, UnicodeString & out)
{
// NOTE: remove it later, gets rid of compiler warning
if (dateFmt.size() > 0) {}
return toString(out);
}
//---------------------------------------------------------------------
UnicodeString & BooleanProperty::toExportString(UnicodeString & out)
{
return toString(out);
}
//---------------------------------------------------------------------

Просмотреть файл

@ -1,188 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
// bydmgntr.cpp
// John Sun
// 4:08 PM February 3 1998
#include "stdafx.h"
#include "jdefines.h"
#include <math.h>
#include <assert.h>
#include "bydmgntr.h"
#include "jutility.h"
#include "calendar.h"
ByDayMonthlyGenerator::ByDayMonthlyGenerator()
: DateGenerator(nsCalUtility::RT_MONTHLY, 0),
m_aiParams(0),
m_iWkSt((t_int32) Calendar::SUNDAY)
{}
//---------------------------------------------------------------------
t_int32
ByDayMonthlyGenerator::getInterval() const { return nsCalUtility::RT_DAILY; }
//---------------------------------------------------------------------
// TODO: crash proof it
t_bool
ByDayMonthlyGenerator::generate(DateTime * start, JulianPtrArray & dateVector,
DateTime * until)
{
DateTime * t, * nextWkSt;
t_int32 i, iMonth = 0, iMonth2 = 0;
t_bool bOldWkSt;
t_int32 temp;
PR_ASSERT(start != 0);
PR_ASSERT(m_aiParams != 0);
// bulletproof code
if (start == 0 || m_aiParams == 0)
{
return FALSE;
}
// if (FALSE) TRACE("start = %s\r\n", start->toString().toCString(""));
t = new DateTime(start->getTime()); PR_ASSERT(t != 0);
// bulletproof code
if (t == 0)
{
return FALSE;
}
nextWkSt = new DateTime(start->getTime()); PR_ASSERT(nextWkSt != 0);
// bulletproof code
if (nextWkSt == 0)
{
if (t != 0) { delete t; t = 0; }
return FALSE;
}
for (i = 0; i < m_iParamsLen; i++)
{
t->setTime(start->getTime());
//if (FALSE) TRACE("t = %s\r\n", t->toString().toCString(""));
//if (FALSE) TRACE("nextWkSt = %s\r\n", nextWkSt->toString().toCString(""));
if (m_aiParams[i][1] >= 0)
{
t->add(Calendar::DATE, -(t->get(Calendar::DATE)) + 1);
}
else
{
t->findLastDayOfMonth();
}
//if (FALSE) TRACE("t = %s\r\n", t->toString().toCString(""));
iMonth = t->get(Calendar::MONTH);
if (m_aiParams[i][1] != 0)
{
while (t->get(Calendar::DAY_OF_WEEK) != m_aiParams[i][0])
t->add(Calendar::DATE, (m_aiParams[i][1] > 0) ? 1 : -1);
//if (FALSE) TRACE("t = %s\r\n", t->toString().toCString(""));
// NOTE: so not to call abs (to fix HPUX-compiling problem), replaces below commented out code
temp = m_aiParams[i][1];
if (temp < 0)
temp = 0 - temp;
t->add(Calendar::DAY_OF_YEAR, (temp - 1) *
(m_aiParams[i][1] > 0 ? 1 : -1) * 7);
/// replacing this code with above
//t->add(Calendar::DAY_OF_YEAR, (abs(m_aiParams[i][1]) - 1) *
// (m_aiParams[i][1] > 0 ? 1 : -1) * 7);
//if (FALSE) TRACE("t = %s\r\n", t->toString().toCString(""));
if (until != 0 && until->isValid() && t->after(until))
{
delete t; t = 0;
delete nextWkSt; nextWkSt = 0;
return TRUE;
}
else
{
// check also still in same month!
// prevents bug if asking 5MO, but no 5th monday in this month
if ((t->after(start) || t->equals(start)) &&
(t->get(Calendar::MONTH) == iMonth)
)
{
dateVector.Add(new DateTime(t->getTime()));
}
}
}
else
{
nextWkSt->setTime(t->getTime());
nextWkSt->moveTo(m_iWkSt, 1, TRUE);
while (t->get(Calendar::MONTH) == iMonth)
{
//if (FALSE) TRACE("nextWkSt = %s\r\n", nextWkSt->toString().toCString(""));
//if (FALSE) TRACE("t = %s\r\n", t->toString().toCString(""));
bOldWkSt = TRUE;
if (until != 0 && until->isValid() && t->after(until))
{
delete t; t = 0;
delete nextWkSt; nextWkSt = 0;
return TRUE;
}
else if (t->get(Calendar::DAY_OF_WEEK) == m_aiParams[i][0] &&
(t->after(start) || t->equals(start)) &&
!(t->after(nextWkSt)))
{
dateVector.Add(new DateTime(t->getTime()));
nextWkSt->setTime(t->getTime());
nextWkSt->moveTo(m_iWkSt, 1, TRUE);
}
else if (t->after(nextWkSt))
{
nextWkSt->setTime(t->getTime());
nextWkSt->moveTo(m_iWkSt, 1, TRUE);
bOldWkSt = FALSE;
}
if ((bOldWkSt) && (!(t->after(nextWkSt))))
{
iMonth2 = t->get(Calendar::DAY_OF_MONTH);
t->add(Calendar::DATE, 1);
if (iMonth2 == t->get(Calendar::DAY_OF_MONTH))
t->add(Calendar::DATE, -1);
}
}
}
}
delete t; t = 0;
delete nextWkSt; nextWkSt = 0;
return FALSE;
}
//---------------------------------------------------------------------

Просмотреть файл

@ -1,85 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
// bydwgntr.cpp
// John Sun
// 4:10 PM February 3 1998
#include "stdafx.h"
#include "jdefines.h"
#include <assert.h>
#include "bydwgntr.h"
#include "jutility.h"
ByDayWeeklyGenerator::ByDayWeeklyGenerator()
:
DateGenerator(nsCalUtility::RT_WEEKLY, 0),
m_aiParams(0),
m_iWkSt((t_int32) Calendar::SUNDAY)
{}
//---------------------------------------------------------------------
t_int32
ByDayWeeklyGenerator::getInterval() const { return nsCalUtility::RT_DAILY; }
//---------------------------------------------------------------------
t_bool
ByDayWeeklyGenerator::generate(DateTime * start, JulianPtrArray & dateVector,
DateTime * until)
{
DateTime * t, * nextWkSt;
t_int32 i;
PR_ASSERT(start != 0);
PR_ASSERT(m_aiParams != 0);
if (start == 0 || m_aiParams == 0)
{
return FALSE;
}
t = new DateTime(start->getTime()); PR_ASSERT(t != 0);
nextWkSt = new DateTime(t->getTime()); PR_ASSERT(nextWkSt != 0);
nextWkSt->moveTo(m_iWkSt, 1, TRUE);
for (i = 0; i < m_iParamsLen; i++)
{
t->setTime(start->getTime());
t->moveTo(m_aiParams[i][0], 1, FALSE);
if (until != 0 && until->isValid() && t->after(until))
{
delete t; t = 0;
delete nextWkSt; nextWkSt = 0;
return TRUE;
}
if ((t->after(start) || t->equals(start)) && t->before(nextWkSt))
{
dateVector.Add(new DateTime(t->getTime()));
}
}
delete t; t = 0;
delete nextWkSt; nextWkSt = 0;
return FALSE;
}
//---------------------------------------------------------------------

Просмотреть файл

@ -1,173 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
// bydygntr.cpp
// John Sun
// 4:11 PM February 3 1998
#include "stdafx.h"
#include "jdefines.h"
#include <math.h>
#include <assert.h>
#include "bydygntr.h"
#include "jutility.h"
ByDayYearlyGenerator::ByDayYearlyGenerator()
:
DateGenerator(nsCalUtility::RT_YEARLY, 0),
m_aiParams(0),
m_iWkSt((t_int32) Calendar::SUNDAY)
{}
//---------------------------------------------------------------------
t_int32
ByDayYearlyGenerator::getInterval() const { return nsCalUtility::RT_DAILY; }
//---------------------------------------------------------------------
// TODO: crash proof
t_bool
ByDayYearlyGenerator::generate(DateTime * start, JulianPtrArray & dateVector,
DateTime * until)
{
DateTime * t, * nextWkSt;
t_int32 i, k, iYear = 0, iDayOfYear = 0;
t_int32 iAbsMod = -1;
t_bool bOldWkSt = FALSE;
t_int32 temp = 0;
PR_ASSERT(start != 0);
PR_ASSERT(m_aiParams != 0);
if (start == 0 || m_aiParams == 0)
{
return FALSE;
}
t = new DateTime(start->getTime()); PR_ASSERT(t != 0);
// bulletproof code
if (t == 0)
{
return FALSE;
}
nextWkSt = new DateTime(start->getTime()); PR_ASSERT(nextWkSt != 0);
// bulletproof code
if (nextWkSt == 0)
{
if (t != 0) { delete t; t = 0; }
return FALSE;
}
for (i = 0; i < m_iParamsLen; i++)
{
k = 0;
t->setTime(start->getTime());
if (m_aiParams[i][1] >= 0)
t->add(Calendar::DAY_OF_YEAR,
-(t->get(Calendar::DAY_OF_YEAR)) + 1);
else
t->findLastDayOfYear();
iYear = t->get(Calendar::YEAR);
if (m_aiParams[i][1] != 0)
{
// NOTE: avoid using abs to fix HPUX compiling problems
temp = m_aiParams[i][1];
if (temp < 0)
temp = 0 - temp;
iAbsMod = temp - 1;
// replacing below code with above
//iAbsMod = abs(m_aiParams[i][1]) - 1;
while ((k != iAbsMod) ||
(t->get(Calendar::DAY_OF_WEEK) != m_aiParams[i][0]))
{
if (t->get(Calendar::DAY_OF_WEEK) == m_aiParams[i][0])
k++;
if (m_aiParams[i][1] > 0)
t->add(Calendar::DAY_OF_YEAR, 1);
else
t->add(Calendar::DAY_OF_YEAR, -1);
if (until != 0 && until->isValid() && t->after(until))
{
delete t; t = 0;
delete nextWkSt; nextWkSt = 0;
return TRUE;
}
}
// check also still in same year!
// prevents bug if asking 53MO, but no 53th monday in this year
if ((t->after(start) || t->equals(start)) &&
(t->get(Calendar::YEAR) == iYear))
{
dateVector.Add(new DateTime(t->getTime()));
}
}
else
{
nextWkSt->setTime(start->getTime());
nextWkSt->moveTo(m_iWkSt, 1, TRUE);
while (t->get(Calendar::YEAR) == iYear)
{
bOldWkSt = TRUE;
if (until != 0 && until->isValid() && t->after(until))
{
delete t; t = 0;
delete nextWkSt; nextWkSt = 0;
return TRUE;
}
else if (t->get(Calendar::DAY_OF_WEEK) == m_aiParams[i][0] &&
(t->after(start) || t->equals(start)) &&
!(t->after(nextWkSt)))
{
dateVector.Add(new DateTime(t->getTime()));
nextWkSt->setTime(t->getTime());
nextWkSt->moveTo(m_iWkSt, 1, TRUE);
}
else if (t->after(nextWkSt))
{
nextWkSt->setTime(t->getTime());
nextWkSt->moveTo(m_iWkSt, 1, TRUE);
bOldWkSt = FALSE;
}
if ((bOldWkSt) && (!t->after(nextWkSt)))
{
iDayOfYear = t->get(Calendar::DAY_OF_YEAR);
t->add(Calendar::DATE, 1);
if (iDayOfYear == t->get(Calendar::DAY_OF_YEAR))
t->add(Calendar::DAY_OF_YEAR, -1);
}
}
}
}
delete t; t = 0;
delete nextWkSt; nextWkSt = 0;
return FALSE;
}
//---------------------------------------------------------------------

Просмотреть файл

@ -1,104 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
// byhgntr.cpp
// John Sun
// 4:18 PM February 3 1998
#include "stdafx.h"
#include "jdefines.h"
#include <assert.h>
#include "byhgntr.h"
#include "jutility.h"
#include "calendar.h"
ByHourGenerator::ByHourGenerator()
:
DateGenerator(nsCalUtility::RT_DAILY, 0),
m_aiParams(0)
{}
//---------------------------------------------------------------------
t_int32
ByHourGenerator::getInterval() const { return nsCalUtility::RT_HOURLY; }
//---------------------------------------------------------------------
t_bool
ByHourGenerator::generate(DateTime * start, JulianPtrArray & dateVector,
DateTime * until)
{
DateTime * t;
t_int32 i;
DateTime dt;
PR_ASSERT(start != 0);
PR_ASSERT(m_aiParams != 0);
if (start == 0 || m_aiParams == 0)
{
return FALSE;
}
t = new DateTime(start->getTime()); PR_ASSERT(t != 0);
for (i = 0; i < m_iParamsLen; i++)
{
t->setTime(start->getTime());
while (start->get((Calendar::EDateFields) m_iSpan) ==
t->get((Calendar::EDateFields) m_iSpan))
{
// only allow 0-23, no negatives allowed, using hour_of_day
// instead of hour since hour does seem to update immediately
t->set(Calendar::HOUR_OF_DAY, m_aiParams[i]);
/*
// allow negatives (not in spec anymore, so commented out)
if (m_aiParams[i] > 0)
t->set(Calendar::HOUR_OF_DAY, m_aiParams[i]);
else
t->set(Calendar::HOUR_OF_DAY, 24 + m_aiParams[i]);
*/
if (until != 0 && until->isValid() && t->after(until))
{
delete t; t = 0;
return TRUE;
}
else if (t->after(start) || t->equals(start))
{
//dt = *t;
//dateVector.Add(t);
//delete t;
dateVector.Add(new DateTime(t->getTime()));
}
t->add(Calendar::DAY_OF_YEAR, 1);
}
}
delete t; t = 0;
return FALSE;
}
//---------------------------------------------------------------------

Просмотреть файл

@ -1,100 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
// bymdgntr.cpp
// John Sun
// 4:08 PM February 3 1998
#include "stdafx.h"
#include "jdefines.h"
#include <assert.h>
#include "bymdgntr.h"
#include "jutility.h"
ByMonthDayGenerator::ByMonthDayGenerator()
:
DateGenerator(nsCalUtility::RT_MONTHLY, 0),
m_aiParams(0)
{}
//---------------------------------------------------------------------
t_int32
ByMonthDayGenerator::getInterval() const { return nsCalUtility::RT_DAILY; }
//---------------------------------------------------------------------
t_bool
ByMonthDayGenerator::generate(DateTime * start, JulianPtrArray & dateVector,
DateTime * until)
{
DateTime * t;
t_int32 i, iMonth = 0;
PR_ASSERT(start != 0);
PR_ASSERT(m_aiParams != 0);
if (start == 0 || m_aiParams == 0)
{
return FALSE;
}
t = new DateTime(start->getTime()); PR_ASSERT(t != 0);
//if (FALSE) TRACE("t = %s\r\n", t->toString().toCString(""));
for (i = 0; i < m_iParamsLen; i++)
{
t->setTime(start->getTime());
//if (FALSE) TRACE("t = %s\r\n", t->toString().toCString(""));
if (m_aiParams[i] > 0)
t->add(Calendar::DATE, - (t->get(Calendar::DATE)) + 1);
else
t->findLastDayOfMonth();
//if (FALSE) TRACE("t = %s\r\n", t->toString().toCString(""));
iMonth = t->get(Calendar::MONTH);
t->add(Calendar::DATE,
(m_aiParams[i] > 0) ? m_aiParams[i] - 1 : m_aiParams[i] + 1);
//if (FALSE) TRACE("t = %s\r\n", t->toString().toCString(""));
if (until != 0 && until->isValid() && t->after(until))
{
delete t; t = 0;
return TRUE;
}
// make sure in same month
if ((t->after(start) || t->equals(start)) &&
(t->get(Calendar::MONTH) == iMonth))
{
dateVector.Add(new DateTime(t->getTime()));
}
}
delete t; t = 0;
return FALSE;
}
//---------------------------------------------------------------------

Просмотреть файл

@ -1,97 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
// bymgntr.cpp
// John Sun
// 12:16 PM February 4 1998
#include "stdafx.h"
#include "jdefines.h"
#include <assert.h>
#include "bymgntr.h"
#include "jutility.h"
#include "calendar.h"
ByMinuteGenerator::ByMinuteGenerator()
:
DateGenerator(nsCalUtility::RT_HOURLY, 0),
m_aiParams(0)
{}
//---------------------------------------------------------------------
t_int32
ByMinuteGenerator::getInterval() const { return nsCalUtility::RT_MINUTELY; }
//---------------------------------------------------------------------
t_bool
ByMinuteGenerator::generate(DateTime * start, JulianPtrArray & dateVector,
DateTime * until)
{
DateTime * t;
t_int32 i;
PR_ASSERT(start != 0);
PR_ASSERT(m_aiParams != 0);
if (start == 0 || m_aiParams == 0)
{
return FALSE;
}
t = new DateTime(start->getTime()); PR_ASSERT(t != 0);
for (i = 0; i < m_iParamsLen; i++)
{
t->setTime(start->getTime());
while (start->get((Calendar::EDateFields) m_iSpan) ==
t->get((Calendar::EDateFields) m_iSpan))
{
// only allow 0-59, no negatives allowed
t->set(Calendar::MINUTE, m_aiParams[i]);
/*
// allow negatives (not in spec anymore, so commented out)
if (m_aiParams[i] >= 0)
t->set(Calendar::MINUTE, m_aiParams[i]);
else
t->set(Calendar::MINUTE, 60 + m_aiParams[i]);
*/
if (until != 0 && until->isValid() && t->after(until))
{
delete t; t = 0;
return TRUE;
}
else if (t->after(start) || t->equals(start))
{
dateVector.Add(new DateTime(t->getTime()));
}
t->add(Calendar::HOUR, 1);
}
}
delete t; t = 0;
return FALSE;
}
//---------------------------------------------------------------------

Просмотреть файл

@ -1,91 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
// bymogntr.cpp
// John Sun
// 4:21 PM February 3 1998
#include "stdafx.h"
#include "jdefines.h"
#include <assert.h>
#include "bymogntr.h"
#include "jutility.h"
ByMonthGenerator::ByMonthGenerator()
:
DateGenerator(nsCalUtility::RT_YEARLY, 0),
m_aiParams(0)
{}
//---------------------------------------------------------------------
t_int32
ByMonthGenerator::getInterval() const { return nsCalUtility::RT_MONTHLY; }
//---------------------------------------------------------------------
t_bool
ByMonthGenerator::generate(DateTime * start, JulianPtrArray & dateVector,
DateTime * until)
{
t_int32 i, iMonth = 0;
DateTime * t;
PR_ASSERT(start != 0);
PR_ASSERT(m_aiParams != 0);
if (start == 0 || m_aiParams == 0)
{
return FALSE;
}
t = new DateTime(start->getTime()); PR_ASSERT(t != 0);
for (i = 0; i < m_iParamsLen; i++)
{
t->setTime(start->getTime());
// negative month don't exist, only [1-12]
//if (FALSE) TRACE("t = %s\r\n", t->toString().toCString(""));
t->add(Calendar::MONTH, m_aiParams[i] - t->get(Calendar::MONTH) - 1);
t->add(Calendar::DATE, - t->get(Calendar::DATE) + 1);
//if (FALSE) TRACE("t = %s\r\n", t->toString().toCString(""));
iMonth = t->get(Calendar::MONTH);
while (t->get(Calendar::MONTH) == iMonth)
{
if (until != 0 && until->isValid() & t->after(until))
{
delete t; t = 0;
return TRUE;
}
if (t->after(start) || t->equals(start))
dateVector.Add(new DateTime(t->getTime()));
t->add(Calendar::DATE, 1);
}
}
delete t; t = 0;
return FALSE;
}
//---------------------------------------------------------------------

Просмотреть файл

@ -1,89 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
// bywngntr.cpp
// John Sun
// 4:23 PM February 3 1998
#include "stdafx.h"
#include "jdefines.h"
#include <assert.h>
#include "bywngntr.h"
#include "jutility.h"
ByWeekNoGenerator::ByWeekNoGenerator()
:
DateGenerator(nsCalUtility::RT_YEARLY, 0),
m_aiParams(0)
{}
//---------------------------------------------------------------------
t_int32
ByWeekNoGenerator::getInterval() const { return nsCalUtility::RT_WEEKLY; }
//---------------------------------------------------------------------
t_bool
ByWeekNoGenerator::generate(DateTime * start, JulianPtrArray & dateVector,
DateTime * until)
{
DateTime * t;
t_int32 i, k;
PR_ASSERT(start != 0);
PR_ASSERT(m_aiParams != 0);
if (start == 0 || m_aiParams == 0)
{
return FALSE;
}
t = new DateTime(start->getTime()); PR_ASSERT(t != 0);
for (i = 0; i < m_iParamsLen; i++)
{
t->setTime(start->getTime());
t->setByISOWeek(m_aiParams[i]);
for (k = 0; k < 7; k++)
{
if (until != 0 && until->isValid() && t->after(until) && i == m_iParamsLen - 1)
{
delete t; t = 0;
return TRUE;
}
else if (until != 0 && until->isValid() && t->after(until))
{
//delete t;
break;
}
if (t->after(start) || t->equals(start))
dateVector.Add(new DateTime(t->getTime()));
t->add(Calendar::DAY_OF_YEAR, 1);
}
}
delete t; t = 0;
return FALSE;
}
//---------------------------------------------------------------------

Просмотреть файл

@ -1,102 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
// byydgntr.cpp
// John Sun
// 4:25 PM February 3 1998
#include "stdafx.h"
#include "jdefines.h"
#include <assert.h>
#include "byydgntr.h"
#include "jutility.h"
ByYearDayGenerator::ByYearDayGenerator()
:
DateGenerator(nsCalUtility::RT_YEARLY, 0),
m_aiParams(0)
{}
//---------------------------------------------------------------------
t_int32
ByYearDayGenerator::getInterval() const { return nsCalUtility::RT_DAILY; }
//---------------------------------------------------------------------
t_bool
ByYearDayGenerator::generate(DateTime * start, JulianPtrArray & dateVector,
DateTime * until)
{
DateTime * t;
t_int32 i, iYear = 0;
PR_ASSERT(start != 0);
PR_ASSERT(m_aiParams != 0);
if (start == 0 || m_aiParams == 0)
{
return FALSE;
}
t = new DateTime(start->getTime()); PR_ASSERT(t != 0);
//if (FALSE) TRACE("t = %s\r\n", t->toString().toCString(""));
for (i = 0; i < m_iParamsLen; i++)
{
t->setTime(start->getTime());
if (m_aiParams[i] > 0)
{
t->add(Calendar::DAY_OF_YEAR,
- (t->get(Calendar::DAY_OF_YEAR)) + 1);
}
else
{
t->findLastDayOfYear();
}
//if (FALSE) TRACE("t = %s\r\n", t->toString().toCString(""));
iYear = t->get(Calendar::YEAR);
t->add(Calendar::DAY_OF_YEAR,
(m_aiParams[i] > 0) ? m_aiParams[i] - 1 : m_aiParams[i] + 1);
//if (FALSE) TRACE("t = %s\r\n", t->toString().toCString(""));
if (until != 0 && until->isValid() & t->after(until))
{
delete t; t = 0;
return TRUE;
}
// make sure in same year
if ((t->after(start) || t->equals(start)) &&
(t->get(Calendar::YEAR) == iYear))
{
dateVector.Add(new DateTime(t->getTime()));
}
}
delete t; t = 0;
return FALSE;
}
//---------------------------------------------------------------------

Просмотреть файл

@ -1,540 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* capiredr.cpp
* John Sun
* 4/16/98 3:42:19 PM
*/
#include "stdafx.h"
#include "capiredr.h"
#include "nspr.h"
//#include "xp_mcom.h"
const t_int32 ICalCAPIReader::m_MAXBUFFERSIZE = 1024;
const t_int32 ICalCAPIReader::m_NOMORECHUNKS = 404;
//---------------------------------------------------------------------
ICalCAPIReader::ICalCAPIReader()
{
PR_ASSERT(FALSE);
}
//---------------------------------------------------------------------
void
ICalCAPIReader::AddChunk(UnicodeString * u)
{
if (m_Chunks == 0)
m_Chunks = new JulianPtrArray();
PR_ASSERT(m_Chunks != 0);
if (m_Chunks != 0)
{
m_Chunks->Add(u);
}
}
//---------------------------------------------------------------------
ICalCAPIReader::ICalCAPIReader(PRMonitor * monitor,
nsCalUtility::MimeEncoding encoding)
{
m_Monitor = monitor;
m_bFinished = FALSE;
m_ChunkIndex = 0;
m_Chunks = 0;
m_Init = TRUE;
m_Pos = 0;
m_Mark = 0;
m_ChunkMark = 0;
m_Encoding = encoding;
}
//---------------------------------------------------------------------
void ICalCAPIReader::deleteUnicodeStringVector(JulianPtrArray * stringVector)
{
t_int32 i;
if (stringVector != 0)
{
for (i = stringVector->GetSize() - 1; i >= 0; i--)
{
delete ((UnicodeString *) stringVector->GetAt(i));
}
}
}
//---------------------------------------------------------------------
ICalCAPIReader::~ICalCAPIReader()
{
if (m_Chunks != 0)
{
deleteUnicodeStringVector(m_Chunks);
delete m_Chunks; m_Chunks = 0;
}
//if (m_Buffer != 0) { delete [] m_Buffer; m_Buffer = 0; }
//PR_Exit();
}
//---------------------------------------------------------------------
/*
void ICalCAPIReader::setBuffer(const char * capiChunk)
{
if (m_Init)
{
strcpy(m_Buffer, capiChunk);
m_BufferSize = strlen(m_Buffer);
m_Init = FALSE;
}
else
{
strcat(m_Buffer + m_BufferSize, capiChunk);
m_BufferSize += strlen(capiChunk);
}
}
*/
//---------------------------------------------------------------------
t_int8 ICalCAPIReader::read(ErrorCode & status)
{
t_int32 i = 0;
while (TRUE)
{
if (m_Chunks == 0 || m_Chunks->GetSize() == 0 ||
m_ChunkIndex >= m_Chunks->GetSize())
{
status = m_NOMORECHUNKS; // no more chunks, should block
return -1;
// block?
}
else
{
// read from linked list of UnicodeString's
// delete front string when finished reading from it
UnicodeString string = *((UnicodeString *) m_Chunks->GetAt(m_ChunkIndex));
if (m_Pos < string.size())
{
// return index of this
status = ZERO_ERROR;
if (m_Encoding == nsCalUtility::MimeEncoding_QuotedPrintable)
{
if ((string)[(TextOffset) m_Pos] == '=')
{
if (string.size() >= m_Pos + 3)
{
if (ICalReader::isHex(string[(TextOffset)(m_Pos + 1)]) &&
ICalReader::isHex(string[(TextOffset)(m_Pos + 2)]))
{
t_int8 c;
c = ICalReader::convertHex(string[(TextOffset) (m_Pos + 1)],
string[(TextOffset) (m_Pos + 2)]);
// replace the contents of string
//string/removeBetween(m_Pos, 3);
//char sBuf[1];
//sBuf[0] = c;
//string->insert(m_Pos, sBuf);
m_Pos += 3;
//m_Pos++;
return c;
}
else
{
return (t_int8) (string)[(TextOffset) m_Pos++];
}
}
else
{
t_int32 lenDiff = string.size() - m_Pos;
char fToken;
char sToken;
t_bool bSetFToken = FALSE;
t_int32 tempIndex = m_ChunkIndex;
UnicodeString token;
while (TRUE)
{
// lenDiff = 1, 2 always
// the =XX spans different chunks
// if last chunk, return out of chunks status
if (tempIndex == m_Chunks->GetSize() - 1)
{
status = m_NOMORECHUNKS;
return -1;
}
else
{
UnicodeString nextstring = *((UnicodeString *) m_Chunks->GetAt(tempIndex + 1));
tempIndex++;
if (nextstring.size() >= 2)
{
t_int8 c;
if (lenDiff == 2)
{
fToken = string[(TextOffset) (string.size() - 1)];
sToken = nextstring[(TextOffset) 0];
if (ICalReader::isHex(fToken) && ICalReader::isHex(sToken))
{
c = ICalReader::convertHex(fToken, sToken);
m_Pos = 1;
m_ChunkIndex = tempIndex;
bSetFToken = FALSE;
return c;
}
else
{
return (t_int8) (string)[(TextOffset) m_Pos++];
}
}
else
{
// lenDiff = 1
if (bSetFToken)
{
sToken = nextstring[(TextOffset) 0];
}
else
{
fToken = nextstring[(TextOffset) 0];
sToken = nextstring[(TextOffset) 1];
}
if (ICalReader::isHex(fToken) && ICalReader::isHex(sToken))
{
c = ICalReader::convertHex(fToken, sToken);
m_Pos = 2;
m_ChunkIndex = tempIndex;
bSetFToken = FALSE;
return c;
}
else
{
return (t_int8) (string)[(TextOffset) m_Pos++];
}
}
}
else
{
if (nextstring.size() > 0)
{
if (!bSetFToken)
{
fToken = nextstring[(TextOffset) 0];
bSetFToken = TRUE;
}
else
{
sToken = nextstring[(TextOffset) 0];
if (ICalReader::isHex(fToken) && ICalReader::isHex(sToken))
{
char c;
c = ICalReader::convertHex(fToken, sToken);
m_Pos = 1;
m_ChunkIndex = tempIndex;
bSetFToken = FALSE;
return c;
}
else
{
return (t_int8) (string)[(TextOffset) m_Pos++];
}
}
}
}
}
}
}
}
else
{
return (t_int8) (string)[(TextOffset) m_Pos++];
}
}
else
{
return (t_int8) (string)[(TextOffset) m_Pos++];
}
}
else
{
// delete front string from list, try reading from next chunk
m_Pos = 0;
m_ChunkIndex++;
//delete ((UnicodeString *) m_Chunks->GetAt(i));
//m_Chunks->RemoveAt(i);
}
}
}
status = 1;
return -1;
/*
if (m_BufferSize > 0)
{
if (m_Pos >= m_BufferSize)
{
status = 1;
return -1;
}
else
{
status = ZERO_ERROR;
return m_Buffer[m_Pos++];
}
}
else
{
status = 2;
return -1;
}
*/
}
//---------------------------------------------------------------------
UnicodeString &
ICalCAPIReader::createLine(t_int32 oldPos, t_int32 oldChunkIndex,
t_int32 newPos, t_int32 newChunkIndex,
UnicodeString & aLine)
{
PR_ASSERT(oldChunkIndex <= newChunkIndex);
UnicodeString u;
if (oldChunkIndex == newChunkIndex)
{
u = *((UnicodeString *) m_Chunks->GetAt(oldChunkIndex));
u.extractBetween(oldPos, newPos, aLine);
return aLine;
}
else {
//(oldChunkIndex < newChunkIndex)
t_int32 i;
UnicodeString v, temp;
u = *((UnicodeString *) m_Chunks->GetAt(oldChunkIndex));
u.extractBetween(oldPos, u.size(), aLine);
v = *((UnicodeString *) m_Chunks->GetAt(newChunkIndex));
v.extractBetween(0, newPos, temp);
i = oldChunkIndex + 1;
while (i < newChunkIndex)
{
v = *((UnicodeString *) m_Chunks->GetAt(i));
aLine += v;
i++;
}
aLine += temp;
return aLine;
}
}
//---------------------------------------------------------------------
UnicodeString &
ICalCAPIReader::readFullLine(UnicodeString & aLine, ErrorCode & status, t_int32 iTemp)
{
status = ZERO_ERROR;
t_int32 i;
#if TESTING_ITIPRIG
if (FALSE) TRACE("ICalCAPIReader: waiting to enter monitor\r\n");
#endif
PR_EnterMonitor(m_Monitor);
#if TESTING_ITIPRIG
if (FALSE) TRACE("ICalCAPIReader: in monitor\r\n");
#endif
t_int32 oldpos = m_Pos;
t_int32 oldChunkIndex = m_ChunkIndex;
readLine(aLine, status);
if (status == m_NOMORECHUNKS)
{
// maybe block on monitor here
//PR_Notify(m_Monitor);
#if CAPI_READY
//PR_Yield();
if (m_bFinished)
{
// do nothing.
}
else
{
#if TESTING_ITIPRIG
if (FALSE) TRACE("ICalCAPIReader: (1) waiting for writeTOCAPIReader to add more chunks\r\n");
#endif
PR_Wait(m_Monitor, LL_MAXINT);
//PR_Yield();
}
#else
return aLine;
#endif
}
UnicodeString aSubLine;
while (TRUE)
{
mark();
i = read(status);
if (status == m_NOMORECHUNKS)
{
// block()? reset()?;
//PR_Notify(m_Monitor);
//PR_ExitMonitor(m_Monitor);
#if CAPI_READY
if (m_bFinished)
{
// do nothing
break;
}
else
{
#if TESTING_ITIPRIG
if (FALSE) TRACE("ICalCAPIReader: (2) waiting for writeTOCAPIReader to add more chunks\r\n");
#endif
PR_Wait(m_Monitor, LL_MAXINT);
//PR_Yield();
}
#else
return aLine;
#endif
}
else if (i == ' ')
{
#if TESTING_ITIPRIG
if (FALSE) TRACE("ICalCAPIReader: recursivecall\r\n");
#endif
aLine += readLine(aSubLine, status);
//PR_Notify(m_Monitor);
//if (FALSE) TRACE("rfl(2) %s\r\n", aLine.toCString(""));
}
else
{
#if TESTING_ITIPRIG
if (FALSE) TRACE("ICalCAPIReader: reset() break out of loop\r\n");
#endif
reset();
break;
}
}
#if TESTING_ITIPRIG
if (FALSE) TRACE("readFullLine returned: ---%s---\r\n", aLine.toCString(""));
#endif
#if TESTING_ITIPRIG
TRACE("ICalCAPIReader: leaving monitor\r\n");
#endif
PR_ExitMonitor(m_Monitor);
return aLine;
}
//---------------------------------------------------------------------
UnicodeString &
ICalCAPIReader::readLine(UnicodeString & aLine, ErrorCode & status)
{
status = ZERO_ERROR;
t_int8 c = 0;
t_int32 oldPos = m_Pos;
t_int32 oldChunkIndex = m_ChunkIndex;
aLine = "";
//PR_EnterMonitor(m_Monitor);
c = read(status);
while (!(FAILURE(status)))
{
if (status == m_NOMORECHUNKS)
{
// block
break;
}
/* Break on '\n', '\r\n', and '\r' */
else if (c == '\n')
{
break;
}
else if (c == '\r')
{
mark();
c = read(status);
if (FAILURE(status))
{
// block(), reset()?
break;
}
else if (c == '\n')
{
break;
}
else
{
reset();
break;
}
}
#if 1
aLine += c;
//if (FALSE) TRACE("aLine = %s: -%c,%d-\r\n", aLine.toCString(""), c, c);
#endif
c = read(status);
}
#if 0
createLine(oldPos, oldChunkIndex, m_Pos, m_ChunkIndex, aLine);
#endif
/*
if (FAILURE(status))
{
PR_Notify(m_Monitor);
PR_ExitMonitor(m_Monitor);
}
*/
//if (FALSE) TRACE("\treadLine returned %s\r\n", aLine.toCString(""));
return aLine;
/*
t_int32 lineSize = m_Pos - oldpos;
char * theLine = new char[lineSize];
PR_ASSERT(theLine != 0);
strncpy(theLine, m_Buffer + oldpos, lineSize);
aLine = theLine;
return aLine;
*/
}
//---------------------------------------------------------------------

Просмотреть файл

@ -1,46 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
// dategntr.cpp
// John Sun
// 12:30 PM February 4 1998
#include "stdafx.h"
#include "jdefines.h"
#include <assert.h>
//#include <assert.h>
#include "dategntr.h"
//#include "calendar.h"
//---------------------------------------------------------------------
DateGenerator::DateGenerator()
{
PR_ASSERT(FALSE);
}
//---------------------------------------------------------------------
DateGenerator::DateGenerator(t_int32 span, t_int32 paramsLen)
: m_iSpan(span), m_iParamsLen(paramsLen)
{
}
//---------------------------------------------------------------------

Просмотреть файл

@ -1,83 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
// deftgntr.cpp
// John Sun
// 4:01 PM Febrary 3 1998
#include "stdafx.h"
#include "jdefines.h"
#include <assert.h>
#include "deftgntr.h"
#include "jutility.h"
#include "duration.h"
//t_int32 DefaultGenerator::m_iParamsLen = 3;
DefaultGenerator::DefaultGenerator()
: DateGenerator(nsCalUtility::RT_MONTHLY, 3),
isActive(FALSE)
{}
//---------------------------------------------------------------------
t_int32
DefaultGenerator::getInterval() const { return nsCalUtility::RT_MONTHLY; }
//---------------------------------------------------------------------
t_bool
DefaultGenerator::generate(DateTime * start, JulianPtrArray & dateVector,
DateTime * until)
{
t_int32 i;
DateTime * t;
nsCalDuration * d;
PR_ASSERT(start != 0);
PR_ASSERT(m_aiParams != 0);
if (start == 0 || m_aiParams == 0)
{
return FALSE;
}
t = new DateTime(start->getTime()); PR_ASSERT(t != 0);
d = new nsCalDuration(m_aiParams[0], m_aiParams[1]); PR_ASSERT(d != 0);
dateVector.Add(new DateTime(t->getTime()));
for (i = 0; i < m_aiParams[2] - 1; i++)
{
t->add(*d);
if (until != 0 && until->isValid() && t->after(until))
{
//t = NULL;
delete t; t = 0;// replaced above line
delete d; d = 0;
return TRUE;
}
dateVector.Add(new DateTime(t->getTime()));
}
delete t; t = 0;
delete d; d = 0;
return FALSE;
}
//---------------------------------------------------------------------

Просмотреть файл

@ -1,183 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
// dprprty.cpp
// John Sun
// 3:15 PM February 12 1998
#include "stdafx.h"
#include "jdefines.h"
#include "dprprty.h"
#include "datetime.h"
#include "prprty.h"
#include "keyword.h"
//---------------------------------------------------------------------
// private never use
DateTimeProperty::DateTimeProperty():
m_DateTime(-1)
{
PR_ASSERT(FALSE);
}
//---------------------------------------------------------------------
DateTimeProperty::DateTimeProperty(const DateTimeProperty & that)
{
setParameters(that.m_vParameters);
m_DateTime = that.m_DateTime;
}
//---------------------------------------------------------------------
DateTimeProperty::DateTimeProperty(DateTime value, JulianPtrArray * parameters)
: StandardProperty(parameters)
{
//PR_ASSERT(value != 0);
//m_string = *((UnicodeString *) value);
m_DateTime = value;
}
//---------------------------------------------------------------------
DateTimeProperty::~DateTimeProperty()
{
//delete m_DateTime;
//deleteICalParameterVector(m_vParameters);
//delete m_vParameters; m_vParameters = 0;
}
//---------------------------------------------------------------------
void * DateTimeProperty::getValue() const
{
return (void *) &m_DateTime;
}
//---------------------------------------------------------------------
void DateTimeProperty::setValue(void * value)
{
PR_ASSERT(value != 0);
if (value != 0)
{
m_DateTime = *((DateTime *) value);
}
}
//---------------------------------------------------------------------
ICalProperty * DateTimeProperty::clone(JLog * initLog)
{
if (initLog) {} // NOTE: Remove later to avoid warnings
return new DateTimeProperty(*this);
}
//---------------------------------------------------------------------
t_bool DateTimeProperty::isValid()
{
//if (m_DateTime == 0)
// return FALSE;
//return m_DateTime->isValid();
return m_DateTime.isValid();
}
//---------------------------------------------------------------------
UnicodeString & DateTimeProperty::toString(UnicodeString & out)
{
//PR_ASSERT(m_DateTime != 0);
//if (m_DateTime->isValid()
out = m_DateTime.toString();
//else
// out = "NULL";
return out;
}
//---------------------------------------------------------------------
UnicodeString &
DateTimeProperty::toString(UnicodeString & dateFmt, UnicodeString & out)
{
out = m_DateTime.strftime(dateFmt);
if (out.size() > 0)
return out;
else
return toString(out);
}
//---------------------------------------------------------------------
UnicodeString & DateTimeProperty::toExportString(UnicodeString & out)
{
//PR_ASSERT(m_DateTime != 0);
out = m_DateTime.toISO8601();
return out;
}
//---------------------------------------------------------------------
UnicodeString &
DateTimeProperty::toICALString(UnicodeString & out)
{
UnicodeString name;
return toICALString(name, out);
}
//---------------------------------------------------------------------
UnicodeString &
DateTimeProperty::toICALString(UnicodeString & sProp,
UnicodeString & out)
{
ICalParameter * aName;
UnicodeString sVal;
sVal = toExportString(sVal);
out = "";
t_int32 size = 0;
t_int32 i;
if (m_vParameters != 0)
size = m_vParameters->GetSize();
if (sVal.size() > 0)
{
UnicodeString u;
out = sProp;
for (i = 0; i < size; i++)
{
aName = (ICalParameter *) m_vParameters->GetAt(i);
u = aName->getParameterName(u);
// don't print the TZID and VALUE parameters
// thus it will only print in Z time and VALUE assumed to be DATETIME
if ((u.compareIgnoreCase(nsCalKeyword::Instance()->ms_sTZID) != 0) &&
(u.compareIgnoreCase(nsCalKeyword::Instance()->ms_sVALUE) != 0))
out += aName->toICALString(u);
}
out += ':'; out += sVal; out += nsCalKeyword::Instance()->ms_sLINEBREAK;
}
//if (FALSE) TRACE("out = %s\r\n", out.toCString(""));
return out;
}
//---------------------------------------------------------------------

Просмотреть файл

@ -1,133 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
// duprprty.cpp
// John Sun
// 3:15 PM February 12 1998
#include "stdafx.h"
#include "jdefines.h"
#include "duprprty.h"
#include "duration.h"
#include "prprty.h"
//---------------------------------------------------------------------
// private never use
DurationProperty::DurationProperty()
{
PR_ASSERT(FALSE);
}
//---------------------------------------------------------------------
DurationProperty::DurationProperty(const DurationProperty & that)
{
setParameters(that.m_vParameters);
m_Duration = that.m_Duration;
}
//---------------------------------------------------------------------
DurationProperty::DurationProperty(nsCalDuration value, JulianPtrArray * parameters)
: StandardProperty(parameters)
{
//PR_ASSERT(value != 0);
//m_string = *((UnicodeString *) value);
m_Duration = value;
}
//---------------------------------------------------------------------
DurationProperty::~DurationProperty()
{
//delete m_Duration;
//deleteICalParameterVector(m_vParameters);
//delete m_vParameters; m_vParameters = 0;
}
//---------------------------------------------------------------------
void * DurationProperty::getValue() const
{
return (void *) &m_Duration;
}
//---------------------------------------------------------------------
void DurationProperty::setValue(void * value)
{
PR_ASSERT(value != 0);
if (value != 0)
{
m_Duration = *((nsCalDuration *) value);
}
}
//---------------------------------------------------------------------
ICalProperty * DurationProperty::clone(JLog * initLog)
{
if (initLog) {} // NOTE: Remove later to avoid warnings
return new DurationProperty(*this);
}
//---------------------------------------------------------------------
t_bool DurationProperty::isValid()
{
//if (m_Duration == 0)
// return FALSE;
//return m_Duration->isValid();
return m_Duration.isValid();
}
//---------------------------------------------------------------------
UnicodeString & DurationProperty::toString(UnicodeString & out)
{
//PR_ASSERT(m_Duration != 0);
//if (m_Duration->isValid()
out = m_Duration.toString();
//else
// out = "NULL";
return out;
}
//---------------------------------------------------------------------
UnicodeString &
DurationProperty::toString(UnicodeString & dateFmt, UnicodeString & out)
{
// NOTE: remove it later, gets rid of compiler warning
if (dateFmt.size() > 0) {}
return toString(out);
}
//---------------------------------------------------------------------
UnicodeString & DurationProperty::toExportString(UnicodeString & out)
{
//PR_ASSERT(m_Duration != 0);
out = m_Duration.toICALString();
return out;
}
//---------------------------------------------------------------------

Просмотреть файл

@ -1,757 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
// freebusy.cpp
// John Sun
// 6:35 PM Febuary 18 1998
#include "stdafx.h"
#include "jdefines.h"
#include "freebusy.h"
#include "icalcomp.h"
#include "unistrto.h"
#include "jlog.h"
#include "jutility.h"
#include "keyword.h"
//---------------------------------------------------------------------
const t_int32 Freebusy::ms_cFreebusyType = 'T';
const t_int32 Freebusy::ms_cFreebusyPeriod = 'P';
const t_int32 Freebusy::ms_iDEFAULT_TYPE= FB_TYPE_BUSY;
#if 0
const t_int32 Freebusy::ms_cFreebusyStatus = 'S';
const t_int32 Freebusy::ms_iDEFAULT_STATUS= FB_STATUS_BUSY;
#endif
//UnicodeString Freebusy::m_strDefaultFmt = "\tTYPE= ^T STATUS = ^S ^P\r\n";
//const UnicodeString Freebusy::nsCalKeyword::Instance()->ms_sDEFAULT_TYPE = nsCalKeyword::Instance()->ms_sBUSY;
//const UnicodeString Freebusy::nsCalKeyword::Instance()->ms_sDEFAULT_STATUS = nsCalKeyword::Instance()->ms_sBUSY;
//static UnicodeString s_sComma = nsCalKeyword::Instance()->ms_sCOMMA_SYMBOL;
//---------------------------------------------------------------------
Freebusy::FB_TYPE
Freebusy::stringToType(UnicodeString & sType)
{
t_int32 hashCode = sType.hashCode();
if (nsCalKeyword::Instance()->ms_ATOM_BUSY == hashCode) return FB_TYPE_BUSY;
else if (nsCalKeyword::Instance()->ms_ATOM_FREE == hashCode) return FB_TYPE_FREE;
// added 4-28-98
else if (nsCalKeyword::Instance()->ms_ATOM_BUSY_UNAVAILABLE == hashCode)
return FB_TYPE_BUSY_UNAVAILABLE;
else if (nsCalKeyword::Instance()->ms_ATOM_BUSY_TENTATIVE == hashCode)
return FB_TYPE_BUSY_TENTATIVE;
else if (ICalProperty::IsXToken(sType))
return FB_TYPE_XPARAMVAL;
else return FB_TYPE_INVALID;
}
//---------------------------------------------------------------------
UnicodeString &
Freebusy::typeToString(Freebusy::FB_TYPE type, UnicodeString & out)
{
switch(type)
{
case FB_TYPE_BUSY: out = nsCalKeyword::Instance()->ms_sBUSY; break;
case FB_TYPE_FREE: out = nsCalKeyword::Instance()->ms_sFREE; break;
// added 4-28-98
case FB_TYPE_BUSY_UNAVAILABLE: out = nsCalKeyword::Instance()->ms_sBUSY_UNAVAILABLE; break;
case FB_TYPE_BUSY_TENTATIVE: out = nsCalKeyword::Instance()->ms_sBUSY_TENTATIVE; break;
case FB_TYPE_XPARAMVAL: out = nsCalKeyword::Instance()->ms_sXPARAMVAL; break;
default:
// return default BUSY
out = nsCalKeyword::Instance()->ms_sBUSY;
break;
}
return out;
}
//---------------------------------------------------------------------
#if 0
Freebusy::FB_STATUS
Freebusy::stringToStatus(UnicodeString & sStatus)
{
t_int32 hashCode = sStatus.hashCode();
if (nsCalKeyword::Instance()->ms_ATOM_BUSY == hashCode) return FB_STATUS_BUSY;
else if (nsCalKeyword::Instance()->ms_ATOM_UNAVAILABLE == hashCode) return FB_STATUS_UNAVAILABLE;
else if (nsCalKeyword::Instance()->ms_ATOM_TENTATIVE == hashCode) return FB_STATUS_TENTATIVE;
else return FB_STATUS_INVALID;
}
//---------------------------------------------------------------------
UnicodeString &
Freebusy::statusToString(Freebusy::FB_STATUS status, UnicodeString & out)
{
switch(status)
{
case FB_STATUS_BUSY: out = nsCalKeyword::Instance()->ms_sBUSY; break;
case FB_STATUS_UNAVAILABLE: out = nsCalKeyword::Instance()->ms_sUNAVAILABLE; break;
case FB_STATUS_TENTATIVE: out = nsCalKeyword::Instance()->ms_sTENTATIVE; break;
default:
// return default BUSY
out = nsCalKeyword::Instance()->ms_sBUSY;
break;
}
return out;
}
#endif
//---------------------------------------------------------------------
// TODO: Finish
void Freebusy::parsePeriod(UnicodeString & s, JulianPtrArray * vTimeZones)
{
UnicodeStringTokenizer * stMult;
//UnicodeString delim = ",";
UnicodeString sPeriod;
//UnicodeString sPeriodStart;
//UnicodeString sPeriodEnd;
Period * p;
ErrorCode status = ZERO_ERROR;
if (vTimeZones)
{
}
stMult = new UnicodeStringTokenizer(s,
nsCalKeyword::Instance()->ms_sCOMMA_SYMBOL);
PR_ASSERT(stMult != 0);
if (stMult != 0)
{
while (stMult->hasMoreTokens())
{
sPeriod = stMult->nextToken(sPeriod, status);
sPeriod.trim();
//if (FALSE) TRACE("sPeriod = %s\r\n", sPeriod.toCString(""));
// TODO: check that period start/end always uses UTC
p = new Period(sPeriod);
PR_ASSERT(p != 0);
if (p != 0)
{
if (!p->isValid())
{
if (m_Log) m_Log->logError(nsCalLogErrorMessage::Instance()->ms_iFreebusyPeriodInvalid,
nsCalKeyword::Instance()->ms_sFREEBUSY, sPeriod, 200);
}
else
{
//sPeriodStart = Period::getStartTimeString(sPeriod, sPeriodStart);
//sPeriodEnd = Period::getEndTimeString(sPeriod, sPeriodEnd);
addPeriod(p);
}
delete p; p = 0;
}
}
delete stMult; stMult = 0;
}
}
//---------------------------------------------------------------------
void Freebusy::setParam(UnicodeString & paramName, UnicodeString & paramVal)
{
t_int32 i;
if (paramName.size() == 0)
{
if (m_Log) m_Log->logError(nsCalLogErrorMessage::Instance()->ms_iInvalidParameterName,
nsCalKeyword::Instance()->ms_sFREEBUSY, paramName, 200);
}
else
{
t_int32 hashCode = paramName.hashCode();
if (nsCalKeyword::Instance()->ms_ATOM_FBTYPE == hashCode)
{
i = Freebusy::stringToType(paramVal);
if (i < 0)
{
if (m_Log) m_Log->logError(nsCalLogErrorMessage::Instance()->ms_iInvalidParameterValue,
nsCalKeyword::Instance()->ms_sFREEBUSY, paramName, paramVal, 200);
}
else
{
if (getType() >= 0)
{
if (m_Log) m_Log->logError(nsCalLogErrorMessage::Instance()->ms_iDuplicatedParameter,
nsCalKeyword::Instance()->ms_sFREEBUSY, paramName, 100);
}
setType((Freebusy::FB_TYPE) i);
}
}
#if 0
else if (nsCalKeyword::Instance()->ms_ATOM_BSTAT == hashCode)
{
i = Freebusy::stringToStatus(paramVal);
if (i < 0)
{
if (m_Log) m_Log->logError(nsCalLogErrorMessage::Instance()->ms_iInvalidParameterValue,
nsCalKeyword::Instance()->ms_sFREEBUSY, paramName, paramVal, 200);
}
else
{
if (getStatus() >= 0)
{
if (m_Log) m_Log->logError(nsCalLogErrorMessage::Instance()->ms_iDuplicatedParameter,
nsCalKeyword::Instance()->ms_sFREEBUSY, paramName, 100);
}
setStatus((Freebusy::FB_STATUS) i);
}
}
#endif
else if (ICalProperty::IsXToken(paramName))
{
if (m_Log) m_Log->logError(nsCalLogErrorMessage::Instance()->ms_iXTokenParamIgnored,
nsCalKeyword::Instance()->ms_sFREEBUSY, paramName, 100);
}
else
{
// NOTE: what about optional parameters?? THERE ARE NONE.
if (m_Log) m_Log->logError(nsCalLogErrorMessage::Instance()->ms_iInvalidParameterName,
nsCalKeyword::Instance()->ms_sFREEBUSY, paramName, 200);
}
}
}
//---------------------------------------------------------------------
void Freebusy::selfCheck()
{
if (getType() < 0 || getType() > FB_TYPE_LENGTH)
setDefaultProps(FB_PROPS_TYPE);
#if 0
else if (getStatus() < 0 || getStatus() > FB_STATUS_LENGTH)
setDefaultProps(FB_PROPS_STATUS);
#endif
// NOTE: selfcheck each period???, no need since addPeriod auto checks??
}
//---------------------------------------------------------------------
void Freebusy::setDefaultProps(Freebusy::FB_PROPS prop)
{
switch (prop)
{
case FB_PROPS_TYPE: setType((Freebusy::FB_TYPE) ms_iDEFAULT_TYPE); return;
#if 0
case FB_PROPS_STATUS: setStatus((Freebusy::FB_STATUS) ms_iDEFAULT_STATUS); return;
#endif
default: return;
}
}
//---------------------------------------------------------------------
void Freebusy::sortPeriods()
{
if (m_vPeriod != 0)
m_vPeriod->QuickSort(Period::ComparePeriods);
}
//---------------------------------------------------------------------
void Freebusy::sortPeriodsByEndTime()
{
if (m_vPeriod != 0)
m_vPeriod->QuickSort(Period::ComparePeriodsByEndTime);
}
//---------------------------------------------------------------------
// private never use
#if 0
Freebusy::Freebusy()
{
PR_ASSERT(FALSE);
}
#endif
//---------------------------------------------------------------------
Freebusy::Freebusy(JLog * initLog)
: m_Type(ms_iDEFAULT_TYPE),
#if 0
m_Status(ms_iDEFAULT_STATUS),
#endif
m_vPeriod(0), m_Log(initLog)
{
//PR_ASSERT(initLog != 0);
}
//---------------------------------------------------------------------
Freebusy::Freebusy(Freebusy & that)
: m_vPeriod(0)
{
t_int32 i;
m_Type = that.m_Type;
#if 0
m_Status = that.m_Status;
#endif
if (that.m_vPeriod != 0)
{
m_vPeriod = new JulianPtrArray();
PR_ASSERT(m_vPeriod != 0);
if (m_vPeriod != 0)
{
for (i = 0; i < that.m_vPeriod->GetSize(); i++)
{
Period * p = (Period *) (that.m_vPeriod->GetAt(i));
PR_ASSERT(p != 0);
if (p != 0)
{
addPeriod(p);
}
}
}
}
}
//---------------------------------------------------------------------
Freebusy::~Freebusy()
{
if (m_vPeriod != 0)
{
ICalProperty::deletePeriodVector(m_vPeriod);
delete m_vPeriod; m_vPeriod = 0;
}
}
//---------------------------------------------------------------------
ICalProperty *
Freebusy::clone(JLog * initLog)
{
m_Log = initLog;
//PR_ASSERT(m_Log != 0);
return new Freebusy(*this);
}
//---------------------------------------------------------------------
void Freebusy::addPeriod(Period * p)
{
PR_ASSERT(p != 0);
if (m_vPeriod == 0)
m_vPeriod = new JulianPtrArray();
PR_ASSERT(m_vPeriod != 0);
if (m_vPeriod != 0 && p != 0)
{
m_vPeriod->Add(new Period(*p));
}
}
//---------------------------------------------------------------------
DateTime Freebusy::startOfFreebusyPeriod()
{
t_int32 i;
DateTime d(-1);
if (m_vPeriod != 0)
{
i = m_vPeriod->GetSize();
if (i > 0)
{
sortPeriods();
Period * p = (Period *) m_vPeriod->GetAt(0);
d = p->getStart();
return d;
}
else
{
// NOTE: No periods in vector, so returning invalid datetime
return d;
}
}
else
{
// NOTE: No periods in vector, so returning invalid datetime
return d;
}
}
//---------------------------------------------------------------------
DateTime Freebusy::endOfFreebusyPeriod()
{
t_int32 i;
DateTime d(-1);
nsCalDuration du(-1, -1, -1, -1, -1, -1, -1);
if (m_vPeriod != 0)
{
i = m_vPeriod->GetSize();
if (i > 0)
{
sortPeriodsByEndTime();
Period * p = (Period *) m_vPeriod->GetAt(i - 1);
if (p->getEnd().isValid())
{
d = p->getEnd();
return d;
}
else
{
d = p->getStart();
du = p->getDuration();
d.add(du);
return d;
}
//return p->getEndingTime(d);
}
else
{
// NOTE: No periods in vector, so returning invalid datetime
return d;
}
}
else
{
// NOTE: No periods in vector, so returning invalid datetime
return d;
}
}
//---------------------------------------------------------------------
void Freebusy::parse(UnicodeString & in)
{
UnicodeString propName;
UnicodeString propVal;
JulianPtrArray * parameters = new JulianPtrArray();
PR_ASSERT(parameters != 0);
if (parameters != 0)
{
ICalProperty::parsePropertyLine(in, propName, propVal, parameters);
parse(propVal, parameters);
ICalProperty::deleteICalParameterVector(parameters);
delete parameters; parameters = 0;
}
}
//---------------------------------------------------------------------
void Freebusy::parse(UnicodeString & sPeriods, JulianPtrArray * parameters,
JulianPtrArray * vTimeZones)
{
t_int32 i;
ICalParameter * ip;
UnicodeString pName;
UnicodeString pVal;
if (sPeriods.size() == 0)
{
}
else
{
parsePeriod(sPeriods, vTimeZones);
if (parameters != 0)
{
for (i = 0; i < parameters->GetSize(); i++)
{
ip = (ICalParameter *) parameters->GetAt(i);
setParam(ip->getParameterName(pName), ip->getParameterValue(pVal));
}
}
}
sortPeriods();
selfCheck();
}
//---------------------------------------------------------------------
void Freebusy::normalizePeriods()
{
sortPeriodsByEndTime();
t_int32 size = 0;
t_int32 i;
Period * p1;
Period * p2;
Period * pUnion;
if (m_vPeriod != 0)
{
size = m_vPeriod->GetSize();
for (i = size -1; i >= 0; i--)
{
p1 = (Period *) m_vPeriod->GetAt(i); PR_ASSERT(p1 != 0);
if (i - 1 >= 0)
{
p2 = (Period *) m_vPeriod->GetAt(i - 1); PR_ASSERT(p2 != 0);
if (Period::IsConnectedPeriods(*p1, *p2))
{
pUnion = new Period(); PR_ASSERT(pUnion != 0);
if (pUnion != 0)
{
Period::Union(*p1, *p2, *pUnion);
delete p1; p1 = 0;
m_vPeriod->RemoveAt(i); // remove p1
delete p2; p2 = 0;
m_vPeriod->RemoveAt(i - 1); // remove p2
//removePeriod(p1); p1 = 0;
//removePeriod(p2); p2 = 0;
m_vPeriod->InsertAt(i -1, pUnion);
}
}
}
}
}
}
//---------------------------------------------------------------------
t_bool Freebusy::isValid()
{
if (m_vPeriod == 0 || m_vPeriod->GetSize() == 0)
return FALSE;
return TRUE;
}
//---------------------------------------------------------------------
UnicodeString & Freebusy::toString(UnicodeString & out)
{
out = toString(nsCalFormatString::Instance()->ms_FreebusyStrDefaultFmt, out);
return out;
}
//---------------------------------------------------------------------
UnicodeString &
Freebusy::toString(UnicodeString & strFmt, UnicodeString & out)
{
if (strFmt.size() == 0 && nsCalFormatString::Instance()->ms_FreebusyStrDefaultFmt.size() > 0)
{
// if empty string, use default
return toString(out);
}
UnicodeString into;
t_int32 i,j;
//char * c = strFmt.toCString("");
out = "";
for ( i = 0; i < strFmt.size(); )
{
// NOTE: changed from % to ^ for freebusy
///
/// If there's a special formatting character,
/// handle it. Otherwise, just emit the supplied
/// character.
///
into = "";
j = strFmt.indexOf('^', i);
if ( -1 != j)
{
if (j > i)
{
out += strFmt.extractBetween(i,j,into);
}
i = j + 1;
if (strFmt.size() > i)
{
out += toStringChar(strFmt[(TextOffset) i], into);
i++;
}
}
else
{
out += strFmt.extractBetween(i, strFmt.size(),into);
break;
}
}
return out;
}
//---------------------------------------------------------------------
UnicodeString &
Freebusy::toStringChar(t_int32 c, UnicodeString & out)
{
switch ( c )
{
case ms_cFreebusyType:
return typeToString(getType(), out);
#if 0
case ms_cFreebusyStatus:
return statusToString(getStatus(), out);
#endif
case ms_cFreebusyPeriod:
if (m_vPeriod != 0)
{
Period * p;
t_int32 i;
for (i = 0; i < m_vPeriod->GetSize(); i++)
{
p = (Period *) m_vPeriod->GetAt(i);
if (i < m_vPeriod->GetSize() -1)
{
out += p->toString();
out += ',';
}
else
out += p->toString();
}
}
return out;
default:
return out;
}
}// end of
//---------------------------------------------------------------------
UnicodeString &
Freebusy::toICALString(UnicodeString & sProp, UnicodeString & out)
{
// NOTE: Remove later, to avoid warning
if (sProp.size() > 0) {}
return toICALString(out);
}
//---------------------------------------------------------------------
UnicodeString & Freebusy::toICALString(UnicodeString & out)
{
UnicodeString s, u;
t_int32 i;
out = nsCalKeyword::Instance()->ms_sFREEBUSY;
s = typeToString(getType(), s);
out += ICalProperty::parameterToCalString(nsCalKeyword::Instance()->ms_sFBTYPE, s, u);
#if 0
s = statusToString(getStatus(), s);
out += ICalProperty::parameterToCalString(nsCalKeyword::Instance()->ms_sBSTAT, s, u);
#endif
out += ":";
if (m_vPeriod != 0)
{
for (i = 0; i < m_vPeriod->GetSize(); i++)
{
Period * p = (Period *) m_vPeriod->GetAt(i);
if (i < m_vPeriod->GetSize() -1)
{
out += p->toICALString();
out += nsCalKeyword::Instance()->ms_sCOMMA_SYMBOL;
}
else
out += p->toICALString();
}
}
out += nsCalKeyword::Instance()->ms_sLINEBREAK;
out = ICalProperty::multiLineFormat(out);
return out;
}
//---------------------------------------------------------------------
void Freebusy::setParameters(JulianPtrArray * parameters)
{
t_int32 i;
ICalParameter * ip;
UnicodeString pName;
UnicodeString pVal;
if (parameters != 0)
{
for (i = 0; i < parameters->GetSize(); i++)
{
ip = (ICalParameter *) parameters->GetAt(i);
setParam(ip->getParameterName(pName), ip->getParameterValue(pVal));
}
}
}
//---------------------------------------------------------------------
// NOTE: assumes normalized periods
// TODO: verify it works
/*
t_bool Freebusy::IsInside(DateTime start, DateTime end)
{
PR_ASSERT(m_vPeriod != 0);
t_int32 i;
Period * p;
if (m_vPeriod != 0)
{
for (i = 0; i < m_vPeriod->GetSize(); i++)
{
p = (Period *) m_vPeriod->GetAt(i);
if (!p->isInside(start, end))
return FALSE;
}
}
return TRUE;
}
*/
//---------------------------------------------------------------------
// TODO: update method
//void update()
//---------------------------------------------------------------------
// TODO: verify it works
/*
void Freebusy::clipOutOfBounds(DateTime start, DateTime end)
{
PR_ASSERT(!start.afterDateTime(end));
Period * p;
Period * pShrunk;
t_int32 i;
if (m_vPeriod != 0)
{
for (i = m_vPeriod->GetSize() - 1; i >= 0; i--)
{
p = (Period *) m_vPeriod->GetAt(i);
if (!p->isInside(start, end))
{
if (p->isIntersecting(start, end))
{
pShrunk = new Period(); PR_ASSERT(pShrunk != 0);
Period::Intersection(*p, start, end, *pShrunk);
addPeriod(pShrunk);
}
removePeriod(p); p = 0;
}
}
}
}
*/
//---------------------------------------------------------------------
int Freebusy::CompareFreebusy(const void * a, const void * b)
{
Freebusy * fa = *(Freebusy **) a;
Freebusy * fb = *(Freebusy **) b;
PR_ASSERT(fa->isValid() && fb->isValid());
Period * pA = (Period *) fa->getPeriod()->GetAt(0);
Period * pB = (Period *) fb->getPeriod()->GetAt(0);
return Period::ComparePeriods(&pA, &pB);
}
//---------------------------------------------------------------------
t_bool
Freebusy::HasSameParams(Freebusy * f1, Freebusy * f2)
{
PR_ASSERT(f1 != 0 && f2 != 0);
if (f1 == 0 || f2 == 0)
{
// BOTH null returns FALSE
return FALSE;
}
#if 0
return ((f1->getType() == f2->getType()) &&
(f1->getStatus() == f2->getStatus()));
#else
return (f1->getType() == f2->getType());
#endif
}
//---------------------------------------------------------------------
void
Freebusy::addAllPeriods(JulianPtrArray * periods)
{
Period * p;
t_int32 i;
if (periods != 0)
{
for (i = 0; i < periods->GetSize(); i++)
{
p = (Period *) periods->GetAt(i);
addPeriod(p);
}
}
}
//---------------------------------------------------------------------

Просмотреть файл

@ -1,137 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the 'NPL'); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an 'AS IS' basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* functbl.cpp
* John Sun
* 7/27/98 1:59:53 PM
*/
#include "stdafx.h"
#include "jdefines.h"
#include "keyword.h"
#include "functbl.h"
#include "valarm.h"
//---------------------------------------------------------------------
JulianFunctionTable * JulianFunctionTable::m_Instance = 0;
//---------------------------------------------------------------------
JulianFunctionTable::JulianFunctionTable()
{
alarmStoreTable[0].set(nsCalKeyword::Instance()->ms_ATOM_ACTION.hashCode(), &VAlarm::storeAction);
alarmStoreTable[1].set(nsCalKeyword::Instance()->ms_ATOM_ACTION.hashCode(), &VAlarm::storeAction);
alarmStoreTable[2].set(nsCalKeyword::Instance()->ms_ATOM_ATTACH.hashCode(), &VAlarm::storeAttach);
alarmStoreTable[3].set(nsCalKeyword::Instance()->ms_ATOM_ATTENDEE.hashCode(), &VAlarm::storeAttendee);
alarmStoreTable[4].set(nsCalKeyword::Instance()->ms_ATOM_DESCRIPTION.hashCode(), &VAlarm::storeDescription);
alarmStoreTable[5].set(nsCalKeyword::Instance()->ms_ATOM_DURATION.hashCode(), &VAlarm::storeDuration);
alarmStoreTable[6].set(nsCalKeyword::Instance()->ms_ATOM_REPEAT.hashCode(), &VAlarm::storeRepeat);
alarmStoreTable[7].set(nsCalKeyword::Instance()->ms_ATOM_SUMMARY.hashCode(), &VAlarm::storeSummary);
alarmStoreTable[8].set(nsCalKeyword::Instance()->ms_ATOM_TRIGGER.hashCode(), &VAlarm::storeTrigger);
alarmStoreTable[9].set(0,0);
tbeStoreTable[0].set(nsCalKeyword::Instance()->ms_ATOM_ATTACH.hashCode(), &TimeBasedEvent::storeAttach);
tbeStoreTable[1].set(nsCalKeyword::Instance()->ms_ATOM_ATTENDEE.hashCode(), &TimeBasedEvent::storeAttendees);
tbeStoreTable[2].set(nsCalKeyword::Instance()->ms_ATOM_CATEGORIES.hashCode(), &TimeBasedEvent::storeCategories);
tbeStoreTable[3].set(nsCalKeyword::Instance()->ms_ATOM_CLASS.hashCode(), &TimeBasedEvent::storeClass);
tbeStoreTable[4].set(nsCalKeyword::Instance()->ms_ATOM_COMMENT.hashCode(), &TimeBasedEvent::storeComment);
tbeStoreTable[5].set(nsCalKeyword::Instance()->ms_ATOM_CONTACT.hashCode(), &TimeBasedEvent::storeContact);
tbeStoreTable[6].set(nsCalKeyword::Instance()->ms_ATOM_CREATED.hashCode(), &TimeBasedEvent::storeCreated);
tbeStoreTable[7].set(nsCalKeyword::Instance()->ms_ATOM_DESCRIPTION.hashCode(), &TimeBasedEvent::storeDescription);
tbeStoreTable[8].set(nsCalKeyword::Instance()->ms_ATOM_DTSTART.hashCode(), &TimeBasedEvent::storeDTStart);
tbeStoreTable[9].set(nsCalKeyword::Instance()->ms_ATOM_DTSTAMP.hashCode(), &TimeBasedEvent::storeDTStamp);
tbeStoreTable[10].set(nsCalKeyword::Instance()->ms_ATOM_EXDATE.hashCode(), &TimeBasedEvent::storeExDate);
tbeStoreTable[11].set(nsCalKeyword::Instance()->ms_ATOM_EXRULE.hashCode(), &TimeBasedEvent::storeExRule);
tbeStoreTable[12].set(nsCalKeyword::Instance()->ms_ATOM_LASTMODIFIED.hashCode(), &TimeBasedEvent::storeLastModified);
tbeStoreTable[13].set(nsCalKeyword::Instance()->ms_ATOM_ORGANIZER.hashCode(), &TimeBasedEvent::storeOrganizer);
tbeStoreTable[14].set(nsCalKeyword::Instance()->ms_ATOM_RDATE.hashCode(), &TimeBasedEvent::storeRDate);
tbeStoreTable[15].set(nsCalKeyword::Instance()->ms_ATOM_RRULE.hashCode(), &TimeBasedEvent::storeRRule);
tbeStoreTable[16].set(nsCalKeyword::Instance()->ms_ATOM_RECURRENCEID.hashCode(), &TimeBasedEvent::storeRecurrenceID);
tbeStoreTable[17].set(nsCalKeyword::Instance()->ms_ATOM_RELATEDTO.hashCode(), &TimeBasedEvent::storeRelatedTo);
tbeStoreTable[18].set(nsCalKeyword::Instance()->ms_ATOM_REQUESTSTATUS.hashCode(), &TimeBasedEvent::storeRequestStatus);
tbeStoreTable[19].set(nsCalKeyword::Instance()->ms_ATOM_SEQUENCE.hashCode(), &TimeBasedEvent::storeSequence);
tbeStoreTable[20].set(nsCalKeyword::Instance()->ms_ATOM_STATUS.hashCode(), &TimeBasedEvent::storeStatus);
tbeStoreTable[21].set(nsCalKeyword::Instance()->ms_ATOM_SUMMARY.hashCode(), &TimeBasedEvent::storeSummary);
tbeStoreTable[22].set(nsCalKeyword::Instance()->ms_ATOM_UID.hashCode(), &TimeBasedEvent::storeUID);
tbeStoreTable[23].set(nsCalKeyword::Instance()->ms_ATOM_URL.hashCode(), &TimeBasedEvent::storeURL);
tbeStoreTable[24].set(0,0);
tzStoreTable[0].set(nsCalKeyword::Instance()->ms_ATOM_COMMENT.hashCode(), &TZPart::storeComment);
tzStoreTable[1].set(nsCalKeyword::Instance()->ms_ATOM_DTSTART.hashCode(), &TZPart::storeDTStart);
tzStoreTable[2].set(nsCalKeyword::Instance()->ms_ATOM_RDATE.hashCode(), &TZPart::storeRDate);
tzStoreTable[3].set(nsCalKeyword::Instance()->ms_ATOM_RRULE.hashCode(), &TZPart::storeRRule);
tzStoreTable[4].set(nsCalKeyword::Instance()->ms_ATOM_TZNAME.hashCode(), &TZPart::storeTZName);
tzStoreTable[5].set(nsCalKeyword::Instance()->ms_ATOM_TZOFFSETTO.hashCode(), &TZPart::storeTZOffsetTo);
tzStoreTable[6].set(nsCalKeyword::Instance()->ms_ATOM_TZOFFSETFROM.hashCode(), &TZPart::storeTZOffsetFrom);
tzStoreTable[7].set(0,0);
veStoreTable[0].set(nsCalKeyword::Instance()->ms_ATOM_DTEND.hashCode(), &VEvent::storeDTEnd);
veStoreTable[1].set(nsCalKeyword::Instance()->ms_ATOM_DURATION.hashCode(), &VEvent::storeDuration);
veStoreTable[2].set(nsCalKeyword::Instance()->ms_ATOM_GEO.hashCode(), &VEvent::storeGEO);
veStoreTable[3].set(nsCalKeyword::Instance()->ms_ATOM_LOCATION.hashCode(), &VEvent::storeLocation);
veStoreTable[4].set(nsCalKeyword::Instance()->ms_ATOM_PRIORITY.hashCode(), &VEvent::storePriority);
veStoreTable[5].set(nsCalKeyword::Instance()->ms_ATOM_RESOURCES.hashCode(), &VEvent::storeResources);
veStoreTable[6].set(nsCalKeyword::Instance()->ms_ATOM_TRANSP.hashCode(), &VEvent::storeTransp);
veStoreTable[7].set(0,0);
vfStoreTable[0].set(nsCalKeyword::Instance()->ms_ATOM_ATTENDEE.hashCode(), &VFreebusy::storeAttendees);
vfStoreTable[1].set(nsCalKeyword::Instance()->ms_ATOM_COMMENT.hashCode(), &VFreebusy::storeComment);
vfStoreTable[2].set(nsCalKeyword::Instance()->ms_ATOM_CONTACT.hashCode(), &VFreebusy::storeContact);
/*vfStoreTable[3].set(nsCalKeyword::Instance()->ms_ATOM_CREATED.hashCode(), &VFreebusy::storeCreated);*/
vfStoreTable[3].set(nsCalKeyword::Instance()->ms_ATOM_DURATION.hashCode(), &VFreebusy::storeDuration);
vfStoreTable[4].set(nsCalKeyword::Instance()->ms_ATOM_DTEND.hashCode(), &VFreebusy::storeDTEnd);
vfStoreTable[5].set(nsCalKeyword::Instance()->ms_ATOM_DTSTART.hashCode(), &VFreebusy::storeDTStart);
vfStoreTable[6].set(nsCalKeyword::Instance()->ms_ATOM_DTSTAMP.hashCode(), &VFreebusy::storeDTStamp);
vfStoreTable[7].set(nsCalKeyword::Instance()->ms_ATOM_FREEBUSY.hashCode(), &VFreebusy::storeFreebusy);
vfStoreTable[8].set(nsCalKeyword::Instance()->ms_ATOM_LASTMODIFIED.hashCode(), &VFreebusy::storeLastModified);
vfStoreTable[9].set(nsCalKeyword::Instance()->ms_ATOM_ORGANIZER.hashCode(), &VFreebusy::storeOrganizer);
vfStoreTable[10].set(nsCalKeyword::Instance()->ms_ATOM_REQUESTSTATUS.hashCode(), &VFreebusy::storeRequestStatus);
vfStoreTable[11].set(nsCalKeyword::Instance()->ms_ATOM_SEQUENCE.hashCode(), &VFreebusy::storeSequence);
vfStoreTable[12].set(nsCalKeyword::Instance()->ms_ATOM_UID.hashCode(), &VFreebusy::storeUID);
vfStoreTable[13].set(nsCalKeyword::Instance()->ms_ATOM_URL.hashCode(), &VFreebusy::storeURL);
vfStoreTable[14].set(0,0);
vtStoreTable[0].set(nsCalKeyword::Instance()->ms_ATOM_COMPLETED.hashCode(), &VTodo::storeCompleted);
vtStoreTable[1].set(nsCalKeyword::Instance()->ms_ATOM_DUE.hashCode(), &VTodo::storeDue);
vtStoreTable[2].set(nsCalKeyword::Instance()->ms_ATOM_DURATION.hashCode(), &VTodo::storeDuration);
vtStoreTable[3].set(nsCalKeyword::Instance()->ms_ATOM_GEO.hashCode(), &VTodo::storeGEO);
vtStoreTable[4].set(nsCalKeyword::Instance()->ms_ATOM_LOCATION.hashCode(), &VTodo::storeLocation);
vtStoreTable[5].set(nsCalKeyword::Instance()->ms_ATOM_PERCENTCOMPLETE.hashCode(), &VTodo::storePercentComplete);
vtStoreTable[6].set(nsCalKeyword::Instance()->ms_ATOM_PRIORITY.hashCode(), &VTodo::storePriority);
vtStoreTable[7].set(nsCalKeyword::Instance()->ms_ATOM_RESOURCES.hashCode(), &VTodo::storeResources);
vtStoreTable[8].set(0,0);
}
//---------------------------------------------------------------------
JulianFunctionTable * JulianFunctionTable::Instance()
{
if (m_Instance == 0)
m_Instance = new JulianFunctionTable();
PR_ASSERT(m_Instance != 0);
return m_Instance;
}
//---------------------------------------------------------------------

Просмотреть файл

@ -1,640 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
// icalcomp.cpp
// John Sun
// 10:41 AM February 9 1998
#include "stdafx.h"
#include "jdefines.h"
#include <unistring.h>
#include "jutility.h"
#include "icalcomp.h"
#include "ptrarray.h"
#include "datetime.h"
#include "prprty.h"
#include "prprtyfy.h"
#include "keyword.h"
//---------------------------------------------------------------------
ICalComponent::ICalComponent() {}
//---------------------------------------------------------------------
ICalComponent::~ICalComponent() {}
//---------------------------------------------------------------------
UnicodeString
ICalComponent::toStringFmt(UnicodeString & strFmt)
{
UnicodeString s, into, dateFmt;
t_int32 i,j;
t_int32 k, l, m;
//if (FALSE) TRACE("strFmt = -%s-\r\n", strFmt.toCString(""));
for ( i = 0; i < strFmt.size(); )
{
//-
/// If there's a special formatting character,
/// handle it. Otherwise, just emit the supplied
/// character.
///
j = strFmt.indexOf('%', i);
if ( -1 != j)
{
dateFmt = "";
if (j > i)
{
s += strFmt.extractBetween(i,j,into);
}
i = j + 1;
if ( strFmt.size() > i)
{
// BELOW is to handle this
// %(MMMM dddd yyyy)B
//k = l = j;
k = strFmt.indexOf("(", i); l = strFmt.indexOf(")", i);
m = strFmt.indexOf("%", i);
if (k != -1 && l != -1 &&
(k < m || m == -1) && k > j &&
(l < m || m == -1) && l > j)
{
if (l > k + 1)
dateFmt = strFmt.extractBetween(k + 1, l, dateFmt);
i = l + 1;
}
//if (FALSE) TRACE("dateFmt = -%s-\r\n", dateFmt.toCString(""));
s += toStringChar(strFmt[(TextOffset) i], dateFmt);
i++;
}
//if (FALSE) TRACE("s = -%s-\r\n", s.toCString(""));
}
else
{
s += strFmt.extractBetween(i, strFmt.size(),into);
break;
}
}
return s;
}// end
//---------------------------------------------------------------------
UnicodeString
ICalComponent::format(UnicodeString & sComponentName,
UnicodeString & strFmt,
UnicodeString sFilterAttendee,
t_bool delegateRequest)
{
UnicodeString s, into;
s = nsCalKeyword::Instance()->ms_sBEGIN_WITH_COLON;
s += sComponentName;
s += nsCalKeyword::Instance()->ms_sLINEBREAK;
t_int32 i,j;
//char * c = strFmt.toCString("");
//if (FALSE) TRACE("%s sComponentName, %s strFmt, %s sFilterAttendee, %d delegateRequest\r\n", sComponentName.toCString(""), strFmt.toCString(""), sFilterAttendee.toCString(""), delegateRequest);
for ( i = 0; i < strFmt.size(); )
{
/*-
*** If there's a special formatting character,
*** handle it. Otherwise, just emit the supplied
*** character.
**/
j = strFmt.indexOf('%', i);
if ( -1 != j)
{
if (j > i)
{
s += strFmt.extractBetween(i,j,into);
}
i = j + 1;
if (strFmt.size() > i)
{
if (delegateRequest)
{
s += formatChar(strFmt[(TextOffset) i], "", delegateRequest);
}
else if (sFilterAttendee.size() > 0)
{
s += formatChar(strFmt[(TextOffset) i], sFilterAttendee, FALSE);
}
else
{
s += formatChar(strFmt[(TextOffset) i], "", FALSE);
}
i++;
}
}
else
{
s += strFmt.extractBetween(i, strFmt.size(),into);
break;
}
}
s += nsCalKeyword::Instance()->ms_sEND_WITH_COLON;
s += sComponentName;
s += nsCalKeyword::Instance()->ms_sLINEBREAK;
return s;
}// end
//---------------------------------------------------------------------
UnicodeString
ICalComponent::componentToString(ICAL_COMPONENT ic)
{
switch (ic)
{
case ICAL_COMPONENT_VEVENT: return nsCalKeyword::Instance()->ms_sVEVENT;
case ICAL_COMPONENT_VTODO: return nsCalKeyword::Instance()->ms_sVTODO;
case ICAL_COMPONENT_VJOURNAL: return nsCalKeyword::Instance()->ms_sVJOURNAL;
case ICAL_COMPONENT_VFREEBUSY: return nsCalKeyword::Instance()->ms_sVFREEBUSY;
case ICAL_COMPONENT_VTIMEZONE: return nsCalKeyword::Instance()->ms_sVTIMEZONE;
case ICAL_COMPONENT_VALARM: return nsCalKeyword::Instance()->ms_sVALARM;
case ICAL_COMPONENT_TZPART: return nsCalKeyword::Instance()->ms_sTZPART;
default:
return "";
}
}
//---------------------------------------------------------------------
ICalComponent::ICAL_COMPONENT
ICalComponent::stringToComponent(UnicodeString & s, t_bool & error)
{
s.toUpper();
t_int32 hashCode = s.hashCode();
error = FALSE;
if (nsCalKeyword::Instance()->ms_ATOM_VEVENT == hashCode) return ICAL_COMPONENT_VEVENT;
else if (nsCalKeyword::Instance()->ms_ATOM_VTODO == hashCode) return ICAL_COMPONENT_VTODO;
else if (nsCalKeyword::Instance()->ms_ATOM_VJOURNAL == hashCode) return ICAL_COMPONENT_VJOURNAL;
else if (nsCalKeyword::Instance()->ms_ATOM_VFREEBUSY == hashCode) return ICAL_COMPONENT_VFREEBUSY;
else if (nsCalKeyword::Instance()->ms_ATOM_VTIMEZONE == hashCode) return ICAL_COMPONENT_VTIMEZONE;
else if (nsCalKeyword::Instance()->ms_ATOM_VALARM == hashCode) return ICAL_COMPONENT_VALARM;
else if (nsCalKeyword::Instance()->ms_ATOM_TZPART == hashCode) return ICAL_COMPONENT_TZPART;
else
{
error = TRUE;
return ICAL_COMPONENT_TZPART;
}
}
//---------------------------------------------------------------------
t_bool ICalComponent::propertyNameToKeyLetter(UnicodeString & propertyName,
t_int32 & outLetter)
{
propertyName.toUpper();
t_int32 hashCode = propertyName.hashCode();
t_bool retStatus = TRUE;
outLetter = ' ';
if (nsCalKeyword::Instance()->ms_ATOM_ATTENDEE == hashCode) outLetter = ms_cAttendees;
else if (nsCalKeyword::Instance()->ms_ATOM_ATTACH == hashCode) outLetter = ms_cAttach;
else if (nsCalKeyword::Instance()->ms_ATOM_CATEGORIES == hashCode) outLetter = ms_cCategories;
else if (nsCalKeyword::Instance()->ms_ATOM_CLASS == hashCode) outLetter = ms_cClass;
else if (nsCalKeyword::Instance()->ms_ATOM_COMMENT == hashCode) outLetter = ms_cComment;
else if (nsCalKeyword::Instance()->ms_ATOM_COMPLETED == hashCode) outLetter = ms_cCompleted;
else if (nsCalKeyword::Instance()->ms_ATOM_CONTACT == hashCode) outLetter = ms_cContact;
else if (nsCalKeyword::Instance()->ms_ATOM_CREATED == hashCode) outLetter = ms_cCreated;
else if (nsCalKeyword::Instance()->ms_ATOM_DTEND == hashCode) outLetter = ms_cDTEnd;
else if (nsCalKeyword::Instance()->ms_ATOM_DTSTART == hashCode) outLetter = ms_cDTStart;
else if (nsCalKeyword::Instance()->ms_ATOM_DTSTAMP == hashCode) outLetter = ms_cDTStamp;
else if (nsCalKeyword::Instance()->ms_ATOM_DESCRIPTION == hashCode) outLetter = ms_cDescription;
else if (nsCalKeyword::Instance()->ms_ATOM_DUE == hashCode) outLetter = ms_cDue;
else if (nsCalKeyword::Instance()->ms_ATOM_DURATION == hashCode) outLetter = ms_cDuration;
else if (nsCalKeyword::Instance()->ms_ATOM_EXDATE == hashCode) outLetter = ms_cExDate;
else if (nsCalKeyword::Instance()->ms_ATOM_EXRULE == hashCode) outLetter = ms_cExRule;
else if (nsCalKeyword::Instance()->ms_ATOM_FREEBUSY == hashCode) outLetter = ms_cFreebusy;
else if (nsCalKeyword::Instance()->ms_ATOM_GEO == hashCode) outLetter = ms_cGEO;
else if (nsCalKeyword::Instance()->ms_ATOM_LASTMODIFIED == hashCode) outLetter = ms_cLastModified;
else if (nsCalKeyword::Instance()->ms_ATOM_LOCATION == hashCode) outLetter = ms_cLocation;
else if (nsCalKeyword::Instance()->ms_ATOM_ORGANIZER == hashCode) outLetter = ms_cOrganizer;
else if (nsCalKeyword::Instance()->ms_ATOM_PERCENTCOMPLETE == hashCode) outLetter = ms_cPercentComplete;
else if (nsCalKeyword::Instance()->ms_ATOM_PRIORITY == hashCode) outLetter = ms_cPriority;
else if (nsCalKeyword::Instance()->ms_ATOM_RDATE == hashCode) outLetter = ms_cRDate;
else if (nsCalKeyword::Instance()->ms_ATOM_RRULE == hashCode) outLetter = ms_cRRule;
else if (nsCalKeyword::Instance()->ms_ATOM_RECURRENCEID == hashCode) outLetter = ms_cRecurrenceID;
else if (nsCalKeyword::Instance()->ms_ATOM_RELATEDTO == hashCode) outLetter = ms_cRelatedTo;
else if (nsCalKeyword::Instance()->ms_ATOM_REPEAT == hashCode) outLetter = ms_cRepeat;
else if (nsCalKeyword::Instance()->ms_ATOM_REQUESTSTATUS == hashCode) outLetter = ms_cRequestStatus;
else if (nsCalKeyword::Instance()->ms_ATOM_RESOURCES == hashCode) outLetter = ms_cResources;
else if (nsCalKeyword::Instance()->ms_ATOM_SEQUENCE == hashCode) outLetter = ms_cSequence;
else if (nsCalKeyword::Instance()->ms_ATOM_STATUS == hashCode) outLetter = ms_cStatus;
else if (nsCalKeyword::Instance()->ms_ATOM_SUMMARY == hashCode) outLetter = ms_cSummary;
else if (nsCalKeyword::Instance()->ms_ATOM_TRANSP == hashCode) outLetter = ms_cTransp;
//else if (nsCalKeyword::Instance()->ms_ATOM_TRIGGER == hashCode) outLetter = ms_cTrigger;
else if (nsCalKeyword::Instance()->ms_ATOM_UID == hashCode) outLetter = ms_cUID;
else if (nsCalKeyword::Instance()->ms_ATOM_URL == hashCode) outLetter = ms_cURL;
//else if (nsCalKeyword::Instance()->ms_ATOM_TZOFFSET == hashCode) outLetter = ms_cTZOffset;
else if (nsCalKeyword::Instance()->ms_ATOM_TZOFFSETTO == hashCode) outLetter = ms_cTZOffsetTo;
else if (nsCalKeyword::Instance()->ms_ATOM_TZOFFSETFROM == hashCode) outLetter = ms_cTZOffsetFrom;
else if (nsCalKeyword::Instance()->ms_ATOM_TZNAME == hashCode) outLetter = ms_cTZName;
//else if (nsCalKeyword::Instance()->ms_ATOM_DAYLIGHT == hashCode) outLetter = ms_cDayLight;
//else if (nsCalKeyword::Instance()->ms_ATOM_STANDARD == hashCode) outLetter = ms_cStandard;
else if (nsCalKeyword::Instance()->ms_ATOM_TZURL == hashCode) outLetter = ms_cTZURL;
else if (nsCalKeyword::Instance()->ms_ATOM_TZID == hashCode) outLetter = ms_cTZID;
else
{
retStatus = FALSE;
}
return retStatus;
}
//---------------------------------------------------------------------
UnicodeString &
ICalComponent::makeFormatString(char ** ppsPropList, t_int32 iPropCount,
UnicodeString & out)
{
// TODO: figure out what to do if no properties?
t_int32 i = 0;
t_int32 keyLetter = ' ';
t_bool bFoundProperty = FALSE;
char *cProp = 0;
UnicodeString u;
UnicodeString usProp;
out = "";
if (iPropCount > 0 && ppsPropList != 0)
{
for (i = 0; i < iPropCount; i++)
{
cProp = ppsPropList[i];
usProp = cProp;
bFoundProperty = ICalComponent::propertyNameToKeyLetter(usProp, keyLetter);
if (bFoundProperty)
{
out += "%";
// TODO: dangerous
out += (char) (keyLetter);
}
}
} else
{
// given an empty propList or a zero propCount,
// return all properties + alarms
out = "%v%a%k%c%K%G%H%t%e%B%C%i%F%D%X%E%Y%O%M%L%J%P%p%x%y%R%o%A%T%r%s%g%S%h%U%u%Z%d%f%n%Q%I%V%w";
}
return out;
}
//---------------------------------------------------------------------
void ICalComponent::deleteUnicodeStringVector(JulianPtrArray * stringVector)
{
t_int32 i;
if (stringVector != 0)
{
for (i = stringVector->GetSize() - 1; i >= 0; i--)
{
delete ((UnicodeString *) stringVector->GetAt(i));
}
}
}
//---------------------------------------------------------------------
void
ICalComponent::deleteICalComponentVector(JulianPtrArray * componentVector)
{
t_int32 i;
if (componentVector != 0)
{
for (i = componentVector->GetSize() - 1; i >= 0; i--)
{
delete ((ICalComponent *) componentVector->GetAt(i));
}
}
}
//---------------------------------------------------------------------
void
ICalComponent::cloneICalComponentVector(JulianPtrArray * out,
JulianPtrArray * toClone)
{
if (out != 0)
{
if (toClone != 0)
{
t_int32 i;
ICalComponent * comp;
ICalComponent * clone;
for (i = 0; i < toClone->GetSize(); i++)
{
comp = (ICalComponent *) toClone->GetAt(i);
clone = comp->clone(0);
out->Add(clone);
}
}
}
}
//---------------------------------------------------------------------
#if 0
void
ICalComponent::setDateTimeValue(ICalProperty ** dateTimePropertyPtr,
DateTime inVal,
JulianPtrArray * inParameters)
{
PR_ASSERT(dateTimePropertyPtr != 0);
if (dateTimePropertyPtr != 0)
{
if (((ICalProperty *) (*dateTimePropertyPtr)) == 0)
{
((ICalProperty *) (*dateTimePropertyPtr)) =
ICalPropertyFactory::Make(ICalProperty::DATETIME,
(void *) &inVal, inParameters);
}
else
{
((ICalProperty *) (*dateTimePropertyPtr))->setValue((void *) &inVal);
((ICalProperty *) (*dateTimePropertyPtr))->setParameters(inParameters);
}
}
}
//---------------------------------------------------------------------
void ICalComponent::getDateTimeValue(ICalProperty ** dateTimePropertyPtr,
DateTime & outVal)
{
PR_ASSERT(dateTimePropertyPtr != 0);
if (dateTimePropertyPtr != 0)
{
if ((ICalProperty *)(*dateTimePropertyPtr) == 0)
outVal.setTime(-1);
else
outVal = *((DateTime *) ((ICalProperty *)(*dateTimePropertyPtr))->getValue());
}
else
{
outVal.setTime(-1);
}
}
//---------------------------------------------------------------------
void
ICalComponent::setStringValue(ICalProperty ** stringPropertyPtr,
UnicodeString inVal,
JulianPtrArray * inParameters)
{
PR_ASSERT(stringPropertyPtr != 0);
if (stringPropertyPtr != 0)
{
if (((ICalProperty *) (*stringPropertyPtr)) == 0)
{
((ICalProperty *) (*stringPropertyPtr)) =
ICalPropertyFactory::Make(ICalProperty::TEXT,
(void *) &inVal, inParameters);
}
else
{
((ICalProperty *) (*stringPropertyPtr))->setValue((void *) &inVal);
((ICalProperty *) (*stringPropertyPtr))->setParameters(inParameters);
}
}
}
//---------------------------------------------------------------------
void
ICalComponent::getStringValue(ICalProperty ** stringPropertyPtr,
UnicodeString & outVal)
{
PR_ASSERT(stringPropertyPtr != 0);
if (stringPropertyPtr != 0)
{
if ((ICalProperty *)(*stringPropertyPtr) == 0)
outVal = "";
else
outVal = *((UnicodeString *) ((ICalProperty *)(*stringPropertyPtr))->getValue());
}
else
{
outVal = "";
}
}
//---------------------------------------------------------------------
void
ICalComponent::setIntegerValue(ICalProperty ** integerPropertyPtr,
t_int32 inVal, JulianPtrArray * inParameters)
{
PR_ASSERT(integerPropertyPtr != 0);
if (integerPropertyPtr != 0)
{
if (((ICalProperty *) (*integerPropertyPtr)) == 0)
{
((ICalProperty *) (*integerPropertyPtr)) =
ICalPropertyFactory::Make(ICalProperty::INTEGER,
(void *) &inVal, inParameters);
}
else
{
((ICalProperty *) (*integerPropertyPtr))->setValue((void *) &inVal);
((ICalProperty *) (*integerPropertyPtr))->setParameters(inParameters);
}
}
}
//---------------------------------------------------------------------
void
ICalComponent::getIntegerValue(ICalProperty ** integerPropertyPtr,
t_int32 & outVal)
{
PR_ASSERT(integerPropertyPtr != 0);
if (integerPropertyPtr != 0)
{
if ((ICalProperty *)(*integerPropertyPtr) == 0)
outVal = -1;
else
outVal = *((t_int32 *) ((ICalProperty *)(*integerPropertyPtr))->getValue());
}
else
{
outVal = -1;
}
}
#endif /* #if 0 */
//---------------------------------------------------------------------
void ICalComponent::internalSetProperty(ICalProperty ** propertyPtr,
ICalProperty * replaceProp,
t_bool bForceOverwriteOnEmpty)
{
PR_ASSERT(propertyPtr != 0);
ICalProperty * prop = 0;
prop = (ICalProperty *) (*(propertyPtr));
t_bool bOverwrite = TRUE;
if (replaceProp == 0 && !bForceOverwriteOnEmpty)
{
bOverwrite = FALSE;
}
if (bOverwrite)
{
if (prop != 0)
{
delete prop;
prop = 0;
(*(propertyPtr)) = 0;
}
if (replaceProp != 0)
{
prop = replaceProp->clone(0);
(*(propertyPtr)) = prop;
}
}
}
//---------------------------------------------------------------------
void ICalComponent::internalSetPropertyVctr(JulianPtrArray ** propertyVctrPtr,
JulianPtrArray * replaceVctr,
t_bool bAddInsteadOfOverwrite,
t_bool bForceOverwriteOnEmpty)
{
// delete the contents of the old vector
// delete the old vector
// create a new vector if replaceVctr != 0
// clone contents of replaceVctr.
PR_ASSERT(propertyVctrPtr != 0);
JulianPtrArray * propVctr = 0;
propVctr = (JulianPtrArray *) (*(propertyVctrPtr));
t_bool bOverwrite = TRUE;
// don't overwrite if overwrite flag is false && replaceVctr is empty or null.
if (bAddInsteadOfOverwrite)
{
bOverwrite = FALSE;
}
else if ((replaceVctr == 0 || replaceVctr->GetSize() == 0) && !bForceOverwriteOnEmpty)
{
bOverwrite = FALSE;
}
if (bOverwrite)
{
if (propVctr != 0)
{
ICalProperty::deleteICalPropertyVector(propVctr);
delete propVctr;
propVctr = 0;
(*(propertyVctrPtr)) = 0;
}
if (replaceVctr != 0)
{
propVctr = new JulianPtrArray();
PR_ASSERT(propVctr != 0);
(*(propertyVctrPtr)) = propVctr;
ICalProperty::CloneICalPropertyVector(replaceVctr, propVctr, 0);
}
}
else if (bAddInsteadOfOverwrite)
{
t_int32 i;
if (replaceVctr != 0)
{
ICalProperty * ip = 0;
for (i = 0; i < replaceVctr->GetSize(); i++)
{
ip = ((ICalProperty *) replaceVctr->GetAt(i))->clone(0);
if (ip != 0)
{
propVctr->Add(ip);
}
}
}
}
}
//---------------------------------------------------------------------
void ICalComponent::internalSetXTokensVctr(JulianPtrArray ** xTokensVctrPtr,
JulianPtrArray * replaceVctr,
t_bool bAddInsteadOfOverwrite,
t_bool bForceOverwriteOnEmpty)
{
// delete the contents of the old vector
// delete the old vector
// create a new vector if replaceVctr != 0
// clone contents of replaceVctr.
PR_ASSERT(xTokensVctrPtr != 0);
JulianPtrArray * xTokensVctr = 0;
xTokensVctr = (JulianPtrArray *) (*(xTokensVctrPtr));
t_bool bOverwrite = TRUE;
// don't overwrite if overwrite flag is false && replaceVctr is empty or null.
if (bAddInsteadOfOverwrite)
{
bOverwrite = FALSE;
}
else if ((replaceVctr == 0 || replaceVctr->GetSize() == 0) && !bForceOverwriteOnEmpty)
{
bOverwrite = FALSE;
}
if (bOverwrite)
{
if (xTokensVctr != 0)
{
ICalComponent::deleteUnicodeStringVector(xTokensVctr);
delete xTokensVctr;
xTokensVctr = 0;
(*(xTokensVctrPtr)) = 0;
}
if (replaceVctr != 0)
{
xTokensVctr = new JulianPtrArray();
PR_ASSERT(xTokensVctr != 0);
(*(xTokensVctrPtr)) = xTokensVctr;
ICalProperty::CloneUnicodeStringVector(replaceVctr, xTokensVctr);
}
}
else if (bAddInsteadOfOverwrite)
{
t_int32 i;
if (replaceVctr != 0)
{
UnicodeString * us = 0;
UnicodeString u;
for (i = 0; i < replaceVctr->GetSize(); i++)
{
u = *((UnicodeString *) replaceVctr->GetAt(i));
us = new UnicodeString(u);
if (us != 0)
{
xTokensVctr->Add(us);
}
}
}
}
}

Просмотреть файл

@ -1,172 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
// icalfrdr.cpp
// John Sun
// 3:03 PM February 10 1998
#include <stdlib.h>
#include <stdio.h>
#include "stdafx.h"
#include "jdefines.h"
#include "icalfrdr.h"
#include "icalredr.h"
//---------------------------------------------------------------------
ICalFileReader::ICalFileReader() {}
//---------------------------------------------------------------------
ICalFileReader::ICalFileReader(char * filename, ErrorCode & status)
: m_file(0), m_filename(0)
{
m_filename = filename;
m_file = fopen(filename, "r");
if (m_file == 0)
{
#if 0
if (FALSE) TRACE("Can't open %s\n", filename);
#endif
status = 1;
}
else
{
status = ZERO_ERROR;
}
}
//---------------------------------------------------------------------
ICalFileReader::~ICalFileReader()
{
if (m_file) { fclose(m_file); m_file = 0; }
}
//---------------------------------------------------------------------
t_int8 ICalFileReader::read(ErrorCode & status)
{
int c = fgetc(m_file);
if (c == EOF)
{
status = 1;
return -1;
}
else
return (t_int8) c;
}
//---------------------------------------------------------------------
// TODO: handle quoted-printable
UnicodeString &
ICalFileReader::readLine(UnicodeString & aLine, ErrorCode & status)
{
status = ZERO_ERROR;
aLine = "";
char * l = 0;
if ( 0 != (l = fgets(m_pBuffer,1023,m_file)) )
{
t_int32 iLen = strlen(m_pBuffer);
if (m_pBuffer[iLen-1] == '\n')
m_pBuffer[iLen-1] = 0;
{
aLine = m_pBuffer;
return aLine;
}
}
status = 1;
return aLine;
}
//---------------------------------------------------------------------
// NOTE: TODO: make faster profiling?
UnicodeString &
ICalFileReader::readFullLine(UnicodeString & aLine, ErrorCode & status, t_int32 iTemp)
{
status = ZERO_ERROR;
t_int8 i;
t_bool qp = FALSE;
readLine(aLine, status);
//if (FALSE) TRACE("rfl(1) %s\r\n", aLine.toCString(""));
if (FAILURE(status))
{
return aLine;
}
if (aLine.indexOf("QUOTED-PRINTABLE") >= 0 || aLine.indexOf("quoted-printable") >= 0)
qp = TRUE;
if (qp)
{
// convert string after ':'
t_int32 i;
i = aLine.indexOf(':');
if (i >= 0)
{
UnicodeString u;
u = aLine.extractBetween(i + 1, aLine.size(), u);
u = ICalReader::convertQuotedPrintableString(u);
aLine.replaceBetween(i + 1, aLine.size(), u);
}
if (aLine[(TextOffset) aLine.size() - 1] == '=')
aLine.remove((TextOffset) aLine.size() - 1, 1);
else
qp = FALSE;
}
UnicodeString aSubLine;
while (TRUE)
{
i = read(status);
if (i != -1 && i == ' ' || (qp && i != -1))
{
if (!qp)
{
aLine += readLine(aSubLine, status);
}
else
{
aLine += i;
aSubLine = readLine(aSubLine, status);
// convert aSubLine;
aSubLine = ICalReader::convertQuotedPrintableString(aSubLine);
// remove last '=' if it exists, if it doesn't we're done.
if (aSubLine[(TextOffset) aSubLine.size() - 1] == '=')
aSubLine.remove((TextOffset) aSubLine.size() - 1, 1);
else
qp = FALSE;
aLine += aSubLine;
}
}
else if (i == -1)
{
return aLine;
}
else
{
ungetc(i, m_file);
break;
}
}
//if (FALSE) TRACE("end of rfl: ---%s---\r\n", aLine.toCString(""));
return aLine;
}
//---------------------------------------------------------------------

Просмотреть файл

@ -1,139 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
// icalprm.cpp
// John Sun
// 3:41 PM February 10 1998
#include "stdafx.h"
#include "jdefines.h"
#include "icalprm.h"
#include "ptrarray.h"
#include "keyword.h"
//---------------------------------------------------------------------
ICalParameter::ICalParameter() {}
//---------------------------------------------------------------------
ICalParameter::ICalParameter(ICalParameter & that)
{
m_ParameterName = that.m_ParameterName;
m_ParameterValue = that.m_ParameterValue;
}
//---------------------------------------------------------------------
ICalParameter::ICalParameter(const UnicodeString & parameterName,
const UnicodeString & parameterValue)
{
m_ParameterName = parameterName;
m_ParameterValue = parameterValue;
}
//---------------------------------------------------------------------
ICalParameter * ICalParameter::clone()
{
return new ICalParameter(*this);
}
//---------------------------------------------------------------------
void
ICalParameter::setParameterName(const UnicodeString & parameterName)
{
m_ParameterName = parameterName;
}
//---------------------------------------------------------------------
void
ICalParameter::setParameterValue(const UnicodeString & parameterValue)
{
m_ParameterValue = parameterValue;
}
//---------------------------------------------------------------------
UnicodeString &
ICalParameter::getParameterName(UnicodeString & retName) const
{
retName = m_ParameterName;
return retName;
}
//---------------------------------------------------------------------
UnicodeString &
ICalParameter::getParameterValue(UnicodeString & retValue) const
{
retValue = m_ParameterValue;
return retValue;
}
//---------------------------------------------------------------------
UnicodeString &
ICalParameter::toICALString(UnicodeString & result) const
{
result = nsCalKeyword::Instance()->ms_sSEMICOLON_SYMBOL;
result += m_ParameterName;
result += '=';
result += m_ParameterValue;
return result;
}
//---------------------------------------------------------------------
const ICalParameter &
ICalParameter::operator=(const ICalParameter & d)
{
if (this != &d)
{
m_ParameterName = d.m_ParameterName;
m_ParameterValue = d.m_ParameterValue;
}
return *this;
}
//---------------------------------------------------------------------
UnicodeString &
ICalParameter::GetParameterFromVector(UnicodeString & paramName,
UnicodeString & retVal,
JulianPtrArray * parameters)
{
t_int32 i;
ICalParameter * ip;
if (parameters != 0)
{
UnicodeString u;
for (i = 0; i < parameters->GetSize(); i++)
{
ip = (ICalParameter *) parameters->GetAt(i);
if (paramName.compareIgnoreCase(ip->getParameterName(u)) == 0)
{
retVal = ip->getParameterValue(retVal);
return retVal;
}
}
}
retVal = "";
return retVal;
}
//---------------------------------------------------------------------

Просмотреть файл

@ -1,107 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
// icalredr.cpp
// John Sun
// 3/23/98 3:29:47 PM
#include "stdafx.h"
#include "icalredr.h"
//---------------------------------------------------------------------
ICalReader::ICalReader() {}
//---------------------------------------------------------------------
t_bool ICalReader::isHex(t_int8 aToken)
{
if (aToken >= '0' && aToken <= '9')
return TRUE;
else if (aToken >= 'A' && aToken <= 'F')
return TRUE;
else if (aToken >= 'a' && aToken <= 'f')
return TRUE;
else
return FALSE;
}
//---------------------------------------------------------------------
t_int8 ICalReader::convertHex(char fToken,
char sToken)
{
unsigned char c = 0;
if (fToken >= '0' && fToken <= '9')
c = fToken - '0';
else if (fToken >= 'A' && fToken <= 'F')
c = fToken - ('A' - 10);
//else if (fToken >= 'a' && fToken <= 'f')
else
c = fToken - ('a' - 10);
/* Second hex digit */
c = (c << 4);
if (sToken >= '0' && sToken <= '9')
c += sToken - '0';
else if (sToken >= 'A' && sToken <= 'F')
c += sToken - ('A' - 10);
//else (sToken >= 'a' && sToken <= 'f')
else
c += sToken - ('a' - 10);
return (t_int8) c;
}
//---------------------------------------------------------------------
UnicodeString &
ICalReader::convertQuotedPrintableString(UnicodeString & stringToConvert)
{
t_int32 iEqual = -1;
t_int32 iCurrentPos = 0;
t_bool done = FALSE;
while (!done)
{
iEqual = stringToConvert.indexOf('=', iCurrentPos);
if (iEqual < 0)
done = TRUE;
else
{
if (stringToConvert.size() >= iEqual + 3)
{
if (ICalReader::isHex((char) stringToConvert[(TextOffset)(iEqual + 1)]) &&
ICalReader::isHex((char) stringToConvert[(TextOffset)(iEqual + 2)]))
{
t_int8 c;
c = ICalReader::convertHex((char) stringToConvert[(TextOffset)(iEqual+1)],
(char) stringToConvert[(TextOffset)(iEqual+2)]);
UnicodeString u;
u+=c;
stringToConvert.replace(iEqual, 3, u);
iCurrentPos = iEqual + 1;
}
}
else
{
done = TRUE;
}
}
}
return stringToConvert;
}

Просмотреть файл

@ -1,249 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
* icalsrdr.cpp
* John Sun
* 2/10/98 11:37:56 PM
*/
/* TODO: remove Unistring dependency. There is a bug if the
target string is encoded with 2byte character. If so, then the
m_pos and m_length variables are wrong. Currently, I will assume that
all const char * passed in will be us-ascii 8-bit chars
*/
#include "stdafx.h"
#include "jdefines.h"
#include <string.h>
#include "ptypes.h"
#include "icalsrdr.h"
#include "icalredr.h"
//---------------------------------------------------------------------
ICalStringReader::ICalStringReader() {}
//---------------------------------------------------------------------
ICalStringReader::ICalStringReader(const char * string,
nsCalUtility::MimeEncoding encoding)
: m_string(string), m_pos(0), m_mark(0)
{
m_length = strlen(m_string);
m_unistring = m_string;
m_Encoding = encoding;
}
//---------------------------------------------------------------------
t_int8 ICalStringReader::read(ErrorCode & status)
{
if (m_pos >= m_length)
{
status = 1;
return -1;
}
else
{
status = ZERO_ERROR;
if (m_Encoding == nsCalUtility::MimeEncoding_7bit)
{
return m_string[m_pos++];
}
else
{
// for now only handles quoted-printable
PR_ASSERT(m_Encoding == nsCalUtility::MimeEncoding_QuotedPrintable);
if (m_Encoding == nsCalUtility::MimeEncoding_QuotedPrintable)
{
if ((m_string[m_pos] == '=') && (m_length >= m_pos + 3))
{
// TODO: use libmime decoding algorithm instead of this one
if (ICalReader::isHex(m_string[m_pos+1]) && ICalReader::isHex(m_string[m_pos + 2]))
{
t_int8 c;
c = ICalReader::convertHex(m_string[m_pos + 1], m_string[m_pos + 2]);
m_pos += 3;
return c;
}
else
{
return m_string[m_pos++];
}
}
else
{
return m_string[m_pos++];
}
}
else
{
// handle like 7bit
return m_string[m_pos++];
}
}
}
}
//---------------------------------------------------------------------
void ICalStringReader::mark()
{
m_mark = m_pos;
}
//---------------------------------------------------------------------
void ICalStringReader::reset()
{
m_pos = m_mark;
}
//---------------------------------------------------------------------
UnicodeString & ICalStringReader::readLine(UnicodeString & aLine,
ErrorCode & status)
{
status = ZERO_ERROR;
t_int8 c = 0;
t_int32 oldpos = m_pos;
aLine = "";
c = read(status);
while (!(FAILURE(status)))
{
/* Break on '\n', '\r\n', and '\r' */
if (c == '\n')
{
break;
}
else if (c == '\r')
{
mark();
c = read(status);
if (FAILURE(status))
break;
else if (c == '\n')
{
break;
}
else
{
reset();
break;
}
}
#if 1
aLine += c;
#endif
c = read(status);
}
#if 0
if (m_pos > oldpos)
m_unistring.extractBetween(oldpos, m_pos - 1, aLine);
else
aLine = "";
#endif
//if (FALSE) TRACE("end of readline:---%s---\r\n", aLine.toCString(""));
return aLine;
}
//---------------------------------------------------------------------
UnicodeString & ICalStringReader::readFullLine(UnicodeString & aLine,
ErrorCode & status, t_int32 iTemp)
{
status = ZERO_ERROR;
t_int32 i;
t_bool qp = FALSE;
readLine(aLine, status);
//if (FALSE) TRACE("rfl(1) %s\r\n", aLine.toCString(""));
if (FAILURE(status))
{
//aLine = "";
return aLine;
}
if (aLine.indexOf("QUOTED-PRINTABLE") >= 0 || aLine.indexOf("quoted-printable") >=0 )
qp = TRUE;
if (qp)
{
// convert string after ':'
t_int32 i;
i = aLine.indexOf(':');
if (i >= 0)
{
UnicodeString u;
u = aLine.extractBetween(i + 1, aLine.size(), u);
u = ICalReader::convertQuotedPrintableString(u);
aLine.replaceBetween(i + 1, aLine.size(), u);
}
if (aLine[(TextOffset) aLine.size() - 1] == '=')
aLine.remove((TextOffset) aLine.size() - 1, 1);
else
qp = FALSE;
}
UnicodeString aSubLine;
while (TRUE)
{
mark();
i = read(status);
if (i == ' ' || (qp && i != -1))
{
if (!qp)
{
aLine += readLine(aSubLine, status);
}
else
{
aLine += i;
aSubLine = readLine(aSubLine, status);
// convert aSubLine;
aSubLine = ICalReader::convertQuotedPrintableString(aSubLine);
// remove last '=' if it exists, if it doesn't we're done.
if (aSubLine[(TextOffset) aSubLine.size() - 1] == '=')
aSubLine.remove((TextOffset) aSubLine.size() - 1, 1);
else
qp = FALSE;
aLine += aSubLine;
}
}
else if (FAILURE(status))
{
return aLine;
}
else
{
reset();
break;
}
}
//if (FALSE) TRACE("end of rfl: ---%s---\r\n", aLine.toCString(""));
return aLine;
}
//---------------------------------------------------------------------

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше