home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
linuxmafia.com 2016
/
linuxmafia.com.tar
/
linuxmafia.com
/
pub
/
palmos
/
linkmaster-src-1.0.4.tar.gz
/
linkmaster-src-1.0.4.tar
/
linkmaster-1.0.4
/
proxy
/
db
/
DateDB.h
< prev
next >
Wrap
C/C++ Source or Header
|
2000-09-05
|
8KB
|
259 lines
/*******************************************************************
Copyright ⌐ 1995 - 1998, 3Com Corporation or its subsidiaries ("3Com").
All rights reserved.
This software may be copied and used solely for developing products for
the Palm Computing platform and for archival and backup purposes. Except
for the foregoing, no part of this software may be reproduced or transmitted
in any form or by any means or used to make any derivative work (such as
translation, transformation or adaptation) without express written consent
from 3Com.
3Com reserves the right to revise this software and to make changes in content
from time to time without obligation on the part of 3Com to provide notification
of such revision or changes.
3COM MAKES NO REPRESENTATIONS OR WARRANTIES THAT THE SOFTWARE IS FREE OF ERRORS
OR THAT THE SOFTWARE IS SUITABLE FOR YOUR USE. THE SOFTWARE IS PROVIDED ON AN
"AS IS" BASIS. 3COM MAKES NO WARRANTIES, TERMS OR CONDITIONS, EXPRESS OR IMPLIED,
EITHER IN FACT OR BY OPERATION OF LAW, STATUTORY OR OTHERWISE, INCLUDING WARRANTIES,
TERMS, OR CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
SATISFACTORY QUALITY.
TO THE FULL EXTENT ALLOWED BY LAW, 3COM ALSO EXCLUDES FOR ITSELF AND ITS SUPPLIERS
ANY LIABILITY, WHETHER BASED IN CONTRACT OR TORT (INCLUDING NEGLIGENCE), FOR
DIRECT, INCIDENTAL, CONSEQUENTIAL, INDIRECT, SPECIAL, OR PUNITIVE DAMAGES OF
ANY KIND, OR FOR LOSS OF REVENUE OR PROFITS, LOSS OF BUSINESS, LOSS OF INFORMATION
OR DATA, OR OTHER FINANCIAL LOSS ARISING OUT OF OR IN CONNECTION WITH THIS SOFTWARE,
EVEN IF 3COM HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
3Com, HotSync, Palm Computing, and Graffiti are registered trademarks, and
Palm III and Palm OS are trademarks of 3Com Corporation or its subsidiaries.
IF THIS SOFTWARE IS PROVIDED ON A COMPACT DISK, THE OTHER SOFTWARE AND
DOCUMENTATION ON THE COMPACT DISK ARE SUBJECT TO THE LICENSE AGREEMENT
ACCOMPANYING THE COMPACT DISK.
*****************************************************************************
* FileName:
* ApptMgr.h
*
* Description:
* Header for the Appointment Manager
*
* History:
* 1/25/95 rsf - Created
*
*******************************************************************/
#ifndef __TDAPPTMGR_H__
#define __TDAPPTMGR_H__
typedef struct {
UInt renamedCategories; // bitfield of categories with a different name
char categoryLabels[dmRecNumCategories][dmCategoryLength];
Byte categoryUniqIDs[dmRecNumCategories];
Byte lastUniqID; // Uniq IDs generated by the device are between
// 0 - 127. Those from the PC are 128 - 255.
Byte reserved1; // from the compiler word aligning things
Word reserved2;
Byte startOfWeek;
} ApptAppInfoType;
typedef ApptAppInfoType * ApptAppInfoPtr;
/************************************************************
*
* Appointment Database constants.
*
*************************************************************/
#define apptMaxPerDay 100 // max appointments displayable on a day.
#define apptNoTime -1 // start time of an untimed appt.
#define apptNoEndDate -1 // end date of appts that repeat forever
#define apptNoAlarm -1
#define apptMaxEndTime 0x1737 // 11:55 pm, hours in high byte, minutes in low byte
#define apptMaxDisplayableAlarms 10
/************************************************************
*
* Appointment Database structures.
*
*************************************************************/
// The format of a packed appointment record is as follows:
//
// ApptDateTimeType when;
// ApptDBRecordFlags flags; // A flag set for each datum present
// AlarmInfoType alarm; // optional
// RepeatInfoType repeat; // optional
// ExceptionsListType exceptions; // optional
// char [] note; // null terminated, optional
// char [] description; // null terminated
//
// All optional data may or may not appear.
// Alarm advance - the period of time before the appointment that the
// alarm should sound.
//
typedef enum alarmTypes {aauMinutes, aauHours, aauDays} AlarmUnitType;
typedef struct {
SByte advance; // Alarm advance (-1 = no alarm)
AlarmUnitType advanceUnit; // minutes, hours, days
} AlarmInfoType;
// The following enum is used to specify the frequency of
// repeating appointments.
//
enum repeatTypes {
repeatNone,
repeatDaily,
repeatWeekly,
repeatMonthlyByDay,
repeatMonthlyByDate,
repeatYearly
};
typedef enum repeatTypes RepeatType;
// This structure contains information about repeat appointments. The
// repeatOn member is only used by weelky and monthly-by-day repeating
// appointments. For weekly the byte is a bit field that contains the
// days of the week the appointments occurs on (bit: 0-sun, 1-mon,
// 2-tue, etc.). For monthly-by-day the byte contains the day the
// appointments occurs, (ex: the 3rd friday), the byte is of type
// DayOfMonthType.
//
typedef struct {
RepeatType repeatType; // daily, weekly, monthlyByDay, etc.
DateType repeatEndDate; // minus one if forever
unsigned char repeatFrequency; // i.e. every 2 days if repeatType daily
unsigned char repeatOn; // monthlyByDay and repeatWeekly only
unsigned char repeatStartOfWeek;// repeatWeekly only
} RepeatInfoType;
typedef RepeatInfoType * RepeatInfoPtr;
// This structure contains information about the date and time of an
// appointment.
//
typedef struct {
TimeType startTime; // Time the appointment starts
TimeType endTime; // Time the appointment ends
DateType date; // date of appointment
} ApptDateTimeType;
// This is the structure for a repeating appointment's exceptions list. The
// exceptions list is a variable length list of dates that the repeating appointment
// should not appear on. The list is in chronological order.
//
typedef struct {
UInt numExceptions;
DateType exception;
} ExceptionsListType;
typedef ExceptionsListType * ExceptionsListPtr;
// This structure describes what information is present in an
// AppointmentPackedDBRecordType
typedef struct {
unsigned when :1; // set if when info changed (ApptChangeRecord)
unsigned alarm :1; // set if record contains alarm info
unsigned repeat :1; // set if record contains repeat info
unsigned note :1; // set if record contains a note
unsigned exceptions :1; // set if record contains exceptions list
unsigned description :1;
} ApptDBRecordFlags;
// ApptDBRecordType
//
// This is the record used by the application. All pointers are either NULL
// or point to data within the PackedDB record. All strings are null
// character terminated.
typedef struct {
ApptDateTimeType * when;
AlarmInfoType * alarm;
RepeatInfoType * repeat;
ExceptionsListType * exceptions;
CharPtr description;
CharPtr note;
} ApptDBRecordType;
typedef ApptDBRecordType * ApptDBRecordPtr;
// ApptGetAppointments returns an array of the following structures.
typedef struct {
TimeType startTime;
TimeType endTime;
UInt recordNum;
} ApptInfoType;
typedef ApptInfoType * ApptInfoPtr;
/************************************************************
*
* Appointment database routines.
*
*************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
Err ApptAppInfoInit (DmOpenRef dbP);
Err ApptGetRecord (DmOpenRef dbP, UInt index, ApptDBRecordPtr r,
VoidHand * handleP);
Err ApptNewRecord (DmOpenRef dbP, ApptDBRecordPtr r, UInt *index);
Err ApptChangeRecord (DmOpenRef dbP, UInt *index, ApptDBRecordPtr r,
ApptDBRecordFlags changedFields);
Err ApptAddException (DmOpenRef dbP, UInt *index, DateType date);
Boolean ApptFindFirst (DmOpenRef dbP, DateType date, UIntPtr indexP);
Boolean ApptRepeatsOnDate (ApptDBRecordPtr apptRec, DateType date);
Boolean ApptNextRepeat (ApptDBRecordPtr apptRec, DatePtr dateP);
ULong ApptGetAlarmTime (ApptDBRecordPtr apptRec, ULong currentTime);
VoidHand ApptGetAlarmsList (DmOpenRef dbP, ULong alarmTime, UIntPtr countP,
BooleanPtr quite);
void ApptGetNextAlarm (DmOpenRef dbP);
ULong ApptGetTimeOfNextAlarm (DmOpenRef dbP, ULong timeInSeconds);
void ApptSort (DmOpenRef dbP);
void ApptGetAppointments (DmOpenRef dbP, DateType date, Word days,
VoidHand apptLists [], UInt counts []);
#ifdef __cplusplus
}
#endif
#endif