Update ooo320-m1
[ooovba.git] / connectivity / source / drivers / kab / kcondition.hxx
blobd22c09ce96a3f6951d901c1d9f8553171e51018e
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: kcondition.hxx,v $
10 * $Revision: 1.5 $
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_KAB_CONDITION_HXX_
32 #define _CONNECTIVITY_KAB_CONDITION_HXX_
34 #ifndef _COMPHELPER_TYPES_H_
35 #include <comphelper/types.hxx>
36 #endif
37 #include <vcl/kde_headers.h>
38 #include <connectivity/dbexception.hxx>
40 namespace connectivity
42 namespace kab
44 // -----------------------------------------------------------------------------
45 class KabCondition
47 public:
48 virtual ~KabCondition();
49 virtual sal_Bool isAlwaysTrue() const = 0;
50 virtual sal_Bool isAlwaysFalse() const = 0;
51 virtual sal_Bool eval(const ::KABC::Addressee &aAddressee) const = 0;
53 // -----------------------------------------------------------------------------
54 class KabConditionConstant : public KabCondition
56 protected:
57 sal_Bool m_bValue;
59 public:
60 KabConditionConstant(const sal_Bool bValue);
61 virtual sal_Bool isAlwaysTrue() const;
62 virtual sal_Bool isAlwaysFalse() const;
63 virtual sal_Bool eval(const ::KABC::Addressee &aAddressee) const;
65 // -----------------------------------------------------------------------------
66 class KabConditionColumn : public KabCondition
68 protected:
69 sal_Int32 m_nFieldNumber;
71 QString value(const ::KABC::Addressee &aAddressee) const;
73 public:
74 KabConditionColumn(
75 const ::rtl::OUString &sColumnName) throw(::com::sun::star::sdbc::SQLException);
76 virtual sal_Bool isAlwaysTrue() const;
77 virtual sal_Bool isAlwaysFalse() const;
79 // -----------------------------------------------------------------------------
80 class KabConditionNull : public KabConditionColumn
82 public:
83 KabConditionNull(
84 const ::rtl::OUString &sColumnName) throw(::com::sun::star::sdbc::SQLException);
85 virtual sal_Bool eval(const ::KABC::Addressee &aAddressee) const;
87 // -----------------------------------------------------------------------------
88 class KabConditionNotNull : public KabConditionColumn
90 public:
91 KabConditionNotNull(
92 const ::rtl::OUString &sColumnName) throw(::com::sun::star::sdbc::SQLException);
93 virtual sal_Bool eval(const ::KABC::Addressee &aAddressee) const;
95 // -----------------------------------------------------------------------------
96 class KabConditionCompare : public KabConditionColumn
98 protected:
99 const ::rtl::OUString m_sMatchString;
101 public:
102 KabConditionCompare(
103 const ::rtl::OUString &sColumnName,
104 const ::rtl::OUString &sMatchString) throw(::com::sun::star::sdbc::SQLException);
106 // -----------------------------------------------------------------------------
107 class KabConditionEqual : public KabConditionCompare
109 public:
110 KabConditionEqual(
111 const ::rtl::OUString &sColumnName,
112 const ::rtl::OUString &sMatchString) throw(::com::sun::star::sdbc::SQLException);
113 virtual sal_Bool eval(const ::KABC::Addressee &aAddressee) const;
115 // -----------------------------------------------------------------------------
116 class KabConditionDifferent : public KabConditionCompare
118 public:
119 KabConditionDifferent(
120 const ::rtl::OUString &sColumnName,
121 const ::rtl::OUString &sMatchString) throw(::com::sun::star::sdbc::SQLException);
122 virtual sal_Bool eval(const ::KABC::Addressee &aAddressee) const;
124 // -----------------------------------------------------------------------------
125 class KabConditionSimilar : public KabConditionCompare
127 public:
128 KabConditionSimilar(
129 const ::rtl::OUString &sColumnName,
130 const ::rtl::OUString &sMatchString) throw(::com::sun::star::sdbc::SQLException);
131 virtual sal_Bool eval(const ::KABC::Addressee &aAddressee) const;
133 // -----------------------------------------------------------------------------
134 class KabConditionBoolean : public KabCondition
136 protected:
137 KabCondition *m_pLeft, *m_pRight;
139 public:
140 KabConditionBoolean(KabCondition *pLeft, KabCondition *pRight);
141 virtual ~KabConditionBoolean();
143 // -----------------------------------------------------------------------------
144 class KabConditionOr : public KabConditionBoolean
146 public:
147 KabConditionOr(KabCondition *pLeft, KabCondition *pRight);
148 virtual sal_Bool isAlwaysTrue() const;
149 virtual sal_Bool isAlwaysFalse() const;
150 virtual sal_Bool eval(const ::KABC::Addressee &aAddressee) const;
152 // -----------------------------------------------------------------------------
153 class KabConditionAnd : public KabConditionBoolean
155 public:
156 KabConditionAnd(KabCondition *pLeft, KabCondition *pRight);
157 virtual sal_Bool isAlwaysTrue() const;
158 virtual sal_Bool isAlwaysFalse() const;
159 virtual sal_Bool eval(const ::KABC::Addressee &addressee) const;
161 // -----------------------------------------------------------------------------
165 #endif // _CONNECTIVITY_KAB_CONDITION_HXX_