update dev300-m58
[ooovba.git] / connectivity / source / drivers / macab / macabcondition.hxx
blob2a03483dc2a57e1ad443723705ba3b29a9fa4d75
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: macabcondition.hxx,v $
10 * $Revision: 1.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _CONNECTIVITY_MACAB_CONDITION_HXX_
32 #define _CONNECTIVITY_MACAB_CONDITION_HXX_
34 #include "MacabHeader.hxx"
35 #include "MacabRecord.hxx"
37 #ifndef _COMPHELPER_TYPES_H_
38 #include <comphelper/types.hxx>
39 #endif
40 #include <connectivity/dbexception.hxx>
42 namespace connectivity
44 namespace macab
46 // -----------------------------------------------------------------------------
47 class MacabCondition
49 public:
50 virtual ~MacabCondition();
51 virtual sal_Bool isAlwaysTrue() const = 0;
52 virtual sal_Bool isAlwaysFalse() const = 0;
53 virtual sal_Bool eval(const MacabRecord *aRecord) const = 0;
55 // -----------------------------------------------------------------------------
56 class MacabConditionConstant : public MacabCondition
58 protected:
59 sal_Bool m_bValue;
61 public:
62 MacabConditionConstant(const sal_Bool bValue);
63 virtual sal_Bool isAlwaysTrue() const;
64 virtual sal_Bool isAlwaysFalse() const;
65 virtual sal_Bool eval(const MacabRecord *aRecord) const;
67 // -----------------------------------------------------------------------------
68 class MacabConditionColumn : public MacabCondition
70 protected:
71 sal_Int32 m_nFieldNumber;
73 public:
74 MacabConditionColumn(
75 const MacabHeader *header,
76 const ::rtl::OUString &sColumnName) throw(::com::sun::star::sdbc::SQLException);
77 virtual sal_Bool isAlwaysTrue() const;
78 virtual sal_Bool isAlwaysFalse() const;
80 // -----------------------------------------------------------------------------
81 class MacabConditionNull : public MacabConditionColumn
83 public:
84 MacabConditionNull(
85 const MacabHeader *header,
86 const ::rtl::OUString &sColumnName) throw(::com::sun::star::sdbc::SQLException);
87 virtual sal_Bool eval(const MacabRecord *aRecord) const;
89 // -----------------------------------------------------------------------------
90 class MacabConditionNotNull : public MacabConditionColumn
92 public:
93 MacabConditionNotNull(
94 const MacabHeader *header,
95 const ::rtl::OUString &sColumnName) throw(::com::sun::star::sdbc::SQLException);
96 virtual sal_Bool eval(const MacabRecord *aRecord) const;
98 // -----------------------------------------------------------------------------
99 class MacabConditionCompare : public MacabConditionColumn
101 protected:
102 const ::rtl::OUString m_sMatchString;
104 public:
105 MacabConditionCompare(
106 const MacabHeader *header,
107 const ::rtl::OUString &sColumnName,
108 const ::rtl::OUString &sMatchString) throw(::com::sun::star::sdbc::SQLException);
110 // -----------------------------------------------------------------------------
111 class MacabConditionEqual : public MacabConditionCompare
113 public:
114 MacabConditionEqual(
115 const MacabHeader *header,
116 const ::rtl::OUString &sColumnName,
117 const ::rtl::OUString &sMatchString) throw(::com::sun::star::sdbc::SQLException);
118 virtual sal_Bool eval(const MacabRecord *aRecord) const;
120 // -----------------------------------------------------------------------------
121 class MacabConditionDifferent : public MacabConditionCompare
123 public:
124 MacabConditionDifferent(
125 const MacabHeader *header,
126 const ::rtl::OUString &sColumnName,
127 const ::rtl::OUString &sMatchString) throw(::com::sun::star::sdbc::SQLException);
128 virtual sal_Bool eval(const MacabRecord *aRecord) const;
130 // -----------------------------------------------------------------------------
131 class MacabConditionSimilar : public MacabConditionCompare
133 public:
134 MacabConditionSimilar(
135 const MacabHeader *header,
136 const ::rtl::OUString &sColumnName,
137 const ::rtl::OUString &sMatchString) throw(::com::sun::star::sdbc::SQLException);
138 virtual sal_Bool eval(const MacabRecord *aRecord) const;
140 // -----------------------------------------------------------------------------
141 class MacabConditionBoolean : public MacabCondition
143 protected:
144 MacabCondition *m_pLeft, *m_pRight;
146 public:
147 MacabConditionBoolean(MacabCondition *pLeft, MacabCondition *pRight);
148 virtual ~MacabConditionBoolean();
150 // -----------------------------------------------------------------------------
151 class MacabConditionOr : public MacabConditionBoolean
153 public:
154 MacabConditionOr(MacabCondition *pLeft, MacabCondition *pRight);
155 virtual sal_Bool isAlwaysTrue() const;
156 virtual sal_Bool isAlwaysFalse() const;
157 virtual sal_Bool eval(const MacabRecord *aRecord) const;
159 // -----------------------------------------------------------------------------
160 class MacabConditionAnd : public MacabConditionBoolean
162 public:
163 MacabConditionAnd(MacabCondition *pLeft, MacabCondition *pRight);
164 virtual sal_Bool isAlwaysTrue() const;
165 virtual sal_Bool isAlwaysFalse() const;
166 virtual sal_Bool eval(const MacabRecord *aRecord) const;
168 // -----------------------------------------------------------------------------
172 #endif // _CONNECTIVITY_MACAB_CONDITION_HXX_