home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
VSCPPv8.zip
/
VACPP
/
IBMCPP
/
samples
/
VISBUILD
/
RAPSHEET
/
CPPOV23
/
ILSREC.CPP
< prev
next >
Wrap
Text File
|
1995-05-15
|
8KB
|
205 lines
//****************************************************************************
// ILastSeenRecord Class - C++ Source File (ilsrec.cpp) *
// *
// COPYRIGHT: Copyright (C) International Business Machines Corp., 1994,1995 *
// *
// DISCLAIMER OF WARRANTIES: *
// The following [enclosed] code is sample code created by IBM *
// Corporation. This sample code is not part of any standard IBM product *
// and is provided to you solely for the purpose of assisting you in the *
// development of your applications. The code is provided "AS IS", *
// without warranty of any kind. IBM shall not be liable for any damages *
// arising out of your use of the sample code, even if they have been *
// advised of the possibility of such damages. *
//****************************************************************************
//NOTE: WE RECOMMEND USING A FIXED-SPACE FONT TO LOOK AT THE SOURCE.
//
#include "ilsrec.hpp" //ILastSeenRecord header
#include <rap.h>
/*******************************************************************
* Manager Member Functions
*******************************************************************/
ILastSeenRecord :: ILastSeenRecord() :
IRecord(),
dMySize(sizeof(LAST_SEEN_STRUCT))
{
dParentSize = size();
setSize( dParentSize + dMySize ); //pad with '\x00'
}
ILastSeenRecord :: ILastSeenRecord ( const IString & stringData ) :
IRecord(),
dMySize(sizeof(LAST_SEEN_STRUCT))
{
dParentSize = size();
*this = stringData;
setSize( dParentSize + dMySize ); //truncate or pad as appropriate
}
ILastSeenRecord :: ILastSeenRecord ( const ILastSeenRecord & aRecord ) :
IRecord(),
dMySize(sizeof(LAST_SEEN_STRUCT))
{
dParentSize = size();
*this = aRecord;
/*------------------------------------------------------------------
* NOTE: this record would have gotten set with the correct size
* if had called the IRecord (aRecord) constructor, but
* need to determine what dParentSize is (the assignment
* operators need this info).
*-----------------------------------------------------------------*/
}
ILastSeenRecord :: ~ILastSeenRecord()
{
}
/*******************************************************************
* Access Member Functions
*******************************************************************/
/*------------------------------------------------------------------
* location
*-----------------------------------------------------------------*/
IString ILastSeenRecord :: location () const
{
IString buffer;
return field(buffer, offsetof(LAST_SEEN_STRUCT, lastSeenLocation)+1, LS_LOC_LEN); //pad with NULLs
}
ILastSeenRecord & ILastSeenRecord :: setLocation
(const IString & iLocation)
{
setField(iLocation, offsetof(LAST_SEEN_STRUCT, lastSeenLocation)+1, LS_LOC_LEN); //pad with NULLs
return *this;
}
/*------------------------------------------------------------------
* witness
*-----------------------------------------------------------------*/
IString ILastSeenRecord :: witness() const
{
IString buffer;
return field(buffer, offsetof(LAST_SEEN_STRUCT, lastSeenWitness)+1, LS_WITNESS_LEN); //pad with NULLs
}
ILastSeenRecord & ILastSeenRecord :: setWitness
(const IString & iWitness)
{
setField(iWitness, offsetof(LAST_SEEN_STRUCT, lastSeenWitness)+1, LS_WITNESS_LEN); //pad with NULLs
return *this;
}
/*------------------------------------------------------------------
* lastSeenDate
*-----------------------------------------------------------------*/
IString ILastSeenRecord :: lastSeenDate() const
{
IString buffer;
return field(buffer, offsetof(LAST_SEEN_STRUCT, lastSeenDate)+1, DATE_LEN); //pad with NULLs
}
ILastSeenRecord & ILastSeenRecord :: setLastSeenDate
(const IString & iLastSeenDate)
{
setField(iLastSeenDate, offsetof(LAST_SEEN_STRUCT, lastSeenDate)+1, DATE_LEN); //pad with NULLs
return *this;
}
/*------------------------------------------------------------------
* street
*-----------------------------------------------------------------*/
IString ILastSeenRecord :: street() const
{
IString buffer;
return field(buffer, offsetof(LAST_SEEN_STRUCT, lastSeenStreet)+1, ADDRESS_STREET_LEN); //pad with NULLs
}
ILastSeenRecord & ILastSeenRecord :: setStreet
(const IString & iStreet)
{
setField(iStreet, offsetof(LAST_SEEN_STRUCT, lastSeenDate)+1, ADDRESS_STREET_LEN); //pad with NULLs
return *this;
}
/*------------------------------------------------------------------
* city
*-----------------------------------------------------------------*/
IString ILastSeenRecord :: city() const
{
IString buffer;
return field(buffer, offsetof(LAST_SEEN_STRUCT, lastSeenCity)+1, ADDRESS_CITY_LEN); //pad with NULLs
}
ILastSeenRecord & ILastSeenRecord :: setCity
(const IString & iStreet)
{
setField(iStreet, offsetof(LAST_SEEN_STRUCT, lastSeenCity)+1, ADDRESS_CITY_LEN); //pad with NULLs
return *this;
}
/*------------------------------------------------------------------
* state
*-----------------------------------------------------------------*/
IString ILastSeenRecord :: state() const
{
IString buffer;
return field(buffer, offsetof(LAST_SEEN_STRUCT, lastSeenState)+1, ADDRESS_STATE_LEN); //pad with NULLs
}
ILastSeenRecord & ILastSeenRecord :: setState
(const IString & iStreet)
{
setField(iStreet, offsetof(LAST_SEEN_STRUCT, lastSeenState)+1, ADDRESS_STATE_LEN); //pad with NULLs
return *this;
}
/*------------------------------------------------------------------
* comment
*-----------------------------------------------------------------*/
IString ILastSeenRecord :: comment() const
{
IString buffer;
return field(buffer, offsetof(LAST_SEEN_STRUCT, lastSeenComment)+1, COMMENT_LEN); //pad with NULLs
}
ILastSeenRecord & ILastSeenRecord :: setComment
(const IString & iComment)
{
setField(iComment, offsetof(LAST_SEEN_STRUCT, lastSeenComment)+1, COMMENT_LEN); //pad with NULLs
return *this;
}
/*******************************************************************
* Implementor Member Functions
*******************************************************************/
/*------------------------------------------------------------------------------
| Function Name: ILastSeenRecord :: operator =
|
| Implementation:
| Replace our data with the source ILastSeenRecord data.
------------------------------------------------------------------------------*/
ILastSeenRecord & ILastSeenRecord :: operator = ( const ILastSeenRecord & aRecord )
{
IRecord::operator=(aRecord);
return( *this );
}
/*------------------------------------------------------------------------------
| Function Name: ILastSeenRecord :: operator =
|
| Implementation:
| Replace our data with the source IString data.
------------------------------------------------------------------------------*/
ILastSeenRecord & ILastSeenRecord :: operator = ( const IString & aString )
{
IRecord::operator=(aString);
setSize (dParentSize + dMySize);
return( *this );
}