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 <exception>
39 #include <memory>
40 #include <string>
41 #include <vector>
42 
49 #ifndef DEFINE_OGRFeatureH
51 #define DEFINE_OGRFeatureH
53 #ifdef DEBUG
54 typedef struct OGRFieldDefnHS *OGRFieldDefnH;
55 typedef struct OGRFeatureDefnHS *OGRFeatureDefnH;
56 typedef struct OGRFeatureHS *OGRFeatureH;
57 typedef struct OGRStyleTableHS *OGRStyleTableH;
58 #else
60 typedef void *OGRFieldDefnH;
62 typedef void *OGRFeatureDefnH;
64 typedef void *OGRFeatureH;
66 typedef void *OGRStyleTableH;
67 #endif
69 typedef struct OGRGeomFieldDefnHS *OGRGeomFieldDefnH;
70 
72 typedef struct OGRFieldDomainHS *OGRFieldDomainH;
73 #endif /* DEFINE_OGRFeatureH */
74 
75 class OGRStyleTable;
76 
77 /************************************************************************/
78 /* OGRFieldDefn */
79 /************************************************************************/
80 
98 class CPL_DLL OGRFieldDefn
99 {
100  private:
101  char *pszName;
102  char *pszAlternativeName;
103  OGRFieldType eType;
104  OGRJustification eJustify;
105  int nWidth; // Zero is variable.
106  int nPrecision;
107  char *pszDefault;
108 
109  int bIgnore;
110  OGRFieldSubType eSubType;
111 
112  int bNullable;
113  int bUnique;
114 
115  std::string m_osDomainName{}; // field domain name. Might be empty
116 
117  public:
118  OGRFieldDefn( const char *, OGRFieldType );
119  explicit OGRFieldDefn( const OGRFieldDefn * );
120  ~OGRFieldDefn();
121 
122  void SetName( const char * );
123  const char *GetNameRef() const { return pszName; }
124 
125  void SetAlternativeName( const char * );
126  const char *GetAlternativeNameRef() const { return pszAlternativeName; }
127 
128  OGRFieldType GetType() const { return eType; }
129  void SetType( OGRFieldType eTypeIn );
130  static const char *GetFieldTypeName( OGRFieldType );
131 
132  OGRFieldSubType GetSubType() const { return eSubType; }
133  void SetSubType( OGRFieldSubType eSubTypeIn );
134  static const char *GetFieldSubTypeName( OGRFieldSubType );
135 
136  OGRJustification GetJustify() const { return eJustify; }
137  void SetJustify( OGRJustification eJustifyIn )
138  { eJustify = eJustifyIn; }
139 
140  int GetWidth() const { return nWidth; }
141  void SetWidth( int nWidthIn ) { nWidth = MAX(0,nWidthIn); }
142 
143  int GetPrecision() const { return nPrecision; }
144  void SetPrecision( int nPrecisionIn )
145  { nPrecision = nPrecisionIn; }
146 
147  void Set( const char *, OGRFieldType, int = 0, int = 0,
148  OGRJustification = OJUndefined );
149 
150  void SetDefault( const char* );
151  const char *GetDefault() const;
152  int IsDefaultDriverSpecific() const;
153 
154  int IsIgnored() const { return bIgnore; }
155  void SetIgnored( int bIgnoreIn ) { bIgnore = bIgnoreIn; }
156 
157  int IsNullable() const { return bNullable; }
158  void SetNullable( int bNullableIn ) { bNullable = bNullableIn; }
159 
160  int IsUnique() const { return bUnique; }
161  void SetUnique( int bUniqueIn ) { bUnique = bUniqueIn; }
162 
163  const std::string& GetDomainName() const { return m_osDomainName; }
164  void SetDomainName(const std::string& osDomainName) { m_osDomainName = osDomainName; }
165 
166  int IsSame( const OGRFieldDefn * ) const;
167 
171  static inline OGRFieldDefnH ToHandle(OGRFieldDefn* poFieldDefn)
172  { return reinterpret_cast<OGRFieldDefnH>(poFieldDefn); }
173 
177  static inline OGRFieldDefn* FromHandle(OGRFieldDefnH hFieldDefn)
178  { return reinterpret_cast<OGRFieldDefn*>(hFieldDefn); }
179  private:
181 };
182 
183 /************************************************************************/
184 /* OGRGeomFieldDefn */
185 /************************************************************************/
186 
201 class CPL_DLL OGRGeomFieldDefn
202 {
203 protected:
205  char *pszName = nullptr;
206  OGRwkbGeometryType eGeomType = wkbUnknown; /* all values possible except wkbNone */
207  mutable OGRSpatialReference* poSRS = nullptr;
208 
209  int bIgnore = false;
210  mutable int bNullable = true;
211 
212  void Initialize( const char *, OGRwkbGeometryType );
214 
215 public:
216  OGRGeomFieldDefn( const char *pszNameIn,
217  OGRwkbGeometryType eGeomTypeIn );
218  explicit OGRGeomFieldDefn( const OGRGeomFieldDefn * );
219  virtual ~OGRGeomFieldDefn();
220 
221  void SetName( const char * );
222  const char *GetNameRef() const { return pszName; }
223 
224  OGRwkbGeometryType GetType() const { return eGeomType; }
225  void SetType( OGRwkbGeometryType eTypeIn );
226 
227  virtual OGRSpatialReference* GetSpatialRef() const;
228  void SetSpatialRef( OGRSpatialReference* poSRSIn );
229 
230  int IsIgnored() const { return bIgnore; }
231  void SetIgnored( int bIgnoreIn ) { bIgnore = bIgnoreIn; }
232 
233  int IsNullable() const { return bNullable; }
234  void SetNullable( int bNullableIn )
235  { bNullable = bNullableIn; }
236 
237  int IsSame( const OGRGeomFieldDefn * ) const;
238 
242  static inline OGRGeomFieldDefnH ToHandle(OGRGeomFieldDefn* poGeomFieldDefn)
243  { return reinterpret_cast<OGRGeomFieldDefnH>(poGeomFieldDefn); }
244 
248  static inline OGRGeomFieldDefn* FromHandle(OGRGeomFieldDefnH hGeomFieldDefn)
249  { return reinterpret_cast<OGRGeomFieldDefn*>(hGeomFieldDefn); }
250  private:
252 };
253 
254 /************************************************************************/
255 /* OGRFeatureDefn */
256 /************************************************************************/
257 
278 class CPL_DLL OGRFeatureDefn
279 {
280  protected:
282  volatile int nRefCount = 0;
283 
284  mutable std::vector<std::unique_ptr<OGRFieldDefn>> apoFieldDefn{};
285  mutable std::vector<std::unique_ptr<OGRGeomFieldDefn>> apoGeomFieldDefn{};
286 
287  char *pszFeatureClassName = nullptr;
288 
289  bool bIgnoreStyle = false;
291 
292  public:
293  explicit OGRFeatureDefn( const char * pszName = nullptr );
294  virtual ~OGRFeatureDefn();
295 
296  void SetName( const char* pszName );
297  virtual const char *GetName() const;
298 
299  virtual int GetFieldCount() const;
300  virtual OGRFieldDefn *GetFieldDefn( int i );
301  virtual const OGRFieldDefn *GetFieldDefn( int i ) const;
302  virtual int GetFieldIndex( const char * ) const;
303  int GetFieldIndexCaseSensitive( const char * ) const;
304 
306  // That method should only be called if there's a guarantee that GetFieldCount() has been called before
307  int GetFieldCountUnsafe() const { return static_cast<int>(apoFieldDefn.size()); }
308 
309  // Those methods don't check i is n range.
310  OGRFieldDefn *GetFieldDefnUnsafe( int i ) { if( apoFieldDefn.empty() ) GetFieldDefn(i); return apoFieldDefn[i].get(); }
311  const OGRFieldDefn *GetFieldDefnUnsafe( int i ) const { if( apoFieldDefn.empty() ) GetFieldDefn(i); return apoFieldDefn[i].get(); }
313 
314  virtual void AddFieldDefn( const OGRFieldDefn * );
315  virtual OGRErr DeleteFieldDefn( int iField );
316  virtual OGRErr ReorderFieldDefns( const int* panMap );
317 
318  virtual int GetGeomFieldCount() const;
319  virtual OGRGeomFieldDefn *GetGeomFieldDefn( int i );
320  virtual const OGRGeomFieldDefn *GetGeomFieldDefn( int i ) const;
321  virtual int GetGeomFieldIndex( const char * ) const;
322 
323  virtual void AddGeomFieldDefn( const OGRGeomFieldDefn * );
324  virtual void AddGeomFieldDefn( std::unique_ptr<OGRGeomFieldDefn>&& );
325  virtual OGRErr DeleteGeomFieldDefn( int iGeomField );
326 
327  virtual OGRwkbGeometryType GetGeomType() const;
328  virtual void SetGeomType( OGRwkbGeometryType );
329 
330  virtual OGRFeatureDefn *Clone() const;
331 
332  int Reference() { return CPLAtomicInc(&nRefCount); }
333  int Dereference() { return CPLAtomicDec(&nRefCount); }
334  int GetReferenceCount() const { return nRefCount; }
335  void Release();
336 
337  virtual int IsGeometryIgnored() const;
338  virtual void SetGeometryIgnored( int bIgnore );
339  virtual bool IsStyleIgnored() const { return bIgnoreStyle; }
340  virtual void SetStyleIgnored( bool bIgnore )
341  { bIgnoreStyle = bIgnore; }
342 
343  virtual int IsSame( const OGRFeatureDefn * poOtherFeatureDefn ) const;
344 
346  void ReserveSpaceForFields(int nFieldCountIn);
348 
349  std::vector<int> ComputeMapForSetFrom( const OGRFeatureDefn* poSrcFDefn,
350  bool bForgiving = true ) const;
351 
352  static OGRFeatureDefn *CreateFeatureDefn( const char *pszName = nullptr );
353  static void DestroyFeatureDefn( OGRFeatureDefn * );
354 
358  static inline OGRFeatureDefnH ToHandle(OGRFeatureDefn* poFeatureDefn)
359  { return reinterpret_cast<OGRFeatureDefnH>(poFeatureDefn); }
360 
364  static inline OGRFeatureDefn* FromHandle(OGRFeatureDefnH hFeatureDefn)
365  { return reinterpret_cast<OGRFeatureDefn*>(hFeatureDefn); }
366 
367  private:
369 };
370 
371 /************************************************************************/
372 /* OGRFeature */
373 /************************************************************************/
374 
379 class CPL_DLL OGRFeature
380 {
381  private:
382 
383  GIntBig nFID;
384  OGRFeatureDefn *poDefn;
385  OGRGeometry **papoGeometries;
386  OGRField *pauFields;
387  char *m_pszNativeData;
388  char *m_pszNativeMediaType;
389 
390  bool SetFieldInternal( int i, const OGRField * puValue );
391 
392  protected:
394  mutable char *m_pszStyleString;
395  mutable OGRStyleTable *m_poStyleTable;
396  mutable char *m_pszTmpFieldValue;
398 
399  bool CopySelfTo( OGRFeature *poNew ) const;
400 
401  public:
402  explicit OGRFeature( OGRFeatureDefn * );
403  virtual ~OGRFeature();
404 
406  class CPL_DLL FieldValue
407  {
408  friend class OGRFeature;
409  struct Private;
410  std::unique_ptr<Private> m_poPrivate;
411 
412  FieldValue(OGRFeature* poFeature, int iFieldIndex);
413  FieldValue(const OGRFeature* poFeature, int iFieldIndex);
414  FieldValue(const FieldValue& oOther) = delete;
415 
416  public:
418  ~FieldValue();
420 
422  FieldValue& operator= (const FieldValue& oOther);
424  FieldValue& operator= (int nVal);
426  FieldValue& operator= (GIntBig nVal);
428  FieldValue& operator= (double dfVal);
430  FieldValue& operator= (const char *pszVal);
432  FieldValue& operator= (const std::string& osVal);
434  FieldValue& operator= (const std::vector<int>& oArray);
436  FieldValue& operator= (const std::vector<GIntBig>& oArray);
438  FieldValue& operator= (const std::vector<double>& oArray);
440  FieldValue& operator= (const std::vector<std::string>& oArray);
442  FieldValue& operator= (CSLConstList papszValues);
444  void SetNull();
446  void clear();
448  void Unset() { clear(); }
450  void SetDateTime(int nYear, int nMonth, int nDay,
451  int nHour=0, int nMinute=0, float fSecond=0.f,
452  int nTZFlag = 0 );
453 
455  int GetIndex() const;
457  const OGRFieldDefn* GetDefn() const;
459  const char* GetName() const { return GetDefn()->GetNameRef(); }
461  OGRFieldType GetType() const { return GetDefn()->GetType(); }
463  OGRFieldSubType GetSubType() const { return GetDefn()->GetSubType(); }
464 
466  // cppcheck-suppress functionStatic
467  bool empty() const { return IsUnset(); }
468 
470  // cppcheck-suppress functionStatic
471  bool IsUnset() const;
472 
474  // cppcheck-suppress functionStatic
475  bool IsNull() const;
476 
478  const OGRField *GetRawValue() const;
479 
483  // cppcheck-suppress functionStatic
484  int GetInteger() const { return GetRawValue()->Integer; }
485 
489  // cppcheck-suppress functionStatic
490  GIntBig GetInteger64() const { return GetRawValue()->Integer64; }
491 
495  // cppcheck-suppress functionStatic
496  double GetDouble() const { return GetRawValue()->Real; }
497 
501  // cppcheck-suppress functionStatic
502  const char* GetString() const { return GetRawValue()->String; }
503 
505  bool GetDateTime( int *pnYear, int *pnMonth,
506  int *pnDay,
507  int *pnHour, int *pnMinute,
508  float *pfSecond,
509  int *pnTZFlag ) const;
510 
512  operator int () const { return GetAsInteger(); }
514  operator GIntBig() const { return GetAsInteger64(); }
516  operator double () const { return GetAsDouble(); }
518  operator const char*() const { return GetAsString(); }
520  operator const std::vector<int>& () const { return GetAsIntegerList(); }
522  operator const std::vector<GIntBig>& () const { return GetAsInteger64List(); }
524  operator const std::vector<double>& () const { return GetAsDoubleList(); }
526  operator const std::vector<std::string>& () const { return GetAsStringList(); }
528  operator CSLConstList () const;
529 
531  int GetAsInteger() const;
533  GIntBig GetAsInteger64() const;
535  double GetAsDouble() const;
537  const char* GetAsString() const;
539  const std::vector<int>& GetAsIntegerList() const;
541  const std::vector<GIntBig>& GetAsInteger64List() const;
543  const std::vector<double>& GetAsDoubleList() const;
545  const std::vector<std::string>& GetAsStringList() const;
546  };
547 
549  class CPL_DLL ConstFieldIterator
550  {
551  friend class OGRFeature;
552  struct Private;
553  std::unique_ptr<Private> m_poPrivate;
554 
555  ConstFieldIterator(const OGRFeature* poSelf, int nPos);
556 
557  public:
559  ConstFieldIterator(ConstFieldIterator&& oOther) noexcept; // declared but not defined. Needed for gcc 5.4 at least
561  const FieldValue& operator*() const;
562  ConstFieldIterator& operator++();
563  bool operator!=(const ConstFieldIterator& it) const;
565  };
566 
583  ConstFieldIterator begin() const;
585  ConstFieldIterator end() const;
586 
587  const FieldValue operator[](int iField) const;
588  FieldValue operator[](int iField);
589 
591  class FieldNotFoundException: public std::exception {};
592 
593  const FieldValue operator[](const char* pszFieldName) const;
594  FieldValue operator[](const char* pszFieldName);
595 
596  OGRFeatureDefn *GetDefnRef() { return poDefn; }
597  const OGRFeatureDefn *GetDefnRef() const { return poDefn; }
598 
600  void SetFDefnUnsafe( OGRFeatureDefn* poNewFDefn );
602 
603  OGRErr SetGeometryDirectly( OGRGeometry * );
604  OGRErr SetGeometry( const OGRGeometry * );
605  OGRGeometry *GetGeometryRef();
606  const OGRGeometry *GetGeometryRef() const;
607  OGRGeometry *StealGeometry() CPL_WARN_UNUSED_RESULT;
608 
609  int GetGeomFieldCount() const
610  { return poDefn->GetGeomFieldCount(); }
612  { return poDefn->GetGeomFieldDefn(iField); }
613  const OGRGeomFieldDefn *GetGeomFieldDefnRef( int iField ) const
614  { return poDefn->GetGeomFieldDefn(iField); }
615  int GetGeomFieldIndex( const char * pszName ) const
616  { return poDefn->GetGeomFieldIndex(pszName); }
617 
618  OGRGeometry* GetGeomFieldRef( int iField );
619  const OGRGeometry* GetGeomFieldRef( int iField ) const;
620  OGRGeometry* StealGeometry( int iField );
621  OGRGeometry* GetGeomFieldRef( const char* pszFName );
622  const OGRGeometry* GetGeomFieldRef( const char* pszFName ) const;
623  OGRErr SetGeomFieldDirectly( int iField, OGRGeometry * );
624  OGRErr SetGeomField( int iField, const OGRGeometry * );
625 
626  void Reset();
627 
628  OGRFeature *Clone() const CPL_WARN_UNUSED_RESULT;
629  virtual OGRBoolean Equal( const OGRFeature * poFeature ) const;
630 
631  int GetFieldCount() const
632  { return poDefn->GetFieldCount(); }
633  const OGRFieldDefn *GetFieldDefnRef( int iField ) const
634  { return poDefn->GetFieldDefn(iField); }
636  { return poDefn->GetFieldDefn(iField); }
637  int GetFieldIndex( const char * pszName ) const
638  { return poDefn->GetFieldIndex(pszName); }
639 
640  int IsFieldSet( int iField ) const;
641 
642  void UnsetField( int iField );
643 
644  bool IsFieldNull( int iField ) const;
645 
646  void SetFieldNull( int iField );
647 
648  bool IsFieldSetAndNotNull( int iField ) const;
649 
650  OGRField *GetRawFieldRef( int i ) { return pauFields + i; }
651  const OGRField *GetRawFieldRef( int i ) const { return pauFields + i; }
652 
653  int GetFieldAsInteger( int i ) const;
654  GIntBig GetFieldAsInteger64( int i ) const;
655  double GetFieldAsDouble( int i ) const;
656  const char *GetFieldAsString( int i ) const;
657  const int *GetFieldAsIntegerList( int i, int *pnCount ) const;
658  const GIntBig *GetFieldAsInteger64List( int i, int *pnCount ) const;
659  const double *GetFieldAsDoubleList( int i, int *pnCount ) const;
660  char **GetFieldAsStringList( int i ) const;
661  GByte *GetFieldAsBinary( int i, int *pnCount ) const;
662  int GetFieldAsDateTime( int i,
663  int *pnYear, int *pnMonth,
664  int *pnDay,
665  int *pnHour, int *pnMinute,
666  int *pnSecond,
667  int *pnTZFlag ) const;
668  int GetFieldAsDateTime( int i,
669  int *pnYear, int *pnMonth,
670  int *pnDay,
671  int *pnHour, int *pnMinute,
672  float *pfSecond,
673  int *pnTZFlag ) const;
674  char *GetFieldAsSerializedJSon( int i ) const;
675 
677  bool IsFieldSetUnsafe( int i ) const { return !(pauFields[i].Set.nMarker1 == OGRUnsetMarker &&
678  pauFields[i].Set.nMarker2 == OGRUnsetMarker &&
679  pauFields[i].Set.nMarker3 == OGRUnsetMarker); }
680  bool IsFieldNullUnsafe( int i ) const { return (pauFields[i].Set.nMarker1 == OGRNullMarker &&
681  pauFields[i].Set.nMarker2 == OGRNullMarker &&
682  pauFields[i].Set.nMarker3 == OGRNullMarker); }
683  bool IsFieldSetAndNotNullUnsafe( int i ) const { return IsFieldSetUnsafe(i) && !IsFieldNullUnsafe(i); }
684  // Those methods should only be called on a field that is of the type
685  // consistent with the value, and that is set.
686  int GetFieldAsIntegerUnsafe( int i ) const { return pauFields[i].Integer; }
687  GIntBig GetFieldAsInteger64Unsafe( int i ) const { return pauFields[i].Integer64; }
688  double GetFieldAsDoubleUnsafe( int i ) const { return pauFields[i].Real; }
689  const char* GetFieldAsStringUnsafe( int i) const { return pauFields[i].String; }
691 
692  int GetFieldAsInteger( const char *pszFName ) const
693  { return GetFieldAsInteger( GetFieldIndex(pszFName) ); }
694  GIntBig GetFieldAsInteger64( const char *pszFName ) const
695  { return GetFieldAsInteger64( GetFieldIndex(pszFName) ); }
696  double GetFieldAsDouble( const char *pszFName ) const
697  { return GetFieldAsDouble( GetFieldIndex(pszFName) ); }
698  const char *GetFieldAsString( const char *pszFName ) const
699  { return GetFieldAsString( GetFieldIndex(pszFName) ); }
700  const int *GetFieldAsIntegerList( const char *pszFName,
701  int *pnCount ) const
702  { return GetFieldAsIntegerList( GetFieldIndex(pszFName),
703  pnCount ); }
704  const GIntBig *GetFieldAsInteger64List( const char *pszFName,
705  int *pnCount ) const
706  { return GetFieldAsInteger64List( GetFieldIndex(pszFName),
707  pnCount ); }
708  const double *GetFieldAsDoubleList( const char *pszFName,
709  int *pnCount ) const
710  { return GetFieldAsDoubleList( GetFieldIndex(pszFName),
711  pnCount ); }
712  char **GetFieldAsStringList( const char *pszFName ) const
713  { return GetFieldAsStringList(GetFieldIndex(pszFName)); }
714 
715  void SetField( int i, int nValue );
716  void SetField( int i, GIntBig nValue );
717  void SetField( int i, double dfValue );
718  void SetField( int i, const char * pszValue );
719  void SetField( int i, int nCount, const int * panValues );
720  void SetField( int i, int nCount,
721  const GIntBig * panValues );
722  void SetField( int i, int nCount, const double * padfValues );
723  void SetField( int i, const char * const * papszValues );
724  void SetField( int i, const OGRField * puValue );
725  void SetField( int i, int nCount, const void * pabyBinary );
726  void SetField( int i, int nYear, int nMonth, int nDay,
727  int nHour=0, int nMinute=0, float fSecond=0.f,
728  int nTZFlag = 0 );
729 
731  // Those methods should only be called on a field that is of the type
732  // consistent with the value, and in a unset state.
733  void SetFieldSameTypeUnsafe( int i, int nValue ) {
734  pauFields[i].Integer = nValue; pauFields[i].Set.nMarker2 = 0; pauFields[i].Set.nMarker3 = 0; }
735  void SetFieldSameTypeUnsafe( int i, GIntBig nValue ) { pauFields[i].Integer64 = nValue; }
736  void SetFieldSameTypeUnsafe( int i, double dfValue ) { pauFields[i].Real = dfValue; }
737  void SetFieldSameTypeUnsafe( int i, char* pszValueTransfered ) { pauFields[i].String = pszValueTransfered; }
739 
740  void SetField( const char *pszFName, int nValue )
741  { SetField( GetFieldIndex(pszFName), nValue ); }
742  void SetField( const char *pszFName, GIntBig nValue )
743  { SetField( GetFieldIndex(pszFName), nValue ); }
744  void SetField( const char *pszFName, double dfValue )
745  { SetField( GetFieldIndex(pszFName), dfValue ); }
746  void SetField( const char *pszFName, const char * pszValue )
747  { SetField( GetFieldIndex(pszFName), pszValue ); }
748  void SetField( const char *pszFName, int nCount,
749  const int * panValues )
750  { SetField(GetFieldIndex(pszFName),nCount,panValues); }
751  void SetField( const char *pszFName, int nCount,
752  const GIntBig * panValues )
753  { SetField(GetFieldIndex(pszFName),nCount,panValues); }
754  void SetField( const char *pszFName, int nCount,
755  const double * padfValues )
756  {SetField(GetFieldIndex(pszFName),nCount,padfValues); }
757  void SetField( const char *pszFName, const char * const * papszValues )
758  { SetField( GetFieldIndex(pszFName), papszValues); }
759  void SetField( const char *pszFName, const OGRField * puValue )
760  { SetField( GetFieldIndex(pszFName), puValue ); }
761  void SetField( const char *pszFName,
762  int nYear, int nMonth, int nDay,
763  int nHour=0, int nMinute=0, float fSecond=0.f,
764  int nTZFlag = 0 )
765  { SetField( GetFieldIndex(pszFName),
766  nYear, nMonth, nDay,
767  nHour, nMinute, fSecond, nTZFlag ); }
768 
769  GIntBig GetFID() const { return nFID; }
770  virtual OGRErr SetFID( GIntBig nFIDIn );
771 
772  void DumpReadable( FILE *, char** papszOptions = nullptr ) const;
773 
774  OGRErr SetFrom( const OGRFeature *, int = TRUE );
775  OGRErr SetFrom( const OGRFeature *, const int *, int = TRUE );
776  OGRErr SetFieldsFrom( const OGRFeature *, const int *, int = TRUE );
777 
779  OGRErr RemapFields( OGRFeatureDefn *poNewDefn,
780  const int *panRemapSource );
781  void AppendField();
782  OGRErr RemapGeomFields( OGRFeatureDefn *poNewDefn,
783  const int *panRemapSource );
785 
786  int Validate( int nValidateFlags,
787  int bEmitError ) const;
788  void FillUnsetWithDefault( int bNotNullableOnly,
789  char** papszOptions );
790 
791  virtual const char *GetStyleString() const;
792  virtual void SetStyleString( const char * );
793  virtual void SetStyleStringDirectly( char * );
794 
798  virtual OGRStyleTable *GetStyleTable() const { return m_poStyleTable; } /* f.i.x.m.e: add a const qualifier for return type */
799  virtual void SetStyleTable( OGRStyleTable *poStyleTable );
800  virtual void SetStyleTableDirectly( OGRStyleTable *poStyleTable );
801 
802  const char *GetNativeData() const { return m_pszNativeData; }
803  const char *GetNativeMediaType() const
804  { return m_pszNativeMediaType; }
805  void SetNativeData( const char* pszNativeData );
806  void SetNativeMediaType( const char* pszNativeMediaType );
807 
808  static OGRFeature *CreateFeature( OGRFeatureDefn * );
809  static void DestroyFeature( OGRFeature * );
810 
814  static inline OGRFeatureH ToHandle(OGRFeature* poFeature)
815  { return reinterpret_cast<OGRFeatureH>(poFeature); }
816 
820  static inline OGRFeature* FromHandle(OGRFeatureH hFeature)
821  { return reinterpret_cast<OGRFeature*>(hFeature); }
822 
823  private:
825 };
826 
828 struct CPL_DLL OGRFeatureUniquePtrDeleter
829 {
830  void operator()(OGRFeature*) const;
831 };
833 
837 typedef std::unique_ptr<OGRFeature, OGRFeatureUniquePtrDeleter> OGRFeatureUniquePtr;
838 
840 
841 inline OGRFeature::ConstFieldIterator begin(const OGRFeature* poFeature) { return poFeature->begin(); }
843 inline OGRFeature::ConstFieldIterator end(const OGRFeature* poFeature) { return poFeature->end(); }
844 
846 inline OGRFeature::ConstFieldIterator begin(const OGRFeatureUniquePtr& poFeature) { return poFeature->begin(); }
848 inline OGRFeature::ConstFieldIterator end(const OGRFeatureUniquePtr& poFeature) { return poFeature->end(); }
849 
851 
852 /************************************************************************/
853 /* OGRFieldDomain */
854 /************************************************************************/
855 
876 class CPL_DLL OGRFieldDomain
877 {
878 protected:
880  std::string m_osName;
881  std::string m_osDescription;
882  OGRFieldDomainType m_eDomainType;
883  OGRFieldType m_eFieldType;
884  OGRFieldSubType m_eFieldSubType;
887 
888  OGRFieldDomain(const std::string& osName,
889  const std::string& osDescription,
890  OGRFieldDomainType eDomainType,
891  OGRFieldType eFieldType,
892  OGRFieldSubType eFieldSubType);
895 public:
900  virtual ~OGRFieldDomain() = 0;
901 
906  virtual OGRFieldDomain* Clone() const = 0;
907 
912  const std::string& GetName() const { return m_osName; }
913 
919  const std::string& GetDescription() const { return m_osDescription; }
920 
925  OGRFieldDomainType GetDomainType() const { return m_eDomainType; }
926 
931  OGRFieldType GetFieldType() const { return m_eFieldType; }
932 
937  OGRFieldSubType GetFieldSubType() const { return m_eFieldSubType; }
938 
940  static inline OGRFieldDomainH ToHandle(OGRFieldDomain* poFieldDomain)
941  { return reinterpret_cast<OGRFieldDomainH>(poFieldDomain); }
942 
944  static inline OGRFieldDomain* FromHandle(OGRFieldDomainH hFieldDomain)
945  { return reinterpret_cast<OGRFieldDomain*>(hFieldDomain); }
946 
951  OGRFieldDomainSplitPolicy GetSplitPolicy() const { return m_eSplitPolicy; }
952 
957  void SetSplitPolicy(OGRFieldDomainSplitPolicy policy) { m_eSplitPolicy = policy; }
958 
963  OGRFieldDomainMergePolicy GetMergePolicy() const { return m_eMergePolicy; }
964 
969  void SetMergePolicy(OGRFieldDomainMergePolicy policy) { m_eMergePolicy = policy; }
970 };
971 
978 class CPL_DLL OGRCodedFieldDomain final: public OGRFieldDomain
979 {
980 private:
981  std::vector<OGRCodedValue> m_asValues{};
982 
983  OGRCodedFieldDomain(const OGRCodedFieldDomain&) = delete;
984  OGRCodedFieldDomain& operator= (const OGRCodedFieldDomain&) = delete;
985 
986 public:
1001  OGRCodedFieldDomain(const std::string& osName,
1002  const std::string& osDescription,
1003  OGRFieldType eFieldType,
1004  OGRFieldSubType eFieldSubType,
1005  std::vector<OGRCodedValue>&& asValues);
1006 
1007  ~OGRCodedFieldDomain() override;
1008 
1009  OGRCodedFieldDomain* Clone() const override;
1010 
1016  const OGRCodedValue* GetEnumeration() const { return m_asValues.data(); }
1017 };
1018 
1021 class CPL_DLL OGRRangeFieldDomain final: public OGRFieldDomain
1022 {
1023 private:
1024  OGRField m_sMin;
1025  OGRField m_sMax;
1026  bool m_bMinIsInclusive;
1027  bool m_bMaxIsInclusive;
1028 
1029  OGRRangeFieldDomain(const OGRRangeFieldDomain&) = delete;
1030  OGRRangeFieldDomain& operator= (const OGRRangeFieldDomain&) = delete;
1031 
1032 public:
1057  OGRRangeFieldDomain(const std::string& osName,
1058  const std::string& osDescription,
1059  OGRFieldType eFieldType,
1060  OGRFieldSubType eFieldSubType,
1061  const OGRField& sMin,
1062  bool bMinIsInclusive,
1063  const OGRField& sMax,
1064  bool bMaxIsInclusive);
1065 
1066  OGRRangeFieldDomain* Clone() const override {
1067  return new OGRRangeFieldDomain(m_osName, m_osDescription,
1068  m_eFieldType, m_eFieldSubType,
1069  m_sMin, m_bMinIsInclusive,
1070  m_sMax, m_bMaxIsInclusive);
1071  }
1072 
1084  const OGRField& GetMin(bool& bIsInclusiveOut) const {
1085  bIsInclusiveOut = m_bMinIsInclusive;
1086  return m_sMin;
1087  }
1088 
1100  const OGRField& GetMax(bool& bIsInclusiveOut) const {
1101  bIsInclusiveOut = m_bMaxIsInclusive;
1102  return m_sMax;
1103  }
1104 };
1105 
1110 class CPL_DLL OGRGlobFieldDomain final: public OGRFieldDomain
1111 {
1112 private:
1113  std::string m_osGlob;
1114 
1115  OGRGlobFieldDomain(const OGRGlobFieldDomain&) = delete;
1116  OGRGlobFieldDomain& operator= (const OGRGlobFieldDomain&) = delete;
1117 
1118 public:
1129  OGRGlobFieldDomain(const std::string& osName,
1130  const std::string& osDescription,
1131  OGRFieldType eFieldType,
1132  OGRFieldSubType eFieldSubType,
1133  const std::string& osBlob);
1134 
1135  OGRGlobFieldDomain* Clone() const override {
1136  return new OGRGlobFieldDomain(m_osName, m_osDescription,
1137  m_eFieldType, m_eFieldSubType,
1138  m_osGlob);
1139  }
1140 
1145  const std::string& GetGlob() const { return m_osGlob; }
1146 };
1147 
1148 /************************************************************************/
1149 /* OGRFeatureQuery */
1150 /************************************************************************/
1151 
1153 class OGRLayer;
1154 class swq_expr_node;
1155 class swq_custom_func_registrar;
1156 
1157 class CPL_DLL OGRFeatureQuery
1158 {
1159  private:
1160  OGRFeatureDefn *poTargetDefn;
1161  void *pSWQExpr;
1162 
1163  char **FieldCollector( void *, char ** );
1164 
1165  GIntBig *EvaluateAgainstIndices( swq_expr_node*, OGRLayer *,
1166  GIntBig& nFIDCount );
1167 
1168  int CanUseIndex( swq_expr_node*, OGRLayer * );
1169 
1170  OGRErr Compile( OGRLayer *, OGRFeatureDefn*, const char *,
1171  int bCheck,
1172  swq_custom_func_registrar* poCustomFuncRegistrar );
1173 
1174  CPL_DISALLOW_COPY_ASSIGN(OGRFeatureQuery)
1175 
1176  public:
1177  OGRFeatureQuery();
1178  ~OGRFeatureQuery();
1179 
1180  OGRErr Compile( OGRLayer *, const char *,
1181  int bCheck = TRUE,
1182  swq_custom_func_registrar*
1183  poCustomFuncRegistrar = nullptr );
1184  OGRErr Compile( OGRFeatureDefn *, const char *,
1185  int bCheck = TRUE,
1186  swq_custom_func_registrar*
1187  poCustomFuncRegistrar = nullptr );
1188  int Evaluate( OGRFeature * );
1189 
1190  GIntBig *EvaluateAgainstIndices( OGRLayer *, OGRErr * );
1191 
1192  int CanUseIndex( OGRLayer * );
1193 
1194  char **GetUsedFields();
1195 
1196  void *GetSWQExpr() { return pSWQExpr; }
1197 };
1199 
1200 #endif /* ndef OGR_FEATURE_H_INCLUDED */
Definition of a coded / enumerated field domain.
Definition: ogr_feature.h:979
const OGRCodedValue * GetEnumeration() const
Get the enumeration as (code, value) pairs.
Definition: ogr_feature.h:1016
Definition of a feature class or feature layer.
Definition: ogr_feature.h:279
int Reference()
Increments the reference count by one.
Definition: ogr_feature.h:332
virtual int GetFieldCount() const
Fetch number of fields on this feature.
Definition: ogrfeaturedefn.cpp:269
virtual OGRFieldDefn * GetFieldDefn(int i)
Fetch field definition.
Definition: ogrfeaturedefn.cpp:313
static OGRFeatureDefn * FromHandle(OGRFeatureDefnH hFeatureDefn)
Convert a OGRFeatureDefnH to a OGRFeatureDefn*.
Definition: ogr_feature.h:364
virtual bool IsStyleIgnored() const
Determine whether the style can be omitted when fetching features.
Definition: ogr_feature.h:339
int Dereference()
Decrements the reference count by one.
Definition: ogr_feature.h:333
static OGRFeatureDefnH ToHandle(OGRFeatureDefn *poFeatureDefn)
Convert a OGRFeatureDefn* to a OGRFeatureDefnH.
Definition: ogr_feature.h:358
virtual OGRGeomFieldDefn * GetGeomFieldDefn(int i)
Fetch geometry field definition.
Definition: ogrfeaturedefn.cpp:642
virtual int GetGeomFieldCount() const
Fetch number of geometry fields on this feature.
Definition: ogrfeaturedefn.cpp:593
virtual int GetFieldIndex(const char *) const
Find field by name.
Definition: ogrfeaturedefn.cpp:1182
int GetReferenceCount() const
Fetch current reference count.
Definition: ogr_feature.h:334
virtual int GetGeomFieldIndex(const char *) const
Find geometry field by name.
Definition: ogrfeaturedefn.cpp:879
virtual void SetStyleIgnored(bool bIgnore)
Set whether the style can be omitted when fetching features.
Definition: ogr_feature.h:340
Field value iterator class.
Definition: ogr_feature.h:550
Exception raised by operator[](const char*) when a field is not found.
Definition: ogr_feature.h:591
Field value.
Definition: ogr_feature.h:407
bool empty() const
Return whether the field value is unset/empty.
Definition: ogr_feature.h:467
int GetInteger() const
Return the integer value.
Definition: ogr_feature.h:484
OGRFieldType GetType() const
Return field type.
Definition: ogr_feature.h:461
void Unset()
Unset the field.
Definition: ogr_feature.h:448
const char * GetString() const
Return the string value.
Definition: ogr_feature.h:502
double GetDouble() const
Return the double value.
Definition: ogr_feature.h:496
const char * GetName() const
Return field name.
Definition: ogr_feature.h:459
GIntBig GetInteger64() const
Return the 64-bit integer value.
Definition: ogr_feature.h:490
OGRFieldSubType GetSubType() const
Return field subtype.
Definition: ogr_feature.h:463
A simple feature, including geometry and attributes.
Definition: ogr_feature.h:380
OGRFeatureDefn * GetDefnRef()
Fetch feature definition.
Definition: ogr_feature.h:596
static OGRFeatureH ToHandle(OGRFeature *poFeature)
Convert a OGRFeature* to a OGRFeatureH.
Definition: ogr_feature.h:814
char ** GetFieldAsStringList(const char *pszFName) const
Fetch field value as a list of strings.
Definition: ogr_feature.h:712
virtual OGRStyleTable * GetStyleTable() const
Return style table.
Definition: ogr_feature.h:798
ConstFieldIterator end() const
Return end of field value iterator.
Definition: ogrfeature.cpp:7269
ConstFieldIterator begin() const
Return begin of field value iterator.
Definition: ogrfeature.cpp:7264
void SetField(const char *pszFName, int nCount, const GIntBig *panValues)
Set field to list of 64 bit integers value.
Definition: ogr_feature.h:751
const OGRFeatureDefn * GetDefnRef() const
Fetch feature definition.
Definition: ogr_feature.h:597
OGRFieldDefn * GetFieldDefnRef(int iField)
Fetch definition for this field.
Definition: ogr_feature.h:635
const double * GetFieldAsDoubleList(const char *pszFName, int *pnCount) const
Fetch field value as a list of doubles.
Definition: ogr_feature.h:708
void SetField(const char *pszFName, int nCount, const int *panValues)
Set field to list of integers value.
Definition: ogr_feature.h:748
void SetField(const char *pszFName, GIntBig nValue)
Set field to 64 bit integer value.
Definition: ogr_feature.h:742
void SetField(const char *pszFName, const char *pszValue)
Set field to string value.
Definition: ogr_feature.h:746
void SetField(const char *pszFName, int nValue)
Set field to integer value.
Definition: ogr_feature.h:740
const OGRFieldDefn * GetFieldDefnRef(int iField) const
Fetch definition for this field.
Definition: ogr_feature.h:633
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:761
const OGRGeomFieldDefn * GetGeomFieldDefnRef(int iField) const
Fetch definition for this geometry field.
Definition: ogr_feature.h:613
const char * GetNativeData() const
Returns the native data for the feature.
Definition: ogr_feature.h:802
int GetFieldIndex(const char *pszName) const
Fetch the field index given field name.
Definition: ogr_feature.h:637
static OGRFeature * FromHandle(OGRFeatureH hFeature)
Convert a OGRFeatureH to a OGRFeature*.
Definition: ogr_feature.h:820
int GetGeomFieldIndex(const char *pszName) const
Fetch the geometry field index given geometry field name.
Definition: ogr_feature.h:615
OGRGeomFieldDefn * GetGeomFieldDefnRef(int iField)
Fetch definition for this geometry field.
Definition: ogr_feature.h:611
GIntBig GetFieldAsInteger64(const char *pszFName) const
Fetch field value as integer 64 bit.
Definition: ogr_feature.h:694
const int * GetFieldAsIntegerList(const char *pszFName, int *pnCount) const
Fetch field value as a list of integers.
Definition: ogr_feature.h:700
void SetField(const char *pszFName, double dfValue)
Set field to double value.
Definition: ogr_feature.h:744
const char * GetFieldAsString(const char *pszFName) const
Fetch field value as a string.
Definition: ogr_feature.h:698
void SetField(const char *pszFName, const char *const *papszValues)
Set field to list of strings value.
Definition: ogr_feature.h:757
const OGRField * GetRawFieldRef(int i) const
Fetch a pointer to the internal field value given the index.
Definition: ogr_feature.h:651
int GetFieldAsInteger(const char *pszFName) const
Fetch field value as integer.
Definition: ogr_feature.h:692
const char * GetNativeMediaType() const
Returns the native media type for the feature.
Definition: ogr_feature.h:803
void SetField(const char *pszFName, const OGRField *puValue)
Set field.
Definition: ogr_feature.h:759
GIntBig GetFID() const
Get feature identifier.
Definition: ogr_feature.h:769
OGRField * GetRawFieldRef(int i)
Fetch a pointer to the internal field value given the index.
Definition: ogr_feature.h:650
void SetField(const char *pszFName, int nCount, const double *padfValues)
Set field to list of doubles value.
Definition: ogr_feature.h:754
double GetFieldAsDouble(const char *pszFName) const
Fetch field value as a double.
Definition: ogr_feature.h:696
const GIntBig * GetFieldAsInteger64List(const char *pszFName, int *pnCount) const
Fetch field value as a list of 64 bit integers.
Definition: ogr_feature.h:704
Definition of an attribute of an OGRFeatureDefn.
Definition: ogr_feature.h:99
const char * GetNameRef() const
Fetch name of this field.
Definition: ogr_feature.h:123
int IsNullable() const
Return whether this field can receive null values.
Definition: ogr_feature.h:157
static OGRFieldDefn * FromHandle(OGRFieldDefnH hFieldDefn)
Convert a OGRFieldDefnH to a OGRFieldDefn*.
Definition: ogr_feature.h:177
int IsUnique() const
Return whether this field has a unique constraint.
Definition: ogr_feature.h:160
void SetUnique(int bUniqueIn)
Set whether this field has a unique constraint.
Definition: ogr_feature.h:161
OGRFieldSubType GetSubType() const
Fetch subtype of this field.
Definition: ogr_feature.h:132
OGRJustification GetJustify() const
Get the justification for this field.
Definition: ogr_feature.h:136
void SetIgnored(int bIgnoreIn)
Set whether this field should be omitted when fetching features.
Definition: ogr_feature.h:155
void SetDomainName(const std::string &osDomainName)
Set the name of the field domain for this field.
Definition: ogr_feature.h:164
int GetPrecision() const
Get the formatting precision for this field.
Definition: ogr_feature.h:143
OGRFieldType GetType() const
Fetch type of this field.
Definition: ogr_feature.h:128
void SetWidth(int nWidthIn)
Set the formatting width for this field in characters.
Definition: ogr_feature.h:141
int GetWidth() const
Get the formatting width for this field.
Definition: ogr_feature.h:140
void SetPrecision(int nPrecisionIn)
Set the formatting precision for this field in characters.
Definition: ogr_feature.h:144
void SetNullable(int bNullableIn)
Set whether this field can receive null values.
Definition: ogr_feature.h:158
void SetJustify(OGRJustification eJustifyIn)
Set the justification for this field.
Definition: ogr_feature.h:137
const char * GetAlternativeNameRef() const
Fetch the alternative name (or "alias") for this field.
Definition: ogr_feature.h:126
static OGRFieldDefnH ToHandle(OGRFieldDefn *poFieldDefn)
Convert a OGRFieldDefn* to a OGRFieldDefnH.
Definition: ogr_feature.h:171
const std::string & GetDomainName() const
Return the name of the field domain for this field.
Definition: ogr_feature.h:163
int IsIgnored() const
Return whether this field should be omitted when fetching features.
Definition: ogr_feature.h:154
Definition of a field domain.
Definition: ogr_feature.h:877
OGRFieldDomainMergePolicy GetMergePolicy() const
Get the merge policy.
Definition: ogr_feature.h:963
void SetMergePolicy(OGRFieldDomainMergePolicy policy)
Set the merge policy.
Definition: ogr_feature.h:969
static OGRFieldDomain * FromHandle(OGRFieldDomainH hFieldDomain)
Convert a OGRFieldDomainH to a OGRFieldDomain*.
Definition: ogr_feature.h:944
OGRFieldSubType GetFieldSubType() const
Get the field subtype.
Definition: ogr_feature.h:937
virtual ~OGRFieldDomain()=0
Destructor.
virtual OGRFieldDomain * Clone() const =0
Clone.
OGRFieldDomainSplitPolicy GetSplitPolicy() const
Get the split policy.
Definition: ogr_feature.h:951
static OGRFieldDomainH ToHandle(OGRFieldDomain *poFieldDomain)
Convert a OGRFieldDomain* to a OGRFieldDomainH.
Definition: ogr_feature.h:940
const std::string & GetDescription() const
Get the description of the field domain.
Definition: ogr_feature.h:919
OGRFieldType GetFieldType() const
Get the field type.
Definition: ogr_feature.h:931
OGRFieldDomainType GetDomainType() const
Get the type of the field domain.
Definition: ogr_feature.h:925
const std::string & GetName() const
Get the name of the field domain.
Definition: ogr_feature.h:912
void SetSplitPolicy(OGRFieldDomainSplitPolicy policy)
Set the split policy.
Definition: ogr_feature.h:957
Definition of a geometry field of an OGRFeatureDefn.
Definition: ogr_feature.h:202
void SetIgnored(int bIgnoreIn)
Set whether this field should be omitted when fetching features.
Definition: ogr_feature.h:231
int IsNullable() const
Return whether this geometry field can receive null values.
Definition: ogr_feature.h:233
static OGRGeomFieldDefn * FromHandle(OGRGeomFieldDefnH hGeomFieldDefn)
Convert a OGRGeomFieldDefnH to a OGRGeomFieldDefn*.
Definition: ogr_feature.h:248
void SetNullable(int bNullableIn)
Set whether this geometry field can receive null values.
Definition: ogr_feature.h:234
OGRwkbGeometryType GetType() const
Fetch geometry type of this field.
Definition: ogr_feature.h:224
int IsIgnored() const
Return whether this field should be omitted when fetching features.
Definition: ogr_feature.h:230
static OGRGeomFieldDefnH ToHandle(OGRGeomFieldDefn *poGeomFieldDefn)
Convert a OGRGeomFieldDefn* to a OGRGeomFieldDefnH.
Definition: ogr_feature.h:242
const char * GetNameRef() const
Fetch name of this field.
Definition: ogr_feature.h:222
Abstract base class for all geometry classes.
Definition: ogr_geometry.h:327
Definition of a field domain for field content validated by a glob.
Definition: ogr_feature.h:1111
OGRGlobFieldDomain * Clone() const override
Clone.
Definition: ogr_feature.h:1135
const std::string & GetGlob() const
Get the glob expression.
Definition: ogr_feature.h:1145
This class represents a layer of simple features, with access methods.
Definition: ogrsf_frmts.h:71
Definition of a numeric field domain with a range of validity for values.
Definition: ogr_feature.h:1022
OGRRangeFieldDomain * Clone() const override
Clone.
Definition: ogr_feature.h:1066
const OGRField & GetMin(bool &bIsInclusiveOut) const
Get the minimum value.
Definition: ogr_feature.h:1084
const OGRField & GetMax(bool &bIsInclusiveOut) const
Get the maximum value.
Definition: ogr_feature.h:1100
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:158
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:927
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition: cpl_port.h:1053
#define CPL_WARN_UNUSED_RESULT
Qualifier to warn when the return value of a function is not used.
Definition: cpl_port.h:866
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:203
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition: cpl_port.h:230
#define MAX(a, b)
Macro to compute the maximum of 2 values.
Definition: cpl_port.h:378
void * OGRFieldDefnH
Opaque type for a field definition (OGRFieldDefn)
Definition: ogr_api.h:331
void * OGRFeatureDefnH
Opaque type for a feature definition (OGRFeatureDefn)
Definition: ogr_api.h:333
void * OGRFeatureH
Opaque type for a feature (OGRFeature)
Definition: ogr_api.h:335
struct OGRFieldDomainHS * OGRFieldDomainH
Opaque type for a field domain definition (OGRFieldDomain)
Definition: ogr_api.h:343
struct OGRGeomFieldDefnHS * OGRGeomFieldDefnH
Opaque type for a geometry field definition (OGRGeomFieldDefn)
Definition: ogr_api.h:340
#define OGRUnsetMarker
Special value set in OGRField.Set.nMarker1, nMarker2 and nMarker3 for a unset field.
Definition: ogr_core.h:743
int OGRBoolean
Type for a OGR boolean.
Definition: ogr_core.h:357
OGRFieldSubType
List of field subtypes.
Definition: ogr_core.h:697
OGRFieldDomainMergePolicy
Merge policy for field domains.
Definition: ogr_core.h:1054
@ OFDMP_DEFAULT_VALUE
Default value.
Definition: ogr_core.h:1056
OGRFieldDomainType
Type of field domain.
Definition: ogr_core.h:1020
OGRJustification
Display justification for field values.
Definition: ogr_core.h:721
OGRFieldType
List of feature field types.
Definition: ogr_core.h:669
#define OGRNullMarker
Special value set in OGRField.Set.nMarker1, nMarker2 and nMarker3 for a null field.
Definition: ogr_core.h:751
OGRwkbGeometryType
List of well known binary geometry types.
Definition: ogr_core.h:369
@ wkbUnknown
unknown type, non-standard
Definition: ogr_core.h:370
int OGRErr
Type for a OGR error.
Definition: ogr_core.h:341
OGRFieldDomainSplitPolicy
Split policy for field domains.
Definition: ogr_core.h:1037
@ OFDSP_DEFAULT_VALUE
Default value.
Definition: ogr_core.h:1039
std::unique_ptr< OGRFeature, OGRFeatureUniquePtrDeleter > OGRFeatureUniquePtr
Unique pointer type for OGRFeature.
Definition: ogr_feature.h:837
void * OGRFieldDefnH
Opaque type for a field definition (OGRFieldDefn)
Definition: ogr_feature.h:60
void * OGRFeatureDefnH
Opaque type for a feature definition (OGRFeatureDefn)
Definition: ogr_feature.h:62
void * OGRFeatureH
Opaque type for a feature (OGRFeature)
Definition: ogr_feature.h:64
struct OGRFieldDomainHS * OGRFieldDomainH
Opaque type for a field domain definition (OGRFieldDomain)
Definition: ogr_feature.h:72
struct OGRGeomFieldDefnHS * OGRGeomFieldDefnH
Opaque type for a geometry field definition (OGRGeomFieldDefn)
Definition: ogr_feature.h:69
void * OGRStyleTableH
Opaque type for a style table (OGRStyleTable)
Definition: ogr_feature.h:66
Simple feature style classes.
Simple feature geometry classes.
OGRLayer::FeatureIterator begin(OGRLayer *poLayer)
Return begin of feature iterator.
Definition: ogrsf_frmts.h:289
OGRLayer::FeatureIterator end(OGRLayer *poLayer)
Return end of feature iterator.
Definition: ogrsf_frmts.h:294
Associates a code and a value.
Definition: ogr_core.h:1007
OGRFeature field attribute value union.
Definition: ogr_core.h:761