1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: macabcondition.hxx,v $
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>
40 #include <connectivity/dbexception.hxx>
42 namespace connectivity
46 // -----------------------------------------------------------------------------
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
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
71 sal_Int32 m_nFieldNumber
;
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
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
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
102 const ::rtl::OUString m_sMatchString
;
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
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
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
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
144 MacabCondition
*m_pLeft
, *m_pRight
;
147 MacabConditionBoolean(MacabCondition
*pLeft
, MacabCondition
*pRight
);
148 virtual ~MacabConditionBoolean();
150 // -----------------------------------------------------------------------------
151 class MacabConditionOr
: public MacabConditionBoolean
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
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_