home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
VSCPPv8.zip
/
VACPP
/
IBMCPP
/
samples
/
VISBUILD
/
RAPSHEET
/
CPPOV23
/
IARSTREC.CPP
< prev
next >
Wrap
Text File
|
1995-05-15
|
5KB
|
137 lines
//****************************************************************************
// IArrestRecord Class - C++ Source File (iarstrec.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 "iarstrec.hpp" //IArrestRecord header
/*******************************************************************
* Manager Member Functions
*******************************************************************/
IArrestRecord :: IArrestRecord() :
IRecord(),
dMySize(14L)
{
dParentSize = size();
setSize( dParentSize + dMySize ); //pad with '\x00'
}
IArrestRecord :: IArrestRecord ( const IString & stringData ) :
IRecord(),
dMySize(14L)
{
dParentSize = size();
*this = stringData;
setSize( dParentSize + dMySize ); //truncate or pad as appropriate
}
IArrestRecord :: IArrestRecord ( const IArrestRecord & aRecord ) :
IRecord(),
dMySize(14L)
{
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).
*-----------------------------------------------------------------*/
}
IArrestRecord :: ~IArrestRecord()
{
}
/*******************************************************************
* Access Member Functions
*******************************************************************/
/*------------------------------------------------------------------
* charge
*-----------------------------------------------------------------*/
unsigned short IArrestRecord :: charge () const
{
unsigned short buffer;
return field(buffer, 1);
}
IArrestRecord & IArrestRecord :: setCharge
(unsigned short iCharge)
{
setField(iCharge, 1);
return *this;
}
/*------------------------------------------------------------------
* status
*-----------------------------------------------------------------*/
unsigned short IArrestRecord :: status () const
{
unsigned short buffer;
return field(buffer, 3);
}
IArrestRecord & IArrestRecord :: setStatus
(unsigned short iStatus)
{
setField(iStatus, 3);
return *this;
}
/*------------------------------------------------------------------
* statusDate
*-----------------------------------------------------------------*/
IString IArrestRecord :: statusDate () const
{
IString buffer;
return field(buffer, 5, 10); //pad with NULLs
}
IArrestRecord & IArrestRecord :: setStatusDate
(const IString & iStatusDate)
{
setField(iStatusDate, 5, 10); //pad with NULLs
return *this;
}
/*******************************************************************
* Implementor Member Functions
*******************************************************************/
/*------------------------------------------------------------------------------
| Function Name: IArrestRecord :: operator =
|
| Implementation:
| Replace our data with the source IArrestRecord data.
------------------------------------------------------------------------------*/
IArrestRecord & IArrestRecord :: operator = ( const IArrestRecord & aRecord )
{
IRecord::operator=(aRecord);
return( *this );
}
/*------------------------------------------------------------------------------
| Function Name: IArrestRecord :: operator =
|
| Implementation:
| Replace our data with the source IString data.
------------------------------------------------------------------------------*/
IArrestRecord & IArrestRecord :: operator = ( const IString & aString )
{
IRecord::operator=(aString);
setSize (dParentSize + dMySize);
return( *this );
}