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