30 #ifndef ISO8211_H_INCLUDED 31 #define ISO8211_H_INCLUDED 51 int 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 85 int Open(
const char * pszFilename,
int bFailQuietly = FALSE );
86 int Create(
const char *pszFilename );
89 int Initialize(
char chInterchangeLevel =
'3',
90 char chLeaderIden =
'L',
91 char chCodeExtensionIndicator =
'E',
92 char chVersionNumber =
'1',
93 char chAppIndicator =
' ',
94 const char *pszExtendedCharSet =
" ! ",
95 int nSizeFieldLength = 3,
96 int nSizeFieldPos = 4,
97 int nSizeFieldTag = 4 );
99 void Dump( FILE * fp );
102 void Rewind(
long nOffset = -1 );
113 int GetFieldControlLength() {
return _fieldControlLength; }
118 VSILFILE *GetFP() {
return fpDDF; }
119 int GetSizeFieldTag()
const {
return (
int)_sizeFieldTag; }
122 int GetSizeFieldPos()
const {
return _sizeFieldPos; }
123 int GetSizeFieldLength()
const {
return _sizeFieldLength; }
124 char GetInterchangeLevel()
const {
return _interchangeLevel; }
125 char GetLeaderIden()
const {
return _leaderIden; }
126 char GetCodeExtensionIndicator()
const {
return _inlineCodeExtensionIndicator; }
127 char GetVersionNumber()
const {
return _versionNumber; }
128 char GetAppIndicator()
const {
return _appIndicator; }
129 const char* GetExtendedCharSet()
const {
return _extendedCharSet; }
130 void SetFieldControlLength(
int nVal) { _fieldControlLength = nVal; }
135 long nFirstRecordOffset;
137 char _interchangeLevel;
138 char _inlineCodeExtensionIndicator;
141 int _fieldControlLength;
142 char _extendedCharSet[4];
147 int _sizeFieldLength;
166 typedef enum { dsc_elementary, dsc_vector, dsc_array, dsc_concatenated } DDF_data_struct_code;
167 typedef enum { dtc_char_string,
170 dtc_explicit_point_scaled,
173 dtc_mixed_data_type } DDF_data_type_code;
188 int Create(
const char *pszTag,
const char *pszFieldName,
189 const char *pszDescription,
190 DDF_data_struct_code eDataStructCode,
191 DDF_data_type_code eDataTypeCode,
192 const char *pszFormat = NULL );
194 int bDontAddToFormat = FALSE );
195 void AddSubfield(
const char *pszName,
const char *pszFormat );
196 int GenerateDDREntry(
DDFModule * poModule,
char **ppachData,
int *pnLength );
198 int Initialize(
DDFModule * poModule,
const char *pszTag,
199 int nSize,
const char * pachRecord );
201 void Dump( FILE * fp );
235 static char *ExpandFormat(
const char * );
240 char *GetDefaultValue(
int *pnSize );
242 const char *GetArrayDescr()
const {
return _arrayDescr; }
243 const char *GetFormatControls()
const {
return _formatControls; }
244 DDF_data_struct_code GetDataStructCode()
const {
return _data_struct_code; }
245 DDF_data_type_code GetDataTypeCode()
const {
return _data_type_code; }
247 void SetFormatControls(
const char* pszVal);
251 static char *ExtractSubstring(
const char * );
258 char * _formatControls;
260 int bRepeatingSubfields;
263 int BuildSubfields();
266 DDF_data_struct_code _data_struct_code;
268 DDF_data_type_code _data_type_code;
295 void SetName(
const char * pszName );
302 int SetFormat(
const char * pszFormat );
314 double ExtractFloatData(
const char *pachData,
int nMaxBytes,
315 int * pnConsumedBytes );
316 int ExtractIntData(
const char *pachData,
int nMaxBytes,
317 int * pnConsumedBytes );
318 const char *ExtractStringData(
const char *pachData,
int nMaxBytes,
319 int * pnConsumedBytes );
320 int GetDataLength(
const char *,
int,
int * );
321 void DumpData(
const char *pachData,
int nMaxBytes, FILE * fp );
323 int FormatStringValue(
char *pachData,
int nBytesAvailable,
324 int *pnBytesUsed,
const char *pszValue,
325 int nValueLength = -1 );
327 int FormatIntValue(
char *pachData,
int nBytesAvailable,
328 int *pnBytesUsed,
int nNewValue );
330 int FormatFloatValue(
char *pachData,
int nBytesAvailable,
331 int *pnBytesUsed,
double dfNewValue );
336 int GetDefaultValue(
char *pachData,
int nBytesAvailable,
339 void Dump( FILE * fp );
354 DDFBinaryFormat GetBinaryFormat()
const {
return eBinaryFormat; }
358 char *pszFormatString;
361 DDFBinaryFormat eBinaryFormat;
369 char chFormatDelimiter;
407 DDFField *FindField(
const char *,
int = 0 );
410 int GetIntSubfield(
const char *,
int,
const char *,
int,
412 double GetFloatSubfield(
const char *,
int,
const char *,
int,
414 const char *GetStringSubfield(
const char *,
int,
const char *,
int,
417 int SetIntSubfield(
const char *pszField,
int iFieldIndex,
418 const char *pszSubfield,
int iSubfieldIndex,
420 int SetStringSubfield(
const char *pszField,
int iFieldIndex,
421 const char *pszSubfield,
int iSubfieldIndex,
422 const char *pszValue,
int nValueLength=-1 );
423 int SetFloatSubfield(
const char *pszField,
int iFieldIndex,
424 const char *pszSubfield,
int iSubfieldIndex,
443 int ResizeField(
DDFField *poField,
int nNewDataSize );
444 int DeleteField(
DDFField *poField );
447 int CreateDefaultFieldInstance(
DDFField *poField,
int iIndexWithinField );
449 int SetFieldRaw(
DDFField *poField,
int iIndexWithinField,
450 const char *pachRawData,
int nRawDataSize );
451 int UpdateFieldRaw(
DDFField *poField,
int iIndexWithinField,
452 int nStartOffset,
int nOldSize,
453 const char *pachRawData,
int nRawDataSize );
458 int GetReuseHeader()
const {
return nReuseHeader; }
459 int GetSizeFieldTag()
const {
return _sizeFieldTag; }
460 int GetSizeFieldPos()
const {
return _sizeFieldPos; }
461 int GetSizeFieldLength()
const {
return _sizeFieldLength; }
463 void SetSizeFieldTag(
int nVal) { _sizeFieldTag = nVal; }
464 void SetSizeFieldPos(
int nVal) { _sizeFieldPos = nVal; }
465 void SetSizeFieldLength(
int nVal) { _sizeFieldLength = nVal; }
470 int ResetDirectory();
471 void RemoveIsCloneFlag() { bIsClone = FALSE; }
485 int _sizeFieldLength;
514 DDFField() : poDefn(NULL), nDataSize(0), pachData(NULL) {}
519 void Dump( FILE * fp );
522 int * = NULL,
int = 0 );
524 const char *GetInstanceData(
int nInstance,
int *pnSize );
535 int GetRepeatCount();
545 const char *pachData;
int GetSubfieldCount()
Definition: iso8211.h:214
DDFModule * GetModule()
Definition: iso8211.h:441
Definition: iso8211.h:511
DDFDataType GetType()
Definition: iso8211.h:312
const char * GetData()
Definition: iso8211.h:530
const char * GetData()
Definition: iso8211.h:435
DDFFieldDefn * GetFieldDefn()
Definition: iso8211.h:538
void SetRepeatingFlag(int n)
Definition: iso8211.h:238
int GetDataSize()
Definition: iso8211.h:428
const char * GetName()
Definition: iso8211.h:298
Definition: iso8211.h:182
int IsRepeating()
Definition: iso8211.h:233
Definition: iso8211.h:288
int GetDataSize()
Definition: iso8211.h:533
int GetFixedWidth()
Definition: iso8211.h:226
const char * GetFormat()
Definition: iso8211.h:301
int GetWidth()
Definition: iso8211.h:334
const char * GetName()
Definition: iso8211.h:206
int GetFieldCount()
Definition: iso8211.h:405
Definition: iso8211.h:393
const char * GetDescription()
Definition: iso8211.h:211
int GetFieldCount()
Definition: iso8211.h:108