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: conditionalexpression.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 CONDITIONALEXPRESSION_HXX
32 #define CONDITIONALEXPRESSION_HXX
36 /** === begin UNO includes === **/
37 /** === end UNO includes === **/
39 #include <rtl/ustring.hxx>
41 #include <boost/shared_ptr.hpp>
45 //........................................................................
48 //........................................................................
50 // =============================================================================
51 // = ConditionalExpression
52 // =============================================================================
53 class REPORTDESIGN_DLLPUBLIC ConditionalExpression
56 const ::rtl::OUString m_sPattern
;
59 ConditionalExpression( const sal_Char
* _pAsciiPattern
);
61 /** assembles an expression string from a field data source, and one or two operands
63 ::rtl::OUString
assembleExpression( const ::rtl::OUString
& _rFieldDataSource
, const ::rtl::OUString
& _rLHS
, const ::rtl::OUString
& _rRHS
) const;
65 /** matches the given expression string to the expression pattern represented by the object
67 the expression to match
68 @param _rFieldDataSource
71 output parameter taking the left hand side operand, if successful
73 output parameter taking the right hand side operand, if successful
75 <TRUE/> if and only if the expression string could be successfully matched to
78 bool matchExpression( const ::rtl::OUString
& _rExpression
, const ::rtl::OUString
& _rFieldDataSource
, ::rtl::OUString
& _out_rLHS
, ::rtl::OUString
& _out_rRHS
) const;
81 //========================================================================
83 //========================================================================
86 eFieldValueComparison
= 0,
90 //========================================================================
91 //= ComparisonOperation
92 //========================================================================
93 enum ComparisonOperation
105 typedef ::boost::shared_ptr
< ConditionalExpression
> PConditionalExpression
;
106 typedef ::std::map
< ComparisonOperation
, PConditionalExpression
> ConditionalExpressions
;
108 // =============================================================================
109 // = ConditionalExpressionFactory
110 // =============================================================================
111 class REPORTDESIGN_DLLPUBLIC ConditionalExpressionFactory
114 /// fills the given map with all ConditionalExpressions which we know
115 static size_t getKnownConditionalExpressions( ConditionalExpressions
& _out_rCondExp
);
118 ConditionalExpressionFactory(); // never implemented
119 ConditionalExpressionFactory( const ConditionalExpressionFactory
& ); // never implemented
120 ConditionalExpressionFactory
& operator=( const ConditionalExpressionFactory
& ); // never implemented
122 //........................................................................
124 //........................................................................
126 #endif // CONDITIONALEXPRESSION_HXX