1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABCONDITION_HXX
21 #define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABCONDITION_HXX
23 #include "MacabHeader.hxx"
24 #include "MacabRecord.hxx"
26 #include <comphelper/types.hxx>
27 #include <connectivity/dbexception.hxx>
29 namespace connectivity
37 virtual ~MacabCondition();
38 virtual sal_Bool
isAlwaysTrue() const = 0;
39 virtual sal_Bool
isAlwaysFalse() const = 0;
40 virtual sal_Bool
eval(const MacabRecord
*aRecord
) const = 0;
43 class MacabConditionConstant
: public MacabCondition
49 MacabConditionConstant(const sal_Bool bValue
);
50 virtual sal_Bool
isAlwaysTrue() const SAL_OVERRIDE
;
51 virtual sal_Bool
isAlwaysFalse() const SAL_OVERRIDE
;
52 virtual sal_Bool
eval(const MacabRecord
*aRecord
) const SAL_OVERRIDE
;
55 class MacabConditionColumn
: public MacabCondition
58 sal_Int32 m_nFieldNumber
;
62 const MacabHeader
*header
,
63 const OUString
&sColumnName
) throw(::com::sun::star::sdbc::SQLException
);
64 virtual sal_Bool
isAlwaysTrue() const SAL_OVERRIDE
;
65 virtual sal_Bool
isAlwaysFalse() const SAL_OVERRIDE
;
68 class MacabConditionNull
: public MacabConditionColumn
72 const MacabHeader
*header
,
73 const OUString
&sColumnName
) throw(::com::sun::star::sdbc::SQLException
);
74 virtual sal_Bool
eval(const MacabRecord
*aRecord
) const SAL_OVERRIDE
;
77 class MacabConditionNotNull
: public MacabConditionColumn
80 MacabConditionNotNull(
81 const MacabHeader
*header
,
82 const OUString
&sColumnName
) throw(::com::sun::star::sdbc::SQLException
);
83 virtual sal_Bool
eval(const MacabRecord
*aRecord
) const SAL_OVERRIDE
;
86 class MacabConditionCompare
: public MacabConditionColumn
89 const OUString m_sMatchString
;
92 MacabConditionCompare(
93 const MacabHeader
*header
,
94 const OUString
&sColumnName
,
95 const OUString
&sMatchString
) throw(::com::sun::star::sdbc::SQLException
);
98 class MacabConditionEqual
: public MacabConditionCompare
102 const MacabHeader
*header
,
103 const OUString
&sColumnName
,
104 const OUString
&sMatchString
) throw(::com::sun::star::sdbc::SQLException
);
105 virtual sal_Bool
eval(const MacabRecord
*aRecord
) const SAL_OVERRIDE
;
108 class MacabConditionDifferent
: public MacabConditionCompare
111 MacabConditionDifferent(
112 const MacabHeader
*header
,
113 const OUString
&sColumnName
,
114 const OUString
&sMatchString
) throw(::com::sun::star::sdbc::SQLException
);
115 virtual sal_Bool
eval(const MacabRecord
*aRecord
) const SAL_OVERRIDE
;
118 class MacabConditionSimilar
: public MacabConditionCompare
121 MacabConditionSimilar(
122 const MacabHeader
*header
,
123 const OUString
&sColumnName
,
124 const OUString
&sMatchString
) throw(::com::sun::star::sdbc::SQLException
);
125 virtual sal_Bool
eval(const MacabRecord
*aRecord
) const SAL_OVERRIDE
;
128 class MacabConditionBoolean
: public MacabCondition
131 MacabCondition
*m_pLeft
, *m_pRight
;
134 MacabConditionBoolean(MacabCondition
*pLeft
, MacabCondition
*pRight
);
135 virtual ~MacabConditionBoolean();
138 class MacabConditionOr
: public MacabConditionBoolean
141 MacabConditionOr(MacabCondition
*pLeft
, MacabCondition
*pRight
);
142 virtual sal_Bool
isAlwaysTrue() const SAL_OVERRIDE
;
143 virtual sal_Bool
isAlwaysFalse() const SAL_OVERRIDE
;
144 virtual sal_Bool
eval(const MacabRecord
*aRecord
) const SAL_OVERRIDE
;
147 class MacabConditionAnd
: public MacabConditionBoolean
150 MacabConditionAnd(MacabCondition
*pLeft
, MacabCondition
*pRight
);
151 virtual sal_Bool
isAlwaysTrue() const SAL_OVERRIDE
;
152 virtual sal_Bool
isAlwaysFalse() const SAL_OVERRIDE
;
153 virtual sal_Bool
eval(const MacabRecord
*aRecord
) const SAL_OVERRIDE
;
159 #endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABCONDITION_HXX
161 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */