Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

DDFSubfieldDefn Class Reference

Information from the DDR record describing one subfield of a DDFFieldDefn. More...

#include <iso8211.h>

List of all members.


Public Members

const char* GetName ()
Get pointer to subfield name.

const char* GetFormat ()
Get pointer to subfield format string.

DDFDataType GetType ()
Get the general type of the subfield. More...

double ExtractFloatData ( const char *pachData, int nMaxBytes, int * pnConsumedBytes )
Extract a subfield value as a float. More...

int ExtractIntData ( const char *pachData, int nMaxBytes, int * pnConsumedBytes )
Extract a subfield value as an integer. More...

const char* ExtractStringData ( const char *pachData, int nMaxBytes, int * pnConsumedBytes )
Extract a zero terminated string containing the data for this subfield. More...

int GetDataLength ( const char *, int, int * )
Scan for the end of variable length data. More...

void DumpData ( const char *pachData, int nMaxBytes, FILE * fp )
Dump subfield value to debugging file. More...

int GetWidth ()
Get the subfield width (zero for variable).

void Dump ( FILE * fp )
Write out subfield definition info to debugging file. More...


Detailed Description

Information from the DDR record describing one subfield of a DDFFieldDefn.

All subfields of a field will occur in each occurance of that field (as a DDFField) in a DDFRecord. Subfield's actually contain formatted data (as instances within a record).


Member Function Documentation

DDFDataType DDFSubfieldDefn::GetType ()

Get the general type of the subfield.

This can be used to determine which of ExtractFloatData(), ExtractIntData() or ExtractStringData() should be used.

Returns:
The subfield type. One of DDFInt, DDFFloat, DDFString or DDFBinaryString.

double DDFSubfieldDefn::ExtractFloatData (const char * pachSourceData, int nMaxBytes, int * pnConsumedBytes)

Extract a subfield value as a float.

Given a pointer to the data for this subfield (from within a DDFRecord) this method will return the floating point data for this subfield. The number of bytes consumed as part of this field can also be fetched. This method may be called for any type of subfield, and will return zero if the subfield is not numeric.

Parameters:
pachSourceData - The pointer to the raw data for this field. This may have come from DDFRecord::GetData(), taking into account skip factors over previous subfields data.
nMaxBytes - The maximum number of bytes that are accessable after pachSourceData.
pnConsumedBytes - Pointer to an integer into which the number of bytes consumed by this field should be written. May be NULL to ignore. This is used as a skip factor to increment pachSourceData to point to the next subfields data.

Returns:
The subfield's numeric value (or zero if it isn't numeric).

See also:
ExtractIntData(), ExtractStringData()

int DDFSubfieldDefn::ExtractIntData (const char * pachSourceData, int nMaxBytes, int * pnConsumedBytes)

Extract a subfield value as an integer.

Given a pointer to the data for this subfield (from within a DDFRecord) this method will return the int data for this subfield. The number of bytes consumed as part of this field can also be fetched. This method may be called for any type of subfield, and will return zero if the subfield is not numeric.

Parameters:
pachSourceData - The pointer to the raw data for this field. This may have come from DDFRecord::GetData(), taking into account skip factors over previous subfields data.
nMaxBytes - The maximum number of bytes that are accessable after pachSourceData.
pnConsumedBytes - Pointer to an integer into which the number of bytes consumed by this field should be written. May be NULL to ignore. This is used as a skip factor to increment pachSourceData to point to the next subfields data.

Returns:
The subfield's numeric value (or zero if it isn't numeric).

See also:
ExtractFloatData(), ExtractStringData()

const char * DDFSubfieldDefn::ExtractStringData (const char * pachSourceData, int nMaxBytes, int * pnConsumedBytes)

Extract a zero terminated string containing the data for this subfield.

Given a pointer to the data for this subfield (from within a DDFRecord) this method will return the data for this subfield. The number of bytes consumed as part of this field can also be fetched. This number may be one longer than the string length if there is a terminator character used.

This function will return the raw binary data of a subfield for types other than DDFString, including data past zero chars. This is the standard way of extracting DDFBinaryString subfields for instance.

Parameters:
pachSourceData - The pointer to the raw data for this field. This may have come from DDFRecord::GetData(), taking into account skip factors over previous subfields data.
nMaxBytes - The maximum number of bytes that are accessable after pachSourceData.
pnConsumedBytes - Pointer to an integer into which the number of bytes consumed by this field should be written. May be NULL to ignore. This is used as a skip factor to increment pachSourceData to point to the next subfields data.

Returns:
A pointer to a buffer containing the data for this field. The returned pointer is to an internal buffer which is invalidated on the next ExtractStringData() call on this DDFSubfieldDefn(). It should not be freed by the application.

See also:
ExtractIntData(), ExtractFloatData()

int DDFSubfieldDefn::GetDataLength (const char * pachSourceData, int nMaxBytes, int * pnConsumedBytes)

Scan for the end of variable length data.

Given a pointer to the data for this subfield (from within a DDFRecord) this method will return the number of bytes which are data for this subfield. The number of bytes consumed as part of this field can also be fetched. This number may be one longer than the length if there is a terminator character used.

This method is mainly for internal use, or for applications which want the raw binary data to interpret themselves. Otherwise use one of ExtractStringData(), ExtractIntData() or ExtractFloatData().

Parameters:
pachSourceData - The pointer to the raw data for this field. This may have come from DDFRecord::GetData(), taking into account skip factors over previous subfields data.
nMaxBytes - The maximum number of bytes that are accessable after pachSourceData.
pnConsumedBytes - Pointer to an integer into which the number of bytes consumed by this field should be written. May be NULL to ignore.

Returns:
The number of bytes at pachSourceData which are actual data for this record (not including unit, or field terminator).

void DDFSubfieldDefn::DumpData (const char * pachData, int nMaxBytes, FILE * fp)

Dump subfield value to debugging file.

Parameters:
pachData - Pointer to data for this subfield.
nMaxBytes - Maximum number of bytes available in pachData.
fp - File to write report to.

void DDFSubfieldDefn::Dump (FILE * fp)

Write out subfield definition info to debugging file.

A variety of information about this field definition is written to the give debugging file handle.

Parameters:
fp - The standard io file handle to write to. ie. stderr

The documentation for this classwas generated from the following files:
Generated at Wed Sep 22 10:32:07 1999 for SDTS_AL by doxygen  written by Dimitri van Heesch, © 1997-1999