xref: /trunk/main/connectivity/source/drivers/macab/macabcondition.hxx (revision 914d351e5f5b84e4342a86d6ab8d4aca7308b9bd)
1*caf5cd79SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*caf5cd79SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*caf5cd79SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*caf5cd79SAndrew Rist  * distributed with this work for additional information
6*caf5cd79SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*caf5cd79SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*caf5cd79SAndrew Rist  * "License"); you may not use this file except in compliance
9*caf5cd79SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*caf5cd79SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*caf5cd79SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*caf5cd79SAndrew Rist  * software distributed under the License is distributed on an
15*caf5cd79SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*caf5cd79SAndrew Rist  * KIND, either express or implied.  See the License for the
17*caf5cd79SAndrew Rist  * specific language governing permissions and limitations
18*caf5cd79SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*caf5cd79SAndrew Rist  *************************************************************/
21*caf5cd79SAndrew Rist 
22*caf5cd79SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _CONNECTIVITY_MACAB_CONDITION_HXX_
25cdf0e10cSrcweir #define _CONNECTIVITY_MACAB_CONDITION_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "MacabHeader.hxx"
28cdf0e10cSrcweir #include "MacabRecord.hxx"
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #ifndef _COMPHELPER_TYPES_H_
31cdf0e10cSrcweir #include <comphelper/types.hxx>
32cdf0e10cSrcweir #endif
33cdf0e10cSrcweir #include <connectivity/dbexception.hxx>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir namespace connectivity
36cdf0e10cSrcweir {
37cdf0e10cSrcweir     namespace macab
38cdf0e10cSrcweir     {
39cdf0e10cSrcweir // -----------------------------------------------------------------------------
40cdf0e10cSrcweir class MacabCondition
41cdf0e10cSrcweir {
42cdf0e10cSrcweir     public:
43cdf0e10cSrcweir         virtual ~MacabCondition();
44cdf0e10cSrcweir         virtual sal_Bool isAlwaysTrue() const = 0;
45cdf0e10cSrcweir         virtual sal_Bool isAlwaysFalse() const = 0;
46cdf0e10cSrcweir         virtual sal_Bool eval(const MacabRecord *aRecord) const = 0;
47cdf0e10cSrcweir };
48cdf0e10cSrcweir // -----------------------------------------------------------------------------
49cdf0e10cSrcweir class MacabConditionConstant : public MacabCondition
50cdf0e10cSrcweir {
51cdf0e10cSrcweir     protected:
52cdf0e10cSrcweir         sal_Bool m_bValue;
53cdf0e10cSrcweir 
54cdf0e10cSrcweir     public:
55cdf0e10cSrcweir         MacabConditionConstant(const sal_Bool bValue);
56cdf0e10cSrcweir         virtual sal_Bool isAlwaysTrue() const;
57cdf0e10cSrcweir         virtual sal_Bool isAlwaysFalse() const;
58cdf0e10cSrcweir         virtual sal_Bool eval(const MacabRecord *aRecord) const;
59cdf0e10cSrcweir };
60cdf0e10cSrcweir // -----------------------------------------------------------------------------
61cdf0e10cSrcweir class MacabConditionColumn : public MacabCondition
62cdf0e10cSrcweir {
63cdf0e10cSrcweir     protected:
64cdf0e10cSrcweir         sal_Int32 m_nFieldNumber;
65cdf0e10cSrcweir 
66cdf0e10cSrcweir     public:
67cdf0e10cSrcweir         MacabConditionColumn(
68cdf0e10cSrcweir             const MacabHeader *header,
69cdf0e10cSrcweir             const ::rtl::OUString &sColumnName) throw(::com::sun::star::sdbc::SQLException);
70cdf0e10cSrcweir         virtual sal_Bool isAlwaysTrue() const;
71cdf0e10cSrcweir         virtual sal_Bool isAlwaysFalse() const;
72cdf0e10cSrcweir };
73cdf0e10cSrcweir // -----------------------------------------------------------------------------
74cdf0e10cSrcweir class MacabConditionNull : public MacabConditionColumn
75cdf0e10cSrcweir {
76cdf0e10cSrcweir     public:
77cdf0e10cSrcweir         MacabConditionNull(
78cdf0e10cSrcweir             const MacabHeader *header,
79cdf0e10cSrcweir             const ::rtl::OUString &sColumnName) throw(::com::sun::star::sdbc::SQLException);
80cdf0e10cSrcweir         virtual sal_Bool eval(const MacabRecord *aRecord) const;
81cdf0e10cSrcweir };
82cdf0e10cSrcweir // -----------------------------------------------------------------------------
83cdf0e10cSrcweir class MacabConditionNotNull : public MacabConditionColumn
84cdf0e10cSrcweir {
85cdf0e10cSrcweir     public:
86cdf0e10cSrcweir         MacabConditionNotNull(
87cdf0e10cSrcweir             const MacabHeader *header,
88cdf0e10cSrcweir             const ::rtl::OUString &sColumnName) throw(::com::sun::star::sdbc::SQLException);
89cdf0e10cSrcweir         virtual sal_Bool eval(const MacabRecord *aRecord) const;
90cdf0e10cSrcweir };
91cdf0e10cSrcweir // -----------------------------------------------------------------------------
92cdf0e10cSrcweir class MacabConditionCompare : public MacabConditionColumn
93cdf0e10cSrcweir {
94cdf0e10cSrcweir     protected:
95cdf0e10cSrcweir         const ::rtl::OUString m_sMatchString;
96cdf0e10cSrcweir 
97cdf0e10cSrcweir     public:
98cdf0e10cSrcweir         MacabConditionCompare(
99cdf0e10cSrcweir             const MacabHeader *header,
100cdf0e10cSrcweir             const ::rtl::OUString &sColumnName,
101cdf0e10cSrcweir             const ::rtl::OUString &sMatchString) throw(::com::sun::star::sdbc::SQLException);
102cdf0e10cSrcweir };
103cdf0e10cSrcweir // -----------------------------------------------------------------------------
104cdf0e10cSrcweir class MacabConditionEqual : public MacabConditionCompare
105cdf0e10cSrcweir {
106cdf0e10cSrcweir     public:
107cdf0e10cSrcweir         MacabConditionEqual(
108cdf0e10cSrcweir             const MacabHeader *header,
109cdf0e10cSrcweir             const ::rtl::OUString &sColumnName,
110cdf0e10cSrcweir             const ::rtl::OUString &sMatchString) throw(::com::sun::star::sdbc::SQLException);
111cdf0e10cSrcweir         virtual sal_Bool eval(const MacabRecord *aRecord) const;
112cdf0e10cSrcweir };
113cdf0e10cSrcweir // -----------------------------------------------------------------------------
114cdf0e10cSrcweir class MacabConditionDifferent : public MacabConditionCompare
115cdf0e10cSrcweir {
116cdf0e10cSrcweir     public:
117cdf0e10cSrcweir         MacabConditionDifferent(
118cdf0e10cSrcweir             const MacabHeader *header,
119cdf0e10cSrcweir             const ::rtl::OUString &sColumnName,
120cdf0e10cSrcweir             const ::rtl::OUString &sMatchString) throw(::com::sun::star::sdbc::SQLException);
121cdf0e10cSrcweir         virtual sal_Bool eval(const MacabRecord *aRecord) const;
122cdf0e10cSrcweir };
123cdf0e10cSrcweir // -----------------------------------------------------------------------------
124cdf0e10cSrcweir class MacabConditionSimilar : public MacabConditionCompare
125cdf0e10cSrcweir {
126cdf0e10cSrcweir     public:
127cdf0e10cSrcweir         MacabConditionSimilar(
128cdf0e10cSrcweir             const MacabHeader *header,
129cdf0e10cSrcweir             const ::rtl::OUString &sColumnName,
130cdf0e10cSrcweir             const ::rtl::OUString &sMatchString) throw(::com::sun::star::sdbc::SQLException);
131cdf0e10cSrcweir         virtual sal_Bool eval(const MacabRecord *aRecord) const;
132cdf0e10cSrcweir };
133cdf0e10cSrcweir // -----------------------------------------------------------------------------
134cdf0e10cSrcweir class MacabConditionBoolean : public MacabCondition
135cdf0e10cSrcweir {
136cdf0e10cSrcweir     protected:
137cdf0e10cSrcweir         MacabCondition *m_pLeft, *m_pRight;
138cdf0e10cSrcweir 
139cdf0e10cSrcweir     public:
140cdf0e10cSrcweir         MacabConditionBoolean(MacabCondition *pLeft, MacabCondition *pRight);
141cdf0e10cSrcweir         virtual ~MacabConditionBoolean();
142cdf0e10cSrcweir };
143cdf0e10cSrcweir // -----------------------------------------------------------------------------
144cdf0e10cSrcweir class MacabConditionOr : public MacabConditionBoolean
145cdf0e10cSrcweir {
146cdf0e10cSrcweir     public:
147cdf0e10cSrcweir         MacabConditionOr(MacabCondition *pLeft, MacabCondition *pRight);
148cdf0e10cSrcweir         virtual sal_Bool isAlwaysTrue() const;
149cdf0e10cSrcweir         virtual sal_Bool isAlwaysFalse() const;
150cdf0e10cSrcweir         virtual sal_Bool eval(const MacabRecord *aRecord) const;
151cdf0e10cSrcweir };
152cdf0e10cSrcweir // -----------------------------------------------------------------------------
153cdf0e10cSrcweir class MacabConditionAnd : public MacabConditionBoolean
154cdf0e10cSrcweir {
155cdf0e10cSrcweir     public:
156cdf0e10cSrcweir         MacabConditionAnd(MacabCondition *pLeft, MacabCondition *pRight);
157cdf0e10cSrcweir         virtual sal_Bool isAlwaysTrue() const;
158cdf0e10cSrcweir         virtual sal_Bool isAlwaysFalse() const;
159cdf0e10cSrcweir         virtual sal_Bool eval(const MacabRecord *aRecord) const;
160cdf0e10cSrcweir };
161cdf0e10cSrcweir // -----------------------------------------------------------------------------
162cdf0e10cSrcweir     }
163cdf0e10cSrcweir }
164cdf0e10cSrcweir 
165cdf0e10cSrcweir #endif // _CONNECTIVITY_MACAB_CONDITION_HXX_
166