Quantum GIS API Documentation  1.7.4
src/core/qgsfield.cpp
Go to the documentation of this file.
00001 /***************************************************************************
00002        qgsfield.cpp - 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  *                                                                         *
00010  *   This program is free software; you can redistribute it and/or modify  *
00011  *   it under the terms of the GNU General Public License as published by  *
00012  *   the Free Software Foundation; either version 2 of the License, or     *
00013  *   (at your option) any later version.                                   *
00014  *                                                                         *
00015  ***************************************************************************/
00016 /* $Id$ */
00017 
00018 #include "qgsfield.h"
00019 
00020 static const char * const ident_ =
00021   "$Id$";
00022 
00023 /*
00024 QgsField::QgsField(QString nam, QString typ, int len, int prec, bool num,
00025                    QString comment)
00026     :mName(nam), mType(typ), mLength(len), mPrecision(prec), mNumeric(num),
00027      mComment(comment)
00028 {
00029   // This function used to lower case the field name since some stores
00030   // use upper case (eg. shapefiles), but that caused problems with
00031   // attribute actions getting confused between uppercase and
00032   // lowercase versions of the attribute names, so just leave the
00033   // names how they are now.
00034 }*/
00035 
00036 QgsField::QgsField( QString name, QVariant::Type type, QString typeName, int len, int prec, QString comment )
00037     : mName( name ), mType( type ), mTypeName( typeName ),
00038     mLength( len ), mPrecision( prec ), mComment( comment )
00039 {
00040 }
00041 
00042 
00043 QgsField::~QgsField()
00044 {
00045 }
00046 
00047 bool QgsField::operator==( const QgsField& other ) const
00048 {
00049   return (( mName == other.mName ) && ( mType == other.mType ) && ( mTypeName == other.mTypeName )
00050           && ( mLength == other.mLength ) && ( mPrecision == other.mPrecision ) );
00051 }
00052 
00053 const QString & QgsField::name() const
00054 {
00055   return mName;
00056 }
00057 
00058 QVariant::Type QgsField::type() const
00059 {
00060   return mType;
00061 }
00062 
00063 const QString & QgsField::typeName() const
00064 {
00065   return mTypeName;
00066 }
00067 
00068 int QgsField::length() const
00069 {
00070   return mLength;
00071 }
00072 
00073 int QgsField::precision() const
00074 {
00075   return mPrecision;
00076 }
00077 
00078 const QString & QgsField::comment() const
00079 {
00080   return mComment;
00081 }
00082 
00083 void QgsField::setName( const QString & nam )
00084 {
00085   mName = nam;
00086 }
00087 
00088 void QgsField::setType( QVariant::Type type )
00089 {
00090   mType = type;
00091 }
00092 
00093 void QgsField::setTypeName( const QString & typeName )
00094 {
00095   mTypeName = typeName;
00096 }
00097 
00098 void QgsField::setLength( int len )
00099 {
00100   mLength = len;
00101 }
00102 void QgsField::setPrecision( int prec )
00103 {
00104   mPrecision = prec;
00105 }
00106 
00107 void QgsField::setComment( const QString & comment )
00108 {
00109   mComment = comment;
00110 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines