Quantum GIS API Documentation  1.7.5-Wroclaw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
qgsfield.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsfield.cpp - 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  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  ***************************************************************************/
16 /* $Id$ */
17 
18 #include "qgsfield.h"
19 
20 static const char * const ident_ =
21  "$Id$";
22 
23 /*
24 QgsField::QgsField(QString nam, QString typ, int len, int prec, bool num,
25  QString comment)
26  :mName(nam), mType(typ), mLength(len), mPrecision(prec), mNumeric(num),
27  mComment(comment)
28 {
29  // This function used to lower case the field name since some stores
30  // use upper case (eg. shapefiles), but that caused problems with
31  // attribute actions getting confused between uppercase and
32  // lowercase versions of the attribute names, so just leave the
33  // names how they are now.
34 }*/
35 
36 QgsField::QgsField( QString name, QVariant::Type type, QString typeName, int len, int prec, QString comment )
37  : mName( name ), mType( type ), mTypeName( typeName ),
38  mLength( len ), mPrecision( prec ), mComment( comment )
39 {
40 }
41 
42 
44 {
45 }
46 
47 bool QgsField::operator==( const QgsField& other ) const
48 {
49  return (( mName == other.mName ) && ( mType == other.mType ) && ( mTypeName == other.mTypeName )
50  && ( mLength == other.mLength ) && ( mPrecision == other.mPrecision ) );
51 }
52 
53 const QString & QgsField::name() const
54 {
55  return mName;
56 }
57 
58 QVariant::Type QgsField::type() const
59 {
60  return mType;
61 }
62 
63 const QString & QgsField::typeName() const
64 {
65  return mTypeName;
66 }
67 
68 int QgsField::length() const
69 {
70  return mLength;
71 }
72 
74 {
75  return mPrecision;
76 }
77 
78 const QString & QgsField::comment() const
79 {
80  return mComment;
81 }
82 
83 void QgsField::setName( const QString & nam )
84 {
85  mName = nam;
86 }
87 
88 void QgsField::setType( QVariant::Type type )
89 {
90  mType = type;
91 }
92 
93 void QgsField::setTypeName( const QString & typeName )
94 {
96 }
97 
98 void QgsField::setLength( int len )
99 {
100  mLength = len;
101 }
102 void QgsField::setPrecision( int prec )
103 {
104  mPrecision = prec;
105 }
106 
107 void QgsField::setComment( const QString & comment )
108 {
109  mComment = comment;
110 }