GDAL
ogr_feature.h
Go to the documentation of this file.
1/******************************************************************************
2 * $Id$
3 *
4 * Project: OpenGIS Simple Features Reference Implementation
5 * Purpose: Class for representing a whole feature, and layer schemas.
6 * Author: Frank Warmerdam, warmerdam@pobox.com
7 *
8 ******************************************************************************
9 * Copyright (c) 1999, Les Technologies SoftMap Inc.
10 * Copyright (c) 2008-2013, Even Rouault <even dot rouault at spatialys.com>
11 *
12 * Permission is hereby granted, free of charge, to any person obtaining a
13 * copy of this software and associated documentation files (the "Software"),
14 * to deal in the Software without restriction, including without limitation
15 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16 * and/or sell copies of the Software, and to permit persons to whom the
17 * Software is furnished to do so, subject to the following conditions:
18 *
19 * The above copyright notice and this permission notice shall be included
20 * in all copies or substantial portions of the Software.
21 *
22 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
25 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
28 * DEALINGS IN THE SOFTWARE.
29 ****************************************************************************/
30
31#ifndef OGR_FEATURE_H_INCLUDED
32#define OGR_FEATURE_H_INCLUDED
33
34#include "cpl_atomic_ops.h"
35#include "ogr_featurestyle.h"
36#include "ogr_geometry.h"
37
38#include <cstddef>
39
40#include <exception>
41#include <memory>
42#include <string>
43#include <vector>
44
51#ifndef DEFINE_OGRFeatureH
53#define DEFINE_OGRFeatureH
55#ifdef DEBUG
56typedef struct OGRFieldDefnHS *OGRFieldDefnH;
57typedef struct OGRFeatureDefnHS *OGRFeatureDefnH;
58typedef struct OGRFeatureHS *OGRFeatureH;
59typedef struct OGRStyleTableHS *OGRStyleTableH;
60#else
62typedef void *OGRFieldDefnH;
64typedef void *OGRFeatureDefnH;
66typedef void *OGRFeatureH;
68typedef void *OGRStyleTableH;
69#endif
71typedef struct OGRGeomFieldDefnHS *OGRGeomFieldDefnH;
72
74typedef struct OGRFieldDomainHS *OGRFieldDomainH;
75#endif /* DEFINE_OGRFeatureH */
76
77class OGRStyleTable;
78
79/************************************************************************/
80/* OGRFieldDefn */
81/************************************************************************/
82
103class CPL_DLL OGRFieldDefn
104{
105 private:
106 char *pszName;
107 char *pszAlternativeName;
108 OGRFieldType eType;
109 OGRJustification eJustify;
110 int nWidth; // Zero is variable.
111 int nPrecision;
112 char *pszDefault;
113
114 int bIgnore;
115 OGRFieldSubType eSubType;
116
117 int bNullable;
118 int bUnique;
119
120 std::string m_osDomainName{}; // field domain name. Might be empty
121
122 public:
123 OGRFieldDefn(const char *, OGRFieldType);
124 explicit OGRFieldDefn(const OGRFieldDefn *);
126
127 void SetName(const char *);
128 const char *GetNameRef() const
129 {
130 return pszName;
131 }
132
133 void SetAlternativeName(const char *);
134 const char *GetAlternativeNameRef() const
135 {
136 return pszAlternativeName;
137 }
138
140 {
141 return eType;
142 }
143 void SetType(OGRFieldType eTypeIn);
144 static const char *GetFieldTypeName(OGRFieldType);
145
147 {
148 return eSubType;
149 }
150 void SetSubType(OGRFieldSubType eSubTypeIn);
151 static const char *GetFieldSubTypeName(OGRFieldSubType);
152
154 {
155 return eJustify;
156 }
158 {
159 eJustify = eJustifyIn;
160 }
161
162 int GetWidth() const
163 {
164 return nWidth;
165 }
166 void SetWidth(int nWidthIn)
167 {
168 nWidth = MAX(0, nWidthIn);
169 }
170
171 int GetPrecision() const
172 {
173 return nPrecision;
174 }
175 void SetPrecision(int nPrecisionIn)
176 {
177 nPrecision = nPrecisionIn;
178 }
179
180 void Set(const char *, OGRFieldType, int = 0, int = 0,
181 OGRJustification = OJUndefined);
182
183 void SetDefault(const char *);
184 const char *GetDefault() const;
185 int IsDefaultDriverSpecific() const;
186
187 int IsIgnored() const
188 {
189 return bIgnore;
190 }
191 void SetIgnored(int bIgnoreIn)
192 {
193 bIgnore = bIgnoreIn;
194 }
195
196 int IsNullable() const
197 {
198 return bNullable;
199 }
200 void SetNullable(int bNullableIn)
201 {
202 bNullable = bNullableIn;
203 }
204
205 int IsUnique() const
206 {
207 return bUnique;
208 }
209 void SetUnique(int bUniqueIn)
210 {
211 bUnique = bUniqueIn;
212 }
213
214 const std::string &GetDomainName() const
215 {
216 return m_osDomainName;
217 }
218 void SetDomainName(const std::string &osDomainName)
219 {
220 m_osDomainName = osDomainName;
221 }
222
223 int IsSame(const OGRFieldDefn *) const;
224
228 static inline OGRFieldDefnH ToHandle(OGRFieldDefn *poFieldDefn)
229 {
230 return reinterpret_cast<OGRFieldDefnH>(poFieldDefn);
231 }
232
236 static inline OGRFieldDefn *FromHandle(OGRFieldDefnH hFieldDefn)
237 {
238 return reinterpret_cast<OGRFieldDefn *>(hFieldDefn);
239 }
240
241 private:
243};
244
245/************************************************************************/
246/* OGRGeomFieldDefn */
247/************************************************************************/
248
264class CPL_DLL OGRGeomFieldDefn
265{
266 protected:
268 char *pszName = nullptr;
269 OGRwkbGeometryType eGeomType =
270 wkbUnknown; /* all values possible except wkbNone */
271 mutable OGRSpatialReference *poSRS = nullptr;
272
273 int bIgnore = false;
274 mutable int bNullable = true;
275
276 void Initialize(const char *, OGRwkbGeometryType);
278
279 public:
280 OGRGeomFieldDefn(const char *pszNameIn, OGRwkbGeometryType eGeomTypeIn);
281 explicit OGRGeomFieldDefn(const OGRGeomFieldDefn *);
282 virtual ~OGRGeomFieldDefn();
283
284 void SetName(const char *);
285 const char *GetNameRef() const
286 {
287 return pszName;
288 }
289
291 {
292 return eGeomType;
293 }
294 void SetType(OGRwkbGeometryType eTypeIn);
295
296 virtual OGRSpatialReference *GetSpatialRef() const;
297 void SetSpatialRef(OGRSpatialReference *poSRSIn);
298
299 int IsIgnored() const
300 {
301 return bIgnore;
302 }
303 void SetIgnored(int bIgnoreIn)
304 {
305 bIgnore = bIgnoreIn;
306 }
307
308 int IsNullable() const
309 {
310 return bNullable;
311 }
312 void SetNullable(int bNullableIn)
313 {
314 bNullable = bNullableIn;
315 }
316
317 int IsSame(const OGRGeomFieldDefn *) const;
318
322 static inline OGRGeomFieldDefnH ToHandle(OGRGeomFieldDefn *poGeomFieldDefn)
323 {
324 return reinterpret_cast<OGRGeomFieldDefnH>(poGeomFieldDefn);
325 }
326
330 static inline OGRGeomFieldDefn *FromHandle(OGRGeomFieldDefnH hGeomFieldDefn)
331 {
332 return reinterpret_cast<OGRGeomFieldDefn *>(hGeomFieldDefn);
333 }
334
335 private:
337};
338
339/************************************************************************/
340/* OGRFeatureDefn */
341/************************************************************************/
342
363class CPL_DLL OGRFeatureDefn
364{
365 protected:
367 volatile int nRefCount = 0;
368
369 mutable std::vector<std::unique_ptr<OGRFieldDefn>> apoFieldDefn{};
370 mutable std::vector<std::unique_ptr<OGRGeomFieldDefn>> apoGeomFieldDefn{};
371
372 char *pszFeatureClassName = nullptr;
373
374 bool bIgnoreStyle = false;
376
377 public:
378 explicit OGRFeatureDefn(const char *pszName = nullptr);
379 virtual ~OGRFeatureDefn();
380
381 void SetName(const char *pszName);
382 virtual const char *GetName() const;
383
384 virtual int GetFieldCount() const;
385 virtual OGRFieldDefn *GetFieldDefn(int i);
386 virtual const OGRFieldDefn *GetFieldDefn(int i) const;
387 virtual int GetFieldIndex(const char *) const;
388 int GetFieldIndexCaseSensitive(const char *) const;
389
391 // That method should only be called if there's a guarantee that
392 // GetFieldCount() has been called before
393 int GetFieldCountUnsafe() const
394 {
395 return static_cast<int>(apoFieldDefn.size());
396 }
397
398 // Those methods don't check i is n range.
399 OGRFieldDefn *GetFieldDefnUnsafe(int i)
400 {
401 if (apoFieldDefn.empty())
402 GetFieldDefn(i);
403 return apoFieldDefn[static_cast<std::size_t>(i)].get();
404 }
405 const OGRFieldDefn *GetFieldDefnUnsafe(int i) const
406 {
407 if (apoFieldDefn.empty())
408 GetFieldDefn(i);
409 return apoFieldDefn[static_cast<std::size_t>(i)].get();
410 }
412
413 virtual void AddFieldDefn(const OGRFieldDefn *);
414 virtual OGRErr DeleteFieldDefn(int iField);
415 virtual OGRErr ReorderFieldDefns(const int *panMap);
416
417 virtual int GetGeomFieldCount() const;
418 virtual OGRGeomFieldDefn *GetGeomFieldDefn(int i);
419 virtual const OGRGeomFieldDefn *GetGeomFieldDefn(int i) const;
420 virtual int GetGeomFieldIndex(const char *) const;
421
422 virtual void AddGeomFieldDefn(const OGRGeomFieldDefn *);
423 virtual void AddGeomFieldDefn(std::unique_ptr<OGRGeomFieldDefn> &&);
424 virtual OGRErr DeleteGeomFieldDefn(int iGeomField);
425
426 virtual OGRwkbGeometryType GetGeomType() const;
427 virtual void SetGeomType(OGRwkbGeometryType);
428
429 virtual OGRFeatureDefn *Clone() const;
430
432 {
433 return CPLAtomicInc(&nRefCount);
434 }
436 {
437 return CPLAtomicDec(&nRefCount);
438 }
440 {
441 return nRefCount;
442 }
443 void Release();
444
445 virtual int IsGeometryIgnored() const;
446 virtual void SetGeometryIgnored(int bIgnore);
447 virtual bool IsStyleIgnored() const
448 {
449 return bIgnoreStyle;
450 }
451 virtual void SetStyleIgnored(bool bIgnore)
452 {
453 bIgnoreStyle = bIgnore;
454 }
455
456 virtual int IsSame(const OGRFeatureDefn *poOtherFeatureDefn) const;
457
459 void ReserveSpaceForFields(int nFieldCountIn);
461
462 std::vector<int> ComputeMapForSetFrom(const OGRFeatureDefn *poSrcFDefn,
463 bool bForgiving = true) const;
464
465 static OGRFeatureDefn *CreateFeatureDefn(const char *pszName = nullptr);
466 static void DestroyFeatureDefn(OGRFeatureDefn *);
467
471 static inline OGRFeatureDefnH ToHandle(OGRFeatureDefn *poFeatureDefn)
472 {
473 return reinterpret_cast<OGRFeatureDefnH>(poFeatureDefn);
474 }
475
479 static inline OGRFeatureDefn *FromHandle(OGRFeatureDefnH hFeatureDefn)
480 {
481 return reinterpret_cast<OGRFeatureDefn *>(hFeatureDefn);
482 }
483
484 private:
486};
487
488/************************************************************************/
489/* OGRFeature */
490/************************************************************************/
491
496class CPL_DLL OGRFeature
497{
498 private:
499 GIntBig nFID;
500 OGRFeatureDefn *poDefn;
501 OGRGeometry **papoGeometries;
502 OGRField *pauFields;
503 char *m_pszNativeData;
504 char *m_pszNativeMediaType;
505
506 bool SetFieldInternal(int i, const OGRField *puValue);
507
508 protected:
510 mutable char *m_pszStyleString;
511 mutable OGRStyleTable *m_poStyleTable;
512 mutable char *m_pszTmpFieldValue;
514
515 bool CopySelfTo(OGRFeature *poNew) const;
516
517 public:
518 explicit OGRFeature(OGRFeatureDefn *);
519 virtual ~OGRFeature();
520
522 class CPL_DLL FieldValue
523 {
524 friend class OGRFeature;
525 struct Private;
526 std::unique_ptr<Private> m_poPrivate;
527
528 FieldValue(OGRFeature *poFeature, int iFieldIndex);
529 FieldValue(const OGRFeature *poFeature, int iFieldIndex);
530 FieldValue(const FieldValue &oOther) = delete;
531 FieldValue &Assign(const FieldValue &oOther);
532
533 public:
535 ~FieldValue();
536
537 FieldValue &operator=(FieldValue &&oOther);
539
541 FieldValue &operator=(const FieldValue &oOther);
543 FieldValue &operator=(int nVal);
545 FieldValue &operator=(GIntBig nVal);
547 FieldValue &operator=(double dfVal);
549 FieldValue &operator=(const char *pszVal);
551 FieldValue &operator=(const std::string &osVal);
553 FieldValue &operator=(const std::vector<int> &oArray);
555 FieldValue &operator=(const std::vector<GIntBig> &oArray);
557 FieldValue &operator=(const std::vector<double> &oArray);
559 FieldValue &operator=(const std::vector<std::string> &oArray);
561 FieldValue &operator=(CSLConstList papszValues);
563 void SetNull();
565 void clear();
567 void Unset()
568 {
569 clear();
570 }
572 void SetDateTime(int nYear, int nMonth, int nDay, int nHour = 0,
573 int nMinute = 0, float fSecond = 0.f, int nTZFlag = 0);
574
576 int GetIndex() const;
578 const OGRFieldDefn *GetDefn() const;
580 const char *GetName() const
581 {
582 return GetDefn()->GetNameRef();
583 }
586 {
587 return GetDefn()->GetType();
588 }
591 {
592 return GetDefn()->GetSubType();
593 }
594
596 // cppcheck-suppress functionStatic
597 bool empty() const
598 {
599 return IsUnset();
600 }
601
603 // cppcheck-suppress functionStatic
604 bool IsUnset() const;
605
607 // cppcheck-suppress functionStatic
608 bool IsNull() const;
609
611 const OGRField *GetRawValue() const;
612
616 // cppcheck-suppress functionStatic
617 int GetInteger() const
618 {
619 return GetRawValue()->Integer;
620 }
621
625 // cppcheck-suppress functionStatic
627 {
628 return GetRawValue()->Integer64;
629 }
630
634 // cppcheck-suppress functionStatic
635 double GetDouble() const
636 {
637 return GetRawValue()->Real;
638 }
639
643 // cppcheck-suppress functionStatic
644 const char *GetString() const
645 {
646 return GetRawValue()->String;
647 }
648
650 bool GetDateTime(int *pnYear, int *pnMonth, int *pnDay, int *pnHour,
651 int *pnMinute, float *pfSecond, int *pnTZFlag) const;
652
654 operator int() const
655 {
656 return GetAsInteger();
657 }
660 operator GIntBig() const
661 {
662 return GetAsInteger64();
663 }
665 operator double() const
666 {
667 return GetAsDouble();
668 }
670 operator const char *() const
671 {
672 return GetAsString();
673 }
675 operator const std::vector<int> &() const
676 {
677 return GetAsIntegerList();
678 }
681 operator const std::vector<GIntBig> &() const
682 {
683 return GetAsInteger64List();
684 }
686 operator const std::vector<double> &() const
687 {
688 return GetAsDoubleList();
689 }
691 operator const std::vector<std::string> &() const
692 {
693 return GetAsStringList();
694 }
696 operator CSLConstList() const;
697
699 int GetAsInteger() const;
702 GIntBig GetAsInteger64() const;
704 double GetAsDouble() const;
706 const char *GetAsString() const;
708 const std::vector<int> &GetAsIntegerList() const;
711 const std::vector<GIntBig> &GetAsInteger64List() const;
713 const std::vector<double> &GetAsDoubleList() const;
715 const std::vector<std::string> &GetAsStringList() const;
716 };
717
719 class CPL_DLL ConstFieldIterator
720 {
721 friend class OGRFeature;
722 struct Private;
723 std::unique_ptr<Private> m_poPrivate;
724
725 ConstFieldIterator(const OGRFeature *poSelf, int nPos);
726
727 public:
730 ConstFieldIterator &&oOther) noexcept; // declared but not defined.
731 // Needed for gcc 5.4 at least
733 const FieldValue &operator*() const;
734 ConstFieldIterator &operator++();
735 bool operator!=(const ConstFieldIterator &it) const;
737 };
738
758 ConstFieldIterator end() const;
759
760 const FieldValue operator[](int iField) const;
761 FieldValue operator[](int iField);
762
765 class FieldNotFoundException : public std::exception
766 {
767 };
768
769 const FieldValue operator[](const char *pszFieldName) const;
770 FieldValue operator[](const char *pszFieldName);
771
773 {
774 return poDefn;
775 }
777 {
778 return poDefn;
779 }
780
782 void SetFDefnUnsafe(OGRFeatureDefn *poNewFDefn);
784
785 OGRErr SetGeometryDirectly(OGRGeometry *);
786 OGRErr SetGeometry(const OGRGeometry *);
787 OGRGeometry *GetGeometryRef();
788 const OGRGeometry *GetGeometryRef() const;
789 OGRGeometry *StealGeometry() CPL_WARN_UNUSED_RESULT;
790
791 int GetGeomFieldCount() const
792 {
793 return poDefn->GetGeomFieldCount();
794 }
796 {
797 return poDefn->GetGeomFieldDefn(iField);
798 }
799 const OGRGeomFieldDefn *GetGeomFieldDefnRef(int iField) const
800 {
801 return poDefn->GetGeomFieldDefn(iField);
802 }
803 int GetGeomFieldIndex(const char *pszName) const
804 {
805 return poDefn->GetGeomFieldIndex(pszName);
806 }
807
808 OGRGeometry *GetGeomFieldRef(int iField);
809 const OGRGeometry *GetGeomFieldRef(int iField) const;
810 OGRGeometry *StealGeometry(int iField);
811 OGRGeometry *GetGeomFieldRef(const char *pszFName);
812 const OGRGeometry *GetGeomFieldRef(const char *pszFName) const;
813 OGRErr SetGeomFieldDirectly(int iField, OGRGeometry *);
814 OGRErr SetGeomField(int iField, const OGRGeometry *);
815
816 void Reset();
817
818 OGRFeature *Clone() const CPL_WARN_UNUSED_RESULT;
819 virtual OGRBoolean Equal(const OGRFeature *poFeature) const;
820
821 int GetFieldCount() const
822 {
823 return poDefn->GetFieldCount();
824 }
825 const OGRFieldDefn *GetFieldDefnRef(int iField) const
826 {
827 return poDefn->GetFieldDefn(iField);
828 }
830 {
831 return poDefn->GetFieldDefn(iField);
832 }
833 int GetFieldIndex(const char *pszName) const
834 {
835 return poDefn->GetFieldIndex(pszName);
836 }
837
838 int IsFieldSet(int iField) const;
839
840 void UnsetField(int iField);
841
842 bool IsFieldNull(int iField) const;
843
844 void SetFieldNull(int iField);
845
846 bool IsFieldSetAndNotNull(int iField) const;
847
849 {
850 return pauFields + i;
851 }
852 const OGRField *GetRawFieldRef(int i) const
853 {
854 return pauFields + i;
855 }
856
857 int GetFieldAsInteger(int i) const;
858 GIntBig GetFieldAsInteger64(int i) const;
859 double GetFieldAsDouble(int i) const;
860 const char *GetFieldAsString(int i) const;
861 const int *GetFieldAsIntegerList(int i, int *pnCount) const;
862 const GIntBig *GetFieldAsInteger64List(int i, int *pnCount) const;
863 const double *GetFieldAsDoubleList(int i, int *pnCount) const;
864 char **GetFieldAsStringList(int i) const;
865 GByte *GetFieldAsBinary(int i, int *pnCount) const;
866 int GetFieldAsDateTime(int i, int *pnYear, int *pnMonth, int *pnDay,
867 int *pnHour, int *pnMinute, int *pnSecond,
868 int *pnTZFlag) const;
869 int GetFieldAsDateTime(int i, int *pnYear, int *pnMonth, int *pnDay,
870 int *pnHour, int *pnMinute, float *pfSecond,
871 int *pnTZFlag) const;
872 char *GetFieldAsSerializedJSon(int i) const;
873
875 bool IsFieldSetUnsafe(int i) const
876 {
877 return !(pauFields[i].Set.nMarker1 == OGRUnsetMarker &&
878 pauFields[i].Set.nMarker2 == OGRUnsetMarker &&
879 pauFields[i].Set.nMarker3 == OGRUnsetMarker);
880 }
881 bool IsFieldNullUnsafe(int i) const
882 {
883 return (pauFields[i].Set.nMarker1 == OGRNullMarker &&
884 pauFields[i].Set.nMarker2 == OGRNullMarker &&
885 pauFields[i].Set.nMarker3 == OGRNullMarker);
886 }
887 bool IsFieldSetAndNotNullUnsafe(int i) const
888 {
889 return IsFieldSetUnsafe(i) && !IsFieldNullUnsafe(i);
890 }
891 // Those methods should only be called on a field that is of the type
892 // consistent with the value, and that is set.
893 int GetFieldAsIntegerUnsafe(int i) const
894 {
895 return pauFields[i].Integer;
896 }
897 GIntBig GetFieldAsInteger64Unsafe(int i) const
898 {
899 return pauFields[i].Integer64;
900 }
901 double GetFieldAsDoubleUnsafe(int i) const
902 {
903 return pauFields[i].Real;
904 }
905 const char *GetFieldAsStringUnsafe(int i) const
906 {
907 return pauFields[i].String;
908 }
910
911 int GetFieldAsInteger(const char *pszFName) const
912 {
913 return GetFieldAsInteger(GetFieldIndex(pszFName));
914 }
915 GIntBig GetFieldAsInteger64(const char *pszFName) const
916 {
917 return GetFieldAsInteger64(GetFieldIndex(pszFName));
918 }
919 double GetFieldAsDouble(const char *pszFName) const
920 {
921 return GetFieldAsDouble(GetFieldIndex(pszFName));
922 }
923 const char *GetFieldAsString(const char *pszFName) const
924 {
925 return GetFieldAsString(GetFieldIndex(pszFName));
926 }
927 const int *GetFieldAsIntegerList(const char *pszFName, int *pnCount) const
928 {
929 return GetFieldAsIntegerList(GetFieldIndex(pszFName), pnCount);
930 }
931 const GIntBig *GetFieldAsInteger64List(const char *pszFName,
932 int *pnCount) const
933 {
934 return GetFieldAsInteger64List(GetFieldIndex(pszFName), pnCount);
935 }
936 const double *GetFieldAsDoubleList(const char *pszFName, int *pnCount) const
937 {
938 return GetFieldAsDoubleList(GetFieldIndex(pszFName), pnCount);
939 }
940 char **GetFieldAsStringList(const char *pszFName) const
941 {
942 return GetFieldAsStringList(GetFieldIndex(pszFName));
943 }
944
945 void SetField(int i, int nValue);
946 void SetField(int i, GIntBig nValue);
947 void SetField(int i, double dfValue);
948 void SetField(int i, const char *pszValue);
949 void SetField(int i, int nCount, const int *panValues);
950 void SetField(int i, int nCount, const GIntBig *panValues);
951 void SetField(int i, int nCount, const double *padfValues);
952 void SetField(int i, const char *const *papszValues);
953 void SetField(int i, const OGRField *puValue);
954 void SetField(int i, int nCount, const void *pabyBinary);
955 void SetField(int i, int nYear, int nMonth, int nDay, int nHour = 0,
956 int nMinute = 0, float fSecond = 0.f, int nTZFlag = 0);
957
959 // Those methods should only be called on a field that is of the type
960 // consistent with the value, and in a unset state.
961 void SetFieldSameTypeUnsafe(int i, int nValue)
962 {
963 pauFields[i].Integer = nValue;
964 pauFields[i].Set.nMarker2 = 0;
965 pauFields[i].Set.nMarker3 = 0;
966 }
967 void SetFieldSameTypeUnsafe(int i, GIntBig nValue)
968 {
969 pauFields[i].Integer64 = nValue;
970 }
971 void SetFieldSameTypeUnsafe(int i, double dfValue)
972 {
973 pauFields[i].Real = dfValue;
974 }
975 void SetFieldSameTypeUnsafe(int i, char *pszValueTransferred)
976 {
977 pauFields[i].String = pszValueTransferred;
978 }
980
981 void SetField(const char *pszFName, int nValue)
982 {
983 SetField(GetFieldIndex(pszFName), nValue);
984 }
985 void SetField(const char *pszFName, GIntBig nValue)
986 {
987 SetField(GetFieldIndex(pszFName), nValue);
988 }
989 void SetField(const char *pszFName, double dfValue)
990 {
991 SetField(GetFieldIndex(pszFName), dfValue);
992 }
993 void SetField(const char *pszFName, const char *pszValue)
994 {
995 SetField(GetFieldIndex(pszFName), pszValue);
996 }
997 void SetField(const char *pszFName, int nCount, const int *panValues)
998 {
999 SetField(GetFieldIndex(pszFName), nCount, panValues);
1000 }
1001 void SetField(const char *pszFName, int nCount, const GIntBig *panValues)
1002 {
1003 SetField(GetFieldIndex(pszFName), nCount, panValues);
1004 }
1005 void SetField(const char *pszFName, int nCount, const double *padfValues)
1006 {
1007 SetField(GetFieldIndex(pszFName), nCount, padfValues);
1008 }
1009 void SetField(const char *pszFName, const char *const *papszValues)
1010 {
1011 SetField(GetFieldIndex(pszFName), papszValues);
1012 }
1013 void SetField(const char *pszFName, const OGRField *puValue)
1014 {
1015 SetField(GetFieldIndex(pszFName), puValue);
1016 }
1017 void SetField(const char *pszFName, int nYear, int nMonth, int nDay,
1018 int nHour = 0, int nMinute = 0, float fSecond = 0.f,
1019 int nTZFlag = 0)
1020 {
1021 SetField(GetFieldIndex(pszFName), nYear, nMonth, nDay, nHour, nMinute,
1022 fSecond, nTZFlag);
1023 }
1024
1026 {
1027 return nFID;
1028 }
1029 virtual OGRErr SetFID(GIntBig nFIDIn);
1030
1031 void DumpReadable(FILE *, char **papszOptions = nullptr) const;
1032
1033 OGRErr SetFrom(const OGRFeature *, int = TRUE);
1034 OGRErr SetFrom(const OGRFeature *, const int *, int = TRUE);
1035 OGRErr SetFieldsFrom(const OGRFeature *, const int *, int = TRUE);
1036
1038 OGRErr RemapFields(OGRFeatureDefn *poNewDefn, const int *panRemapSource);
1039 void AppendField();
1040 OGRErr RemapGeomFields(OGRFeatureDefn *poNewDefn,
1041 const int *panRemapSource);
1043
1044 int Validate(int nValidateFlags, int bEmitError) const;
1045 void FillUnsetWithDefault(int bNotNullableOnly, char **papszOptions);
1046
1047 virtual const char *GetStyleString() const;
1048 virtual void SetStyleString(const char *);
1049 virtual void SetStyleStringDirectly(char *);
1050
1055 {
1056 return m_poStyleTable;
1057 } /* f.i.x.m.e: add a const qualifier for return type */
1058 virtual void SetStyleTable(OGRStyleTable *poStyleTable);
1059 virtual void SetStyleTableDirectly(OGRStyleTable *poStyleTable);
1060
1061 const char *GetNativeData() const
1062 {
1063 return m_pszNativeData;
1064 }
1065 const char *GetNativeMediaType() const
1066 {
1067 return m_pszNativeMediaType;
1068 }
1069 void SetNativeData(const char *pszNativeData);
1070 void SetNativeMediaType(const char *pszNativeMediaType);
1071
1072 static OGRFeature *CreateFeature(OGRFeatureDefn *);
1073 static void DestroyFeature(OGRFeature *);
1074
1078 static inline OGRFeatureH ToHandle(OGRFeature *poFeature)
1079 {
1080 return reinterpret_cast<OGRFeatureH>(poFeature);
1081 }
1082
1086 static inline OGRFeature *FromHandle(OGRFeatureH hFeature)
1087 {
1088 return reinterpret_cast<OGRFeature *>(hFeature);
1089 }
1090
1091 private:
1093};
1094
1096struct CPL_DLL OGRFeatureUniquePtrDeleter
1097{
1098 void operator()(OGRFeature *) const;
1099};
1101
1105typedef std::unique_ptr<OGRFeature, OGRFeatureUniquePtrDeleter>
1107
1109
1110inline OGRFeature::ConstFieldIterator begin(const OGRFeature *poFeature)
1111{
1112 return poFeature->begin();
1113}
1115inline OGRFeature::ConstFieldIterator end(const OGRFeature *poFeature)
1116{
1117 return poFeature->end();
1118}
1119
1122begin(const OGRFeatureUniquePtr &poFeature)
1123{
1124 return poFeature->begin();
1125}
1128{
1129 return poFeature->end();
1130}
1131
1133
1134/************************************************************************/
1135/* OGRFieldDomain */
1136/************************************************************************/
1137
1138/* clang-format off */
1158/* clang-format on */
1159
1160class CPL_DLL OGRFieldDomain
1161{
1162 protected:
1164 std::string m_osName;
1165 std::string m_osDescription;
1166 OGRFieldDomainType m_eDomainType;
1167 OGRFieldType m_eFieldType;
1168 OGRFieldSubType m_eFieldSubType;
1171
1172 OGRFieldDomain(const std::string &osName, const std::string &osDescription,
1173 OGRFieldDomainType eDomainType, OGRFieldType eFieldType,
1174 OGRFieldSubType eFieldSubType);
1177 public:
1182 virtual ~OGRFieldDomain() = 0;
1183
1188 virtual OGRFieldDomain *Clone() const = 0;
1189
1194 const std::string &GetName() const
1195 {
1196 return m_osName;
1197 }
1198
1204 const std::string &GetDescription() const
1205 {
1206 return m_osDescription;
1207 }
1208
1214 {
1215 return m_eDomainType;
1216 }
1217
1223 {
1224 return m_eFieldType;
1225 }
1226
1232 {
1233 return m_eFieldSubType;
1234 }
1235
1237 static inline OGRFieldDomainH ToHandle(OGRFieldDomain *poFieldDomain)
1238 {
1239 return reinterpret_cast<OGRFieldDomainH>(poFieldDomain);
1240 }
1241
1243 static inline OGRFieldDomain *FromHandle(OGRFieldDomainH hFieldDomain)
1244 {
1245 return reinterpret_cast<OGRFieldDomain *>(hFieldDomain);
1246 }
1247
1253 {
1254 return m_eSplitPolicy;
1255 }
1256
1262 {
1263 m_eSplitPolicy = policy;
1264 }
1265
1271 {
1272 return m_eMergePolicy;
1273 }
1274
1280 {
1281 m_eMergePolicy = policy;
1282 }
1283};
1284
1291class CPL_DLL OGRCodedFieldDomain final : public OGRFieldDomain
1292{
1293 private:
1294 std::vector<OGRCodedValue> m_asValues{};
1295
1296 OGRCodedFieldDomain(const OGRCodedFieldDomain &) = delete;
1297 OGRCodedFieldDomain &operator=(const OGRCodedFieldDomain &) = delete;
1298
1299 public:
1315 OGRCodedFieldDomain(const std::string &osName,
1316 const std::string &osDescription,
1317 OGRFieldType eFieldType, OGRFieldSubType eFieldSubType,
1318 std::vector<OGRCodedValue> &&asValues);
1319
1320 ~OGRCodedFieldDomain() override;
1321
1322 OGRCodedFieldDomain *Clone() const override;
1323
1330 {
1331 return m_asValues.data();
1332 }
1333};
1334
1337class CPL_DLL OGRRangeFieldDomain final : public OGRFieldDomain
1338{
1339 private:
1340 OGRField m_sMin;
1341 OGRField m_sMax;
1342 bool m_bMinIsInclusive;
1343 bool m_bMaxIsInclusive;
1344
1345 OGRRangeFieldDomain(const OGRRangeFieldDomain &) = delete;
1346 OGRRangeFieldDomain &operator=(const OGRRangeFieldDomain &) = delete;
1347
1348 public:
1376 OGRRangeFieldDomain(const std::string &osName,
1377 const std::string &osDescription,
1378 OGRFieldType eFieldType, OGRFieldSubType eFieldSubType,
1379 const OGRField &sMin, bool bMinIsInclusive,
1380 const OGRField &sMax, bool bMaxIsInclusive);
1381
1382 OGRRangeFieldDomain *Clone() const override
1383 {
1384 auto poDomain = new OGRRangeFieldDomain(
1385 m_osName, m_osDescription, m_eFieldType, m_eFieldSubType, m_sMin,
1386 m_bMinIsInclusive, m_sMax, m_bMaxIsInclusive);
1387 poDomain->SetMergePolicy(m_eMergePolicy);
1388 poDomain->SetSplitPolicy(m_eSplitPolicy);
1389 return poDomain;
1390 }
1391
1405 const OGRField &GetMin(bool &bIsInclusiveOut) const
1406 {
1407 bIsInclusiveOut = m_bMinIsInclusive;
1408 return m_sMin;
1409 }
1410
1424 const OGRField &GetMax(bool &bIsInclusiveOut) const
1425 {
1426 bIsInclusiveOut = m_bMaxIsInclusive;
1427 return m_sMax;
1428 }
1429};
1430
1435class CPL_DLL OGRGlobFieldDomain final : public OGRFieldDomain
1436{
1437 private:
1438 std::string m_osGlob;
1439
1440 OGRGlobFieldDomain(const OGRGlobFieldDomain &) = delete;
1441 OGRGlobFieldDomain &operator=(const OGRGlobFieldDomain &) = delete;
1442
1443 public:
1454 OGRGlobFieldDomain(const std::string &osName,
1455 const std::string &osDescription,
1456 OGRFieldType eFieldType, OGRFieldSubType eFieldSubType,
1457 const std::string &osBlob);
1458
1459 OGRGlobFieldDomain *Clone() const override
1460 {
1461 auto poDomain = new OGRGlobFieldDomain(
1462 m_osName, m_osDescription, m_eFieldType, m_eFieldSubType, m_osGlob);
1463 poDomain->SetMergePolicy(m_eMergePolicy);
1464 poDomain->SetSplitPolicy(m_eSplitPolicy);
1465 return poDomain;
1466 }
1467
1472 const std::string &GetGlob() const
1473 {
1474 return m_osGlob;
1475 }
1476};
1477
1478/************************************************************************/
1479/* OGRFeatureQuery */
1480/************************************************************************/
1481
1483class OGRLayer;
1484class swq_expr_node;
1485class swq_custom_func_registrar;
1486
1487class CPL_DLL OGRFeatureQuery
1488{
1489 private:
1490 OGRFeatureDefn *poTargetDefn;
1491 void *pSWQExpr;
1492
1493 char **FieldCollector(void *, char **);
1494
1495 GIntBig *EvaluateAgainstIndices(swq_expr_node *, OGRLayer *,
1496 GIntBig &nFIDCount);
1497
1498 int CanUseIndex(swq_expr_node *, OGRLayer *);
1499
1500 OGRErr Compile(OGRLayer *, OGRFeatureDefn *, const char *, int bCheck,
1501 swq_custom_func_registrar *poCustomFuncRegistrar);
1502
1503 CPL_DISALLOW_COPY_ASSIGN(OGRFeatureQuery)
1504
1505 public:
1506 OGRFeatureQuery();
1507 ~OGRFeatureQuery();
1508
1509 OGRErr Compile(OGRLayer *, const char *, int bCheck = TRUE,
1510 swq_custom_func_registrar *poCustomFuncRegistrar = nullptr);
1511 OGRErr Compile(OGRFeatureDefn *, const char *, int bCheck = TRUE,
1512 swq_custom_func_registrar *poCustomFuncRegistrar = nullptr);
1513 int Evaluate(OGRFeature *);
1514
1515 GIntBig *EvaluateAgainstIndices(OGRLayer *, OGRErr *);
1516
1517 int CanUseIndex(OGRLayer *);
1518
1519 char **GetUsedFields();
1520
1521 void *GetSWQExpr()
1522 {
1523 return pSWQExpr;
1524 }
1525};
1527
1528#endif /* ndef OGR_FEATURE_H_INCLUDED */
Definition of a coded / enumerated field domain.
Definition ogr_feature.h:1292
const OGRCodedValue * GetEnumeration() const
Get the enumeration as (code, value) pairs.
Definition ogr_feature.h:1329
Definition of a feature class or feature layer.
Definition ogr_feature.h:364
int Reference()
Increments the reference count by one.
Definition ogr_feature.h:431
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
virtual bool IsStyleIgnored() const
Determine whether the style can be omitted when fetching features.
Definition ogr_feature.h:447
int Dereference()
Decrements the reference count by one.
Definition ogr_feature.h:435
static OGRFeatureDefnH ToHandle(OGRFeatureDefn *poFeatureDefn)
Convert a OGRFeatureDefn* to a OGRFeatureDefnH.
Definition ogr_feature.h:471
static OGRFeatureDefn * FromHandle(OGRFeatureDefnH hFeatureDefn)
Convert a OGRFeatureDefnH to a OGRFeatureDefn*.
Definition ogr_feature.h:479
virtual OGRGeomFieldDefn * GetGeomFieldDefn(int i)
Fetch geometry field definition.
Definition ogrfeaturedefn.cpp:640
virtual int GetGeomFieldCount() const
Fetch number of geometry fields on this feature.
Definition ogrfeaturedefn.cpp:591
virtual int GetFieldIndex(const char *) const
Find field by name.
Definition ogrfeaturedefn.cpp:1177
int GetReferenceCount() const
Fetch current reference count.
Definition ogr_feature.h:439
virtual int GetGeomFieldIndex(const char *) const
Find geometry field by name.
Definition ogrfeaturedefn.cpp:875
virtual void SetStyleIgnored(bool bIgnore)
Set whether the style can be omitted when fetching features.
Definition ogr_feature.h:451
Field value iterator class.
Definition ogr_feature.h:720
Exception raised by operator[](const char*) when a field is not found.
Definition ogr_feature.h:766
Field value.
Definition ogr_feature.h:523
bool empty() const
Return whether the field value is unset/empty.
Definition ogr_feature.h:597
int GetInteger() const
Return the integer value.
Definition ogr_feature.h:617
OGRFieldType GetType() const
Return field type.
Definition ogr_feature.h:585
void Unset()
Unset the field.
Definition ogr_feature.h:567
double GetDouble() const
Return the double value.
Definition ogr_feature.h:635
const char * GetName() const
Return field name.
Definition ogr_feature.h:580
GIntBig GetInteger64() const
Return the 64-bit integer value.
Definition ogr_feature.h:626
OGRFieldSubType GetSubType() const
Return field subtype.
Definition ogr_feature.h:590
const char * GetString() const
Return the string value.
Definition ogr_feature.h:644
A simple feature, including geometry and attributes.
Definition ogr_feature.h:497
OGRFeatureDefn * GetDefnRef()
Fetch feature definition.
Definition ogr_feature.h:772
static OGRFeatureH ToHandle(OGRFeature *poFeature)
Convert a OGRFeature* to a OGRFeatureH.
Definition ogr_feature.h:1078
char ** GetFieldAsStringList(const char *pszFName) const
Fetch field value as a list of strings.
Definition ogr_feature.h:940
ConstFieldIterator end() const
Return end of field value iterator.
Definition ogrfeature.cpp:7212
ConstFieldIterator begin() const
Return begin of field value iterator.
Definition ogrfeature.cpp:7207
void SetField(const char *pszFName, int nCount, const GIntBig *panValues)
Set field to list of 64 bit integers value.
Definition ogr_feature.h:1001
const OGRFeatureDefn * GetDefnRef() const
Fetch feature definition.
Definition ogr_feature.h:776
OGRFieldDefn * GetFieldDefnRef(int iField)
Fetch definition for this field.
Definition ogr_feature.h:829
const double * GetFieldAsDoubleList(const char *pszFName, int *pnCount) const
Fetch field value as a list of doubles.
Definition ogr_feature.h:936
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:997
void SetField(const char *pszFName, GIntBig nValue)
Set field to 64 bit integer value.
Definition ogr_feature.h:985
void SetField(const char *pszFName, const char *pszValue)
Set field to string value.
Definition ogr_feature.h:993
void SetField(const char *pszFName, int nValue)
Set field to integer value.
Definition ogr_feature.h:981
const OGRFieldDefn * GetFieldDefnRef(int iField) const
Fetch definition for this field.
Definition ogr_feature.h:825
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:1017
const OGRGeomFieldDefn * GetGeomFieldDefnRef(int iField) const
Fetch definition for this geometry field.
Definition ogr_feature.h:799
const char * GetNativeData() const
Returns the native data for the feature.
Definition ogr_feature.h:1061
int GetFieldIndex(const char *pszName) const
Fetch the field index given field name.
Definition ogr_feature.h:833
int GetGeomFieldIndex(const char *pszName) const
Fetch the geometry field index given geometry field name.
Definition ogr_feature.h:803
OGRGeomFieldDefn * GetGeomFieldDefnRef(int iField)
Fetch definition for this geometry field.
Definition ogr_feature.h:795
GIntBig GetFieldAsInteger64(const char *pszFName) const
Fetch field value as integer 64 bit.
Definition ogr_feature.h:915
const int * GetFieldAsIntegerList(const char *pszFName, int *pnCount) const
Fetch field value as a list of integers.
Definition ogr_feature.h:927
void SetField(const char *pszFName, double dfValue)
Set field to double value.
Definition ogr_feature.h:989
const char * GetFieldAsString(const char *pszFName) const
Fetch field value as a string.
Definition ogr_feature.h:923
void SetField(const char *pszFName, const char *const *papszValues)
This method currently on has an effect of OFTStringList fields.
Definition ogr_feature.h:1009
const OGRField * GetRawFieldRef(int i) const
Fetch a pointer to the internal field value given the index.
Definition ogr_feature.h:852
int GetFieldAsInteger(const char *pszFName) const
Fetch field value as integer.
Definition ogr_feature.h:911
const char * GetNativeMediaType() const
Returns the native media type for the feature.
Definition ogr_feature.h:1065
void SetField(const char *pszFName, const OGRField *puValue)
Set field.
Definition ogr_feature.h:1013
GIntBig GetFID() const
Get feature identifier.
Definition ogr_feature.h:1025
OGRField * GetRawFieldRef(int i)
Fetch a pointer to the internal field value given the index.
Definition ogr_feature.h:848
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:1005
virtual OGRStyleTable * GetStyleTable() const
Return style table.
Definition ogr_feature.h:1054
double GetFieldAsDouble(const char *pszFName) const
Fetch field value as a double.
Definition ogr_feature.h:919
static OGRFeature * FromHandle(OGRFeatureH hFeature)
Convert a OGRFeatureH to a OGRFeature*.
Definition ogr_feature.h:1086
const GIntBig * GetFieldAsInteger64List(const char *pszFName, int *pnCount) const
Fetch field value as a list of 64 bit integers.
Definition ogr_feature.h:931
Definition of an attribute of an OGRFeatureDefn.
Definition ogr_feature.h:104
const char * GetNameRef() const
Fetch name of this field.
Definition ogr_feature.h:128
int IsNullable() const
Return whether this field can receive null values.
Definition ogr_feature.h:196
int IsUnique() const
Return whether this field has a unique constraint.
Definition ogr_feature.h:205
void SetUnique(int bUniqueIn)
Set whether this field has a unique constraint.
Definition ogr_feature.h:209
OGRFieldSubType GetSubType() const
Fetch subtype of this field.
Definition ogr_feature.h:146
OGRJustification GetJustify() const
Get the justification for this field.
Definition ogr_feature.h:153
void SetIgnored(int bIgnoreIn)
Set whether this field should be omitted when fetching features.
Definition ogr_feature.h:191
void SetDomainName(const std::string &osDomainName)
Set the name of the field domain for this field.
Definition ogr_feature.h:218
int GetPrecision() const
Get the formatting precision for this field.
Definition ogr_feature.h:171
OGRFieldType GetType() const
Fetch type of this field.
Definition ogr_feature.h:139
void SetWidth(int nWidthIn)
Set the formatting width for this field in characters.
Definition ogr_feature.h:166
int GetWidth() const
Get the formatting width for this field.
Definition ogr_feature.h:162
void SetPrecision(int nPrecisionIn)
Set the formatting precision for this field in characters.
Definition ogr_feature.h:175
void SetNullable(int bNullableIn)
Set whether this field can receive null values.
Definition ogr_feature.h:200
void SetJustify(OGRJustification eJustifyIn)
Set the justification for this field.
Definition ogr_feature.h:157
const char * GetAlternativeNameRef() const
Fetch the alternative name (or "alias") for this field.
Definition ogr_feature.h:134
static OGRFieldDefnH ToHandle(OGRFieldDefn *poFieldDefn)
Convert a OGRFieldDefn* to a OGRFieldDefnH.
Definition ogr_feature.h:228
const std::string & GetDomainName() const
Return the name of the field domain for this field.
Definition ogr_feature.h:214
int IsIgnored() const
Return whether this field should be omitted when fetching features.
Definition ogr_feature.h:187
static OGRFieldDefn * FromHandle(OGRFieldDefnH hFieldDefn)
Convert a OGRFieldDefnH to a OGRFieldDefn*.
Definition ogr_feature.h:236
Definition of a field domain.
Definition ogr_feature.h:1161
OGRFieldDomainMergePolicy GetMergePolicy() const
Get the merge policy.
Definition ogr_feature.h:1270
void SetMergePolicy(OGRFieldDomainMergePolicy policy)
Set the merge policy.
Definition ogr_feature.h:1279
static OGRFieldDomain * FromHandle(OGRFieldDomainH hFieldDomain)
Convert a OGRFieldDomainH to a OGRFieldDomain*.
Definition ogr_feature.h:1243
virtual OGRFieldDomain * Clone() const =0
Clone.
OGRFieldSubType GetFieldSubType() const
Get the field subtype.
Definition ogr_feature.h:1231
const std::string & GetName() const
Get the name of the field domain.
Definition ogr_feature.h:1194
virtual ~OGRFieldDomain()=0
Destructor.
const std::string & GetDescription() const
Get the description of the field domain.
Definition ogr_feature.h:1204
OGRFieldDomainSplitPolicy GetSplitPolicy() const
Get the split policy.
Definition ogr_feature.h:1252
static OGRFieldDomainH ToHandle(OGRFieldDomain *poFieldDomain)
Convert a OGRFieldDomain* to a OGRFieldDomainH.
Definition ogr_feature.h:1237
OGRFieldType GetFieldType() const
Get the field type.
Definition ogr_feature.h:1222
OGRFieldDomainType GetDomainType() const
Get the type of the field domain.
Definition ogr_feature.h:1213
void SetSplitPolicy(OGRFieldDomainSplitPolicy policy)
Set the split policy.
Definition ogr_feature.h:1261
Definition of a geometry field of an OGRFeatureDefn.
Definition ogr_feature.h:265
void SetIgnored(int bIgnoreIn)
Set whether this field should be omitted when fetching features.
Definition ogr_feature.h:303
static OGRGeomFieldDefn * FromHandle(OGRGeomFieldDefnH hGeomFieldDefn)
Convert a OGRGeomFieldDefnH to a OGRGeomFieldDefn*.
Definition ogr_feature.h:330
int IsNullable() const
Return whether this geometry field can receive null values.
Definition ogr_feature.h:308
void SetNullable(int bNullableIn)
Set whether this geometry field can receive null values.
Definition ogr_feature.h:312
OGRwkbGeometryType GetType() const
Fetch geometry type of this field.
Definition ogr_feature.h:290
int IsIgnored() const
Return whether this field should be omitted when fetching features.
Definition ogr_feature.h:299
static OGRGeomFieldDefnH ToHandle(OGRGeomFieldDefn *poGeomFieldDefn)
Convert a OGRGeomFieldDefn* to a OGRGeomFieldDefnH.
Definition ogr_feature.h:322
const char * GetNameRef() const
Fetch name of this field.
Definition ogr_feature.h:285
Abstract base class for all geometry classes.
Definition ogr_geometry.h:335
Definition of a field domain for field content validated by a glob.
Definition ogr_feature.h:1436
OGRGlobFieldDomain * Clone() const override
Clone.
Definition ogr_feature.h:1459
const std::string & GetGlob() const
Get the glob expression.
Definition ogr_feature.h:1472
This class represents a layer of simple features, with access methods.
Definition ogrsf_frmts.h:73
Definition of a numeric field domain with a range of validity for values.
Definition ogr_feature.h:1338
OGRRangeFieldDomain * Clone() const override
Clone.
Definition ogr_feature.h:1382
const OGRField & GetMax(bool &bIsInclusiveOut) const
Get the maximum value.
Definition ogr_feature.h:1424
const OGRField & GetMin(bool &bIsInclusiveOut) const
Get the minimum value.
Definition ogr_feature.h:1405
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition ogr_spatialref.h:167
This class represents a style table.
Definition ogr_featurestyle.h:85
#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:1049
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition cpl_port.h:1190
#define CPL_WARN_UNUSED_RESULT
Qualifier to warn when the return value of a function is not used.
Definition cpl_port.h:983
unsigned char GByte
Unsigned byte type.
Definition cpl_port.h:205
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition cpl_port.h:233
#define MAX(a, b)
Macro to compute the maximum of 2 values.
Definition cpl_port.h:392
#define OGRUnsetMarker
Special value set in OGRField.Set.nMarker1, nMarker2 and nMarker3 for a unset field.
Definition ogr_core.h:847
int OGRBoolean
Type for a OGR boolean.
Definition ogr_core.h:395
OGRFieldSubType
List of field subtypes.
Definition ogr_core.h:800
OGRFieldDomainMergePolicy
Merge policy for field domains.
Definition ogr_core.h:1232
@ OFDMP_DEFAULT_VALUE
Default value.
Definition ogr_core.h:1234
OGRFieldDomainType
Type of field domain.
Definition ogr_core.h:1197
OGRJustification
Display justification for field values.
Definition ogr_core.h:825
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:855
OGRwkbGeometryType
List of well known binary geometry types.
Definition ogr_core.h:407
@ wkbUnknown
unknown type, non-standard
Definition ogr_core.h:408
int OGRErr
Type for a OGR error.
Definition ogr_core.h:378
OGRFieldDomainSplitPolicy
Split policy for field domains.
Definition ogr_core.h:1214
@ OFDSP_DEFAULT_VALUE
Default value.
Definition ogr_core.h:1216
std::unique_ptr< OGRFeature, OGRFeatureUniquePtrDeleter > OGRFeatureUniquePtr
Unique pointer type for OGRFeature.
Definition ogr_feature.h:1106
void * OGRFieldDefnH
Opaque type for a field definition (OGRFieldDefn)
Definition ogr_feature.h:62
void * OGRFeatureDefnH
Opaque type for a feature definition (OGRFeatureDefn)
Definition ogr_feature.h:64
void * OGRFeatureH
Opaque type for a feature (OGRFeature)
Definition ogr_feature.h:66
struct OGRFieldDomainHS * OGRFieldDomainH
Opaque type for a field domain definition (OGRFieldDomain)
Definition ogr_feature.h:74
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
Simple feature style classes.
Simple feature geometry classes.
OGRLayer::FeatureIterator begin(OGRLayer *poLayer)
Return begin of feature iterator.
Definition ogrsf_frmts.h:345
OGRLayer::FeatureIterator end(OGRLayer *poLayer)
Return end of feature iterator.
Definition ogrsf_frmts.h:353
Associates a code and a value.
Definition ogr_core.h:1184
OGRFeature field attribute value union.
Definition ogr_core.h:866