Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

field.h

Go to the documentation of this file.
00001 /*
00002    This file is part of the KDB libraries
00003    Copyright (c) 2000 Praduroux Alessandro <pradu@thekompany.com>
00004  
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009  
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014  
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018    Boston, MA 02111-1307, USA.
00019 */     
00020 #ifndef FIELD_H
00021 #define FIELD_H
00022 
00023 #ifdef HAVE_CONFIG_H
00024 #include <config.h>
00025 #endif
00026 
00027 #include "kdb.h"
00028 #include "object.h"
00029 
00030 #include <qlist.h>
00031 #include <qstring.h>
00032 #include <qdatetime.h>
00033 
00034 
00035 namespace KDB {
00036 
00037 class Handler;
00038 
00039 class Field;
00040 typedef QList<Field>         FieldList;
00041 typedef QListIterator<Field> FieldIterator;
00042 
00079  //BIG TODO: conversion operators and logic
00080 class Field :public Object {
00081     
00082     friend class Recordset;
00083     friend class Record;
00084     friend class Table;
00085     
00086     Q_OBJECT
00087   
00088  public:
00089 
00090     ~Field();
00091 
00092     void setPrecision(unsigned int size);
00093     unsigned int precision();
00094 
00095     void setSize(unsigned int size);
00096     unsigned int size();
00097 
00098     void setType(DataType t);
00099     DataType type() ;
00100 
00101     QString nativeType();
00102 
00103     void setConstraint(const QString &val);
00104     QString constraint() ;
00105 
00106     void setAcceptNull(bool);
00107     bool acceptNull();
00108 
00109     bool isNull();
00110     
00111     void operator =(const QString &newVal) ;  
00112     void operator =(const QDateTime &newVal) ;      
00113     void operator =(int newVal) ; 
00114     void operator =(double newVal)  ;   
00115     
00116     operator QString() ;                      
00117     operator QDateTime() ;
00118     operator int() ;
00119     operator double() ;                                   
00120 
00121  private:
00122     Field (const QString &name, QObject *parent = 0);
00123     Field (Handler *h,  const QString &name, const QByteArray &val, QObject *parent = 0);
00124 
00125     QByteArray m_val;
00126     Handler *m_handler;
00127 
00128     DataType m_type;
00129     unsigned int m_size;
00130     unsigned int m_precision;
00131     QString m_constraint;
00132     bool m_acceptNull;
00133 };
00134  
00135 }
00136 
00137 #endif
00138 
00139 

Generated at Fri Sep 29 16:32:21 2000 for KDB by doxygen1.2.1 written by Dimitri van Heesch, © 1997-2000