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