Quantum GIS API Documentation  1.7.5-Wroclaw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
qgsfield.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsfield.h - Describes a field in a layer or table
3  --------------------------------------
4  Date : 01-Jan-2004
5  Copyright : (C) 2004 by Gary E.Sherman
6  email : sherman at mrcc.com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 /* $Id$ */
16 
17 #ifndef QGSFIELD_H
18 #define QGSFIELD_H
19 
20 #include <QString>
21 #include <QVariant>
22 
29 class CORE_EXPORT QgsField
30 {
31  public:
44  QgsField( QString name = QString(),
45  QVariant::Type type = QVariant::Invalid,
46  QString typeName = QString(),
47  int len = 0,
48  int prec = 0,
49  QString comment = QString() );
50 
52  ~QgsField();
53 
54  bool operator==( const QgsField& other ) const;
55 
57  const QString & name() const;
58 
60  QVariant::Type type() const;
61 
68  const QString & typeName() const;
69 
70 
75  int length() const;
76 
77 
82  int precision() const;
83 
87  const QString & comment() const;
88 
93  void setName( const QString & nam );
94 
98  void setType( QVariant::Type type );
99 
104  void setTypeName( const QString & typ );
105 
110  void setLength( int len );
111 
116  void setPrecision( int prec );
117 
118 
122  void setComment( const QString & comment );
123 
124  private:
125 
127  QString mName;
128 
130  QVariant::Type mType;
131 
133  QString mTypeName;
134 
136  int mLength;
137 
140 
142  QString mComment;
143 
144 }; // class QgsField
145 
146 // key = field index, value=field data
147 typedef QMap<int, QgsField> QgsFieldMap;
148 
149 #endif