Go to the documentation of this file.
31 #ifndef OGR_FEATURE_H_INCLUDED
32 #define OGR_FEATURE_H_INCLUDED
34 #include "cpl_atomic_ops.h"
51 #ifndef DEFINE_OGRFeatureH
53 #define DEFINE_OGRFeatureH
107 char *pszAlternativeName;
120 std::string m_osDomainName{};
122 std::string m_osComment{};
129 void SetName(
const char *);
135 void SetAlternativeName(
const char *);
138 return pszAlternativeName;
161 eJustify = eJustifyIn;
170 nWidth =
MAX(0, nWidthIn);
179 nPrecision = nPrecisionIn;
185 void SetDefault(
const char *);
186 const char *GetDefault()
const;
187 int IsDefaultDriverSpecific()
const;
204 bNullable = bNullableIn;
218 return m_osDomainName;
222 m_osDomainName = osDomainName;
231 m_osComment = osComment;
279 char *pszName =
nullptr;
285 mutable int bNullable =
true;
295 void SetName(
const char *);
325 bNullable = bNullableIn;
378 volatile int nRefCount = 0;
380 mutable std::vector<std::unique_ptr<OGRFieldDefn>> apoFieldDefn{};
381 mutable std::vector<std::unique_ptr<OGRGeomFieldDefn>> apoGeomFieldDefn{};
383 char *pszFeatureClassName =
nullptr;
385 bool bIgnoreStyle =
false;
392 void SetName(
const char *pszName);
393 virtual const char *GetName()
const;
395 virtual int GetFieldCount()
const;
398 virtual int GetFieldIndex(
const char *)
const;
399 int GetFieldIndexCaseSensitive(
const char *)
const;
406 struct CPL_DLL Fields
412 inline explicit Fields(
OGRFeatureDefn *poFDefn) : m_poFDefn(poFDefn)
416 struct CPL_DLL ConstIterator
424 : m_poFDefn(poFDefn), m_nIdx(nIdx)
432 inline ConstIterator &operator++()
437 inline bool operator!=(
const ConstIterator &it)
const
439 return m_nIdx != it.m_nIdx;
443 inline ConstIterator
begin()
445 return ConstIterator(m_poFDefn, 0);
447 inline ConstIterator
end()
452 inline size_t size()
const
485 int GetFieldCountUnsafe()
const
487 return static_cast<int>(apoFieldDefn.size());
493 if (apoFieldDefn.empty())
495 return apoFieldDefn[
static_cast<std::size_t
>(i)].get();
499 if (apoFieldDefn.empty())
501 return apoFieldDefn[
static_cast<std::size_t
>(i)].get();
506 virtual OGRErr DeleteFieldDefn(
int iField);
507 virtual OGRErr ReorderFieldDefns(
const int *panMap);
509 virtual int GetGeomFieldCount()
const;
512 virtual int GetGeomFieldIndex(
const char *)
const;
519 struct CPL_DLL GeomFields
525 inline explicit GeomFields(
OGRFeatureDefn *poFDefn) : m_poFDefn(poFDefn)
529 struct CPL_DLL ConstIterator
537 : m_poFDefn(poFDefn), m_nIdx(nIdx)
545 inline ConstIterator &operator++()
550 inline bool operator!=(
const ConstIterator &it)
const
552 return m_nIdx != it.m_nIdx;
556 inline ConstIterator
begin()
558 return ConstIterator(m_poFDefn, 0);
560 inline ConstIterator
end()
565 inline size_t size()
const
592 return GeomFields(
this);
596 virtual void AddGeomFieldDefn(std::unique_ptr<OGRGeomFieldDefn> &&);
597 virtual OGRErr DeleteGeomFieldDefn(
int iGeomField);
606 return CPLAtomicInc(&nRefCount);
610 return CPLAtomicDec(&nRefCount);
618 virtual int IsGeometryIgnored()
const;
619 virtual void SetGeometryIgnored(
int bIgnore);
626 bIgnoreStyle = bIgnore;
629 virtual int IsSame(
const OGRFeatureDefn *poOtherFeatureDefn)
const;
632 void ReserveSpaceForFields(
int nFieldCountIn);
635 std::vector<int> ComputeMapForSetFrom(
const OGRFeatureDefn *poSrcFDefn,
636 bool bForgiving =
true)
const;
638 static OGRFeatureDefn *CreateFeatureDefn(
const char *pszName =
nullptr);
676 char *m_pszNativeData;
677 char *m_pszNativeMediaType;
679 bool SetFieldInternal(
int i,
const OGRField *puValue);
683 mutable char *m_pszStyleString;
685 mutable char *m_pszTmpFieldValue;
699 std::unique_ptr<Private> m_poPrivate;
724 FieldValue &operator=(
const std::string &osVal);
726 FieldValue &operator=(
const std::vector<int> &oArray);
728 FieldValue &operator=(
const std::vector<GIntBig> &oArray);
730 FieldValue &operator=(
const std::vector<double> &oArray);
732 FieldValue &operator=(
const std::vector<std::string> &oArray);
745 void SetDateTime(
int nYear,
int nMonth,
int nDay,
int nHour = 0,
746 int nMinute = 0,
float fSecond = 0.f,
int nTZFlag = 0);
749 int GetIndex()
const;
755 return GetDefn()->GetNameRef();
760 return GetDefn()->GetType();
765 return GetDefn()->GetSubType();
777 bool IsUnset()
const;
784 const OGRField *GetRawValue()
const;
792 return GetRawValue()->Integer;
801 return GetRawValue()->Integer64;
810 return GetRawValue()->Real;
819 return GetRawValue()->String;
823 bool GetDateTime(
int *pnYear,
int *pnMonth,
int *pnDay,
int *pnHour,
824 int *pnMinute,
float *pfSecond,
int *pnTZFlag)
const;
829 return GetAsInteger();
835 return GetAsInteger64();
838 operator double()
const
840 return GetAsDouble();
843 operator const char *()
const
845 return GetAsString();
848 operator const std::vector<int> &()
const
850 return GetAsIntegerList();
854 operator const std::vector<GIntBig> &()
const
856 return GetAsInteger64List();
859 operator const std::vector<double> &()
const
861 return GetAsDoubleList();
864 operator const std::vector<std::string> &()
const
866 return GetAsStringList();
872 int GetAsInteger()
const;
875 GIntBig GetAsInteger64()
const;
877 double GetAsDouble()
const;
879 const char *GetAsString()
const;
881 const std::vector<int> &GetAsIntegerList()
const;
884 const std::vector<GIntBig> &GetAsInteger64List()
const;
886 const std::vector<double> &GetAsDoubleList()
const;
888 const std::vector<std::string> &GetAsStringList()
const;
896 std::unique_ptr<Private> m_poPrivate;
933 const FieldValue operator[](
int iField)
const;
942 const FieldValue operator[](
const char *pszFieldName)
const;
943 FieldValue operator[](
const char *pszFieldName);
964 int GetGeomFieldCount()
const
982 const OGRGeometry *GetGeomFieldRef(
int iField)
const;
984 OGRGeometry *GetGeomFieldRef(
const char *pszFName);
985 const OGRGeometry *GetGeomFieldRef(
const char *pszFName)
const;
994 int GetFieldCount()
const
1011 int IsFieldSet(
int iField)
const;
1013 void UnsetField(
int iField);
1015 bool IsFieldNull(
int iField)
const;
1017 void SetFieldNull(
int iField);
1019 bool IsFieldSetAndNotNull(
int iField)
const;
1023 return pauFields + i;
1027 return pauFields + i;
1030 int GetFieldAsInteger(
int i)
const;
1031 GIntBig GetFieldAsInteger64(
int i)
const;
1032 double GetFieldAsDouble(
int i)
const;
1033 const char *GetFieldAsString(
int i)
const;
1034 const char *GetFieldAsISO8601DateTime(
int i,
1036 const int *GetFieldAsIntegerList(
int i,
int *pnCount)
const;
1037 const GIntBig *GetFieldAsInteger64List(
int i,
int *pnCount)
const;
1038 const double *GetFieldAsDoubleList(
int i,
int *pnCount)
const;
1039 char **GetFieldAsStringList(
int i)
const;
1040 GByte *GetFieldAsBinary(
int i,
int *pnCount)
const;
1041 int GetFieldAsDateTime(
int i,
int *pnYear,
int *pnMonth,
int *pnDay,
1042 int *pnHour,
int *pnMinute,
int *pnSecond,
1043 int *pnTZFlag)
const;
1044 int GetFieldAsDateTime(
int i,
int *pnYear,
int *pnMonth,
int *pnDay,
1045 int *pnHour,
int *pnMinute,
float *pfSecond,
1046 int *pnTZFlag)
const;
1047 char *GetFieldAsSerializedJSon(
int i)
const;
1050 bool IsFieldSetUnsafe(
int i)
const
1056 bool IsFieldNullUnsafe(
int i)
const
1062 bool IsFieldSetAndNotNullUnsafe(
int i)
const
1064 return IsFieldSetUnsafe(i) && !IsFieldNullUnsafe(i);
1068 int GetFieldAsIntegerUnsafe(
int i)
const
1070 return pauFields[i].Integer;
1072 GIntBig GetFieldAsInteger64Unsafe(
int i)
const
1074 return pauFields[i].Integer64;
1076 double GetFieldAsDoubleUnsafe(
int i)
const
1078 return pauFields[i].Real;
1080 const char *GetFieldAsStringUnsafe(
int i)
const
1082 return pauFields[i].String;
1088 return GetFieldAsInteger(GetFieldIndex(pszFName));
1092 return GetFieldAsInteger64(GetFieldIndex(pszFName));
1096 return GetFieldAsDouble(GetFieldIndex(pszFName));
1100 return GetFieldAsString(GetFieldIndex(pszFName));
1105 return GetFieldAsISO8601DateTime(GetFieldIndex(pszFName), papszOptions);
1109 return GetFieldAsIntegerList(GetFieldIndex(pszFName), pnCount);
1114 return GetFieldAsInteger64List(GetFieldIndex(pszFName), pnCount);
1118 return GetFieldAsDoubleList(GetFieldIndex(pszFName), pnCount);
1122 return GetFieldAsStringList(GetFieldIndex(pszFName));
1125 void SetField(
int i,
int nValue);
1126 void SetField(
int i,
GIntBig nValue);
1127 void SetField(
int i,
double dfValue);
1128 void SetField(
int i,
const char *pszValue);
1129 void SetField(
int i,
int nCount,
const int *panValues);
1130 void SetField(
int i,
int nCount,
const GIntBig *panValues);
1131 void SetField(
int i,
int nCount,
const double *padfValues);
1132 void SetField(
int i,
const char *
const *papszValues);
1133 void SetField(
int i,
const OGRField *puValue);
1134 void SetField(
int i,
int nCount,
const void *pabyBinary);
1135 void SetField(
int i,
int nYear,
int nMonth,
int nDay,
int nHour = 0,
1136 int nMinute = 0,
float fSecond = 0.f,
int nTZFlag = 0);
1141 void SetFieldSameTypeUnsafe(
int i,
int nValue)
1143 pauFields[i].Integer = nValue;
1144 pauFields[i].Set.nMarker2 = 0;
1145 pauFields[i].Set.nMarker3 = 0;
1147 void SetFieldSameTypeUnsafe(
int i,
GIntBig nValue)
1149 pauFields[i].Integer64 = nValue;
1151 void SetFieldSameTypeUnsafe(
int i,
double dfValue)
1153 pauFields[i].Real = dfValue;
1155 void SetFieldSameTypeUnsafe(
int i,
char *pszValueTransferred)
1157 pauFields[i].String = pszValueTransferred;
1163 SetField(GetFieldIndex(pszFName), nValue);
1167 SetField(GetFieldIndex(pszFName), nValue);
1171 SetField(GetFieldIndex(pszFName), dfValue);
1173 void SetField(
const char *pszFName,
const char *pszValue)
1175 SetField(GetFieldIndex(pszFName), pszValue);
1177 void SetField(
const char *pszFName,
int nCount,
const int *panValues)
1179 SetField(GetFieldIndex(pszFName), nCount, panValues);
1183 SetField(GetFieldIndex(pszFName), nCount, panValues);
1185 void SetField(
const char *pszFName,
int nCount,
const double *padfValues)
1187 SetField(GetFieldIndex(pszFName), nCount, padfValues);
1189 void SetField(
const char *pszFName,
const char *
const *papszValues)
1191 SetField(GetFieldIndex(pszFName), papszValues);
1195 SetField(GetFieldIndex(pszFName), puValue);
1197 void SetField(
const char *pszFName,
int nYear,
int nMonth,
int nDay,
1198 int nHour = 0,
int nMinute = 0,
float fSecond = 0.f,
1201 SetField(GetFieldIndex(pszFName), nYear, nMonth, nDay, nHour, nMinute,
1211 void DumpReadable(FILE *,
CSLConstList papszOptions =
nullptr)
const;
1212 std::string DumpReadableAsString(
CSLConstList papszOptions =
nullptr)
const;
1222 const int *panRemapSource);
1225 int Validate(
int nValidateFlags,
int bEmitError)
const;
1226 void FillUnsetWithDefault(
int bNotNullableOnly,
char **papszOptions);
1228 virtual const char *GetStyleString()
const;
1229 virtual void SetStyleString(
const char *);
1230 virtual void SetStyleStringDirectly(
char *);
1237 return m_poStyleTable;
1240 virtual void SetStyleTableDirectly(
OGRStyleTable *poStyleTable);
1244 return m_pszNativeData;
1248 return m_pszNativeMediaType;
1250 void SetNativeData(
const char *pszNativeData);
1251 void SetNativeMediaType(
const char *pszNativeMediaType);
1269 return reinterpret_cast<OGRFeature *
>(hFeature);
1277 struct CPL_DLL OGRFeatureUniquePtrDeleter
1286 typedef std::unique_ptr<OGRFeature, OGRFeatureUniquePtrDeleter>
1293 return poFeature->
begin();
1298 return poFeature->
end();
1305 return poFeature->begin();
1310 return poFeature->end();
1345 std::string m_osName;
1346 std::string m_osDescription;
1353 OGRFieldDomain(
const std::string &osName,
const std::string &osDescription,
1387 return m_osDescription;
1396 return m_eDomainType;
1405 return m_eFieldType;
1414 return m_eFieldSubType;
1435 return m_eSplitPolicy;
1444 m_eSplitPolicy = policy;
1453 return m_eMergePolicy;
1462 m_eMergePolicy = policy;
1475 std::vector<OGRCodedValue> m_asValues{};
1497 const std::string &osDescription,
1499 std::vector<OGRCodedValue> &&asValues);
1512 return m_asValues.data();
1523 bool m_bMinIsInclusive;
1524 bool m_bMaxIsInclusive;
1558 const std::string &osDescription,
1560 const OGRField &sMin,
bool bMinIsInclusive,
1561 const OGRField &sMax,
bool bMaxIsInclusive);
1566 m_osName, m_osDescription, m_eFieldType, m_eFieldSubType, m_sMin,
1567 m_bMinIsInclusive, m_sMax, m_bMaxIsInclusive);
1568 poDomain->SetMergePolicy(m_eMergePolicy);
1569 poDomain->SetSplitPolicy(m_eSplitPolicy);
1588 bIsInclusiveOut = m_bMinIsInclusive;
1607 bIsInclusiveOut = m_bMaxIsInclusive;
1619 std::string m_osGlob;
1636 const std::string &osDescription,
1638 const std::string &osBlob);
1643 m_osName, m_osDescription, m_eFieldType, m_eFieldSubType, m_osGlob);
1644 poDomain->SetMergePolicy(m_eMergePolicy);
1645 poDomain->SetSplitPolicy(m_eSplitPolicy);
1665 class swq_expr_node;
1666 class swq_custom_func_registrar;
1668 class CPL_DLL OGRFeatureQuery
1674 char **FieldCollector(
void *,
char **);
1679 int CanUseIndex(swq_expr_node *,
OGRLayer *);
1682 swq_custom_func_registrar *poCustomFuncRegistrar);
1691 swq_custom_func_registrar *poCustomFuncRegistrar =
nullptr);
1693 swq_custom_func_registrar *poCustomFuncRegistrar =
nullptr);
1700 char **GetUsedFields();
#define MAX(a, b)
Macro to compute the maximum of 2 values.
Definition: cpl_port.h:394
#define OGRNullMarker
Special value set in OGRField.Set.nMarker1, nMarker2 and nMarker3 for a null field.
Definition: ogr_core.h:867
const double * GetFieldAsDoubleList(const char *pszFName, int *pnCount) const
Fetch field value as a list of doubles.
Definition: ogr_feature.h:1116
const char * GetString() const
Return the string value.
Definition: ogr_feature.h:817
static OGRFeatureDefn * FromHandle(OGRFeatureDefnH hFeatureDefn)
Convert a OGRFeatureDefnH to a OGRFeatureDefn*.
Definition: ogr_feature.h:652
OGRFieldSubType GetSubType() const
Return field subtype.
Definition: ogr_feature.h:763
OGRFieldDomainSplitPolicy GetSplitPolicy() const
Get the split policy.
Definition: ogr_feature.h:1433
Fields GetFields()
Return an object that can be used to iterate over non-geometry fields.
Definition: ogr_feature.h:477
OGRFieldDomainMergePolicy
Merge policy for field domains.
Definition: ogr_core.h:1246
virtual bool IsStyleIgnored() const
Determine whether the style can be omitted when fetching features.
Definition: ogr_feature.h:620
@ OFDSP_DEFAULT_VALUE
Default value.
Definition: ogr_core.h:1231
OGRFieldDomainType
Type of field domain.
Definition: ogr_core.h:1211
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:205
void * OGRFieldDefnH
Opaque type for a field definition (OGRFieldDefn)
Definition: ogr_feature.h:62
Exception raised by operator[](const char*) when a field is not found.
Definition: ogr_feature.h:938
const OGRCodedValue * GetEnumeration() const
Get the enumeration as (code, value) pairs.
Definition: ogr_feature.h:1510
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:1165
char ** GetFieldAsStringList(const char *pszFName) const
Fetch field value as a list of strings.
Definition: ogr_feature.h:1120
const std::string & GetDomainName() const
Return the name of the field domain for this field.
Definition: ogr_feature.h:216
Field value iterator class.
Definition: ogr_feature.h:892
void SetDomainName(const std::string &osDomainName)
Set the name of the field domain for this field.
Definition: ogr_feature.h:220
virtual OGRStyleTable * GetStyleTable() const
Return style table.
Definition: ogr_feature.h:1235
void SetJustify(OGRJustification eJustifyIn)
Set the justification for this field.
Definition: ogr_feature.h:159
OGRLayer::FeatureIterator begin(OGRLayer *poLayer)
Return begin of feature iterator.
Definition: ogrsf_frmts.h:364
OGRFieldType GetType() const
Return field type.
Definition: ogr_feature.h:758
void SetIgnored(int bIgnoreIn)
Set whether this field should be omitted when fetching features.
Definition: ogr_feature.h:314
This class represents a style table.
Definition: ogr_featurestyle.h:84
void SetMergePolicy(OGRFieldDomainMergePolicy policy)
Set the merge policy.
Definition: ogr_feature.h:1460
void SetIgnored(int bIgnoreIn)
Set whether this field should be omitted when fetching features.
Definition: ogr_feature.h:193
static OGRFeatureH ToHandle(OGRFeature *poFeature)
Convert a OGRFeature* to a OGRFeatureH.
Definition: ogr_feature.h:1259
const char * GetName() const
Return field name.
Definition: ogr_feature.h:753
virtual int GetGeomFieldIndex(const char *) const
Find geometry field by name.
Definition: ogrfeaturedefn.cpp:875
OGRFieldDefn * GetFieldDefnRef(int iField)
Fetch definition for this field.
Definition: ogr_feature.h:1002
int GetWidth() const
Get the formatting width for this field.
Definition: ogr_feature.h:164
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:166
struct OGRGeomFieldDefnHS * OGRGeomFieldDefnH
Opaque type for a geometry field definition (OGRGeomFieldDefn)
Definition: ogr_feature.h:71
void * OGRStyleTableH
Opaque type for a style table (OGRStyleTable)
Definition: ogr_feature.h:68
static OGRFieldDomain * FromHandle(OGRFieldDomainH hFieldDomain)
Convert a OGRFieldDomainH to a OGRFieldDomain*.
Definition: ogr_feature.h:1424
void * OGRFeatureH
Opaque type for a feature (OGRFeature)
Definition: ogr_feature.h:66
void SetSplitPolicy(OGRFieldDomainSplitPolicy policy)
Set the split policy.
Definition: ogr_feature.h:1442
void SetField(const char *pszFName, const OGRField *puValue)
Set field.
Definition: ogr_feature.h:1193
const OGRField & GetMin(bool &bIsInclusiveOut) const
Get the minimum value.
Definition: ogr_feature.h:1586
double GetFieldAsDouble(const char *pszFName) const
Fetch field value as a double.
Definition: ogr_feature.h:1094
Abstract base class for all geometry classes.
Definition: ogr_geometry.h:334
const std::string & GetDescription() const
Get the description of the field domain.
Definition: ogr_feature.h:1385
virtual OGRFieldDomain * Clone() const =0
Clone.
OGRGeomFieldDefn * GetGeomFieldDefnRef(int iField)
Fetch definition for this geometry field.
Definition: ogr_feature.h:968
This class represents a layer of simple features, with access methods.
Definition: ogrsf_frmts.h:72
bool empty() const
Return whether the field value is unset/empty.
Definition: ogr_feature.h:770
@ OFDMP_DEFAULT_VALUE
Default value.
Definition: ogr_core.h:1249
static OGRGeomFieldDefnH ToHandle(OGRGeomFieldDefn *poGeomFieldDefn)
Convert a OGRGeomFieldDefn* to a OGRGeomFieldDefnH.
Definition: ogr_feature.h:333
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:173
const char * GetNameRef() const
Fetch name of this field.
Definition: ogr_feature.h:296
int IsIgnored() const
Return whether this field should be omitted when fetching features.
Definition: ogr_feature.h:310
std::unique_ptr< OGRFeature, OGRFeatureUniquePtrDeleter > OGRFeatureUniquePtr
Unique pointer type for OGRFeature.
Definition: ogr_feature.h:1287
const OGRField & GetMax(bool &bIsInclusiveOut) const
Get the maximum value.
Definition: ogr_feature.h:1605
void * OGRFeatureH
Opaque type for a feature (OGRFeature)
Definition: ogr_api.h:361
int GetGeomFieldIndex(const char *pszName) const
Fetch the geometry field index given geometry field name.
Definition: ogr_feature.h:976
const char * GetNameRef() const
Fetch name of this field.
Definition: ogr_feature.h:130
int OGRBoolean
Type for a OGR boolean.
Definition: ogr_core.h:395
void * OGRFeatureDefnH
Opaque type for a feature definition (OGRFeatureDefn)
Definition: ogr_api.h:359
void SetPrecision(int nPrecisionIn)
Set the formatting precision for this field in characters.
Definition: ogr_feature.h:177
virtual OGRFieldDefn * GetFieldDefn(int i)
Fetch field definition.
Definition: ogrfeaturedefn.cpp:312
Field value.
Definition: ogr_feature.h:695
struct OGRGeomFieldDefnHS * OGRGeomFieldDefnH
Opaque type for a geometry field definition (OGRGeomFieldDefn)
Definition: ogr_api.h:366
const std::string & GetComment() const
Return the (optional) comment for this field.
Definition: ogr_feature.h:225
ConstFieldIterator begin() const
Return begin of field value iterator.
Definition: ogrfeature.cpp:7455
void SetComment(const std::string &osComment)
Set the comment for this field.
Definition: ogr_feature.h:229
OGRFieldDomainMergePolicy GetMergePolicy() const
Get the merge policy.
Definition: ogr_feature.h:1451
int IsUnique() const
Return whether this field has a unique constraint.
Definition: ogr_feature.h:207
Definition of a field domain for field content validated by a glob.
Definition: ogr_feature.h:1616
OGRFeature field attribute value union.
Definition: ogr_core.h:877
OGRFeatureDefn * GetDefnRef()
Fetch feature definition.
Definition: ogr_feature.h:945
virtual OGRGeomFieldDefn * GetGeomFieldDefn(int i)
Fetch geometry field definition.
Definition: ogrfeaturedefn.cpp:640
void SetField(const char *pszFName, int nCount, const double *padfValues)
Definition: ogr_feature.h:1185
Associates a code and a value.
Definition: ogr_core.h:1198
int GetFieldIndex(const char *pszName) const
Fetch the field index given field name.
Definition: ogr_feature.h:1006
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition: cpl_port.h:1195
void Unset()
Unset the field.
Definition: ogr_feature.h:740
virtual int GetFieldCount() const
Fetch number of fields on this feature.
Definition: ogrfeaturedefn.cpp:268
void SetField(const char *pszFName, const char *pszValue)
Set field to string value.
Definition: ogr_feature.h:1173
const std::string & GetName() const
Get the name of the field domain.
Definition: ogr_feature.h:1375
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:1197
static OGRFieldDefn * FromHandle(OGRFieldDefnH hFieldDefn)
Convert a OGRFieldDefnH to a OGRFieldDefn*.
Definition: ogr_feature.h:247
struct OGRFieldDomainHS * OGRFieldDomainH
Opaque type for a field domain definition (OGRFieldDomain)
Definition: ogr_api.h:369
Definition of an attribute of an OGRFeatureDefn.
Definition: ogr_feature.h:103
int IsNullable() const
Return whether this geometry field can receive null values.
Definition: ogr_feature.h:319
void SetUnique(int bUniqueIn)
Set whether this field has a unique constraint.
Definition: ogr_feature.h:211
void SetField(const char *pszFName, int nCount, const int *panValues)
Definition: ogr_feature.h:1177
#define OGRUnsetMarker
Special value set in OGRField.Set.nMarker1, nMarker2 and nMarker3 for a unset field.
Definition: ogr_core.h:859
Definition of a numeric field domain with a range of validity for values.
Definition: ogr_feature.h:1518
OGRJustification
Display justification for field values.
Definition: ogr_core.h:836
virtual void SetStyleIgnored(bool bIgnore)
Set whether the style can be omitted when fetching features.
Definition: ogr_feature.h:624
void * OGRFieldDefnH
Opaque type for a field definition (OGRFieldDefn)
Definition: ogr_api.h:357
OGRFieldType GetFieldType() const
Get the field type.
Definition: ogr_feature.h:1403
Definition of a geometry field of an OGRFeatureDefn.
Definition: ogr_feature.h:275
double GetDouble() const
Return the double value.
Definition: ogr_feature.h:808
const GIntBig * GetFieldAsInteger64List(const char *pszFName, int *pnCount) const
Fetch field value as a list of 64 bit integers.
Definition: ogr_feature.h:1111
Definition of a field domain.
Definition: ogr_feature.h:1341
static OGRFeature * FromHandle(OGRFeatureH hFeature)
Convert a OGRFeatureH to a OGRFeature*.
Definition: ogr_feature.h:1267
int Dereference()
Decrements the reference count by one.
Definition: ogr_feature.h:608
OGRLayer::FeatureIterator end(OGRLayer *poLayer)
Return end of feature iterator.
Definition: ogrsf_frmts.h:372
OGRFieldType GetType() const
Fetch type of this field.
Definition: ogr_feature.h:141
virtual int GetFieldIndex(const char *) const
Find field by name.
Definition: ogrfeaturedefn.cpp:1177
OGRFieldSubType GetFieldSubType() const
Get the field subtype.
Definition: ogr_feature.h:1412
const char * GetAlternativeNameRef() const
Fetch the alternative name (or "alias") for this field.
Definition: ogr_feature.h:136
OGRFieldDomainSplitPolicy
Split policy for field domains.
Definition: ogr_core.h:1228
int OGRErr
Type for a OGR error.
Definition: ogr_core.h:378
GeomFields GetGeomFields()
Return an object that can be used to iterate over geometry fields.
Definition: ogr_feature.h:590
static OGRFieldDomainH ToHandle(OGRFieldDomain *poFieldDomain)
Convert a OGRFieldDomain* to a OGRFieldDomainH.
Definition: ogr_feature.h:1418
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition: cpl_port.h:235
const OGRFieldDefn * GetFieldDefnRef(int iField) const
Fetch definition for this field.
Definition: ogr_feature.h:998
int GetInteger() const
Return the integer value.
Definition: ogr_feature.h:790
const OGRField * GetRawFieldRef(int i) const
Fetch a pointer to the internal field value given the index.
Definition: ogr_feature.h:1025
OGRwkbGeometryType
List of well known binary geometry types.
Definition: ogr_core.h:406
int IsIgnored() const
Return whether this field should be omitted when fetching features.
Definition: ogr_feature.h:189
void SetField(const char *pszFName, double dfValue)
Set field to double value.
Definition: ogr_feature.h:1169
#define CPL_WARN_UNUSED_RESULT
Qualifier to warn when the return value of a function is not used.
Definition: cpl_port.h:985
OGRField * GetRawFieldRef(int i)
Fetch a pointer to the internal field value given the index.
Definition: ogr_feature.h:1021
int Reference()
Increments the reference count by one.
Definition: ogr_feature.h:604
Definition of a coded / enumerated field domain.
Definition: ogr_feature.h:1472
A simple feature, including geometry and attributes.
Definition: ogr_feature.h:669
ConstFieldIterator end() const
Return end of field value iterator.
Definition: ogrfeature.cpp:7460
const OGRGeomFieldDefn * GetGeomFieldDefnRef(int iField) const
Fetch definition for this geometry field.
Definition: ogr_feature.h:972
OGRwkbGeometryType GetType() const
Fetch geometry type of this field.
Definition: ogr_feature.h:301
const char * GetNativeMediaType() const
Returns the native media type for the feature.
Definition: ogr_feature.h:1246
OGRFieldSubType
List of field subtypes.
Definition: ogr_core.h:811
void SetNullable(int bNullableIn)
Set whether this field can receive null values.
Definition: ogr_feature.h:202
void SetNullable(int bNullableIn)
Set whether this geometry field can receive null values.
Definition: ogr_feature.h:323
OGRRangeFieldDomain * Clone() const override
Clone.
Definition: ogr_feature.h:1563
static OGRGeomFieldDefn * FromHandle(OGRGeomFieldDefnH hGeomFieldDefn)
Convert a OGRGeomFieldDefnH to a OGRGeomFieldDefn*.
Definition: ogr_feature.h:341
static OGRFeatureDefnH ToHandle(OGRFeatureDefn *poFeatureDefn)
Convert a OGRFeatureDefn* to a OGRFeatureDefnH.
Definition: ogr_feature.h:644
int IsNullable() const
Return whether this field can receive null values.
Definition: ogr_feature.h:198
OGRFieldType
List of feature field types.
Definition: ogr_core.h:783
void * OGRFeatureDefnH
Opaque type for a feature definition (OGRFeatureDefn)
Definition: ogr_feature.h:64
virtual int GetGeomFieldCount() const
Fetch number of geometry fields on this feature.
Definition: ogrfeaturedefn.cpp:591
GIntBig GetFieldAsInteger64(const char *pszFName) const
Fetch field value as integer 64 bit.
Definition: ogr_feature.h:1090
const char * GetFieldAsString(const char *pszFName) const
Fetch field value as a string.
Definition: ogr_feature.h:1098
GIntBig GetInteger64() const
Return the 64-bit integer value.
Definition: ogr_feature.h:799
void SetField(const char *pszFName, const char *const *papszValues)
Definition: ogr_feature.h:1189
void SetWidth(int nWidthIn)
Set the formatting width for this field in characters.
Definition: ogr_feature.h:168
Definition of a feature class or feature layer.
Definition: ogr_feature.h:374
const std::string & GetGlob() const
Get the glob expression.
Definition: ogr_feature.h:1653
int GetFieldAsInteger(const char *pszFName) const
Fetch field value as integer.
Definition: ogr_feature.h:1086
int GetReferenceCount() const
Fetch current reference count.
Definition: ogr_feature.h:612
OGRFieldSubType GetSubType() const
Fetch subtype of this field.
Definition: ogr_feature.h:148
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:1161
const int * GetFieldAsIntegerList(const char *pszFName, int *pnCount) const
Fetch field value as a list of integers.
Definition: ogr_feature.h:1107
@ wkbUnknown
unknown type, non-standard
Definition: ogr_core.h:408
struct OGRFieldDomainHS * OGRFieldDomainH
Opaque type for a field domain definition (OGRFieldDomain)
Definition: ogr_feature.h:74
OGRGlobFieldDomain * Clone() const override
Clone.
Definition: ogr_feature.h:1640
#define CPL_DISALLOW_COPY_ASSIGN(ClassName)
Helper to remove the copy and assignment constructors so that the compiler will not generate the defa...
Definition: cpl_port.h:1051
OGRJustification GetJustify() const
Get the justification for this field.
Definition: ogr_feature.h:155
const char * GetNativeData() const
Returns the native data for the feature.
Definition: ogr_feature.h:1242
const char * GetFieldAsISO8601DateTime(const char *pszFName, CSLConstList papszOptions) const
Fetch OFTDateTime field value as a ISO8601 representation.
Definition: ogr_feature.h:1102
OGRFieldDomainType GetDomainType() const
Get the type of the field domain.
Definition: ogr_feature.h:1394
GIntBig GetFID() const
Get feature identifier.
Definition: ogr_feature.h:1205
void SetField(const char *pszFName, int nCount, const GIntBig *panValues)
Set field to list of 64 bit integers value.
Definition: ogr_feature.h:1181
static OGRFieldDefnH ToHandle(OGRFieldDefn *poFieldDefn)
Convert a OGRFieldDefn* to a OGRFieldDefnH.
Definition: ogr_feature.h:239