Eneboo - Documentación para desarrolladores
src/flbase/FLFieldMetaData.h
Ir a la documentación de este archivo.
00001 /***************************************************************************
00002                            FLFieldMetaData.h
00003                           -------------------
00004  begin                : Mon Jul 2 2001
00005  copyright            : (C) 2001-2005 by InfoSiAL S.L.
00006  email                : mail@infosial.com
00007 ***************************************************************************/
00008 /***************************************************************************
00009  *   This program is free software; you can redistribute it and/or modify  *
00010  *   it under the terms of the GNU General Public License as published by  *
00011  *   the Free Software Foundation; version 2 of the License.               *
00012  ***************************************************************************/
00013 /***************************************************************************
00014    Este  programa es software libre. Puede redistribuirlo y/o modificarlo
00015    bajo  los  términos  de  la  Licencia  Pública General de GNU   en  su
00016    versión 2, publicada  por  la  Free  Software Foundation.
00017  ***************************************************************************/
00018 
00019 #ifndef FLFIELDMETADATA_H
00020 #define FLFIELDMETADATA_H
00021 
00022 #include <qvariant.h>
00023 #include <qstring.h>
00024 #include <qptrlist.h>
00025 
00026 class FLTableMetaData;
00027 class FLRelationMetaData;
00028 class FLFieldMetaDataPrivate;
00029 
00037 class FLFieldMetaData
00038 {
00039 public:
00040 
00044   enum specialType {
00048     Serial = 100,
00052     Unlock = 200,
00056     Check = 300
00057   };
00058 
00085   FLFieldMetaData(const QString &n, const QString &a, bool aN, bool iPK, int t,
00086                   int l = 0, bool c = false, bool v = true, bool ed = false,
00087                   int pI = 4, int pD = 0, bool iNX = false, bool uNI = false,
00088                   bool coun = false, const QVariant &defValue = QVariant(), bool oT = false,
00089                   const QString &rX = QString::null, bool vG = true, bool gen = true, bool iCK = false);
00090 
00094   ~FLFieldMetaData();
00095 
00101   QString name() const;
00102 
00108   void setName(const QString &n);
00109 
00115   QString alias() const;
00116 
00122   bool allowNull() const;
00123 
00129   bool isPrimaryKey() const;
00130 
00136   bool isCompoundKey() const;
00137 
00143   int type() const;
00144 
00150   int length() const;
00151 
00157   bool calculated() const;
00158 
00164   void setCalculated(bool c);
00165 
00171   bool editable() const;
00172 
00179   void setEditable(bool ed);
00180 
00186   bool visible() const;
00187 
00193   bool visibleGrid() const;
00194 
00198   bool generated() const;
00199 
00206   void setVisible(bool v);
00207 
00214   void setVisibleGrid(bool v);
00215 
00221   int partInteger() const;
00222 
00228   int partDecimal() const;
00229 
00235   bool isCounter() const;
00236 
00242   bool isIndex() const;
00243 
00249   bool isUnique() const;
00250 
00254   typedef QPtrList < FLRelationMetaData > FLRelationMetaDataList;
00255 
00271   void addRelationMD(FLRelationMetaData *r);
00272 
00286   void setRelationList(FLRelationMetaDataList *rl);
00287 
00295   FLRelationMetaDataList *relationList() const;
00296 
00305   FLRelationMetaData *relationM1() const;
00306 
00318   void setAssociatedField(FLFieldMetaData *r, const QString &f);
00319 
00326   void setAssociatedField(const QString &rName, const QString &f);
00327 
00336   FLFieldMetaData *associatedField() const;
00337 
00346   QString associatedFieldFilterTo() const;
00347 
00355   QString associatedFieldName() const;
00356 
00362   QVariant defaultValue();
00363 
00370   bool outTransaction();
00371 
00378   QString regExpValidator();
00379 
00385   QStringList optionsList();
00386 
00393   void setOptionsList(const QString &ol);
00394 
00398   bool isCheck() const;
00399 
00403   bool hasOptionsList() const;
00404 
00408   void setMetadata(FLTableMetaData *mtd);
00409 
00413   FLTableMetaData *metadata() const;
00414 
00418   static QVariant::Type flDecodeType(int fltype);
00419 
00420 private:
00421 
00425   FLFieldMetaDataPrivate *d;
00426 
00427   friend class FLTableMetaData;
00428   friend class FLTableMetaDataPrivate;
00429 };
00430 
00431 class FLFieldMetaDataPrivate
00432 {
00433 public:
00434 
00435   FLFieldMetaDataPrivate(const QString &n, const QString &a, bool aN, bool iPK, int t,
00436                          int l, bool c, bool v, bool ed, int pI, int pD,
00437                          bool iNX, bool uNI, bool coun, const QVariant &defValue, bool oT,
00438                          const QString &rX, bool vG, bool gen, bool iCK);
00439 
00440   ~FLFieldMetaDataPrivate();
00441 
00445   QString name_;
00446 
00451   QString alias_;
00452 
00456   bool allowNull_;
00457 
00461   bool isPrimaryKey_;
00462 
00466   int type_;
00467 
00471   int length_;
00472 
00476   bool calculated_;
00477 
00481   bool visible_;
00482 
00486   bool editable_;
00487 
00491   int partInteger_;
00492 
00496   int partDecimal_;
00497 
00501   bool isIndex_;
00502 
00506   bool isUnique_;
00507 
00515   bool contador_;
00516 
00520   FLFieldMetaData::FLRelationMetaDataList *relationList_;
00521 
00526   FLRelationMetaData *relationM1_;
00527 
00548   FLFieldMetaData *associatedField_;
00549   QString associatedFieldName_;
00550 
00566   QString associatedFieldFilterTo_;
00567 
00571   QVariant defaultValue_;
00572 
00576   QStringList optionsList_;
00577 
00592   bool outTransaction_;
00593 
00597   QString regExpValidator_;
00598 
00602   bool visibleGrid_;
00603 
00607   bool generated_;
00608 
00612   bool isCompoundKey_;
00613 
00617   bool hasOptionsList_;
00618 
00622   FLTableMetaData *mtd_;
00623 };
00624 
00625 inline QString FLFieldMetaData::name() const
00626 {
00627   return d->name_;
00628 }
00629 
00630 inline QString FLFieldMetaData::alias() const
00631 {
00632   return d->alias_;
00633 }
00634 
00635 inline bool FLFieldMetaData::allowNull() const
00636 {
00637   return d->allowNull_;
00638 }
00639 
00640 inline bool FLFieldMetaData::isPrimaryKey() const
00641 {
00642   return d->isPrimaryKey_;
00643 }
00644 
00645 inline int FLFieldMetaData::type() const
00646 {
00647   return (d->type_ == FLFieldMetaData::Check ? QVariant::Bool : d->type_);
00648 }
00649 
00650 inline int FLFieldMetaData::length() const
00651 {
00652   return d->length_;
00653 }
00654 
00655 inline bool FLFieldMetaData::calculated() const
00656 {
00657   return d->calculated_;
00658 }
00659 
00660 inline void FLFieldMetaData::setCalculated(bool c)
00661 {
00662   d->calculated_ = c;
00663 }
00664 
00665 inline bool FLFieldMetaData::editable() const
00666 {
00667   return d->editable_;
00668 }
00669 
00670 inline void FLFieldMetaData::setEditable(bool ed)
00671 {
00672   d->editable_ = ed;
00673 }
00674 
00675 inline bool FLFieldMetaData::visible() const
00676 {
00677   return d->visible_;
00678 }
00679 
00680 inline bool FLFieldMetaData::visibleGrid() const
00681 {
00682   return d->visibleGrid_;
00683 }
00684 
00685 inline bool FLFieldMetaData::generated() const
00686 {
00687   return d->generated_;
00688 }
00689 
00690 inline void FLFieldMetaData::setVisible(bool v)
00691 {
00692   d->visible_ = v;
00693 }
00694 
00695 inline void FLFieldMetaData::setVisibleGrid(bool v)
00696 {
00697   d->visibleGrid_ = v;
00698 }
00699 
00700 inline int FLFieldMetaData::partInteger() const
00701 {
00702   return d->partInteger_;
00703 }
00704 
00705 inline int FLFieldMetaData::partDecimal() const
00706 {
00707   return d->partDecimal_;
00708 }
00709 
00710 inline bool FLFieldMetaData::isCounter() const
00711 {
00712   return d->contador_;
00713 }
00714 
00715 inline bool FLFieldMetaData::isIndex() const
00716 {
00717   return d->isIndex_;
00718 }
00719 
00720 inline bool FLFieldMetaData::isUnique() const
00721 {
00722   return d->isUnique_;
00723 }
00724 
00725 inline FLFieldMetaData::FLRelationMetaDataList *FLFieldMetaData::relationList() const
00726 {
00727   return d->relationList_;
00728 }
00729 
00730 inline FLRelationMetaData *FLFieldMetaData::relationM1() const
00731 {
00732   return d->relationM1_;
00733 }
00734 
00735 inline void FLFieldMetaData::setAssociatedField(FLFieldMetaData *r, const QString &f)
00736 {
00737   d->associatedField_ = r;
00738   d->associatedFieldFilterTo_ = f;
00739 }
00740 
00741 inline void FLFieldMetaData::setAssociatedField(const QString &rName, const QString &f)
00742 {
00743   d->associatedFieldName_ = rName;
00744   d->associatedFieldFilterTo_ = f;
00745 }
00746 
00747 inline FLFieldMetaData *FLFieldMetaData::associatedField() const
00748 {
00749   return d->associatedField_;
00750 }
00751 
00752 inline QString FLFieldMetaData::associatedFieldFilterTo() const
00753 {
00754   return d->associatedFieldFilterTo_;
00755 }
00756 
00757 inline QString FLFieldMetaData::associatedFieldName() const
00758 {
00759   return d->associatedFieldName_;
00760 }
00761 
00762 inline QVariant FLFieldMetaData::defaultValue()
00763 {
00764   return d->defaultValue_;
00765 }
00766 
00767 inline bool FLFieldMetaData::outTransaction()
00768 {
00769   return d->outTransaction_;
00770 }
00771 
00772 inline QString FLFieldMetaData::regExpValidator()
00773 {
00774   return d->regExpValidator_;
00775 }
00776 
00777 inline QStringList FLFieldMetaData::optionsList()
00778 {
00779   return d->optionsList_;
00780 }
00781 
00782 inline bool FLFieldMetaData::isCompoundKey() const
00783 {
00784   return d->isCompoundKey_;
00785 }
00786 
00787 inline bool FLFieldMetaData::isCheck() const
00788 {
00789   return (d->type_ == FLFieldMetaData::Check);
00790 }
00791 
00792 inline bool FLFieldMetaData::hasOptionsList() const
00793 {
00794   return d->hasOptionsList_;
00795 }
00796 
00797 inline void FLFieldMetaData::setMetadata(FLTableMetaData *mtd)
00798 {
00799   d->mtd_ = mtd;
00800 }
00801 
00802 inline FLTableMetaData *FLFieldMetaData::metadata() const
00803 {
00804   return d->mtd_;
00805 }
00806 
00807 #endif
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'