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; }
241 int indexFromName(
const QString& name )
const {
return mNameToIndex.value( name, -1 ); }
246 int fieldNameIndex(
const QString& fieldName )
const;
253 QList<QgsField> toList()
const;