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
52 
53 #define DEFINE_OGRFeatureH
54 
55 #ifdef DEBUG
56 typedef struct OGRFieldDefnHS *OGRFieldDefnH;
57 typedef struct OGRFeatureDefnHS *OGRFeatureDefnH;
58 typedef struct OGRFeatureHS *OGRFeatureH;
59 typedef struct OGRStyleTableHS *OGRStyleTableH;
60 #else
61 
62 typedef void *OGRFieldDefnH;
64 typedef void *OGRFeatureDefnH;
66 typedef void *OGRFeatureH;
68 typedef void *OGRStyleTableH;
69 #endif
70 
71 typedef struct OGRGeomFieldDefnHS *OGRGeomFieldDefnH;
72 
74 typedef struct OGRFieldDomainHS *OGRFieldDomainH;
75 #endif /* DEFINE_OGRFeatureH */
76 
77 class OGRStyleTable;
78 
79 /************************************************************************/
80 /* OGRFieldDefn */
81 /************************************************************************/
82 
100 class CPL_DLL OGRFieldDefn
101 {
102  private:
103  char *pszName;
104  char *pszAlternativeName;
105  OGRFieldType eType;
106  OGRJustification eJustify;
107  int nWidth; // Zero is variable.
108  int nPrecision;
109  char *pszDefault;
110 
111  int bIgnore;
112  OGRFieldSubType eSubType;
113 
114  int bNullable;
115  int bUnique;
116 
117  std::string m_osDomainName{}; // field domain name. Might be empty
118 
119  public:
120  OGRFieldDefn( const char *, OGRFieldType );
121  explicit OGRFieldDefn( const OGRFieldDefn * );
122  ~OGRFieldDefn();
123 
124  void SetName( const char * );
125  const char *GetNameRef() const { return pszName; }
126 
127  void SetAlternativeName( const char * );
128  const char *GetAlternativeNameRef() const { return pszAlternativeName; }
129 
130  OGRFieldType GetType() const { return eType; }
131  void SetType( OGRFieldType eTypeIn );
132  static const char *GetFieldTypeName( OGRFieldType );
133 
134  OGRFieldSubType GetSubType() const { return eSubType; }
135  void SetSubType( OGRFieldSubType eSubTypeIn );
136  static const char *GetFieldSubTypeName( OGRFieldSubType );
137 
138  OGRJustification GetJustify() const { return eJustify; }
139  void SetJustify( OGRJustification eJustifyIn )
140  { eJustify = eJustifyIn; }
141 
142  int GetWidth() const { return nWidth; }
143  void SetWidth( int nWidthIn ) { nWidth = MAX(0,nWidthIn); }
144 
145  int GetPrecision() const { return nPrecision; }
146  void SetPrecision( int nPrecisionIn )
147  { nPrecision = nPrecisionIn; }
148 
149  void Set( const char *, OGRFieldType, int = 0, int = 0,
150  OGRJustification = OJUndefined );
151 
152  void SetDefault( const char* );
153  const char *GetDefault() const;
154  int IsDefaultDriverSpecific() const;
155 
156  int IsIgnored() const { return bIgnore; }
157  void SetIgnored( int bIgnoreIn ) { bIgnore = bIgnoreIn; }
158 
159  int IsNullable() const { return bNullable; }
160  void SetNullable( int bNullableIn ) { bNullable = bNullableIn; }
161 
162  int IsUnique() const { return bUnique; }
163  void SetUnique( int bUniqueIn ) { bUnique = bUniqueIn; }
164 
165  const std::string& GetDomainName() const { return m_osDomainName; }
166  void SetDomainName(const std::string& osDomainName) { m_osDomainName = osDomainName; }
167 
168  int IsSame( const OGRFieldDefn * ) const;
169 
173  static inline OGRFieldDefnH ToHandle(OGRFieldDefn* poFieldDefn)
174  { return reinterpret_cast<OGRFieldDefnH>(poFieldDefn); }
175 
179  static inline OGRFieldDefn* FromHandle(OGRFieldDefnH hFieldDefn)
180  { return reinterpret_cast<OGRFieldDefn*>(hFieldDefn); }
181  private:
183 };
184 
185 /************************************************************************/
186 /* OGRGeomFieldDefn */
187 /************************************************************************/
188 
203 class CPL_DLL OGRGeomFieldDefn
204 {
205 protected:
207  char *pszName = nullptr;
208  OGRwkbGeometryType eGeomType = wkbUnknown; /* all values possible except wkbNone */
209  mutable OGRSpatialReference* poSRS = nullptr;
210 
211  int bIgnore = false;
212  mutable int bNullable = true;
213 
214  void Initialize( const char *, OGRwkbGeometryType );
216 
217 public:
218  OGRGeomFieldDefn( const char *pszNameIn,
219  OGRwkbGeometryType eGeomTypeIn );
220  explicit OGRGeomFieldDefn( const OGRGeomFieldDefn * );
221  virtual ~OGRGeomFieldDefn();
222 
223  void SetName( const char * );
224  const char *GetNameRef() const { return pszName; }
225 
226  OGRwkbGeometryType GetType() const { return eGeomType; }
227  void SetType( OGRwkbGeometryType eTypeIn );
228 
229  virtual OGRSpatialReference* GetSpatialRef() const;
230  void SetSpatialRef( OGRSpatialReference* poSRSIn );
231 
232  int IsIgnored() const { return bIgnore; }
233  void SetIgnored( int bIgnoreIn ) { bIgnore = bIgnoreIn; }
234 
235  int IsNullable() const { return bNullable; }
236  void SetNullable( int bNullableIn )
237  { bNullable = bNullableIn; }
238 
239  int IsSame( const OGRGeomFieldDefn * ) const;
240 
244  static inline OGRGeomFieldDefnH ToHandle(OGRGeomFieldDefn* poGeomFieldDefn)
245  { return reinterpret_cast<OGRGeomFieldDefnH>(poGeomFieldDefn); }
246 
250  static inline OGRGeomFieldDefn* FromHandle(OGRGeomFieldDefnH hGeomFieldDefn)
251  { return reinterpret_cast<OGRGeomFieldDefn*>(hGeomFieldDefn); }
252  private:
254 };
255 
256 /************************************************************************/
257 /* OGRFeatureDefn */
258 /************************************************************************/
259 
280 class CPL_DLL OGRFeatureDefn
281 {
282  protected:
284  volatile int nRefCount = 0;
285 
286  mutable std::vector<std::unique_ptr<OGRFieldDefn>> apoFieldDefn{};
287  mutable std::vector<std::unique_ptr<OGRGeomFieldDefn>> apoGeomFieldDefn{};
288 
289  char *pszFeatureClassName = nullptr;
290 
291  bool bIgnoreStyle = false;
293 
294  public:
295  explicit OGRFeatureDefn( const char * pszName = nullptr );
296  virtual ~OGRFeatureDefn();
297 
298  void SetName( const char* pszName );
299  virtual const char *GetName() const;
300 
301  virtual int GetFieldCount() const;
302  virtual OGRFieldDefn *GetFieldDefn( int i );
303  virtual const OGRFieldDefn *GetFieldDefn( int i ) const;
304  virtual int GetFieldIndex( const char * ) const;
305  int GetFieldIndexCaseSensitive( const char * ) const;
306 
308  // That method should only be called if there's a guarantee that GetFieldCount() has been called before
309  int GetFieldCountUnsafe() const { return static_cast<int>(apoFieldDefn.size()); }
310 
311  // Those methods don't check i is n range.
312  OGRFieldDefn *GetFieldDefnUnsafe( int i ) { if( apoFieldDefn.empty() ) GetFieldDefn(i); return apoFieldDefn[static_cast<std::size_t>(i)].get(); }
313  const OGRFieldDefn *GetFieldDefnUnsafe( int i ) const { if( apoFieldDefn.empty() ) GetFieldDefn(i); return apoFieldDefn[static_cast<std::size_t>(i)].get(); }
315 
316  virtual void AddFieldDefn( const OGRFieldDefn * );
317  virtual OGRErr DeleteFieldDefn( int iField );
318  virtual OGRErr ReorderFieldDefns( const int* panMap );
319 
320  virtual int GetGeomFieldCount() const;
321  virtual OGRGeomFieldDefn *GetGeomFieldDefn( int i );
322  virtual const OGRGeomFieldDefn *GetGeomFieldDefn( int i ) const;
323  virtual int GetGeomFieldIndex( const char * ) const;
324 
325  virtual void AddGeomFieldDefn( const OGRGeomFieldDefn * );
326  virtual void AddGeomFieldDefn( std::unique_ptr<OGRGeomFieldDefn>&& );
327  virtual OGRErr DeleteGeomFieldDefn( int iGeomField );
328 
329  virtual OGRwkbGeometryType GetGeomType() const;
330  virtual void SetGeomType( OGRwkbGeometryType );
331 
332  virtual OGRFeatureDefn *Clone() const;
333 
334  int Reference() { return CPLAtomicInc(&nRefCount); }
335  int Dereference() { return CPLAtomicDec(&nRefCount); }
336  int GetReferenceCount() const { return nRefCount; }
337  void Release();
338 
339  virtual int IsGeometryIgnored() const;
340  virtual void SetGeometryIgnored( int bIgnore );
341  virtual bool IsStyleIgnored() const { return bIgnoreStyle; }
342  virtual void SetStyleIgnored( bool bIgnore )
343  { bIgnoreStyle = bIgnore; }
344 
345  virtual int IsSame( const OGRFeatureDefn * poOtherFeatureDefn ) const;
346 
348  void ReserveSpaceForFields(int nFieldCountIn);
350 
351  std::vector<int> ComputeMapForSetFrom( const OGRFeatureDefn* poSrcFDefn,
352  bool bForgiving = true ) const;
353 
354  static OGRFeatureDefn *CreateFeatureDefn( const char *pszName = nullptr );
355  static void DestroyFeatureDefn( OGRFeatureDefn * );
356 
360  static inline OGRFeatureDefnH ToHandle(OGRFeatureDefn* poFeatureDefn)
361  { return reinterpret_cast<OGRFeatureDefnH>(poFeatureDefn); }
362 
366  static inline OGRFeatureDefn* FromHandle(OGRFeatureDefnH hFeatureDefn)
367  { return reinterpret_cast<OGRFeatureDefn*>(hFeatureDefn); }
368 
369  private:
371 };
372 
373 /************************************************************************/
374 /* OGRFeature */
375 /************************************************************************/
376 
381 class CPL_DLL OGRFeature
382 {
383  private:
384 
385  GIntBig nFID;
386  OGRFeatureDefn *poDefn;
387  OGRGeometry **papoGeometries;
388  OGRField *pauFields;
389  char *m_pszNativeData;
390  char *m_pszNativeMediaType;
391 
392  bool SetFieldInternal( int i, const OGRField * puValue );
393 
394  protected:
396  mutable char *m_pszStyleString;
397  mutable OGRStyleTable *m_poStyleTable;
398  mutable char *m_pszTmpFieldValue;
400 
401  bool CopySelfTo( OGRFeature *poNew ) const;
402 
403  public:
404  explicit OGRFeature( OGRFeatureDefn * );
405  virtual ~OGRFeature();
406 
408  class CPL_DLL FieldValue
409  {
410  friend class OGRFeature;
411  struct Private;
412  std::unique_ptr<Private> m_poPrivate;
413 
414  FieldValue(OGRFeature* poFeature, int iFieldIndex);
415  FieldValue(const OGRFeature* poFeature, int iFieldIndex);
416  FieldValue(const FieldValue& oOther) = delete;
417  FieldValue& Assign(const FieldValue& oOther);
418 
419  public:
421  ~FieldValue();
422 
423  FieldValue& operator=(FieldValue&& oOther);
425 
427  FieldValue& operator= (const FieldValue& oOther);
429  FieldValue& operator= (int nVal);
431  FieldValue& operator= (GIntBig nVal);
433  FieldValue& operator= (double dfVal);
435  FieldValue& operator= (const char *pszVal);
437  FieldValue& operator= (const std::string& osVal);
439  FieldValue& operator= (const std::vector<int>& oArray);
441  FieldValue& operator= (const std::vector<GIntBig>& oArray);
443  FieldValue& operator= (const std::vector<double>& oArray);
445  FieldValue& operator= (const std::vector<std::string>& oArray);
447  FieldValue& operator= (CSLConstList papszValues);
449  void SetNull();
451  void clear();
453  void Unset() { clear(); }
455  void SetDateTime(int nYear, int nMonth, int nDay,
456  int nHour=0, int nMinute=0, float fSecond=0.f,
457  int nTZFlag = 0 );
458 
460  int GetIndex() const;
462  const OGRFieldDefn* GetDefn() const;
464  const char* GetName() const { return GetDefn()->GetNameRef(); }
466  OGRFieldType GetType() const { return GetDefn()->GetType(); }
468  OGRFieldSubType GetSubType() const { return GetDefn()->GetSubType(); }
469 
471  // cppcheck-suppress functionStatic
472  bool empty() const { return IsUnset(); }
473 
475  // cppcheck-suppress functionStatic
476  bool IsUnset() const;
477 
479  // cppcheck-suppress functionStatic
480  bool IsNull() const;
481 
483  const OGRField *GetRawValue() const;
484 
488  // cppcheck-suppress functionStatic
489  int GetInteger() const { return GetRawValue()->Integer; }
490 
494  // cppcheck-suppress functionStatic
495  GIntBig GetInteger64() const { return GetRawValue()->Integer64; }
496 
500  // cppcheck-suppress functionStatic
501  double GetDouble() const { return GetRawValue()->Real; }
502 
506  // cppcheck-suppress functionStatic
507  const char* GetString() const { return GetRawValue()->String; }
508 
510  bool GetDateTime( int *pnYear, int *pnMonth,
511  int *pnDay,
512  int *pnHour, int *pnMinute,
513  float *pfSecond,
514  int *pnTZFlag ) const;
515 
517  operator int () const { return GetAsInteger(); }
519  operator GIntBig() const { return GetAsInteger64(); }
521  operator double () const { return GetAsDouble(); }
523  operator const char*() const { return GetAsString(); }
525  operator const std::vector<int>& () const { return GetAsIntegerList(); }
527  operator const std::vector<GIntBig>& () const { return GetAsInteger64List(); }
529  operator const std::vector<double>& () const { return GetAsDoubleList(); }
531  operator const std::vector<std::string>& () const { return GetAsStringList(); }
533  operator CSLConstList () const;
534 
536  int GetAsInteger() const;
538  GIntBig GetAsInteger64() const;
540  double GetAsDouble() const;
542  const char* GetAsString() const;
544  const std::vector<int>& GetAsIntegerList() const;
546  const std::vector<GIntBig>& GetAsInteger64List() const;
548  const std::vector<double>& GetAsDoubleList() const;
550  const std::vector<std::string>& GetAsStringList() const;
551  };
552 
554  class CPL_DLL ConstFieldIterator
555  {
556  friend class OGRFeature;
557  struct Private;
558  std::unique_ptr<Private> m_poPrivate;
559 
560  ConstFieldIterator(const OGRFeature* poSelf, int nPos);
561 
562  public:
564  ConstFieldIterator(ConstFieldIterator&& oOther) noexcept; // declared but not defined. Needed for gcc 5.4 at least
566  const FieldValue& operator*() const;
567  ConstFieldIterator& operator++();
568  bool operator!=(const ConstFieldIterator& it) const;
570  };
571 
588  ConstFieldIterator begin() const;
590  ConstFieldIterator end() const;
591 
592  const FieldValue operator[](int iField) const;
593  FieldValue operator[](int iField);
594 
596  class FieldNotFoundException: public std::exception {};
597 
598  const FieldValue operator[](const char* pszFieldName) const;
599  FieldValue operator[](const char* pszFieldName);
600 
601  OGRFeatureDefn *GetDefnRef() { return poDefn; }
602  const OGRFeatureDefn *GetDefnRef() const { return poDefn; }
603 
605  void SetFDefnUnsafe( OGRFeatureDefn* poNewFDefn );
607 
608  OGRErr SetGeometryDirectly( OGRGeometry * );
609  OGRErr SetGeometry( const OGRGeometry * );
610  OGRGeometry *GetGeometryRef();
611  const OGRGeometry *GetGeometryRef() const;
612  OGRGeometry *StealGeometry() CPL_WARN_UNUSED_RESULT;
613 
614  int GetGeomFieldCount() const
615  { return poDefn->GetGeomFieldCount(); }
617  { return poDefn->GetGeomFieldDefn(iField); }
618  const OGRGeomFieldDefn *GetGeomFieldDefnRef( int iField ) const
619  { return poDefn->GetGeomFieldDefn(iField); }
620  int GetGeomFieldIndex( const char * pszName ) const
621  { return poDefn->GetGeomFieldIndex(pszName); }
622 
623  OGRGeometry* GetGeomFieldRef( int iField );
624  const OGRGeometry* GetGeomFieldRef( int iField ) const;
625  OGRGeometry* StealGeometry( int iField );
626  OGRGeometry* GetGeomFieldRef( const char* pszFName );
627  const OGRGeometry* GetGeomFieldRef( const char* pszFName ) const;
628  OGRErr SetGeomFieldDirectly( int iField, OGRGeometry * );
629  OGRErr SetGeomField( int iField, const OGRGeometry * );
630 
631  void Reset();
632 
633  OGRFeature *Clone() const CPL_WARN_UNUSED_RESULT;
634  virtual OGRBoolean Equal( const OGRFeature * poFeature ) const;
635 
636  int GetFieldCount() const
637  { return poDefn->GetFieldCount(); }
638  const OGRFieldDefn *GetFieldDefnRef( int iField ) const
639  { return poDefn->GetFieldDefn(iField); }
641  { return poDefn->GetFieldDefn(iField); }
642  int GetFieldIndex( const char * pszName ) const
643  { return poDefn->GetFieldIndex(pszName); }
644 
645  int IsFieldSet( int iField ) const;
646 
647  void UnsetField( int iField );
648 
649  bool IsFieldNull( int iField ) const;
650 
651  void SetFieldNull( int iField );
652 
653  bool IsFieldSetAndNotNull( int iField ) const;
654 
655  OGRField *GetRawFieldRef( int i ) { return pauFields + i; }
656  const OGRField *GetRawFieldRef( int i ) const { return pauFields + i; }
657 
658  int GetFieldAsInteger( int i ) const;
659  GIntBig GetFieldAsInteger64( int i ) const;
660  double GetFieldAsDouble( int i ) const;
661  const char *GetFieldAsString( int i ) const;
662  const int *GetFieldAsIntegerList( int i, int *pnCount ) const;
663  const GIntBig *GetFieldAsInteger64List( int i, int *pnCount ) const;
664  const double *GetFieldAsDoubleList( int i, int *pnCount ) const;
665  char **GetFieldAsStringList( int i ) const;
666  GByte *GetFieldAsBinary( int i, int *pnCount ) const;
667  int GetFieldAsDateTime( int i,
668  int *pnYear, int *pnMonth,
669  int *pnDay,
670  int *pnHour, int *pnMinute,
671  int *pnSecond,
672  int *pnTZFlag ) const;
673  int GetFieldAsDateTime( int i,
674  int *pnYear, int *pnMonth,
675  int *pnDay,
676  int *pnHour, int *pnMinute,
677  float *pfSecond,
678  int *pnTZFlag ) const;
679  char *GetFieldAsSerializedJSon( int i ) const;
680 
682  bool IsFieldSetUnsafe( int i ) const { return !(pauFields[i].Set.nMarker1 == OGRUnsetMarker &&
683  pauFields[i].Set.nMarker2 == OGRUnsetMarker &&
684  pauFields[i].Set.nMarker3 == OGRUnsetMarker); }
685  bool IsFieldNullUnsafe( int i ) const { return (pauFields[i].Set.nMarker1 == OGRNullMarker &&
686  pauFields[i].Set.nMarker2 == OGRNullMarker &&
687  pauFields[i].Set.nMarker3 == OGRNullMarker); }
688  bool IsFieldSetAndNotNullUnsafe( int i ) const { return IsFieldSetUnsafe(i) && !IsFieldNullUnsafe(i); }
689  // Those methods should only be called on a field that is of the type
690  // consistent with the value, and that is set.
691  int GetFieldAsIntegerUnsafe( int i ) const { return pauFields[i].Integer; }
692  GIntBig GetFieldAsInteger64Unsafe( int i ) const { return pauFields[i].Integer64; }
693  double GetFieldAsDoubleUnsafe( int i ) const { return pauFields[i].Real; }
694  const char* GetFieldAsStringUnsafe( int i) const { return pauFields[i].String; }
696 
697  int GetFieldAsInteger( const char *pszFName ) const
698  { return GetFieldAsInteger( GetFieldIndex(pszFName) ); }
699  GIntBig GetFieldAsInteger64( const char *pszFName ) const
700  { return GetFieldAsInteger64( GetFieldIndex(pszFName) ); }
701  double GetFieldAsDouble( const char *pszFName ) const
702  { return GetFieldAsDouble( GetFieldIndex(pszFName) ); }
703  const char *GetFieldAsString( const char *pszFName ) const
704  { return GetFieldAsString( GetFieldIndex(pszFName) ); }
705  const int *GetFieldAsIntegerList( const char *pszFName,
706  int *pnCount ) const
707  { return GetFieldAsIntegerList( GetFieldIndex(pszFName),
708  pnCount ); }
709  const GIntBig *GetFieldAsInteger64List( const char *pszFName,
710  int *pnCount ) const
711  { return GetFieldAsInteger64List( GetFieldIndex(pszFName),
712  pnCount ); }
713  const double *GetFieldAsDoubleList( const char *pszFName,
714  int *pnCount ) const
715  { return GetFieldAsDoubleList( GetFieldIndex(pszFName),
716  pnCount ); }
717  char **GetFieldAsStringList( const char *pszFName ) const
718  { return GetFieldAsStringList(GetFieldIndex(pszFName)); }
719 
720  void SetField( int i, int nValue );
721  void SetField( int i, GIntBig nValue );
722  void SetField( int i, double dfValue );
723  void SetField( int i, const char * pszValue );
724  void SetField( int i, int nCount, const int * panValues );
725  void SetField( int i, int nCount,
726  const GIntBig * panValues );
727  void SetField( int i, int nCount, const double * padfValues );
728  void SetField( int i, const char * const * papszValues );
729  void SetField( int i, const OGRField * puValue );
730  void SetField( int i, int nCount, const void * pabyBinary );
731  void SetField( int i, int nYear, int nMonth, int nDay,
732  int nHour=0, int nMinute=0, float fSecond=0.f,
733  int nTZFlag = 0 );
734 
736  // Those methods should only be called on a field that is of the type
737  // consistent with the value, and in a unset state.
738  void SetFieldSameTypeUnsafe( int i, int nValue ) {
739  pauFields[i].Integer = nValue; pauFields[i].Set.nMarker2 = 0; pauFields[i].Set.nMarker3 = 0; }
740  void SetFieldSameTypeUnsafe( int i, GIntBig nValue ) { pauFields[i].Integer64 = nValue; }
741  void SetFieldSameTypeUnsafe( int i, double dfValue ) { pauFields[i].Real = dfValue; }
742  void SetFieldSameTypeUnsafe( int i, char* pszValueTransferred ) { pauFields[i].String = pszValueTransferred; }
744 
745  void SetField( const char *pszFName, int nValue )
746  { SetField( GetFieldIndex(pszFName), nValue ); }
747  void SetField( const char *pszFName, GIntBig nValue )
748  { SetField( GetFieldIndex(pszFName), nValue ); }
749  void SetField( const char *pszFName, double dfValue )
750  { SetField( GetFieldIndex(pszFName), dfValue ); }
751  void SetField( const char *pszFName, const char * pszValue )
752  { SetField( GetFieldIndex(pszFName), pszValue ); }
753  void SetField( const char *pszFName, int nCount,
754  const int * panValues )
755  { SetField(GetFieldIndex(pszFName),nCount,panValues); }
756  void SetField( const char *pszFName, int nCount,
757  const GIntBig * panValues )
758  { SetField(GetFieldIndex(pszFName),nCount,panValues); }
759  void SetField( const char *pszFName, int nCount,
760  const double * padfValues )
761  {SetField(GetFieldIndex(pszFName),nCount,padfValues); }
762  void SetField( const char *pszFName, const char * const * papszValues )
763  { SetField( GetFieldIndex(pszFName), papszValues); }
764  void SetField( const char *pszFName, const OGRField * puValue )
765  { SetField( GetFieldIndex(pszFName), puValue ); }
766  void SetField( const char *pszFName,
767  int nYear, int nMonth, int nDay,
768  int nHour=0, int nMinute=0, float fSecond=0.f,
769  int nTZFlag = 0 )
770  { SetField( GetFieldIndex(pszFName),
771  nYear, nMonth, nDay,
772  nHour, nMinute, fSecond, nTZFlag ); }
773 
774  GIntBig GetFID() const { return nFID; }
775  virtual OGRErr SetFID( GIntBig nFIDIn );
776 
777  void DumpReadable( FILE *, char** papszOptions = nullptr ) const;
778 
779  OGRErr SetFrom( const OGRFeature *, int = TRUE );
780  OGRErr SetFrom( const OGRFeature *, const int *, int = TRUE );
781  OGRErr SetFieldsFrom( const OGRFeature *, const int *, int = TRUE );
782 
784  OGRErr RemapFields( OGRFeatureDefn *poNewDefn,
785  const int *panRemapSource );
786  void AppendField();
787  OGRErr RemapGeomFields( OGRFeatureDefn *poNewDefn,
788  const int *panRemapSource );
790 
791  int Validate( int nValidateFlags,
792  int bEmitError ) const;
793  void FillUnsetWithDefault( int bNotNullableOnly,
794  char** papszOptions );
795 
796  virtual const char *GetStyleString() const;
797  virtual void SetStyleString( const char * );
798  virtual void SetStyleStringDirectly( char * );
799 
803  virtual OGRStyleTable *GetStyleTable() const { return m_poStyleTable; } /* f.i.x.m.e: add a const qualifier for return type */
804  virtual void SetStyleTable( OGRStyleTable *poStyleTable );
805  virtual void SetStyleTableDirectly( OGRStyleTable *poStyleTable );
806 
807  const char *GetNativeData() const { return m_pszNativeData; }
808  const char *GetNativeMediaType() const
809  { return m_pszNativeMediaType; }
810  void SetNativeData( const char* pszNativeData );
811  void SetNativeMediaType( const char* pszNativeMediaType );
812 
813  static OGRFeature *CreateFeature( OGRFeatureDefn * );
814  static void DestroyFeature( OGRFeature * );
815 
819  static inline OGRFeatureH ToHandle(OGRFeature* poFeature)
820  { return reinterpret_cast<OGRFeatureH>(poFeature); }
821 
825  static inline OGRFeature* FromHandle(OGRFeatureH hFeature)
826  { return reinterpret_cast<OGRFeature*>(hFeature); }
827 
828  private:
830 };
831 
833 struct CPL_DLL OGRFeatureUniquePtrDeleter
834 {
835  void operator()(OGRFeature*) const;
836 };
838 
842 typedef std::unique_ptr<OGRFeature, OGRFeatureUniquePtrDeleter> OGRFeatureUniquePtr;
843 
845 
846 inline OGRFeature::ConstFieldIterator begin(const OGRFeature* poFeature) { return poFeature->begin(); }
848 inline OGRFeature::ConstFieldIterator end(const OGRFeature* poFeature) { return poFeature->end(); }
849 
851 inline OGRFeature::ConstFieldIterator begin(const OGRFeatureUniquePtr& poFeature) { return poFeature->begin(); }
853 inline OGRFeature::ConstFieldIterator end(const OGRFeatureUniquePtr& poFeature) { return poFeature->end(); }
854 
856 
857 /************************************************************************/
858 /* OGRFieldDomain */
859 /************************************************************************/
860 
881 class CPL_DLL OGRFieldDomain
882 {
883 protected:
885  std::string m_osName;
886  std::string m_osDescription;
887  OGRFieldDomainType m_eDomainType;
888  OGRFieldType m_eFieldType;
889  OGRFieldSubType m_eFieldSubType;
892 
893  OGRFieldDomain(const std::string& osName,
894  const std::string& osDescription,
895  OGRFieldDomainType eDomainType,
896  OGRFieldType eFieldType,
897  OGRFieldSubType eFieldSubType);
900 public:
905  virtual ~OGRFieldDomain() = 0;
906 
911  virtual OGRFieldDomain* Clone() const = 0;
912 
917  const std::string& GetName() const { return m_osName; }
918 
924  const std::string& GetDescription() const { return m_osDescription; }
925 
930  OGRFieldDomainType GetDomainType() const { return m_eDomainType; }
931 
936  OGRFieldType GetFieldType() const { return m_eFieldType; }
937 
942  OGRFieldSubType GetFieldSubType() const { return m_eFieldSubType; }
943 
945  static inline OGRFieldDomainH ToHandle(OGRFieldDomain* poFieldDomain)
946  { return reinterpret_cast<OGRFieldDomainH>(poFieldDomain); }
947 
949  static inline OGRFieldDomain* FromHandle(OGRFieldDomainH hFieldDomain)
950  { return reinterpret_cast<OGRFieldDomain*>(hFieldDomain); }
951 
956  OGRFieldDomainSplitPolicy GetSplitPolicy() const { return m_eSplitPolicy; }
957 
962  void SetSplitPolicy(OGRFieldDomainSplitPolicy policy) { m_eSplitPolicy = policy; }
963 
968  OGRFieldDomainMergePolicy GetMergePolicy() const { return m_eMergePolicy; }
969 
974  void SetMergePolicy(OGRFieldDomainMergePolicy policy) { m_eMergePolicy = policy; }
975 };
976 
983 class CPL_DLL OGRCodedFieldDomain final: public OGRFieldDomain
984 {
985 private:
986  std::vector<OGRCodedValue> m_asValues{};
987 
988  OGRCodedFieldDomain(const OGRCodedFieldDomain&) = delete;
989  OGRCodedFieldDomain& operator= (const OGRCodedFieldDomain&) = delete;
990 
991 public:
1006  OGRCodedFieldDomain(const std::string& osName,
1007  const std::string& osDescription,
1008  OGRFieldType eFieldType,
1009  OGRFieldSubType eFieldSubType,
1010  std::vector<OGRCodedValue>&& asValues);
1011 
1012  ~OGRCodedFieldDomain() override;
1013 
1014  OGRCodedFieldDomain* Clone() const override;
1015 
1021  const OGRCodedValue* GetEnumeration() const { return m_asValues.data(); }
1022 };
1023 
1026 class CPL_DLL OGRRangeFieldDomain final: public OGRFieldDomain
1027 {
1028 private:
1029  OGRField m_sMin;
1030  OGRField m_sMax;
1031  bool m_bMinIsInclusive;
1032  bool m_bMaxIsInclusive;
1033 
1034  OGRRangeFieldDomain(const OGRRangeFieldDomain&) = delete;
1035  OGRRangeFieldDomain& operator= (const OGRRangeFieldDomain&) = delete;
1036 
1037 public:
1062  OGRRangeFieldDomain(const std::string& osName,
1063  const std::string& osDescription,
1064  OGRFieldType eFieldType,
1065  OGRFieldSubType eFieldSubType,
1066  const OGRField& sMin,
1067  bool bMinIsInclusive,
1068  const OGRField& sMax,
1069  bool bMaxIsInclusive);
1070 
1071  OGRRangeFieldDomain* Clone() const override {
1072  auto poDomain = new OGRRangeFieldDomain(m_osName, m_osDescription,
1073  m_eFieldType, m_eFieldSubType,
1074  m_sMin, m_bMinIsInclusive,
1075  m_sMax, m_bMaxIsInclusive);
1076  poDomain->SetMergePolicy(m_eMergePolicy);
1077  poDomain->SetSplitPolicy(m_eSplitPolicy);
1078  return poDomain;
1079  }
1080 
1092  const OGRField& GetMin(bool& bIsInclusiveOut) const {
1093  bIsInclusiveOut = m_bMinIsInclusive;
1094  return m_sMin;
1095  }
1096 
1108  const OGRField& GetMax(bool& bIsInclusiveOut) const {
1109  bIsInclusiveOut = m_bMaxIsInclusive;
1110  return m_sMax;
1111  }
1112 };
1113 
1118 class CPL_DLL OGRGlobFieldDomain final: public OGRFieldDomain
1119 {
1120 private:
1121  std::string m_osGlob;
1122 
1123  OGRGlobFieldDomain(const OGRGlobFieldDomain&) = delete;
1124  OGRGlobFieldDomain& operator= (const OGRGlobFieldDomain&) = delete;
1125 
1126 public:
1137  OGRGlobFieldDomain(const std::string& osName,
1138  const std::string& osDescription,
1139  OGRFieldType eFieldType,
1140  OGRFieldSubType eFieldSubType,
1141  const std::string& osBlob);
1142 
1143  OGRGlobFieldDomain* Clone() const override {
1144  auto poDomain = new OGRGlobFieldDomain(m_osName, m_osDescription,
1145  m_eFieldType, m_eFieldSubType,
1146  m_osGlob);
1147  poDomain->SetMergePolicy(m_eMergePolicy);
1148  poDomain->SetSplitPolicy(m_eSplitPolicy);
1149  return poDomain;
1150  }
1151 
1156  const std::string& GetGlob() const { return m_osGlob; }
1157 };
1158 
1159 /************************************************************************/
1160 /* OGRFeatureQuery */
1161 /************************************************************************/
1162 
1164 class OGRLayer;
1165 class swq_expr_node;
1166 class swq_custom_func_registrar;
1167 
1168 class CPL_DLL OGRFeatureQuery
1169 {
1170  private:
1171  OGRFeatureDefn *poTargetDefn;
1172  void *pSWQExpr;
1173 
1174  char **FieldCollector( void *, char ** );
1175 
1176  GIntBig *EvaluateAgainstIndices( swq_expr_node*, OGRLayer *,
1177  GIntBig& nFIDCount );
1178 
1179  int CanUseIndex( swq_expr_node*, OGRLayer * );
1180 
1181  OGRErr Compile( OGRLayer *, OGRFeatureDefn*, const char *,
1182  int bCheck,
1183  swq_custom_func_registrar* poCustomFuncRegistrar );
1184 
1185  CPL_DISALLOW_COPY_ASSIGN(OGRFeatureQuery)
1186 
1187  public:
1188  OGRFeatureQuery();
1189  ~OGRFeatureQuery();
1190 
1191  OGRErr Compile( OGRLayer *, const char *,
1192  int bCheck = TRUE,
1193  swq_custom_func_registrar*
1194  poCustomFuncRegistrar = nullptr );
1195  OGRErr Compile( OGRFeatureDefn *, const char *,
1196  int bCheck = TRUE,
1197  swq_custom_func_registrar*
1198  poCustomFuncRegistrar = nullptr );
1199  int Evaluate( OGRFeature * );
1200 
1201  GIntBig *EvaluateAgainstIndices( OGRLayer *, OGRErr * );
1202 
1203  int CanUseIndex( OGRLayer * );
1204 
1205  char **GetUsedFields();
1206 
1207  void *GetSWQExpr() { return pSWQExpr; }
1208 };
1210 
1211 #endif /* ndef OGR_FEATURE_H_INCLUDED */
MAX
#define MAX(a, b)
Macro to compute the maximum of 2 values.
Definition: cpl_port.h:381
OGRNullMarker
#define OGRNullMarker
Special value set in OGRField.Set.nMarker1, nMarker2 and nMarker3 for a null field.
Definition: ogr_core.h:792
OGRFeature::GetFieldAsDoubleList
const double * GetFieldAsDoubleList(const char *pszFName, int *pnCount) const
Fetch field value as a list of doubles.
Definition: ogr_feature.h:713
OGRFeature::FieldValue::GetString
const char * GetString() const
Return the string value.
Definition: ogr_feature.h:507
OGRFeatureDefn::FromHandle
static OGRFeatureDefn * FromHandle(OGRFeatureDefnH hFeatureDefn)
Convert a OGRFeatureDefnH to a OGRFeatureDefn*.
Definition: ogr_feature.h:366
OGRFeature::FieldValue::GetSubType
OGRFieldSubType GetSubType() const
Return field subtype.
Definition: ogr_feature.h:468
OGRFieldDomain::GetSplitPolicy
OGRFieldDomainSplitPolicy GetSplitPolicy() const
Get the split policy.
Definition: ogr_feature.h:956
OGRFieldDomainMergePolicy
OGRFieldDomainMergePolicy
Merge policy for field domains.
Definition: ogr_core.h:1099
OGRFeatureDefn::IsStyleIgnored
virtual bool IsStyleIgnored() const
Determine whether the style can be omitted when fetching features.
Definition: ogr_feature.h:341
OFDSP_DEFAULT_VALUE
@ OFDSP_DEFAULT_VALUE
Default value.
Definition: ogr_core.h:1085
OGRFieldDomainType
OGRFieldDomainType
Type of field domain.
Definition: ogr_core.h:1065
GByte
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:203
OGRFieldDefnH
void * OGRFieldDefnH
Opaque type for a field definition (OGRFieldDefn)
Definition: ogr_feature.h:62
OGRFeature::FieldNotFoundException
Exception raised by operator[](const char*) when a field is not found.
Definition: ogr_feature.h:596
OGRCodedFieldDomain::GetEnumeration
const OGRCodedValue * GetEnumeration() const
Get the enumeration as (code, value) pairs.
Definition: ogr_feature.h:1021
OGRFeature::SetField
void SetField(const char *pszFName, GIntBig nValue)
Set field to 64 bit integer value. OFTInteger, OFTInteger64 and OFTReal fields will be set directly....
Definition: ogr_feature.h:747
OGRFeature::GetFieldAsStringList
char ** GetFieldAsStringList(const char *pszFName) const
Fetch field value as a list of strings.
Definition: ogr_feature.h:717
OGRFieldDefn::GetDomainName
const std::string & GetDomainName() const
Return the name of the field domain for this field.
Definition: ogr_feature.h:165
OGRFeature::ConstFieldIterator
Field value iterator class.
Definition: ogr_feature.h:554
OGRFieldDefn::SetDomainName
void SetDomainName(const std::string &osDomainName)
Set the name of the field domain for this field.
Definition: ogr_feature.h:166
OGRFeature::GetStyleTable
virtual OGRStyleTable * GetStyleTable() const
Return style table.
Definition: ogr_feature.h:803
OGRFieldDefn::SetJustify
void SetJustify(OGRJustification eJustifyIn)
Set the justification for this field.
Definition: ogr_feature.h:139
begin
OGRLayer::FeatureIterator begin(OGRLayer *poLayer)
Return begin of feature iterator.
Definition: ogrsf_frmts.h:325
OGRFeature::FieldValue::GetType
OGRFieldType GetType() const
Return field type.
Definition: ogr_feature.h:466
OGRGeomFieldDefn::SetIgnored
void SetIgnored(int bIgnoreIn)
Set whether this field should be omitted when fetching features.
Definition: ogr_feature.h:233
OGRStyleTable
This class represents a style table.
Definition: ogr_featurestyle.h:84
OGRFieldDomain::SetMergePolicy
void SetMergePolicy(OGRFieldDomainMergePolicy policy)
Set the merge policy.
Definition: ogr_feature.h:974
OGRFieldDefn::SetIgnored
void SetIgnored(int bIgnoreIn)
Set whether this field should be omitted when fetching features.
Definition: ogr_feature.h:157
OGRFeature::ToHandle
static OGRFeatureH ToHandle(OGRFeature *poFeature)
Convert a OGRFeature* to a OGRFeatureH.
Definition: ogr_feature.h:819
OGRFeature::FieldValue::GetName
const char * GetName() const
Return field name.
Definition: ogr_feature.h:464
OGRFeatureDefn::GetGeomFieldIndex
virtual int GetGeomFieldIndex(const char *) const
Find geometry field by name.
Definition: ogrfeaturedefn.cpp:878
OGRFeature::GetFieldDefnRef
OGRFieldDefn * GetFieldDefnRef(int iField)
Fetch definition for this field.
Definition: ogr_feature.h:640
OGRFieldDefn::GetWidth
int GetWidth() const
Get the formatting width for this field.
Definition: ogr_feature.h:142
OGRSpatialReference
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:157
OGRGeomFieldDefnH
struct OGRGeomFieldDefnHS * OGRGeomFieldDefnH
Opaque type for a geometry field definition (OGRGeomFieldDefn)
Definition: ogr_feature.h:71
OGRStyleTableH
void * OGRStyleTableH
Opaque type for a style table (OGRStyleTable)
Definition: ogr_feature.h:68
OGRFieldDomain::FromHandle
static OGRFieldDomain * FromHandle(OGRFieldDomainH hFieldDomain)
Convert a OGRFieldDomainH to a OGRFieldDomain*.
Definition: ogr_feature.h:949
OGRFeatureH
void * OGRFeatureH
Opaque type for a feature (OGRFeature)
Definition: ogr_feature.h:66
OGRFieldDomain::SetSplitPolicy
void SetSplitPolicy(OGRFieldDomainSplitPolicy policy)
Set the split policy.
Definition: ogr_feature.h:962
OGRFeature::SetField
void SetField(const char *pszFName, const OGRField *puValue)
Set field.
Definition: ogr_feature.h:764
OGRRangeFieldDomain::GetMin
const OGRField & GetMin(bool &bIsInclusiveOut) const
Get the minimum value.
Definition: ogr_feature.h:1092
OGRFeature::GetFieldAsDouble
double GetFieldAsDouble(const char *pszFName) const
Fetch field value as a double.
Definition: ogr_feature.h:701
OGRGeometry
Abstract base class for all geometry classes.
Definition: ogr_geometry.h:326
OGRFieldDomain::GetDescription
const std::string & GetDescription() const
Get the description of the field domain.
Definition: ogr_feature.h:924
OGRFieldDomain::Clone
virtual OGRFieldDomain * Clone() const =0
Clone.
OGRFeature::GetGeomFieldDefnRef
OGRGeomFieldDefn * GetGeomFieldDefnRef(int iField)
Fetch definition for this geometry field.
Definition: ogr_feature.h:616
OGRLayer
This class represents a layer of simple features, with access methods.
Definition: ogrsf_frmts.h:72
OGRFeature::FieldValue::empty
bool empty() const
Return whether the field value is unset/empty.
Definition: ogr_feature.h:472
OFDMP_DEFAULT_VALUE
@ OFDMP_DEFAULT_VALUE
Default value.
Definition: ogr_core.h:1102
OGRGeomFieldDefn::ToHandle
static OGRGeomFieldDefnH ToHandle(OGRGeomFieldDefn *poGeomFieldDefn)
Convert a OGRGeomFieldDefn* to a OGRGeomFieldDefnH.
Definition: ogr_feature.h:244
OGRFieldDefn::GetPrecision
int GetPrecision() const
Get the formatting precision for this field. This should normally be zero for fields of types other t...
Definition: ogr_feature.h:145
ogr_geometry.h
OGRGeomFieldDefn::GetNameRef
const char * GetNameRef() const
Fetch name of this field.
Definition: ogr_feature.h:224
OGRGeomFieldDefn::IsIgnored
int IsIgnored() const
Return whether this field should be omitted when fetching features.
Definition: ogr_feature.h:232
OGRFeatureUniquePtr
std::unique_ptr< OGRFeature, OGRFeatureUniquePtrDeleter > OGRFeatureUniquePtr
Unique pointer type for OGRFeature.
Definition: ogr_feature.h:842
OGRRangeFieldDomain::GetMax
const OGRField & GetMax(bool &bIsInclusiveOut) const
Get the maximum value.
Definition: ogr_feature.h:1108
OGRFeatureH
void * OGRFeatureH
Opaque type for a feature (OGRFeature)
Definition: ogr_api.h:337
OGRFeature::GetGeomFieldIndex
int GetGeomFieldIndex(const char *pszName) const
Fetch the geometry field index given geometry field name.
Definition: ogr_feature.h:620
OGRFieldDefn::GetNameRef
const char * GetNameRef() const
Fetch name of this field.
Definition: ogr_feature.h:125
OGRBoolean
int OGRBoolean
Type for a OGR boolean.
Definition: ogr_core.h:357
OGRFeatureDefnH
void * OGRFeatureDefnH
Opaque type for a feature definition (OGRFeatureDefn)
Definition: ogr_api.h:335
OGRFieldDefn::SetPrecision
void SetPrecision(int nPrecisionIn)
Set the formatting precision for this field in characters.
Definition: ogr_feature.h:146
OGRFeatureDefn::GetFieldDefn
virtual OGRFieldDefn * GetFieldDefn(int i)
Fetch field definition.
Definition: ogrfeaturedefn.cpp:312
OGRFeature::FieldValue
Field value.
Definition: ogr_feature.h:408
OGRGeomFieldDefnH
struct OGRGeomFieldDefnHS * OGRGeomFieldDefnH
Opaque type for a geometry field definition (OGRGeomFieldDefn)
Definition: ogr_api.h:342
OGRFeature::begin
ConstFieldIterator begin() const
Return begin of field value iterator.
Definition: ogrfeature.cpp:7277
OGRFieldDomain::GetMergePolicy
OGRFieldDomainMergePolicy GetMergePolicy() const
Get the merge policy.
Definition: ogr_feature.h:968
OGRFieldDefn::IsUnique
int IsUnique() const
Return whether this field has a unique constraint.
Definition: ogr_feature.h:162
OGRGlobFieldDomain
Definition of a field domain for field content validated by a glob.
Definition: ogr_feature.h:1118
OGRField
OGRFeature field attribute value union.
Definition: ogr_core.h:802
OGRFeature::GetDefnRef
OGRFeatureDefn * GetDefnRef()
Fetch feature definition.
Definition: ogr_feature.h:601
OGRFeatureDefn::GetGeomFieldDefn
virtual OGRGeomFieldDefn * GetGeomFieldDefn(int i)
Fetch geometry field definition.
Definition: ogrfeaturedefn.cpp:641
OGRFeature::SetField
void SetField(const char *pszFName, int nCount, const double *padfValues)
Set field to list of doubles value.
Definition: ogr_feature.h:759
OGRCodedValue
Associates a code and a value.
Definition: ogr_core.h:1052
OGRFeature::GetFieldIndex
int GetFieldIndex(const char *pszName) const
Fetch the field index given field name.
Definition: ogr_feature.h:642
CSLConstList
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition: cpl_port.h:1056
OGRFeature::FieldValue::Unset
void Unset()
Unset the field.
Definition: ogr_feature.h:453
OGRFeatureDefn::GetFieldCount
virtual int GetFieldCount() const
Fetch number of fields on this feature.
Definition: ogrfeaturedefn.cpp:268
OGRFeature::SetField
void SetField(const char *pszFName, const char *pszValue)
Set field to string value.
Definition: ogr_feature.h:751
OGRFieldDomain::GetName
const std::string & GetName() const
Get the name of the field domain.
Definition: ogr_feature.h:917
OGRFeature::SetField
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:766
OGRFieldDefn::FromHandle
static OGRFieldDefn * FromHandle(OGRFieldDefnH hFieldDefn)
Convert a OGRFieldDefnH to a OGRFieldDefn*.
Definition: ogr_feature.h:179
OGRFieldDomainH
struct OGRFieldDomainHS * OGRFieldDomainH
Opaque type for a field domain definition (OGRFieldDomain)
Definition: ogr_api.h:345
OGRFieldDefn
Definition of an attribute of an OGRFeatureDefn.
Definition: ogr_feature.h:100
OGRGeomFieldDefn::IsNullable
int IsNullable() const
Return whether this geometry field can receive null values.
Definition: ogr_feature.h:235
ogr_featurestyle.h
OGRFieldDefn::SetUnique
void SetUnique(int bUniqueIn)
Set whether this field has a unique constraint.
Definition: ogr_feature.h:163
OGRFeature::SetField
void SetField(const char *pszFName, int nCount, const int *panValues)
Set field to list of integers value.
Definition: ogr_feature.h:753
OGRUnsetMarker
#define OGRUnsetMarker
Special value set in OGRField.Set.nMarker1, nMarker2 and nMarker3 for a unset field.
Definition: ogr_core.h:784
OGRRangeFieldDomain
Definition of a numeric field domain with a range of validity for values.
Definition: ogr_feature.h:1026
OGRJustification
OGRJustification
Display justification for field values.
Definition: ogr_core.h:761
OGRFeatureDefn::SetStyleIgnored
virtual void SetStyleIgnored(bool bIgnore)
Set whether the style can be omitted when fetching features.
Definition: ogr_feature.h:342
OGRFieldDefnH
void * OGRFieldDefnH
Opaque type for a field definition (OGRFieldDefn)
Definition: ogr_api.h:333
OGRFieldDomain::GetFieldType
OGRFieldType GetFieldType() const
Get the field type.
Definition: ogr_feature.h:936
OGRGeomFieldDefn
Definition of a geometry field of an OGRFeatureDefn.
Definition: ogr_feature.h:203
OGRFeature::FieldValue::GetDouble
double GetDouble() const
Return the double value.
Definition: ogr_feature.h:501
OGRFeature::GetFieldAsInteger64List
const GIntBig * GetFieldAsInteger64List(const char *pszFName, int *pnCount) const
Fetch field value as a list of 64 bit integers.
Definition: ogr_feature.h:709
OGRFieldDomain
Definition of a field domain.
Definition: ogr_feature.h:881
OGRFeature::FromHandle
static OGRFeature * FromHandle(OGRFeatureH hFeature)
Convert a OGRFeatureH to a OGRFeature*.
Definition: ogr_feature.h:825
OGRFeatureDefn::Dereference
int Dereference()
Decrements the reference count by one.
Definition: ogr_feature.h:335
end
OGRLayer::FeatureIterator end(OGRLayer *poLayer)
Return end of feature iterator.
Definition: ogrsf_frmts.h:330
OGRFieldDefn::GetType
OGRFieldType GetType() const
Fetch type of this field.
Definition: ogr_feature.h:130
OGRFeatureDefn::GetFieldIndex
virtual int GetFieldIndex(const char *) const
Find field by name.
Definition: ogrfeaturedefn.cpp:1181
OGRFieldDomain::GetFieldSubType
OGRFieldSubType GetFieldSubType() const
Get the field subtype.
Definition: ogr_feature.h:942
OGRFieldDefn::GetAlternativeNameRef
const char * GetAlternativeNameRef() const
Fetch the alternative name (or "alias") for this field.
Definition: ogr_feature.h:128
OGRFieldDomainSplitPolicy
OGRFieldDomainSplitPolicy
Split policy for field domains.
Definition: ogr_core.h:1082
OGRErr
int OGRErr
Type for a OGR error.
Definition: ogr_core.h:341
OGRFieldDomain::ToHandle
static OGRFieldDomainH ToHandle(OGRFieldDomain *poFieldDomain)
Convert a OGRFieldDomain* to a OGRFieldDomainH.
Definition: ogr_feature.h:945
GIntBig
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition: cpl_port.h:230
OGRFeature::GetFieldDefnRef
const OGRFieldDefn * GetFieldDefnRef(int iField) const
Fetch definition for this field.
Definition: ogr_feature.h:638
OGRFeature::FieldValue::GetInteger
int GetInteger() const
Return the integer value.
Definition: ogr_feature.h:489
OGRFeature::GetRawFieldRef
const OGRField * GetRawFieldRef(int i) const
Fetch a pointer to the internal field value given the index.
Definition: ogr_feature.h:656
OGRwkbGeometryType
OGRwkbGeometryType
List of well known binary geometry types.
Definition: ogr_core.h:368
OGRFieldDefn::IsIgnored
int IsIgnored() const
Return whether this field should be omitted when fetching features.
Definition: ogr_feature.h:156
OGRFeature::SetField
void SetField(const char *pszFName, double dfValue)
Set field to double value.
Definition: ogr_feature.h:749
CPL_WARN_UNUSED_RESULT
#define CPL_WARN_UNUSED_RESULT
Qualifier to warn when the return value of a function is not used.
Definition: cpl_port.h:869
OGRFeature::GetRawFieldRef
OGRField * GetRawFieldRef(int i)
Fetch a pointer to the internal field value given the index.
Definition: ogr_feature.h:655
OGRFeatureDefn::Reference
int Reference()
Increments the reference count by one.
Definition: ogr_feature.h:334
OGRCodedFieldDomain
Definition of a coded / enumerated field domain.
Definition: ogr_feature.h:983
OGRFeature
A simple feature, including geometry and attributes.
Definition: ogr_feature.h:381
OGRFeature::end
ConstFieldIterator end() const
Return end of field value iterator.
Definition: ogrfeature.cpp:7282
OGRFeature::GetGeomFieldDefnRef
const OGRGeomFieldDefn * GetGeomFieldDefnRef(int iField) const
Fetch definition for this geometry field.
Definition: ogr_feature.h:618
OGRGeomFieldDefn::GetType
OGRwkbGeometryType GetType() const
Fetch geometry type of this field.
Definition: ogr_feature.h:226
OGRFeature::GetNativeMediaType
const char * GetNativeMediaType() const
Returns the native media type for the feature.
Definition: ogr_feature.h:808
OGRFieldSubType
OGRFieldSubType
List of field subtypes.
Definition: ogr_core.h:737
OGRFieldDefn::SetNullable
void SetNullable(int bNullableIn)
Set whether this field can receive null values.
Definition: ogr_feature.h:160
OGRGeomFieldDefn::SetNullable
void SetNullable(int bNullableIn)
Set whether this geometry field can receive null values.
Definition: ogr_feature.h:236
OGRRangeFieldDomain::Clone
OGRRangeFieldDomain * Clone() const override
Clone.
Definition: ogr_feature.h:1071
OGRGeomFieldDefn::FromHandle
static OGRGeomFieldDefn * FromHandle(OGRGeomFieldDefnH hGeomFieldDefn)
Convert a OGRGeomFieldDefnH to a OGRGeomFieldDefn*.
Definition: ogr_feature.h:250
OGRFeatureDefn::ToHandle
static OGRFeatureDefnH ToHandle(OGRFeatureDefn *poFeatureDefn)
Convert a OGRFeatureDefn* to a OGRFeatureDefnH.
Definition: ogr_feature.h:360
OGRFieldDefn::IsNullable
int IsNullable() const
Return whether this field can receive null values.
Definition: ogr_feature.h:159
OGRFieldType
OGRFieldType
List of feature field types.
Definition: ogr_core.h:709
OGRFeatureDefnH
void * OGRFeatureDefnH
Opaque type for a feature definition (OGRFeatureDefn)
Definition: ogr_feature.h:64
OGRFeatureDefn::GetGeomFieldCount
virtual int GetGeomFieldCount() const
Fetch number of geometry fields on this feature.
Definition: ogrfeaturedefn.cpp:592
OGRFeature::GetFieldAsInteger64
GIntBig GetFieldAsInteger64(const char *pszFName) const
Fetch field value as integer 64 bit.
Definition: ogr_feature.h:699
OGRFeature::GetFieldAsString
const char * GetFieldAsString(const char *pszFName) const
Fetch field value as a string.
Definition: ogr_feature.h:703
OGRFeature::FieldValue::GetInteger64
GIntBig GetInteger64() const
Return the 64-bit integer value.
Definition: ogr_feature.h:495
OGRFeature::SetField
void SetField(const char *pszFName, const char *const *papszValues)
Set field to list of strings value.
Definition: ogr_feature.h:762
OGRFieldDefn::SetWidth
void SetWidth(int nWidthIn)
Set the formatting width for this field in characters.
Definition: ogr_feature.h:143
OGRFeatureDefn
Definition of a feature class or feature layer.
Definition: ogr_feature.h:280
OGRGlobFieldDomain::GetGlob
const std::string & GetGlob() const
Get the glob expression.
Definition: ogr_feature.h:1156
OGRFeature::GetFieldAsInteger
int GetFieldAsInteger(const char *pszFName) const
Fetch field value as integer.
Definition: ogr_feature.h:697
OGRFeatureDefn::GetReferenceCount
int GetReferenceCount() const
Fetch current reference count.
Definition: ogr_feature.h:336
OGRFieldDefn::GetSubType
OGRFieldSubType GetSubType() const
Fetch subtype of this field.
Definition: ogr_feature.h:134
OGRFeature::SetField
void SetField(const char *pszFName, int nValue)
Set field to integer value. OFTInteger, OFTInteger64 and OFTReal fields will be set directly....
Definition: ogr_feature.h:745
OGRFeature::GetFieldAsIntegerList
const int * GetFieldAsIntegerList(const char *pszFName, int *pnCount) const
Fetch field value as a list of integers.
Definition: ogr_feature.h:705
wkbUnknown
@ wkbUnknown
unknown type, non-standard
Definition: ogr_core.h:370
OGRFieldDomainH
struct OGRFieldDomainHS * OGRFieldDomainH
Opaque type for a field domain definition (OGRFieldDomain)
Definition: ogr_feature.h:74
OGRGlobFieldDomain::Clone
OGRGlobFieldDomain * Clone() const override
Clone.
Definition: ogr_feature.h:1143
CPL_DISALLOW_COPY_ASSIGN
#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:930
OGRFieldDefn::GetJustify
OGRJustification GetJustify() const
Get the justification for this field.
Definition: ogr_feature.h:138
OGRFeature::GetNativeData
const char * GetNativeData() const
Returns the native data for the feature.
Definition: ogr_feature.h:807
OGRFieldDomain::GetDomainType
OGRFieldDomainType GetDomainType() const
Get the type of the field domain.
Definition: ogr_feature.h:930
OGRFeature::GetFID
GIntBig GetFID() const
Get feature identifier.
Definition: ogr_feature.h:774
OGRFeature::SetField
void SetField(const char *pszFName, int nCount, const GIntBig *panValues)
Set field to list of 64 bit integers value.
Definition: ogr_feature.h:756
OGRFieldDefn::ToHandle
static OGRFieldDefnH ToHandle(OGRFieldDefn *poFieldDefn)
Convert a OGRFieldDefn* to a OGRFieldDefnH.
Definition: ogr_feature.h:173