ISO8211Lib
Public Member Functions | List of all members
DDFField Class Reference

#include <iso8211.h>

Public Member Functions

void Dump (FILE *fp)
 
const char * GetSubfieldData (DDFSubfieldDefn *, int *=NULL, int=0)
 
const char * GetInstanceData (int nInstance, int *pnSize)
 
const char * GetData ()
 
int GetDataSize ()
 
int GetRepeatCount ()
 
DDFFieldDefnGetFieldDefn ()
 

Detailed Description

This object represents one field in a DDFRecord. This models an instance of the fields data, rather than its data definition, which is handled by the DDFFieldDefn class. Note that a DDFField doesn't have DDFSubfield children as you would expect. To extract subfield values use GetSubfieldData() to find the right data pointer and then use ExtractIntData(), ExtractFloatData() or ExtractStringData().

Member Function Documentation

◆ Dump()

void DDFField::Dump ( FILE *  fp)

Write out field contents to debugging file.

A variety of information about this field, and all its subfields is written to the given debugging file handle. Note that field definition information (ala DDFFieldDefn) isn't written.

Parameters
fpThe standard IO file handle to write to. i.e. stderr

◆ GetData()

const char* DDFField::GetData ( )
inline

Return the pointer to the entire data block for this record. This is an internal copy, and should not be freed by the application.

◆ GetDataSize()

int DDFField::GetDataSize ( )
inline

Return the number of bytes in the data block returned by GetData().

◆ GetFieldDefn()

DDFFieldDefn* DDFField::GetFieldDefn ( )
inline

Fetch the corresponding DDFFieldDefn.

◆ GetInstanceData()

const char * DDFField::GetInstanceData ( int  nInstance,
int *  pnInstanceSize 
)

Get field instance data and size.

The returned data pointer and size values are suitable for use with DDFRecord::SetFieldRaw().

Parameters
nInstancea value from 0 to GetRepeatCount()-1.
pnInstanceSizea location to put the size (in bytes) of the field instance data returned. This size will include the unit terminator (if any), but not the field terminator. This size pointer may be NULL if not needed.
Returns
the data pointer, or NULL on error.

◆ GetRepeatCount()

int DDFField::GetRepeatCount ( )

How many times do the subfields of this record repeat? This will always be one for non-repeating fields.

Returns
The number of times that the subfields of this record occur in this record. This will be one for non-repeating fields.
See also
8211view example program for a demonstration of handling repeated fields properly.

◆ GetSubfieldData()

const char * DDFField::GetSubfieldData ( DDFSubfieldDefn poSFDefn,
int *  pnMaxBytes = NULL,
int  iSubfieldIndex = 0 
)

Fetch raw data pointer for a particular subfield of this field.

The passed DDFSubfieldDefn (poSFDefn) should be acquired from the DDFFieldDefn corresponding with this field. This is normally done once before reading any records. This method involves a series of calls to DDFSubfield::GetDataLength() in order to track through the DDFField data to that belonging to the requested subfield. This can be relatively expensive.

Parameters
poSFDefnThe definition of the subfield for which the raw data pointer is desired.
pnMaxBytesThe maximum number of bytes that can be accessed from the returned data pointer is placed in this int, unless it is NULL.
iSubfieldIndexThe instance of this subfield to fetch. Use zero (the default) for the first instance.
Returns
A pointer into the DDFField's data that belongs to the subfield. This returned pointer is invalidated by the next record read (DDFRecord::ReadRecord()) and the returned pointer should not be freed by the application.

The documentation for this class was generated from the following files: