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