Eneboo - Documentación para desarrolladores
|
00001 /*************************************************************************** 00002 FLRelationMetaData.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 FLRELATIONMETADATA_H 00020 #define FLRELATIONMETADATA_H 00021 00022 #include <qstring.h> 00023 00024 class FLRelationMetaDataPrivate; 00025 00069 class FL_EXPORT FLRelationMetaData 00070 { 00071 00072 public: 00073 00075 enum Cardinality { 00077 RELATION_1M = 0, 00079 RELATION_M1 = 1 00080 }; 00081 00092 FLRelationMetaData(const QString &fT, const QString &fF, int rC, 00093 bool dC = false, bool uC = false, bool cI = true); 00094 00098 ~FLRelationMetaData(); 00099 00105 void setField(const QString &fN); 00106 00112 QString field() const; 00113 00119 QString foreignTable() const; 00120 00126 QString foreignField() const; 00127 00134 int cardinality() const; 00135 00141 bool deleteCascade() const; 00142 00148 bool updateCascade() const; 00149 00153 bool checkIn(); 00154 00155 private: 00156 00160 FLRelationMetaDataPrivate *d; 00161 }; 00162 00163 class FLRelationMetaDataPrivate 00164 { 00165 public: 00166 00167 FLRelationMetaDataPrivate(const QString &fT, const QString &fF, int rC, 00168 bool dC, bool uC, bool cI); 00169 00173 QString field_; 00174 00178 QString foreignTable_; 00179 00183 QString foreignField_; 00184 00188 int cardinality_; 00189 00193 bool deleteCascade_; 00194 00198 bool updateCascade_; 00199 00203 bool checkIn_; 00204 }; 00205 00206 inline void FLRelationMetaData::setField(const QString &fN) 00207 { 00208 d->field_ = fN.lower(); 00209 } 00210 00211 inline QString FLRelationMetaData::field() const 00212 { 00213 return d->field_; 00214 } 00215 00216 inline QString FLRelationMetaData::foreignTable() const 00217 { 00218 return d->foreignTable_; 00219 } 00220 00221 inline QString FLRelationMetaData::foreignField() const 00222 { 00223 return d->foreignField_; 00224 } 00225 00226 inline int FLRelationMetaData::cardinality() const 00227 { 00228 return d->cardinality_; 00229 } 00230 00231 inline bool FLRelationMetaData::deleteCascade() const 00232 { 00233 return (d->deleteCascade_ && d->cardinality_ == RELATION_M1); 00234 } 00235 00236 inline bool FLRelationMetaData::updateCascade() const 00237 { 00238 return (d->updateCascade_ && d->cardinality_ == RELATION_M1); 00239 } 00240 00241 inline bool FLRelationMetaData::checkIn() 00242 { 00243 return d->checkIn_; 00244 } 00245 00246 #endif