1 #ifndef _CEGOATTRCOMP_H_INCLUDED_ 2 #define _CEGOATTRCOMP_H_INCLUDED_ 3 /////////////////////////////////////////////////////////////////////////////// 4 // 5 // CegoAttrComp.h 6 // -------------- 7 // Cego table attribute comparison description class definition 8 // 9 // Design and Implementation by Bjoern Lemke 10 // 11 // (C)opyright 2000-2019 Bjoern Lemke 12 // 13 // INTERFACE MODULE 14 // 15 // Class: CegoAttrComp 16 // 17 // Description: Attribute comparison utility class 18 // 19 // Status: CLEAN 20 // 21 /////////////////////////////////////////////////////////////////////////////// 22 23 // LFC INCLUDES 24 #include <lfcbase/Chain.h> 25 #include <lfcbase/ListT.h> 26 #include <lfcbase/Matcher.h> 27 28 // CEGO INCLUDES 29 #include "CegoField.h" 30 #include "CegoFieldValue.h" 31 #include "CegoAttrDesc.h" 32 #include "CegoComparison.h" 33 34 class CegoAttrComp { 35 36 public: 37 38 enum CompMode { UNDEF, VAL, ATTR, BTWN, ISLIKE, ISNOTLIKE }; 39 40 enum BetweenMode { VALUE2VALUE, VALUE2ATTR, ATTR2VALUE, ATTR2ATTR }; 41 42 CegoAttrComp(); 43 CegoAttrComp(const Chain& tableName, const Chain& attrName); 44 CegoAttrComp(const Chain& tableName, const Chain& attrName, CegoComparison comp, const CegoFieldValue& fv); 45 CegoAttrComp(const Chain& tableName, const Chain& attrName, CegoComparison comp, const CegoAttrDesc& attrDesc); 46 CegoAttrComp(const Chain& tableName, const Chain& attrName, const CegoFieldValue& fv, const CegoFieldValue& fv2); 47 48 CegoAttrComp(const Chain& tableName, const Chain& attrName, const CegoAttrDesc& attrDesc, const CegoFieldValue& fv2); 49 CegoAttrComp(const Chain& tableName, const Chain& attrName, const CegoFieldValue& fv, const CegoAttrDesc& attrDesc2); 50 CegoAttrComp(const Chain& tableName, const Chain& attrName, const CegoAttrDesc& attrDesc, const CegoAttrDesc& attrDesc2); 51 52 CegoAttrComp(const Chain& tableName, const Chain& attrName, const Chain& pattern, bool isNot); 53 ~CegoAttrComp(); 54 55 CompMode getCompMode() const; 56 57 int getPos() const; 58 void setPos(int pos); 59 60 void setTableName(const Chain& tableName); 61 const Chain& getTableName() const; 62 void setAttrName(const Chain& attrName); 63 const Chain& getAttrName() const; 64 CegoComparison getComparison() const; 65 void setComparison(CegoComparison comp); 66 67 void setFieldValue(const CegoFieldValue& fv); 68 void setFieldValue2(const CegoFieldValue& fv); 69 70 const CegoFieldValue& getFieldValue() const; 71 const CegoFieldValue& getFieldValue2() const; 72 73 void setAttrDesc(const CegoAttrDesc& ad); 74 const CegoAttrDesc& getAttrDesc() const; 75 76 void setAttrDesc2(const CegoAttrDesc& ad); 77 const CegoAttrDesc& getAttrDesc2() const; 78 79 void reset(); 80 isParentSetup()81 bool isParentSetup() { return _isParentSetup; } setParentSetup()82 void setParentSetup() { _isParentSetup = true; } 83 84 bool setup(const ListT<CegoField>& fl); 85 bool setup(ListT<CegoField>** pJoinBuf, int offset); 86 87 bool isNullComp() const; 88 89 bool isSetup(); 90 91 const Chain& getPattern() const; 92 Matcher* getMatcher(); 93 94 CegoAttrComp& operator = ( const CegoAttrComp& ac); 95 bool operator == ( const CegoAttrComp& ac) const; 96 bool operator > ( const CegoAttrComp& ac) const; 97 bool operator < ( const CegoAttrComp& ac) const; 98 99 Chain getId() const; 100 Chain toChain() const; 101 friend ostream& operator << (ostream& s, const CegoAttrComp& ac); 102 103 private: 104 105 int _pos; 106 Chain _tableName; 107 Chain _attrName; 108 CegoComparison _comp; 109 CegoFieldValue _fv; 110 CegoFieldValue _fv2; 111 CegoAttrDesc _attrDesc; 112 CegoAttrDesc _attrDesc2; 113 CompMode _compMode; 114 BetweenMode _btwnMode; 115 Chain _pattern; 116 Matcher* _pMatcher; 117 118 bool _isSetup; 119 bool _isSetup2; 120 121 int _xpos; 122 int _ypos; 123 int _xpos2; 124 int _ypos2; 125 126 bool _posSetup; 127 bool _isParentSetup; 128 }; 129 130 #endif 131