Source: field.h


Annotated List
Files
Globals
Hierarchy
Index
#ifndef FIELD_H
#define FIELD_H

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include "kdb.h"
#include "object.h"

#include <qstring.h>
#include <qdatetime.h>

namespace KDB {

/**
 * @short Representation of a field object.
 *
 * It knows its name, its datatype, constraints
 * when available (like null/not null) and, when it is part of a record, its value.
 *
 * The field object can manage only the data type of the underlying column.
 * Conversion operators are provided for all common C++ datatypes. If a conversion
 * is not allowed, a @ref KDB::ConversionException is raised.
 *
 * It is responsibility of the plugin to instantiate a correct field object for
 * the underlying datatype. For datatypes not supported natively by C++, the
 * Plugin can handle either QStrings or QByteArrays.
 *
 * The datatype supported are the following:
 *
 * @li  QString (can be used for unknown datatypes)
 * @li  QStringList (for sets and one-dimensional array)
 * @li  QDateTime
 * @li  QByteArray (for BLOBs and Unknown datatypes)
 * @li  char
 * @li  short
 * @li  int
 * @li  long
 * @li  float
 * @li  double
 * @li  long double
 * @li  bool
 *
 * All numeric types are handled both in signed and unsigned form.
 */
class Field :public Object {

    Q_OBJECT
  
 public:
    Field (const char * name);

    virtual ~Field();

    dataType type();

    QString name();

    QString constraint();


    virtual void operator =(const QString &newVal);
    virtual void operator =(const QDateTime &newVal);
    virtual void operator =(int newVal);
    virtual void operator =(double newVal);
    
    virtual operator QString();
    virtual operator int();
    virtual operator double();
    virtual operator QDateTime();

 protected:
    QString val;
        
};
    
}

#endif



Generated by: pradu@server.rete.casa on Fri Jul 28 15:15:55 2000, using kdoc 2.0a36.