14#ifndef OGR_FEATURE_H_INCLUDED
15#define OGR_FEATURE_H_INCLUDED
17#include "cpl_atomic_ops.h"
28#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
75 char *pszAlternativeName;
89 bool m_bGenerated =
false;
91 std::string m_osDomainName{};
93 std::string m_osComment{};
96 bool m_bSealed =
false;
109 void SetName(
const char *);
116 void SetAlternativeName(
const char *);
120 return pszAlternativeName;
148 eJustify = eJustifyIn;
156 void SetWidth(
int nWidthIn);
163 void SetPrecision(
int nPrecisionIn);
170 void SetTZFlag(
int nTZFlag);
175 void SetDefault(
const char *);
176 const char *GetDefault()
const;
177 int IsDefaultDriverSpecific()
const;
194 void SetNullable(
int bNullableIn);
221 m_bGenerated = bGeneratedIn;
224 void SetUnique(
int bUniqueIn);
228 return m_osDomainName;
231 void SetDomainName(
const std::string &osDomainName);
238 void SetComment(
const std::string &osComment);
261 struct CPL_DLL TemporaryUnsealer
268 : m_poFieldDefn(poFieldDefn)
273 TemporaryUnsealer(TemporaryUnsealer &&) =
default;
274 TemporaryUnsealer &operator=(TemporaryUnsealer &&) =
default;
278 m_poFieldDefn->
Seal();
283 return m_poFieldDefn;
289 TemporaryUnsealer GetTemporaryUnsealer();
292#ifdef GDAL_COMPILATION
304inline OGRFieldDefn::TemporaryUnsealer whileUnsealing(
OGRFieldDefn *
object)
306 return object->GetTemporaryUnsealer();
338 char *pszName =
nullptr;
341 mutable OGRSpatialReferenceRefCountedPtr poSRS =
nullptr;
344 mutable int bNullable =
true;
345 bool m_bSealed =
false;
368 void SetName(
const char *);
384 void SetSpatialRef(OGRSpatialReferenceRefCountedPtr poSRSIn);
401 void SetNullable(
int bNullableIn);
405 return m_oCoordPrecision;
431 struct CPL_DLL TemporaryUnsealer
438 : m_poFieldDefn(poFieldDefn)
443 TemporaryUnsealer(TemporaryUnsealer &&) =
default;
444 TemporaryUnsealer &operator=(TemporaryUnsealer &&) =
default;
448 m_poFieldDefn->
Seal();
453 return m_poFieldDefn;
459 TemporaryUnsealer GetTemporaryUnsealer();
462 OGRSpatialReferenceRefCountedPtr &GetRefCountedSRS()
const
469#ifdef GDAL_COMPILATION
481inline OGRGeomFieldDefn::TemporaryUnsealer
484 return object->GetTemporaryUnsealer();
524 volatile int nRefCount = 0;
526 mutable std::vector<std::unique_ptr<OGRFieldDefn>> apoFieldDefn{};
527 mutable std::vector<std::unique_ptr<OGRGeomFieldDefn>> apoGeomFieldDefn{};
529 char *pszFeatureClassName =
nullptr;
531 bool bIgnoreStyle =
false;
533 friend class TemporaryUnsealer;
534 bool m_bSealed =
false;
535 int m_nTemporaryUnsealCount = 0;
542 void SetName(
const char *pszName);
543 virtual const char *GetName()
const;
545 virtual int GetFieldCount()
const;
548 virtual int GetFieldIndex(
const char *)
const;
549 int GetFieldIndexCaseSensitive(
const char *)
const;
556 template <
class OwnerT,
class ChildT>
struct CPL_DLL Fields
562 inline explicit Fields(OwnerT poFDefn) : m_poFDefn(poFDefn)
566 struct CPL_DLL Iterator
570 const int m_nFieldCount;
575 inline Iterator(OwnerT poFDefn,
int nIdx)
576 : m_poFDefn(poFDefn), m_nFieldCount(poFDefn->GetFieldCount()),
579 if (m_nIdx < m_nFieldCount)
580 m_curValue = m_poFDefn->GetFieldDefn(m_nIdx);
583 inline const ChildT &operator*()
const
588 inline ChildT &operator*()
593 inline Iterator &operator++()
596 if (m_nIdx < m_nFieldCount)
597 m_curValue = m_poFDefn->GetFieldDefn(m_nIdx);
599 m_curValue =
nullptr;
603 inline bool operator!=(
const Iterator &it)
const
605 return m_nIdx != it.m_nIdx;
609 inline Iterator
begin()
const
611 return Iterator(m_poFDefn, 0);
614 inline Iterator
end()
const
616 return Iterator(m_poFDefn, m_poFDefn->GetFieldCount());
619 inline size_t size()
const
621 return static_cast<std::size_t
>(m_poFDefn->GetFieldCount());
624 inline ChildT operator[](
size_t i)
626 return m_poFDefn->GetFieldDefn(
static_cast<int>(i));
651 using ConstFields = Fields<const OGRFeatureDefn *, const OGRFieldDefn *>;
671 int GetFieldCountUnsafe()
const
673 return static_cast<int>(apoFieldDefn.size());
679 if (apoFieldDefn.empty())
681 return apoFieldDefn[
static_cast<std::size_t
>(i)].get();
686 if (apoFieldDefn.empty())
688 return apoFieldDefn[
static_cast<std::size_t
>(i)].get();
694 virtual OGRErr DeleteFieldDefn(
int iField);
704 virtual std::unique_ptr<OGRFieldDefn> StealFieldDefn(
int iField);
706 virtual void AddFieldDefn(std::unique_ptr<OGRFieldDefn> &&poFieldDefn);
708 virtual OGRErr ReorderFieldDefns(
const int *panMap);
718 virtual std::unique_ptr<OGRGeomFieldDefn> StealGeomFieldDefn(
int iField);
720 virtual int GetGeomFieldCount()
const;
723 virtual int GetGeomFieldIndex(
const char *)
const;
730 template <
class OwnerT,
class ChildT>
struct CPL_DLL GeomFields
736 inline explicit GeomFields(OwnerT poFDefn) : m_poFDefn(poFDefn)
740 struct CPL_DLL Iterator
747 inline Iterator(OwnerT poFDefn,
int nIdx)
748 : m_poFDefn(poFDefn), m_nIdx(nIdx)
752 inline ChildT operator*()
const
754 return m_poFDefn->GetGeomFieldDefn(m_nIdx);
757 inline Iterator &operator++()
763 inline bool operator!=(
const Iterator &it)
const
765 return m_nIdx != it.m_nIdx;
769 inline Iterator
begin()
771 return Iterator(m_poFDefn, 0);
774 inline Iterator
end()
776 return Iterator(m_poFDefn, m_poFDefn->GetGeomFieldCount());
779 inline size_t size()
const
781 return static_cast<std::size_t
>(m_poFDefn->GetGeomFieldCount());
784 inline ChildT operator[](
size_t i)
const
786 return m_poFDefn->GetGeomFieldDefn(
static_cast<int>(i));
812 GeomFields<const OGRFeatureDefn *, const OGRGeomFieldDefn *>;
830 virtual void AddGeomFieldDefn(std::unique_ptr<OGRGeomFieldDefn> &&);
831 virtual OGRErr DeleteGeomFieldDefn(
int iGeomField);
838#ifdef DEPRECATE_OGRFEATUREDEFN_REF_COUNTING
840 CPL_WARN_DEPRECATED("Use OGRFeatureDefnRefCountedPtr instead")
842 return CPLAtomicInc(&nRefCount);
846 CPL_WARN_DEPRECATED("Use OGRFeatureDefnRefCountedPtr instead")
848 return CPLAtomicDec(&nRefCount);
851 int GetReferenceCount() const
852 CPL_WARN_DEPRECATED("Use OGRFeatureDefnRefCountedPtr instead")
858 CPL_WARN_DEPRECATED("Use OGRFeatureDefnRefCountedPtr instead");
862 return CPLAtomicInc(&nRefCount);
866#if defined(GDAL_COMPILATION) && !defined(DOXYGEN_XML)
867 CPL_WARN_DEPRECATED(
"Use Release() instead")
870 return CPLAtomicDec(&nRefCount);
881 virtual int IsGeometryIgnored()
const;
882 virtual void SetGeometryIgnored(
int bIgnore);
891 bIgnoreStyle = bIgnore;
894 virtual int IsSame(
const OGRFeatureDefn *poOtherFeatureDefn)
const;
897 void ReserveSpaceForFields(
int nFieldCountIn);
900 std::vector<int> ComputeMapForSetFrom(
const OGRFeatureDefn *poSrcFDefn,
901 bool bForgiving =
true)
const;
903 static OGRFeatureDefn *CreateFeatureDefn(
const char *pszName =
nullptr);
920 void Seal(
bool bSealFields);
922 void Unseal(
bool bUnsealFields);
925 struct CPL_DLL TemporaryUnsealer
929 bool m_bSealFields =
false;
935 TemporaryUnsealer(TemporaryUnsealer &&) =
default;
936 TemporaryUnsealer &operator=(TemporaryUnsealer &&) =
default;
938 ~TemporaryUnsealer();
942 return m_poFeatureDefn;
948 TemporaryUnsealer GetTemporaryUnsealer(
bool bSealFields =
true);
956#include "ogr_refcountedptr.h"
960 :
public OGRRefCountedPtrBase<OGRFeatureDefn>
964 inline explicit OGRRefCountedPtr(
OGRFeatureDefn *poFDefn =
nullptr,
972 inline explicit OGRRefCountedPtr(std::nullptr_t)
978 inline static OGRRefCountedPtr makeInstance(
const char *pszName)
993using OGRFeatureDefnRefCountedPtr = OGRRefCountedPtr<OGRFeatureDefn>;
997#ifdef GDAL_COMPILATION
1018inline OGRFeatureDefn::TemporaryUnsealer whileUnsealing(
OGRFeatureDefn *
object,
1019 bool bSealFields =
true)
1021 return object->GetTemporaryUnsealer(bSealFields);
1024inline OGRFeatureDefn::TemporaryUnsealer
1025whileUnsealing(OGRFeatureDefnRefCountedPtr &
object,
bool bSealFields =
true)
1027 return object->GetTemporaryUnsealer(bSealFields);
1047 char *m_pszNativeData;
1048 char *m_pszNativeMediaType;
1050 bool SetFieldInternal(
int i,
const OGRField *puValue);
1054 mutable char *m_pszStyleString;
1056 mutable char *m_pszTmpFieldValue;
1070 std::unique_ptr<Private> m_poPrivate;
1095 FieldValue &operator=(
const std::string &osVal);
1097 FieldValue &operator=(
const std::vector<int> &oArray);
1099 FieldValue &operator=(
const std::vector<GIntBig> &oArray);
1101 FieldValue &operator=(
const std::vector<double> &oArray);
1103 FieldValue &operator=(
const std::vector<std::string> &oArray);
1118 void SetDateTime(
int nYear,
int nMonth,
int nDay,
int nHour = 0,
1119 int nMinute = 0,
float fSecond = 0.f,
int nTZFlag = 0);
1122 int GetIndex()
const;
1129 return GetDefn()->GetNameRef();
1135 return GetDefn()->GetType();
1141 return GetDefn()->GetSubType();
1153 bool IsUnset()
const;
1157 bool IsNull()
const;
1160 const OGRField *GetRawValue()
const;
1168 return GetRawValue()->Integer;
1177 return GetRawValue()->Integer64;
1186 return GetRawValue()->Real;
1195 return GetRawValue()->String;
1199 bool GetDateTime(
int *pnYear,
int *pnMonth,
int *pnDay,
int *pnHour,
1200 int *pnMinute,
float *pfSecond,
int *pnTZFlag)
const;
1203 operator int()
const
1205 return GetAsInteger();
1212 return GetAsInteger64();
1216 operator double()
const
1218 return GetAsDouble();
1222 operator const char *()
const
1224 return GetAsString();
1228 operator const std::vector<int> &()
const
1230 return GetAsIntegerList();
1235 operator const std::vector<GIntBig> &()
const
1237 return GetAsInteger64List();
1241 operator const std::vector<double> &()
const
1243 return GetAsDoubleList();
1247 operator const std::vector<std::string> &()
const
1249 return GetAsStringList();
1256 int GetAsInteger()
const;
1259 GIntBig GetAsInteger64()
const;
1261 double GetAsDouble()
const;
1263 const char *GetAsString()
const;
1265 const std::vector<int> &GetAsIntegerList()
const;
1268 const std::vector<GIntBig> &GetAsInteger64List()
const;
1270 const std::vector<double> &GetAsDoubleList()
const;
1272 const std::vector<std::string> &GetAsStringList()
const;
1280 std::unique_ptr<Private> m_poPrivate;
1316 const FieldValue operator[](
int iField)
const;
1319#if defined(__clang__)
1320#pragma clang diagnostic push
1321#pragma clang diagnostic ignored "-Wweak-vtables"
1330#if defined(__clang__)
1331#pragma clang diagnostic pop
1334 const FieldValue operator[](
const char *pszFieldName)
const;
1335 FieldValue operator[](
const char *pszFieldName);
1348 OGRErr SetGeometry(std::unique_ptr<OGRGeometry>);
1353 int GetGeomFieldCount()
const
1369 const OGRGeometry *GetGeomFieldRef(
int iField)
const;
1371 OGRGeometry *GetGeomFieldRef(
const char *pszFName);
1372 const OGRGeometry *GetGeomFieldRef(
const char *pszFName)
const;
1375 OGRErr SetGeomField(
int iField, std::unique_ptr<OGRGeometry>);
1382 int GetFieldCount()
const
1397 int IsFieldSet(
int iField)
const;
1399 void UnsetField(
int iField);
1401 bool IsFieldNull(
int iField)
const;
1403 void SetFieldNull(
int iField);
1405 bool IsFieldSetAndNotNull(
int iField)
const;
1409 return pauFields + i;
1414 return pauFields + i;
1417 int GetFieldAsInteger(
int i)
const;
1418 GIntBig GetFieldAsInteger64(
int i)
const;
1419 double GetFieldAsDouble(
int i)
const;
1420 const char *GetFieldAsString(
int i)
const;
1421 const char *GetFieldAsISO8601DateTime(
int i,
1423 const int *GetFieldAsIntegerList(
int i,
int *pnCount)
const;
1424 const GIntBig *GetFieldAsInteger64List(
int i,
int *pnCount)
const;
1425 const double *GetFieldAsDoubleList(
int i,
int *pnCount)
const;
1426 char **GetFieldAsStringList(
int i)
const;
1427 GByte *GetFieldAsBinary(
int i,
int *pnCount)
const;
1428 int GetFieldAsDateTime(
int i,
int *pnYear,
int *pnMonth,
int *pnDay,
1429 int *pnHour,
int *pnMinute,
int *pnSecond,
1430 int *pnTZFlag)
const;
1431 int GetFieldAsDateTime(
int i,
int *pnYear,
int *pnMonth,
int *pnDay,
1432 int *pnHour,
int *pnMinute,
float *pfSecond,
1433 int *pnTZFlag)
const;
1434 char *GetFieldAsSerializedJSon(
int i)
const;
1437 bool IsFieldSetUnsafe(
int i)
const
1444 bool IsFieldNullUnsafe(
int i)
const
1451 bool IsFieldSetAndNotNullUnsafe(
int i)
const
1453 return IsFieldSetUnsafe(i) && !IsFieldNullUnsafe(i);
1458 int GetFieldAsIntegerUnsafe(
int i)
const
1460 return pauFields[i].Integer;
1463 GIntBig GetFieldAsInteger64Unsafe(
int i)
const
1465 return pauFields[i].Integer64;
1468 double GetFieldAsDoubleUnsafe(
int i)
const
1470 return pauFields[i].Real;
1473 const char *GetFieldAsStringUnsafe(
int i)
const
1475 return pauFields[i].String;
1482 return GetFieldAsInteger(GetFieldIndex(pszFName));
1487 return GetFieldAsInteger64(GetFieldIndex(pszFName));
1492 return GetFieldAsDouble(GetFieldIndex(pszFName));
1497 return GetFieldAsString(GetFieldIndex(pszFName));
1503 return GetFieldAsISO8601DateTime(GetFieldIndex(pszFName), papszOptions);
1508 return GetFieldAsIntegerList(GetFieldIndex(pszFName), pnCount);
1514 return GetFieldAsInteger64List(GetFieldIndex(pszFName), pnCount);
1519 return GetFieldAsDoubleList(GetFieldIndex(pszFName), pnCount);
1524 return GetFieldAsStringList(GetFieldIndex(pszFName));
1527 void SetField(
int i,
int nValue);
1528 void SetField(
int i,
GIntBig nValue);
1529 void SetField(
int i,
double dfValue);
1530 void SetField(
int i,
const char *pszValue);
1531#if defined(DOXYGEN_SKIP) || __cplusplus >= 201703L || \
1532 (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
1533 void SetField(
int i, std::string_view svValue);
1536 inline void SetField(
int i,
const std::string &osValue)
1538 SetField(i, osValue.c_str());
1543 void SetField(
int i,
int nCount,
const int *panValues);
1544 void SetField(
int i,
int nCount,
const GIntBig *panValues);
1545 void SetField(
int i,
int nCount,
const double *padfValues);
1546 void SetField(
int i,
const char *
const *papszValues);
1547 void SetField(
int i,
const OGRField *puValue);
1548 void SetField(
int i,
int nCount,
const void *pabyBinary);
1549 void SetField(
int i,
int nYear,
int nMonth,
int nDay,
int nHour = 0,
1550 int nMinute = 0,
float fSecond = 0.f,
int nTZFlag = 0);
1555 void SetFieldSameTypeUnsafe(
int i,
int nValue)
1557 pauFields[i].Integer = nValue;
1558 pauFields[i].Set.nMarker2 = 0;
1559 pauFields[i].Set.nMarker3 = 0;
1562 void SetFieldSameTypeUnsafe(
int i,
GIntBig nValue)
1564 pauFields[i].Integer64 = nValue;
1567 void SetFieldSameTypeUnsafe(
int i,
double dfValue)
1569 pauFields[i].Real = dfValue;
1572 void SetFieldSameTypeUnsafe(
int i,
char *pszValueTransferred)
1574 pauFields[i].String = pszValueTransferred;
1581 SetField(GetFieldIndex(pszFName), nValue);
1586 SetField(GetFieldIndex(pszFName), nValue);
1591 SetField(GetFieldIndex(pszFName), dfValue);
1594 void SetField(
const char *pszFName,
const char *pszValue)
1596 SetField(GetFieldIndex(pszFName), pszValue);
1599 void SetField(
const char *pszFName,
int nCount,
const int *panValues)
1601 SetField(GetFieldIndex(pszFName), nCount, panValues);
1606 SetField(GetFieldIndex(pszFName), nCount, panValues);
1609 void SetField(
const char *pszFName,
int nCount,
const double *padfValues)
1611 SetField(GetFieldIndex(pszFName), nCount, padfValues);
1614 void SetField(
const char *pszFName,
const char *
const *papszValues)
1616 SetField(GetFieldIndex(pszFName), papszValues);
1621 SetField(GetFieldIndex(pszFName), puValue);
1624 void SetField(
const char *pszFName,
int nYear,
int nMonth,
int nDay,
1625 int nHour = 0,
int nMinute = 0,
float fSecond = 0.f,
1628 SetField(GetFieldIndex(pszFName), nYear, nMonth, nDay, nHour, nMinute,
1639 void DumpReadable(FILE *,
CSLConstList papszOptions =
nullptr)
const;
1640 std::string DumpReadableAsString(
CSLConstList papszOptions =
nullptr)
const;
1643 OGRErr SetFrom(
const OGRFeature *,
const int *panMap,
int bForgiving = TRUE,
1644 bool bUseISO8601ForDateTimeAsString =
false);
1646 int bForgiving = TRUE,
1647 bool bUseISO8601ForDateTimeAsString =
false);
1651 const int *panRemapSource);
1654 const int *panRemapSource);
1657 int Validate(
int nValidateFlags,
int bEmitError)
const;
1658 void FillUnsetWithDefault(
int bNotNullableOnly,
CSLConstList papszOptions);
1660 bool SerializeToBinary(std::vector<GByte> &abyBuffer)
const;
1661 bool DeserializeFromBinary(
const GByte *pabyBuffer,
size_t nSize);
1663 virtual const char *GetStyleString()
const;
1664 virtual void SetStyleString(
const char *);
1665 virtual void SetStyleStringDirectly(
char *);
1672 return m_poStyleTable;
1676 virtual void SetStyleTableDirectly(
OGRStyleTable *poStyleTable);
1680 return m_pszNativeData;
1685 return m_pszNativeMediaType;
1688 void SetNativeData(
const char *pszNativeData);
1689 void SetNativeMediaType(
const char *pszNativeMediaType);
1705 return reinterpret_cast<OGRFeature *
>(hFeature);
1713struct CPL_DLL OGRFeatureUniquePtrDeleter
1722typedef std::unique_ptr<OGRFeature, OGRFeatureUniquePtrDeleter>
1729 return poFeature->
begin();
1735 return poFeature->
end();
1742 return poFeature->begin();
1748 return poFeature->end();
1783 std::string m_osName;
1784 std::string m_osDescription;
1791 OGRFieldDomain(
const std::string &osName,
const std::string &osDescription,
1825 return m_osDescription;
1834 return m_eDomainType;
1843 return m_eFieldType;
1852 return m_eFieldSubType;
1873 return m_eSplitPolicy;
1882 m_eSplitPolicy = policy;
1891 return m_eMergePolicy;
1900 m_eMergePolicy = policy;
1913 std::vector<OGRCodedValue> m_asValues{};
1935 const std::string &osDescription,
1937 std::vector<OGRCodedValue> &&asValues);
1950 return m_asValues.data();
1961 bool m_bMinIsInclusive;
1962 bool m_bMaxIsInclusive;
1996 const std::string &osDescription,
1998 const OGRField &sMin,
bool bMinIsInclusive,
1999 const OGRField &sMax,
bool bMaxIsInclusive);
2018 bIsInclusiveOut = m_bMinIsInclusive;
2037 bIsInclusiveOut = m_bMaxIsInclusive;
2049 std::string m_osGlob;
2066 const std::string &osDescription,
2068 const std::string &osBlob);
2089class swq_custom_func_registrar;
2090struct swq_evaluation_context;
2092class CPL_DLL OGRFeatureQuery
2097 swq_evaluation_context *m_psContext =
nullptr;
2099 char **FieldCollector(
void *,
char **);
2101 static GIntBig *EvaluateAgainstIndices(
const swq_expr_node *,
OGRLayer *,
2104 static int CanUseIndex(
const swq_expr_node *,
OGRLayer *);
2108 swq_custom_func_registrar *poCustomFuncRegistrar);
2116 OGRErr Compile(
const OGRLayer *,
const char *,
int bCheck = TRUE,
2117 swq_custom_func_registrar *poCustomFuncRegistrar =
nullptr);
2119 swq_custom_func_registrar *poCustomFuncRegistrar =
nullptr);
2126 char **GetUsedFields();
Definition of a coded / enumerated field domain.
Definition ogr_feature.h:1911
const OGRCodedValue * GetEnumeration() const
Get the enumeration as (code, value) pairs.
Definition ogr_feature.h:1948
Definition of a feature class or feature layer.
Definition ogr_feature.h:521
int Reference()
Increments the reference count by one.
Definition ogr_feature.h:860
ConstFields GetFields() const
Return an object that can be used to iterate over non-geometry fields.
Definition ogr_feature.h:663
ConstGeomFields GetGeomFields() const
Return an object that can be used to iterate over geometry fields.
Definition ogr_feature.h:824
virtual int GetFieldCount() const
Fetch number of fields on this feature.
Definition ogrfeaturedefn.cpp:268
virtual OGRFieldDefn * GetFieldDefn(int i)
Fetch field definition.
Definition ogrfeaturedefn.cpp:312
NonConstGeomFields GetGeomFields()
Return an object that can be used to iterate over geometry fields.
Definition ogr_feature.h:805
virtual bool IsStyleIgnored() const
Determine whether the style can be omitted when fetching features.
Definition ogr_feature.h:884
int Dereference()
Decrements the reference count by one.
Definition ogr_feature.h:865
static OGRFeatureDefnH ToHandle(OGRFeatureDefn *poFeatureDefn)
Convert a OGRFeatureDefn* to a OGRFeatureDefnH.
Definition ogr_feature.h:908
Fields< OGRFeatureDefn *, OGRFieldDefn * > NonConstFields
Return type of GetFields()
Definition ogr_feature.h:633
static OGRFeatureDefn * FromHandle(OGRFeatureDefnH hFeatureDefn)
Convert a OGRFeatureDefnH to a OGRFeatureDefn*.
Definition ogr_feature.h:915
GeomFields< OGRFeatureDefn *, OGRGeomFieldDefn * > NonConstGeomFields
Return type of GetGeomFields()
Definition ogr_feature.h:793
virtual OGRGeomFieldDefn * GetGeomFieldDefn(int i)
Fetch geometry field definition.
Definition ogrfeaturedefn.cpp:713
Fields< const OGRFeatureDefn *, const OGRFieldDefn * > ConstFields
Return type of GetFields() const.
Definition ogr_feature.h:651
virtual int GetGeomFieldCount() const
Fetch number of geometry fields on this feature.
Definition ogrfeaturedefn.cpp:666
GeomFields< const OGRFeatureDefn *, const OGRGeomFieldDefn * > ConstGeomFields
Return type of GetGeomFields() const.
Definition ogr_feature.h:812
virtual int GetFieldIndex(const char *) const
Find field by name.
Definition ogrfeaturedefn.cpp:1279
int GetReferenceCount() const
Fetch current reference count.
Definition ogr_feature.h:873
virtual int GetGeomFieldIndex(const char *) const
Find geometry field by name.
Definition ogrfeaturedefn.cpp:957
virtual void SetStyleIgnored(bool bIgnore)
Set whether the style can be omitted when fetching features.
Definition ogr_feature.h:889
NonConstFields GetFields()
Return an object that can be used to iterate over non-geometry fields.
Definition ogr_feature.h:645
Field value iterator class.
Definition ogr_feature.h:1277
Exception raised by operator[](const char*) when a field is not found.
Definition ogr_feature.h:1327
Field value.
Definition ogr_feature.h:1067
bool empty() const
Return whether the field value is unset/empty.
Definition ogr_feature.h:1146
int GetInteger() const
Return the integer value.
Definition ogr_feature.h:1166
OGRFieldType GetType() const
Return field type.
Definition ogr_feature.h:1133
void Unset()
Unset the field.
Definition ogr_feature.h:1112
double GetDouble() const
Return the double value.
Definition ogr_feature.h:1184
const char * GetName() const
Return field name.
Definition ogr_feature.h:1127
GIntBig GetInteger64() const
Return the 64-bit integer value.
Definition ogr_feature.h:1175
OGRFieldSubType GetSubType() const
Return field subtype.
Definition ogr_feature.h:1139
const char * GetString() const
Return the string value.
Definition ogr_feature.h:1193
A simple feature, including geometry and attributes.
Definition ogr_feature.h:1041
const char * GetFieldAsISO8601DateTime(const char *pszFName, CSLConstList papszOptions) const
Fetch OFTDateTime field value as a ISO8601 representation.
Definition ogr_feature.h:1500
static OGRFeatureH ToHandle(OGRFeature *poFeature)
Convert a OGRFeature* to a OGRFeatureH.
Definition ogr_feature.h:1696
char ** GetFieldAsStringList(const char *pszFName) const
Fetch field value as a list of strings.
Definition ogr_feature.h:1522
ConstFieldIterator end() const
Return end of field value iterator.
Definition ogrfeature.cpp:8397
ConstFieldIterator begin() const
Return begin of field value iterator.
Definition ogrfeature.cpp:8392
void SetField(const char *pszFName, int nCount, const GIntBig *panValues)
Set field to list of 64 bit integers value.
Definition ogr_feature.h:1604
const OGRFeatureDefn * GetDefnRef() const
Fetch feature definition.
Definition ogr_feature.h:1337
const double * GetFieldAsDoubleList(const char *pszFName, int *pnCount) const
Fetch field value as a list of doubles.
Definition ogr_feature.h:1517
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:1599
void SetField(const char *pszFName, GIntBig nValue)
Set field to 64 bit integer value.
Definition ogr_feature.h:1584
void SetField(const char *pszFName, const char *pszValue)
Set field to string value.
Definition ogr_feature.h:1594
void SetField(const char *pszFName, int nValue)
Set field to integer value.
Definition ogr_feature.h:1579
const OGRFieldDefn * GetFieldDefnRef(int iField) const
Fetch definition for this field.
Definition ogr_feature.h:1387
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:1624
const OGRGeomFieldDefn * GetGeomFieldDefnRef(int iField) const
Fetch definition for this geometry field.
Definition ogr_feature.h:1358
const char * GetNativeData() const
Returns the native data for the feature.
Definition ogr_feature.h:1678
int GetFieldIndex(const char *pszName) const
Fetch the field index given field name.
Definition ogr_feature.h:1392
int GetGeomFieldIndex(const char *pszName) const
Fetch the geometry field index given geometry field name.
Definition ogr_feature.h:1363
GIntBig GetFieldAsInteger64(const char *pszFName) const
Fetch field value as integer 64 bit.
Definition ogr_feature.h:1485
const int * GetFieldAsIntegerList(const char *pszFName, int *pnCount) const
Fetch field value as a list of integers.
Definition ogr_feature.h:1506
void SetField(const char *pszFName, double dfValue)
Set field to double value.
Definition ogr_feature.h:1589
const char * GetFieldAsString(const char *pszFName) const
Fetch field value as a string.
Definition ogr_feature.h:1495
void SetField(const char *pszFName, const char *const *papszValues)
This method currently on has an effect of OFTStringList fields.
Definition ogr_feature.h:1614
const OGRField * GetRawFieldRef(int i) const
Fetch a pointer to the internal field value given the index.
Definition ogr_feature.h:1412
int GetFieldAsInteger(const char *pszFName) const
Fetch field value as integer.
Definition ogr_feature.h:1480
const char * GetNativeMediaType() const
Returns the native media type for the feature.
Definition ogr_feature.h:1683
void SetField(const char *pszFName, const OGRField *puValue)
Set field.
Definition ogr_feature.h:1619
GIntBig GetFID() const
Get feature identifier.
Definition ogr_feature.h:1632
OGRField * GetRawFieldRef(int i)
Fetch a pointer to the internal field value given the index.
Definition ogr_feature.h:1407
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:1609
virtual OGRStyleTable * GetStyleTable() const
Return style table.
Definition ogr_feature.h:1670
double GetFieldAsDouble(const char *pszFName) const
Fetch field value as a double.
Definition ogr_feature.h:1490
static OGRFeature * FromHandle(OGRFeatureH hFeature)
Convert a OGRFeatureH to a OGRFeature*.
Definition ogr_feature.h:1703
const GIntBig * GetFieldAsInteger64List(const char *pszFName, int *pnCount) const
Fetch field value as a list of 64 bit integers.
Definition ogr_feature.h:1511
Definition of an attribute of an OGRFeatureDefn.
Definition ogr_feature.h:72
const char * GetNameRef() const
Fetch name of this field.
Definition ogr_feature.h:111
void Unseal()
Unseal a OGRFieldDefn.
Definition ogrfielddefn.cpp:2297
int IsNullable() const
Return whether this field can receive null values.
Definition ogr_feature.h:189
void Seal()
Seal a OGRFieldDefn.
Definition ogrfielddefn.cpp:2278
int IsUnique() const
Return whether this field has a unique constraint.
Definition ogr_feature.h:196
OGRFieldSubType GetSubType() const
Fetch subtype of this field.
Definition ogr_feature.h:132
bool IsGenerated() const
Return whether the field is a generated field.
Definition ogr_feature.h:209
OGRJustification GetJustify() const
Get the justification for this field.
Definition ogr_feature.h:141
void SetIgnored(int bIgnoreIn)
Set whether this field should be omitted when fetching features.
Definition ogr_feature.h:184
int GetPrecision() const
Get the formatting precision for this field.
Definition ogr_feature.h:158
OGRFieldType GetType() const
Fetch type of this field.
Definition ogr_feature.h:123
int GetWidth() const
Get the formatting width for this field.
Definition ogr_feature.h:151
const std::string & GetComment() const
Return the (optional) comment for this field.
Definition ogr_feature.h:233
int GetTZFlag() const
Get the time zone flag.
Definition ogr_feature.h:165
void SetGenerated(bool bGeneratedIn)
SetGenerated set the field generated status.
Definition ogr_feature.h:219
void SetJustify(OGRJustification eJustifyIn)
Set the justification for this field.
Definition ogr_feature.h:146
const char * GetAlternativeNameRef() const
Fetch the alternative name (or "alias") for this field.
Definition ogr_feature.h:118
static OGRFieldDefnH ToHandle(OGRFieldDefn *poFieldDefn)
Convert a OGRFieldDefn* to a OGRFieldDefnH.
Definition ogr_feature.h:244
const std::string & GetDomainName() const
Return the name of the field domain for this field.
Definition ogr_feature.h:226
int IsIgnored() const
Return whether this field should be omitted when fetching features.
Definition ogr_feature.h:179
static OGRFieldDefn * FromHandle(OGRFieldDefnH hFieldDefn)
Convert a OGRFieldDefnH to a OGRFieldDefn*.
Definition ogr_feature.h:251
Definition of a field domain.
Definition ogr_feature.h:1780
OGRFieldDomainMergePolicy GetMergePolicy() const
Get the merge policy.
Definition ogr_feature.h:1889
void SetMergePolicy(OGRFieldDomainMergePolicy policy)
Set the merge policy.
Definition ogr_feature.h:1898
static OGRFieldDomain * FromHandle(OGRFieldDomainH hFieldDomain)
Convert a OGRFieldDomainH to a OGRFieldDomain*.
Definition ogr_feature.h:1862
virtual OGRFieldDomain * Clone() const =0
Clone.
OGRFieldSubType GetFieldSubType() const
Get the field subtype.
Definition ogr_feature.h:1850
const std::string & GetName() const
Get the name of the field domain.
Definition ogr_feature.h:1813
const std::string & GetDescription() const
Get the description of the field domain.
Definition ogr_feature.h:1823
OGRFieldDomainSplitPolicy GetSplitPolicy() const
Get the split policy.
Definition ogr_feature.h:1871
static OGRFieldDomainH ToHandle(OGRFieldDomain *poFieldDomain)
Convert a OGRFieldDomain* to a OGRFieldDomainH.
Definition ogr_feature.h:1856
OGRFieldType GetFieldType() const
Get the field type.
Definition ogr_feature.h:1841
OGRFieldDomainType GetDomainType() const
Get the type of the field domain.
Definition ogr_feature.h:1832
void SetSplitPolicy(OGRFieldDomainSplitPolicy policy)
Set the split policy.
Definition ogr_feature.h:1880
virtual ~OGRFieldDomain()
Destructor.
Definition of a geometry field of an OGRFeatureDefn.
Definition ogr_feature.h:335
void SetIgnored(int bIgnoreIn)
Set whether this field should be omitted when fetching features.
Definition ogr_feature.h:391
void Seal()
Seal a OGRGeomFieldDefn.
Definition ogrgeomfielddefn.cpp:905
void Unseal()
Unseal a OGRGeomFieldDefn.
Definition ogrgeomfielddefn.cpp:924
static OGRGeomFieldDefn * FromHandle(OGRGeomFieldDefnH hGeomFieldDefn)
Convert a OGRGeomFieldDefnH to a OGRGeomFieldDefn*.
Definition ogr_feature.h:421
int IsNullable() const
Return whether this geometry field can receive null values.
Definition ogr_feature.h:396
OGRwkbGeometryType GetType() const
Fetch geometry type of this field.
Definition ogr_feature.h:375
const OGRGeomCoordinatePrecision & GetCoordinatePrecision() const
Return the coordinate precision associated to this geometry field.
Definition ogr_feature.h:403
int IsIgnored() const
Return whether this field should be omitted when fetching features.
Definition ogr_feature.h:386
static OGRGeomFieldDefnH ToHandle(OGRGeomFieldDefn *poGeomFieldDefn)
Convert a OGRGeomFieldDefn* to a OGRGeomFieldDefnH.
Definition ogr_feature.h:414
const char * GetNameRef() const
Fetch name of this field.
Definition ogr_feature.h:370
Abstract base class for all geometry classes.
Definition ogr_geometry.h:357
Definition of a field domain for field content validated by a glob.
Definition ogr_feature.h:2047
const std::string & GetGlob() const
Get the glob expression.
Definition ogr_feature.h:2076
This class represents a layer of simple features, with access methods.
Definition ogrsf_frmts.h:61
Definition of a numeric field domain with a range of validity for values.
Definition ogr_feature.h:1957
const OGRField & GetMax(bool &bIsInclusiveOut) const
Get the maximum value.
Definition ogr_feature.h:2035
const OGRField & GetMin(bool &bIsInclusiveOut) const
Get the minimum value.
Definition ogr_feature.h:2016
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:1101
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition cpl_port.h:1252
#define CPL_WARN_UNUSED_RESULT
Qualifier to warn when the return value of a function is not used.
Definition cpl_port.h:1035
unsigned char GByte
Unsigned byte type.
Definition cpl_port.h:165
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition cpl_port.h:195
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:863
#define OGR_TZFLAG_UNKNOWN
Time zone flag indicating unknown timezone.
Definition ogr_core.h:876
int OGRBoolean
Type for a OGR boolean.
Definition ogr_core.h:404
OGRFieldSubType
List of field subtypes.
Definition ogr_core.h:817
OGRFieldDomainMergePolicy
Merge policy for field domains.
Definition ogr_core.h:1269
@ OFDMP_DEFAULT_VALUE
Default value.
Definition ogr_core.h:1271
OGRFieldDomainType
Type of field domain.
Definition ogr_core.h:1234
OGRJustification
Display justification for field values.
Definition ogr_core.h:841
OGRFieldType
List of feature field types.
Definition ogr_core.h:790
#define OGRNullMarker
Special value set in OGRField.Set.nMarker1, nMarker2 and nMarker3 for a null field.
Definition ogr_core.h:870
OGRwkbGeometryType
List of well known binary geometry types.
Definition ogr_core.h:423
@ wkbUnknown
unknown type, non-standard
Definition ogr_core.h:424
int OGRErr
Type for a OGR error.
Definition ogr_core.h:388
OGRFieldDomainSplitPolicy
Split policy for field domains.
Definition ogr_core.h:1251
@ OFDSP_DEFAULT_VALUE
Default value.
Definition ogr_core.h:1253
std::unique_ptr< OGRFeature, OGRFeatureUniquePtrDeleter > OGRFeatureUniquePtr
Unique pointer type for OGRFeature.
Definition ogr_feature.h:1723
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:478
OGRLayer::FeatureIterator end(OGRLayer *poLayer)
Return end of feature iterator.
Definition ogrsf_frmts.h:486
Associates a code and a value.
Definition ogr_core.h:1221
Geometry coordinate precision.
Definition ogr_geomcoordinateprecision.h:40
OGRFeature field attribute value union.
Definition ogr_core.h:904