30 #ifndef _ISO8211_H_INCLUDED
31 #define _ISO8211_H_INCLUDED
51 long CPL_ODLL DDFScanInt(
const char *pszString,
int nMaxChars );
52 int CPL_ODLL DDFScanVariable(
const char * pszString,
int nMaxChars,
int nDelimChar );
53 char CPL_ODLL *DDFFetchVariable(
const char *pszString,
int nMaxChars,
54 int nDelimChar1,
int nDelimChar2,
55 int *pnConsumedChars );
57 #define DDF_FIELD_TERMINATOR 30
58 #define DDF_UNIT_TERMINATOR 31
86 int Open(
const char * pszFilename,
int bFailQuietly = FALSE );
87 int Create(
const char *pszFilename );
90 int Initialize(
char chInterchangeLevel =
'3',
91 char chLeaderIden =
'L',
92 char chCodeExtensionIndicator =
'E',
93 char chVersionNumber =
'1',
94 char chAppIndicator =
' ',
95 const char *pszExtendedCharSet =
" ! ",
96 int nSizeFieldLength = 3,
97 int nSizeFieldPos = 4,
98 int nSizeFieldTag = 4 );
100 void Dump( FILE * fp );
103 void Rewind(
long nOffset = -1 );
114 int GetFieldControlLength() {
return _fieldControlLength; }
119 VSILFILE *GetFP() {
return fpDDF; }
124 long nFirstRecordOffset;
126 char _interchangeLevel;
127 char _inlineCodeExtensionIndicator;
130 int _fieldControlLength;
131 char _extendedCharSet[4];
135 long _fieldAreaStart;
136 long _sizeFieldLength;
155 typedef enum { dsc_elementary, dsc_vector, dsc_array, dsc_concatenated } DDF_data_struct_code;
156 typedef enum { dtc_char_string,
159 dtc_explicit_point_scaled,
162 dtc_mixed_data_type } DDF_data_type_code;
177 int Create(
const char *pszTag,
const char *pszFieldName,
178 const char *pszDescription,
179 DDF_data_struct_code eDataStructCode,
180 DDF_data_type_code eDataTypeCode,
181 const char *pszFormat = NULL );
183 int bDontAddToFormat = FALSE );
184 void AddSubfield(
const char *pszName,
const char *pszFormat );
185 int GenerateDDREntry(
char **ppachData,
int *pnLength );
187 int Initialize(
DDFModule * poModule,
const char *pszTag,
188 int nSize,
const char * pachRecord );
190 void Dump( FILE * fp );
224 static char *ExpandFormat(
const char * );
229 char *GetDefaultValue(
int *pnSize );
233 static char *ExtractSubstring(
const char * );
240 char * _formatControls;
242 int bRepeatingSubfields;
245 int BuildSubfields();
248 DDF_data_struct_code _data_struct_code;
250 DDF_data_type_code _data_type_code;
277 void SetName(
const char * pszName );
284 int SetFormat(
const char * pszFormat );
296 double ExtractFloatData(
const char *pachData,
int nMaxBytes,
297 int * pnConsumedBytes );
298 int ExtractIntData(
const char *pachData,
int nMaxBytes,
299 int * pnConsumedBytes );
300 const char *ExtractStringData(
const char *pachData,
int nMaxBytes,
301 int * pnConsumedBytes );
302 int GetDataLength(
const char *,
int,
int * );
303 void DumpData(
const char *pachData,
int nMaxBytes, FILE * fp );
305 int FormatStringValue(
char *pachData,
int nBytesAvailable,
306 int *pnBytesUsed,
const char *pszValue,
307 int nValueLength = -1 );
309 int FormatIntValue(
char *pachData,
int nBytesAvailable,
310 int *pnBytesUsed,
int nNewValue );
312 int FormatFloatValue(
char *pachData,
int nBytesAvailable,
313 int *pnBytesUsed,
double dfNewValue );
318 int GetDefaultValue(
char *pachData,
int nBytesAvailable,
321 void Dump( FILE * fp );
336 DDFBinaryFormat GetBinaryFormat(
void)
const {
return eBinaryFormat; }
342 char *pszFormatString;
345 DDFBinaryFormat eBinaryFormat;
353 char chFormatDelimeter;
391 DDFField *FindField(
const char *,
int = 0 );
394 int GetIntSubfield(
const char *,
int,
const char *,
int,
396 double GetFloatSubfield(
const char *,
int,
const char *,
int,
398 const char *GetStringSubfield(
const char *,
int,
const char *,
int,
401 int SetIntSubfield(
const char *pszField,
int iFieldIndex,
402 const char *pszSubfield,
int iSubfieldIndex,
404 int SetStringSubfield(
const char *pszField,
int iFieldIndex,
405 const char *pszSubfield,
int iSubfieldIndex,
406 const char *pszValue,
int nValueLength=-1 );
407 int SetFloatSubfield(
const char *pszField,
int iFieldIndex,
408 const char *pszSubfield,
int iSubfieldIndex,
427 int ResizeField(
DDFField *poField,
int nNewDataSize );
428 int DeleteField(
DDFField *poField );
431 int CreateDefaultFieldInstance(
DDFField *poField,
int iIndexWithinField );
433 int SetFieldRaw(
DDFField *poField,
int iIndexWithinField,
434 const char *pachRawData,
int nRawDataSize );
435 int UpdateFieldRaw(
DDFField *poField,
int iIndexWithinField,
436 int nStartOffset,
int nOldSize,
437 const char *pachRawData,
int nRawDataSize );
444 int ResetDirectory();
458 int _sizeFieldLength;
490 void Dump( FILE * fp );
493 int * = NULL,
int = 0 );
495 const char *GetInstanceData(
int nInstance,
int *pnSize );
506 int GetRepeatCount();
516 const char *pachData;