1
1
/***************************************************************************
2
qgsfield.cpp - Describes a field in a layer or table
3
--------------------------------------
5
Copyright : (C) 2004 by Gary E.Sherman
6
email : sherman at mrcc.com
2
qgsfield.cpp - Describes a field in a layer or table
3
--------------------------------------
5
Copyright : (C) 2004 by Gary E.Sherman
6
email : sherman at mrcc.com
8
8
***************************************************************************
10
10
* This program is free software; you can redistribute it and/or modify *
13
13
* (at your option) any later version. *
15
15
***************************************************************************/
16
/* $Id: qgsfield.cpp 5501 2006-06-01 10:33:19Z g_j_m $ */
19
18
#include "qgsfield.h"
24
static const char * const ident_ =
25
"$Id: qgsfield.cpp 5501 2006-06-01 10:33:19Z g_j_m $";
28
QgsField::QgsField(QString nam, QString typ, int len, int prec, bool num)
29
:mName(nam), mType(typ), mLength(len), mPrecision(prec), mNumeric(num)
20
static const char * const ident_ =
24
QgsField::QgsField(QString nam, QString typ, int len, int prec, bool num,
26
:mName(nam), mType(typ), mLength(len), mPrecision(prec), mNumeric(num),
31
29
// This function used to lower case the field name since some stores
32
30
// use upper case (eg. shapefiles), but that caused problems with
33
31
// attribute actions getting confused between uppercase and
34
32
// lowercase versions of the attribute names, so just leave the
35
33
// names how they are now.
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 )
38
43
QgsField::~QgsField()
42
bool QgsField::operator==(const QgsField other) const
44
return ((mName == other.mName) && (mType == other.mType)
45
&& (mLength == other.mLength) && (mPrecision == other.mPrecision));
48
bool QgsField::operator!=(const QgsField other) const
50
return !(*this == other);
53
QString const & QgsField::name() const
47
bool QgsField::operator==( const QgsField& other ) const
49
return (( mName == other.mName ) && ( mType == other.mType ) && ( mTypeName == other.mTypeName )
50
&& ( mLength == other.mLength ) && ( mPrecision == other.mPrecision ) );
53
const QString & QgsField::name() const
58
QString const & QgsField::type() const
58
QVariant::Type QgsField::type() const
63
const QString & QgsField::typeName() const
63
68
int QgsField::length() const
73
bool QgsField::isNumeric() const
78
const QString & QgsField::comment() const
78
void QgsField::setName(QString const & nam)
83
void QgsField::setName( const QString & nam )
83
void QgsField::setType(QString const & typ)
87
void QgsField::setLength(int len)
88
void QgsField::setType( QVariant::Type type )
93
void QgsField::setTypeName( const QString & typeName )
98
void QgsField::setLength( int len )
91
void QgsField::setPrecision(int prec)
102
void QgsField::setPrecision( int prec )
93
104
mPrecision = prec;
95
void QgsField::setNumeric(bool num)
107
void QgsField::setComment( const QString & comment )