Quantum GIS API Documentation  1.8
src/core/qgsfield.h
Go to the documentation of this file.
00001 /***************************************************************************
00002                qgsfield.h - Describes a field in a layer or table
00003                      --------------------------------------
00004                Date                 : 01-Jan-2004
00005                Copyright            : (C) 2004 by Gary E.Sherman
00006                email                : sherman at mrcc.com
00007  ***************************************************************************
00008  *                                                                         *
00009  *   This program is free software; you can redistribute it and/or modify  *
00010  *   it under the terms of the GNU General Public License as published by  *
00011  *   the Free Software Foundation; either version 2 of the License, or     *
00012  *   (at your option) any later version.                                   *
00013  *                                                                         *
00014  ***************************************************************************/
00015 
00016 #ifndef QGSFIELD_H
00017 #define QGSFIELD_H
00018 
00019 #include <QString>
00020 #include <QVariant>
00021 
00028 class CORE_EXPORT QgsField
00029 {
00030   public:
00043     QgsField( QString name = QString(),
00044               QVariant::Type type = QVariant::Invalid,
00045               QString typeName = QString(),
00046               int len = 0,
00047               int prec = 0,
00048               QString comment = QString() );
00049 
00051     ~QgsField();
00052 
00053     bool operator==( const QgsField& other ) const;
00054 
00056     const QString & name() const;
00057 
00059     QVariant::Type type() const;
00060 
00067     const QString & typeName() const;
00068 
00069 
00074     int length() const;
00075 
00076 
00081     int precision() const;
00082 
00086     const QString & comment() const;
00087 
00092     void setName( const QString & nam );
00093 
00097     void setType( QVariant::Type type );
00098 
00103     void setTypeName( const QString & typ );
00104 
00109     void setLength( int len );
00110 
00115     void setPrecision( int prec );
00116 
00117 
00121     void setComment( const QString & comment );
00122 
00123   private:
00124 
00126     QString mName;
00127 
00129     QVariant::Type mType;
00130 
00132     QString mTypeName;
00133 
00135     int mLength;
00136 
00138     int mPrecision;
00139 
00141     QString mComment;
00142 
00143 }; // class QgsField
00144 
00145 // key = field index, value=field data
00146 typedef QMap<int, QgsField> QgsFieldMap;
00147 
00148 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines