Should VDK_Date, VDK_Time, VDK_DateTime have value methods operator = and such?

Matthew Jew mjew at icnc.com
Thu Sep 18 20:49:38 CDT 2003


Ruslan,

Would it be useful to have operator = and value getters for the various
Date and Time classes?

I find myself needing to copy values from one table to another, and now 
I have to
do something like:

long	aYear;
ushort	aMonth;
ushort	aDay;
ushort	anHour;
ushort	aMinute;
ushort	aSecond;

theSourceTable->modDateTimeField.GetDate( aYear, aMonth, aDay );
theSourceTable->modDateTimeField.GetTime( anHour, aMinute, aSecond );

... and then later ...

theDestinationTable->modDateTimeField.SetDate( aYear, aMonth, aDay );
theDestinationTable->modDateTimeField.SetTime( anHour, aMinute, aSecond 
);

Even worse, I need to retrieve hundreds of these DateTimes in a batch,
store the data, and then save them in a batch later to the destination.
That adds even more work, as I either need to store 6 pieces of data for
each DateTime, or encode them into a llong just to decode them later
into 6 pieces of data to store each DateTime.

If there were an = operator and value getter, one could just do:

llong aDateTimeValue;

aDateTimeValue = theSourceTable->modDateTimeField;

... and then later ...

theDestinationTable->modDateTimeField = aDateTimeValue;

Actually, if VDK_DateTime were a subclass of VDK_LLong,
and if VDK_Date were a subclass of VDK_Long,
and if VDK_Time were a subclass of VDK_ULong, you would get it for free.

Anyway, I'm assuming there was a reason *not* to have operator = and 
such for
VDK_DateTime, VDK_Date, and VDK_Time, but I am not sure what that 
reason is.

Would it be possible to have value methods for VDK_DateTime, VDK_Date, 
and VDK_Time?
Or would that be a bad idea?

- Matthew




More information about the Valentina mailing list