Accounting Software
Small Business Software Estimating Software
Inventory SoftwareInventory Control SoftwareInventory Tracking SoftwareInventory Management SoftwareConstruction Management SoftwareProject Management SoftwareBusiness Management Software

Data Holders (Source Code)

Link to: header | other data directory

Copyright Turtle Creek Software 1996-2006. All Rights Reserved.

Comments

CHolder

an abstract base class for classes which manage some piece of data.
Generally we don't change the value of a holder after it is created-
instead we just delete it and replace it with a different holder

This class manages data storage in tables for the Goldenseal accounting software,
project management software and construction project estimating software.

*************

CDataHolder

also abstract, but takes CHolder one step further
by allowing for a data type, via a template

SUPERCLASS = CHolder

*************

CStringHolder string data
CDateHolder-- dates
CTimeHolder-- time
CCVHolder-- data for clairvoyant fields
CPercentHolder-- a percent value
CMoneyHolder-- a money value
CEMoneyHolder-- a money value showing with extra decimals
CRealHolder-- a real value
CInt32Holder-- a long value or ID
CBooleanHolder-- a boolean value

SUPERCLASS = CDataHolder

Source Code

/*********************************************************************************

ConvertValueTo

convert the string value to some other data type
*********************************************************************************/
Boolean CStringHolder::ConvertValueTo(void *aValue, const SInt32 aType) const
{
return DB_PersistentObject::ConvertMember(&mData, type_cstring, aValue, aType);
}/*********************************************************************************

ConvertValueFrom

convert the given data value to our string
*********************************************************************************/
Boolean CStringHolder::ConvertValueFrom(const void *aValue, const SInt32 aType)
{
return DB_PersistentObject::ConvertMember(aValue, aType, &mData, type_cstring);
}/*********************************************************************************

ReadData

read the string data from a stream
*********************************************************************************/
void CStringHolder::ReadData(CNeoStream &stream)
{
ReadTextFromStream(&stream, &mData);
}/*********************************************************************************

WriteData

write the string data out to a stream
*********************************************************************************/
void CStringHolder::WriteData(CNeoStream &stream) const
{
WriteTextToStream(&stream, mData, cMenuTextLen); // TCS added max length 6/20/98
}

