📄 iso8211.h
字号:
private: static char *ExtractSubstring( const char * ); DDFModule * poModule; char * pszTag; char * _fieldName; char * _arrayDescr; char * _formatControls; int bRepeatingSubfields; int nFixedWidth; // zero if variable. int BuildSubfields(); int ApplyFormats(); DDF_data_struct_code _data_struct_code; DDF_data_type_code _data_type_code; int nSubfieldCount; DDFSubfieldDefn **papoSubfields;};/************************************************************************//* DDFSubfieldDefn *//* *//* Information from the DDR record for one subfield of a *//* particular field. *//************************************************************************//** * 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). */class DDFSubfieldDefn{public: DDFSubfieldDefn(); ~DDFSubfieldDefn(); void SetName( const char * pszName ); /** Get pointer to subfield name. */ const char *GetName() { return pszName; } /** Get pointer to subfield format string */ const char *GetFormat() { return pszFormatString; } int SetFormat( const char * pszFormat ); /** * Get the general type of the subfield. This can be used to * determine which of ExtractFloatData(), ExtractIntData() or * ExtractStringData() should be used. * @return The subfield type. One of DDFInt, DDFFloat, DDFString or * DDFBinaryString. */ DDFDataType GetType() { return eType; } 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 ); /** Get the subfield width (zero for variable). */ int GetWidth() { return nFormatWidth; } // zero for variable. int GetDefaultValue( char *pachData, int nBytesAvailable, int *pnBytesUsed ); void Dump( FILE * fp );/** Binary format: this is the digit immediately following the B or b for binary formats. */typedef enum { NotBinary=0, UInt=1, SInt=2, FPReal=3, FloatReal=4, FloatComplex=5} DDFBinaryFormat; DDFBinaryFormat GetBinaryFormat(void) const { return eBinaryFormat; } private: char *pszName; // a.k.a. subfield mnemonic char *pszFormatString; DDFDataType eType; DDFBinaryFormat eBinaryFormat;/* -------------------------------------------------------------------- *//* bIsVariable determines whether we using the *//* chFormatDelimeter (TRUE), or the fixed width (FALSE). *//* -------------------------------------------------------------------- */ int bIsVariable; char chFormatDelimeter; int nFormatWidth;/* -------------------------------------------------------------------- *//* Fetched string cache. This is where we hold the values *//* returned from ExtractStringData(). *//* -------------------------------------------------------------------- */ int nMaxBufChars; char *pachBuffer;};/************************************************************************//* DDFRecord *//* *//* Class that contains one DR record from a file. We read into *//* the same record object repeatedly to ensure that repeated *//* leaders can be easily preserved. *//************************************************************************//** * Contains instance data from one data record (DR). The data is contained * as a list of DDFField instances partitioning the raw data into fields. */class DDFRecord{ public: DDFRecord( DDFModule * ); ~DDFRecord(); DDFRecord *Clone(); DDFRecord *CloneOn( DDFModule * ); void Dump( FILE * ); /** Get the number of DDFFields on this record. */ int GetFieldCount() { return nFieldCount; } DDFField *FindField( const char *, int = 0 ); DDFField *GetField( int ); int GetIntSubfield( const char *, int, const char *, int, int * = NULL ); double GetFloatSubfield( const char *, int, const char *, int, int * = NULL ); const char *GetStringSubfield( const char *, int, const char *, int, int * = NULL ); int SetIntSubfield( const char *pszField, int iFieldIndex, const char *pszSubfield, int iSubfieldIndex, int nValue ); int SetStringSubfield( const char *pszField, int iFieldIndex, const char *pszSubfield, int iSubfieldIndex, const char *pszValue, int nValueLength=-1 ); int SetFloatSubfield( const char *pszField, int iFieldIndex, const char *pszSubfield, int iSubfieldIndex, double dfNewValue ); /** Fetch size of records raw data (GetData()) in bytes. */ int GetDataSize() { return nDataSize; } /** * Fetch the raw data for this record. The returned pointer is effectively * to the data for the first field of the record, and is of size * GetDataSize(). */ const char *GetData() { return pachData; } /** * Fetch the DDFModule with which this record is associated. */ DDFModule * GetModule() { return poModule; } int ResizeField( DDFField *poField, int nNewDataSize ); int DeleteField( DDFField *poField ); DDFField* AddField( DDFFieldDefn * ); int CreateDefaultFieldInstance( DDFField *poField, int iIndexWithinField ); int SetFieldRaw( DDFField *poField, int iIndexWithinField, const char *pachRawData, int nRawDataSize ); int UpdateFieldRaw( DDFField *poField, int iIndexWithinField, int nStartOffset, int nOldSize, const char *pachRawData, int nRawDataSize ); int Write(); // This is really just for the DDFModule class. int Read(); void Clear(); int ResetDirectory(); private: int ReadHeader(); DDFModule *poModule; int nReuseHeader; int nFieldOffset; // field data area, not dir entries. int _sizeFieldTag; int _sizeFieldPos; int _sizeFieldLength; int nDataSize; // Whole record except leader with header char *pachData; int nFieldCount; DDFField *paoFields; int bIsClone;};/************************************************************************//* DDFField *//* *//* This object represents one field in a DDFRecord. *//************************************************************************//** * 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(). */class DDFField{ public: void Initialize( DDFFieldDefn *, const char *pszData, int nSize ); void Dump( FILE * fp ); const char *GetSubfieldData( DDFSubfieldDefn *, int * = NULL, int = 0 ); const char *GetInstanceData( int nInstance, int *pnSize ); /** * Return the pointer to the entire data block for this record. This * is an internal copy, and shouldn't be freed by the application. */ const char *GetData() { return pachData; } /** Return the number of bytes in the data block returned by GetData(). */ int GetDataSize() { return nDataSize; } int GetRepeatCount(); /** Fetch the corresponding DDFFieldDefn. */ DDFFieldDefn *GetFieldDefn() { return poDefn; } private: DDFFieldDefn *poDefn; int nDataSize; const char *pachData;};#endif /* ndef _ISO8211_H_INCLUDED */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -