xref: /aoo41x/main/registry/source/reflread.cxx (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 // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_registry.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <memory>
32*cdf0e10cSrcweir #include <new>
33*cdf0e10cSrcweir 
34*cdf0e10cSrcweir #include <string.h>
35*cdf0e10cSrcweir #include <sal/types.h>
36*cdf0e10cSrcweir #include <osl/endian.h>
37*cdf0e10cSrcweir #include <registry/reflread.hxx>
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir #include "registry/reader.h"
40*cdf0e10cSrcweir #include "registry/version.h"
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir #include "reflcnst.hxx"
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir #include <cstddef>
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir static sal_Char NULL_STRING[1] = { 0 };
47*cdf0e10cSrcweir static sal_Unicode NULL_WSTRING[1] = { 0 };
48*cdf0e10cSrcweir 
49*cdf0e10cSrcweir const sal_uInt32    magic = 0x12345678;
50*cdf0e10cSrcweir const sal_uInt16 minorVersion = 0x0000;
51*cdf0e10cSrcweir const sal_uInt16 majorVersion = 0x0001;
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir #if defined ( GCC ) && ( defined ( SCO ) )
54*cdf0e10cSrcweir ORealDynamicLoader* ODynamicLoader<RegistryTypeReader_Api>::m_pLoader = NULL;
55*cdf0e10cSrcweir #endif
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir /**************************************************************************
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir     class BlopObject
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir     holds any data in a flat memory buffer
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir **************************************************************************/
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir class BlopObject
66*cdf0e10cSrcweir {
67*cdf0e10cSrcweir public:
68*cdf0e10cSrcweir     const sal_uInt8* m_pBuffer;
69*cdf0e10cSrcweir     sal_uInt32      m_bufferLen;
70*cdf0e10cSrcweir     sal_Bool        m_isCopied;
71*cdf0e10cSrcweir 
72*cdf0e10cSrcweir     BlopObject(const sal_uInt8* buffer, sal_uInt32 len, sal_Bool copyBuffer);
73*cdf0e10cSrcweir         // throws std::bad_alloc
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir     ~BlopObject();
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir     inline sal_uInt8 readBYTE(sal_uInt32 index) const
78*cdf0e10cSrcweir     {
79*cdf0e10cSrcweir         return m_pBuffer[index];
80*cdf0e10cSrcweir     }
81*cdf0e10cSrcweir 
82*cdf0e10cSrcweir     inline sal_Int16 readINT16(sal_uInt32 index) const
83*cdf0e10cSrcweir     {
84*cdf0e10cSrcweir         return ((m_pBuffer[index] << 8) | (m_pBuffer[index+1] << 0));
85*cdf0e10cSrcweir     }
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir     inline sal_uInt16 readUINT16(sal_uInt32 index) const
88*cdf0e10cSrcweir     {
89*cdf0e10cSrcweir         return ((m_pBuffer[index] << 8) | (m_pBuffer[index+1] << 0));
90*cdf0e10cSrcweir     }
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir     inline sal_Int32 readINT32(sal_uInt32 index) const
93*cdf0e10cSrcweir     {
94*cdf0e10cSrcweir         return (
95*cdf0e10cSrcweir             (m_pBuffer[index]   << 24) |
96*cdf0e10cSrcweir             (m_pBuffer[index+1] << 16) |
97*cdf0e10cSrcweir             (m_pBuffer[index+2] << 8)  |
98*cdf0e10cSrcweir             (m_pBuffer[index+3] << 0)
99*cdf0e10cSrcweir         );
100*cdf0e10cSrcweir     }
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir     inline sal_uInt32 readUINT32(sal_uInt32 index) const
103*cdf0e10cSrcweir     {
104*cdf0e10cSrcweir         return (
105*cdf0e10cSrcweir             (m_pBuffer[index]   << 24) |
106*cdf0e10cSrcweir             (m_pBuffer[index+1] << 16) |
107*cdf0e10cSrcweir             (m_pBuffer[index+2] << 8)  |
108*cdf0e10cSrcweir             (m_pBuffer[index+3] << 0)
109*cdf0e10cSrcweir         );
110*cdf0e10cSrcweir     }
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir     inline sal_Int64 readINT64(sal_uInt32 index) const
113*cdf0e10cSrcweir     {
114*cdf0e10cSrcweir 		return (
115*cdf0e10cSrcweir             ((sal_Int64)m_pBuffer[index]   << 56) |
116*cdf0e10cSrcweir             ((sal_Int64)m_pBuffer[index+1] << 48) |
117*cdf0e10cSrcweir             ((sal_Int64)m_pBuffer[index+2] << 40) |
118*cdf0e10cSrcweir             ((sal_Int64)m_pBuffer[index+3] << 32) |
119*cdf0e10cSrcweir             ((sal_Int64)m_pBuffer[index+4] << 24) |
120*cdf0e10cSrcweir             ((sal_Int64)m_pBuffer[index+5] << 16) |
121*cdf0e10cSrcweir             ((sal_Int64)m_pBuffer[index+6] << 8)  |
122*cdf0e10cSrcweir             ((sal_Int64)m_pBuffer[index+7] << 0)
123*cdf0e10cSrcweir         );
124*cdf0e10cSrcweir     }
125*cdf0e10cSrcweir 
126*cdf0e10cSrcweir     inline sal_uInt64 readUINT64(sal_uInt32 index) const
127*cdf0e10cSrcweir     {
128*cdf0e10cSrcweir         return (
129*cdf0e10cSrcweir             ((sal_uInt64)m_pBuffer[index]   << 56) |
130*cdf0e10cSrcweir             ((sal_uInt64)m_pBuffer[index+1] << 48) |
131*cdf0e10cSrcweir             ((sal_uInt64)m_pBuffer[index+2] << 40) |
132*cdf0e10cSrcweir             ((sal_uInt64)m_pBuffer[index+3] << 32) |
133*cdf0e10cSrcweir             ((sal_uInt64)m_pBuffer[index+4] << 24) |
134*cdf0e10cSrcweir             ((sal_uInt64)m_pBuffer[index+5] << 16) |
135*cdf0e10cSrcweir             ((sal_uInt64)m_pBuffer[index+6] << 8)  |
136*cdf0e10cSrcweir             ((sal_uInt64)m_pBuffer[index+7] << 0)
137*cdf0e10cSrcweir         );
138*cdf0e10cSrcweir     }
139*cdf0e10cSrcweir };
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir BlopObject::BlopObject(const sal_uInt8* buffer, sal_uInt32 len, sal_Bool copyBuffer)
142*cdf0e10cSrcweir     : m_bufferLen(len)
143*cdf0e10cSrcweir     , m_isCopied(copyBuffer)
144*cdf0e10cSrcweir {
145*cdf0e10cSrcweir     if (m_isCopied)
146*cdf0e10cSrcweir     {
147*cdf0e10cSrcweir         m_pBuffer = 0;
148*cdf0e10cSrcweir         sal_uInt8* newBuffer = new sal_uInt8[len];
149*cdf0e10cSrcweir         memcpy(newBuffer, buffer, len);
150*cdf0e10cSrcweir         m_pBuffer = newBuffer;
151*cdf0e10cSrcweir     }
152*cdf0e10cSrcweir     else
153*cdf0e10cSrcweir     {
154*cdf0e10cSrcweir         m_pBuffer = buffer;
155*cdf0e10cSrcweir     }
156*cdf0e10cSrcweir }
157*cdf0e10cSrcweir 
158*cdf0e10cSrcweir BlopObject::~BlopObject()
159*cdf0e10cSrcweir {
160*cdf0e10cSrcweir     if (m_isCopied)
161*cdf0e10cSrcweir     {
162*cdf0e10cSrcweir         delete[] const_cast<sal_uInt8*>(m_pBuffer);
163*cdf0e10cSrcweir     }
164*cdf0e10cSrcweir }
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir /**************************************************************************
167*cdf0e10cSrcweir 
168*cdf0e10cSrcweir     class StringCache
169*cdf0e10cSrcweir 
170*cdf0e10cSrcweir **************************************************************************/
171*cdf0e10cSrcweir 
172*cdf0e10cSrcweir class StringCache
173*cdf0e10cSrcweir {
174*cdf0e10cSrcweir public:
175*cdf0e10cSrcweir     sal_Unicode**   m_stringTable;
176*cdf0e10cSrcweir     sal_uInt16      m_numOfStrings;
177*cdf0e10cSrcweir     sal_uInt16      m_stringsCopied;
178*cdf0e10cSrcweir 
179*cdf0e10cSrcweir     StringCache(sal_uInt16 size); // throws std::bad_alloc
180*cdf0e10cSrcweir     ~StringCache();
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir     const sal_Unicode*  getString(sal_uInt16 index);
183*cdf0e10cSrcweir     sal_uInt16 createString(const sal_uInt8* buffer); // throws std::bad_alloc
184*cdf0e10cSrcweir };
185*cdf0e10cSrcweir 
186*cdf0e10cSrcweir StringCache::StringCache(sal_uInt16 size)
187*cdf0e10cSrcweir     : m_stringTable(NULL)
188*cdf0e10cSrcweir     , m_numOfStrings(size)
189*cdf0e10cSrcweir     , m_stringsCopied(0)
190*cdf0e10cSrcweir {
191*cdf0e10cSrcweir     m_stringTable = new sal_Unicode*[m_numOfStrings];
192*cdf0e10cSrcweir 
193*cdf0e10cSrcweir     for (sal_uInt16 i = 0; i < m_numOfStrings; i++)
194*cdf0e10cSrcweir     {
195*cdf0e10cSrcweir         m_stringTable[i] = NULL;
196*cdf0e10cSrcweir     }
197*cdf0e10cSrcweir }
198*cdf0e10cSrcweir 
199*cdf0e10cSrcweir StringCache::~StringCache()
200*cdf0e10cSrcweir {
201*cdf0e10cSrcweir     if (m_stringTable)
202*cdf0e10cSrcweir     {
203*cdf0e10cSrcweir         for (sal_uInt16 i = 0; i < m_stringsCopied; i++)
204*cdf0e10cSrcweir         {
205*cdf0e10cSrcweir             delete[] m_stringTable[i];
206*cdf0e10cSrcweir         }
207*cdf0e10cSrcweir 
208*cdf0e10cSrcweir         delete[] m_stringTable;
209*cdf0e10cSrcweir     }
210*cdf0e10cSrcweir }
211*cdf0e10cSrcweir 
212*cdf0e10cSrcweir const sal_Unicode* StringCache::getString(sal_uInt16 index)
213*cdf0e10cSrcweir {
214*cdf0e10cSrcweir     if ((index > 0) && (index <= m_stringsCopied))
215*cdf0e10cSrcweir         return m_stringTable[index - 1];
216*cdf0e10cSrcweir     else
217*cdf0e10cSrcweir         return NULL;
218*cdf0e10cSrcweir }
219*cdf0e10cSrcweir 
220*cdf0e10cSrcweir sal_uInt16 StringCache::createString(const sal_uInt8* buffer)
221*cdf0e10cSrcweir {
222*cdf0e10cSrcweir     if (m_stringsCopied < m_numOfStrings)
223*cdf0e10cSrcweir     {
224*cdf0e10cSrcweir         sal_uInt32 len = UINT16StringLen(buffer);
225*cdf0e10cSrcweir 
226*cdf0e10cSrcweir         m_stringTable[m_stringsCopied] = new sal_Unicode[len + 1];
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir         readString(buffer, m_stringTable[m_stringsCopied], (len + 1) * sizeof(sal_Unicode));
229*cdf0e10cSrcweir 
230*cdf0e10cSrcweir         return ++m_stringsCopied;
231*cdf0e10cSrcweir     }
232*cdf0e10cSrcweir     else
233*cdf0e10cSrcweir         return 0;
234*cdf0e10cSrcweir }
235*cdf0e10cSrcweir 
236*cdf0e10cSrcweir /**************************************************************************
237*cdf0e10cSrcweir 
238*cdf0e10cSrcweir     class ConstantPool
239*cdf0e10cSrcweir 
240*cdf0e10cSrcweir **************************************************************************/
241*cdf0e10cSrcweir 
242*cdf0e10cSrcweir class ConstantPool : public BlopObject
243*cdf0e10cSrcweir {
244*cdf0e10cSrcweir public:
245*cdf0e10cSrcweir 
246*cdf0e10cSrcweir     sal_uInt16  m_numOfEntries;
247*cdf0e10cSrcweir     sal_Int32*  m_pIndex;           // index values may be < 0 for cached string constants
248*cdf0e10cSrcweir 
249*cdf0e10cSrcweir     StringCache* m_pStringCache;
250*cdf0e10cSrcweir 
251*cdf0e10cSrcweir     ConstantPool(const sal_uInt8* buffer, sal_uInt16 numEntries)
252*cdf0e10cSrcweir         : BlopObject(buffer, 0, sal_False)
253*cdf0e10cSrcweir         , m_numOfEntries(numEntries)
254*cdf0e10cSrcweir         , m_pIndex(NULL)
255*cdf0e10cSrcweir         , m_pStringCache(NULL)
256*cdf0e10cSrcweir     {
257*cdf0e10cSrcweir     }
258*cdf0e10cSrcweir 
259*cdf0e10cSrcweir     ~ConstantPool();
260*cdf0e10cSrcweir 
261*cdf0e10cSrcweir     sal_uInt32 parseIndex(); // throws std::bad_alloc
262*cdf0e10cSrcweir 
263*cdf0e10cSrcweir     CPInfoTag       readTag(sal_uInt16 index);
264*cdf0e10cSrcweir 
265*cdf0e10cSrcweir     const sal_Char* 	readUTF8NameConstant(sal_uInt16 index);
266*cdf0e10cSrcweir     sal_Bool        	readBOOLConstant(sal_uInt16 index);
267*cdf0e10cSrcweir     sal_uInt8       	readBYTEConstant(sal_uInt16 index);
268*cdf0e10cSrcweir     sal_Int16       	readINT16Constant(sal_uInt16 index);
269*cdf0e10cSrcweir     sal_uInt16      	readUINT16Constant(sal_uInt16 index);
270*cdf0e10cSrcweir     sal_Int32       	readINT32Constant(sal_uInt16 index);
271*cdf0e10cSrcweir     sal_uInt32      	readUINT32Constant(sal_uInt16 index);
272*cdf0e10cSrcweir     sal_Int64       	readINT64Constant(sal_uInt16 index);
273*cdf0e10cSrcweir     sal_uInt64      	readUINT64Constant(sal_uInt16 index);
274*cdf0e10cSrcweir     float           	readFloatConstant(sal_uInt16 index);
275*cdf0e10cSrcweir     double          	readDoubleConstant(sal_uInt16 index);
276*cdf0e10cSrcweir     const sal_Unicode*  readStringConstant(sal_uInt16 index);
277*cdf0e10cSrcweir         // throws std::bad_alloc
278*cdf0e10cSrcweir     void            	readUIK(sal_uInt16 index, RTUik* uik);
279*cdf0e10cSrcweir };
280*cdf0e10cSrcweir 
281*cdf0e10cSrcweir ConstantPool::~ConstantPool()
282*cdf0e10cSrcweir {
283*cdf0e10cSrcweir     delete[] m_pIndex;
284*cdf0e10cSrcweir     delete m_pStringCache;
285*cdf0e10cSrcweir }
286*cdf0e10cSrcweir 
287*cdf0e10cSrcweir sal_uInt32 ConstantPool::parseIndex()
288*cdf0e10cSrcweir {
289*cdf0e10cSrcweir     if (m_pIndex)
290*cdf0e10cSrcweir     {
291*cdf0e10cSrcweir         delete[] m_pIndex;
292*cdf0e10cSrcweir         m_pIndex = NULL;
293*cdf0e10cSrcweir     }
294*cdf0e10cSrcweir 
295*cdf0e10cSrcweir     if (m_pStringCache)
296*cdf0e10cSrcweir     {
297*cdf0e10cSrcweir         delete m_pStringCache;
298*cdf0e10cSrcweir         m_pStringCache = NULL;
299*cdf0e10cSrcweir     }
300*cdf0e10cSrcweir 
301*cdf0e10cSrcweir     sal_uInt32  offset = 0;
302*cdf0e10cSrcweir     sal_uInt16  numOfStrings = 0;
303*cdf0e10cSrcweir 
304*cdf0e10cSrcweir     if (m_numOfEntries)
305*cdf0e10cSrcweir     {
306*cdf0e10cSrcweir         m_pIndex = new sal_Int32[m_numOfEntries];
307*cdf0e10cSrcweir 
308*cdf0e10cSrcweir         for (int i = 0; i < m_numOfEntries; i++)
309*cdf0e10cSrcweir         {
310*cdf0e10cSrcweir             m_pIndex[i] = offset;
311*cdf0e10cSrcweir 
312*cdf0e10cSrcweir             offset += readUINT32(offset);
313*cdf0e10cSrcweir 
314*cdf0e10cSrcweir             if ( ((CPInfoTag) readUINT16(m_pIndex[i] + CP_OFFSET_ENTRY_TAG)) ==
315*cdf0e10cSrcweir                  CP_TAG_CONST_STRING )
316*cdf0e10cSrcweir             {
317*cdf0e10cSrcweir                 numOfStrings++;
318*cdf0e10cSrcweir             }
319*cdf0e10cSrcweir 
320*cdf0e10cSrcweir         }
321*cdf0e10cSrcweir     }
322*cdf0e10cSrcweir 
323*cdf0e10cSrcweir     if (numOfStrings)
324*cdf0e10cSrcweir     {
325*cdf0e10cSrcweir         m_pStringCache = new StringCache(numOfStrings);
326*cdf0e10cSrcweir     }
327*cdf0e10cSrcweir 
328*cdf0e10cSrcweir     m_bufferLen = offset;
329*cdf0e10cSrcweir 
330*cdf0e10cSrcweir     return offset;
331*cdf0e10cSrcweir }
332*cdf0e10cSrcweir 
333*cdf0e10cSrcweir CPInfoTag ConstantPool::readTag(sal_uInt16 index)
334*cdf0e10cSrcweir {
335*cdf0e10cSrcweir     CPInfoTag tag = CP_TAG_INVALID;
336*cdf0e10cSrcweir 
337*cdf0e10cSrcweir     if (m_pIndex && (index > 0) && (index <= m_numOfEntries))
338*cdf0e10cSrcweir     {
339*cdf0e10cSrcweir         tag = (CPInfoTag) readUINT16(m_pIndex[index - 1] + CP_OFFSET_ENTRY_TAG);
340*cdf0e10cSrcweir     }
341*cdf0e10cSrcweir 
342*cdf0e10cSrcweir     return tag;
343*cdf0e10cSrcweir }
344*cdf0e10cSrcweir 
345*cdf0e10cSrcweir const sal_Char* ConstantPool::readUTF8NameConstant(sal_uInt16 index)
346*cdf0e10cSrcweir {
347*cdf0e10cSrcweir     const sal_Char* aName = NULL_STRING;
348*cdf0e10cSrcweir 
349*cdf0e10cSrcweir     if (m_pIndex && (index > 0) && (index <= m_numOfEntries))
350*cdf0e10cSrcweir     {
351*cdf0e10cSrcweir         if (readUINT16(m_pIndex[index - 1] + CP_OFFSET_ENTRY_TAG) == CP_TAG_UTF8_NAME)
352*cdf0e10cSrcweir         {
353*cdf0e10cSrcweir             aName = (const sal_Char*) (m_pBuffer + m_pIndex[index - 1] + CP_OFFSET_ENTRY_DATA);
354*cdf0e10cSrcweir         }
355*cdf0e10cSrcweir     }
356*cdf0e10cSrcweir 
357*cdf0e10cSrcweir     return aName;
358*cdf0e10cSrcweir }
359*cdf0e10cSrcweir 
360*cdf0e10cSrcweir sal_Bool ConstantPool::readBOOLConstant(sal_uInt16 index)
361*cdf0e10cSrcweir {
362*cdf0e10cSrcweir     sal_Bool aBool = sal_False;
363*cdf0e10cSrcweir 
364*cdf0e10cSrcweir     if (m_pIndex && (index> 0) && (index <= m_numOfEntries))
365*cdf0e10cSrcweir     {
366*cdf0e10cSrcweir         if (readUINT16(m_pIndex[index - 1] + CP_OFFSET_ENTRY_TAG) == CP_TAG_CONST_BOOL)
367*cdf0e10cSrcweir         {
368*cdf0e10cSrcweir             aBool = (sal_Bool) readBYTE(m_pIndex[index - 1] + CP_OFFSET_ENTRY_DATA);
369*cdf0e10cSrcweir         }
370*cdf0e10cSrcweir     }
371*cdf0e10cSrcweir 
372*cdf0e10cSrcweir     return aBool;
373*cdf0e10cSrcweir }
374*cdf0e10cSrcweir 
375*cdf0e10cSrcweir sal_uInt8 ConstantPool::readBYTEConstant(sal_uInt16 index)
376*cdf0e10cSrcweir {
377*cdf0e10cSrcweir     sal_uInt8 aByte = sal_False;
378*cdf0e10cSrcweir 
379*cdf0e10cSrcweir     if (m_pIndex && (index> 0) && (index <= m_numOfEntries))
380*cdf0e10cSrcweir     {
381*cdf0e10cSrcweir         if (readUINT16(m_pIndex[index - 1] + CP_OFFSET_ENTRY_TAG) == CP_TAG_CONST_BYTE)
382*cdf0e10cSrcweir         {
383*cdf0e10cSrcweir             aByte = readBYTE(m_pIndex[index - 1] + CP_OFFSET_ENTRY_DATA);
384*cdf0e10cSrcweir         }
385*cdf0e10cSrcweir     }
386*cdf0e10cSrcweir 
387*cdf0e10cSrcweir     return aByte;
388*cdf0e10cSrcweir }
389*cdf0e10cSrcweir 
390*cdf0e10cSrcweir sal_Int16 ConstantPool::readINT16Constant(sal_uInt16 index)
391*cdf0e10cSrcweir {
392*cdf0e10cSrcweir     sal_Int16 aINT16 = sal_False;
393*cdf0e10cSrcweir 
394*cdf0e10cSrcweir     if (m_pIndex && (index> 0) && (index <= m_numOfEntries))
395*cdf0e10cSrcweir     {
396*cdf0e10cSrcweir         if (readUINT16(m_pIndex[index - 1] + CP_OFFSET_ENTRY_TAG) == CP_TAG_CONST_INT16)
397*cdf0e10cSrcweir         {
398*cdf0e10cSrcweir             aINT16 = readINT16(m_pIndex[index - 1] + CP_OFFSET_ENTRY_DATA);
399*cdf0e10cSrcweir         }
400*cdf0e10cSrcweir     }
401*cdf0e10cSrcweir 
402*cdf0e10cSrcweir     return aINT16;
403*cdf0e10cSrcweir }
404*cdf0e10cSrcweir 
405*cdf0e10cSrcweir sal_uInt16 ConstantPool::readUINT16Constant(sal_uInt16 index)
406*cdf0e10cSrcweir {
407*cdf0e10cSrcweir     sal_uInt16 asal_uInt16 = sal_False;
408*cdf0e10cSrcweir 
409*cdf0e10cSrcweir     if (m_pIndex && (index> 0) && (index <= m_numOfEntries))
410*cdf0e10cSrcweir     {
411*cdf0e10cSrcweir         if (readUINT16(m_pIndex[index - 1] + CP_OFFSET_ENTRY_TAG) == CP_TAG_CONST_UINT16)
412*cdf0e10cSrcweir         {
413*cdf0e10cSrcweir             asal_uInt16 = readUINT16(m_pIndex[index - 1] + CP_OFFSET_ENTRY_DATA);
414*cdf0e10cSrcweir         }
415*cdf0e10cSrcweir     }
416*cdf0e10cSrcweir 
417*cdf0e10cSrcweir     return asal_uInt16;
418*cdf0e10cSrcweir }
419*cdf0e10cSrcweir 
420*cdf0e10cSrcweir sal_Int32 ConstantPool::readINT32Constant(sal_uInt16 index)
421*cdf0e10cSrcweir {
422*cdf0e10cSrcweir     sal_Int32 aINT32 = sal_False;
423*cdf0e10cSrcweir 
424*cdf0e10cSrcweir     if (m_pIndex && (index> 0) && (index <= m_numOfEntries))
425*cdf0e10cSrcweir     {
426*cdf0e10cSrcweir         if (readUINT16(m_pIndex[index - 1] + CP_OFFSET_ENTRY_TAG) == CP_TAG_CONST_INT32)
427*cdf0e10cSrcweir         {
428*cdf0e10cSrcweir             aINT32 = readINT32(m_pIndex[index - 1] + CP_OFFSET_ENTRY_DATA);
429*cdf0e10cSrcweir         }
430*cdf0e10cSrcweir     }
431*cdf0e10cSrcweir 
432*cdf0e10cSrcweir     return aINT32;
433*cdf0e10cSrcweir }
434*cdf0e10cSrcweir 
435*cdf0e10cSrcweir sal_uInt32 ConstantPool::readUINT32Constant(sal_uInt16 index)
436*cdf0e10cSrcweir {
437*cdf0e10cSrcweir     sal_uInt32 aUINT32 = sal_False;
438*cdf0e10cSrcweir 
439*cdf0e10cSrcweir     if (m_pIndex && (index> 0) && (index <= m_numOfEntries))
440*cdf0e10cSrcweir     {
441*cdf0e10cSrcweir         if (readUINT16(m_pIndex[index - 1] + CP_OFFSET_ENTRY_TAG) == CP_TAG_CONST_UINT32)
442*cdf0e10cSrcweir         {
443*cdf0e10cSrcweir             aUINT32 = readUINT32(m_pIndex[index - 1] + CP_OFFSET_ENTRY_DATA);
444*cdf0e10cSrcweir         }
445*cdf0e10cSrcweir     }
446*cdf0e10cSrcweir 
447*cdf0e10cSrcweir     return aUINT32;
448*cdf0e10cSrcweir }
449*cdf0e10cSrcweir 
450*cdf0e10cSrcweir sal_Int64 ConstantPool::readINT64Constant(sal_uInt16 index)
451*cdf0e10cSrcweir {
452*cdf0e10cSrcweir     sal_Int64 aINT64 = sal_False;
453*cdf0e10cSrcweir 
454*cdf0e10cSrcweir     if (m_pIndex && (index> 0) && (index <= m_numOfEntries))
455*cdf0e10cSrcweir     {
456*cdf0e10cSrcweir         if (readUINT16(m_pIndex[index - 1] + CP_OFFSET_ENTRY_TAG) == CP_TAG_CONST_INT64)
457*cdf0e10cSrcweir         {
458*cdf0e10cSrcweir             aINT64 = readINT64(m_pIndex[index - 1] + CP_OFFSET_ENTRY_DATA);
459*cdf0e10cSrcweir         }
460*cdf0e10cSrcweir     }
461*cdf0e10cSrcweir 
462*cdf0e10cSrcweir     return aINT64;
463*cdf0e10cSrcweir }
464*cdf0e10cSrcweir 
465*cdf0e10cSrcweir sal_uInt64 ConstantPool::readUINT64Constant(sal_uInt16 index)
466*cdf0e10cSrcweir {
467*cdf0e10cSrcweir     sal_uInt64 aUINT64 = sal_False;
468*cdf0e10cSrcweir 
469*cdf0e10cSrcweir     if (m_pIndex && (index> 0) && (index <= m_numOfEntries))
470*cdf0e10cSrcweir     {
471*cdf0e10cSrcweir         if (readUINT16(m_pIndex[index - 1] + CP_OFFSET_ENTRY_TAG) == CP_TAG_CONST_UINT64)
472*cdf0e10cSrcweir         {
473*cdf0e10cSrcweir             aUINT64 = readUINT64(m_pIndex[index - 1] + CP_OFFSET_ENTRY_DATA);
474*cdf0e10cSrcweir         }
475*cdf0e10cSrcweir     }
476*cdf0e10cSrcweir 
477*cdf0e10cSrcweir     return aUINT64;
478*cdf0e10cSrcweir }
479*cdf0e10cSrcweir 
480*cdf0e10cSrcweir float ConstantPool::readFloatConstant(sal_uInt16 index)
481*cdf0e10cSrcweir {
482*cdf0e10cSrcweir     union
483*cdf0e10cSrcweir     {
484*cdf0e10cSrcweir         float   v;
485*cdf0e10cSrcweir         sal_uInt32  b;
486*cdf0e10cSrcweir     } x = { 0.0f };
487*cdf0e10cSrcweir 
488*cdf0e10cSrcweir     if (m_pIndex && (index> 0) && (index <= m_numOfEntries))
489*cdf0e10cSrcweir     {
490*cdf0e10cSrcweir         if (readUINT16(m_pIndex[index - 1] + CP_OFFSET_ENTRY_TAG) == CP_TAG_CONST_FLOAT)
491*cdf0e10cSrcweir         {
492*cdf0e10cSrcweir #ifdef REGTYPE_IEEE_NATIVE
493*cdf0e10cSrcweir             x.b = readUINT32(m_pIndex[index - 1] + CP_OFFSET_ENTRY_DATA);
494*cdf0e10cSrcweir #else
495*cdf0e10cSrcweir #   error no IEEE
496*cdf0e10cSrcweir #endif
497*cdf0e10cSrcweir         }
498*cdf0e10cSrcweir     }
499*cdf0e10cSrcweir 
500*cdf0e10cSrcweir     return  x.v;
501*cdf0e10cSrcweir }
502*cdf0e10cSrcweir 
503*cdf0e10cSrcweir double ConstantPool::readDoubleConstant(sal_uInt16 index)
504*cdf0e10cSrcweir {
505*cdf0e10cSrcweir     union
506*cdf0e10cSrcweir     {
507*cdf0e10cSrcweir         double v;
508*cdf0e10cSrcweir         struct
509*cdf0e10cSrcweir         {
510*cdf0e10cSrcweir             sal_uInt32  b1;
511*cdf0e10cSrcweir             sal_uInt32  b2;
512*cdf0e10cSrcweir         } b;
513*cdf0e10cSrcweir     } x = { 0.0 };
514*cdf0e10cSrcweir 
515*cdf0e10cSrcweir     if (m_pIndex && (index> 0) && (index <= m_numOfEntries))
516*cdf0e10cSrcweir     {
517*cdf0e10cSrcweir         if (readUINT16(m_pIndex[index - 1] + CP_OFFSET_ENTRY_TAG) == CP_TAG_CONST_DOUBLE)
518*cdf0e10cSrcweir         {
519*cdf0e10cSrcweir 
520*cdf0e10cSrcweir #ifdef REGTYPE_IEEE_NATIVE
521*cdf0e10cSrcweir #   ifdef OSL_BIGENDIAN
522*cdf0e10cSrcweir             x.b.b1 = readUINT32(m_pIndex[index - 1] + CP_OFFSET_ENTRY_DATA);
523*cdf0e10cSrcweir             x.b.b2 = readUINT32(m_pIndex[index - 1] + CP_OFFSET_ENTRY_DATA + sizeof(sal_uInt32));
524*cdf0e10cSrcweir #   else
525*cdf0e10cSrcweir             x.b.b1 = readUINT32(m_pIndex[index - 1] + CP_OFFSET_ENTRY_DATA + sizeof(sal_uInt32));
526*cdf0e10cSrcweir             x.b.b2 = readUINT32(m_pIndex[index - 1] + CP_OFFSET_ENTRY_DATA);
527*cdf0e10cSrcweir #   endif
528*cdf0e10cSrcweir #else
529*cdf0e10cSrcweir #   error no IEEE
530*cdf0e10cSrcweir #endif
531*cdf0e10cSrcweir         }
532*cdf0e10cSrcweir     }
533*cdf0e10cSrcweir 
534*cdf0e10cSrcweir     return x.v;
535*cdf0e10cSrcweir }
536*cdf0e10cSrcweir 
537*cdf0e10cSrcweir const sal_Unicode* ConstantPool::readStringConstant(sal_uInt16 index)
538*cdf0e10cSrcweir {
539*cdf0e10cSrcweir     const sal_Unicode* aString = NULL_WSTRING;
540*cdf0e10cSrcweir 
541*cdf0e10cSrcweir     if (m_pIndex && (index> 0) && (index <= m_numOfEntries) && m_pStringCache)
542*cdf0e10cSrcweir     {
543*cdf0e10cSrcweir         if (m_pIndex[index - 1] >= 0)
544*cdf0e10cSrcweir         {
545*cdf0e10cSrcweir             // create cached string now
546*cdf0e10cSrcweir 
547*cdf0e10cSrcweir             if (readUINT16(m_pIndex[index - 1] + CP_OFFSET_ENTRY_TAG) == CP_TAG_CONST_STRING)
548*cdf0e10cSrcweir             {
549*cdf0e10cSrcweir                 m_pIndex[index - 1] = -1 * m_pStringCache->createString(m_pBuffer + m_pIndex[index - 1] + CP_OFFSET_ENTRY_DATA);
550*cdf0e10cSrcweir             }
551*cdf0e10cSrcweir         }
552*cdf0e10cSrcweir 
553*cdf0e10cSrcweir         aString = m_pStringCache->getString((sal_uInt16) (m_pIndex[index - 1] * -1));
554*cdf0e10cSrcweir     }
555*cdf0e10cSrcweir 
556*cdf0e10cSrcweir     return aString;
557*cdf0e10cSrcweir }
558*cdf0e10cSrcweir 
559*cdf0e10cSrcweir void ConstantPool::readUIK(sal_uInt16 index, RTUik* uik)
560*cdf0e10cSrcweir {
561*cdf0e10cSrcweir     if (index == 0)
562*cdf0e10cSrcweir     {
563*cdf0e10cSrcweir         uik->m_Data1 = 0;
564*cdf0e10cSrcweir         uik->m_Data2 = 0;
565*cdf0e10cSrcweir         uik->m_Data3 = 0;
566*cdf0e10cSrcweir         uik->m_Data4 = 0;
567*cdf0e10cSrcweir         uik->m_Data5 = 0;
568*cdf0e10cSrcweir     }
569*cdf0e10cSrcweir     else if (m_pIndex && (index <= m_numOfEntries))
570*cdf0e10cSrcweir     {
571*cdf0e10cSrcweir         if (readUINT16(m_pIndex[index - 1] + CP_OFFSET_ENTRY_TAG) == CP_TAG_UIK)
572*cdf0e10cSrcweir         {
573*cdf0e10cSrcweir             uik->m_Data1 = readUINT32(m_pIndex[index - 1] + CP_OFFSET_ENTRY_UIK1);
574*cdf0e10cSrcweir             uik->m_Data2 = readUINT16(m_pIndex[index - 1] + CP_OFFSET_ENTRY_UIK2);
575*cdf0e10cSrcweir             uik->m_Data3 = readUINT16(m_pIndex[index - 1] + CP_OFFSET_ENTRY_UIK3);
576*cdf0e10cSrcweir             uik->m_Data4 = readUINT32(m_pIndex[index - 1] + CP_OFFSET_ENTRY_UIK4);
577*cdf0e10cSrcweir             uik->m_Data5 = readUINT32(m_pIndex[index - 1] + CP_OFFSET_ENTRY_UIK5);
578*cdf0e10cSrcweir         }
579*cdf0e10cSrcweir     }
580*cdf0e10cSrcweir }
581*cdf0e10cSrcweir 
582*cdf0e10cSrcweir /**************************************************************************
583*cdf0e10cSrcweir 
584*cdf0e10cSrcweir     class FieldList
585*cdf0e10cSrcweir 
586*cdf0e10cSrcweir **************************************************************************/
587*cdf0e10cSrcweir 
588*cdf0e10cSrcweir class FieldList : public BlopObject
589*cdf0e10cSrcweir {
590*cdf0e10cSrcweir public:
591*cdf0e10cSrcweir 
592*cdf0e10cSrcweir     sal_uInt16      m_numOfEntries;
593*cdf0e10cSrcweir     sal_uInt16      m_numOfFieldEntries;
594*cdf0e10cSrcweir     sal_uInt16      m_FIELD_ENTRY_SIZE;
595*cdf0e10cSrcweir     ConstantPool*   m_pCP;
596*cdf0e10cSrcweir 
597*cdf0e10cSrcweir     FieldList(const sal_uInt8* buffer, sal_uInt16 numEntries, ConstantPool* pCP)
598*cdf0e10cSrcweir         : BlopObject(buffer, 0, sal_False)
599*cdf0e10cSrcweir         , m_numOfEntries(numEntries)
600*cdf0e10cSrcweir         , m_pCP(pCP)
601*cdf0e10cSrcweir     {
602*cdf0e10cSrcweir 		if ( m_numOfEntries > 0 )
603*cdf0e10cSrcweir 		{
604*cdf0e10cSrcweir 			m_numOfFieldEntries = readUINT16(0);
605*cdf0e10cSrcweir 			m_FIELD_ENTRY_SIZE = m_numOfFieldEntries * sizeof(sal_uInt16);
606*cdf0e10cSrcweir 		} else
607*cdf0e10cSrcweir 		{
608*cdf0e10cSrcweir 			m_numOfFieldEntries = 0;
609*cdf0e10cSrcweir 			m_FIELD_ENTRY_SIZE = 0;
610*cdf0e10cSrcweir 		}
611*cdf0e10cSrcweir     }
612*cdf0e10cSrcweir 
613*cdf0e10cSrcweir     sal_uInt32 parseIndex();
614*cdf0e10cSrcweir 
615*cdf0e10cSrcweir     const sal_Char* getFieldName(sal_uInt16 index);
616*cdf0e10cSrcweir     const sal_Char* getFieldType(sal_uInt16 index);
617*cdf0e10cSrcweir     RTFieldAccess getFieldAccess(sal_uInt16 index);
618*cdf0e10cSrcweir     RTValueType     getFieldConstValue(sal_uInt16 index, RTConstValueUnion* value);
619*cdf0e10cSrcweir         // throws std::bad_alloc
620*cdf0e10cSrcweir     const sal_Char* getFieldDoku(sal_uInt16 index);
621*cdf0e10cSrcweir     const sal_Char* getFieldFileName(sal_uInt16 index);
622*cdf0e10cSrcweir };
623*cdf0e10cSrcweir 
624*cdf0e10cSrcweir sal_uInt32 FieldList::parseIndex()
625*cdf0e10cSrcweir {
626*cdf0e10cSrcweir     return ((m_numOfEntries ? sizeof(sal_uInt16) : 0) + (m_numOfEntries * m_FIELD_ENTRY_SIZE));
627*cdf0e10cSrcweir }
628*cdf0e10cSrcweir 
629*cdf0e10cSrcweir const sal_Char* FieldList::getFieldName(sal_uInt16 index)
630*cdf0e10cSrcweir {
631*cdf0e10cSrcweir     const sal_Char* aName = NULL;
632*cdf0e10cSrcweir 
633*cdf0e10cSrcweir     if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
634*cdf0e10cSrcweir     {
635*cdf0e10cSrcweir         aName = m_pCP->readUTF8NameConstant(readUINT16(sizeof(sal_uInt16) + (index * m_FIELD_ENTRY_SIZE) + FIELD_OFFSET_NAME));
636*cdf0e10cSrcweir     }
637*cdf0e10cSrcweir 
638*cdf0e10cSrcweir     return aName;
639*cdf0e10cSrcweir }
640*cdf0e10cSrcweir 
641*cdf0e10cSrcweir const sal_Char* FieldList::getFieldType(sal_uInt16 index)
642*cdf0e10cSrcweir {
643*cdf0e10cSrcweir     const sal_Char* aName = NULL;
644*cdf0e10cSrcweir 
645*cdf0e10cSrcweir     if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
646*cdf0e10cSrcweir     {
647*cdf0e10cSrcweir         aName = m_pCP->readUTF8NameConstant(readUINT16(sizeof(sal_uInt16) + (index * m_FIELD_ENTRY_SIZE) + FIELD_OFFSET_TYPE));
648*cdf0e10cSrcweir     }
649*cdf0e10cSrcweir 
650*cdf0e10cSrcweir     return aName;
651*cdf0e10cSrcweir }
652*cdf0e10cSrcweir 
653*cdf0e10cSrcweir RTFieldAccess FieldList::getFieldAccess(sal_uInt16 index)
654*cdf0e10cSrcweir {
655*cdf0e10cSrcweir     RTFieldAccess aAccess = RT_ACCESS_INVALID;
656*cdf0e10cSrcweir 
657*cdf0e10cSrcweir     if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
658*cdf0e10cSrcweir     {
659*cdf0e10cSrcweir         aAccess = (RTFieldAccess) readUINT16(sizeof(sal_uInt16) + (index * m_FIELD_ENTRY_SIZE) + FIELD_OFFSET_ACCESS);
660*cdf0e10cSrcweir     }
661*cdf0e10cSrcweir 
662*cdf0e10cSrcweir     return aAccess;
663*cdf0e10cSrcweir }
664*cdf0e10cSrcweir 
665*cdf0e10cSrcweir RTValueType FieldList::getFieldConstValue(sal_uInt16 index, RTConstValueUnion* value)
666*cdf0e10cSrcweir {
667*cdf0e10cSrcweir     RTValueType ret = RT_TYPE_NONE;
668*cdf0e10cSrcweir 
669*cdf0e10cSrcweir     if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
670*cdf0e10cSrcweir     {
671*cdf0e10cSrcweir         sal_uInt16 cpIndex = readUINT16(sizeof(sal_uInt16) + (index * m_FIELD_ENTRY_SIZE) + FIELD_OFFSET_VALUE);
672*cdf0e10cSrcweir 
673*cdf0e10cSrcweir         switch (m_pCP->readTag(cpIndex))
674*cdf0e10cSrcweir         {
675*cdf0e10cSrcweir             case CP_TAG_CONST_BOOL:
676*cdf0e10cSrcweir                 value->aBool = m_pCP->readBOOLConstant(cpIndex);
677*cdf0e10cSrcweir                 ret = RT_TYPE_BOOL;
678*cdf0e10cSrcweir                 break;
679*cdf0e10cSrcweir             case CP_TAG_CONST_BYTE:
680*cdf0e10cSrcweir                 value->aByte = m_pCP->readBYTEConstant(cpIndex);
681*cdf0e10cSrcweir                 ret = RT_TYPE_BYTE;
682*cdf0e10cSrcweir                 break;
683*cdf0e10cSrcweir             case CP_TAG_CONST_INT16:
684*cdf0e10cSrcweir                 value->aShort = m_pCP->readINT16Constant(cpIndex);
685*cdf0e10cSrcweir                 ret = RT_TYPE_INT16;
686*cdf0e10cSrcweir                 break;
687*cdf0e10cSrcweir             case CP_TAG_CONST_UINT16:
688*cdf0e10cSrcweir                 value->aUShort = m_pCP->readUINT16Constant(cpIndex);
689*cdf0e10cSrcweir                 ret = RT_TYPE_UINT16;
690*cdf0e10cSrcweir                 break;
691*cdf0e10cSrcweir             case CP_TAG_CONST_INT32:
692*cdf0e10cSrcweir                 value->aLong = m_pCP->readINT32Constant(cpIndex);
693*cdf0e10cSrcweir                 ret = RT_TYPE_INT32;
694*cdf0e10cSrcweir                 break;
695*cdf0e10cSrcweir             case CP_TAG_CONST_UINT32:
696*cdf0e10cSrcweir                 value->aULong = m_pCP->readUINT32Constant(cpIndex);
697*cdf0e10cSrcweir                 ret = RT_TYPE_UINT32;
698*cdf0e10cSrcweir                 break;
699*cdf0e10cSrcweir             case CP_TAG_CONST_INT64:
700*cdf0e10cSrcweir               value->aHyper = m_pCP->readINT64Constant(cpIndex);
701*cdf0e10cSrcweir                 ret = RT_TYPE_INT64;
702*cdf0e10cSrcweir                 break;
703*cdf0e10cSrcweir             case CP_TAG_CONST_UINT64:
704*cdf0e10cSrcweir               value->aUHyper = m_pCP->readUINT64Constant(cpIndex);
705*cdf0e10cSrcweir                 ret = RT_TYPE_UINT64;
706*cdf0e10cSrcweir                 break;
707*cdf0e10cSrcweir             case CP_TAG_CONST_FLOAT:
708*cdf0e10cSrcweir                 value->aFloat = m_pCP->readFloatConstant(cpIndex);
709*cdf0e10cSrcweir                 ret = RT_TYPE_FLOAT;
710*cdf0e10cSrcweir                 break;
711*cdf0e10cSrcweir             case CP_TAG_CONST_DOUBLE:
712*cdf0e10cSrcweir                 value->aDouble = m_pCP->readDoubleConstant(cpIndex);
713*cdf0e10cSrcweir                 ret = RT_TYPE_DOUBLE;
714*cdf0e10cSrcweir                 break;
715*cdf0e10cSrcweir             case CP_TAG_CONST_STRING:
716*cdf0e10cSrcweir                 value->aString = m_pCP->readStringConstant(cpIndex);
717*cdf0e10cSrcweir                 ret = RT_TYPE_STRING;
718*cdf0e10cSrcweir                 break;
719*cdf0e10cSrcweir             default:
720*cdf0e10cSrcweir                 break;
721*cdf0e10cSrcweir         }
722*cdf0e10cSrcweir     }
723*cdf0e10cSrcweir 
724*cdf0e10cSrcweir     return ret;
725*cdf0e10cSrcweir }
726*cdf0e10cSrcweir 
727*cdf0e10cSrcweir const sal_Char* FieldList::getFieldDoku(sal_uInt16 index)
728*cdf0e10cSrcweir {
729*cdf0e10cSrcweir     const sal_Char* aDoku = NULL;
730*cdf0e10cSrcweir 
731*cdf0e10cSrcweir     if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
732*cdf0e10cSrcweir     {
733*cdf0e10cSrcweir         aDoku = m_pCP->readUTF8NameConstant(readUINT16(sizeof(sal_uInt16) + (index * m_FIELD_ENTRY_SIZE) + FIELD_OFFSET_DOKU));
734*cdf0e10cSrcweir     }
735*cdf0e10cSrcweir 
736*cdf0e10cSrcweir     return aDoku;
737*cdf0e10cSrcweir }
738*cdf0e10cSrcweir 
739*cdf0e10cSrcweir const sal_Char* FieldList::getFieldFileName(sal_uInt16 index)
740*cdf0e10cSrcweir {
741*cdf0e10cSrcweir     const sal_Char* aFileName = NULL;
742*cdf0e10cSrcweir 
743*cdf0e10cSrcweir     if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
744*cdf0e10cSrcweir     {
745*cdf0e10cSrcweir         aFileName = m_pCP->readUTF8NameConstant(readUINT16(sizeof(sal_uInt16) + (index * m_FIELD_ENTRY_SIZE) + FIELD_OFFSET_FILENAME));
746*cdf0e10cSrcweir     }
747*cdf0e10cSrcweir 
748*cdf0e10cSrcweir     return aFileName;
749*cdf0e10cSrcweir }
750*cdf0e10cSrcweir 
751*cdf0e10cSrcweir /**************************************************************************
752*cdf0e10cSrcweir 
753*cdf0e10cSrcweir     class ReferenceList
754*cdf0e10cSrcweir 
755*cdf0e10cSrcweir **************************************************************************/
756*cdf0e10cSrcweir 
757*cdf0e10cSrcweir class ReferenceList : public BlopObject
758*cdf0e10cSrcweir {
759*cdf0e10cSrcweir public:
760*cdf0e10cSrcweir 
761*cdf0e10cSrcweir     sal_uInt16		m_numOfEntries;
762*cdf0e10cSrcweir     sal_uInt16		m_numOfReferenceEntries;
763*cdf0e10cSrcweir     sal_uInt16		m_REFERENCE_ENTRY_SIZE;
764*cdf0e10cSrcweir     ConstantPool*	m_pCP;
765*cdf0e10cSrcweir 
766*cdf0e10cSrcweir     ReferenceList(const sal_uInt8* buffer, sal_uInt16 numEntries, ConstantPool* pCP)
767*cdf0e10cSrcweir         : BlopObject(buffer, 0, sal_False)
768*cdf0e10cSrcweir         , m_numOfEntries(numEntries)
769*cdf0e10cSrcweir         , m_pCP(pCP)
770*cdf0e10cSrcweir     {
771*cdf0e10cSrcweir         if ( m_numOfEntries > 0 )
772*cdf0e10cSrcweir 		{
773*cdf0e10cSrcweir 			m_numOfReferenceEntries = readUINT16(0);
774*cdf0e10cSrcweir 			m_REFERENCE_ENTRY_SIZE = m_numOfReferenceEntries * sizeof(sal_uInt16);
775*cdf0e10cSrcweir 		} else
776*cdf0e10cSrcweir 		{
777*cdf0e10cSrcweir 			m_numOfReferenceEntries = 0;
778*cdf0e10cSrcweir 			m_REFERENCE_ENTRY_SIZE = 0;
779*cdf0e10cSrcweir 		}
780*cdf0e10cSrcweir     }
781*cdf0e10cSrcweir 
782*cdf0e10cSrcweir     sal_uInt32 parseIndex();
783*cdf0e10cSrcweir 
784*cdf0e10cSrcweir     const sal_Char* getReferenceName(sal_uInt16 index);
785*cdf0e10cSrcweir     RTReferenceType getReferenceType(sal_uInt16 index);
786*cdf0e10cSrcweir     const sal_Char* getReferenceDoku(sal_uInt16 index);
787*cdf0e10cSrcweir 	RTFieldAccess 	getReferenceAccess(sal_uInt16 index);
788*cdf0e10cSrcweir };
789*cdf0e10cSrcweir 
790*cdf0e10cSrcweir sal_uInt32 ReferenceList::parseIndex()
791*cdf0e10cSrcweir {
792*cdf0e10cSrcweir     return ((m_numOfEntries ? sizeof(sal_uInt16) : 0) + (m_numOfEntries * m_REFERENCE_ENTRY_SIZE));
793*cdf0e10cSrcweir }
794*cdf0e10cSrcweir 
795*cdf0e10cSrcweir const sal_Char* ReferenceList::getReferenceName(sal_uInt16 index)
796*cdf0e10cSrcweir {
797*cdf0e10cSrcweir     const sal_Char* aName = NULL;
798*cdf0e10cSrcweir 
799*cdf0e10cSrcweir     if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
800*cdf0e10cSrcweir     {
801*cdf0e10cSrcweir         aName = m_pCP->readUTF8NameConstant(readUINT16(sizeof(sal_uInt16) + (index * m_REFERENCE_ENTRY_SIZE) + REFERENCE_OFFSET_NAME));
802*cdf0e10cSrcweir     }
803*cdf0e10cSrcweir 
804*cdf0e10cSrcweir     return aName;
805*cdf0e10cSrcweir }
806*cdf0e10cSrcweir 
807*cdf0e10cSrcweir RTReferenceType ReferenceList::getReferenceType(sal_uInt16 index)
808*cdf0e10cSrcweir {
809*cdf0e10cSrcweir     RTReferenceType refType = RT_REF_INVALID;
810*cdf0e10cSrcweir 
811*cdf0e10cSrcweir     if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
812*cdf0e10cSrcweir     {
813*cdf0e10cSrcweir         refType = (RTReferenceType) readUINT16(sizeof(sal_uInt16) + (index * m_REFERENCE_ENTRY_SIZE) + REFERENCE_OFFSET_TYPE);
814*cdf0e10cSrcweir     }
815*cdf0e10cSrcweir 
816*cdf0e10cSrcweir     return refType;
817*cdf0e10cSrcweir }
818*cdf0e10cSrcweir 
819*cdf0e10cSrcweir const sal_Char* ReferenceList::getReferenceDoku(sal_uInt16 index)
820*cdf0e10cSrcweir {
821*cdf0e10cSrcweir     const sal_Char* aDoku = NULL;
822*cdf0e10cSrcweir 
823*cdf0e10cSrcweir     if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
824*cdf0e10cSrcweir     {
825*cdf0e10cSrcweir         aDoku = m_pCP->readUTF8NameConstant(readUINT16(sizeof(sal_uInt16) + (index * m_REFERENCE_ENTRY_SIZE) + REFERENCE_OFFSET_DOKU));
826*cdf0e10cSrcweir     }
827*cdf0e10cSrcweir 
828*cdf0e10cSrcweir     return aDoku;
829*cdf0e10cSrcweir }
830*cdf0e10cSrcweir 
831*cdf0e10cSrcweir RTFieldAccess ReferenceList::getReferenceAccess(sal_uInt16 index)
832*cdf0e10cSrcweir {
833*cdf0e10cSrcweir     RTFieldAccess aAccess = RT_ACCESS_INVALID;
834*cdf0e10cSrcweir 
835*cdf0e10cSrcweir     if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
836*cdf0e10cSrcweir     {
837*cdf0e10cSrcweir         aAccess = (RTFieldAccess) readUINT16(sizeof(sal_uInt16) + (index * m_REFERENCE_ENTRY_SIZE) + REFERENCE_OFFSET_ACCESS);
838*cdf0e10cSrcweir     }
839*cdf0e10cSrcweir 
840*cdf0e10cSrcweir     return aAccess;
841*cdf0e10cSrcweir }
842*cdf0e10cSrcweir 
843*cdf0e10cSrcweir /**************************************************************************
844*cdf0e10cSrcweir 
845*cdf0e10cSrcweir     class MethodList
846*cdf0e10cSrcweir 
847*cdf0e10cSrcweir **************************************************************************/
848*cdf0e10cSrcweir 
849*cdf0e10cSrcweir class MethodList : public BlopObject
850*cdf0e10cSrcweir {
851*cdf0e10cSrcweir public:
852*cdf0e10cSrcweir 
853*cdf0e10cSrcweir     sal_uInt16		m_numOfEntries;
854*cdf0e10cSrcweir     sal_uInt16		m_numOfMethodEntries;
855*cdf0e10cSrcweir     sal_uInt16		m_numOfParamEntries;
856*cdf0e10cSrcweir     sal_uInt16		m_PARAM_ENTRY_SIZE;
857*cdf0e10cSrcweir     sal_uInt32*		m_pIndex;
858*cdf0e10cSrcweir     ConstantPool*	m_pCP;
859*cdf0e10cSrcweir 
860*cdf0e10cSrcweir     MethodList(const sal_uInt8* buffer, sal_uInt16 numEntries, ConstantPool* pCP)
861*cdf0e10cSrcweir         : BlopObject(buffer, 0, sal_False)
862*cdf0e10cSrcweir         , m_numOfEntries(numEntries)
863*cdf0e10cSrcweir         , m_pIndex(NULL)
864*cdf0e10cSrcweir         , m_pCP(pCP)
865*cdf0e10cSrcweir     {
866*cdf0e10cSrcweir 		if ( m_numOfEntries > 0 )
867*cdf0e10cSrcweir 		{
868*cdf0e10cSrcweir 			m_numOfMethodEntries = readUINT16(0);
869*cdf0e10cSrcweir 			m_numOfParamEntries = readUINT16(sizeof(sal_uInt16));
870*cdf0e10cSrcweir 			m_PARAM_ENTRY_SIZE = m_numOfParamEntries * sizeof(sal_uInt16);
871*cdf0e10cSrcweir 		} else
872*cdf0e10cSrcweir 		{
873*cdf0e10cSrcweir 			m_numOfMethodEntries = 0;
874*cdf0e10cSrcweir 			m_numOfParamEntries = 0;
875*cdf0e10cSrcweir 			m_PARAM_ENTRY_SIZE = 0;
876*cdf0e10cSrcweir 		}
877*cdf0e10cSrcweir     }
878*cdf0e10cSrcweir 
879*cdf0e10cSrcweir     ~MethodList();
880*cdf0e10cSrcweir 
881*cdf0e10cSrcweir     sal_uInt32 parseIndex(); // throws std::bad_alloc
882*cdf0e10cSrcweir 
883*cdf0e10cSrcweir     const sal_Char* getMethodName(sal_uInt16 index);
884*cdf0e10cSrcweir     sal_uInt16      getMethodParamCount(sal_uInt16 index);
885*cdf0e10cSrcweir     const sal_Char* getMethodParamType(sal_uInt16 index, sal_uInt16 paramIndex);
886*cdf0e10cSrcweir     const sal_Char* getMethodParamName(sal_uInt16 index, sal_uInt16 paramIndex);
887*cdf0e10cSrcweir     RTParamMode     getMethodParamMode(sal_uInt16 index, sal_uInt16 paramIndex);
888*cdf0e10cSrcweir     sal_uInt16      getMethodExcCount(sal_uInt16 index);
889*cdf0e10cSrcweir     const sal_Char* getMethodExcType(sal_uInt16 index, sal_uInt16 excIndex);
890*cdf0e10cSrcweir     const sal_Char* getMethodReturnType(sal_uInt16 index);
891*cdf0e10cSrcweir     RTMethodMode    getMethodMode(sal_uInt16 index);
892*cdf0e10cSrcweir     const sal_Char* getMethodDoku(sal_uInt16 index);
893*cdf0e10cSrcweir 
894*cdf0e10cSrcweir private:
895*cdf0e10cSrcweir 	sal_uInt16 calcMethodParamIndex( const sal_uInt16 index );
896*cdf0e10cSrcweir };
897*cdf0e10cSrcweir 
898*cdf0e10cSrcweir MethodList::~MethodList()
899*cdf0e10cSrcweir {
900*cdf0e10cSrcweir     if (m_pIndex) delete[] m_pIndex;
901*cdf0e10cSrcweir }
902*cdf0e10cSrcweir 
903*cdf0e10cSrcweir sal_uInt16 MethodList::calcMethodParamIndex( const sal_uInt16 index )
904*cdf0e10cSrcweir {
905*cdf0e10cSrcweir 	return (METHOD_OFFSET_PARAM_COUNT + sizeof(sal_uInt16) + (index * m_PARAM_ENTRY_SIZE));
906*cdf0e10cSrcweir }
907*cdf0e10cSrcweir 
908*cdf0e10cSrcweir sal_uInt32 MethodList::parseIndex()
909*cdf0e10cSrcweir {
910*cdf0e10cSrcweir     if (m_pIndex)
911*cdf0e10cSrcweir     {
912*cdf0e10cSrcweir         delete[] m_pIndex;
913*cdf0e10cSrcweir         m_pIndex = NULL;
914*cdf0e10cSrcweir     }
915*cdf0e10cSrcweir 
916*cdf0e10cSrcweir     sal_uInt32 offset = 0;
917*cdf0e10cSrcweir 
918*cdf0e10cSrcweir     if (m_numOfEntries)
919*cdf0e10cSrcweir     {
920*cdf0e10cSrcweir 		offset = 2 * sizeof(sal_uInt16);
921*cdf0e10cSrcweir         m_pIndex = new sal_uInt32[m_numOfEntries];
922*cdf0e10cSrcweir 
923*cdf0e10cSrcweir         for (int i = 0; i < m_numOfEntries; i++)
924*cdf0e10cSrcweir         {
925*cdf0e10cSrcweir             m_pIndex[i] = offset;
926*cdf0e10cSrcweir 
927*cdf0e10cSrcweir             offset += readUINT16(offset);
928*cdf0e10cSrcweir         }
929*cdf0e10cSrcweir     }
930*cdf0e10cSrcweir 
931*cdf0e10cSrcweir     return offset;
932*cdf0e10cSrcweir }
933*cdf0e10cSrcweir 
934*cdf0e10cSrcweir const sal_Char* MethodList::getMethodName(sal_uInt16 index)
935*cdf0e10cSrcweir {
936*cdf0e10cSrcweir     const sal_Char* aName = NULL;
937*cdf0e10cSrcweir 
938*cdf0e10cSrcweir     if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
939*cdf0e10cSrcweir     {
940*cdf0e10cSrcweir         aName = m_pCP->readUTF8NameConstant(readUINT16(m_pIndex[index] + METHOD_OFFSET_NAME));
941*cdf0e10cSrcweir     }
942*cdf0e10cSrcweir 
943*cdf0e10cSrcweir     return aName;
944*cdf0e10cSrcweir }
945*cdf0e10cSrcweir 
946*cdf0e10cSrcweir sal_uInt16 MethodList::getMethodParamCount(sal_uInt16 index)
947*cdf0e10cSrcweir {
948*cdf0e10cSrcweir     sal_uInt16 aCount = 0;
949*cdf0e10cSrcweir 
950*cdf0e10cSrcweir     if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
951*cdf0e10cSrcweir     {
952*cdf0e10cSrcweir         aCount = readUINT16(m_pIndex[index] + METHOD_OFFSET_PARAM_COUNT);
953*cdf0e10cSrcweir     }
954*cdf0e10cSrcweir 
955*cdf0e10cSrcweir     return aCount;
956*cdf0e10cSrcweir }
957*cdf0e10cSrcweir 
958*cdf0e10cSrcweir const sal_Char* MethodList::getMethodParamType(sal_uInt16 index, sal_uInt16 paramIndex)
959*cdf0e10cSrcweir {
960*cdf0e10cSrcweir     const sal_Char* aName = NULL;
961*cdf0e10cSrcweir 
962*cdf0e10cSrcweir     if ((m_numOfEntries > 0) &&
963*cdf0e10cSrcweir 		(index <= m_numOfEntries) &&
964*cdf0e10cSrcweir 		(paramIndex <= readUINT16(m_pIndex[index] + METHOD_OFFSET_PARAM_COUNT)))
965*cdf0e10cSrcweir     {
966*cdf0e10cSrcweir         aName = m_pCP->readUTF8NameConstant(
967*cdf0e10cSrcweir             readUINT16(
968*cdf0e10cSrcweir                 m_pIndex[index] +
969*cdf0e10cSrcweir                 calcMethodParamIndex(paramIndex) +
970*cdf0e10cSrcweir                 PARAM_OFFSET_TYPE));
971*cdf0e10cSrcweir     }
972*cdf0e10cSrcweir 
973*cdf0e10cSrcweir     return aName;
974*cdf0e10cSrcweir }
975*cdf0e10cSrcweir 
976*cdf0e10cSrcweir const sal_Char* MethodList::getMethodParamName(sal_uInt16 index, sal_uInt16 paramIndex)
977*cdf0e10cSrcweir {
978*cdf0e10cSrcweir     const sal_Char* aName = NULL;
979*cdf0e10cSrcweir 
980*cdf0e10cSrcweir     if ((m_numOfEntries > 0) &&
981*cdf0e10cSrcweir 		(index <= m_numOfEntries) &&
982*cdf0e10cSrcweir 		(paramIndex <= readUINT16(m_pIndex[index] + METHOD_OFFSET_PARAM_COUNT)))
983*cdf0e10cSrcweir     {
984*cdf0e10cSrcweir         aName = m_pCP->readUTF8NameConstant(
985*cdf0e10cSrcweir             readUINT16(
986*cdf0e10cSrcweir                 m_pIndex[index] +
987*cdf0e10cSrcweir                 calcMethodParamIndex(paramIndex) +
988*cdf0e10cSrcweir                 PARAM_OFFSET_NAME));
989*cdf0e10cSrcweir     }
990*cdf0e10cSrcweir 
991*cdf0e10cSrcweir     return aName;
992*cdf0e10cSrcweir }
993*cdf0e10cSrcweir 
994*cdf0e10cSrcweir RTParamMode MethodList::getMethodParamMode(sal_uInt16 index, sal_uInt16 paramIndex)
995*cdf0e10cSrcweir {
996*cdf0e10cSrcweir     RTParamMode aMode = RT_PARAM_INVALID;
997*cdf0e10cSrcweir 
998*cdf0e10cSrcweir     if ((m_numOfEntries > 0) &&
999*cdf0e10cSrcweir     	(index <= m_numOfEntries) &&
1000*cdf0e10cSrcweir 		(paramIndex <= readUINT16(m_pIndex[index] + METHOD_OFFSET_PARAM_COUNT)))
1001*cdf0e10cSrcweir     {
1002*cdf0e10cSrcweir         aMode = (RTParamMode) readUINT16(
1003*cdf0e10cSrcweir                 m_pIndex[index] +
1004*cdf0e10cSrcweir                 calcMethodParamIndex(paramIndex) +
1005*cdf0e10cSrcweir                 PARAM_OFFSET_MODE);
1006*cdf0e10cSrcweir     }
1007*cdf0e10cSrcweir 
1008*cdf0e10cSrcweir     return aMode;
1009*cdf0e10cSrcweir }
1010*cdf0e10cSrcweir 
1011*cdf0e10cSrcweir sal_uInt16 MethodList::getMethodExcCount(sal_uInt16 index)
1012*cdf0e10cSrcweir {
1013*cdf0e10cSrcweir     sal_uInt16 aCount = 0;
1014*cdf0e10cSrcweir 
1015*cdf0e10cSrcweir     if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
1016*cdf0e10cSrcweir     {
1017*cdf0e10cSrcweir         aCount = readUINT16(m_pIndex[index] + calcMethodParamIndex(readUINT16(m_pIndex[index] + METHOD_OFFSET_PARAM_COUNT)));
1018*cdf0e10cSrcweir     }
1019*cdf0e10cSrcweir 
1020*cdf0e10cSrcweir     return aCount;
1021*cdf0e10cSrcweir }
1022*cdf0e10cSrcweir 
1023*cdf0e10cSrcweir const sal_Char* MethodList::getMethodExcType(sal_uInt16 index, sal_uInt16 excIndex)
1024*cdf0e10cSrcweir {
1025*cdf0e10cSrcweir     const sal_Char* aName = NULL;
1026*cdf0e10cSrcweir 
1027*cdf0e10cSrcweir     if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
1028*cdf0e10cSrcweir     {
1029*cdf0e10cSrcweir         sal_uInt32 excOffset = m_pIndex[index] + calcMethodParamIndex(readUINT16(m_pIndex[index] + METHOD_OFFSET_PARAM_COUNT));
1030*cdf0e10cSrcweir 
1031*cdf0e10cSrcweir         if (excIndex <= readUINT16(excOffset))
1032*cdf0e10cSrcweir         {
1033*cdf0e10cSrcweir             aName = m_pCP->readUTF8NameConstant(
1034*cdf0e10cSrcweir                 readUINT16(
1035*cdf0e10cSrcweir                     excOffset +
1036*cdf0e10cSrcweir                     sizeof(sal_uInt16) +
1037*cdf0e10cSrcweir                     (excIndex * sizeof(sal_uInt16))));
1038*cdf0e10cSrcweir         }
1039*cdf0e10cSrcweir     }
1040*cdf0e10cSrcweir 
1041*cdf0e10cSrcweir     return aName;
1042*cdf0e10cSrcweir }
1043*cdf0e10cSrcweir 
1044*cdf0e10cSrcweir const sal_Char* MethodList::getMethodReturnType(sal_uInt16 index)
1045*cdf0e10cSrcweir {
1046*cdf0e10cSrcweir     const sal_Char* aName = NULL;
1047*cdf0e10cSrcweir 
1048*cdf0e10cSrcweir     if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
1049*cdf0e10cSrcweir     {
1050*cdf0e10cSrcweir         aName = m_pCP->readUTF8NameConstant(readUINT16(m_pIndex[index] + METHOD_OFFSET_RETURN));
1051*cdf0e10cSrcweir     }
1052*cdf0e10cSrcweir 
1053*cdf0e10cSrcweir     return aName;
1054*cdf0e10cSrcweir }
1055*cdf0e10cSrcweir 
1056*cdf0e10cSrcweir RTMethodMode MethodList::getMethodMode(sal_uInt16 index)
1057*cdf0e10cSrcweir {
1058*cdf0e10cSrcweir     RTMethodMode aMode = RT_MODE_INVALID;
1059*cdf0e10cSrcweir 
1060*cdf0e10cSrcweir     if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
1061*cdf0e10cSrcweir     {
1062*cdf0e10cSrcweir         aMode = (RTMethodMode) readUINT16(m_pIndex[index] + METHOD_OFFSET_MODE);
1063*cdf0e10cSrcweir     }
1064*cdf0e10cSrcweir 
1065*cdf0e10cSrcweir     return aMode;
1066*cdf0e10cSrcweir }
1067*cdf0e10cSrcweir 
1068*cdf0e10cSrcweir const sal_Char* MethodList::getMethodDoku(sal_uInt16 index)
1069*cdf0e10cSrcweir {
1070*cdf0e10cSrcweir     const sal_Char* aDoku = NULL;
1071*cdf0e10cSrcweir 
1072*cdf0e10cSrcweir     if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
1073*cdf0e10cSrcweir     {
1074*cdf0e10cSrcweir         aDoku = m_pCP->readUTF8NameConstant(readUINT16(m_pIndex[index] + METHOD_OFFSET_DOKU));
1075*cdf0e10cSrcweir     }
1076*cdf0e10cSrcweir 
1077*cdf0e10cSrcweir     return aDoku;
1078*cdf0e10cSrcweir }
1079*cdf0e10cSrcweir 
1080*cdf0e10cSrcweir /**************************************************************************
1081*cdf0e10cSrcweir 
1082*cdf0e10cSrcweir     class TypeRegistryEntry
1083*cdf0e10cSrcweir 
1084*cdf0e10cSrcweir **************************************************************************/
1085*cdf0e10cSrcweir 
1086*cdf0e10cSrcweir class TypeRegistryEntry: public BlopObject {
1087*cdf0e10cSrcweir public:
1088*cdf0e10cSrcweir     ConstantPool*   m_pCP;
1089*cdf0e10cSrcweir     FieldList*      m_pFields;
1090*cdf0e10cSrcweir     MethodList*     m_pMethods;
1091*cdf0e10cSrcweir     ReferenceList*  m_pReferences;
1092*cdf0e10cSrcweir     sal_uInt32      m_refCount;
1093*cdf0e10cSrcweir 	sal_uInt16		m_nSuperTypes;
1094*cdf0e10cSrcweir 	sal_uInt16		m_offset_SUPERTYPES;
1095*cdf0e10cSrcweir 
1096*cdf0e10cSrcweir     TypeRegistryEntry(
1097*cdf0e10cSrcweir         const sal_uInt8* buffer, sal_uInt32 len, sal_Bool copyBuffer);
1098*cdf0e10cSrcweir         // throws std::bad_alloc
1099*cdf0e10cSrcweir 
1100*cdf0e10cSrcweir     ~TypeRegistryEntry();
1101*cdf0e10cSrcweir 
1102*cdf0e10cSrcweir     typereg_Version getVersion() const;
1103*cdf0e10cSrcweir };
1104*cdf0e10cSrcweir 
1105*cdf0e10cSrcweir TypeRegistryEntry::TypeRegistryEntry(
1106*cdf0e10cSrcweir     const sal_uInt8* buffer, sal_uInt32 len, sal_Bool copyBuffer):
1107*cdf0e10cSrcweir     BlopObject(buffer, len, copyBuffer), m_pCP(NULL), m_pFields(NULL),
1108*cdf0e10cSrcweir     m_pMethods(NULL), m_pReferences(NULL), m_refCount(1), m_nSuperTypes(0),
1109*cdf0e10cSrcweir     m_offset_SUPERTYPES(0)
1110*cdf0e10cSrcweir {
1111*cdf0e10cSrcweir     std::size_t const entrySize = sizeof(sal_uInt16);
1112*cdf0e10cSrcweir 	sal_uInt16 nHeaderEntries = readUINT16(OFFSET_N_ENTRIES);
1113*cdf0e10cSrcweir 	sal_uInt16 offset_N_SUPERTYPES = OFFSET_N_ENTRIES + entrySize + (nHeaderEntries * entrySize);
1114*cdf0e10cSrcweir 	m_offset_SUPERTYPES = offset_N_SUPERTYPES + entrySize;
1115*cdf0e10cSrcweir 	m_nSuperTypes = readUINT16(offset_N_SUPERTYPES);
1116*cdf0e10cSrcweir 
1117*cdf0e10cSrcweir 	sal_uInt16 offset_CP_SIZE = m_offset_SUPERTYPES + (m_nSuperTypes * entrySize);
1118*cdf0e10cSrcweir 	sal_uInt16 offset_CP = offset_CP_SIZE + entrySize;
1119*cdf0e10cSrcweir 
1120*cdf0e10cSrcweir     m_pCP = new ConstantPool(m_pBuffer + offset_CP, readUINT16(offset_CP_SIZE));
1121*cdf0e10cSrcweir 
1122*cdf0e10cSrcweir     sal_uInt32 offset = offset_CP + m_pCP->parseIndex();
1123*cdf0e10cSrcweir 
1124*cdf0e10cSrcweir     m_pFields = new FieldList(
1125*cdf0e10cSrcweir         m_pBuffer + offset + entrySize, readUINT16(offset), m_pCP);
1126*cdf0e10cSrcweir 
1127*cdf0e10cSrcweir     offset += sizeof(sal_uInt16) + m_pFields->parseIndex();
1128*cdf0e10cSrcweir 
1129*cdf0e10cSrcweir     m_pMethods = new MethodList(
1130*cdf0e10cSrcweir         m_pBuffer + offset + entrySize, readUINT16(offset), m_pCP);
1131*cdf0e10cSrcweir 
1132*cdf0e10cSrcweir     offset += sizeof(sal_uInt16) + m_pMethods->parseIndex();
1133*cdf0e10cSrcweir 
1134*cdf0e10cSrcweir     m_pReferences = new ReferenceList(
1135*cdf0e10cSrcweir         m_pBuffer + offset + entrySize, readUINT16(offset), m_pCP);
1136*cdf0e10cSrcweir 
1137*cdf0e10cSrcweir     m_pReferences->parseIndex();
1138*cdf0e10cSrcweir }
1139*cdf0e10cSrcweir 
1140*cdf0e10cSrcweir TypeRegistryEntry::~TypeRegistryEntry()
1141*cdf0e10cSrcweir {
1142*cdf0e10cSrcweir     delete m_pCP;
1143*cdf0e10cSrcweir     delete m_pFields;
1144*cdf0e10cSrcweir     delete m_pMethods;
1145*cdf0e10cSrcweir     delete m_pReferences;
1146*cdf0e10cSrcweir }
1147*cdf0e10cSrcweir 
1148*cdf0e10cSrcweir typereg_Version TypeRegistryEntry::getVersion() const {
1149*cdf0e10cSrcweir     // Assumes two's complement arithmetic with modulo-semantics:
1150*cdf0e10cSrcweir     return static_cast< typereg_Version >(readUINT32(OFFSET_MAGIC) - magic);
1151*cdf0e10cSrcweir }
1152*cdf0e10cSrcweir 
1153*cdf0e10cSrcweir /**************************************************************************
1154*cdf0e10cSrcweir 
1155*cdf0e10cSrcweir     C-API
1156*cdf0e10cSrcweir 
1157*cdf0e10cSrcweir **************************************************************************/
1158*cdf0e10cSrcweir 
1159*cdf0e10cSrcweir extern "C" {
1160*cdf0e10cSrcweir 
1161*cdf0e10cSrcweir sal_Bool typereg_reader_create(
1162*cdf0e10cSrcweir     void const * buffer, sal_uInt32 length, sal_Bool copy,
1163*cdf0e10cSrcweir     typereg_Version maxVersion, void ** result)
1164*cdf0e10cSrcweir     SAL_THROW_EXTERN_C()
1165*cdf0e10cSrcweir {
1166*cdf0e10cSrcweir     if (length < OFFSET_CP || length > SAL_MAX_UINT32) {
1167*cdf0e10cSrcweir         *result = 0;
1168*cdf0e10cSrcweir         return true;
1169*cdf0e10cSrcweir     }
1170*cdf0e10cSrcweir     std::auto_ptr< TypeRegistryEntry > entry;
1171*cdf0e10cSrcweir     try {
1172*cdf0e10cSrcweir         entry.reset(
1173*cdf0e10cSrcweir             new TypeRegistryEntry(
1174*cdf0e10cSrcweir                 static_cast< sal_uInt8 const * >(buffer),
1175*cdf0e10cSrcweir                 static_cast< sal_uInt32 >(length), copy));
1176*cdf0e10cSrcweir     } catch (std::bad_alloc &) {
1177*cdf0e10cSrcweir         return false;
1178*cdf0e10cSrcweir     }
1179*cdf0e10cSrcweir     if (entry->readUINT32(OFFSET_SIZE) != length) {
1180*cdf0e10cSrcweir         *result = 0;
1181*cdf0e10cSrcweir         return true;
1182*cdf0e10cSrcweir     }
1183*cdf0e10cSrcweir     typereg_Version version = entry->getVersion();
1184*cdf0e10cSrcweir     if (version < TYPEREG_VERSION_0 || version > maxVersion) {
1185*cdf0e10cSrcweir         *result = 0;
1186*cdf0e10cSrcweir         return true;
1187*cdf0e10cSrcweir     }
1188*cdf0e10cSrcweir     *result = entry.release();
1189*cdf0e10cSrcweir     return true;
1190*cdf0e10cSrcweir }
1191*cdf0e10cSrcweir 
1192*cdf0e10cSrcweir static TypeReaderImpl TYPEREG_CALLTYPE createEntry(const sal_uInt8* buffer, sal_uInt32 len, sal_Bool copyBuffer)
1193*cdf0e10cSrcweir {
1194*cdf0e10cSrcweir     void * handle;
1195*cdf0e10cSrcweir     typereg_reader_create(buffer, len, copyBuffer, TYPEREG_VERSION_0, &handle);
1196*cdf0e10cSrcweir     return handle;
1197*cdf0e10cSrcweir }
1198*cdf0e10cSrcweir 
1199*cdf0e10cSrcweir void typereg_reader_acquire(void * hEntry) SAL_THROW_EXTERN_C()
1200*cdf0e10cSrcweir {
1201*cdf0e10cSrcweir     TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
1202*cdf0e10cSrcweir 
1203*cdf0e10cSrcweir     if (pEntry != NULL)
1204*cdf0e10cSrcweir         pEntry->m_refCount++;
1205*cdf0e10cSrcweir }
1206*cdf0e10cSrcweir 
1207*cdf0e10cSrcweir void typereg_reader_release(void * hEntry) SAL_THROW_EXTERN_C()
1208*cdf0e10cSrcweir {
1209*cdf0e10cSrcweir     TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
1210*cdf0e10cSrcweir 
1211*cdf0e10cSrcweir     if (pEntry != NULL)
1212*cdf0e10cSrcweir     {
1213*cdf0e10cSrcweir         if (--pEntry->m_refCount == 0)
1214*cdf0e10cSrcweir             delete pEntry;
1215*cdf0e10cSrcweir     }
1216*cdf0e10cSrcweir }
1217*cdf0e10cSrcweir 
1218*cdf0e10cSrcweir typereg_Version typereg_reader_getVersion(void * handle) SAL_THROW_EXTERN_C() {
1219*cdf0e10cSrcweir     return handle == 0
1220*cdf0e10cSrcweir         ? TYPEREG_VERSION_0
1221*cdf0e10cSrcweir         : static_cast< TypeRegistryEntry * >(handle)->getVersion();
1222*cdf0e10cSrcweir }
1223*cdf0e10cSrcweir 
1224*cdf0e10cSrcweir static sal_uInt16 TYPEREG_CALLTYPE getMinorVersion(TypeReaderImpl hEntry)
1225*cdf0e10cSrcweir {
1226*cdf0e10cSrcweir     TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
1227*cdf0e10cSrcweir 
1228*cdf0e10cSrcweir     if (pEntry == NULL) return 0;
1229*cdf0e10cSrcweir 
1230*cdf0e10cSrcweir     return pEntry->readUINT16(OFFSET_MINOR_VERSION);
1231*cdf0e10cSrcweir }
1232*cdf0e10cSrcweir 
1233*cdf0e10cSrcweir static sal_uInt16 TYPEREG_CALLTYPE getMajorVersion(TypeReaderImpl hEntry)
1234*cdf0e10cSrcweir {
1235*cdf0e10cSrcweir     TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
1236*cdf0e10cSrcweir 
1237*cdf0e10cSrcweir     if (pEntry == NULL) return 0;
1238*cdf0e10cSrcweir 
1239*cdf0e10cSrcweir     return pEntry->readUINT16(OFFSET_MAJOR_VERSION);
1240*cdf0e10cSrcweir }
1241*cdf0e10cSrcweir 
1242*cdf0e10cSrcweir RTTypeClass typereg_reader_getTypeClass(void * hEntry) SAL_THROW_EXTERN_C()
1243*cdf0e10cSrcweir {
1244*cdf0e10cSrcweir     TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
1245*cdf0e10cSrcweir 
1246*cdf0e10cSrcweir     if (pEntry == NULL) return RT_TYPE_INVALID;
1247*cdf0e10cSrcweir 
1248*cdf0e10cSrcweir     return (RTTypeClass)
1249*cdf0e10cSrcweir         (pEntry->readUINT16(OFFSET_TYPE_CLASS) & ~RT_TYPE_PUBLISHED);
1250*cdf0e10cSrcweir }
1251*cdf0e10cSrcweir 
1252*cdf0e10cSrcweir sal_Bool typereg_reader_isPublished(void * hEntry) SAL_THROW_EXTERN_C()
1253*cdf0e10cSrcweir {
1254*cdf0e10cSrcweir     TypeRegistryEntry * entry = static_cast< TypeRegistryEntry * >(hEntry);
1255*cdf0e10cSrcweir     return entry != 0
1256*cdf0e10cSrcweir         && (entry->readUINT16(OFFSET_TYPE_CLASS) & RT_TYPE_PUBLISHED) != 0;
1257*cdf0e10cSrcweir }
1258*cdf0e10cSrcweir 
1259*cdf0e10cSrcweir void typereg_reader_getTypeName(void * hEntry, rtl_uString** pTypeName)
1260*cdf0e10cSrcweir     SAL_THROW_EXTERN_C()
1261*cdf0e10cSrcweir {
1262*cdf0e10cSrcweir     TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
1263*cdf0e10cSrcweir 
1264*cdf0e10cSrcweir     if (pEntry == NULL)
1265*cdf0e10cSrcweir 	{
1266*cdf0e10cSrcweir 		rtl_uString_new(pTypeName);
1267*cdf0e10cSrcweir 		return;
1268*cdf0e10cSrcweir 	}
1269*cdf0e10cSrcweir 
1270*cdf0e10cSrcweir     const sal_Char* pTmp = pEntry->m_pCP->readUTF8NameConstant(pEntry->readUINT16(OFFSET_THIS_TYPE));
1271*cdf0e10cSrcweir     rtl_string2UString(
1272*cdf0e10cSrcweir         pTypeName, pTmp, pTmp == 0 ? 0 : rtl_str_getLength(pTmp),
1273*cdf0e10cSrcweir         RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1274*cdf0e10cSrcweir }
1275*cdf0e10cSrcweir 
1276*cdf0e10cSrcweir 
1277*cdf0e10cSrcweir static void TYPEREG_CALLTYPE getSuperTypeName(TypeReaderImpl hEntry, rtl_uString** pSuperTypeName)
1278*cdf0e10cSrcweir {
1279*cdf0e10cSrcweir     TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
1280*cdf0e10cSrcweir 
1281*cdf0e10cSrcweir     if (pEntry == NULL)
1282*cdf0e10cSrcweir 	{
1283*cdf0e10cSrcweir 		rtl_uString_new(pSuperTypeName);
1284*cdf0e10cSrcweir 		return;
1285*cdf0e10cSrcweir 	}
1286*cdf0e10cSrcweir 
1287*cdf0e10cSrcweir     if (pEntry->m_nSuperTypes == 0)
1288*cdf0e10cSrcweir 	{
1289*cdf0e10cSrcweir 		rtl_uString_new(pSuperTypeName);
1290*cdf0e10cSrcweir 		return;
1291*cdf0e10cSrcweir 	}
1292*cdf0e10cSrcweir 
1293*cdf0e10cSrcweir     const sal_Char* pTmp = pEntry->m_pCP->readUTF8NameConstant(pEntry->readUINT16(pEntry->m_offset_SUPERTYPES )); //+ (index * sizeof(sal_uInt16))));
1294*cdf0e10cSrcweir     rtl_string2UString(
1295*cdf0e10cSrcweir         pSuperTypeName, pTmp, pTmp == 0 ? 0 : rtl_str_getLength(pTmp),
1296*cdf0e10cSrcweir         RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1297*cdf0e10cSrcweir }
1298*cdf0e10cSrcweir 
1299*cdf0e10cSrcweir static void TYPEREG_CALLTYPE getUik(TypeReaderImpl hEntry, RTUik* uik)
1300*cdf0e10cSrcweir {
1301*cdf0e10cSrcweir     TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
1302*cdf0e10cSrcweir 
1303*cdf0e10cSrcweir     if (pEntry != NULL)
1304*cdf0e10cSrcweir     {
1305*cdf0e10cSrcweir         pEntry->m_pCP->readUIK(pEntry->readUINT16(OFFSET_UIK), uik);
1306*cdf0e10cSrcweir     }
1307*cdf0e10cSrcweir }
1308*cdf0e10cSrcweir 
1309*cdf0e10cSrcweir void typereg_reader_getDocumentation(void * hEntry, rtl_uString** pDoku)
1310*cdf0e10cSrcweir     SAL_THROW_EXTERN_C()
1311*cdf0e10cSrcweir {
1312*cdf0e10cSrcweir     TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
1313*cdf0e10cSrcweir 
1314*cdf0e10cSrcweir     if (pEntry == NULL)
1315*cdf0e10cSrcweir 	{
1316*cdf0e10cSrcweir 		rtl_uString_new(pDoku);
1317*cdf0e10cSrcweir 		return;
1318*cdf0e10cSrcweir 	}
1319*cdf0e10cSrcweir 
1320*cdf0e10cSrcweir     const sal_Char* pTmp = pEntry->m_pCP->readUTF8NameConstant(pEntry->readUINT16(OFFSET_DOKU));
1321*cdf0e10cSrcweir     rtl_string2UString(
1322*cdf0e10cSrcweir         pDoku, pTmp, pTmp == 0 ? 0 : rtl_str_getLength(pTmp),
1323*cdf0e10cSrcweir         RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1324*cdf0e10cSrcweir }
1325*cdf0e10cSrcweir 
1326*cdf0e10cSrcweir void typereg_reader_getFileName(void * hEntry, rtl_uString** pFileName)
1327*cdf0e10cSrcweir     SAL_THROW_EXTERN_C()
1328*cdf0e10cSrcweir {
1329*cdf0e10cSrcweir     TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
1330*cdf0e10cSrcweir 
1331*cdf0e10cSrcweir     if (pEntry == NULL)
1332*cdf0e10cSrcweir 	{
1333*cdf0e10cSrcweir 		rtl_uString_new(pFileName);
1334*cdf0e10cSrcweir 		return;
1335*cdf0e10cSrcweir 	}
1336*cdf0e10cSrcweir 
1337*cdf0e10cSrcweir     const sal_Char* pTmp = pEntry->m_pCP->readUTF8NameConstant(pEntry->readUINT16(OFFSET_FILENAME));
1338*cdf0e10cSrcweir     rtl_string2UString(
1339*cdf0e10cSrcweir         pFileName, pTmp, pTmp == 0 ? 0 : rtl_str_getLength(pTmp),
1340*cdf0e10cSrcweir         RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1341*cdf0e10cSrcweir }
1342*cdf0e10cSrcweir 
1343*cdf0e10cSrcweir 
1344*cdf0e10cSrcweir sal_uInt16 typereg_reader_getFieldCount(void * hEntry) SAL_THROW_EXTERN_C()
1345*cdf0e10cSrcweir {
1346*cdf0e10cSrcweir     TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
1347*cdf0e10cSrcweir 
1348*cdf0e10cSrcweir     if (pEntry == NULL) return 0;
1349*cdf0e10cSrcweir 
1350*cdf0e10cSrcweir     return pEntry->m_pFields->m_numOfEntries;
1351*cdf0e10cSrcweir }
1352*cdf0e10cSrcweir 
1353*cdf0e10cSrcweir static sal_uInt32 TYPEREG_CALLTYPE getFieldCount(TypeReaderImpl hEntry)
1354*cdf0e10cSrcweir {
1355*cdf0e10cSrcweir     return typereg_reader_getFieldCount(hEntry);
1356*cdf0e10cSrcweir }
1357*cdf0e10cSrcweir 
1358*cdf0e10cSrcweir void typereg_reader_getFieldName(void * hEntry, rtl_uString** pFieldName, sal_uInt16 index)
1359*cdf0e10cSrcweir     SAL_THROW_EXTERN_C()
1360*cdf0e10cSrcweir {
1361*cdf0e10cSrcweir     TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
1362*cdf0e10cSrcweir 
1363*cdf0e10cSrcweir     if (pEntry == NULL)
1364*cdf0e10cSrcweir 	{
1365*cdf0e10cSrcweir 		rtl_uString_new(pFieldName);
1366*cdf0e10cSrcweir 		return;
1367*cdf0e10cSrcweir 	}
1368*cdf0e10cSrcweir     const sal_Char* pTmp = pEntry->m_pFields->getFieldName(index);
1369*cdf0e10cSrcweir     rtl_string2UString(
1370*cdf0e10cSrcweir         pFieldName, pTmp, pTmp == 0 ? 0 : rtl_str_getLength(pTmp),
1371*cdf0e10cSrcweir         RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1372*cdf0e10cSrcweir }
1373*cdf0e10cSrcweir 
1374*cdf0e10cSrcweir void typereg_reader_getFieldTypeName(void * hEntry, rtl_uString** pFieldType, sal_uInt16 index)
1375*cdf0e10cSrcweir     SAL_THROW_EXTERN_C()
1376*cdf0e10cSrcweir {
1377*cdf0e10cSrcweir     TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
1378*cdf0e10cSrcweir 
1379*cdf0e10cSrcweir     if (pEntry == NULL)
1380*cdf0e10cSrcweir 	{
1381*cdf0e10cSrcweir 		rtl_uString_new(pFieldType);
1382*cdf0e10cSrcweir 		return;
1383*cdf0e10cSrcweir 	}
1384*cdf0e10cSrcweir 
1385*cdf0e10cSrcweir     const sal_Char* pTmp = pEntry->m_pFields->getFieldType(index);
1386*cdf0e10cSrcweir     rtl_string2UString(
1387*cdf0e10cSrcweir         pFieldType, pTmp, pTmp == 0 ? 0 : rtl_str_getLength(pTmp),
1388*cdf0e10cSrcweir         RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1389*cdf0e10cSrcweir }
1390*cdf0e10cSrcweir 
1391*cdf0e10cSrcweir RTFieldAccess typereg_reader_getFieldFlags(void * hEntry, sal_uInt16 index)
1392*cdf0e10cSrcweir     SAL_THROW_EXTERN_C()
1393*cdf0e10cSrcweir {
1394*cdf0e10cSrcweir     TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
1395*cdf0e10cSrcweir 
1396*cdf0e10cSrcweir     if (pEntry == NULL) return RT_ACCESS_INVALID;
1397*cdf0e10cSrcweir 
1398*cdf0e10cSrcweir     return pEntry->m_pFields->getFieldAccess(index);
1399*cdf0e10cSrcweir }
1400*cdf0e10cSrcweir 
1401*cdf0e10cSrcweir sal_Bool typereg_reader_getFieldValue(
1402*cdf0e10cSrcweir     void * hEntry, sal_uInt16 index, RTValueType * type,
1403*cdf0e10cSrcweir     RTConstValueUnion * value)
1404*cdf0e10cSrcweir     SAL_THROW_EXTERN_C()
1405*cdf0e10cSrcweir {
1406*cdf0e10cSrcweir     TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
1407*cdf0e10cSrcweir 
1408*cdf0e10cSrcweir     if (pEntry == NULL) {
1409*cdf0e10cSrcweir         *type = RT_TYPE_NONE;
1410*cdf0e10cSrcweir         return true;
1411*cdf0e10cSrcweir     }
1412*cdf0e10cSrcweir 
1413*cdf0e10cSrcweir     try {
1414*cdf0e10cSrcweir         *type = pEntry->m_pFields->getFieldConstValue(index, value);
1415*cdf0e10cSrcweir     } catch (std::bad_alloc &) {
1416*cdf0e10cSrcweir         return false;
1417*cdf0e10cSrcweir     }
1418*cdf0e10cSrcweir     return true;
1419*cdf0e10cSrcweir }
1420*cdf0e10cSrcweir 
1421*cdf0e10cSrcweir static RTValueType TYPEREG_CALLTYPE getFieldConstValue(TypeReaderImpl hEntry, sal_uInt16 index, RTConstValueUnion* value)
1422*cdf0e10cSrcweir {
1423*cdf0e10cSrcweir     RTValueType t = RT_TYPE_NONE;
1424*cdf0e10cSrcweir     typereg_reader_getFieldValue(hEntry, index, &t, value);
1425*cdf0e10cSrcweir     return t;
1426*cdf0e10cSrcweir }
1427*cdf0e10cSrcweir 
1428*cdf0e10cSrcweir void typereg_reader_getFieldDocumentation(void * hEntry, rtl_uString** pDoku, sal_uInt16 index)
1429*cdf0e10cSrcweir     SAL_THROW_EXTERN_C()
1430*cdf0e10cSrcweir {
1431*cdf0e10cSrcweir     TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
1432*cdf0e10cSrcweir 
1433*cdf0e10cSrcweir     if (pEntry == NULL)
1434*cdf0e10cSrcweir 	{
1435*cdf0e10cSrcweir 		rtl_uString_new(pDoku);
1436*cdf0e10cSrcweir 		return;
1437*cdf0e10cSrcweir 	}
1438*cdf0e10cSrcweir 
1439*cdf0e10cSrcweir     const sal_Char* pTmp = pEntry->m_pFields->getFieldDoku(index);
1440*cdf0e10cSrcweir     rtl_string2UString(
1441*cdf0e10cSrcweir         pDoku, pTmp, pTmp == 0 ? 0 : rtl_str_getLength(pTmp),
1442*cdf0e10cSrcweir         RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1443*cdf0e10cSrcweir }
1444*cdf0e10cSrcweir 
1445*cdf0e10cSrcweir void typereg_reader_getFieldFileName(void * hEntry, rtl_uString** pFieldFileName, sal_uInt16 index)
1446*cdf0e10cSrcweir     SAL_THROW_EXTERN_C()
1447*cdf0e10cSrcweir {
1448*cdf0e10cSrcweir     TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
1449*cdf0e10cSrcweir 
1450*cdf0e10cSrcweir     if (pEntry == NULL)
1451*cdf0e10cSrcweir 	{
1452*cdf0e10cSrcweir 		rtl_uString_new(pFieldFileName);
1453*cdf0e10cSrcweir 		return;
1454*cdf0e10cSrcweir 	}
1455*cdf0e10cSrcweir 
1456*cdf0e10cSrcweir     const sal_Char* pTmp = pEntry->m_pFields->getFieldFileName(index);
1457*cdf0e10cSrcweir     rtl_string2UString(
1458*cdf0e10cSrcweir         pFieldFileName, pTmp, pTmp == 0 ? 0 : rtl_str_getLength(pTmp),
1459*cdf0e10cSrcweir         RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1460*cdf0e10cSrcweir }
1461*cdf0e10cSrcweir 
1462*cdf0e10cSrcweir 
1463*cdf0e10cSrcweir sal_uInt16 typereg_reader_getMethodCount(void * hEntry) SAL_THROW_EXTERN_C()
1464*cdf0e10cSrcweir {
1465*cdf0e10cSrcweir     TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
1466*cdf0e10cSrcweir 
1467*cdf0e10cSrcweir     if (pEntry == NULL) return 0;
1468*cdf0e10cSrcweir 
1469*cdf0e10cSrcweir     return pEntry->m_pMethods->m_numOfEntries;
1470*cdf0e10cSrcweir }
1471*cdf0e10cSrcweir 
1472*cdf0e10cSrcweir static sal_uInt32 TYPEREG_CALLTYPE getMethodCount(TypeReaderImpl hEntry)
1473*cdf0e10cSrcweir {
1474*cdf0e10cSrcweir     return typereg_reader_getMethodCount(hEntry);
1475*cdf0e10cSrcweir }
1476*cdf0e10cSrcweir 
1477*cdf0e10cSrcweir void typereg_reader_getMethodName(void * hEntry, rtl_uString** pMethodName, sal_uInt16 index)
1478*cdf0e10cSrcweir     SAL_THROW_EXTERN_C()
1479*cdf0e10cSrcweir {
1480*cdf0e10cSrcweir     TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
1481*cdf0e10cSrcweir 
1482*cdf0e10cSrcweir     if (pEntry == NULL)
1483*cdf0e10cSrcweir 	{
1484*cdf0e10cSrcweir 		rtl_uString_new(pMethodName);
1485*cdf0e10cSrcweir 		return;
1486*cdf0e10cSrcweir 	}
1487*cdf0e10cSrcweir 
1488*cdf0e10cSrcweir     const sal_Char* pTmp = pEntry->m_pMethods->getMethodName(index);
1489*cdf0e10cSrcweir     rtl_string2UString(
1490*cdf0e10cSrcweir         pMethodName, pTmp, pTmp == 0 ? 0 : rtl_str_getLength(pTmp),
1491*cdf0e10cSrcweir         RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1492*cdf0e10cSrcweir }
1493*cdf0e10cSrcweir 
1494*cdf0e10cSrcweir sal_uInt16 typereg_reader_getMethodParameterCount(
1495*cdf0e10cSrcweir     void * hEntry, sal_uInt16 index) SAL_THROW_EXTERN_C()
1496*cdf0e10cSrcweir {
1497*cdf0e10cSrcweir     TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
1498*cdf0e10cSrcweir 
1499*cdf0e10cSrcweir     if (pEntry == NULL) return 0;
1500*cdf0e10cSrcweir 
1501*cdf0e10cSrcweir     return pEntry->m_pMethods->getMethodParamCount(index);
1502*cdf0e10cSrcweir }
1503*cdf0e10cSrcweir 
1504*cdf0e10cSrcweir static sal_uInt32 TYPEREG_CALLTYPE getMethodParamCount(TypeReaderImpl hEntry, sal_uInt16 index)
1505*cdf0e10cSrcweir {
1506*cdf0e10cSrcweir     return typereg_reader_getMethodParameterCount(hEntry, index);
1507*cdf0e10cSrcweir }
1508*cdf0e10cSrcweir 
1509*cdf0e10cSrcweir void typereg_reader_getMethodParameterTypeName(void * hEntry, rtl_uString** pMethodParamType, sal_uInt16 index, sal_uInt16 paramIndex)
1510*cdf0e10cSrcweir     SAL_THROW_EXTERN_C()
1511*cdf0e10cSrcweir {
1512*cdf0e10cSrcweir     TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
1513*cdf0e10cSrcweir 
1514*cdf0e10cSrcweir     if (pEntry == NULL)
1515*cdf0e10cSrcweir 	{
1516*cdf0e10cSrcweir 		rtl_uString_new(pMethodParamType);
1517*cdf0e10cSrcweir 		return;
1518*cdf0e10cSrcweir 	}
1519*cdf0e10cSrcweir 
1520*cdf0e10cSrcweir     const sal_Char* pTmp = pEntry->m_pMethods->getMethodParamType(index, paramIndex);
1521*cdf0e10cSrcweir     rtl_string2UString(
1522*cdf0e10cSrcweir         pMethodParamType, pTmp, pTmp == 0 ? 0 : rtl_str_getLength(pTmp),
1523*cdf0e10cSrcweir         RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1524*cdf0e10cSrcweir }
1525*cdf0e10cSrcweir 
1526*cdf0e10cSrcweir void typereg_reader_getMethodParameterName(void * hEntry, rtl_uString** pMethodParamName, sal_uInt16 index, sal_uInt16 paramIndex)
1527*cdf0e10cSrcweir     SAL_THROW_EXTERN_C()
1528*cdf0e10cSrcweir {
1529*cdf0e10cSrcweir     TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
1530*cdf0e10cSrcweir 
1531*cdf0e10cSrcweir     if (pEntry == NULL)
1532*cdf0e10cSrcweir 	{
1533*cdf0e10cSrcweir 		rtl_uString_new(pMethodParamName);
1534*cdf0e10cSrcweir 		return;
1535*cdf0e10cSrcweir 	}
1536*cdf0e10cSrcweir 
1537*cdf0e10cSrcweir     const sal_Char* pTmp = pEntry->m_pMethods->getMethodParamName(index, paramIndex);
1538*cdf0e10cSrcweir     rtl_string2UString(
1539*cdf0e10cSrcweir         pMethodParamName, pTmp, pTmp == 0 ? 0 : rtl_str_getLength(pTmp),
1540*cdf0e10cSrcweir         RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1541*cdf0e10cSrcweir }
1542*cdf0e10cSrcweir 
1543*cdf0e10cSrcweir RTParamMode typereg_reader_getMethodParameterFlags(void * hEntry, sal_uInt16 index, sal_uInt16 paramIndex)
1544*cdf0e10cSrcweir     SAL_THROW_EXTERN_C()
1545*cdf0e10cSrcweir {
1546*cdf0e10cSrcweir     TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
1547*cdf0e10cSrcweir 
1548*cdf0e10cSrcweir     if (pEntry == NULL) return RT_PARAM_INVALID;
1549*cdf0e10cSrcweir 
1550*cdf0e10cSrcweir     return pEntry->m_pMethods->getMethodParamMode(index, paramIndex);
1551*cdf0e10cSrcweir }
1552*cdf0e10cSrcweir 
1553*cdf0e10cSrcweir sal_uInt16 typereg_reader_getMethodExceptionCount(
1554*cdf0e10cSrcweir     void * hEntry, sal_uInt16 index) SAL_THROW_EXTERN_C()
1555*cdf0e10cSrcweir {
1556*cdf0e10cSrcweir     TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
1557*cdf0e10cSrcweir 
1558*cdf0e10cSrcweir     if (pEntry == NULL) return 0;
1559*cdf0e10cSrcweir 
1560*cdf0e10cSrcweir     return pEntry->m_pMethods->getMethodExcCount(index);
1561*cdf0e10cSrcweir }
1562*cdf0e10cSrcweir 
1563*cdf0e10cSrcweir static sal_uInt32 TYPEREG_CALLTYPE getMethodExcCount(TypeReaderImpl hEntry, sal_uInt16 index)
1564*cdf0e10cSrcweir {
1565*cdf0e10cSrcweir     return typereg_reader_getMethodExceptionCount(hEntry, index);
1566*cdf0e10cSrcweir }
1567*cdf0e10cSrcweir 
1568*cdf0e10cSrcweir void typereg_reader_getMethodExceptionTypeName(void * hEntry, rtl_uString** pMethodExcpType, sal_uInt16 index, sal_uInt16 excIndex)
1569*cdf0e10cSrcweir     SAL_THROW_EXTERN_C()
1570*cdf0e10cSrcweir {
1571*cdf0e10cSrcweir     TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
1572*cdf0e10cSrcweir 
1573*cdf0e10cSrcweir     if (pEntry == NULL)
1574*cdf0e10cSrcweir 	{
1575*cdf0e10cSrcweir 		rtl_uString_new(pMethodExcpType);
1576*cdf0e10cSrcweir 		return;
1577*cdf0e10cSrcweir 	}
1578*cdf0e10cSrcweir 
1579*cdf0e10cSrcweir     const sal_Char* pTmp = pEntry->m_pMethods->getMethodExcType(index, excIndex);
1580*cdf0e10cSrcweir     rtl_string2UString(
1581*cdf0e10cSrcweir         pMethodExcpType, pTmp, pTmp == 0 ? 0 : rtl_str_getLength(pTmp),
1582*cdf0e10cSrcweir         RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1583*cdf0e10cSrcweir }
1584*cdf0e10cSrcweir 
1585*cdf0e10cSrcweir void typereg_reader_getMethodReturnTypeName(void * hEntry, rtl_uString** pMethodReturnType, sal_uInt16 index)
1586*cdf0e10cSrcweir     SAL_THROW_EXTERN_C()
1587*cdf0e10cSrcweir {
1588*cdf0e10cSrcweir     TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
1589*cdf0e10cSrcweir 
1590*cdf0e10cSrcweir     if (pEntry == NULL)
1591*cdf0e10cSrcweir 	{
1592*cdf0e10cSrcweir 		rtl_uString_new(pMethodReturnType);
1593*cdf0e10cSrcweir 		return;
1594*cdf0e10cSrcweir 	}
1595*cdf0e10cSrcweir 
1596*cdf0e10cSrcweir     const sal_Char* pTmp = pEntry->m_pMethods->getMethodReturnType(index);
1597*cdf0e10cSrcweir     rtl_string2UString(
1598*cdf0e10cSrcweir         pMethodReturnType, pTmp, pTmp == 0 ? 0 : rtl_str_getLength(pTmp),
1599*cdf0e10cSrcweir         RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1600*cdf0e10cSrcweir }
1601*cdf0e10cSrcweir 
1602*cdf0e10cSrcweir RTMethodMode typereg_reader_getMethodFlags(void * hEntry, sal_uInt16 index)
1603*cdf0e10cSrcweir     SAL_THROW_EXTERN_C()
1604*cdf0e10cSrcweir {
1605*cdf0e10cSrcweir     TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
1606*cdf0e10cSrcweir 
1607*cdf0e10cSrcweir     if (pEntry == NULL) return RT_MODE_INVALID;
1608*cdf0e10cSrcweir 
1609*cdf0e10cSrcweir     return pEntry->m_pMethods->getMethodMode(index);
1610*cdf0e10cSrcweir }
1611*cdf0e10cSrcweir 
1612*cdf0e10cSrcweir void typereg_reader_getMethodDocumentation(void * hEntry, rtl_uString** pMethodDoku, sal_uInt16 index)
1613*cdf0e10cSrcweir     SAL_THROW_EXTERN_C()
1614*cdf0e10cSrcweir {
1615*cdf0e10cSrcweir     TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
1616*cdf0e10cSrcweir 
1617*cdf0e10cSrcweir     if (pEntry == NULL)
1618*cdf0e10cSrcweir 	{
1619*cdf0e10cSrcweir 		rtl_uString_new(pMethodDoku);
1620*cdf0e10cSrcweir 		return;
1621*cdf0e10cSrcweir 	}
1622*cdf0e10cSrcweir 
1623*cdf0e10cSrcweir     const sal_Char* pTmp = pEntry->m_pMethods->getMethodDoku(index);
1624*cdf0e10cSrcweir     rtl_string2UString(
1625*cdf0e10cSrcweir         pMethodDoku, pTmp, pTmp == 0 ? 0 : rtl_str_getLength(pTmp),
1626*cdf0e10cSrcweir         RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1627*cdf0e10cSrcweir }
1628*cdf0e10cSrcweir 
1629*cdf0e10cSrcweir sal_uInt16 typereg_reader_getReferenceCount(void * hEntry) SAL_THROW_EXTERN_C()
1630*cdf0e10cSrcweir {
1631*cdf0e10cSrcweir     TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
1632*cdf0e10cSrcweir 
1633*cdf0e10cSrcweir     if (pEntry == NULL) return 0;
1634*cdf0e10cSrcweir 
1635*cdf0e10cSrcweir     return pEntry->m_pReferences->m_numOfEntries;
1636*cdf0e10cSrcweir }
1637*cdf0e10cSrcweir 
1638*cdf0e10cSrcweir static sal_uInt32 TYPEREG_CALLTYPE getReferenceCount(TypeReaderImpl hEntry)
1639*cdf0e10cSrcweir {
1640*cdf0e10cSrcweir     return typereg_reader_getReferenceCount(hEntry);
1641*cdf0e10cSrcweir }
1642*cdf0e10cSrcweir 
1643*cdf0e10cSrcweir void typereg_reader_getReferenceTypeName(void * hEntry, rtl_uString** pReferenceName, sal_uInt16 index)
1644*cdf0e10cSrcweir     SAL_THROW_EXTERN_C()
1645*cdf0e10cSrcweir {
1646*cdf0e10cSrcweir     TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
1647*cdf0e10cSrcweir 
1648*cdf0e10cSrcweir     if (pEntry == NULL)
1649*cdf0e10cSrcweir 	{
1650*cdf0e10cSrcweir 		rtl_uString_new(pReferenceName);
1651*cdf0e10cSrcweir 		return;
1652*cdf0e10cSrcweir 	}
1653*cdf0e10cSrcweir 
1654*cdf0e10cSrcweir     const sal_Char* pTmp = pEntry->m_pReferences->getReferenceName(index);
1655*cdf0e10cSrcweir     rtl_string2UString(
1656*cdf0e10cSrcweir         pReferenceName, pTmp, pTmp == 0 ? 0 : rtl_str_getLength(pTmp),
1657*cdf0e10cSrcweir         RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1658*cdf0e10cSrcweir }
1659*cdf0e10cSrcweir 
1660*cdf0e10cSrcweir RTReferenceType typereg_reader_getReferenceSort(void * hEntry, sal_uInt16 index)
1661*cdf0e10cSrcweir     SAL_THROW_EXTERN_C()
1662*cdf0e10cSrcweir {
1663*cdf0e10cSrcweir     TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
1664*cdf0e10cSrcweir 
1665*cdf0e10cSrcweir     if (pEntry == NULL) return RT_REF_INVALID;
1666*cdf0e10cSrcweir 
1667*cdf0e10cSrcweir     return pEntry->m_pReferences->getReferenceType(index);
1668*cdf0e10cSrcweir }
1669*cdf0e10cSrcweir 
1670*cdf0e10cSrcweir void typereg_reader_getReferenceDocumentation(void * hEntry, rtl_uString** pReferenceDoku, sal_uInt16 index)
1671*cdf0e10cSrcweir     SAL_THROW_EXTERN_C()
1672*cdf0e10cSrcweir {
1673*cdf0e10cSrcweir     TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
1674*cdf0e10cSrcweir 
1675*cdf0e10cSrcweir     if (pEntry == NULL)
1676*cdf0e10cSrcweir 	{
1677*cdf0e10cSrcweir 		rtl_uString_new(pReferenceDoku);
1678*cdf0e10cSrcweir 		return;
1679*cdf0e10cSrcweir 	}
1680*cdf0e10cSrcweir 
1681*cdf0e10cSrcweir     const sal_Char* pTmp = pEntry->m_pReferences->getReferenceDoku(index);
1682*cdf0e10cSrcweir     rtl_string2UString(
1683*cdf0e10cSrcweir         pReferenceDoku, pTmp, pTmp == 0 ? 0 : rtl_str_getLength(pTmp),
1684*cdf0e10cSrcweir         RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1685*cdf0e10cSrcweir }
1686*cdf0e10cSrcweir 
1687*cdf0e10cSrcweir RTFieldAccess typereg_reader_getReferenceFlags(void * hEntry, sal_uInt16 index)
1688*cdf0e10cSrcweir     SAL_THROW_EXTERN_C()
1689*cdf0e10cSrcweir {
1690*cdf0e10cSrcweir     TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
1691*cdf0e10cSrcweir 
1692*cdf0e10cSrcweir     if (pEntry == NULL) return RT_ACCESS_INVALID;
1693*cdf0e10cSrcweir 
1694*cdf0e10cSrcweir     return pEntry->m_pReferences->getReferenceAccess(index);
1695*cdf0e10cSrcweir }
1696*cdf0e10cSrcweir 
1697*cdf0e10cSrcweir sal_uInt16 typereg_reader_getSuperTypeCount(void * hEntry)
1698*cdf0e10cSrcweir     SAL_THROW_EXTERN_C()
1699*cdf0e10cSrcweir {
1700*cdf0e10cSrcweir     TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
1701*cdf0e10cSrcweir 
1702*cdf0e10cSrcweir     if (pEntry == NULL) return 0;
1703*cdf0e10cSrcweir 
1704*cdf0e10cSrcweir     return pEntry->m_nSuperTypes;
1705*cdf0e10cSrcweir }
1706*cdf0e10cSrcweir 
1707*cdf0e10cSrcweir void typereg_reader_getSuperTypeName(
1708*cdf0e10cSrcweir     void * hEntry, rtl_uString ** pSuperTypeName, sal_uInt16 index)
1709*cdf0e10cSrcweir     SAL_THROW_EXTERN_C()
1710*cdf0e10cSrcweir {
1711*cdf0e10cSrcweir     TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
1712*cdf0e10cSrcweir 
1713*cdf0e10cSrcweir     if (pEntry == NULL)
1714*cdf0e10cSrcweir 	{
1715*cdf0e10cSrcweir 		rtl_uString_new(pSuperTypeName);
1716*cdf0e10cSrcweir 		return;
1717*cdf0e10cSrcweir 	}
1718*cdf0e10cSrcweir 
1719*cdf0e10cSrcweir     OSL_ASSERT(index < pEntry->m_nSuperTypes);
1720*cdf0e10cSrcweir     const sal_Char* pTmp = pEntry->m_pCP->readUTF8NameConstant(pEntry->readUINT16(pEntry->m_offset_SUPERTYPES + (index * sizeof(sal_uInt16))));
1721*cdf0e10cSrcweir     rtl_string2UString(
1722*cdf0e10cSrcweir         pSuperTypeName, pTmp, pTmp == 0 ? 0 : rtl_str_getLength(pTmp),
1723*cdf0e10cSrcweir         RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1724*cdf0e10cSrcweir }
1725*cdf0e10cSrcweir 
1726*cdf0e10cSrcweir RegistryTypeReader_Api* TYPEREG_CALLTYPE initRegistryTypeReader_Api(void)
1727*cdf0e10cSrcweir {
1728*cdf0e10cSrcweir     static RegistryTypeReader_Api aApi= {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
1729*cdf0e10cSrcweir     if (!aApi.acquire)
1730*cdf0e10cSrcweir     {
1731*cdf0e10cSrcweir         aApi.createEntry            = &createEntry;
1732*cdf0e10cSrcweir         aApi.acquire                = &typereg_reader_acquire;
1733*cdf0e10cSrcweir         aApi.release                = &typereg_reader_release;
1734*cdf0e10cSrcweir         aApi.getMinorVersion        = &getMinorVersion;
1735*cdf0e10cSrcweir         aApi.getMajorVersion        = &getMajorVersion;
1736*cdf0e10cSrcweir         aApi.getTypeClass           = &typereg_reader_getTypeClass;
1737*cdf0e10cSrcweir         aApi.getTypeName            = &typereg_reader_getTypeName;
1738*cdf0e10cSrcweir         aApi.getSuperTypeName       = &getSuperTypeName;
1739*cdf0e10cSrcweir         aApi.getUik                 = &getUik;
1740*cdf0e10cSrcweir         aApi.getDoku                = &typereg_reader_getDocumentation;
1741*cdf0e10cSrcweir         aApi.getFileName            = &typereg_reader_getFileName;
1742*cdf0e10cSrcweir         aApi.getFieldCount          = &getFieldCount;
1743*cdf0e10cSrcweir         aApi.getFieldName           = &typereg_reader_getFieldName;
1744*cdf0e10cSrcweir         aApi.getFieldType           = &typereg_reader_getFieldTypeName;
1745*cdf0e10cSrcweir         aApi.getFieldAccess         = &typereg_reader_getFieldFlags;
1746*cdf0e10cSrcweir         aApi.getFieldConstValue     = &getFieldConstValue;
1747*cdf0e10cSrcweir         aApi.getFieldDoku           = &typereg_reader_getFieldDocumentation;
1748*cdf0e10cSrcweir         aApi.getFieldFileName       = &typereg_reader_getFieldFileName;
1749*cdf0e10cSrcweir         aApi.getMethodCount         = &getMethodCount;
1750*cdf0e10cSrcweir         aApi.getMethodName          = &typereg_reader_getMethodName;
1751*cdf0e10cSrcweir         aApi.getMethodParamCount    = &getMethodParamCount;
1752*cdf0e10cSrcweir         aApi.getMethodParamType = &typereg_reader_getMethodParameterTypeName;
1753*cdf0e10cSrcweir         aApi.getMethodParamName     = &typereg_reader_getMethodParameterName;
1754*cdf0e10cSrcweir         aApi.getMethodParamMode     = &typereg_reader_getMethodParameterFlags;
1755*cdf0e10cSrcweir         aApi.getMethodExcCount      = &getMethodExcCount;
1756*cdf0e10cSrcweir         aApi.getMethodExcType = &typereg_reader_getMethodExceptionTypeName;
1757*cdf0e10cSrcweir         aApi.getMethodReturnType    = &typereg_reader_getMethodReturnTypeName;
1758*cdf0e10cSrcweir         aApi.getMethodMode          = &typereg_reader_getMethodFlags;
1759*cdf0e10cSrcweir         aApi.getMethodDoku          = &typereg_reader_getMethodDocumentation;
1760*cdf0e10cSrcweir         aApi.getReferenceCount      = &getReferenceCount;
1761*cdf0e10cSrcweir         aApi.getReferenceName       = &typereg_reader_getReferenceTypeName;
1762*cdf0e10cSrcweir         aApi.getReferenceType       = &typereg_reader_getReferenceSort;
1763*cdf0e10cSrcweir         aApi.getReferenceDoku       = &typereg_reader_getReferenceDocumentation;
1764*cdf0e10cSrcweir         aApi.getReferenceAccess     = &typereg_reader_getReferenceFlags;
1765*cdf0e10cSrcweir 
1766*cdf0e10cSrcweir         return (&aApi);
1767*cdf0e10cSrcweir     }
1768*cdf0e10cSrcweir     else
1769*cdf0e10cSrcweir     {
1770*cdf0e10cSrcweir         return (&aApi);
1771*cdf0e10cSrcweir     }
1772*cdf0e10cSrcweir }
1773*cdf0e10cSrcweir 
1774*cdf0e10cSrcweir }
1775