DDFField Class Reference

#include <iso8211.h>

List of all members.

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 it's 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

void DDFField::Dump ( FILE *  fp  ) 

Write out field contents to debugging file.

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

Parameters:
fp The standard io file handle to write to. ie. stderr
const char* DDFField::GetData (  )  [inline]

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

int DDFField::GetDataSize (  )  [inline]

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

DDFFieldDefn* DDFField::GetFieldDefn (  )  [inline]

Fetch the corresponding DDFFieldDefn.

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:
nInstance a value from 0 to GetRepeatCount()-1.
pnInstanceSize a 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.
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 demonstation of handling repeated fields properly.
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:
poSFDefn The definition of the subfield for which the raw data pointer is desired.
pnMaxBytes The maximum number of bytes that can be accessed from the returned data pointer is placed in this int, unless it is NULL.
iSubfieldIndex The 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:

Generated on 2 Aug 2014 for ISO8211Lib by  doxygen 1.6.1