45 QVariant::Type type = QVariant::Invalid,
46 QString typeName = QString(),
49 QString comment = QString() );
58 const QString & name()
const;
61 QVariant::Type type()
const;
69 const QString & typeName()
const;
83 int precision()
const;
88 const QString & comment()
const;
94 void setName(
const QString & nam );
99 void setType( QVariant::Type type );
105 void setTypeName(
const QString & typ );
111 void setLength(
int len );
117 void setPrecision(
int prec );
123 void setComment(
const QString & comment );
126 QString displayString(
const QVariant& v )
const;
176 Field(): origin( OriginUnknown ), originIndex( -1 ) {}
187 bool append(
const QgsField& field,
FieldOrigin origin = OriginProvider,
int originIndex = -1 );
189 void remove(
int fieldIdx );
194 inline bool isEmpty()
const {
return mFields.isEmpty(); }
196 inline int count()
const {
return mFields.count(); }
198 inline int size()
const {
return mFields.count(); }
202 inline bool exists(
int i )
const {
return i >= 0 && i < mFields.count(); }
209 const QgsField&
at(
int i )
const {
return mFields[i].field; }
211 const QgsField&
field(
int fieldIdx )
const {
return mFields[fieldIdx].field; }
213 const QgsField&
field(
const QString& name )
const {
return mFields[ indexFromName( name )].field; }
221 int indexFromName(
const QString& name )
const {
return mNameToIndex.value( name, -1 ); }
224 QList<QgsField> toList()
const;