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
50
51 #define DEFINE_OGRFeatureH
52
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
59
60 typedef void *OGRFieldDefnH;
62 typedef void *OGRFeatureDefnH;
64 typedef void *OGRFeatureH;
66 typedef void *OGRStyleTableH;
67 #endif
68
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:
180 CPL_DISALLOW_COPY_ASSIGN(OGRFieldDefn)
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:
251 CPL_DISALLOW_COPY_ASSIGN(OGRGeomFieldDefn)
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
305 virtual void AddFieldDefn( const OGRFieldDefn * );
306 virtual OGRErr DeleteFieldDefn( int iField );
307 virtual OGRErr ReorderFieldDefns( const int* panMap );
308
309 virtual int GetGeomFieldCount() const;
310 virtual OGRGeomFieldDefn *GetGeomFieldDefn( int i );
311 virtual const OGRGeomFieldDefn *GetGeomFieldDefn( int i ) const;
312 virtual int GetGeomFieldIndex( const char * ) const;
313
314 virtual void AddGeomFieldDefn( const OGRGeomFieldDefn * );
315 virtual void AddGeomFieldDefn( std::unique_ptr<OGRGeomFieldDefn>&& );
316 virtual OGRErr DeleteGeomFieldDefn( int iGeomField );
317
318 virtual OGRwkbGeometryType GetGeomType() const;
319 virtual void SetGeomType( OGRwkbGeometryType );
320
321 virtual OGRFeatureDefn *Clone() const;
322
323 int Reference() { return CPLAtomicInc(&nRefCount); }
324 int Dereference() { return CPLAtomicDec(&nRefCount); }
325 int GetReferenceCount() const { return nRefCount; }
326 void Release();
327
328 virtual int IsGeometryIgnored() const;
329 virtual void SetGeometryIgnored( int bIgnore );
330 virtual bool IsStyleIgnored() const { return bIgnoreStyle; }
331 virtual void SetStyleIgnored( bool bIgnore )
332 { bIgnoreStyle = bIgnore; }
333
334 virtual int IsSame( const OGRFeatureDefn * poOtherFeatureDefn ) const;
335
337 void ReserveSpaceForFields(int nFieldCountIn);
339
340 std::vector<int> ComputeMapForSetFrom( const OGRFeatureDefn* poSrcFDefn,
341 bool bForgiving = true ) const;
342
343 static OGRFeatureDefn *CreateFeatureDefn( const char *pszName = nullptr );
344 static void DestroyFeatureDefn( OGRFeatureDefn * );
345
349 static inline OGRFeatureDefnH ToHandle(OGRFeatureDefn* poFeatureDefn)
350 { return reinterpret_cast<OGRFeatureDefnH>(poFeatureDefn); }
351
355 static inline OGRFeatureDefn* FromHandle(OGRFeatureDefnH hFeatureDefn)
356 { return reinterpret_cast<OGRFeatureDefn*>(hFeatureDefn); }
357
358 private:
359 CPL_DISALLOW_COPY_ASSIGN(OGRFeatureDefn)
360 };
361
362 /************************************************************************/
363 /* OGRFeature */
364 /************************************************************************/
365
370 class CPL_DLL OGRFeature
371 {
372 private:
373
374 GIntBig nFID;
375 OGRFeatureDefn *poDefn;
376 OGRGeometry **papoGeometries;
377 OGRField *pauFields;
378 char *m_pszNativeData;
379 char *m_pszNativeMediaType;
380
381 bool SetFieldInternal( int i, OGRField * puValue );
382
383 protected:
385 mutable char *m_pszStyleString;
386 mutable OGRStyleTable *m_poStyleTable;
387 mutable char *m_pszTmpFieldValue;
389
390 bool CopySelfTo( OGRFeature *poNew ) const;
391
392 public:
393 explicit OGRFeature( OGRFeatureDefn * );
394 virtual ~OGRFeature();
395
397 class CPL_DLL FieldValue
398 {
399 friend class OGRFeature;
400 struct Private;
401 std::unique_ptr<Private> m_poPrivate;
402
403 FieldValue(OGRFeature* poFeature, int iFieldIndex);
404 FieldValue(const OGRFeature* poFeature, int iFieldIndex);
405 FieldValue(const FieldValue& oOther) = delete;
406
407 public:
409 ~FieldValue();
411
413 FieldValue& operator= (const FieldValue& oOther);
415 FieldValue& operator= (int nVal);
417 FieldValue& operator= (GIntBig nVal);
419 FieldValue& operator= (double dfVal);
421 FieldValue& operator= (const char *pszVal);
423 FieldValue& operator= (const std::string& osVal);
425 FieldValue& operator= (const std::vector<int>& oArray);
427 FieldValue& operator= (const std::vector<GIntBig>& oArray);
429 FieldValue& operator= (const std::vector<double>& oArray);
431 FieldValue& operator= (const std::vector<std::string>& oArray);
433 FieldValue& operator= (CSLConstList papszValues);
435 void SetNull();
437 void clear();
439 void Unset() { clear(); }
441 void SetDateTime(int nYear, int nMonth, int nDay,
442 int nHour=0, int nMinute=0, float fSecond=0.f,
443 int nTZFlag = 0 );
444
446 int GetIndex() const;
448 const OGRFieldDefn* GetDefn() const;
450 const char* GetName() const { return GetDefn()->GetNameRef(); }
452 OGRFieldType GetType() const { return GetDefn()->GetType(); }
454 OGRFieldSubType GetSubType() const { return GetDefn()->GetSubType(); }
455
457 // cppcheck-suppress functionStatic
458 bool empty() const { return IsUnset(); }
459
461 // cppcheck-suppress functionStatic
462 bool IsUnset() const;
463
465 // cppcheck-suppress functionStatic
466 bool IsNull() const;
467
469 const OGRField *GetRawValue() const;
470
474 // cppcheck-suppress functionStatic
475 int GetInteger() const { return GetRawValue()->Integer; }
476
480 // cppcheck-suppress functionStatic
481 GIntBig GetInteger64() const { return GetRawValue()->Integer64; }
482
486 // cppcheck-suppress functionStatic
487 double GetDouble() const { return GetRawValue()->Real; }
488
492 // cppcheck-suppress functionStatic
493 const char* GetString() const { return GetRawValue()->String; }
494
496 bool GetDateTime( int *pnYear, int *pnMonth,
497 int *pnDay,
498 int *pnHour, int *pnMinute,
499 float *pfSecond,
500 int *pnTZFlag ) const;
501
503 operator int () const { return GetAsInteger(); }
505 operator GIntBig() const { return GetAsInteger64(); }
507 operator double () const { return GetAsDouble(); }
509 operator const char*() const { return GetAsString(); }
511 operator const std::vector<int>& () const { return GetAsIntegerList(); }
513 operator const std::vector<GIntBig>& () const { return GetAsInteger64List(); }
515 operator const std::vector<double>& () const { return GetAsDoubleList(); }
517 operator const std::vector<std::string>& () const { return GetAsStringList(); }
519 operator CSLConstList () const;
520
522 int GetAsInteger() const;
524 GIntBig GetAsInteger64() const;
526 double GetAsDouble() const;
528 const char* GetAsString() const;
530 const std::vector<int>& GetAsIntegerList() const;
532 const std::vector<GIntBig>& GetAsInteger64List() const;
534 const std::vector<double>& GetAsDoubleList() const;
536 const std::vector<std::string>& GetAsStringList() const;
537 };
538
540 class CPL_DLL ConstFieldIterator
541 {
542 friend class OGRFeature;
543 struct Private;
544 std::unique_ptr<Private> m_poPrivate;
545
546 ConstFieldIterator(const OGRFeature* poSelf, int nPos);
547
548 public:
550 ConstFieldIterator(ConstFieldIterator&& oOther) noexcept; // declared but not defined. Needed for gcc 5.4 at least
551 ~ConstFieldIterator();
552 const FieldValue& operator*() const;
553 ConstFieldIterator& operator++();
554 bool operator!=(const ConstFieldIterator& it) const;
556 };
557
574 ConstFieldIterator begin() const;
576 ConstFieldIterator end() const;
577
578 const FieldValue operator[](int iField) const;
579 FieldValue operator[](int iField);
580
582 class FieldNotFoundException: public std::exception {};
583
584 const FieldValue operator[](const char* pszFieldName) const;
585 FieldValue operator[](const char* pszFieldName);
586
587 OGRFeatureDefn *GetDefnRef() { return poDefn; }
588 const OGRFeatureDefn *GetDefnRef() const { return poDefn; }
589
590 OGRErr SetGeometryDirectly( OGRGeometry * );
591 OGRErr SetGeometry( const OGRGeometry * );
592 OGRGeometry *GetGeometryRef();
593 const OGRGeometry *GetGeometryRef() const;
594 OGRGeometry *StealGeometry() CPL_WARN_UNUSED_RESULT;
595
596 int GetGeomFieldCount() const
597 { return poDefn->GetGeomFieldCount(); }
598 OGRGeomFieldDefn *GetGeomFieldDefnRef( int iField )
599 { return poDefn->GetGeomFieldDefn(iField); }
600 const OGRGeomFieldDefn *GetGeomFieldDefnRef( int iField ) const
601 { return poDefn->GetGeomFieldDefn(iField); }
602 int GetGeomFieldIndex( const char * pszName ) const
603 { return poDefn->GetGeomFieldIndex(pszName); }
604
605 OGRGeometry* GetGeomFieldRef( int iField );
606 const OGRGeometry* GetGeomFieldRef( int iField ) const;
607 OGRGeometry* StealGeometry( int iField );
608 OGRGeometry* GetGeomFieldRef( const char* pszFName );
609 const OGRGeometry* GetGeomFieldRef( const char* pszFName ) const;
610 OGRErr SetGeomFieldDirectly( int iField, OGRGeometry * );
611 OGRErr SetGeomField( int iField, const OGRGeometry * );
612
613 OGRFeature *Clone() const CPL_WARN_UNUSED_RESULT;
614 virtual OGRBoolean Equal( const OGRFeature * poFeature ) const;
615
616 int GetFieldCount() const
617 { return poDefn->GetFieldCount(); }
618 const OGRFieldDefn *GetFieldDefnRef( int iField ) const
619 { return poDefn->GetFieldDefn(iField); }
620 OGRFieldDefn *GetFieldDefnRef( int iField )
621 { return poDefn->GetFieldDefn(iField); }
622 int GetFieldIndex( const char * pszName ) const
623 { return poDefn->GetFieldIndex(pszName); }
624
625 int IsFieldSet( int iField ) const;
626
627 void UnsetField( int iField );
628
629 bool IsFieldNull( int iField ) const;
630
631 void SetFieldNull( int iField );
632
633 bool IsFieldSetAndNotNull( int iField ) const;
634
635 OGRField *GetRawFieldRef( int i ) { return pauFields + i; }
636 const OGRField *GetRawFieldRef( int i ) const { return pauFields + i; }
637
638 int GetFieldAsInteger( int i ) const;
639 GIntBig GetFieldAsInteger64( int i ) const;
640 double GetFieldAsDouble( int i ) const;
641 const char *GetFieldAsString( int i ) const;
642 const int *GetFieldAsIntegerList( int i, int *pnCount ) const;
643 const GIntBig *GetFieldAsInteger64List( int i, int *pnCount ) const;
644 const double *GetFieldAsDoubleList( int i, int *pnCount ) const;
645 char **GetFieldAsStringList( int i ) const;
646 GByte *GetFieldAsBinary( int i, int *pnCount ) const;
647 int GetFieldAsDateTime( int i,
648 int *pnYear, int *pnMonth,
649 int *pnDay,
650 int *pnHour, int *pnMinute,
651 int *pnSecond,
652 int *pnTZFlag ) const;
653 int GetFieldAsDateTime( int i,
654 int *pnYear, int *pnMonth,
655 int *pnDay,
656 int *pnHour, int *pnMinute,
657 float *pfSecond,
658 int *pnTZFlag ) const;
659 char *GetFieldAsSerializedJSon( int i ) const;
660
661 int GetFieldAsInteger( const char *pszFName ) const
662 { return GetFieldAsInteger( GetFieldIndex(pszFName) ); }
663 GIntBig GetFieldAsInteger64( const char *pszFName ) const
664 { return GetFieldAsInteger64( GetFieldIndex(pszFName) ); }
665 double GetFieldAsDouble( const char *pszFName ) const
666 { return GetFieldAsDouble( GetFieldIndex(pszFName) ); }
667 const char *GetFieldAsString( const char *pszFName ) const
668 { return GetFieldAsString( GetFieldIndex(pszFName) ); }
669 const int *GetFieldAsIntegerList( const char *pszFName,
670 int *pnCount ) const
671 { return GetFieldAsIntegerList( GetFieldIndex(pszFName),
672 pnCount ); }
673 const GIntBig *GetFieldAsInteger64List( const char *pszFName,
674 int *pnCount ) const
675 { return GetFieldAsInteger64List( GetFieldIndex(pszFName),
676 pnCount ); }
677 const double *GetFieldAsDoubleList( const char *pszFName,
678 int *pnCount ) const
679 { return GetFieldAsDoubleList( GetFieldIndex(pszFName),
680 pnCount ); }
681 char **GetFieldAsStringList( const char *pszFName ) const
682 { return GetFieldAsStringList(GetFieldIndex(pszFName)); }
683
684 void SetField( int i, int nValue );
685 void SetField( int i, GIntBig nValue );
686 void SetField( int i, double dfValue );
687 void SetField( int i, const char * pszValue );
688 void SetField( int i, int nCount, const int * panValues );
689 void SetField( int i, int nCount,
690 const GIntBig * panValues );
691 void SetField( int i, int nCount, const double * padfValues );
692 void SetField( int i, const char * const * papszValues );
693 void SetField( int i, OGRField * puValue );
694 void SetField( int i, int nCount, const void * pabyBinary );
695 void SetField( int i, int nYear, int nMonth, int nDay,
696 int nHour=0, int nMinute=0, float fSecond=0.f,
697 int nTZFlag = 0 );
698
699 void SetField( const char *pszFName, int nValue )
700 { SetField( GetFieldIndex(pszFName), nValue ); }
701 void SetField( const char *pszFName, GIntBig nValue )
702 { SetField( GetFieldIndex(pszFName), nValue ); }
703 void SetField( const char *pszFName, double dfValue )
704 { SetField( GetFieldIndex(pszFName), dfValue ); }
705 void SetField( const char *pszFName, const char * pszValue )
706 { SetField( GetFieldIndex(pszFName), pszValue ); }
707 void SetField( const char *pszFName, int nCount,
708 const int * panValues )
709 { SetField(GetFieldIndex(pszFName),nCount,panValues); }
710 void SetField( const char *pszFName, int nCount,
711 const GIntBig * panValues )
712 { SetField(GetFieldIndex(pszFName),nCount,panValues); }
713 void SetField( const char *pszFName, int nCount,
714 const double * padfValues )
715 {SetField(GetFieldIndex(pszFName),nCount,padfValues); }
716 void SetField( const char *pszFName, const char * const * papszValues )
717 { SetField( GetFieldIndex(pszFName), papszValues); }
718 void SetField( const char *pszFName, OGRField * puValue )
719 { SetField( GetFieldIndex(pszFName), puValue ); }
720 void SetField( const char *pszFName,
721 int nYear, int nMonth, int nDay,
722 int nHour=0, int nMinute=0, float fSecond=0.f,
723 int nTZFlag = 0 )
724 { SetField( GetFieldIndex(pszFName),
725 nYear, nMonth, nDay,
726 nHour, nMinute, fSecond, nTZFlag ); }
727
728 GIntBig GetFID() const { return nFID; }
729 virtual OGRErr SetFID( GIntBig nFIDIn );
730
731 void DumpReadable( FILE *, char** papszOptions = nullptr ) const;
732
733 OGRErr SetFrom( const OGRFeature *, int = TRUE );
734 OGRErr SetFrom( const OGRFeature *, const int *, int = TRUE );
735 OGRErr SetFieldsFrom( const OGRFeature *, const int *, int = TRUE );
736
738 OGRErr RemapFields( OGRFeatureDefn *poNewDefn,
739 const int *panRemapSource );
740 void AppendField();
741 OGRErr RemapGeomFields( OGRFeatureDefn *poNewDefn,
742 const int *panRemapSource );
744
745 int Validate( int nValidateFlags,
746 int bEmitError ) const;
747 void FillUnsetWithDefault( int bNotNullableOnly,
748 char** papszOptions );
749
750 virtual const char *GetStyleString() const;
751 virtual void SetStyleString( const char * );
752 virtual void SetStyleStringDirectly( char * );
753
757 virtual OGRStyleTable *GetStyleTable() const { return m_poStyleTable; } /* f.i.x.m.e: add a const qualifier for return type */
758 virtual void SetStyleTable( OGRStyleTable *poStyleTable );
759 virtual void SetStyleTableDirectly( OGRStyleTable *poStyleTable );
760
761 const char *GetNativeData() const { return m_pszNativeData; }
762 const char *GetNativeMediaType() const
763 { return m_pszNativeMediaType; }
764 void SetNativeData( const char* pszNativeData );
765 void SetNativeMediaType( const char* pszNativeMediaType );
766
767 static OGRFeature *CreateFeature( OGRFeatureDefn * );
768 static void DestroyFeature( OGRFeature * );
769
773 static inline OGRFeatureH ToHandle(OGRFeature* poFeature)
774 { return reinterpret_cast<OGRFeatureH>(poFeature); }
775
779 static inline OGRFeature* FromHandle(OGRFeatureH hFeature)
780 { return reinterpret_cast<OGRFeature*>(hFeature); }
781
782 private:
783 CPL_DISALLOW_COPY_ASSIGN(OGRFeature)
784 };
785
787 struct CPL_DLL OGRFeatureUniquePtrDeleter
788 {
789 void operator()(OGRFeature*) const;
790 };
792
796 typedef std::unique_ptr<OGRFeature, OGRFeatureUniquePtrDeleter> OGRFeatureUniquePtr;
797
799
800 inline OGRFeature::ConstFieldIterator begin(const OGRFeature* poFeature) { return poFeature->begin(); }
802 inline OGRFeature::ConstFieldIterator end(const OGRFeature* poFeature) { return poFeature->end(); }
803
805 inline OGRFeature::ConstFieldIterator begin(const OGRFeatureUniquePtr& poFeature) { return poFeature->begin(); }
807 inline OGRFeature::ConstFieldIterator end(const OGRFeatureUniquePtr& poFeature) { return poFeature->end(); }
808
810
811 /************************************************************************/
812 /* OGRFieldDomain */
813 /************************************************************************/
814
835 class CPL_DLL OGRFieldDomain
836 {
837 protected:
839 std::string m_osName;
840 std::string m_osDescription;
841 OGRFieldDomainType m_eDomainType;
842 OGRFieldType m_eFieldType;
843 OGRFieldSubType m_eFieldSubType;
844 OGRFieldDomainSplitPolicy m_eSplitPolicy = OFDSP_DEFAULT_VALUE;
845 OGRFieldDomainMergePolicy m_eMergePolicy = OFDMP_DEFAULT_VALUE;
846
847 OGRFieldDomain(const std::string& osName,
848 const std::string& osDescription,
849 OGRFieldDomainType eDomainType,
850 OGRFieldType eFieldType,
851 OGRFieldSubType eFieldSubType);
854 public:
859 virtual ~OGRFieldDomain() = 0;
860
865 virtual OGRFieldDomain* Clone() const = 0;
866
871 const std::string& GetName() const { return m_osName; }
872
878 const std::string& GetDescription() const { return m_osDescription; }
879
884 OGRFieldDomainType GetDomainType() const { return m_eDomainType; }
885
890 OGRFieldType GetFieldType() const { return m_eFieldType; }
891
896 OGRFieldSubType GetFieldSubType() const { return m_eFieldSubType; }
897
899 static inline OGRFieldDomainH ToHandle(OGRFieldDomain* poFieldDomain)
900 { return reinterpret_cast<OGRFieldDomainH>(poFieldDomain); }
901
903 static inline OGRFieldDomain* FromHandle(OGRFieldDomainH hFieldDomain)
904 { return reinterpret_cast<OGRFieldDomain*>(hFieldDomain); }
905
910 OGRFieldDomainSplitPolicy GetSplitPolicy() const { return m_eSplitPolicy; }
911
916 void SetSplitPolicy(OGRFieldDomainSplitPolicy policy) { m_eSplitPolicy = policy; }
917
922 OGRFieldDomainMergePolicy GetMergePolicy() const { return m_eMergePolicy; }
923
928 void SetMergePolicy(OGRFieldDomainMergePolicy policy) { m_eMergePolicy = policy; }
929 };
930
937 class CPL_DLL OGRCodedFieldDomain final: public OGRFieldDomain
938 {
939 private:
940 std::vector<OGRCodedValue> m_asValues{};
941
942 OGRCodedFieldDomain(const OGRCodedFieldDomain&) = delete;
943 OGRCodedFieldDomain& operator= (const OGRCodedFieldDomain&) = delete;
944
945 public:
960 OGRCodedFieldDomain(const std::string& osName,
961 const std::string& osDescription,
962 OGRFieldType eFieldType,
963 OGRFieldSubType eFieldSubType,
964 std::vector<OGRCodedValue>&& asValues);
965
966 ~OGRCodedFieldDomain() override;
967
968 OGRCodedFieldDomain* Clone() const override;
969
975 const OGRCodedValue* GetEnumeration() const { return m_asValues.data(); }
976 };
977
980 class CPL_DLL OGRRangeFieldDomain final: public OGRFieldDomain
981 {
982 private:
983 OGRField m_sMin;
984 OGRField m_sMax;
985 bool m_bMinIsInclusive;
986 bool m_bMaxIsInclusive;
987
988 OGRRangeFieldDomain(const OGRRangeFieldDomain&) = delete;
989 OGRRangeFieldDomain& operator= (const OGRRangeFieldDomain&) = delete;
990
991 public:
1016 OGRRangeFieldDomain(const std::string& osName,
1017 const std::string& osDescription,
1018 OGRFieldType eFieldType,
1019 OGRFieldSubType eFieldSubType,
1020 const OGRField& sMin,
1021 bool bMinIsInclusive,
1022 const OGRField& sMax,
1023 bool bMaxIsInclusive);
1024
1025 OGRRangeFieldDomain* Clone() const override {
1026 return new OGRRangeFieldDomain(m_osName, m_osDescription,
1027 m_eFieldType, m_eFieldSubType,
1028 m_sMin, m_bMinIsInclusive,
1029 m_sMax, m_bMaxIsInclusive);
1030 }
1031
1043 const OGRField& GetMin(bool& bIsInclusiveOut) const {
1044 bIsInclusiveOut = m_bMinIsInclusive;
1045 return m_sMin;
1046 }
1047
1059 const OGRField& GetMax(bool& bIsInclusiveOut) const {
1060 bIsInclusiveOut = m_bMaxIsInclusive;
1061 return m_sMax;
1062 }
1063 };
1064
1069 class CPL_DLL OGRGlobFieldDomain final: public OGRFieldDomain
1070 {
1071 private:
1072 std::string m_osGlob;
1073
1074 OGRGlobFieldDomain(const OGRGlobFieldDomain&) = delete;
1075 OGRGlobFieldDomain& operator= (const OGRGlobFieldDomain&) = delete;
1076
1077 public:
1088 OGRGlobFieldDomain(const std::string& osName,
1089 const std::string& osDescription,
1090 OGRFieldType eFieldType,
1091 OGRFieldSubType eFieldSubType,
1092 const std::string& osBlob);
1093
1094 OGRGlobFieldDomain* Clone() const override {
1095 return new OGRGlobFieldDomain(m_osName, m_osDescription,
1096 m_eFieldType, m_eFieldSubType,
1097 m_osGlob);
1098 }
1099
1104 const std::string& GetGlob() const { return m_osGlob; }
1105 };
1106
1107 /************************************************************************/
1108 /* OGRFeatureQuery */
1109 /************************************************************************/
1110
1112 class OGRLayer;
1113 class swq_expr_node;
1114 class swq_custom_func_registrar;
1115
1116 class CPL_DLL OGRFeatureQuery
1117 {
1118 private:
1119 OGRFeatureDefn *poTargetDefn;
1120 void *pSWQExpr;
1121
1122 char **FieldCollector( void *, char ** );
1123
1124 GIntBig *EvaluateAgainstIndices( swq_expr_node*, OGRLayer *,
1125 GIntBig& nFIDCount );
1126
1127 int CanUseIndex( swq_expr_node*, OGRLayer * );
1128
1129 OGRErr Compile( OGRLayer *, OGRFeatureDefn*, const char *,
1130 int bCheck,
1131 swq_custom_func_registrar* poCustomFuncRegistrar );
1132
1133 CPL_DISALLOW_COPY_ASSIGN(OGRFeatureQuery)
1134
1135 public:
1136 OGRFeatureQuery();
1137 ~OGRFeatureQuery();
1138
1139 OGRErr Compile( OGRLayer *, const char *,
1140 int bCheck = TRUE,
1141 swq_custom_func_registrar*
1142 poCustomFuncRegistrar = nullptr );
1143 OGRErr Compile( OGRFeatureDefn *, const char *,
1144 int bCheck = TRUE,
1145 swq_custom_func_registrar*
1146 poCustomFuncRegistrar = nullptr );
1147 int Evaluate( OGRFeature * );
1148
1149 GIntBig *EvaluateAgainstIndices( OGRLayer *, OGRErr * );
1150
1151 int CanUseIndex( OGRLayer * );
1152
1153 char **GetUsedFields();
1154
1155 void *GetSWQExpr() { return pSWQExpr; }
1156 };
1158
1159 #endif /* ndef OGR_FEATURE_H_INCLUDED */
MAX
#define MAX(a, b)
Macro to compute the maximum of 2 values.
Definition: cpl_port.h:406
OGRFeature::GetFieldAsDoubleList
const double * GetFieldAsDoubleList(const char *pszFName, int *pnCount) const
Fetch field value as a list of doubles.
Definition: ogr_feature.h:677
OGRFeature::FieldValue::GetString
const char * GetString() const
Return the string value.
Definition: ogr_feature.h:493
OGRFeatureDefn::FromHandle
static OGRFeatureDefn * FromHandle(OGRFeatureDefnH hFeatureDefn)
Convert a OGRFeatureDefnH to a OGRFeatureDefn*.
Definition: ogr_feature.h:355
OGRFeature::FieldValue::GetSubType
OGRFieldSubType GetSubType() const
Return field subtype.
Definition: ogr_feature.h:454
OGRFieldDomain::GetSplitPolicy
OGRFieldDomainSplitPolicy GetSplitPolicy() const
Get the split policy.
Definition: ogr_feature.h:910
OGRFieldDomainMergePolicy
OGRFieldDomainMergePolicy
Merge policy for field domains.
Definition: ogr_core.h:1026
OGRFeatureDefn::IsStyleIgnored
virtual bool IsStyleIgnored() const
Determine whether the style can be omitted when fetching features.
Definition: ogr_feature.h:330
OFDSP_DEFAULT_VALUE
@ OFDSP_DEFAULT_VALUE
Default value.
Definition: ogr_core.h:1012
OGRFieldDomainType
OGRFieldDomainType
Type of field domain.
Definition: ogr_core.h:992
GByte
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:215
OGRFieldDefnH
void * OGRFieldDefnH
Opaque type for a field definition (OGRFieldDefn)
Definition: ogr_feature.h:60
OGRFeature::FieldNotFoundException
Exception raised by operator[](const char*) when a field is not found.
Definition: ogr_feature.h:582
OGRCodedFieldDomain::GetEnumeration
const OGRCodedValue * GetEnumeration() const
Get the enumeration as (code, value) pairs.
Definition: ogr_feature.h:975
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:701
OGRFeature::GetFieldAsStringList
char ** GetFieldAsStringList(const char *pszFName) const
Fetch field value as a list of strings.
Definition: ogr_feature.h:681
OGRFieldDefn::GetDomainName
const std::string & GetDomainName() const
Return the name of the field domain for this field.
Definition: ogr_feature.h:163
OGRFeature::ConstFieldIterator
Field value iterator class.
Definition: ogr_feature.h:540
OGRFieldDefn::SetDomainName
void SetDomainName(const std::string &osDomainName)
Set the name of the field domain for this field.
Definition: ogr_feature.h:164
OGRFeature::GetStyleTable
virtual OGRStyleTable * GetStyleTable() const
Return style table.
Definition: ogr_feature.h:757
OGRFieldDefn::SetJustify
void SetJustify(OGRJustification eJustifyIn)
Set the justification for this field.
Definition: ogr_feature.h:137
begin
OGRLayer::FeatureIterator begin(OGRLayer *poLayer)
Return begin of feature iterator.
Definition: ogrsf_frmts.h:287
OGRFeature::FieldValue::GetType
OGRFieldType GetType() const
Return field type.
Definition: ogr_feature.h:452
OGRGeomFieldDefn::SetIgnored
void SetIgnored(int bIgnoreIn)
Set whether this field should be omitted when fetching features.
Definition: ogr_feature.h:231
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:928
OGRFieldDefn::SetIgnored
void SetIgnored(int bIgnoreIn)
Set whether this field should be omitted when fetching features.
Definition: ogr_feature.h:155
OGRFeature::ToHandle
static OGRFeatureH ToHandle(OGRFeature *poFeature)
Convert a OGRFeature* to a OGRFeatureH.
Definition: ogr_feature.h:773
OGRFeature::FieldValue::GetName
const char * GetName() const
Return field name.
Definition: ogr_feature.h:450
OGRFeatureDefn::GetGeomFieldIndex
virtual int GetGeomFieldIndex(const char *) const
Find geometry field by name.
Definition: ogrfeaturedefn.cpp:879
OGRFeature::GetFieldDefnRef
OGRFieldDefn * GetFieldDefnRef(int iField)
Fetch definition for this field.
Definition: ogr_feature.h:620
OGRFieldDefn::GetWidth
int GetWidth() const
Get the formatting width for this field.
Definition: ogr_feature.h:140
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:69
OGRStyleTableH
void * OGRStyleTableH
Opaque type for a style table (OGRStyleTable)
Definition: ogr_feature.h:66
OGRFieldDomain::FromHandle
static OGRFieldDomain * FromHandle(OGRFieldDomainH hFieldDomain)
Convert a OGRFieldDomainH to a OGRFieldDomain*.
Definition: ogr_feature.h:903
OGRFeatureH
void * OGRFeatureH
Opaque type for a feature (OGRFeature)
Definition: ogr_feature.h:64
OGRFieldDomain::SetSplitPolicy
void SetSplitPolicy(OGRFieldDomainSplitPolicy policy)
Set the split policy.
Definition: ogr_feature.h:916
OGRRangeFieldDomain::GetMin
const OGRField & GetMin(bool &bIsInclusiveOut) const
Get the minimum value.
Definition: ogr_feature.h:1043
OGRFeature::GetFieldAsDouble
double GetFieldAsDouble(const char *pszFName) const
Fetch field value as a double.
Definition: ogr_feature.h:665
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:878
OGRFieldDomain::Clone
virtual OGRFieldDomain * Clone() const =0
Clone.
OGRFeature::GetGeomFieldDefnRef
OGRGeomFieldDefn * GetGeomFieldDefnRef(int iField)
Fetch definition for this geometry field.
Definition: ogr_feature.h:598
OGRLayer
This class represents a layer of simple features, with access methods.
Definition: ogrsf_frmts.h:70
OGRFeature::FieldValue::empty
bool empty() const
Return whether the field value is unset/empty.
Definition: ogr_feature.h:458
OFDMP_DEFAULT_VALUE
@ OFDMP_DEFAULT_VALUE
Default value.
Definition: ogr_core.h:1029
OGRGeomFieldDefn::ToHandle
static OGRGeomFieldDefnH ToHandle(OGRGeomFieldDefn *poGeomFieldDefn)
Convert a OGRGeomFieldDefn* to a OGRGeomFieldDefnH.
Definition: ogr_feature.h:242
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:143
ogr_geometry.h
OGRGeomFieldDefn::GetNameRef
const char * GetNameRef() const
Fetch name of this field.
Definition: ogr_feature.h:222
OGRGeomFieldDefn::IsIgnored
int IsIgnored() const
Return whether this field should be omitted when fetching features.
Definition: ogr_feature.h:230
OGRFeatureUniquePtr
std::unique_ptr< OGRFeature, OGRFeatureUniquePtrDeleter > OGRFeatureUniquePtr
Unique pointer type for OGRFeature.
Definition: ogr_feature.h:796
OGRRangeFieldDomain::GetMax
const OGRField & GetMax(bool &bIsInclusiveOut) const
Get the maximum value.
Definition: ogr_feature.h:1059
OGRFeatureH
void * OGRFeatureH
Opaque type for a feature (OGRFeature)
Definition: ogr_api.h:335
OGRFeature::GetGeomFieldIndex
int GetGeomFieldIndex(const char *pszName) const
Fetch the geometry field index given geometry field name.
Definition: ogr_feature.h:602
OGRFieldDefn::GetNameRef
const char * GetNameRef() const
Fetch name of this field.
Definition: ogr_feature.h:123
OGRBoolean
int OGRBoolean
Type for a OGR boolean.
Definition: ogr_core.h:334
OGRFeatureDefnH
void * OGRFeatureDefnH
Opaque type for a feature definition (OGRFeatureDefn)
Definition: ogr_api.h:333
OGRFieldDefn::SetPrecision
void SetPrecision(int nPrecisionIn)
Set the formatting precision for this field in characters.
Definition: ogr_feature.h:144
OGRFeatureDefn::GetFieldDefn
virtual OGRFieldDefn * GetFieldDefn(int i)
Fetch field definition.
Definition: ogrfeaturedefn.cpp:313
OGRFeature::FieldValue
Field value.
Definition: ogr_feature.h:397
OGRGeomFieldDefnH
struct OGRGeomFieldDefnHS * OGRGeomFieldDefnH
Opaque type for a geometry field definition (OGRGeomFieldDefn)
Definition: ogr_api.h:340
OGRFeature::begin
ConstFieldIterator begin() const
Return begin of field value iterator.
Definition: ogrfeature.cpp:7072
OGRFieldDomain::GetMergePolicy
OGRFieldDomainMergePolicy GetMergePolicy() const
Get the merge policy.
Definition: ogr_feature.h:922
OGRFieldDefn::IsUnique
int IsUnique() const
Return whether this field has a unique constraint.
Definition: ogr_feature.h:160
OGRGlobFieldDomain
Definition of a field domain for field content validated by a glob.
Definition: ogr_feature.h:1069
OGRField
OGRFeature field attribute value union.
Definition: ogr_core.h:738
OGRFeature::GetDefnRef
OGRFeatureDefn * GetDefnRef()
Fetch feature definition.
Definition: ogr_feature.h:587
OGRFeatureDefn::GetGeomFieldDefn
virtual OGRGeomFieldDefn * GetGeomFieldDefn(int i)
Fetch geometry field definition.
Definition: ogrfeaturedefn.cpp:642
OGRFeature::SetField
void SetField(const char *pszFName, int nCount, const double *padfValues)
Set field to list of doubles value.
Definition: ogr_feature.h:713
OGRCodedValue
Associates a code and a value.
Definition: ogr_core.h:979
OGRFeature::GetFieldIndex
int GetFieldIndex(const char *pszName) const
Fetch the field index given field name.
Definition: ogr_feature.h:622
CSLConstList
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition: cpl_port.h:1169
OGRFeature::FieldValue::Unset
void Unset()
Unset the field.
Definition: ogr_feature.h:439
OGRFeatureDefn::GetFieldCount
virtual int GetFieldCount() const
Fetch number of fields on this feature.
Definition: ogrfeaturedefn.cpp:269
OGRFeature::SetField
void SetField(const char *pszFName, const char *pszValue)
Set field to string value.
Definition: ogr_feature.h:705
OGRFieldDomain::GetName
const std::string & GetName() const
Get the name of the field domain.
Definition: ogr_feature.h:871
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:720
OGRFieldDefn::FromHandle
static OGRFieldDefn * FromHandle(OGRFieldDefnH hFieldDefn)
Convert a OGRFieldDefnH to a OGRFieldDefn*.
Definition: ogr_feature.h:177
OGRFieldDomainH
struct OGRFieldDomainHS * OGRFieldDomainH
Opaque type for a field domain definition (OGRFieldDomain)
Definition: ogr_api.h:343
OGRFieldDefn
Definition of an attribute of an OGRFeatureDefn.
Definition: ogr_feature.h:98
OGRGeomFieldDefn::IsNullable
int IsNullable() const
Return whether this geometry field can receive null values.
Definition: ogr_feature.h:233
ogr_featurestyle.h
OGRFieldDefn::SetUnique
void SetUnique(int bUniqueIn)
Set whether this field has a unique constraint.
Definition: ogr_feature.h:161
OGRFeature::SetField
void SetField(const char *pszFName, int nCount, const int *panValues)
Set field to list of integers value.
Definition: ogr_feature.h:707
OGRRangeFieldDomain
Definition of a numeric field domain with a range of validity for values.
Definition: ogr_feature.h:980
OGRJustification
OGRJustification
Display justification for field values.
Definition: ogr_core.h:697
OGRFeatureDefn::SetStyleIgnored
virtual void SetStyleIgnored(bool bIgnore)
Set whether the style can be omitted when fetching features.
Definition: ogr_feature.h:331
OGRFieldDefnH
void * OGRFieldDefnH
Opaque type for a field definition (OGRFieldDefn)
Definition: ogr_api.h:331
OGRFieldDomain::GetFieldType
OGRFieldType GetFieldType() const
Get the field type.
Definition: ogr_feature.h:890
OGRGeomFieldDefn
Definition of a geometry field of an OGRFeatureDefn.
Definition: ogr_feature.h:201
OGRFeature::FieldValue::GetDouble
double GetDouble() const
Return the double value.
Definition: ogr_feature.h:487
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:673
OGRFieldDomain
Definition of a field domain.
Definition: ogr_feature.h:835
OGRFeature::FromHandle
static OGRFeature * FromHandle(OGRFeatureH hFeature)
Convert a OGRFeatureH to a OGRFeature*.
Definition: ogr_feature.h:779
OGRFeatureDefn::Dereference
int Dereference()
Decrements the reference count by one.
Definition: ogr_feature.h:324
end
OGRLayer::FeatureIterator end(OGRLayer *poLayer)
Return end of feature iterator.
Definition: ogrsf_frmts.h:292
OGRFieldDefn::GetType
OGRFieldType GetType() const
Fetch type of this field.
Definition: ogr_feature.h:128
OGRFeatureDefn::GetFieldIndex
virtual int GetFieldIndex(const char *) const
Find field by name.
Definition: ogrfeaturedefn.cpp:1182
OGRFieldDomain::GetFieldSubType
OGRFieldSubType GetFieldSubType() const
Get the field subtype.
Definition: ogr_feature.h:896
OGRFieldDefn::GetAlternativeNameRef
const char * GetAlternativeNameRef() const
Fetch the alternative name (or "alias") for this field.
Definition: ogr_feature.h:126
OGRFieldDomainSplitPolicy
OGRFieldDomainSplitPolicy
Split policy for field domains.
Definition: ogr_core.h:1009
OGRErr
int OGRErr
Type for a OGR error.
Definition: ogr_core.h:318
OGRFieldDomain::ToHandle
static OGRFieldDomainH ToHandle(OGRFieldDomain *poFieldDomain)
Convert a OGRFieldDomain* to a OGRFieldDomainH.
Definition: ogr_feature.h:899
GIntBig
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition: cpl_port.h:244
OGRFeature::GetFieldDefnRef
const OGRFieldDefn * GetFieldDefnRef(int iField) const
Fetch definition for this field.
Definition: ogr_feature.h:618
OGRFeature::FieldValue::GetInteger
int GetInteger() const
Return the integer value.
Definition: ogr_feature.h:475
OGRFeature::GetRawFieldRef
const OGRField * GetRawFieldRef(int i) const
Fetch a pointer to the internal field value given the index.
Definition: ogr_feature.h:636
OGRwkbGeometryType
OGRwkbGeometryType
List of well known binary geometry types.
Definition: ogr_core.h:345
OGRFieldDefn::IsIgnored
int IsIgnored() const
Return whether this field should be omitted when fetching features.
Definition: ogr_feature.h:154
OGRFeature::SetField
void SetField(const char *pszFName, double dfValue)
Set field to double value.
Definition: ogr_feature.h:703
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:894
OGRFeature::GetRawFieldRef
OGRField * GetRawFieldRef(int i)
Fetch a pointer to the internal field value given the index.
Definition: ogr_feature.h:635
OGRFeatureDefn::Reference
int Reference()
Increments the reference count by one.
Definition: ogr_feature.h:323
OGRCodedFieldDomain
Definition of a coded / enumerated field domain.
Definition: ogr_feature.h:937
OGRFeature
A simple feature, including geometry and attributes.
Definition: ogr_feature.h:370
OGRFeature::end
ConstFieldIterator end() const
Return end of field value iterator.
Definition: ogrfeature.cpp:7077
OGRFeature::GetGeomFieldDefnRef
const OGRGeomFieldDefn * GetGeomFieldDefnRef(int iField) const
Fetch definition for this geometry field.
Definition: ogr_feature.h:600
OGRGeomFieldDefn::GetType
OGRwkbGeometryType GetType() const
Fetch geometry type of this field.
Definition: ogr_feature.h:224
OGRFeature::GetNativeMediaType
const char * GetNativeMediaType() const
Returns the native media type for the feature.
Definition: ogr_feature.h:762
OGRFieldSubType
OGRFieldSubType
List of field subtypes.
Definition: ogr_core.h:673
OGRFieldDefn::SetNullable
void SetNullable(int bNullableIn)
Set whether this field can receive null values.
Definition: ogr_feature.h:158
OGRGeomFieldDefn::SetNullable
void SetNullable(int bNullableIn)
Set whether this geometry field can receive null values.
Definition: ogr_feature.h:234
OGRRangeFieldDomain::Clone
OGRRangeFieldDomain * Clone() const override
Clone.
Definition: ogr_feature.h:1025
OGRGeomFieldDefn::FromHandle
static OGRGeomFieldDefn * FromHandle(OGRGeomFieldDefnH hGeomFieldDefn)
Convert a OGRGeomFieldDefnH to a OGRGeomFieldDefn*.
Definition: ogr_feature.h:248
OGRFeatureDefn::ToHandle
static OGRFeatureDefnH ToHandle(OGRFeatureDefn *poFeatureDefn)
Convert a OGRFeatureDefn* to a OGRFeatureDefnH.
Definition: ogr_feature.h:349
OGRFieldDefn::IsNullable
int IsNullable() const
Return whether this field can receive null values.
Definition: ogr_feature.h:157
OGRFieldType
OGRFieldType
List of feature field types.
Definition: ogr_core.h:645
OGRFeatureDefnH
void * OGRFeatureDefnH
Opaque type for a feature definition (OGRFeatureDefn)
Definition: ogr_feature.h:62
OGRFeatureDefn::GetGeomFieldCount
virtual int GetGeomFieldCount() const
Fetch number of geometry fields on this feature.
Definition: ogrfeaturedefn.cpp:593
OGRFeature::GetFieldAsInteger64
GIntBig GetFieldAsInteger64(const char *pszFName) const
Fetch field value as integer 64 bit.
Definition: ogr_feature.h:663
OGRFeature::GetFieldAsString
const char * GetFieldAsString(const char *pszFName) const
Fetch field value as a string.
Definition: ogr_feature.h:667
OGRFeature::FieldValue::GetInteger64
GIntBig GetInteger64() const
Return the 64-bit integer value.
Definition: ogr_feature.h:481
OGRFeature::SetField
void SetField(const char *pszFName, OGRField *puValue)
Set field.
Definition: ogr_feature.h:718
OGRFeature::SetField
void SetField(const char *pszFName, const char *const *papszValues)
Set field to list of strings value.
Definition: ogr_feature.h:716
OGRFieldDefn::SetWidth
void SetWidth(int nWidthIn)
Set the formatting width for this field in characters.
Definition: ogr_feature.h:141
OGRFeatureDefn
Definition of a feature class or feature layer.
Definition: ogr_feature.h:278
OGRGlobFieldDomain::GetGlob
const std::string & GetGlob() const
Get the glob expression.
Definition: ogr_feature.h:1104
OGRFeature::GetFieldAsInteger
int GetFieldAsInteger(const char *pszFName) const
Fetch field value as integer.
Definition: ogr_feature.h:661
OGRFeatureDefn::GetReferenceCount
int GetReferenceCount() const
Fetch current reference count.
Definition: ogr_feature.h:325
OGRFieldDefn::GetSubType
OGRFieldSubType GetSubType() const
Fetch subtype of this field.
Definition: ogr_feature.h:132
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:699
OGRFeature::GetFieldAsIntegerList
const int * GetFieldAsIntegerList(const char *pszFName, int *pnCount) const
Fetch field value as a list of integers.
Definition: ogr_feature.h:669
wkbUnknown
@ wkbUnknown
unknown type, non-standard
Definition: ogr_core.h:347
OGRFieldDomainH
struct OGRFieldDomainHS * OGRFieldDomainH
Opaque type for a field domain definition (OGRFieldDomain)
Definition: ogr_feature.h:72
OGRGlobFieldDomain::Clone
OGRGlobFieldDomain * Clone() const override
Clone.
Definition: ogr_feature.h:1094
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:955
OGRFieldDefn::GetJustify
OGRJustification GetJustify() const
Get the justification for this field.
Definition: ogr_feature.h:136
OGRFeature::GetNativeData
const char * GetNativeData() const
Returns the native data for the feature.
Definition: ogr_feature.h:761
OGRFieldDomain::GetDomainType
OGRFieldDomainType GetDomainType() const
Get the type of the field domain.
Definition: ogr_feature.h:884
OGRFeature::GetFID
GIntBig GetFID() const
Get feature identifier.
Definition: ogr_feature.h:728
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:710
OGRFieldDefn::ToHandle
static OGRFieldDefnH ToHandle(OGRFieldDefn *poFieldDefn)
Convert a OGRFieldDefn* to a OGRFieldDefnH.
Definition: ogr_feature.h:171