xref: /trunk/main/framework/inc/classes/wildcard.hxx (revision f8e07b45)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef __FRAMEWORK_CLASSES_WILDCARD_HXX_
25 #define __FRAMEWORK_CLASSES_WILDCARD_HXX_
26 
27 //_________________________________________________________________________________________________________________
28 //	my own includes
29 //_________________________________________________________________________________________________________________
30 
31 #include <macros/debug.hxx>
32 
33 //_________________________________________________________________________________________________________________
34 //	interface includes
35 //_________________________________________________________________________________________________________________
36 
37 //_________________________________________________________________________________________________________________
38 //	other includes
39 //_________________________________________________________________________________________________________________
40 #include <rtl/ustring.hxx>
41 
42 //_________________________________________________________________________________________________________________
43 //	const
44 //_________________________________________________________________________________________________________________
45 
46 //_________________________________________________________________________________________________________________
47 //	namespace
48 //_________________________________________________________________________________________________________________
49 
50 namespace framework{
51 
52 //_________________________________________________________________________________________________________________
53 //	declarations
54 //_________________________________________________________________________________________________________________
55 
56 /*-************************************************************************************************************//**
57 	@short			implement wildcard-mechanism for unicode
58 	@descr			This class can be used to get information about the matching of a pattern to a given text.
59 					It's suitable for 8-Bit- AND 16-Bit-strings!
60 
61 	@implements		-
62 	@base			-
63 
64 	@ATTENTION		This class is'nt threadsafe!
65 
66 	@devstatus		deprecated
67 *//*-*************************************************************************************************************/
68 
69 class Wildcard
70 {
71 	//-------------------------------------------------------------------------------------------------------------
72 	//	public methods
73 	//-------------------------------------------------------------------------------------------------------------
74 
75 	public:
76 
77 		//---------------------------------------------------------------------------------------------------------
78 		//	constructor / destructor
79 		//---------------------------------------------------------------------------------------------------------
80 
81 		/*-****************************************************************************************************//**
82 			@short      standard ctor
83 			@descr		We do nothing here.
84 
85 			@seealso	-
86 
87 			@param		-
88 			@return		-
89 
90 			@onerror	-
91 		*//*-*****************************************************************************************************/
92 
93 		Wildcard();
94 
95 		/*-****************************************************************************************************//**
96 			@short      standard dtor
97 			@descr		We do nothing here.
98 
99 			@seealso	-
100 
101 			@param		-
102 			@return		-
103 
104 			@onerror	-
105 		*//*-*****************************************************************************************************/
106 
107 		virtual ~Wildcard();
108 
109 		//---------------------------------------------------------------------------------------------------------
110 		//	interface
111 		//---------------------------------------------------------------------------------------------------------
112 
113 		/*-****************************************************************************************************//**
114 			@short      try to find an agreement between given text and searchpattern
115 			@descr		You can use wildcards in pattern only!
116 
117 			@seealso	-
118 
119 			@param		"sText" is the text, in which we search given pattern.
120 			@param		"sPattern" is the searched pattern with includes wildcards.
121 			@return		sal_True , if pattern was found.
122 			@return		sal_False, if pattern don't match the text.
123 
124 			@onerror	-
125 		*//*-*****************************************************************************************************/
126 
127 		static sal_Bool match(	const	::rtl::OUString&	sText		,
128 			   					const	::rtl::OUString&	sPattern	);
129 
130 		//---------------------------------------------------------------------------------------------------------
131 		//	debug and test methods
132 		//---------------------------------------------------------------------------------------------------------
133 
134 		/*-****************************************************************************************************//**
135 			@short		debug-methods to check incoming parameter of some other mehods of this class
136 			@descr		The follow methods are used to check parameters for other methods
137 						of this class. The return value is used directly for an ASSERT(...).
138 						This mechanism is active in debug version only!
139 
140 			@seealso	FRAMEWORK_ASSERT in implementation!
141 
142 			@param		references to checking variables
143 			@return		sal_False on invalid parameter
144 			@return		sal_True otherwise
145 
146 			@onerror	-
147 		*//*-*****************************************************************************************************/
148 
149 		#ifdef ENABLE_ASSERTIONS
150 
151 		static sal_Bool impldbg_checkParameter_match(	const	::rtl::OUString&	sText		,
152 			   											const	::rtl::OUString&	sPattern	);
153 
154 		#endif	// #ifdef ENABLE_ASSERTIONS
155 
156 		/*-****************************************************************************************************//**
157 			@short      test implementation of match() with different examples
158 			@descr		If TESTMODE activated, you cann call these method to start and log some special examples.
159 						Do this if you have changed the implementation of method match() to test it.
160 
161 			@seealso	-
162 
163 			@param		-
164 			@return		-
165 
166 			@onerror	Error-conditions are written to file or show in a messagebox.
167 						Thhat depends from current setting of ASSERT_OUTPUTTYPE. (see debug.hxx for further informations.)
168 		*//*-*****************************************************************************************************/
169 
170 		#ifdef ENABLE_CLASSDEBUG
171 
172 		void impldbg_testWildcard();
173 
174 		#endif // #ifdef ENABLE_CLASSDEBUG
175 
176 };		//	class Wildcard
177 
178 }		//	namespace framework
179 
180 #endif	//	#ifndef __FRAMEWORK_CLASSES_WILDCARD_HXX_
181