xref: /aoo41x/main/framework/inc/classes/wildcard.hxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef __FRAMEWORK_CLASSES_WILDCARD_HXX_
29*cdf0e10cSrcweir #define __FRAMEWORK_CLASSES_WILDCARD_HXX_
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
32*cdf0e10cSrcweir //	my own includes
33*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir #include <macros/debug.hxx>
36*cdf0e10cSrcweir 
37*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
38*cdf0e10cSrcweir //	interface includes
39*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
42*cdf0e10cSrcweir //	other includes
43*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
44*cdf0e10cSrcweir #include <rtl/ustring.hxx>
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
47*cdf0e10cSrcweir //	const
48*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
51*cdf0e10cSrcweir //	namespace
52*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
53*cdf0e10cSrcweir 
54*cdf0e10cSrcweir namespace framework{
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
57*cdf0e10cSrcweir //	declarations
58*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir /*-************************************************************************************************************//**
61*cdf0e10cSrcweir 	@short			implement wildcard-mechanism for unicode
62*cdf0e10cSrcweir 	@descr			This class can be used to get information about the matching of a pattern to a given text.
63*cdf0e10cSrcweir 					It's suitable for 8-Bit- AND 16-Bit-strings!
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir 	@implements		-
66*cdf0e10cSrcweir 	@base			-
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir 	@ATTENTION		This class is'nt threadsafe!
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir 	@devstatus		deprecated
71*cdf0e10cSrcweir *//*-*************************************************************************************************************/
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir class Wildcard
74*cdf0e10cSrcweir {
75*cdf0e10cSrcweir 	//-------------------------------------------------------------------------------------------------------------
76*cdf0e10cSrcweir 	//	public methods
77*cdf0e10cSrcweir 	//-------------------------------------------------------------------------------------------------------------
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir 	public:
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir 		//---------------------------------------------------------------------------------------------------------
82*cdf0e10cSrcweir 		//	constructor / destructor
83*cdf0e10cSrcweir 		//---------------------------------------------------------------------------------------------------------
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir 		/*-****************************************************************************************************//**
86*cdf0e10cSrcweir 			@short      standard ctor
87*cdf0e10cSrcweir 			@descr		We do nothing here.
88*cdf0e10cSrcweir 
89*cdf0e10cSrcweir 			@seealso	-
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir 			@param		-
92*cdf0e10cSrcweir 			@return		-
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir 			@onerror	-
95*cdf0e10cSrcweir 		*//*-*****************************************************************************************************/
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir 		Wildcard();
98*cdf0e10cSrcweir 
99*cdf0e10cSrcweir 		/*-****************************************************************************************************//**
100*cdf0e10cSrcweir 			@short      standard dtor
101*cdf0e10cSrcweir 			@descr		We do nothing here.
102*cdf0e10cSrcweir 
103*cdf0e10cSrcweir 			@seealso	-
104*cdf0e10cSrcweir 
105*cdf0e10cSrcweir 			@param		-
106*cdf0e10cSrcweir 			@return		-
107*cdf0e10cSrcweir 
108*cdf0e10cSrcweir 			@onerror	-
109*cdf0e10cSrcweir 		*//*-*****************************************************************************************************/
110*cdf0e10cSrcweir 
111*cdf0e10cSrcweir 		virtual ~Wildcard();
112*cdf0e10cSrcweir 
113*cdf0e10cSrcweir 		//---------------------------------------------------------------------------------------------------------
114*cdf0e10cSrcweir 		//	interface
115*cdf0e10cSrcweir 		//---------------------------------------------------------------------------------------------------------
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir 		/*-****************************************************************************************************//**
118*cdf0e10cSrcweir 			@short      try to find an agreement between given text and searchpattern
119*cdf0e10cSrcweir 			@descr		You can use wildcards in pattern only!
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir 			@seealso	-
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir 			@param		"sText" is the text, in which we search given pattern.
124*cdf0e10cSrcweir 			@param		"sPattern" is the searched pattern with includes wildcards.
125*cdf0e10cSrcweir 			@return		sal_True , if pattern was found.
126*cdf0e10cSrcweir 			@return		sal_False, if pattern don't match the text.
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir 			@onerror	-
129*cdf0e10cSrcweir 		*//*-*****************************************************************************************************/
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir 		static sal_Bool match(	const	::rtl::OUString&	sText		,
132*cdf0e10cSrcweir 			   					const	::rtl::OUString&	sPattern	);
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir 		//---------------------------------------------------------------------------------------------------------
135*cdf0e10cSrcweir 		//	debug and test methods
136*cdf0e10cSrcweir 		//---------------------------------------------------------------------------------------------------------
137*cdf0e10cSrcweir 
138*cdf0e10cSrcweir 		/*-****************************************************************************************************//**
139*cdf0e10cSrcweir 			@short		debug-methods to check incoming parameter of some other mehods of this class
140*cdf0e10cSrcweir 			@descr		The follow methods are used to check parameters for other methods
141*cdf0e10cSrcweir 						of this class. The return value is used directly for an ASSERT(...).
142*cdf0e10cSrcweir 						This mechanism is active in debug version only!
143*cdf0e10cSrcweir 
144*cdf0e10cSrcweir 			@seealso	FRAMEWORK_ASSERT in implementation!
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir 			@param		references to checking variables
147*cdf0e10cSrcweir 			@return		sal_False on invalid parameter
148*cdf0e10cSrcweir 			@return		sal_True otherwise
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir 			@onerror	-
151*cdf0e10cSrcweir 		*//*-*****************************************************************************************************/
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir 		#ifdef ENABLE_ASSERTIONS
154*cdf0e10cSrcweir 
155*cdf0e10cSrcweir 		static sal_Bool impldbg_checkParameter_match(	const	::rtl::OUString&	sText		,
156*cdf0e10cSrcweir 			   											const	::rtl::OUString&	sPattern	);
157*cdf0e10cSrcweir 
158*cdf0e10cSrcweir 		#endif	// #ifdef ENABLE_ASSERTIONS
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir 		/*-****************************************************************************************************//**
161*cdf0e10cSrcweir 			@short      test implementation of match() with different examples
162*cdf0e10cSrcweir 			@descr		If TESTMODE activated, you cann call these method to start and log some special examples.
163*cdf0e10cSrcweir 						Do this if you have changed the implementation of method match() to test it.
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir 			@seealso	-
166*cdf0e10cSrcweir 
167*cdf0e10cSrcweir 			@param		-
168*cdf0e10cSrcweir 			@return		-
169*cdf0e10cSrcweir 
170*cdf0e10cSrcweir 			@onerror	Error-conditions are written to file or show in a messagebox.
171*cdf0e10cSrcweir 						Thhat depends from current setting of ASSERT_OUTPUTTYPE. (see debug.hxx for further informations.)
172*cdf0e10cSrcweir 		*//*-*****************************************************************************************************/
173*cdf0e10cSrcweir 
174*cdf0e10cSrcweir 		#ifdef ENABLE_CLASSDEBUG
175*cdf0e10cSrcweir 
176*cdf0e10cSrcweir 		void impldbg_testWildcard();
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir 		#endif // #ifdef ENABLE_CLASSDEBUG
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir };		//	class Wildcard
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir }		//	namespace framework
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir #endif	//	#ifndef __FRAMEWORK_CLASSES_WILDCARD_HXX_
185