QGIS API Documentation
2.6.0-Brighton
|
Container of fields for a vector layer. More...
#include <qgsfield.h>
Classes | |
struct | Field |
Public Types | |
enum | FieldOrigin { OriginUnknown, OriginProvider, OriginJoin, OriginEdit, OriginExpression } |
typedef struct QgsFields::Field | Field |
Public Member Functions | |
void | clear () |
Remove all fields. | |
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) | |
void | remove (int fieldIdx) |
Remove a field with the given index. | |
void | extend (const QgsFields &other) |
Extend with fields from another QgsFields container. | |
bool | isEmpty () const |
Check whether the container is empty. | |
int | count () const |
Return number of items. | |
int | size () const |
Return number of items. | |
bool | exists (int i) const |
Return if a field index is valid. | |
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) | |
const QgsField & | at (int i) const |
Get field at particular index (must be in range 0..N-1) | |
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) | |
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. | |
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. | |
QgsAttributeList | allAttributesList () const |
Utility function to get list of attribute indexes. | |
QList< QgsField > | toList () const |
Utility function to return a list of QgsField instances. | |
bool | operator== (const QgsFields &other) const |
bool | operator!= (const QgsFields &other) const |
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:
typedef struct QgsFields::Field QgsFields::Field |
QgsAttributeList QgsFields::allAttributesList | ( | ) | const |
Utility function to get list of attribute indexes.
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)
bool QgsFields::appendExpressionField | ( | const QgsField & | field, |
int | originIndex | ||
) |
Append an expression field. The field must have unique name, otherwise it is rejected (returns false)
|
inline |
Get field at particular index (must be in range 0..N-1)
void QgsFields::clear | ( | ) |
Remove all fields.
|
inline |
Return number of items.
|
inline |
Return if a field index is valid.
i | Index of the field which needs to be checked |
void QgsFields::extend | ( | const QgsFields & | other | ) |
Extend with fields from another QgsFields container.
|
inline |
Get field at particular index (must be in range 0..N-1)
|
inline |
Get field at particular index (must be in range 0..N-1)
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.
|
inline |
Get field's origin (value from an enumeration)
|
inline |
Get field's origin index (its meaning is specific to each type of origin)
|
inline |
Look up field's index from name. Returns -1 on error.
|
inline |
Check whether the container is empty.
|
inline |
|
inline |
|
inline |
Get field at particular index (must be in range 0..N-1)
|
inline |
Get field at particular index (must be in range 0..N-1)
void QgsFields::remove | ( | int | fieldIdx | ) |
Remove a field with the given index.
|
inline |
Return number of items.
QList< QgsField > QgsFields::toList | ( | ) | const |
Utility function to return a list of QgsField instances.
|
protected |
internal storage of the container
|
protected |
map for quick resolution of name to index