31 #ifndef OGR_FEATURE_H_INCLUDED 32 #define OGR_FEATURE_H_INCLUDED 34 #include "cpl_atomic_ops.h" 82 void SetName(
const char * );
95 { eJustify = eJustifyIn; }
102 { nPrecision = nPrecisionIn; }
107 void SetDefault(
const char* );
108 const char *GetDefault()
const;
109 int IsDefaultDriverSpecific()
const;
161 void SetName(
const char * );
175 { bNullable = bNullableIn; }
211 volatile int nRefCount;
219 char *pszFeatureClassName;
228 virtual const char *GetName();
230 virtual int GetFieldCount();
232 virtual int GetFieldIndex(
const char * );
235 virtual OGRErr DeleteFieldDefn(
int iField );
236 virtual OGRErr ReorderFieldDefns(
int* panMap );
238 virtual int GetGeomFieldCount();
240 virtual int GetGeomFieldIndex(
const char * );
244 virtual OGRErr DeleteGeomFieldDefn(
int iGeomField );
256 virtual int IsGeometryIgnored();
257 virtual void SetGeometryIgnored(
int bIgnore );
260 { bIgnoreStyle = bIgnore; }
264 static OGRFeatureDefn *CreateFeatureDefn(
const char *pszName = NULL );
287 char *m_pszNativeData;
288 char *m_pszNativeMediaType;
290 bool SetFieldInternal(
int i,
OGRField * puValue );
294 char *m_pszStyleString;
296 char *m_pszTmpFieldValue;
310 int GetGeomFieldCount()
const 319 OGRGeometry* GetGeomFieldRef(
const char* pszFName );
326 int GetFieldCount()
const 333 int IsFieldSet(
int iField );
335 void UnsetField(
int iField );
337 bool IsFieldNull(
int iField );
339 void SetFieldNull(
int iField );
341 bool IsFieldSetAndNotNull(
int iField );
345 int GetFieldAsInteger(
int i );
346 GIntBig GetFieldAsInteger64(
int i );
347 double GetFieldAsDouble(
int i );
348 const char *GetFieldAsString(
int i );
349 const int *GetFieldAsIntegerList(
int i,
int *pnCount );
350 const GIntBig *GetFieldAsInteger64List(
int i,
int *pnCount );
351 const double *GetFieldAsDoubleList(
int i,
int *pnCount );
352 char **GetFieldAsStringList(
int i );
353 GByte *GetFieldAsBinary(
int i,
int *pnCount );
354 int GetFieldAsDateTime(
int i,
355 int *pnYear,
int *pnMonth,
357 int *pnHour,
int *pnMinute,
360 int GetFieldAsDateTime(
int i,
361 int *pnYear,
int *pnMonth,
363 int *pnHour,
int *pnMinute,
366 char *GetFieldAsSerializedJSon(
int i );
369 {
return GetFieldAsInteger( GetFieldIndex(pszFName) ); }
371 {
return GetFieldAsInteger64( GetFieldIndex(pszFName) ); }
373 {
return GetFieldAsDouble( GetFieldIndex(pszFName) ); }
375 {
return GetFieldAsString( GetFieldIndex(pszFName) ); }
378 {
return GetFieldAsIntegerList( GetFieldIndex(pszFName),
382 {
return GetFieldAsInteger64List( GetFieldIndex(pszFName),
386 {
return GetFieldAsDoubleList( GetFieldIndex(pszFName),
389 {
return GetFieldAsStringList(GetFieldIndex(pszFName)); }
391 void SetField(
int i,
int nValue );
392 void SetField(
int i,
GIntBig nValue );
393 void SetField(
int i,
double dfValue );
394 void SetField(
int i,
const char * pszValue );
395 void SetField(
int i,
int nCount,
int * panValues );
396 void SetField(
int i,
int nCount,
398 void SetField(
int i,
int nCount,
double * padfValues );
399 void SetField(
int i,
char ** papszValues );
400 void SetField(
int i,
OGRField * puValue );
401 void SetField(
int i,
int nCount,
GByte * pabyBinary );
402 void SetField(
int i,
int nYear,
int nMonth,
int nDay,
403 int nHour=0,
int nMinute=0,
float fSecond=0.f,
407 { SetField( GetFieldIndex(pszFName), nValue ); }
409 { SetField( GetFieldIndex(pszFName), nValue ); }
410 void SetField(
const char *pszFName,
double dfValue )
411 { SetField( GetFieldIndex(pszFName), dfValue ); }
412 void SetField(
const char *pszFName,
const char * pszValue )
413 { SetField( GetFieldIndex(pszFName), pszValue ); }
416 { SetField(GetFieldIndex(pszFName),nCount,panValues); }
419 { SetField(GetFieldIndex(pszFName),nCount,panValues); }
421 double * padfValues )
422 {SetField(GetFieldIndex(pszFName),nCount,padfValues); }
423 void SetField(
const char *pszFName,
char ** papszValues )
424 { SetField( GetFieldIndex(pszFName), papszValues); }
426 { SetField( GetFieldIndex(pszFName), puValue ); }
428 int nYear,
int nMonth,
int nDay,
429 int nHour=0,
int nMinute=0,
float fSecond=0.f,
431 { SetField( GetFieldIndex(pszFName),
433 nHour, nMinute, fSecond, nTZFlag ); }
438 void DumpReadable( FILE *,
char** papszOptions = NULL );
446 int *panRemapSource );
448 int *panRemapSource );
451 int Validate(
int nValidateFlags,
453 void FillUnsetWithDefault(
int bNotNullableOnly,
454 char** papszOptions );
456 virtual const char *GetStyleString();
457 virtual void SetStyleString(
const char * );
458 virtual void SetStyleStringDirectly(
char * );
465 virtual void SetStyleTableDirectly(
OGRStyleTable *poStyleTable );
469 {
return m_pszNativeMediaType; }
470 void SetNativeData(
const char* pszNativeData );
471 void SetNativeMediaType(
const char* pszNativeMediaType );
487 class swq_custom_func_registrar;
489 class CPL_DLL OGRFeatureQuery
495 char **FieldCollector(
void *,
char ** );
500 int CanUseIndex( swq_expr_node*,
OGRLayer * );
508 swq_custom_func_registrar*
509 poCustomFuncRegistrar = NULL );
516 char **GetUsedFields();
518 void *GetSWQExpr() {
return pSWQExpr; }
int GetReferenceCount()
Fetch current reference count.
Definition: ogr_feature.h:253
OGRFieldDefn * GetFieldDefnRef(int iField) const
Fetch definition for this field.
Definition: ogr_feature.h:328
int GetPrecision() const
Get the formatting precision for this field. This should normally be zero for fields of types other t...
Definition: ogr_feature.h:100
OGRFieldSubType
Definition: ogr_core.h:612
int GetFieldAsInteger(const char *pszFName)
Fetch field value as integer.
Definition: ogr_feature.h:368
int IsNullable() const
Return whether this geometry field can receive null values.
Definition: ogr_feature.h:173
void SetField(const char *pszFName, double dfValue)
Set field to double value.
Definition: ogr_feature.h:410
OGRwkbGeometryType GetType() const
Fetch geometry type of this field.
Definition: ogr_feature.h:164
OGRJustification GetJustify() const
Get the justification for this field.
Definition: ogr_feature.h:93
OGRField * GetRawFieldRef(int i)
Fetch a pointer to the internal field value given the index.
Definition: ogr_feature.h:343
const char * GetNameRef()
Fetch name of this field.
Definition: ogr_feature.h:162
void SetNullable(int bNullableIn)
Set whether this geometry field can receive null values.
Definition: ogr_feature.h:174
Definition: ogr_feature.h:141
virtual int GetGeomFieldCount()
Fetch number of geometry fields on this feature.
Definition: ogrfeaturedefn.cpp:583
virtual void SetStyleIgnored(int bIgnore)
Set whether the style can be omitted when fetching features.
Definition: ogr_feature.h:259
void SetField(const char *pszFName, OGRField *puValue)
Set field.
Definition: ogr_feature.h:425
const int * GetFieldAsIntegerList(const char *pszFName, int *pnCount)
Fetch field value as a list of integers.
Definition: ogr_feature.h:376
int OGRBoolean
Definition: ogr_core.h:301
unsigned char GByte
Definition: cpl_port.h:207
int GetFieldIndex(const char *pszName)
Fetch the field index given field name.
Definition: ogr_feature.h:330
const char * GetNativeMediaType() const
Returns the native media type for the feature.
Definition: ogr_feature.h:468
Definition: ogr_feature.h:207
const GIntBig * GetFieldAsInteger64List(const char *pszFName, int *pnCount)
Fetch field value as a list of 64 bit integers.
Definition: ogr_feature.h:380
void SetField(const char *pszFName, char **papszValues)
Set field to list of strings value.
Definition: ogr_feature.h:423
virtual int GetGeomFieldIndex(const char *)
Find geometry field by name.
Definition: ogrfeaturedefn.cpp:842
double GetFieldAsDouble(const char *pszFName)
Fetch field value as a double.
Definition: ogr_feature.h:372
void SetField(const char *pszFName, int nValue)
Set field to integer value. OFTInteger, OFTInteger64 and OFTReal fields will be set directly...
Definition: ogr_feature.h:406
Definition: ogr_feature.h:62
const char * GetNameRef()
Fetch name of this field.
Definition: ogr_feature.h:83
virtual OGRStyleTable * GetStyleTable()
Definition: ogr_feature.h:463
#define MAX(a, b)
Definition: cpl_port.h:460
GIntBig GetFieldAsInteger64(const char *pszFName)
Fetch field value as integer 64 bit.
Definition: ogr_feature.h:370
virtual int IsStyleIgnored() const
Determine whether the style can be omitted when fetching features.
Definition: ogr_feature.h:258
OGRwkbGeometryType
Definition: ogr_core.h:312
virtual OGRGeomFieldDefn * GetGeomFieldDefn(int i)
Fetch geometry field definition.
Definition: ogrfeaturedefn.cpp:632
const char * GetNativeData() const
Returns the native data for the feature.
Definition: ogr_feature.h:467
GIntBig GetFID() const
Get feature identifier.
Definition: ogr_feature.h:435
void SetPrecision(int nPrecisionIn)
Set the formatting precision for this field in characters.
Definition: ogr_feature.h:101
Definition: ogr_geometry.h:118
int IsIgnored() const
Return whether this field should be omitted when fetching features.
Definition: ogr_feature.h:111
void SetWidth(int nWidthIn)
Set the formatting width for this field in characters.
Definition: ogr_feature.h:98
OGRJustification
Definition: ogr_core.h:628
const double * GetFieldAsDoubleList(const char *pszFName, int *pnCount)
Fetch field value as a list of doubles.
Definition: ogr_feature.h:384
void SetField(const char *pszFName, int nCount, const GIntBig *panValues)
Set field to list of 64 bit integers value.
Definition: ogr_feature.h:417
int Reference()
Increments the reference count by one.
Definition: ogr_feature.h:251
int IsNullable() const
Return whether this field can receive null values.
Definition: ogr_feature.h:114
OGRFieldType
Definition: ogr_core.h:584
Definition: ogr_spatialref.h:132
int GetGeomFieldIndex(const char *pszName)
Fetch the geometry field index given geometry field name.
Definition: ogr_feature.h:314
void SetField(const char *pszFName, GIntBig nValue)
Set field to 64 bit integer value. OFTInteger, OFTInteger64 and OFTReal fields will be set directly...
Definition: ogr_feature.h:408
int Dereference()
Decrements the reference count by one.
Definition: ogr_feature.h:252
OGRFieldSubType GetSubType() const
Fetch subtype of this field.
Definition: ogr_feature.h:89
Definition: ogr_core.h:661
void SetField(const char *pszFName, int nCount, double *padfValues)
Set field to list of doubles value.
Definition: ogr_feature.h:420
void SetIgnored(int bIgnoreIn)
Set whether this field should be omitted when fetching features.
Definition: ogr_feature.h:171
Definition: ogrsf_frmts.h:68
char ** GetFieldAsStringList(const char *pszFName)
Fetch field value as a list of strings.
Definition: ogr_feature.h:388
OGRGeomFieldDefn * GetGeomFieldDefnRef(int iField)
Fetch definition for this geometry field.
Definition: ogr_feature.h:312
Definition: ogr_feature.h:279
virtual int GetFieldCount()
Fetch number of fields on this feature.
Definition: ogrfeaturedefn.cpp:270
virtual OGRFieldDefn * GetFieldDefn(int i)
Fetch field definition.
Definition: ogrfeaturedefn.cpp:317
OGRFieldType GetType() const
Fetch type of this field.
Definition: ogr_feature.h:85
Definition: ogr_featurestyle.h:83
long long GIntBig
Definition: cpl_port.h:250
void SetField(const char *pszFName, const char *pszValue)
Set field to string value.
Definition: ogr_feature.h:412
void SetJustify(OGRJustification eJustifyIn)
Set the justification for this field.
Definition: ogr_feature.h:94
int OGRErr
Definition: ogr_core.h:285
OGRFeatureDefn * GetDefnRef()
Fetch feature definition.
Definition: ogr_feature.h:303
void SetField(const char *pszFName, int nCount, int *panValues)
Set field to list of integers value.
Definition: ogr_feature.h:414
void SetField(const char *pszFName, int nYear, int nMonth, int nDay, int nHour=0, int nMinute=0, float fSecond=0.f, int nTZFlag=0)
Set field to date.
Definition: ogr_feature.h:427
int IsIgnored() const
Return whether this field should be omitted when fetching features.
Definition: ogr_feature.h:170
virtual int GetFieldIndex(const char *)
Find field by name.
Definition: ogrfeaturedefn.cpp:1144
void SetIgnored(int bIgnoreIn)
Set whether this field should be omitted when fetching features.
Definition: ogr_feature.h:112
const char * GetFieldAsString(const char *pszFName)
Fetch field value as a string.
Definition: ogr_feature.h:374
int GetWidth() const
Get the formatting width for this field.
Definition: ogr_feature.h:97
#define CPL_DISALLOW_COPY_ASSIGN(ClassName)
Definition: cpl_port.h:1085
void SetNullable(int bNullableIn)
Set whether this field can receive null values.
Definition: ogr_feature.h:115
#define CPL_WARN_UNUSED_RESULT
Definition: cpl_port.h:999