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 #ifndef _XMLSEARCH_QE_DOCGENERATOR_HXX_
24 #define _XMLSEARCH_QE_DOCGENERATOR_HXX_
25 
26 #include <rtl/ref.hxx>
27 #ifndef _RTL_USTRING_HXX__
28 #include  <rtl/ustring.hxx>
29 #endif
30 #include <excep/XmlSearchExceptions.hxx>
31 #include <util/CompressorIterator.hxx>
32 #include <util/Decompressor.hxx>
33 
34 
35 namespace xmlsearch {
36 
37 	namespace qe {
38 
39 
40 		class Query;
41 
42 
43 		class NonnegativeIntegerGenerator
44 		{
45 		public:
46 
47 			static const sal_Int32 END;
48 
~NonnegativeIntegerGenerator()49 			virtual ~NonnegativeIntegerGenerator() { };
50 			virtual sal_Int32 first() throw( xmlsearch::excep::XmlSearchException ) = 0;
51 			virtual sal_Int32 next() throw( xmlsearch::excep::XmlSearchException ) = 0;
52 		};
53 
54 
55 		class RoleFiller
56 		{
57 		public:
58 
STOP()59 			static RoleFiller* STOP() { return &roleFiller_; }
60 
61 			RoleFiller();
62 
63 			~RoleFiller();
64 
acquire()65 			void acquire() { ++m_nRefcount; }
release()66 			void release() { if( ! --m_nRefcount ) delete this; }
67 
68 		private:
69 
70 			static RoleFiller roleFiller_;
71 
72 			sal_uInt32     m_nRefcount;
73 			sal_uInt8      fixedRole_;
74 			sal_Int16      filled_;
75 			sal_Int32      begin_,end_,parentContext_,limit_;
76 
77 			RoleFiller*    next_;
78 			std::vector< RoleFiller* > fillers_;
79 		};
80 
81 
82 		class GeneratorHeap
83 		{
84 		public:
85 
GeneratorHeap()86 			GeneratorHeap()
87 				: heapSize_( 0 ),
88 				  free_( 0 )
89 			{ }
90 		private:
91 
92 			sal_Int32   heapSize_,free_;
93 		};
94 
95 
96 
97 	}
98 }
99 
100 #endif
101