QGIS API Documentation
2.8.2-Wien
|
Container of fields for a vector layer. More...
#include <qgsfield.h>
Classes | |
struct | Field |
Public Types | |
typedef struct QgsFields::Field | Field |
enum | FieldOrigin { OriginUnknown, OriginProvider, OriginJoin, OriginEdit, OriginExpression } |
Public Member Functions | |
QgsAttributeList | allAttributesList () const |
Utility function to get list of attribute indexes. | |
bool | append (const QgsField &field, FieldOrigin origin=OriginProvider, int originIndex=-1) |
Append a field. The field must have unique name, otherwise it is rejected (returns false) | |
bool | appendExpressionField (const QgsField &field, int originIndex) |
Append an expression field. The field must have unique name, otherwise it is rejected (returns false) | |
const QgsField & | at (int i) const |
Get field at particular index (must be in range 0..N-1) | |
void | clear () |
Remove all fields. | |
int | count () const |
Return number of items. | |
bool | exists (int i) const |
Return if a field index is valid. | |
void | extend (const QgsFields &other) |
Extend with fields from another QgsFields container. | |
const QgsField & | field (int fieldIdx) const |
Get field at particular index (must be in range 0..N-1) | |
const QgsField & | field (const QString &name) const |
Get field at particular index (must be in range 0..N-1) | |
int | fieldNameIndex (const QString &fieldName) const |
Look up field's index from name - case insensitive TODO: sort out case sensitive (indexFromName()) vs insensitive (fieldNameIndex()) calls. | |
FieldOrigin | fieldOrigin (int fieldIdx) const |
Get field's origin (value from an enumeration) | |
int | fieldOriginIndex (int fieldIdx) const |
Get field's origin index (its meaning is specific to each type of origin) | |
int | indexFromName (const QString &name) const |
Look up field's index from name. Returns -1 on error. | |
bool | isEmpty () const |
Check whether the container is empty. | |
bool | operator!= (const QgsFields &other) const |
bool | operator== (const QgsFields &other) const |
const QgsField & | operator[] (int i) const |
Get field at particular index (must be in range 0..N-1) | |
QgsField & | operator[] (int i) |
Get field at particular index (must be in range 0..N-1) | |
void | remove (int fieldIdx) |
Remove a field with the given index. | |
int | size () const |
Return number of items. | |
QList< QgsField > | toList () const |
Utility function to return a list of QgsField instances. |
Protected Attributes | |
QVector< Field > | mFields |
internal storage of the container | |
QHash< QString, int > | mNameToIndex |
map for quick resolution of name to index |
Container of fields for a vector layer.
In addition to storing a list of QgsField instances, it also:
Definition at line 172 of file qgsfield.h.
typedef struct QgsFields::Field QgsFields::Field |
Definition at line 176 of file qgsfield.h.
QgsAttributeList QgsFields::allAttributesList | ( | ) | const |
Utility function to get list of attribute indexes.
Definition at line 246 of file qgsfield.cpp.
bool QgsFields::append | ( | const QgsField & | field, |
FieldOrigin | origin = OriginProvider , |
||
int | originIndex = -1 |
||
) |
Append a field. The field must have unique name, otherwise it is rejected (returns false)
Definition at line 177 of file qgsfield.cpp.
bool QgsFields::appendExpressionField | ( | const QgsField & | field, |
int | originIndex | ||
) |
Append an expression field. The field must have unique name, otherwise it is rejected (returns false)
Definition at line 190 of file qgsfield.cpp.
|
inline |
Get field at particular index (must be in range 0..N-1)
Definition at line 227 of file qgsfield.h.
void QgsFields::clear | ( | ) |
Remove all fields.
Definition at line 171 of file qgsfield.cpp.
|
inline |
Return number of items.
Definition at line 214 of file qgsfield.h.
|
inline |
Return if a field index is valid.
i | Index of the field which needs to be checked |
Definition at line 220 of file qgsfield.h.
void QgsFields::extend | ( | const QgsFields & | other | ) |
Extend with fields from another QgsFields container.
Definition at line 210 of file qgsfield.cpp.
|
inline |
Get field at particular index (must be in range 0..N-1)
Definition at line 229 of file qgsfield.h.
|
inline |
Get field at particular index (must be in range 0..N-1)
Definition at line 231 of file qgsfield.h.
int QgsFields::fieldNameIndex | ( | const QString & | fieldName | ) | const |
Look up field's index from name - case insensitive TODO: sort out case sensitive (indexFromName()) vs insensitive (fieldNameIndex()) calls.
Definition at line 234 of file qgsfield.cpp.
QgsFields::FieldOrigin QgsFields::fieldOrigin | ( | int | fieldIdx | ) | const |
Get field's origin (value from an enumeration)
Definition at line 218 of file qgsfield.cpp.
|
inline |
Get field's origin index (its meaning is specific to each type of origin)
Definition at line 236 of file qgsfield.h.
|
inline |
Look up field's index from name. Returns -1 on error.
Definition at line 239 of file qgsfield.h.
|
inline |
Check whether the container is empty.
Definition at line 212 of file qgsfield.h.
|
inline |
Definition at line 256 of file qgsfield.h.
|
inline |
Definition at line 254 of file qgsfield.h.
|
inline |
Get field at particular index (must be in range 0..N-1)
Definition at line 223 of file qgsfield.h.
|
inline |
Get field at particular index (must be in range 0..N-1)
Definition at line 225 of file qgsfield.h.
void QgsFields::remove | ( | int | fieldIdx | ) |
Remove a field with the given index.
Definition at line 201 of file qgsfield.cpp.
|
inline |
Return number of items.
Definition at line 216 of file qgsfield.h.
QList< QgsField > QgsFields::toList | ( | ) | const |
Utility function to return a list of QgsField instances.
Definition at line 226 of file qgsfield.cpp.
|
protected |
internal storage of the container
Definition at line 260 of file qgsfield.h.
|
protected |
map for quick resolution of name to index
Definition at line 263 of file qgsfield.h.