Link to: header | other data directory
Copyright Turtle Creek Software 1996-2006. All Rights Reserved.
Comments
CTimeComparator
This class compares time values for the Goldenseal job cost accounting software,
project management software, construction
estimating software
and construction project estimating software.
It's a convenient way to sort TTimeArray items by date and time. We use this
to maintain the time array for scheduling appointment reminders.
SUPERCLASS = CTCS_ArrayComparator
Source Code
/*****************************************************************************
CTimeComparator Compare TCS 2/1/01
Compare two accounts by their time
******************************************************************************/
SInt32 CTimeComparator::Compare(const void *inItemOne, const void *inItemTwo,
UInt32 inSizeOne, UInt32 inSizeTwo) const
{
// We want to be sure we are being passed the correct pointers
TCS_ASSERTMsg(inSizeOne == sizeof(STimeInfo) &&
inSizeTwo == sizeof(STimeInfo), TCS_GetErrString(errID_ProblemDataSize));
TCS_FailNILMsg(inItemOne, TCS_GetErrString(errID_BadComparator));
TCS_FailNILMsg(inItemTwo, TCS_GetErrString(errID_BadComparator));
// Get the structs
STimeInfo *structOne = ((STimeInfo *)inItemOne);
STimeInfo *structTwo = ((STimeInfo *)inItemTwo);
TCS_FailNILMsg(structOne, TCS_GetErrString(errID_BadComparator)); // TCS 12/2/02
TCS_FailNILMsg(structTwo, TCS_GetErrString(errID_BadComparator));
// Compare the basic dates
if (structOne->basicDate < structTwo->basicDate)
{
return compare_Less;
}
else if (structOne->basicDate == structTwo->basicDate)
{
return compare_Equal;
}
else
{
return compare_Greater;
}
}
|