ICS

QicsTable Documentation Set

QicsDataItem.h

Go to the documentation of this file.
00001 /*********************************************************************
00002 **
00003 ** Copyright (C) 2002-2006 Integrated Computer Solutions, Inc
00004 ** All rights reserved.
00005 **
00006 ** This file is part of the QicsTable Product.
00007 **
00008 **********************************************************************/
00009 
00010 #ifndef _QicsDataItem_H
00011 #define _QicsDataItem_H
00012 
00013 #include <QicsNamespace.h>
00014 
00015 #include <QDateTime>
00016 #include <QDataStream>
00017 #include <QVariant>
00018 
00022 #define QICS_DEFAULT_TRUE_STRING "True"
00023 
00027 #define QICS_DEFAULT_FALSE_STRING "False"
00028 
00032 typedef unsigned int QicsDataItemType;
00033 const QicsDataItemType QicsDataItem_UserDefined = 0;
00034 const QicsDataItemType QicsDataItem_Int     = 1;
00035 const QicsDataItemType QicsDataItem_Long    = 2;
00036 const QicsDataItemType QicsDataItem_LongLong    = 3;
00037 const QicsDataItemType QicsDataItem_Float   = 4;
00038 const QicsDataItemType QicsDataItem_Double  = 5;
00039 const QicsDataItemType QicsDataItem_String  = 6;
00040 const QicsDataItemType QicsDataItem_Date    = 7;
00041 const QicsDataItemType QicsDataItem_Time    = 8;
00042 const QicsDataItemType QicsDataItem_DateTime    = 9;
00043 const QicsDataItemType QicsDataItem_Bool    = 10;
00044 const QicsDataItemType QicsDataItem_Variant = 11;
00045 
00047 
00050 
00051 
00052 // This is used in QicsDataItem::registerType() and must be declared
00053 // first.
00054 
00055 class QicsDataItem;
00061 typedef QicsDataItem * (*QicsDataItemParser)(const QString &);
00066 typedef QicsDataItem * (*QicsDataItemDecoder)(QDataStream &);
00067 
00076 typedef QicsDataItem * (*QicsDataItemDecoderWithType)(QDataStream &,
00077                               const QString &);
00078 
00080 
00101 class QICS_EXPORT QicsDataItem: public Qics {
00102 
00103 public:
00104 
00109     virtual QicsDataItem *create(void) const = 0;
00110 
00115     virtual QicsDataItem *clone(void) const = 0;
00116 
00117     virtual ~QicsDataItem() {}
00122     virtual bool setString(const QString &qs) = 0;
00123 
00128     virtual const QString string(void) const = 0;
00129 
00134     virtual QicsDataItemType type(void) const = 0;
00135 
00139     virtual QString typeString(void) const = 0;
00140 
00148     inline virtual QString format(const char *) const
00149     { return string(); }
00150 
00157     virtual int compareTo(const QicsDataItem &x) const;
00161     virtual void encode(QDataStream &ds) const = 0;
00165     static QicsDataItem *fromString(const QString &str);
00169     static QicsDataItem *decode(QDataStream &ds);
00183     static void registerType(const QString type_name,
00184                  QicsDataItemParser parser,
00185                  QicsDataItemDecoder decoder);
00186 
00202     static void registerTypeI(const QString type_name,
00203                   QicsDataItemParser parser,
00204                   QicsDataItemDecoderWithType decoder);
00205 
00220     static void registerParser(QicsDataItemParser parser);
00221 };
00222 
00226 typedef int (*DataItemComparator)(const QicsDataItem *, const QicsDataItem *);
00227 
00229 
00236 class QICS_EXPORT QicsDataBool: public QicsDataItem {
00237 public:
00238 
00242     QicsDataBool()
00243     {
00244     myData = false;
00245     setTrueString ( QString(QICS_DEFAULT_TRUE_STRING)  );
00246     setFalseString( QString(QICS_DEFAULT_FALSE_STRING) );
00247     }
00248 
00252     QicsDataBool(bool v, QString ts = QICS_DEFAULT_TRUE_STRING, QString fs = QICS_DEFAULT_FALSE_STRING )
00253     {
00254     myData = v;
00255     setTrueString ( QString(ts) );
00256     setFalseString( QString(fs) );
00257     }
00258 
00262     QicsDataBool(const QicsDataBool &db);
00263 
00264     inline QicsDataItem *create(void) const { return new QicsDataBool(); }
00265     inline QicsDataItem *clone(void) const { return new QicsDataBool(*this); }
00266 
00270     inline virtual QicsDataItemType type(void) const
00271     { return (QicsDataItem_Bool); }
00272 
00276     inline static QString typeName(void)
00277     { return QString("bool"); }
00278 
00282     inline virtual QString typeString(void) const
00283     { return QicsDataBool::typeName(); }
00284 
00289     inline virtual QicsDataBool& operator=(const bool& b)
00290     { myData = b; return *this;}
00291 
00292     inline virtual const QString string(void) const
00293     {
00294     if ( myData ) return QString( trueString() );
00295     else return QString(falseString());
00296     }
00297 
00298     inline virtual bool setString(const QString &qs)
00299     {
00300     bool ok = false;
00301     if ( qs == trueString()  ) { myData = true;  ok = true; }
00302     else
00303         if ( qs == falseString() ) { myData = false; ok = true; }
00304     return ok;
00305     }
00306 
00310     inline bool data(void) const { return myData; }
00311 
00315     inline void setData(bool b) { myData = b;}
00316 
00317     inline virtual QString format(const char *fmt_string) const
00318     { QString str; return str.sprintf(fmt_string, (const char *) string().toAscii() ); }
00319 
00320     int compareTo(const QicsDataItem &x) const;
00321     inline void encode(QDataStream &ds) const
00322     { ds << typeString(); ds << myData; }
00327     static QicsDataItem *fromString(const QString &str);
00331     static QicsDataItem *decode(QDataStream &ds)
00332     { bool val; ds >> val; return new QicsDataBool(val); }
00336     inline QString trueString() const { return myTrueString; }
00337 
00341     inline QString falseString() const { return myFalseString; }
00342 
00346     bool setTrueString(const QString &qs)
00347     {
00348     if (!qs.isEmpty())
00349         { myTrueString = qs; return true;}
00350     return false;
00351     }
00352 
00356     bool setFalseString(const QString &qs)
00357     {
00358     if (!qs.isEmpty())
00359         { myFalseString = qs; return true;}
00360     return false;
00361     }
00362 
00363 protected:
00368     bool myData;
00369 
00374     QString myTrueString;
00375 
00380     QString myFalseString;
00381 };
00382 
00384 
00392 class QICS_EXPORT QicsDataInt: public QicsDataItem {
00393 public:
00394 
00398     QicsDataInt() { myData = 0; }
00399 
00403     QicsDataInt(int i) { myData = i;}
00404 
00408     QicsDataInt(const QicsDataInt &di);
00409 
00410     inline QicsDataItem *create(void) const { return new QicsDataInt(); }
00411     inline QicsDataItem *clone(void) const { return new QicsDataInt(*this); }
00412 
00416     inline virtual QicsDataItemType type(void) const
00417     { return (QicsDataItem_Int); }
00418 
00422     inline static QString typeName(void)
00423     { return QString("int"); }
00424 
00428     inline virtual QString typeString(void) const
00429     { return QicsDataInt::typeName(); }
00430 
00435     inline virtual QicsDataInt& operator=(const int& i)
00436     { myData = i; return *this;}
00437 
00438     inline virtual const QString string(void) const { return QString("%1").arg(myData); }
00439     inline virtual bool setString(const QString &qs)
00440     {bool ok; myData = qs.toInt(&ok); return ok;}
00441 
00445     inline int data(void) const { return myData; }
00446 
00450     inline void setData(int i) { myData = i;}
00451 
00452     inline virtual QString format(const char *fmt_string) const
00453     { QString str; return str.sprintf(fmt_string, myData); }
00454 
00455     int compareTo(const QicsDataItem &x) const;
00456     inline void encode(QDataStream &ds) const
00457     { ds << typeString(); ds << myData; }
00462     static QicsDataItem *fromString(const QString &str);
00466     static QicsDataItem *decode(QDataStream &ds)
00467     { int val; ds >> val; return new QicsDataInt(val); }
00468 protected:
00473     int myData;
00474 };
00475 
00477 
00484 class QICS_EXPORT QicsDataLong: public QicsDataItem {
00485 public:
00486 
00490     QicsDataLong() { myData = 0; }
00491 
00495     QicsDataLong(long i) { myData = i;}
00496 
00500     QicsDataLong(const QicsDataLong &dl);
00501 
00502     inline QicsDataItem *create(void) const { return new QicsDataLong(); }
00503     inline QicsDataItem *clone(void) const { return new QicsDataLong(*this); }
00504 
00508     inline virtual QicsDataItemType type(void) const
00509     { return (QicsDataItem_Long); }
00510 
00514     inline static QString typeName(void)
00515     { return QString("long"); }
00516 
00520     inline virtual QString typeString(void) const
00521     { return QicsDataLong::typeName(); }
00522 
00527     inline virtual QicsDataLong& operator=(const long& i)
00528     { myData = i; return *this;}
00529 
00530     inline virtual const QString string(void) const { return QString("%1").arg(myData); }
00531     inline virtual bool setString(const QString &qs)
00532     {bool ok; myData = qs.toLong(&ok); return ok;}
00533 
00537     inline long data(void) const { return myData; }
00538 
00542     inline void setData(long i) { myData = i;}
00543 
00544     inline virtual QString format(const char *fmt_string) const
00545     { QString str; return str.sprintf(fmt_string, myData); }
00546 
00547     int compareTo(const QicsDataItem &x) const;
00548     inline void encode(QDataStream &ds) const
00549         { ds << typeString(); ds << qlonglong(myData); }
00554     static QicsDataItem *fromString(const QString &str);
00558     static QicsDataItem *decode(QDataStream &ds)
00559     { qlonglong val; ds >> val; return new QicsDataLong((long)val); }
00560 
00561 protected:
00566     long myData;
00567 };
00568 
00570 
00578 class QICS_EXPORT QicsDataLongLong: public QicsDataItem {
00579 public:
00580 
00584     QicsDataLongLong() { myData = 0; }
00585 
00589     QicsDataLongLong(qlonglong i) { myData = i;}
00590 
00594     QicsDataLongLong(const QicsDataLongLong &dl);
00595 
00596     inline QicsDataItem *create(void) const { return new QicsDataLongLong(); }
00597     inline QicsDataItem *clone(void) const { return new QicsDataLongLong(*this); }
00598 
00602     inline virtual QicsDataItemType type(void) const
00603     { return (QicsDataItem_LongLong); }
00604 
00608     inline static QString typeName(void)
00609     { return QString("int64"); }
00610 
00614     inline virtual QString typeString(void) const
00615     { return QicsDataLongLong::typeName(); }
00616 
00621     inline virtual QicsDataLongLong& operator=(const qlonglong& i)
00622     { myData = i; return *this;}
00623 
00624     inline virtual const QString string(void) const { return QString("%1").arg(myData); }
00625     inline virtual bool setString(const QString &qs) ;
00626 
00630     inline qlonglong data(void) const { return myData; }
00631 
00635     inline void setData(qlonglong i) { myData = i;}
00636 
00637     inline virtual QString format(const char *fmt_string) const
00638     { QString str; return str.sprintf(fmt_string, myData); }
00639 
00640     int compareTo(const QicsDataItem &x) const;
00641 
00642     inline void encode(QDataStream &ds) const
00643     { ds << typeString(); ds << myData; }
00644 
00649     static QicsDataItem *fromString(const QString &str);
00650 
00654     static QicsDataItem *decode(QDataStream &ds)
00655     { qlonglong val; ds >> val; return new QicsDataLongLong(val); }
00656 
00657 protected:
00662     qlonglong myData;
00663 };
00665 
00672 class QICS_EXPORT QicsDataFloat: public QicsDataItem {
00673 public:
00674 
00678     QicsDataFloat() { myData = 0.0; }
00679 
00683     QicsDataFloat(float f) { myData = f;}
00684 
00688     QicsDataFloat(const QicsDataFloat &df);
00689 
00690     inline QicsDataItem *create(void) const { return new QicsDataFloat(); }
00691     inline QicsDataItem *clone(void) const { return new QicsDataFloat(*this); }
00692 
00696     inline virtual QicsDataItemType type(void) const
00697     { return (QicsDataItem_Float); }
00698 
00702     inline static QString typeName(void)
00703     { return QString("float"); }
00704 
00708     inline virtual QString typeString(void) const
00709     { return QicsDataFloat::typeName(); }
00710 
00715     inline virtual QicsDataFloat& operator=(const float& f)
00716     { myData = f; return *this;}
00717 
00718     inline virtual const QString string(void) const { return QString("%1").arg(myData); }
00719     inline virtual bool setString(const QString &qs)
00720     {bool ok; myData = qs.toFloat(&ok); return ok;}
00721 
00725     inline float data(void) const { return myData; }
00726 
00730     inline void setData(float f) { myData = f;}
00731 
00732     inline virtual QString format(const char *fmt_string) const
00733     { QString str; return str.sprintf(fmt_string, myData); }
00734 
00735     int compareTo(const QicsDataItem &x) const;
00736     inline void encode(QDataStream &ds) const
00737     { ds << typeString(); ds << myData; }
00742     static QicsDataItem *fromString(const QString &str);
00746     static QicsDataItem *decode(QDataStream &ds)
00747     { float val; ds >> val; return new QicsDataFloat(val); }
00748 protected:
00753     float myData;
00754 };
00755 
00757 
00764 class QICS_EXPORT QicsDataDouble: public QicsDataItem {
00765 public:
00766 
00770     QicsDataDouble() { myData = 0.0; }
00771 
00775     QicsDataDouble(double d) { myData = d;}
00776 
00780     QicsDataDouble(const QicsDataDouble &dd);
00781 
00782     inline QicsDataItem *create(void) const { return new QicsDataDouble(); }
00783     inline QicsDataItem *clone(void) const { return new QicsDataDouble(*this); }
00784 
00788     inline static QString typeName(void)
00789     { return QString("double"); }
00790 
00794     inline virtual QString typeString(void) const
00795     { return QicsDataDouble::typeName(); }
00796 
00800     inline virtual QicsDataItemType type(void) const
00801     { return (QicsDataItem_Double); }
00802 
00807     inline virtual QicsDataDouble& operator=(const double& d)
00808     { myData = d; return *this;}
00809 
00810     inline virtual const QString string(void) const { return QString("%1").arg(myData); }
00811     inline virtual bool setString(const QString &qs)
00812     {bool ok; myData = qs.toDouble(&ok); return ok;}
00813 
00817     inline double data(void) const { return myData; }
00818 
00822     inline void setData(double d) { myData = d;}
00823 
00824     inline virtual QString format(const char *fmt_string) const
00825     { QString str; return str.sprintf(fmt_string, myData); }
00826 
00827     int compareTo(const QicsDataItem &x) const;
00828     inline void encode(QDataStream &ds) const
00829     { ds << typeString(); ds << myData; }
00834     static QicsDataItem *fromString(const QString &str);
00838     static QicsDataItem *decode(QDataStream &ds)
00839     { double val; ds >> val; return new QicsDataDouble(val); }
00840 protected:
00846     double myData;
00847 };
00848 
00850 
00858 class QICS_EXPORT QicsDataString: public QicsDataItem {
00859 public:
00860 
00865     QicsDataString() { myData = QString(); }
00866 
00870     QicsDataString(const QString &qs);
00871     QicsDataString(const char* s);
00872 
00873     virtual ~QicsDataString() {}
00874 
00878     QicsDataString(const QicsDataString &ds);
00879 
00880     inline QicsDataItem *create(void) const { return new QicsDataString(); }
00881     inline QicsDataItem *clone(void) const { return new QicsDataString(*this); }
00882 
00886     inline static QString typeName(void)
00887     { return QString("qstring"); }
00888 
00892     inline virtual QString typeString(void) const
00893     { return QicsDataString::typeName(); }
00894 
00898     inline virtual QicsDataItemType type(void) const
00899     { return (QicsDataItem_String); }
00900 
00905     QicsDataString& operator=(const QicsDataString& qs);
00906 
00907     inline virtual bool setString(const QString &qs)
00908     { myData = qs; return true;}
00909 
00913     inline bool setData(const char *s)
00914     { myData = s; return true;}
00915 
00919     inline bool setData(const QString &qs)
00920     { myData = qs; return true;}
00921 
00925     inline QString data(void) const { return myData;}
00926 
00927     inline virtual const QString string(void) const { return myData; }
00928 
00929     inline virtual QString format(const char *fmt_string) const
00930     { QString str; return str.sprintf(fmt_string, (const char *) myData.toAscii()); }
00931 
00932     int compareTo(const QicsDataItem &x) const;
00933     inline void encode(QDataStream &ds) const
00934     { ds << typeString(); ds << myData; }
00935 
00939     static QicsDataItem *decode(QDataStream &ds)
00940     { QString val; ds >> val; return new QicsDataString(val); }
00941 protected:
00946     QString myData;
00947 };
00948 
00950 
00957 class QICS_EXPORT QicsDataDate: public QicsDataItem
00958 {
00959 public:
00960 
00964     QicsDataDate(Qt::DateFormat format = Qt::TextDate);
00969     QicsDataDate(const QDate &date, Qt::DateFormat format = Qt::TextDate);
00974     QicsDataDate(int y, int m, int d, Qt::DateFormat format = Qt::TextDate);
00975 
00979     QicsDataDate(const QicsDataDate &dd);
00980 
00981     inline QicsDataItem *create(void) const { return new QicsDataDate(); }
00982     inline QicsDataItem *clone(void) const { return new QicsDataDate(*this); }
00983 
00987     inline static QString typeName(void)
00988     { return QString("qdate"); }
00989 
00993     inline virtual QString typeString(void) const
00994     { return QicsDataDate::typeName(); }
00995 
00999     inline virtual QicsDataItemType type(void) const
01000     { return (QicsDataItem_Date); }
01001 
01006     virtual QicsDataDate& operator=(const QDate &d);
01007 
01008     inline virtual const QString string(void) const
01009     { return myData.toString(); }
01010     virtual bool setString(const QString &qs);
01011 
01015     inline QDate data(void) const { return myData; }
01016 
01020     inline void setData(const QDate &date)
01021     { myData = date; }
01022 
01023     virtual QString format(const char *fmt_string) const;
01024 
01028     inline virtual Qt::DateFormat defaultDateFormat(void) const
01029     { return myDefaultFormat;}
01030 
01034     inline virtual void setDefaultDateFormat(Qt::DateFormat f)
01035     { myDefaultFormat = f; }
01036 
01037     int compareTo(const QicsDataItem &x) const;
01038     inline void encode(QDataStream &ds) const
01039     { ds << typeString(); ds << myData; }
01044     static QicsDataItem *fromString(const QString &str);
01048     static QicsDataItem *decode(QDataStream &ds)
01049     { QDate val; ds >> val; return new QicsDataDate(val); }
01050 protected:
01055     QDate myData;
01060     Qt::DateFormat myDefaultFormat;
01061 };
01062 
01064 
01071 class QICS_EXPORT QicsDataTime: public QicsDataItem
01072 {
01073 public:
01074 
01078     QicsDataTime(Qt::DateFormat format = Qt::TextDate);
01083     QicsDataTime(const QTime &time, Qt::DateFormat format = Qt::TextDate);
01088     QicsDataTime(int hour, int minute, int second, int msec,
01089          Qt::DateFormat format);
01090 
01094     QicsDataTime(const QicsDataTime &dt);
01095 
01096     inline QicsDataItem *create(void) const { return new QicsDataTime(); }
01097     inline QicsDataItem *clone(void) const { return new QicsDataTime(*this); }
01098 
01102     inline static QString typeName(void)
01103     { return QString("qtime"); }
01104 
01108     inline virtual QString typeString(void) const
01109     { return QicsDataTime::typeName(); }
01110 
01114     inline virtual QicsDataItemType type(void) const
01115     { return (QicsDataItem_Time); }
01116 
01121     virtual QicsDataTime& operator=(const QTime &t);
01122 
01123     inline virtual const QString string(void) const { return myData.toString(); }
01124     virtual bool setString(const QString &qs);
01125 
01129     inline QTime data(void) const { return myData; }
01130 
01134     void setData(const QTime &time);
01135 
01136     virtual QString format(const char *fmt_string) const;
01137 
01141     inline virtual Qt::DateFormat defaultDateFormat(void) const
01142     { return myDefaultFormat;}
01143 
01147     inline virtual void setDefaultDateFormat(Qt::DateFormat f)
01148     { myDefaultFormat = f; }
01149 
01150     int compareTo(const QicsDataItem &x) const;
01151     inline void encode(QDataStream &ds) const
01152     { ds << typeString(); ds << myData; }
01157     static QicsDataItem *fromString(const QString &str);
01161     static QicsDataItem *decode(QDataStream &ds)
01162     { QTime val; ds >> val; return new QicsDataTime(val); }
01163 protected:
01168     QTime myData;
01173     Qt::DateFormat myDefaultFormat;
01174 };
01175 
01177 
01184 class QICS_EXPORT QicsDataDateTime: public QicsDataItem
01185 {
01186 public:
01187 
01191     QicsDataDateTime(Qt::DateFormat format = Qt::TextDate);
01196     QicsDataDateTime(const QDateTime &dt, Qt::DateFormat format = Qt::TextDate);
01201     QicsDataDateTime(const QDate &date, const QTime &time,
01202              Qt::DateFormat format = Qt::TextDate);
01203 
01207     QicsDataDateTime(const QicsDataDateTime &ddt);
01208 
01209     inline QicsDataItem *create(void) const { return new QicsDataDateTime(); }
01210     inline QicsDataItem *clone(void) const { return new QicsDataDateTime(*this); }
01211 
01212     inline virtual QicsDataItemType type(void) const
01213     { return (QicsDataItem_DateTime); }
01214 
01218     inline static QString typeName(void)
01219     { return QString("qdatetime"); }
01220 
01224     inline virtual QString typeString(void) const
01225     { return QicsDataDateTime::typeName(); }
01226 
01231     virtual QicsDataDateTime& operator=(const QDateTime &dt);
01232 
01233     inline virtual const QString string(void) const { return myData.toString(); }
01234 
01239     inline virtual const QString string(const char *fmt_string) const
01240     {
01241     return myData.toString(fmt_string);
01242     }
01243     virtual bool setString(const QString &qs);
01244 
01248     inline QDateTime data(void) const { return myData; }
01249 
01253     void setData(const QDateTime &dt);
01254 
01255     virtual QString format(const char *fmt_string) const;
01256 
01260     inline virtual Qt::DateFormat defaultDateFormat(void) const
01261     { return myDefaultFormat;}
01262 
01266     inline virtual void setDefaultDateFormat(Qt::DateFormat f)
01267     { myDefaultFormat = f; }
01268 
01269     int compareTo(const QicsDataItem &x) const;
01270     inline void encode(QDataStream &ds) const
01271     { ds << typeString(); ds << myData; }
01276     static QicsDataItem *fromString(const QString &str);
01280     static QicsDataItem *decode(QDataStream &ds)
01281     { QDateTime val; ds >> val; return new QicsDataDateTime(val); }
01282 protected:
01287     QDateTime myData;
01292     Qt::DateFormat myDefaultFormat;
01293 };
01294 
01302 class QICS_EXPORT QicsDataVariant: public QicsDataItem {
01303    public:
01304 
01309      QicsDataVariant() { myData = QVariant(); }
01310 
01314       QicsDataVariant(const QicsDataVariant &ds);
01315 
01316       QicsDataVariant ( QVariant::Type type ) : myData(type){;}
01317       QicsDataVariant ( int typeOrUserType, const void * copy ) : myData(typeOrUserType,copy){;};
01318       QicsDataVariant ( const QVariant & p ) : myData(p){;};
01319       QicsDataVariant ( QDataStream & s ) : myData(s){;};
01320       QicsDataVariant ( int val ) : myData(val){;};
01321       QicsDataVariant ( uint val ) : myData(val){;};
01322       QicsDataVariant ( qlonglong val ) : myData(val){;};
01323       QicsDataVariant ( qulonglong val ) : myData(val){;};
01324       QicsDataVariant ( bool val ) : myData(val){;};
01325       QicsDataVariant ( double val ) : myData(val){;};
01326 #ifdef QT_ASCII_CAST_WARN_CONSTRUCTOR
01327       QT_ASCII_CAST_WARN_CONSTRUCTOR QicsDataVariant ( const char * val ) : myData(val){;}
01328 #else
01329       QicsDataVariant ( const char * val ) : myData(val){;}
01330 #endif
01331       QicsDataVariant ( const QByteArray & val ) : myData(val){;};
01332       QicsDataVariant ( const QBitArray & val ) : myData(val){;};
01333       QicsDataVariant ( const QString & val ) : myData(val){;};
01334       QicsDataVariant ( const QLatin1String & val ) : myData(val){;};
01335       QicsDataVariant ( const QStringList & val ) : myData(val){;};
01336       QicsDataVariant ( const QChar & c ) : myData(c){;};
01337       QicsDataVariant ( const QDate & val ) : myData(val){;};
01338       QicsDataVariant ( const QTime & val ) : myData(val){;};
01339       QicsDataVariant ( const QDateTime & val ) : myData(val){;};
01340       QicsDataVariant ( const QList<QVariant> & val ) : myData(val){;};
01341       QicsDataVariant ( const QMap<QString, QVariant> & val ) : myData(val){;};
01342       QicsDataVariant ( const QSize & val ) : myData(val){;};
01343       QicsDataVariant ( const QSizeF & val ) : myData(val){;};
01344       QicsDataVariant ( const QPoint & val ) : myData(val){;};
01345       QicsDataVariant ( const QPointF & val ) : myData(val){;};
01346       QicsDataVariant ( const QLine & val ) : myData(val){;};
01347       QicsDataVariant ( const QLineF & val ) : myData(val){;};
01348       QicsDataVariant ( const QRect & val ) : myData(val){;};
01349       QicsDataVariant ( const QRectF & val ) : myData(val){;};
01350       QicsDataVariant ( const QUrl & val ) : myData(val){;};
01351       QicsDataVariant ( const QLocale & l ) : myData(l){;};
01352       QicsDataVariant ( const QRegExp & regExp ) : myData(regExp){;};
01353       QicsDataVariant ( Qt::GlobalColor color ) : myData(color){;};
01354 
01355 
01356       virtual ~QicsDataVariant() {;}
01357 
01358       inline QicsDataItem *create(void) const { return new QicsDataVariant(); }
01359       inline QicsDataItem *clone(void) const { return new QicsDataVariant(*this); }
01360 
01364       inline static QString typeName(void)
01365       { return QString("qvariant"); }
01366 
01370       inline virtual QString typeString(void) const
01371       { return QicsDataVariant::typeName(); }
01372 
01376       inline virtual QicsDataItemType type(void) const
01377       { return (QicsDataItem_Variant); }
01378 
01379       inline virtual bool setString(const QString &qs)
01380       { myData = qs; return true;}
01381 
01382 
01383       inline virtual QString format(const char *fmt_string) const
01384       { QString str; return str.sprintf(fmt_string, (const char *)myData.toString().toAscii()); }
01385 
01389       inline bool setData(const QVariant &v)
01390       { myData = v; return true;}
01391 
01395       inline QVariant data(void) const { return myData;}
01396 
01397       inline virtual const QString string(void) const { return myData.toString(); }
01398 
01399       int compareTo(const QicsDataItem &x) const;
01400 
01401       inline void encode(QDataStream &ds) const
01402       { ds << typeString(); ds << myData; }
01403 
01407       static QicsDataItem *decode(QDataStream &ds);
01408 
01409     static QicsDataItem * fromString(const QString &str);
01410 
01411    protected:
01416       QVariant myData;
01417 };
01418 
01419 #endif /*_QicsDataItem_H --- Do not add anything past this line */
01420 

All trademarks and copyrights on this page are properties of their respective owners.
The rest is copyright 1999-2006 Integrated Computer Solutions, Inc.