14#ifndef OGR_FEATURE_H_INCLUDED
15#define OGR_FEATURE_H_INCLUDED
17#include "cpl_atomic_ops.h"
72 char *pszAlternativeName;
86 bool m_bGenerated =
false;
88 std::string m_osDomainName{};
90 std::string m_osComment{};
93 bool m_bSealed =
false;
113 void SetAlternativeName(
const char *);
117 return pszAlternativeName;
145 eJustify = eJustifyIn;
153 void SetWidth(
int nWidthIn);
160 void SetPrecision(
int nPrecisionIn);
167 void SetTZFlag(
int nTZFlag);
172 void SetDefault(
const char *);
173 const char *GetDefault()
const;
174 int IsDefaultDriverSpecific()
const;
191 void SetNullable(
int bNullableIn);
218 m_bGenerated = bGeneratedIn;
221 void SetUnique(
int bUniqueIn);
225 return m_osDomainName;
228 void SetDomainName(
const std::string &osDomainName);
235 void SetComment(
const std::string &osComment);
258 struct CPL_DLL TemporaryUnsealer
265 : m_poFieldDefn(poFieldDefn)
270 TemporaryUnsealer(TemporaryUnsealer &&) =
default;
271 TemporaryUnsealer &operator=(TemporaryUnsealer &&) =
default;
275 m_poFieldDefn->
Seal();
278 OGRFieldDefn *operator->()
280 return m_poFieldDefn;
286 TemporaryUnsealer GetTemporaryUnsealer();
289#ifdef GDAL_COMPILATION
301inline OGRFieldDefn::TemporaryUnsealer whileUnsealing(
OGRFieldDefn *
object)
303 return object->GetTemporaryUnsealer();
335 char *pszName =
nullptr;
341 mutable int bNullable =
true;
342 bool m_bSealed =
false;
391 void SetNullable(
int bNullableIn);
395 return m_oCoordPrecision;
421 struct CPL_DLL TemporaryUnsealer
428 : m_poFieldDefn(poFieldDefn)
433 TemporaryUnsealer(TemporaryUnsealer &&) =
default;
434 TemporaryUnsealer &operator=(TemporaryUnsealer &&) =
default;
438 m_poFieldDefn->
Seal();
441 OGRGeomFieldDefn *operator->()
443 return m_poFieldDefn;
449 TemporaryUnsealer GetTemporaryUnsealer();
452#ifdef GDAL_COMPILATION
464inline OGRGeomFieldDefn::TemporaryUnsealer
467 return object->GetTemporaryUnsealer();
507 volatile int nRefCount = 0;
509 mutable std::vector<std::unique_ptr<OGRFieldDefn>> apoFieldDefn{};
510 mutable std::vector<std::unique_ptr<OGRGeomFieldDefn>> apoGeomFieldDefn{};
512 char *pszFeatureClassName =
nullptr;
514 bool bIgnoreStyle =
false;
516 friend class TemporaryUnsealer;
517 bool m_bSealed =
false;
518 int m_nTemporaryUnsealCount = 0;
525 void SetName(
const char *pszName);
526 virtual const char *
GetName()
const;
539 template <
class OwnerT,
class ChildT>
struct CPL_DLL Fields
545 inline explicit Fields(OwnerT poFDefn) : m_poFDefn(poFDefn)
549 struct CPL_DLL Iterator
556 inline Iterator(OwnerT poFDefn,
int nIdx)
557 : m_poFDefn(poFDefn), m_nIdx(nIdx)
561 inline ChildT operator*()
const
563 return m_poFDefn->GetFieldDefn(m_nIdx);
566 inline Iterator &operator++()
572 inline bool operator!=(
const Iterator &it)
const
574 return m_nIdx != it.m_nIdx;
578 inline Iterator
begin()
580 return Iterator(m_poFDefn, 0);
583 inline Iterator
end()
585 return Iterator(m_poFDefn, m_poFDefn->GetFieldCount());
588 inline size_t size()
const
590 return static_cast<std::size_t
>(m_poFDefn->GetFieldCount());
593 inline ChildT operator[](
size_t i)
595 return m_poFDefn->GetFieldDefn(
static_cast<int>(i));
620 using ConstFields = Fields<const OGRFeatureDefn *, const OGRFieldDefn *>;
640 int GetFieldCountUnsafe()
const
642 return static_cast<int>(apoFieldDefn.size());
646 OGRFieldDefn *GetFieldDefnUnsafe(
int i)
648 if (apoFieldDefn.empty())
650 return apoFieldDefn[
static_cast<std::size_t
>(i)].get();
653 const OGRFieldDefn *GetFieldDefnUnsafe(
int i)
const
655 if (apoFieldDefn.empty())
657 return apoFieldDefn[
static_cast<std::size_t
>(i)].get();
662 virtual void AddFieldDefn(
const OGRFieldDefn *);
663 virtual OGRErr DeleteFieldDefn(
int iField);
673 virtual std::unique_ptr<OGRFieldDefn> StealFieldDefn(
int iField);
675 virtual void AddFieldDefn(std::unique_ptr<OGRFieldDefn> &&poFieldDefn);
677 virtual OGRErr ReorderFieldDefns(
const int *panMap);
687 virtual std::unique_ptr<OGRGeomFieldDefn> StealGeomFieldDefn(
int iField);
689 virtual int GetGeomFieldCount()
const;
690 virtual OGRGeomFieldDefn *GetGeomFieldDefn(
int i);
691 virtual const OGRGeomFieldDefn *GetGeomFieldDefn(
int i)
const;
692 virtual int GetGeomFieldIndex(
const char *)
const;
699 template <
class OwnerT,
class ChildT>
struct CPL_DLL GeomFields
705 inline explicit GeomFields(OwnerT poFDefn) : m_poFDefn(poFDefn)
709 struct CPL_DLL Iterator
716 inline Iterator(OwnerT poFDefn,
int nIdx)
717 : m_poFDefn(poFDefn), m_nIdx(nIdx)
721 inline ChildT operator*()
const
723 return m_poFDefn->GetGeomFieldDefn(m_nIdx);
726 inline Iterator &operator++()
732 inline bool operator!=(
const Iterator &it)
const
734 return m_nIdx != it.m_nIdx;
738 inline Iterator
begin()
740 return Iterator(m_poFDefn, 0);
743 inline Iterator
end()
745 return Iterator(m_poFDefn, m_poFDefn->GetGeomFieldCount());
748 inline size_t size()
const
750 return static_cast<std::size_t
>(m_poFDefn->GetGeomFieldCount());
753 inline ChildT operator[](
size_t i)
const
755 return m_poFDefn->GetGeomFieldDefn(
static_cast<int>(i));
781 GeomFields<const OGRFeatureDefn *, const OGRGeomFieldDefn *>;
799 virtual void AddGeomFieldDefn(std::unique_ptr<OGRGeomFieldDefn> &&);
800 virtual OGRErr DeleteGeomFieldDefn(
int iGeomField);
809 return CPLAtomicInc(&nRefCount);
814 return CPLAtomicDec(&nRefCount);
824 virtual int IsGeometryIgnored()
const;
825 virtual void SetGeometryIgnored(
int bIgnore);
834 bIgnoreStyle = bIgnore;
837 virtual int IsSame(
const OGRFeatureDefn *poOtherFeatureDefn)
const;
840 void ReserveSpaceForFields(
int nFieldCountIn);
843 std::vector<int> ComputeMapForSetFrom(
const OGRFeatureDefn *poSrcFDefn,
844 bool bForgiving =
true)
const;
846 static OGRFeatureDefn *CreateFeatureDefn(
const char *pszName =
nullptr);
863 void Seal(
bool bSealFields);
865 void Unseal(
bool bUnsealFields);
868 struct CPL_DLL TemporaryUnsealer
872 bool m_bSealFields =
false;
878 TemporaryUnsealer(TemporaryUnsealer &&) =
default;
879 TemporaryUnsealer &operator=(TemporaryUnsealer &&) =
default;
881 ~TemporaryUnsealer();
885 return m_poFeatureDefn;
891 TemporaryUnsealer GetTemporaryUnsealer(
bool bSealFields =
true);
897#ifdef GDAL_COMPILATION
918inline OGRFeatureDefn::TemporaryUnsealer whileUnsealing(
OGRFeatureDefn *
object,
919 bool bSealFields =
true)
921 return object->GetTemporaryUnsealer(bSealFields);
940 char *m_pszNativeData;
941 char *m_pszNativeMediaType;
943 bool SetFieldInternal(
int i,
const OGRField *puValue);
947 mutable char *m_pszStyleString;
949 mutable char *m_pszTmpFieldValue;
959 class CPL_DLL FieldValue
961 friend class OGRFeature;
963 std::unique_ptr<Private> m_poPrivate;
965 FieldValue(OGRFeature *poFeature,
int iFieldIndex);
966 FieldValue(
const OGRFeature *poFeature,
int iFieldIndex);
967 FieldValue(
const FieldValue &oOther) =
delete;
968 FieldValue &Assign(
const FieldValue &oOther);
974 FieldValue &
operator=(FieldValue &&oOther);
978 FieldValue &
operator=(
const FieldValue &oOther);
986 FieldValue &
operator=(
const char *pszVal);
988 FieldValue &
operator=(
const std::string &osVal);
990 FieldValue &
operator=(
const std::vector<int> &oArray);
992 FieldValue &
operator=(
const std::vector<GIntBig> &oArray);
994 FieldValue &
operator=(
const std::vector<double> &oArray);
996 FieldValue &
operator=(
const std::vector<std::string> &oArray);
1011 void SetDateTime(
int nYear,
int nMonth,
int nDay,
int nHour = 0,
1012 int nMinute = 0,
float fSecond = 0.f,
int nTZFlag = 0);
1015 int GetIndex()
const;
1022 return GetDefn()->GetNameRef();
1034 return GetDefn()->GetSubType();
1046 bool IsUnset()
const;
1050 bool IsNull()
const;
1053 const OGRField *GetRawValue()
const;
1092 bool GetDateTime(
int *pnYear,
int *pnMonth,
int *pnDay,
int *pnHour,
1093 int *pnMinute,
float *pfSecond,
int *pnTZFlag)
const;
1096 operator int()
const
1109 operator double()
const
1115 operator const char *()
const
1121 operator const std::vector<int> &()
const
1128 operator const std::vector<GIntBig> &()
const
1134 operator const std::vector<double> &()
const
1140 operator const std::vector<std::string> &()
const
1149 int GetAsInteger()
const;
1152 GIntBig GetAsInteger64()
const;
1154 double GetAsDouble()
const;
1156 const char *GetAsString()
const;
1158 const std::vector<int> &GetAsIntegerList()
const;
1161 const std::vector<GIntBig> &GetAsInteger64List()
const;
1163 const std::vector<double> &GetAsDoubleList()
const;
1165 const std::vector<std::string> &GetAsStringList()
const;
1169 class CPL_DLL ConstFieldIterator
1171 friend class OGRFeature;
1173 std::unique_ptr<Private> m_poPrivate;
1175 ConstFieldIterator(
const OGRFeature *poSelf,
int nPos);
1180 ConstFieldIterator &&oOther)
noexcept;
1182 ~ConstFieldIterator();
1184 ConstFieldIterator &operator++();
1185 bool operator!=(
const ConstFieldIterator &it)
const;
1212#if defined(__clang__)
1213#pragma clang diagnostic push
1214#pragma clang diagnostic ignored "-Wweak-vtables"
1223#if defined(__clang__)
1224#pragma clang diagnostic pop
1241 OGRErr SetGeometry(std::unique_ptr<OGRGeometry>);
1248 return poDefn->GetGeomFieldCount();
1253 return poDefn->GetGeomFieldDefn(iField);
1258 return poDefn->GetGeomFieldIndex(pszName);
1262 const OGRGeometry *GetGeomFieldRef(
int iField)
const;
1264 OGRGeometry *GetGeomFieldRef(
const char *pszFName);
1265 const OGRGeometry *GetGeomFieldRef(
const char *pszFName)
const;
1268 OGRErr SetGeomField(
int iField, std::unique_ptr<OGRGeometry>);
1277 return poDefn->GetFieldCount();
1282 return poDefn->GetFieldDefn(iField);
1287 return poDefn->GetFieldIndex(pszName);
1290 int IsFieldSet(
int iField)
const;
1292 void UnsetField(
int iField);
1294 bool IsFieldNull(
int iField)
const;
1296 void SetFieldNull(
int iField);
1298 bool IsFieldSetAndNotNull(
int iField)
const;
1302 return pauFields + i;
1307 return pauFields + i;
1310 int GetFieldAsInteger(
int i)
const;
1311 GIntBig GetFieldAsInteger64(
int i)
const;
1312 double GetFieldAsDouble(
int i)
const;
1313 const char *GetFieldAsString(
int i)
const;
1314 const char *GetFieldAsISO8601DateTime(
int i,
1316 const int *GetFieldAsIntegerList(
int i,
int *pnCount)
const;
1317 const GIntBig *GetFieldAsInteger64List(
int i,
int *pnCount)
const;
1318 const double *GetFieldAsDoubleList(
int i,
int *pnCount)
const;
1319 char **GetFieldAsStringList(
int i)
const;
1320 GByte *GetFieldAsBinary(
int i,
int *pnCount)
const;
1321 int GetFieldAsDateTime(
int i,
int *pnYear,
int *pnMonth,
int *pnDay,
1322 int *pnHour,
int *pnMinute,
int *pnSecond,
1323 int *pnTZFlag)
const;
1324 int GetFieldAsDateTime(
int i,
int *pnYear,
int *pnMonth,
int *pnDay,
1325 int *pnHour,
int *pnMinute,
float *pfSecond,
1326 int *pnTZFlag)
const;
1327 char *GetFieldAsSerializedJSon(
int i)
const;
1330 bool IsFieldSetUnsafe(
int i)
const
1337 bool IsFieldNullUnsafe(
int i)
const
1344 bool IsFieldSetAndNotNullUnsafe(
int i)
const
1346 return IsFieldSetUnsafe(i) && !IsFieldNullUnsafe(i);
1351 int GetFieldAsIntegerUnsafe(
int i)
const
1353 return pauFields[i].Integer;
1356 GIntBig GetFieldAsInteger64Unsafe(
int i)
const
1358 return pauFields[i].Integer64;
1361 double GetFieldAsDoubleUnsafe(
int i)
const
1363 return pauFields[i].Real;
1366 const char *GetFieldAsStringUnsafe(
int i)
const
1368 return pauFields[i].String;
1420 void SetField(
int i,
int nValue);
1421 void SetField(
int i,
GIntBig nValue);
1422 void SetField(
int i,
double dfValue);
1423 void SetField(
int i,
const char *pszValue);
1424 void SetField(
int i,
int nCount,
const int *panValues);
1425 void SetField(
int i,
int nCount,
const GIntBig *panValues);
1426 void SetField(
int i,
int nCount,
const double *padfValues);
1427 void SetField(
int i,
const char *
const *papszValues);
1428 void SetField(
int i,
const OGRField *puValue);
1429 void SetField(
int i,
int nCount,
const void *pabyBinary);
1430 void SetField(
int i,
int nYear,
int nMonth,
int nDay,
int nHour = 0,
1431 int nMinute = 0,
float fSecond = 0.f,
int nTZFlag = 0);
1436 void SetFieldSameTypeUnsafe(
int i,
int nValue)
1438 pauFields[i].Integer = nValue;
1439 pauFields[i].Set.nMarker2 = 0;
1440 pauFields[i].Set.nMarker3 = 0;
1443 void SetFieldSameTypeUnsafe(
int i,
GIntBig nValue)
1445 pauFields[i].Integer64 = nValue;
1448 void SetFieldSameTypeUnsafe(
int i,
double dfValue)
1450 pauFields[i].Real = dfValue;
1453 void SetFieldSameTypeUnsafe(
int i,
char *pszValueTransferred)
1455 pauFields[i].String = pszValueTransferred;
1475 void SetField(
const char *pszFName,
const char *pszValue)
1480 void SetField(
const char *pszFName,
int nCount,
const int *panValues)
1490 void SetField(
const char *pszFName,
int nCount,
const double *padfValues)
1495 void SetField(
const char *pszFName,
const char *
const *papszValues)
1505 void SetField(
const char *pszFName,
int nYear,
int nMonth,
int nDay,
1506 int nHour = 0,
int nMinute = 0,
float fSecond = 0.f,
1520 void DumpReadable(FILE *,
CSLConstList papszOptions =
nullptr)
const;
1521 std::string DumpReadableAsString(
CSLConstList papszOptions =
nullptr)
const;
1524 OGRErr SetFrom(
const OGRFeature *,
const int *panMap,
int bForgiving = TRUE,
1525 bool bUseISO8601ForDateTimeAsString =
false);
1527 int bForgiving = TRUE,
1528 bool bUseISO8601ForDateTimeAsString =
false);
1532 const int *panRemapSource);
1535 const int *panRemapSource);
1538 int Validate(
int nValidateFlags,
int bEmitError)
const;
1539 void FillUnsetWithDefault(
int bNotNullableOnly,
char **papszOptions);
1541 bool SerializeToBinary(std::vector<GByte> &abyBuffer)
const;
1542 bool DeserializeFromBinary(
const GByte *pabyBuffer,
size_t nSize);
1544 virtual const char *GetStyleString()
const;
1545 virtual void SetStyleString(
const char *);
1546 virtual void SetStyleStringDirectly(
char *);
1553 return m_poStyleTable;
1557 virtual void SetStyleTableDirectly(
OGRStyleTable *poStyleTable);
1561 return m_pszNativeData;
1566 return m_pszNativeMediaType;
1569 void SetNativeData(
const char *pszNativeData);
1570 void SetNativeMediaType(
const char *pszNativeMediaType);
1586 return reinterpret_cast<OGRFeature *
>(hFeature);
1594struct CPL_DLL OGRFeatureUniquePtrDeleter
1596 void operator()(OGRFeature *)
const;
1603typedef std::unique_ptr<OGRFeature, OGRFeatureUniquePtrDeleter>
1610 return poFeature->
begin();
1616 return poFeature->
end();
1623 return poFeature->begin();
1629 return poFeature->end();
1664 std::string m_osName;
1665 std::string m_osDescription;
1672 OGRFieldDomain(
const std::string &osName,
const std::string &osDescription,
1706 return m_osDescription;
1715 return m_eDomainType;
1724 return m_eFieldType;
1733 return m_eFieldSubType;
1754 return m_eSplitPolicy;
1763 m_eSplitPolicy = policy;
1772 return m_eMergePolicy;
1781 m_eMergePolicy = policy;
1794 std::vector<OGRCodedValue> m_asValues{};
1796 OGRCodedFieldDomain(
const OGRCodedFieldDomain &) =
delete;
1797 OGRCodedFieldDomain &operator=(
const OGRCodedFieldDomain &) =
delete;
1815 OGRCodedFieldDomain(
const std::string &osName,
1816 const std::string &osDescription,
1818 std::vector<OGRCodedValue> &&asValues);
1820 ~OGRCodedFieldDomain()
override;
1822 OGRCodedFieldDomain *
Clone()
const override;
1831 return m_asValues.data();
1842 bool m_bMinIsInclusive;
1843 bool m_bMaxIsInclusive;
1845 OGRRangeFieldDomain(
const OGRRangeFieldDomain &) =
delete;
1846 OGRRangeFieldDomain &operator=(
const OGRRangeFieldDomain &) =
delete;
1876 OGRRangeFieldDomain(
const std::string &osName,
1877 const std::string &osDescription,
1879 const OGRField &sMin,
bool bMinIsInclusive,
1880 const OGRField &sMax,
bool bMaxIsInclusive);
1882 OGRRangeFieldDomain *
Clone()
const override;
1899 bIsInclusiveOut = m_bMinIsInclusive;
1918 bIsInclusiveOut = m_bMaxIsInclusive;
1930 std::string m_osGlob;
1932 OGRGlobFieldDomain(
const OGRGlobFieldDomain &) =
delete;
1933 OGRGlobFieldDomain &operator=(
const OGRGlobFieldDomain &) =
delete;
1946 OGRGlobFieldDomain(
const std::string &osName,
1947 const std::string &osDescription,
1949 const std::string &osBlob);
1951 OGRGlobFieldDomain *
Clone()
const override;
1970class swq_custom_func_registrar;
1971struct swq_evaluation_context;
1973class CPL_DLL OGRFeatureQuery
1976 const OGRFeatureDefn *poTargetDefn;
1978 swq_evaluation_context *m_psContext =
nullptr;
1980 char **FieldCollector(
void *,
char **);
1982 static GIntBig *EvaluateAgainstIndices(
const swq_expr_node *, OGRLayer *,
1985 static int CanUseIndex(
const swq_expr_node *, OGRLayer *);
1987 OGRErr Compile(
const OGRLayer *,
const OGRFeatureDefn *,
const char *,
1989 swq_custom_func_registrar *poCustomFuncRegistrar);
1997 OGRErr Compile(
const OGRLayer *,
const char *,
int bCheck = TRUE,
1998 swq_custom_func_registrar *poCustomFuncRegistrar =
nullptr);
1999 OGRErr Compile(
const OGRFeatureDefn *,
const char *,
int bCheck = TRUE,
2000 swq_custom_func_registrar *poCustomFuncRegistrar =
nullptr);
2001 int Evaluate(OGRFeature *);
2005 int CanUseIndex(OGRLayer *);
2007 char **GetUsedFields();
const OGRCodedValue * GetEnumeration() const
Get the enumeration as (code, value) pairs.
Definition ogr_feature.h:1829
OGRCodedFieldDomain * Clone() const override
Clone.
Definition ogrfielddefn.cpp:2482
Definition of a feature class or feature layer.
Definition ogr_feature.h:504
int Reference()
Increments the reference count by one.
Definition ogr_feature.h:807
ConstFields GetFields() const
Return an object that can be used to iterate over non-geometry fields.
Definition ogr_feature.h:632
ConstGeomFields GetGeomFields() const
Return an object that can be used to iterate over geometry fields.
Definition ogr_feature.h:793
virtual int GetFieldCount() const
Fetch number of fields on this feature.
Definition ogrfeaturedefn.cpp:261
virtual OGRFieldDefn * GetFieldDefn(int i)
Fetch field definition.
Definition ogrfeaturedefn.cpp:305
NonConstGeomFields GetGeomFields()
Return an object that can be used to iterate over geometry fields.
Definition ogr_feature.h:774
int Dereference()
Decrements the reference count by one.
Definition ogr_feature.h:812
static OGRFeatureDefnH ToHandle(OGRFeatureDefn *poFeatureDefn)
Convert a OGRFeatureDefn* to a OGRFeatureDefnH.
Definition ogr_feature.h:851
Fields< OGRFeatureDefn *, OGRFieldDefn * > NonConstFields
Return type of GetFields().
Definition ogr_feature.h:602
int GetFieldIndexCaseSensitive(const char *) const
Find field by name, in a case sensitive way.
Definition ogrfeaturedefn.cpp:1288
GeomFields< const OGRFeatureDefn *, const OGRGeomFieldDefn * > ConstGeomFields
Return type of GetGeomFields() const.
Definition ogr_feature.h:780
virtual bool IsStyleIgnored() const
Determine whether the style can be omitted when fetching features.
Definition ogr_feature.h:827
void SetName(const char *pszName)
Change name of this OGRFeatureDefn.
Definition ogrfeaturedefn.cpp:198
static OGRFeatureDefn * FromHandle(OGRFeatureDefnH hFeatureDefn)
Convert a OGRFeatureDefnH to a OGRFeatureDefn*.
Definition ogr_feature.h:858
virtual const char * GetName() const
Get name of this OGRFeatureDefn.
Definition ogrfeaturedefn.cpp:224
GeomFields< OGRFeatureDefn *, OGRGeomFieldDefn * > NonConstGeomFields
Return type of GetGeomFields().
Definition ogr_feature.h:762
Fields< const OGRFeatureDefn *, const OGRFieldDefn * > ConstFields
Return type of GetFields() const.
Definition ogr_feature.h:620
virtual void SetStyleIgnored(bool bIgnore)
Set whether the style can be omitted when fetching features.
Definition ogr_feature.h:832
OGRFeatureDefn(const char *pszName=nullptr)
Constructor.
Definition ogrfeaturedefn.cpp:46
virtual int GetFieldIndex(const char *) const
Find field by name.
Definition ogrfeaturedefn.cpp:1259
int GetReferenceCount() const
Fetch current reference count.
Definition ogr_feature.h:817
NonConstFields GetFields()
Return an object that can be used to iterate over non-geometry fields.
Definition ogr_feature.h:614
Field value iterator class.
Definition ogr_feature.h:1170
Exception raised by operator[](const char*) when a field is not found.
Definition ogr_feature.h:1220
Field value.
Definition ogr_feature.h:960
const std::vector< std::string > & GetAsStringList() const
Return the field value as string list, with potential conversion.
Definition ogrfeature.cpp:8619
bool empty() const
Return whether the field value is unset/empty.
Definition ogr_feature.h:1039
const std::vector< int > & GetAsIntegerList() const
Return the field value as integer list, with potential conversion.
Definition ogrfeature.cpp:8592
const char * GetAsString() const
Return the field value as string, with potential conversion.
Definition ogrfeature.cpp:8576
int GetInteger() const
Return the integer value.
Definition ogr_feature.h:1059
bool IsUnset() const
Return whether the field value is unset/empty.
Definition ogrfeature.cpp:8548
OGRFieldType GetType() const
Return field type.
Definition ogr_feature.h:1026
void Unset()
Unset the field.
Definition ogr_feature.h:1005
double GetDouble() const
Return the double value.
Definition ogr_feature.h:1077
const char * GetName() const
Return field name.
Definition ogr_feature.h:1020
const std::vector< GIntBig > & GetAsInteger64List() const
Return the field value as 64-bit integer list, with potential conversion.
Definition ogrfeature.cpp:8601
int GetAsInteger() const
Return the field value as integer, with potential conversion.
Definition ogrfeature.cpp:8558
GIntBig GetInteger64() const
Return the 64-bit integer value.
Definition ogr_feature.h:1068
void clear()
Unset the field.
Definition ogrfeature.cpp:8523
const std::vector< double > & GetAsDoubleList() const
Return the field value as double list, with potential conversion.
Definition ogrfeature.cpp:8610
const OGRFieldDefn * GetDefn() const
Return field definition.
Definition ogrfeature.cpp:8538
const OGRField * GetRawValue() const
Return the raw field value.
Definition ogrfeature.cpp:8543
OGRFieldSubType GetSubType() const
Return field subtype.
Definition ogr_feature.h:1032
FieldValue & operator=(const FieldValue &oOther)
Set a field value from another one.
Definition ogrfeature.cpp:8422
GIntBig GetAsInteger64() const
Return the field value as 64-bit integer, with potential conversion.
Definition ogrfeature.cpp:8564
const char * GetString() const
Return the string value.
Definition ogr_feature.h:1086
double GetAsDouble() const
Return the field value as double, with potential conversion.
Definition ogrfeature.cpp:8570
void SetNull()
Set a null value to the field.
Definition ogrfeature.cpp:8518
A simple feature, including geometry and attributes.
Definition ogr_feature.h:934
void SetField(const char *pszFName, int nCount, const double *padfValues)
This method currently on has an effect of OFTIntegerList, OFTInteger64List, OFTRealList fields.
Definition ogr_feature.h:1490
static OGRFeatureH ToHandle(OGRFeature *poFeature)
Convert a OGRFeature* to a OGRFeatureH.
Definition ogr_feature.h:1577
const char * GetFieldAsString(const char *pszFName) const
Fetch field value as a string.
Definition ogr_feature.h:1388
const GIntBig * GetFieldAsInteger64List(const char *pszFName, int *pnCount) const
Fetch field value as a list of 64 bit integers.
Definition ogr_feature.h:1404
const double * GetFieldAsDoubleList(int i, int *pnCount) const
Fetch field value as a list of doubles.
Definition ogrfeature.cpp:3084
ConstFieldIterator end() const
Return end of field value iterator.
Definition ogrfeature.cpp:8340
void SetField(const char *pszFName, double dfValue)
Set field to double value.
Definition ogr_feature.h:1470
ConstFieldIterator begin() const
Return begin of field value iterator.
Definition ogrfeature.cpp:8335
const double * GetFieldAsDoubleList(const char *pszFName, int *pnCount) const
Fetch field value as a list of doubles.
Definition ogr_feature.h:1410
char ** GetFieldAsStringList(int i) const
Fetch field value as a list of strings.
Definition ogrfeature.cpp:3168
const char * GetFieldAsISO8601DateTime(const char *pszFName, CSLConstList papszOptions) const
Fetch OFTDateTime field value as a ISO8601 representation.
Definition ogr_feature.h:1393
const OGRFeatureDefn * GetDefnRef() const
Fetch feature definition.
Definition ogr_feature.h:1230
int GetGeomFieldCount() const
Fetch number of geometry fields on this feature.
Definition ogr_feature.h:1246
const char * GetFieldAsISO8601DateTime(int i, CSLConstList papszOptions) const
Fetch OFTDateTime field value as a ISO8601 representation.
Definition ogrfeature.cpp:2805
char ** GetFieldAsStringList(const char *pszFName) const
Fetch field value as a list of strings.
Definition ogr_feature.h:1415
void SetField(int i, int nValue)
Set field to integer value.
Definition ogrfeature.cpp:3663
const OGRFieldDefn * GetFieldDefnRef(int iField) const
Fetch definition for this field.
Definition ogr_feature.h:1280
double GetFieldAsDouble(const char *pszFName) const
Fetch field value as a double.
Definition ogr_feature.h:1383
void SetField(const char *pszFName, int nValue)
Set field to integer value.
Definition ogr_feature.h:1460
OGRFeature(const OGRFeatureDefn *)
Constructor.
Definition ogrfeature.cpp:70
const int * GetFieldAsIntegerList(const char *pszFName, int *pnCount) const
Fetch field value as a list of integers.
Definition ogr_feature.h:1399
int GetFieldCount() const
Fetch number of fields on this feature.
Definition ogr_feature.h:1275
void SetField(const char *pszFName, int nCount, const GIntBig *panValues)
Set field to list of 64 bit integers value.
Definition ogr_feature.h:1485
GIntBig GetFieldAsInteger64(int i) const
Fetch field value as integer 64 bit.
Definition ogrfeature.cpp:2136
const OGRGeomFieldDefn * GetGeomFieldDefnRef(int iField) const
Fetch definition for this geometry field.
Definition ogr_feature.h:1251
void SetField(const char *pszFName, const char *const *papszValues)
This method currently on has an effect of OFTStringList fields.
Definition ogr_feature.h:1495
void SetField(const char *pszFName, GIntBig nValue)
Set field to 64 bit integer value.
Definition ogr_feature.h:1465
const int * GetFieldAsIntegerList(int i, int *pnCount) const
Fetch field value as a list of integers.
Definition ogrfeature.cpp:2911
const char * GetNativeData() const
Returns the native data for the feature.
Definition ogr_feature.h:1559
int GetFieldAsInteger(const char *pszFName) const
Fetch field value as integer.
Definition ogr_feature.h:1373
const char * GetFieldAsString(int i) const
Fetch field value as a string.
Definition ogrfeature.cpp:2438
int GetFieldIndex(const char *pszName) const
Fetch the field index given field name.
Definition ogr_feature.h:1285
int GetFieldAsInteger(int i) const
Fetch field value as integer.
Definition ogrfeature.cpp:1993
void SetField(const char *pszFName, int nCount, const int *panValues)
This method currently on has an effect of OFTIntegerList, OFTInteger64List and OFTRealList fields.
Definition ogr_feature.h:1480
int GetGeomFieldIndex(const char *pszName) const
Fetch the geometry field index given geometry field name.
Definition ogr_feature.h:1256
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:1505
GIntBig GetFieldAsInteger64(const char *pszFName) const
Fetch field value as integer 64 bit.
Definition ogr_feature.h:1378
const OGRField * GetRawFieldRef(int i) const
Fetch a pointer to the internal field value given the index.
Definition ogr_feature.h:1305
void SetField(const char *pszFName, const char *pszValue)
Set field to string value.
Definition ogr_feature.h:1475
const char * GetNativeMediaType() const
Returns the native media type for the feature.
Definition ogr_feature.h:1564
GIntBig GetFID() const
Get feature identifier.
Definition ogr_feature.h:1513
OGRField * GetRawFieldRef(int i)
Fetch a pointer to the internal field value given the index.
Definition ogr_feature.h:1300
bool CopySelfTo(OGRFeature *poNew) const
Copies the innards of this OGRFeature into the supplied object.
Definition ogrfeature.cpp:1180
double GetFieldAsDouble(int i) const
Fetch field value as a double.
Definition ogrfeature.cpp:2253
const FieldValue operator[](int iField) const
Return a field value.
Definition ogrfeature.cpp:1857
virtual OGRStyleTable * GetStyleTable() const
Return style table.
Definition ogr_feature.h:1551
static OGRFeature * FromHandle(OGRFeatureH hFeature)
Convert a OGRFeatureH to a OGRFeature*.
Definition ogr_feature.h:1584
void SetField(const char *pszFName, const OGRField *puValue)
Set field.
Definition ogr_feature.h:1500
const GIntBig * GetFieldAsInteger64List(int i, int *pnCount) const
Fetch field value as a list of 64 bit integers.
Definition ogrfeature.cpp:2997
Definition of an attribute of an OGRFeatureDefn.
Definition ogr_feature.h:69
const char * GetNameRef() const
Fetch name of this field.
Definition ogr_feature.h:108
void Unseal()
Unseal a OGRFieldDefn.
Definition ogrfielddefn.cpp:2296
int IsNullable() const
Return whether this field can receive null values.
Definition ogr_feature.h:186
void Seal()
Seal a OGRFieldDefn.
Definition ogrfielddefn.cpp:2277
int IsUnique() const
Return whether this field has a unique constraint.
Definition ogr_feature.h:193
void SetName(const char *)
Reset the name of this field.
Definition ogrfielddefn.cpp:205
OGRFieldSubType GetSubType() const
Fetch subtype of this field.
Definition ogr_feature.h:129
bool IsGenerated() const
Return whether the field is a generated field.
Definition ogr_feature.h:206
OGRJustification GetJustify() const
Get the justification for this field.
Definition ogr_feature.h:138
void SetIgnored(int bIgnoreIn)
Set whether this field should be omitted when fetching features.
Definition ogr_feature.h:181
OGRFieldDefn & operator=(const OGRFieldDefn &oOther)
OGRFieldDefn::operator = assignment operator.
Definition ogrfielddefn.cpp:145
int GetPrecision() const
Get the formatting precision for this field.
Definition ogr_feature.h:155
OGRFieldType GetType() const
Fetch type of this field.
Definition ogr_feature.h:120
int GetWidth() const
Get the formatting width for this field.
Definition ogr_feature.h:148
const std::string & GetComment() const
Return the (optional) comment for this field.
Definition ogr_feature.h:230
int GetTZFlag() const
Get the time zone flag.
Definition ogr_feature.h:162
void SetGenerated(bool bGeneratedIn)
SetGenerated set the field generated status.
Definition ogr_feature.h:216
void SetJustify(OGRJustification eJustifyIn)
Set the justification for this field.
Definition ogr_feature.h:143
const char * GetAlternativeNameRef() const
Fetch the alternative name (or "alias") for this field.
Definition ogr_feature.h:115
static OGRFieldDefnH ToHandle(OGRFieldDefn *poFieldDefn)
Convert a OGRFieldDefn* to a OGRFieldDefnH.
Definition ogr_feature.h:241
const std::string & GetDomainName() const
Return the name of the field domain for this field.
Definition ogr_feature.h:223
int IsIgnored() const
Return whether this field should be omitted when fetching features.
Definition ogr_feature.h:176
static OGRFieldDefn * FromHandle(OGRFieldDefnH hFieldDefn)
Convert a OGRFieldDefnH to a OGRFieldDefn*.
Definition ogr_feature.h:248
OGRFieldDefn(const char *, OGRFieldType)
Constructor.
Definition ogrfielddefn.cpp:40
Definition of a field domain.
Definition ogr_feature.h:1661
OGRFieldDomainMergePolicy GetMergePolicy() const
Get the merge policy.
Definition ogr_feature.h:1770
void SetMergePolicy(OGRFieldDomainMergePolicy policy)
Set the merge policy.
Definition ogr_feature.h:1779
static OGRFieldDomain * FromHandle(OGRFieldDomainH hFieldDomain)
Convert a OGRFieldDomainH to a OGRFieldDomain*.
Definition ogr_feature.h:1743
virtual OGRFieldDomain * Clone() const =0
Clone.
OGRFieldSubType GetFieldSubType() const
Get the field subtype.
Definition ogr_feature.h:1731
const std::string & GetName() const
Get the name of the field domain.
Definition ogr_feature.h:1694
const std::string & GetDescription() const
Get the description of the field domain.
Definition ogr_feature.h:1704
OGRFieldDomainSplitPolicy GetSplitPolicy() const
Get the split policy.
Definition ogr_feature.h:1752
static OGRFieldDomainH ToHandle(OGRFieldDomain *poFieldDomain)
Convert a OGRFieldDomain* to a OGRFieldDomainH.
Definition ogr_feature.h:1737
OGRFieldType GetFieldType() const
Get the field type.
Definition ogr_feature.h:1722
OGRFieldDomainType GetDomainType() const
Get the type of the field domain.
Definition ogr_feature.h:1713
void SetSplitPolicy(OGRFieldDomainSplitPolicy policy)
Set the split policy.
Definition ogr_feature.h:1761
virtual ~OGRFieldDomain()
Destructor.
Definition of a geometry field of an OGRFeatureDefn.
Definition ogr_feature.h:332
void SetIgnored(int bIgnoreIn)
Set whether this field should be omitted when fetching features.
Definition ogr_feature.h:381
const OGRGeomCoordinatePrecision & GetCoordinatePrecision() const
Return the coordinate precision associated to this geometry field.
Definition ogr_feature.h:393
void Seal()
Seal a OGRGeomFieldDefn.
Definition ogrgeomfielddefn.cpp:859
void Unseal()
Unseal a OGRGeomFieldDefn.
Definition ogrgeomfielddefn.cpp:878
OGRGeomFieldDefn & operator=(const OGRGeomFieldDefn &oOther)
Copy assignment operator.
Definition ogrgeomfielddefn.cpp:153
static OGRGeomFieldDefn * FromHandle(OGRGeomFieldDefnH hGeomFieldDefn)
Convert a OGRGeomFieldDefnH to a OGRGeomFieldDefn*.
Definition ogr_feature.h:411
int IsNullable() const
Return whether this geometry field can receive null values.
Definition ogr_feature.h:386
OGRwkbGeometryType GetType() const
Fetch geometry type of this field.
Definition ogr_feature.h:366
OGRGeomFieldDefn(const char *pszNameIn, OGRwkbGeometryType eGeomTypeIn)
Constructor.
Definition ogrgeomfielddefn.cpp:39
void SetName(const char *)
Reset the name of this field.
Definition ogrgeomfielddefn.cpp:210
int IsIgnored() const
Return whether this field should be omitted when fetching features.
Definition ogr_feature.h:376
static OGRGeomFieldDefnH ToHandle(OGRGeomFieldDefn *poGeomFieldDefn)
Convert a OGRGeomFieldDefn* to a OGRGeomFieldDefnH.
Definition ogr_feature.h:404
const char * GetNameRef() const
Fetch name of this field.
Definition ogr_feature.h:361
Abstract base class for all geometry classes.
Definition ogr_geometry.h:357
OGRGlobFieldDomain * Clone() const override
Clone.
Definition ogrfeature.cpp:8651
const std::string & GetGlob() const
Get the glob expression.
Definition ogr_feature.h:1957
This class represents a layer of simple features, with access methods.
Definition ogrsf_frmts.h:61
OGRRangeFieldDomain * Clone() const override
Clone.
Definition ogrfeature.cpp:8641
const OGRField & GetMax(bool &bIsInclusiveOut) const
Get the maximum value.
Definition ogr_feature.h:1916
const OGRField & GetMin(bool &bIsInclusiveOut) const
Get the minimum value.
Definition ogr_feature.h:1897
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition ogr_spatialref.h:152
This class represents a style table.
Definition ogr_featurestyle.h:69
#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:936
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition cpl_port.h:1087
#define CPL_WARN_UNUSED_RESULT
Qualifier to warn when the return value of a function is not used.
Definition cpl_port.h:870
unsigned char GByte
Unsigned byte type.
Definition cpl_port.h:175
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition cpl_port.h:205
Forward definitions of GDAL/OGR/OSR C handle types.
void * OGRFieldDefnH
Opaque type for a field definition (OGRFieldDefn).
Definition gdal_fwd.h:122
void * OGRFeatureDefnH
Opaque type for a feature definition (OGRFeatureDefn).
Definition gdal_fwd.h:124
void * OGRFeatureH
Opaque type for a feature (OGRFeature).
Definition gdal_fwd.h:141
struct OGRFieldDomainHS * OGRFieldDomainH
Opaque type for a field domain definition (OGRFieldDomain).
Definition gdal_fwd.h:131
struct OGRGeomFieldDefnHS * OGRGeomFieldDefnH
Opaque type for a geometry field definition (OGRGeomFieldDefn).
Definition gdal_fwd.h:128
#define OGRUnsetMarker
Special value set in OGRField.Set.nMarker1, nMarker2 and nMarker3 for a unset field.
Definition ogr_core.h:845
#define OGR_TZFLAG_UNKNOWN
Time zone flag indicating unknown timezone.
Definition ogr_core.h:858
int OGRBoolean
Type for a OGR boolean.
Definition ogr_core.h:386
OGRFieldSubType
List of field subtypes.
Definition ogr_core.h:799
OGRFieldDomainMergePolicy
Merge policy for field domains.
Definition ogr_core.h:1251
@ OFDMP_DEFAULT_VALUE
Default value.
Definition ogr_core.h:1253
OGRFieldDomainType
Type of field domain.
Definition ogr_core.h:1216
OGRJustification
Display justification for field values.
Definition ogr_core.h:823
OGRFieldType
List of feature field types.
Definition ogr_core.h:772
#define OGRNullMarker
Special value set in OGRField.Set.nMarker1, nMarker2 and nMarker3 for a null field.
Definition ogr_core.h:852
OGRwkbGeometryType
List of well known binary geometry types.
Definition ogr_core.h:405
@ wkbUnknown
unknown type, non-standard
Definition ogr_core.h:406
int OGRErr
Type for a OGR error.
Definition ogr_core.h:370
OGRFieldDomainSplitPolicy
Split policy for field domains.
Definition ogr_core.h:1233
@ OFDSP_DEFAULT_VALUE
Default value.
Definition ogr_core.h:1235
std::unique_ptr< OGRFeature, OGRFeatureUniquePtrDeleter > OGRFeatureUniquePtr
Unique pointer type for OGRFeature.
Definition ogr_feature.h:1604
Simple feature style classes.
Geometry coordinate precision class.
Simple feature geometry classes.
OGRLayer::FeatureIterator begin(OGRLayer *poLayer)
Return begin of feature iterator.
Definition ogrsf_frmts.h:470
OGRLayer::FeatureIterator end(OGRLayer *poLayer)
Return end of feature iterator.
Definition ogrsf_frmts.h:478
Associates a code and a value.
Definition ogr_core.h:1203
Geometry coordinate precision.
Definition ogr_geomcoordinateprecision.h:40
OGRFeature field attribute value union.
Definition ogr_core.h:886