#include <iso8211.h>
Public Types | |
enum | DDFBinaryFormat |
Public Member Functions | |
const char * | GetName () |
const char * | GetFormat () |
DDFDataType | GetType () |
double | ExtractFloatData (const char *pachData, int nMaxBytes, int *pnConsumedBytes) |
int | ExtractIntData (const char *pachData, int nMaxBytes, int *pnConsumedBytes) |
const char * | ExtractStringData (const char *pachData, int nMaxBytes, int *pnConsumedBytes) |
int | GetDataLength (const char *, int, int *) |
void | DumpData (const char *pachData, int nMaxBytes, FILE *fp) |
int | FormatStringValue (char *pachData, int nBytesAvailable, int *pnBytesUsed, const char *pszValue, int nValueLength=-1) |
int | FormatIntValue (char *pachData, int nBytesAvailable, int *pnBytesUsed, int nNewValue) |
int | FormatFloatValue (char *pachData, int nBytesAvailable, int *pnBytesUsed, double dfNewValue) |
int | GetWidth () |
int | GetDefaultValue (char *pachData, int nBytesAvailable, int *pnBytesUsed) |
void | Dump (FILE *fp) |
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).
Binary format: this is the digit immediately following the B or b for binary formats.
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.
fp | The standard io file handle to write to. ie. stderr |
void DDFSubfieldDefn::DumpData | ( | const char * | pachData, | |
int | nMaxBytes, | |||
FILE * | fp | |||
) |
Dump subfield value to debugging file.
pachData | Pointer to data for this subfield. | |
nMaxBytes | Maximum number of bytes available in pachData. | |
fp | File to write report to. |
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.
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. |
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.
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. |
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.
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. |
int DDFSubfieldDefn::FormatFloatValue | ( | char * | pachData, | |
int | nBytesAvailable, | |||
int * | pnBytesUsed, | |||
double | dfNewValue | |||
) |
Format float subfield value.
Returns a buffer with the passed in float value reformatted in a way suitable for storage in a DDFField for this subfield.
int DDFSubfieldDefn::FormatIntValue | ( | char * | pachData, | |
int | nBytesAvailable, | |||
int * | pnBytesUsed, | |||
int | nNewValue | |||
) |
Format int subfield value.
Returns a buffer with the passed in int value reformatted in a way suitable for storage in a DDFField for this subfield.
int DDFSubfieldDefn::FormatStringValue | ( | char * | pachData, | |
int | nBytesAvailable, | |||
int * | pnBytesUsed, | |||
const char * | pszValue, | |||
int | nValueLength = -1 | |||
) |
Format string subfield value.
Returns a buffer with the passed in string value reformatted in a way suitable for storage in a DDFField for this subfield.
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().
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. |
int DDFSubfieldDefn::GetDefaultValue | ( | char * | pachData, | |
int | nBytesAvailable, | |||
int * | pnBytesUsed | |||
) |
Get default data.
Returns the default subfield data contents for this subfield definition. For variable length numbers this will normally be "0<unit-terminator>". For variable length strings it will be "<unit-terminator>". For fixed length numbers it is zero filled. For fixed length strings it is space filled. For binary numbers it is binary zero filled.
pachData | the buffer into which the returned default will be placed. May be NULL if just querying default size. | |
nBytesAvailable | the size of pachData in bytes. | |
pnBytesUsed | will receive the size of the subfield default data in bytes. |
const char* DDFSubfieldDefn::GetFormat | ( | ) | [inline] |
Get pointer to subfield format string
const char* DDFSubfieldDefn::GetName | ( | ) | [inline] |
Get pointer to subfield name.
DDFDataType DDFSubfieldDefn::GetType | ( | ) | [inline] |
Get the general type of the subfield. This can be used to determine which of ExtractFloatData(), ExtractIntData() or ExtractStringData() should be used.
int DDFSubfieldDefn::GetWidth | ( | ) | [inline] |
Get the subfield width (zero for variable).