Quantum GIS API Documentation
1.8
|
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 00017 #include "qgsfield.h" 00018 00019 /* 00020 QgsField::QgsField(QString nam, QString typ, int len, int prec, bool num, 00021 QString comment) 00022 :mName(nam), mType(typ), mLength(len), mPrecision(prec), mNumeric(num), 00023 mComment(comment) 00024 { 00025 // This function used to lower case the field name since some stores 00026 // use upper case (eg. shapefiles), but that caused problems with 00027 // attribute actions getting confused between uppercase and 00028 // lowercase versions of the attribute names, so just leave the 00029 // names how they are now. 00030 }*/ 00031 00032 QgsField::QgsField( QString name, QVariant::Type type, QString typeName, int len, int prec, QString comment ) 00033 : mName( name ), mType( type ), mTypeName( typeName ), 00034 mLength( len ), mPrecision( prec ), mComment( comment ) 00035 { 00036 } 00037 00038 00039 QgsField::~QgsField() 00040 { 00041 } 00042 00043 bool QgsField::operator==( const QgsField& other ) const 00044 { 00045 return (( mName == other.mName ) && ( mType == other.mType ) && ( mTypeName == other.mTypeName ) 00046 && ( mLength == other.mLength ) && ( mPrecision == other.mPrecision ) ); 00047 } 00048 00049 const QString & QgsField::name() const 00050 { 00051 return mName; 00052 } 00053 00054 QVariant::Type QgsField::type() const 00055 { 00056 return mType; 00057 } 00058 00059 const QString & QgsField::typeName() const 00060 { 00061 return mTypeName; 00062 } 00063 00064 int QgsField::length() const 00065 { 00066 return mLength; 00067 } 00068 00069 int QgsField::precision() const 00070 { 00071 return mPrecision; 00072 } 00073 00074 const QString & QgsField::comment() const 00075 { 00076 return mComment; 00077 } 00078 00079 void QgsField::setName( const QString & nam ) 00080 { 00081 mName = nam; 00082 } 00083 00084 void QgsField::setType( QVariant::Type type ) 00085 { 00086 mType = type; 00087 } 00088 00089 void QgsField::setTypeName( const QString & typeName ) 00090 { 00091 mTypeName = typeName; 00092 } 00093 00094 void QgsField::setLength( int len ) 00095 { 00096 mLength = len; 00097 } 00098 void QgsField::setPrecision( int prec ) 00099 { 00100 mPrecision = prec; 00101 } 00102 00103 void QgsField::setComment( const QString & comment ) 00104 { 00105 mComment = comment; 00106 }