home *** CD-ROM | disk | FTP | other *** search
-
-
-
- DATELINK unit
-
- A TP 5.5 OOP unit for keeping track of dates
-
- Rob Rosenberger CIS: 74017,1344
- Barn Owl Software VOX: (618) 632-7345
- P.O. Box #74 BBS: (618) 398-5703
- O'Fallon, IL 62269 HST: (618) 398-2305
-
- This unit provides a heap-managed linked list object (OOP)
- which keeps track of any number of dates in sorted order. It was
- originally set up to store dates corresponding to holidays but,
- because of the nature of OOP, you can use DateLink variables to
- keep track of multiple linked lists of dates for any purpose.
-
- The DateLink unit builds on the OBJECTS.PAS unit from disk
- #3 of the TP 5.5 master disk set, the OBJECTA.PAS unit available
- on CompuServe in the BPROGA forum, LIB 1, filename OBJA.ARC, and
- on the TpDate unit supplied by TurboPower Software in their TPRO5
- toolkit. (OBJECTS.PAS and TpDate are copyrighted works.)
-
- The DateLink unit requires DATEOBJ.PAS, another unit that
- builds on OBJECTS.PAS. The DateObj source should be kept in the
- same directory with the DateLink source. DateObj is transparent
- to the programmer -- DateLink is the one that does all the work
- for you. Therefore, DateObj's capabilities are beyond the scope
- of this documentation.
-
-
- Version 1.00: released to the public domain on 8 July 1989.
-
-
-
-
- TYPE
- DateLinkList
- = OBJECT(LinkList)
- CurrentDatePtr : DateObjectPtr;
-
- CONSTRUCTOR Init;
- PROCEDURE AddDate(TheDate : Date);
- PROCEDURE DeleteDate(TheDate : Date);
- FUNCTION Exists(TheDate : Date) : BOOLEAN;
- FUNCTION CurrentDate : Date;
- FUNCTION FirstDate : Date;
- FUNCTION LastDate : Date;
- PROCEDURE Advance;
- END;
-
-
- CONSTRUCTOR DateLinkList.Init;
-
- This procedure initializes the DateLinkList variable. The
- Done destructor (inherited) should be used to free up the heap
- space associated with the list.
-
-
- PROCEDURE DateLinkList.AddDate(TheDate : Date);
-
- This procedure stores TheDate in the list. It does nothing
- if TheDate already exists on the list.
-
-
- PROCEDURE DateLinkList.DeleteDate(TheDate : Date);
-
- This procedure deletes TheDate from the list. It does
- nothing if TheDate doesn't exist on the list.
-
-
- FUNCTION DateLinkList.Exists(TheDate : Date) : BOOLEAN;
-
- This function determines if the date exists on the list.
-
-
- FUNCTION DateLinkList.CurrentDate : Date;
-
- The DateLinkList variable type keeps a pointer to what it
- knows to be the "current" date. This lets the Advance function
- move on to the next date without the programmer having to worry
- about it. The FirstDate function initializes CurrentDate; so you
- can then use the Advance function to get successive dates on the
- list. CurrentDate returns BadDate (defined in TPRO5 TpDate) if
- you advance beyond the last date on the list.
-
-
- FUNCTION DateLinkList.FirstDate : Date;
-
- This function simply returns the first date in the list.
- Remember, the list is sorted in ascending order by date. BadDate
- (defined in TPRO5 TpDate) is returned if there are no dates on
- the list. CurrentDate will return the same date after you call
- this function.
-
-
- FUNCTION DateLinkList.LastDate : Date;
-
- This function simply returns the last date in the list.
- Remember, the list is sorted in ascending order by date. BadDate
- (defined in TPRO5 TpDate) is returned if there are no dates on
- the list. CurrentDate will return the same date after you call
- this function.
-
-
- PROCEDURE DateLinkList.Advance;
-
- This procedure advances the current-date pointer to the next
- date in the list. Use the CurrentDate function to find out the
- current date. If you advance past the last date on the list, the
- CurrentDate function will return with BadDate (defined in TPRO5
- TpDate).