/*********************************************************************************

CCVDataHolder TCS 1/13/02
ConvertValueTo

convert the value of the cv to another type
*********************************************************************************/
Boolean CCVDataHolder::ConvertValueTo(void *aValue, const SInt32 aType) const
{
if (aType == type_cstring)
return DB_PersistentObject::ConvertMember(&mData.itemName, type_cstring, aValue, aType);
else
return DB_PersistentObject::ConvertMember(&mData.id, type_objectid, aValue, aType);
}/*********************************************************************************

CCVDataHolder TCS 1/13/02
ConvertValueFrom

convert the given data value to our string
*********************************************************************************/
Boolean CCVDataHolder::ConvertValueFrom(const void *aValue, const SInt32 aType)
{
if (aType == type_cstring)
return DB_PersistentObject::ConvertMember(aValue, aType, &mData.itemName, type_cstring);
else

return DB_PersistentObject::ConvertMember(aValue, aType, &mData.id, type_objectid);
}
#if CAN_USE_MARK
#pragma mark -
#endif
/*********************************************************************************

CDateHolder
ConvertValueTo

convert the string value to some other data type
*********************************************************************************/
Boolean CDateHolder::ConvertValueTo(void *aValue, const SInt32 aType) const
{
return DB_PersistentObject::ConvertMember(&mData, type_date, aValue, aType);
}/*********************************************************************************

CDateHolder
ConvertValueFrom

convert the given data value to our string
*********************************************************************************/
Boolean CDateHolder::ConvertValueFrom(const void *aValue, const SInt32 aType)
{
return DB_PersistentObject::ConvertMember(aValue, aType, &mData, type_date);
}#if CAN_USE_MARK
#pragma mark -
#endif
/*********************************************************************************

CTimeHolder
ConvertValueTo

convert the string value to some other data type
*********************************************************************************/
Boolean CTimeHolder::ConvertValueTo(void *aValue, const SInt32 aType) const
{
return DB_PersistentObject::ConvertMember(&mData, type_time, aValue, aType);
}/*********************************************************************************

CTimeHolder
ConvertValueFrom

convert the given data value to our string
*********************************************************************************/
Boolean CTimeHolder::ConvertValueFrom(const void *aValue, const SInt32 aType)
{
return DB_PersistentObject::ConvertMember(aValue, aType, &mData, type_time);
}#if CAN_USE_MARK
#pragma mark -
#endif
/*********************************************************************************

CPercentHolder
ConvertValueTo

convert the string value to some other data type
*********************************************************************************/
Boolean CPercentHolder::ConvertValueTo(void *aValue, const SInt32 aType) const
{
return DB_PersistentObject::ConvertMember(&mData, type_percent, aValue, aType);
}/*********************************************************************************

CPercentHolder
ConvertValueFrom

convert the given data value to our string
*********************************************************************************/
Boolean CPercentHolder::ConvertValueFrom(const void *aValue, const SInt32 aType)
{
return DB_PersistentObject::ConvertMember(aValue, aType, &mData, type_percent);
}#if CAN_USE_MARK
#pragma mark -
#endif
/*********************************************************************************

CMoneyHolder
ConvertValueTo

convert the string value to some other data type
*********************************************************************************/
Boolean CMoneyHolder::ConvertValueTo(void *aValue, const SInt32 aType) const
{
return DB_PersistentObject::ConvertMember(&mData, type_money, aValue, aType);
}/*********************************************************************************

CMoneyHolder
ConvertValueFrom

convert the given data value to our string
*********************************************************************************/
Boolean CMoneyHolder::ConvertValueFrom(const void *aValue, const SInt32 aType)
{
return DB_PersistentObject::ConvertMember(aValue, aType, &mData, type_money);
}#if CAN_USE_MARK
#pragma mark -
#endif
/*********************************************************************************

CEMoneyHolder TCS 3/1/99
ConvertValueTo

convert the string value to some other data type
*********************************************************************************/
Boolean CEMoneyHolder::ConvertValueTo(void *aValue, const SInt32 aType) const
{
return DB_PersistentObject::ConvertMember(&mData, type_emoney, aValue, aType);
}/*********************************************************************************

CEMoneyHolder TCS 3/1/99
ConvertValueFrom

convert the given data value to our string
*********************************************************************************/
Boolean CEMoneyHolder::ConvertValueFrom(const void *aValue, const SInt32 aType)
{
return DB_PersistentObject::ConvertMember(aValue, aType, &mData, type_emoney);
}#if CAN_USE_MARK
#pragma mark -
#endif
/*********************************************************************************

CNumberHolder
ConvertValueTo

convert the string value to some other data type
*********************************************************************************/
Boolean CNumberHolder::ConvertValueTo(void *aValue, const SInt32 aType) const
{
return DB_PersistentObject::ConvertMember(&mData, type_number, aValue, aType);
}/*********************************************************************************

CNumberHolder
ConvertValueFrom

convert the given data value to our string
*********************************************************************************/
Boolean CNumberHolder::ConvertValueFrom(const void *aValue, const SInt32 aType)
{
return DB_PersistentObject::ConvertMember(aValue, aType, &mData, type_number);
}#if CAN_USE_MARK
#pragma mark -
#endif
/*********************************************************************************

CRealHolder
ConvertValueTo
convert the string value to some other data type
*********************************************************************************/
Boolean CRealHolder::ConvertValueTo(void *aValue, const SInt32 aType) const
{
return DB_PersistentObject::ConvertMember(&mData, type_real, aValue, aType);
}/*********************************************************************************

CRealHolder
ConvertValueFrom
convert the given data value to our string
*********************************************************************************/
Boolean CRealHolder::ConvertValueFrom(const void *aValue, const SInt32 aType)
{
return DB_PersistentObject::ConvertMember(aValue, aType, &mData, type_real);
}#if CAN_USE_MARK
#pragma mark -
#endif
/*********************************************************************************

CInt32Holder
ConvertValueTo

convert the string value to some other data type
*********************************************************************************/
Boolean CInt32Holder::ConvertValueTo(void *aValue, const SInt32 aType) const
{
return DB_PersistentObject::ConvertMember(&mData, type_long, aValue, aType);
}/*********************************************************************************

CInt32Holder
ConvertValueFrom

convert the given data value to our string
*********************************************************************************/
Boolean CInt32Holder::ConvertValueFrom(const void *aValue, const SInt32 aType)
{
return DB_PersistentObject::ConvertMember(aValue, aType, &mData, type_long);
}#if CAN_USE_MARK
#pragma mark -
#endif
/*********************************************************************************

CBooleanHolder
ConvertValueTo

convert the string value to some other data type
*********************************************************************************/
Boolean CBooleanHolder::ConvertValueTo(void *aValue, const SInt32 aType) const
{
return DB_PersistentObject::ConvertMember(&mData, type_boolean, aValue, aType);
}/*********************************************************************************

CBooleanHolder
ConvertValueFrom

convert the given data value to our string
*********************************************************************************/
Boolean CBooleanHolder::ConvertValueFrom(const void *aValue, const SInt32 aType)
{
return DB_PersistentObject::ConvertMember(aValue, aType, &mData, type_boolean);
}