1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef CONDITIONALEXPRESSION_HXX
29 #define CONDITIONALEXPRESSION_HXX
33 /** === begin UNO includes === **/
34 /** === end UNO includes === **/
36 #include <rtl/ustring.hxx>
38 #include <boost/shared_ptr.hpp>
42 //........................................................................
45 //........................................................................
47 // =============================================================================
48 // = ConditionalExpression
49 // =============================================================================
50 class REPORTDESIGN_DLLPUBLIC ConditionalExpression
53 const ::rtl::OUString m_sPattern
;
56 ConditionalExpression( const sal_Char
* _pAsciiPattern
);
58 /** assembles an expression string from a field data source, and one or two operands
60 ::rtl::OUString
assembleExpression( const ::rtl::OUString
& _rFieldDataSource
, const ::rtl::OUString
& _rLHS
, const ::rtl::OUString
& _rRHS
) const;
62 /** matches the given expression string to the expression pattern represented by the object
64 the expression to match
65 @param _rFieldDataSource
68 output parameter taking the left hand side operand, if successful
70 output parameter taking the right hand side operand, if successful
72 <TRUE/> if and only if the expression string could be successfully matched to
75 bool matchExpression( const ::rtl::OUString
& _rExpression
, const ::rtl::OUString
& _rFieldDataSource
, ::rtl::OUString
& _out_rLHS
, ::rtl::OUString
& _out_rRHS
) const;
78 //========================================================================
80 //========================================================================
83 eFieldValueComparison
= 0,
87 //========================================================================
88 //= ComparisonOperation
89 //========================================================================
90 enum ComparisonOperation
102 typedef ::boost::shared_ptr
< ConditionalExpression
> PConditionalExpression
;
103 typedef ::std::map
< ComparisonOperation
, PConditionalExpression
> ConditionalExpressions
;
105 // =============================================================================
106 // = ConditionalExpressionFactory
107 // =============================================================================
108 class REPORTDESIGN_DLLPUBLIC ConditionalExpressionFactory
111 /// fills the given map with all ConditionalExpressions which we know
112 static size_t getKnownConditionalExpressions( ConditionalExpressions
& _out_rCondExp
);
115 ConditionalExpressionFactory(); // never implemented
116 ConditionalExpressionFactory( const ConditionalExpressionFactory
& ); // never implemented
117 ConditionalExpressionFactory
& operator=( const ConditionalExpressionFactory
& ); // never implemented
119 //........................................................................
121 //........................................................................
123 #endif // CONDITIONALEXPRESSION_HXX