Eneboo - Documentación para desarrolladores
src/qt/src/sql/qsqlfield.h
Ir a la documentación de este archivo.
00001 /****************************************************************************
00002 **
00003 ** Definition of QSqlField class
00004 **
00005 ** Created : 2000-11-03
00006 **
00007 ** Copyright (C) 2005-2007 Trolltech ASA.  All rights reserved.
00008 **
00009 ** This file is part of the sql module of the Qt GUI Toolkit.
00010 **
00011 ** This file may be distributed under the terms of the Q Public License
00012 ** as defined by Trolltech ASA of Norway and appearing in the file
00013 ** LICENSE.QPL included in the packaging of this file.
00014 **
00015 ** This file may be distributed and/or modified under the terms of the
00016 ** GNU General Public License version 2 as published by the Free Software
00017 ** Foundation and appearing in the file LICENSE.GPL included in the
00018 ** packaging of this file.
00019 **
00020 ** Licensees holding valid Qt Enterprise Edition licenses may use this
00021 ** file in accordance with the Qt Commercial License Agreement provided
00022 ** with the Software.
00023 **
00024 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00025 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00026 **
00027 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
00028 **   information about Qt Commercial License Agreements.
00029 ** See http://www.trolltech.com/qpl/ for QPL licensing information.
00030 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00031 **
00032 ** Contact info@trolltech.com if any conditions of this licensing are
00033 ** not clear to you.
00034 **
00035 **********************************************************************/
00036 
00037 #ifndef QSQLFIELD_H
00038 #define QSQLFIELD_H
00039 
00040 #ifndef QT_H
00041 #include "qstring.h"
00042 #include "qvariant.h"
00043 #endif // QT_H
00044 
00045 #if !defined( QT_MODULE_SQL ) || defined( QT_LICENSE_PROFESSIONAL )
00046 #define QM_EXPORT_SQL
00047 #else
00048 #define QM_EXPORT_SQL Q_EXPORT
00049 #endif
00050 
00051 #ifndef QT_NO_SQL
00052 
00053 class QSqlFieldPrivate
00054 {
00055 public:
00056     QVariant::Type type;
00057 };
00058 
00059 class QM_EXPORT_SQL QSqlField
00060 {
00061 public:
00062     QSqlField( const QString& fieldName = QString::null, QVariant::Type type = QVariant::Invalid );
00063     QSqlField( const QSqlField& other );
00064     QSqlField& operator=( const QSqlField& other );
00065     bool operator==(const QSqlField& other) const;
00066     virtual ~QSqlField();
00067 
00068     virtual void        setValue( const QVariant& value );
00069     virtual QVariant    value() const;
00070     virtual void        setName( const QString& name );
00071     QString             name() const;
00072     virtual void        setNull();
00073     bool                isNull() const;
00074     virtual void        setReadOnly( bool readOnly );
00075     bool                isReadOnly() const;
00076     void                clear( bool nullify = TRUE );
00077     QVariant::Type      type() const;
00078 
00079 private:
00080     QString       nm;
00081     QVariant      val;
00082     uint          ro: 1;
00083     uint          nul: 1;
00084     QSqlFieldPrivate* d;
00085 };
00086 
00087 inline QVariant QSqlField::value() const
00088 { return val; }
00089 
00090 inline QString QSqlField::name() const
00091 { return nm; }
00092 
00093 inline bool QSqlField::isNull() const
00094 { return nul; }
00095 
00096 inline bool QSqlField::isReadOnly() const
00097 { return ro; }
00098 
00099 inline QVariant::Type QSqlField::type() const
00100 { return d->type; }
00101 
00102 
00103 /******************************************/
00104 /*******     QSqlFieldInfo Class     ******/
00105 /******************************************/
00106 
00107 struct QSqlFieldInfoPrivate;
00108 
00109 class QM_EXPORT_SQL QSqlFieldInfo
00110 {
00111 public:
00112     QSqlFieldInfo( const QString& name = QString::null,
00113                    QVariant::Type typ = QVariant::Invalid,
00114                    int required = -1,
00115                    int len = -1,
00116                    int prec = -1,
00117                    const QVariant& defValue = QVariant(),
00118                    int sqlType = 0,
00119                    bool generated = TRUE,
00120                    bool trim = FALSE,
00121                    bool calculated = FALSE );
00122     QSqlFieldInfo( const QSqlFieldInfo & other );
00123     QSqlFieldInfo( const QSqlField & other, bool generated = TRUE );
00124     virtual ~QSqlFieldInfo();
00125     QSqlFieldInfo& operator=( const QSqlFieldInfo& other );
00126     bool operator==( const QSqlFieldInfo& f ) const;
00127 
00128     QSqlField           toField() const;
00129     int                 isRequired() const;
00130     QVariant::Type      type() const;
00131     int                 length() const;
00132     int                 precision() const;
00133     QVariant            defaultValue() const;
00134     QString             name() const;
00135     int                 typeID() const;
00136     bool                isGenerated() const;
00137     bool                isTrim() const;
00138     bool                isCalculated() const;
00139 
00140     virtual void        setTrim( bool trim );
00141     virtual void        setGenerated( bool gen );
00142     virtual void        setCalculated( bool calc );
00143 
00144 private:
00145     QSqlFieldInfoPrivate* d;
00146 };
00147 
00148 
00149 #endif  // QT_NO_SQL
00150 #endif
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'