49 QVariant::Type type = QVariant::Invalid,
50 QString typeName = QString(),
53 QString comment = QString() );
62 const QString & name()
const;
65 QVariant::Type type()
const;
73 const QString & typeName()
const;
87 int precision()
const;
92 const QString & comment()
const;
98 void setName(
const QString & nam );
103 void setType( QVariant::Type type );
109 void setTypeName(
const QString & typ );
115 void setLength(
int len );
121 void setPrecision(
int prec );
127 void setComment(
const QString & comment );
130 QString displayString(
const QVariant& v )
const;
139 bool convertCompatible( QVariant& v )
const;
147 QVariant::Type mType;
187 Field(): origin( OriginUnknown ), originIndex( -1 ) {}
203 bool append(
const QgsField& field,
FieldOrigin origin = OriginProvider,
int originIndex = -1 );
205 bool appendExpressionField(
const QgsField& field,
int originIndex );
207 void remove(
int fieldIdx );
212 inline bool isEmpty()
const {
return mFields.isEmpty(); }
214 inline int count()
const {
return mFields.count(); }
216 inline int size()
const {
return mFields.count(); }
220 inline bool exists(
int i )
const {
return i >= 0 && i < mFields.count(); }
227 const QgsField&
at(
int i )
const {
return mFields[i].field; }
229 const QgsField&
field(
int fieldIdx )
const {
return mFields[fieldIdx].field; }
231 const QgsField&
field(
const QString& name )
const {
return mFields[ indexFromName( name )].field; }
239 int indexFromName(
const QString& name )
const {
return mNameToIndex.value( name, -1 ); }
244 int fieldNameIndex(
const QString& fieldName )
const;
251 QList<QgsField> toList()
const;
Class for parsing and evaluation of expressions (formerly called "search strings").
field comes from a joined layer (originIndex / 1000 = index of the join, originIndex % 1000 = index w...
field has been temporarily added in editing mode (originIndex = index in the list of added attributes...
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
const QgsField & field(int fieldIdx) const
Get field at particular index (must be in range 0..N-1)
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
Container of fields for a vector layer.
const QgsField & at(int i) const
Get field at particular index (must be in range 0..N-1)
field comes from the underlying data provider of the vector layer (originIndex = index in provider's ...
it has not been specified where the field comes from
bool operator==(const Field &other) const
bool exists(int i) const
Return if a field index is valid.
Field(const QgsField &f, FieldOrigin o, int oi)
int fieldOriginIndex(int fieldIdx) const
Get field's origin index (its meaning is specific to each type of origin)
QList< int > QgsAttributeList
QHash< QString, int > mNameToIndex
map for quick resolution of name to index
int count() const
Return number of items.
Encapsulate a field in an attribute table or data source.
int indexFromName(const QString &name) const
Look up field's index from name. Returns -1 on error.
const QgsField & operator[](int i) 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 size() const
Return number of items.
bool operator!=(const Field &other) const
QVector< Field > mFields
internal storage of the container
QgsField & operator[](int i)
Get field at particular index (must be in range 0..N-1)
QList< int > QgsAttributeList
int originIndex
index specific to the origin
bool operator!=(const QgsFields &other) const
FieldOrigin origin
origin of the field
bool isEmpty() const
Check whether the container is empty.
bool operator==(const QgsFields &other) const