28 #include <osl/endian.h>
29 #include <osl/diagnose.h>
43 const sal_uInt32
magic = 0x12345678;
60 struct BoundsError {};
63 sal_uInt32 m_bufferLen;
65 BlopObject(
const sal_uInt8* buffer, sal_uInt32 len);
70 if (index >= m_bufferLen) {
73 return m_pBuffer[index];
76 sal_Int16 readINT16(sal_uInt32 index)
const
78 if (m_bufferLen < 2 || index >= m_bufferLen - 1) {
81 return ((m_pBuffer[index] << 8) | (m_pBuffer[index+1] << 0));
86 if (m_bufferLen < 2 || index >= m_bufferLen - 1) {
89 return ((m_pBuffer[index] << 8) | (m_pBuffer[index+1] << 0));
92 sal_Int32
readINT32(sal_uInt32 index)
const
94 if (m_bufferLen < 4 || index >= m_bufferLen - 3) {
98 (m_pBuffer[index] << 24) |
99 (m_pBuffer[index+1] << 16) |
100 (m_pBuffer[index+2] << 8) |
101 (m_pBuffer[index+3] << 0)
107 if (m_bufferLen < 4 || index >= m_bufferLen - 3) {
111 (m_pBuffer[index] << 24) |
112 (m_pBuffer[index+1] << 16) |
113 (m_pBuffer[index+2] << 8) |
114 (m_pBuffer[index+3] << 0)
118 sal_Int64 readINT64(sal_uInt32 index)
const
120 if (m_bufferLen < 8 || index >= m_bufferLen - 7) {
124 (static_cast<sal_Int64>(m_pBuffer[index]) << 56) |
125 (static_cast<sal_Int64>(m_pBuffer[index+1]) << 48) |
126 (static_cast<sal_Int64>(m_pBuffer[index+2]) << 40) |
127 (static_cast<sal_Int64>(m_pBuffer[index+3]) << 32) |
128 (static_cast<sal_Int64>(m_pBuffer[index+4]) << 24) |
129 (static_cast<sal_Int64>(m_pBuffer[index+5]) << 16) |
130 (static_cast<sal_Int64>(m_pBuffer[index+6]) << 8) |
131 (static_cast<sal_Int64>(m_pBuffer[index+7]) << 0)
135 sal_uInt64 readUINT64(sal_uInt32 index)
const
137 if (m_bufferLen < 8 || index >= m_bufferLen - 7) {
141 (static_cast<sal_uInt64>(m_pBuffer[index]) << 56) |
142 (static_cast<sal_uInt64>(m_pBuffer[index+1]) << 48) |
143 (static_cast<sal_uInt64>(m_pBuffer[index+2]) << 40) |
144 (static_cast<sal_uInt64>(m_pBuffer[index+3]) << 32) |
145 (static_cast<sal_uInt64>(m_pBuffer[index+4]) << 24) |
146 (static_cast<sal_uInt64>(m_pBuffer[index+5]) << 16) |
147 (static_cast<sal_uInt64>(m_pBuffer[index+6]) << 8) |
148 (static_cast<sal_uInt64>(m_pBuffer[index+7]) << 0)
155 BlopObject::BlopObject(
const sal_uInt8* buffer, sal_uInt32 len)
172 std::vector<std::unique_ptr<sal_Unicode[]>> m_stringTable;
173 sal_uInt16 m_stringsCopied;
175 explicit StringCache(sal_uInt16 size);
178 sal_uInt16 createString(
const sal_uInt8* buffer);
183 StringCache::StringCache(sal_uInt16 size)
184 : m_stringTable(size)
189 const sal_Unicode* StringCache::getString(sal_uInt16 index)
const
191 if ((index > 0) && (index <= m_stringsCopied))
192 return m_stringTable[index - 1].get();
197 sal_uInt16 StringCache::createString(
const sal_uInt8* buffer)
199 if (m_stringsCopied < m_stringTable.size())
203 m_stringTable[m_stringsCopied].reset(
new sal_Unicode[len + 1] );
207 return ++m_stringsCopied;
221 class ConstantPool :
public BlopObject
225 sal_uInt16 m_numOfEntries;
226 std::unique_ptr<sal_Int32[]> m_pIndex;
228 std::unique_ptr<StringCache> m_pStringCache;
230 ConstantPool(
const sal_uInt8* buffer, sal_uInt32 len, sal_uInt16 numEntries)
231 : BlopObject(buffer, len)
232 , m_numOfEntries(numEntries)
236 sal_uInt32 parseIndex();
238 CPInfoTag readTag(sal_uInt16 index)
const;
240 const char* readUTF8NameConstant(sal_uInt16 index)
const;
241 bool readBOOLConstant(sal_uInt16 index)
const;
242 sal_Int8 readBYTEConstant(sal_uInt16 index)
const;
243 sal_Int16 readINT16Constant(sal_uInt16 index)
const;
244 sal_uInt16 readUINT16Constant(sal_uInt16 index)
const;
245 sal_Int32 readINT32Constant(sal_uInt16 index)
const;
246 sal_uInt32 readUINT32Constant(sal_uInt16 index)
const;
247 sal_Int64 readINT64Constant(sal_uInt16 index)
const;
248 sal_uInt64 readUINT64Constant(sal_uInt16 index)
const;
249 float readFloatConstant(sal_uInt16 index)
const;
250 double readDoubleConstant(sal_uInt16 index)
const;
251 const sal_Unicode* readStringConstant(sal_uInt16 index)
const;
257 sal_uInt32 ConstantPool::parseIndex()
260 m_pStringCache.reset();
262 sal_uInt32 offset = 0;
263 sal_uInt16 numOfStrings = 0;
267 m_pIndex.reset(
new sal_Int32[m_numOfEntries] );
269 for (
int i = 0;
i < m_numOfEntries;
i++)
271 m_pIndex[
i] = offset;
286 m_pStringCache.reset(
new StringCache(numOfStrings) );
289 m_bufferLen = offset;
294 CPInfoTag ConstantPool::readTag(sal_uInt16 index)
const
298 if (m_pIndex && (index > 0) && (index <= m_numOfEntries))
306 const char* ConstantPool::readUTF8NameConstant(sal_uInt16 index)
const
310 if (m_pIndex && (index > 0) && (index <= m_numOfEntries))
316 && std::memchr(m_pBuffer + n, 0, m_bufferLen - n) !=
nullptr)
318 aName =
reinterpret_cast<const char*
>(
m_pBuffer + n);
326 bool ConstantPool::readBOOLConstant(sal_uInt16 index)
const
330 if (m_pIndex && (index> 0) && (index <= m_numOfEntries))
341 sal_Int8 ConstantPool::readBYTEConstant(sal_uInt16 index)
const
345 if (m_pIndex && (index> 0) && (index <= m_numOfEntries))
357 sal_Int16 ConstantPool::readINT16Constant(sal_uInt16 index)
const
359 sal_Int16 aINT16 = 0;
361 if (m_pIndex && (index> 0) && (index <= m_numOfEntries))
372 sal_uInt16 ConstantPool::readUINT16Constant(sal_uInt16 index)
const
374 sal_uInt16 asal_uInt16 = 0;
376 if (m_pIndex && (index> 0) && (index <= m_numOfEntries))
387 sal_Int32 ConstantPool::readINT32Constant(sal_uInt16 index)
const
389 sal_Int32 aINT32 = 0;
391 if (m_pIndex && (index> 0) && (index <= m_numOfEntries))
402 sal_uInt32 ConstantPool::readUINT32Constant(sal_uInt16 index)
const
404 sal_uInt32 aUINT32 = 0;
406 if (m_pIndex && (index> 0) && (index <= m_numOfEntries))
417 sal_Int64 ConstantPool::readINT64Constant(sal_uInt16 index)
const
419 sal_Int64 aINT64 = 0;
421 if (m_pIndex && (index> 0) && (index <= m_numOfEntries))
432 sal_uInt64 ConstantPool::readUINT64Constant(sal_uInt16 index)
const
434 sal_uInt64 aUINT64 = 0;
436 if (m_pIndex && (index> 0) && (index <= m_numOfEntries))
447 float ConstantPool::readFloatConstant(sal_uInt16 index)
const
455 if (m_pIndex && (index> 0) && (index <= m_numOfEntries))
459 #ifdef REGTYPE_IEEE_NATIVE
470 double ConstantPool::readDoubleConstant(sal_uInt16 index)
const
482 if (m_pIndex && (index> 0) && (index <= m_numOfEntries))
487 #ifdef REGTYPE_IEEE_NATIVE
488 # ifdef OSL_BIGENDIAN
504 const sal_Unicode* ConstantPool::readStringConstant(sal_uInt16 index)
const
508 if (m_pIndex && (index> 0) && (index <= m_numOfEntries) && m_pStringCache)
510 if (m_pIndex[index - 1] >= 0)
518 || (std::memchr(m_pBuffer + n, 0, m_bufferLen - n)
523 m_pIndex[index - 1] = -1 * m_pStringCache->createString(m_pBuffer + n);
527 aString = m_pStringCache->getString(static_cast<sal_uInt16>(m_pIndex[index - 1] * -1));
541 class FieldList :
public BlopObject
545 sal_uInt16 m_numOfEntries;
546 size_t m_FIELD_ENTRY_SIZE;
549 FieldList(
const sal_uInt8* buffer, sal_uInt32 len, sal_uInt16 numEntries, ConstantPool* pCP)
550 : BlopObject(buffer, len)
551 , m_numOfEntries(numEntries)
554 if ( m_numOfEntries > 0 )
557 m_FIELD_ENTRY_SIZE = numOfFieldEntries *
sizeof(sal_uInt16);
560 m_FIELD_ENTRY_SIZE = 0;
564 sal_uInt32 parseIndex()
const {
return ((m_numOfEntries ?
sizeof(sal_uInt16) : 0) + (m_numOfEntries * m_FIELD_ENTRY_SIZE));}
571 const char* getFieldDoku(sal_uInt16 index)
const;
572 const char* getFieldFileName(sal_uInt16 index)
const;
577 const char* FieldList::getFieldName(sal_uInt16 index)
const
579 const char* aName =
nullptr;
581 if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
585 }
catch (BlopObject::BoundsError &) {
593 const char* FieldList::getFieldType(sal_uInt16 index)
const
595 const char* aName =
nullptr;
597 if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
601 }
catch (BlopObject::BoundsError &) {
609 RTFieldAccess FieldList::getFieldAccess(sal_uInt16 index)
const
613 if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
617 }
catch (BlopObject::BoundsError &) {
629 if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
632 switch (m_pCP->readTag(cpIndex))
635 value->
aBool = m_pCP->readBOOLConstant(cpIndex);
639 value->
aByte = m_pCP->readBYTEConstant(cpIndex);
643 value->
aShort = m_pCP->readINT16Constant(cpIndex);
647 value->
aUShort = m_pCP->readUINT16Constant(cpIndex);
651 value->
aLong = m_pCP->readINT32Constant(cpIndex);
655 value->
aULong = m_pCP->readUINT32Constant(cpIndex);
659 value->
aHyper = m_pCP->readINT64Constant(cpIndex);
663 value->
aUHyper = m_pCP->readUINT64Constant(cpIndex);
667 value->
aFloat = m_pCP->readFloatConstant(cpIndex);
671 value->
aDouble = m_pCP->readDoubleConstant(cpIndex);
675 value->
aString = m_pCP->readStringConstant(cpIndex);
682 }
catch (BlopObject::BoundsError &) {
688 const char* FieldList::getFieldDoku(sal_uInt16 index)
const
690 const char* aDoku =
nullptr;
692 if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
696 }
catch (BlopObject::BoundsError &) {
704 const char* FieldList::getFieldFileName(sal_uInt16 index)
const
706 const char* aFileName =
nullptr;
708 if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
712 }
catch (BlopObject::BoundsError &) {
728 class ReferenceList :
public BlopObject
732 sal_uInt16 m_numOfEntries;
733 size_t m_REFERENCE_ENTRY_SIZE;
736 ReferenceList(
const sal_uInt8* buffer, sal_uInt32 len, sal_uInt16 numEntries, ConstantPool* pCP)
737 : BlopObject(buffer, len)
738 , m_numOfEntries(numEntries)
741 if ( m_numOfEntries > 0 )
743 sal_uInt16 numOfReferenceEntries =
readUINT16(0);
744 m_REFERENCE_ENTRY_SIZE = numOfReferenceEntries *
sizeof(sal_uInt16);
747 m_REFERENCE_ENTRY_SIZE = 0;
751 const char* getReferenceName(sal_uInt16 index)
const;
753 const char* getReferenceDoku(sal_uInt16 index)
const;
759 const char* ReferenceList::getReferenceName(sal_uInt16 index)
const
761 const char* aName =
nullptr;
763 if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
767 }
catch (BlopObject::BoundsError &) {
775 RTReferenceType ReferenceList::getReferenceType(sal_uInt16 index)
const
779 if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
783 }
catch (BlopObject::BoundsError &) {
791 const char* ReferenceList::getReferenceDoku(sal_uInt16 index)
const
793 const char* aDoku =
nullptr;
795 if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
799 }
catch (BlopObject::BoundsError &) {
807 RTFieldAccess ReferenceList::getReferenceAccess(sal_uInt16 index)
const
811 if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
815 }
catch (BlopObject::BoundsError &) {
831 class MethodList :
public BlopObject
835 sal_uInt16 m_numOfEntries;
836 size_t m_PARAM_ENTRY_SIZE;
837 std::unique_ptr<sal_uInt32[]> m_pIndex;
840 MethodList(
const sal_uInt8* buffer, sal_uInt32 len, sal_uInt16 numEntries, ConstantPool* pCP)
841 : BlopObject(buffer, len)
842 , m_numOfEntries(numEntries)
845 if ( m_numOfEntries > 0 )
848 sal_uInt16 numOfParamEntries =
readUINT16(
sizeof(sal_uInt16));
849 m_PARAM_ENTRY_SIZE = numOfParamEntries *
sizeof(sal_uInt16);
852 m_PARAM_ENTRY_SIZE = 0;
856 sal_uInt32 parseIndex();
858 const char* getMethodName(sal_uInt16 index)
const;
859 sal_uInt16 getMethodParamCount(sal_uInt16 index)
const;
860 const char* getMethodParamType(sal_uInt16 index, sal_uInt16 paramIndex)
const;
861 const char* getMethodParamName(sal_uInt16 index, sal_uInt16 paramIndex)
const;
862 RTParamMode getMethodParamMode(sal_uInt16 index, sal_uInt16 paramIndex)
const;
863 sal_uInt16 getMethodExcCount(sal_uInt16 index)
const;
864 const char* getMethodExcType(sal_uInt16 index, sal_uInt16 excIndex)
const;
865 const char* getMethodReturnType(sal_uInt16 index)
const;
867 const char* getMethodDoku(sal_uInt16 index)
const;
870 sal_uInt16 calcMethodParamIndex(
const sal_uInt16 index )
const;
875 sal_uInt16 MethodList::calcMethodParamIndex(
const sal_uInt16 index )
const
880 sal_uInt32 MethodList::parseIndex()
884 sal_uInt32 offset = 0;
888 offset = 2 *
sizeof(sal_uInt16);
889 m_pIndex.reset(
new sal_uInt32[m_numOfEntries] );
891 for (
int i = 0;
i < m_numOfEntries;
i++)
893 m_pIndex[
i] = offset;
902 const char* MethodList::getMethodName(sal_uInt16 index)
const
904 const char* aName =
nullptr;
906 if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
910 }
catch (BlopObject::BoundsError &) {
918 sal_uInt16 MethodList::getMethodParamCount(sal_uInt16 index)
const
920 sal_uInt16 aCount = 0;
922 if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
926 }
catch (BlopObject::BoundsError &) {
934 const char* MethodList::getMethodParamType(sal_uInt16 index, sal_uInt16 paramIndex)
const
936 const char* aName =
nullptr;
938 if ((m_numOfEntries > 0) &&
939 (index <= m_numOfEntries) &&
942 aName = m_pCP->readUTF8NameConstant(
945 calcMethodParamIndex(paramIndex) +
948 }
catch (BlopObject::BoundsError &) {
954 const char* MethodList::getMethodParamName(sal_uInt16 index, sal_uInt16 paramIndex)
const
956 const char* aName =
nullptr;
958 if ((m_numOfEntries > 0) &&
959 (index <= m_numOfEntries) &&
962 aName = m_pCP->readUTF8NameConstant(
965 calcMethodParamIndex(paramIndex) +
968 }
catch (BlopObject::BoundsError &) {
974 RTParamMode MethodList::getMethodParamMode(sal_uInt16 index, sal_uInt16 paramIndex)
const
978 if ((m_numOfEntries > 0) &&
979 (index <= m_numOfEntries) &&
984 calcMethodParamIndex(paramIndex) +
987 }
catch (BlopObject::BoundsError &) {
993 #if defined(__COVERITY__)
994 extern "C" void __coverity_tainted_data_sanitize__(
void *);
997 sal_uInt16 MethodList::getMethodExcCount(sal_uInt16 index)
const
999 sal_uInt16 aCount = 0;
1001 if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
1005 #if defined(__COVERITY__)
1006 __coverity_tainted_data_sanitize__(&aCount);
1008 }
catch (BlopObject::BoundsError &) {
1016 const char* MethodList::getMethodExcType(sal_uInt16 index, sal_uInt16 excIndex)
const
1018 const char* aName =
nullptr;
1020 if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
1026 aName = m_pCP->readUTF8NameConstant(
1029 sizeof(sal_uInt16) +
1030 (excIndex *
sizeof(sal_uInt16))));
1032 }
catch (BlopObject::BoundsError &) {
1040 const char* MethodList::getMethodReturnType(sal_uInt16 index)
const
1042 const char* aName =
nullptr;
1044 if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
1048 }
catch (BlopObject::BoundsError &) {
1056 RTMethodMode MethodList::getMethodMode(sal_uInt16 index)
const
1060 if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
1064 }
catch (BlopObject::BoundsError &) {
1072 const char* MethodList::getMethodDoku(sal_uInt16 index)
const
1074 const char* aDoku =
nullptr;
1076 if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
1080 }
catch (BlopObject::BoundsError &) {
1096 class TypeRegistryEntry:
public BlopObject {
1098 std::unique_ptr<ConstantPool> m_pCP;
1099 std::unique_ptr<FieldList> m_pFields;
1100 std::unique_ptr<MethodList> m_pMethods;
1101 std::unique_ptr<ReferenceList> m_pReferences;
1103 sal_uInt16 m_nSuperTypes;
1104 sal_uInt32 m_offset_SUPERTYPES;
1107 const sal_uInt8* buffer, sal_uInt32 len);
1115 TypeRegistryEntry::TypeRegistryEntry(
1116 const sal_uInt8* buffer, sal_uInt32 len):
1117 BlopObject(buffer, len),
m_refCount(1), m_nSuperTypes(0),
1118 m_offset_SUPERTYPES(0)
1120 std::size_t
const entrySize =
sizeof(sal_uInt16);
1122 sal_uInt32 offset_N_SUPERTYPES =
OFFSET_N_ENTRIES + entrySize + (nHeaderEntries * entrySize);
1123 m_offset_SUPERTYPES = offset_N_SUPERTYPES + entrySize;
1124 m_nSuperTypes =
readUINT16(offset_N_SUPERTYPES);
1126 sal_uInt32 offset_CP_SIZE = m_offset_SUPERTYPES + (m_nSuperTypes * entrySize);
1127 sal_uInt32 offset_CP = offset_CP_SIZE + entrySize;
1129 if (offset_CP > m_bufferLen) {
1130 throw BoundsError();
1134 m_pBuffer + offset_CP, m_bufferLen - offset_CP,
1137 sal_uInt32 offset = offset_CP + m_pCP->parseIndex();
1139 assert(m_bufferLen >= entrySize);
1140 if (offset > m_bufferLen - entrySize) {
1141 throw BoundsError();
1145 m_pBuffer + offset + entrySize, m_bufferLen - (offset + entrySize),
1148 offset +=
sizeof(sal_uInt16) + m_pFields->parseIndex();
1150 assert(m_bufferLen >= entrySize);
1151 if (offset > m_bufferLen - entrySize) {
1152 throw BoundsError();
1156 m_pBuffer + offset + entrySize, m_bufferLen - (offset + entrySize),
1159 offset +=
sizeof(sal_uInt16) + m_pMethods->parseIndex();
1161 assert(m_bufferLen >= entrySize);
1162 if (offset > m_bufferLen - entrySize) {
1163 throw BoundsError();
1165 m_pReferences.reset(
1167 m_pBuffer + offset + entrySize, m_bufferLen - (offset + entrySize),
1183 void const * buffer, sal_uInt32 length,
1190 std::unique_ptr< TypeRegistryEntry > entry;
1194 new TypeRegistryEntry(
1195 static_cast< sal_uInt8 const * >(buffer), length));
1196 }
catch (std::bad_alloc &) {
1208 *result = entry.release();
1210 }
catch (BlopObject::BoundsError &) {
1225 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1227 if (pEntry !=
nullptr)
1228 pEntry->m_refCount++;
1233 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1235 if (pEntry !=
nullptr)
1237 if (--pEntry->m_refCount == 0)
1243 if (handle !=
nullptr) {
1245 return static_cast< TypeRegistryEntry
const *
>(handle)->getVersion();
1246 }
catch (BlopObject::BoundsError &) {
1255 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1256 if (pEntry !=
nullptr) {
1259 }
catch (BlopObject::BoundsError &) {
1268 TypeRegistryEntry * entry =
static_cast< TypeRegistryEntry *
>(hEntry);
1269 if (entry !=
nullptr) {
1272 }
catch (BlopObject::BoundsError &) {
1281 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1282 if (pEntry !=
nullptr) {
1284 const char* pTmp = pEntry->m_pCP->readUTF8NameConstant(pEntry->readUINT16(
OFFSET_THIS_TYPE));
1286 pTypeName, pTmp, pTmp ==
nullptr ? 0 : rtl_str_getLength(pTmp),
1287 RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1289 }
catch (BlopObject::BoundsError &) {
1293 rtl_uString_new(pTypeName);
1299 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1300 if (pEntry !=
nullptr && pEntry->m_nSuperTypes != 0) {
1302 const char* pTmp = pEntry->m_pCP->readUTF8NameConstant(pEntry->readUINT16(pEntry->m_offset_SUPERTYPES ));
1304 pSuperTypeName, pTmp, pTmp ==
nullptr ? 0 : rtl_str_getLength(pTmp),
1305 RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1307 }
catch (BlopObject::BoundsError &) {
1311 rtl_uString_new(pSuperTypeName);
1316 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1317 if (pEntry !=
nullptr) {
1319 const char* pTmp = pEntry->m_pCP->readUTF8NameConstant(pEntry->readUINT16(
OFFSET_DOKU));
1321 pDoku, pTmp, pTmp ==
nullptr ? 0 : rtl_str_getLength(pTmp),
1322 RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1324 }
catch (BlopObject::BoundsError &) {
1328 rtl_uString_new(pDoku);
1333 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1334 if (pEntry !=
nullptr) {
1336 const char* pTmp = pEntry->m_pCP->readUTF8NameConstant(pEntry->readUINT16(
OFFSET_FILENAME));
1338 pFileName, pTmp, pTmp ==
nullptr ? 0 : rtl_str_getLength(pTmp),
1339 RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1341 }
catch (BlopObject::BoundsError &) {
1345 rtl_uString_new(pFileName);
1351 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1353 if (pEntry ==
nullptr)
return 0;
1355 return pEntry->m_pFields->m_numOfEntries;
1365 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1367 if (pEntry ==
nullptr)
1369 rtl_uString_new(pFieldName);
1372 const char* pTmp = pEntry->m_pFields->getFieldName(index);
1374 pFieldName, pTmp, pTmp ==
nullptr ? 0 : rtl_str_getLength(pTmp),
1375 RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1380 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1382 if (pEntry ==
nullptr)
1384 rtl_uString_new(pFieldType);
1388 const char* pTmp = pEntry->m_pFields->getFieldType(index);
1390 pFieldType, pTmp, pTmp ==
nullptr ? 0 : rtl_str_getLength(pTmp),
1391 RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1396 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1400 return pEntry->m_pFields->getFieldAccess(index);
1404 void * hEntry, sal_uInt16 index,
RTValueType * type,
1407 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1409 if (pEntry ==
nullptr) {
1415 *type = pEntry->m_pFields->getFieldConstValue(index, value);
1416 }
catch (std::bad_alloc &) {
1431 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1433 if (pEntry ==
nullptr)
1435 rtl_uString_new(pDoku);
1439 const char* pTmp = pEntry->m_pFields->getFieldDoku(index);
1441 pDoku, pTmp, pTmp ==
nullptr ? 0 : rtl_str_getLength(pTmp),
1442 RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1447 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1449 if (pEntry ==
nullptr)
1451 rtl_uString_new(pFieldFileName);
1455 const char* pTmp = pEntry->m_pFields->getFieldFileName(index);
1457 pFieldFileName, pTmp, pTmp ==
nullptr ? 0 : rtl_str_getLength(pTmp),
1458 RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1464 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1466 if (pEntry ==
nullptr)
return 0;
1468 return pEntry->m_pMethods->m_numOfEntries;
1473 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1475 if (pEntry ==
nullptr)
1477 rtl_uString_new(pMethodName);
1481 const char* pTmp = pEntry->m_pMethods->getMethodName(index);
1483 pMethodName, pTmp, pTmp ==
nullptr ? 0 : rtl_str_getLength(pTmp),
1484 RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1488 void * hEntry, sal_uInt16 index)
1490 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1492 if (pEntry ==
nullptr)
return 0;
1494 return pEntry->m_pMethods->getMethodParamCount(index);
1499 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1501 if (pEntry ==
nullptr)
1503 rtl_uString_new(pMethodParamType);
1507 const char* pTmp = pEntry->m_pMethods->getMethodParamType(index, paramIndex);
1509 pMethodParamType, pTmp, pTmp ==
nullptr ? 0 : rtl_str_getLength(pTmp),
1510 RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1515 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1517 if (pEntry ==
nullptr)
1519 rtl_uString_new(pMethodParamName);
1523 const char* pTmp = pEntry->m_pMethods->getMethodParamName(index, paramIndex);
1525 pMethodParamName, pTmp, pTmp ==
nullptr ? 0 : rtl_str_getLength(pTmp),
1526 RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1531 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1535 return pEntry->m_pMethods->getMethodParamMode(index, paramIndex);
1539 void * hEntry, sal_uInt16 index)
1541 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1543 if (pEntry ==
nullptr)
return 0;
1545 return pEntry->m_pMethods->getMethodExcCount(index);
1550 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1552 if (pEntry ==
nullptr)
1554 rtl_uString_new(pMethodExcpType);
1558 const char* pTmp = pEntry->m_pMethods->getMethodExcType(index, excIndex);
1560 pMethodExcpType, pTmp, pTmp ==
nullptr ? 0 : rtl_str_getLength(pTmp),
1561 RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1566 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1568 if (pEntry ==
nullptr)
1570 rtl_uString_new(pMethodReturnType);
1574 const char* pTmp = pEntry->m_pMethods->getMethodReturnType(index);
1576 pMethodReturnType, pTmp, pTmp ==
nullptr ? 0 : rtl_str_getLength(pTmp),
1577 RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1582 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1586 return pEntry->m_pMethods->getMethodMode(index);
1591 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1593 if (pEntry ==
nullptr)
1595 rtl_uString_new(pMethodDoku);
1599 const char* pTmp = pEntry->m_pMethods->getMethodDoku(index);
1601 pMethodDoku, pTmp, pTmp ==
nullptr ? 0 : rtl_str_getLength(pTmp),
1602 RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1607 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1609 if (pEntry ==
nullptr)
return 0;
1611 return pEntry->m_pReferences->m_numOfEntries;
1616 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1618 if (pEntry ==
nullptr)
1620 rtl_uString_new(pReferenceName);
1624 const char* pTmp = pEntry->m_pReferences->getReferenceName(index);
1626 pReferenceName, pTmp, pTmp ==
nullptr ? 0 : rtl_str_getLength(pTmp),
1627 RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1632 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1636 return pEntry->m_pReferences->getReferenceType(index);
1641 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1643 if (pEntry ==
nullptr)
1645 rtl_uString_new(pReferenceDoku);
1649 const char* pTmp = pEntry->m_pReferences->getReferenceDoku(index);
1651 pReferenceDoku, pTmp, pTmp ==
nullptr ? 0 : rtl_str_getLength(pTmp),
1652 RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1657 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1661 return pEntry->m_pReferences->getReferenceAccess(index);
1666 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1668 if (pEntry ==
nullptr)
return 0;
1670 return pEntry->m_nSuperTypes;
1674 void * hEntry, rtl_uString ** pSuperTypeName, sal_uInt16 index)
1676 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1677 if (pEntry !=
nullptr) {
1679 OSL_ASSERT(index < pEntry->m_nSuperTypes);
1680 const char* pTmp = pEntry->m_pCP->readUTF8NameConstant(pEntry->readUINT16(pEntry->m_offset_SUPERTYPES + (index *
sizeof(sal_uInt16))));
1682 pSuperTypeName, pTmp, pTmp ==
nullptr ? 0 : rtl_str_getLength(pTmp),
1683 RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1685 }
catch (BlopObject::BoundsError &) {
1689 rtl_uString_new(pSuperTypeName);
1693 sal_uInt32 bufferLen)
void TYPEREG_CALLTYPE typereg_reader_release(void *hEntry)
Decrements the reference count of a type reader.
static RTValueType TYPEREG_CALLTYPE getFieldConstValue(TypeReaderImpl hEntry, sal_uInt16 index, RTConstValueUnion *value)
#define FIELD_OFFSET_TYPE
sal_uInt16 TYPEREG_CALLTYPE typereg_reader_getFieldCount(void *hEntry)
Returns the number of fields of a type reader.
RTParamMode
specifies the mode of a parameter.
indicates an invalid parameter mode
const char NULL_STRING[1]
const sal_uInt16 minorVersion
void * TypeReaderImpl
Implementation handle.
#define PARAM_OFFSET_TYPE
OUString getFieldName(guint nCol)
RTReferenceType
specifies the type of a reference used in a service description.
#define METHOD_OFFSET_PARAM_COUNT
OUString getFieldFileName(sal_uInt16 index) const
returns the IDL filename of the field specified by index.
RTConstValue getFieldConstValue(sal_uInt16 index) const
returns the value of the field specified by index.
static TypeReaderImpl TYPEREG_CALLTYPE createEntry(const sal_uInt8 *buffer, sal_uInt32 len)
RTValueType m_type
stores the type of the constant value.
RTMethodMode TYPEREG_CALLTYPE typereg_reader_getMethodFlags(void *hEntry, sal_uInt16 index)
Returns the flags of a method of a type reader.
OUString getFieldDoku(sal_uInt16 index) const
returns the documentation string for the field specified by index.
#define FIELD_OFFSET_VALUE
const sal_uInt16 majorVersion
#define PARAM_OFFSET_MODE
sal_uInt8 m_pBuffer[RTL_DIGEST_LENGTH_SHA1]
void TYPEREG_CALLTYPE typereg_reader_getMethodDocumentation(void *hEntry, rtl_uString **pMethodDoku, sal_uInt16 index)
Returns the documentation of a method of a type reader.
bool TYPEREG_CALLTYPE typereg_reader_getFieldValue(void *hEntry, sal_uInt16 index, RTValueType *type, RTConstValueUnion *value)
Returns the value of a field of a type reader.
static sal_uInt32 TYPEREG_CALLTYPE getFieldCount(TypeReaderImpl hEntry)
#define METHOD_OFFSET_RETURN
sal_uInt16 TYPEREG_CALLTYPE typereg_reader_getMethodParameterCount(void *hEntry, sal_uInt16 index)
Returns the number of parameters of a method of a type reader.
void TYPEREG_CALLTYPE typereg_reader_getFileName(void *hEntry, rtl_uString **pFileName)
Returns the file name of a type reader.
OUString getFieldName(sal_uInt16 index) const
returns the name of the field specified by index.
#define REFERENCE_OFFSET_TYPE
void TYPEREG_CALLTYPE typereg_reader_getReferenceDocumentation(void *hEntry, rtl_uString **pReferenceDoku, sal_uInt16 index)
Returns the documentation of a reference of a type reader.
indicates an invalid mode
RTFieldAccess TYPEREG_CALLTYPE typereg_reader_getFieldFlags(void *hEntry, sal_uInt16 index)
Returns the flags of a field of a type reader.
OUString getSuperTypeName() const
returns the full qualified name of the supertype.
#define METHOD_OFFSET_MODE
bool TYPEREG_CALLTYPE typereg_reader_isPublished(void *hEntry)
Returns whether a type reader is published.
void TYPEREG_CALLTYPE typereg_reader_getFieldDocumentation(void *hEntry, rtl_uString **pDoku, sal_uInt16 index)
Returns the documentation of a field of a type reader.
sal_uInt32 readUINT32(const sal_uInt8 *buffer, sal_uInt32 &v)
RTParamMode TYPEREG_CALLTYPE typereg_reader_getMethodParameterFlags(void *hEntry, sal_uInt16 index, sal_uInt16 paramIndex)
Returns the flags of a parameter of a method of a type reader.
#define FIELD_OFFSET_NAME
the reference type is unknown
#define METHOD_OFFSET_NAME
void TYPEREG_CALLTYPE typereg_reader_getTypeName(void *hEntry, rtl_uString **pTypeName)
Returns the type name of a type reader.
typereg_Version
The version of a binary blob that represents a UNOIDL type.
sal_Unicode const * aString
#define TYPEREG_CALLTYPE
specifies the calling convention for type reader/writer api
RTConstValueUnion m_value
stores the value of the constant.
RTFieldAccess getFieldAccess(sal_uInt16 index) const
returns the access mode of the field specified by index.
specifies a variable container for field values.
void TYPEREG_CALLTYPE typereg_reader_getSuperTypeName(void *hEntry, rtl_uString **pSuperTypeName, sal_uInt16 index)
Returns the type name of a super type of a type reader.
#define REFERENCE_OFFSET_ACCESS
static void TYPEREG_CALLTYPE getSuperTypeName(TypeReaderImpl hEntry, rtl_uString **pSuperTypeName)
specifies that the structure of the given blob is unknown and can't be read.
sal_Int32 getFieldType(guint nCol)
#define CP_OFFSET_ENTRY_TAG
sal_uInt32 UINT16StringLen(const sal_uInt8 *wstring)
#define FIELD_OFFSET_ACCESS
#define OFFSET_TYPE_CLASS
sal_uInt32 readUINT16(const sal_uInt8 *buffer, sal_uInt16 &v)
sal_uInt16 TYPEREG_CALLTYPE typereg_reader_getReferenceCount(void *hEntry)
Returns the number of references of a type reader.
const sal_Unicode NULL_WSTRING[1]
#define FIELD_OFFSET_FILENAME
#define REFERENCE_OFFSET_NAME
sal_uInt16 TYPEREG_CALLTYPE typereg_reader_getMethodExceptionCount(void *hEntry, sal_uInt16 index)
Returns the number of exceptions of a method of a type reader.
#define PARAM_OFFSET_NAME
RTTypeClass
specifies the typeclass of a binary type blob.
sal_uInt32 getFieldCount() const
returns the number of fields (attributes/properties, enum values or number of constants in a module)...
#define METHOD_OFFSET_DOKU
sal_uInt32 readINT32(const sal_uInt8 *buffer, sal_Int32 &v)
#define FIELD_OFFSET_DOKU
RTFieldAccess TYPEREG_CALLTYPE typereg_reader_getReferenceFlags(void *hEntry, sal_uInt16 index)
Returns the flags of a reference of a type reader.
void TYPEREG_CALLTYPE typereg_reader_getMethodParameterName(void *hEntry, rtl_uString **pMethodParamName, sal_uInt16 index, sal_uInt16 paramIndex)
Returns the name of a parameter of a method of a type reader.
sal_uInt32 readString(const sal_uInt8 *buffer, sal_Unicode *v, sal_uInt32 maxSize)
sal_uInt16 TYPEREG_CALLTYPE typereg_reader_getSuperTypeCount(void *hEntry)
Returns the number of super types of a type reader.
bool TYPEREG_CALLTYPE typereg_reader_create(void const *buffer, sal_uInt32 length, void **result)
Creates a type reader working on a binary blob that represents a UNOIDL type.
RTValueType
specifies the type of a field value.
Denotes the updated version of UNOIDL type blobs.
void TYPEREG_CALLTYPE typereg_reader_getFieldFileName(void *hEntry, rtl_uString **pFieldFileName, sal_uInt16 index)
Returns the file name of a field of a type reader.
RTTypeClass getTypeClass() const
returns the typeclass of the type represented by this blob.
specifies an unknown flag
void TYPEREG_CALLTYPE typereg_reader_getReferenceTypeName(void *hEntry, rtl_uString **pReferenceName, sal_uInt16 index)
Returns the type name of a reference of a type reader.
RTReferenceType TYPEREG_CALLTYPE typereg_reader_getReferenceSort(void *hEntry, sal_uInt16 index)
Returns the sort of a reference of a type reader.
void TYPEREG_CALLTYPE typereg_reader_getMethodReturnTypeName(void *hEntry, rtl_uString **pMethodReturnType, sal_uInt16 index)
Returns the return type name of a method of a type reader.
RTMethodMode
specifies the mode of a method.
#define CP_OFFSET_ENTRY_DATA
void TYPEREG_CALLTYPE typereg_reader_acquire(void *hEntry)
Increments the reference count of a type reader.
void TYPEREG_CALLTYPE typereg_reader_getMethodParameterTypeName(void *hEntry, rtl_uString **pMethodParamType, sal_uInt16 index, sal_uInt16 paramIndex)
Returns the type name of a parameter of a method of a type reader.
void TYPEREG_CALLTYPE typereg_reader_getFieldTypeName(void *hEntry, rtl_uString **pFieldType, sal_uInt16 index)
Returns the type name of a field of a type reader.
void TYPEREG_CALLTYPE typereg_reader_getMethodName(void *hEntry, rtl_uString **pMethodName, sal_uInt16 index)
Returns the name of a method of a type reader.
Denotes the original version of UNOIDL type blobs.
void TYPEREG_CALLTYPE typereg_reader_getFieldName(void *hEntry, rtl_uString **pFieldName, sal_uInt16 index)
Returns the name of a field of a type reader.
#define SAL_WARN(area, stream)
TypeReaderImpl m_hImpl
stores the handle of an implementation class
typereg_Version TYPEREG_CALLTYPE typereg_reader_getVersion(void const *handle)
Returns the binary blob version of a type reader.
RTTypeClass TYPEREG_CALLTYPE typereg_reader_getTypeClass(void *hEntry)
Returns the type class of a type reader.
OUString getFieldType(sal_uInt16 index) const
returns the full qualified name of the field specified by index.
OUString getString(const Any &_rAny)
RTFieldAccess
specifies the type for the field access.
#define REFERENCE_OFFSET_DOKU
sal_uInt16 TYPEREG_CALLTYPE typereg_reader_getMethodCount(void *hEntry)
Returns the number of methods of a type reader.
RegistryTypeReader(const sal_uInt8 *buffer, sal_uInt32 bufferLen)
Constructor.
OUString getTypeName() const
returns the full qualified name of the type.
~RegistryTypeReader()
Destructor. The Destructor frees the data block if the copyData flag was TRUE.
void TYPEREG_CALLTYPE typereg_reader_getDocumentation(void *hEntry, rtl_uString **pDoku)
Returns the documentation of a type reader.
void TYPEREG_CALLTYPE typereg_reader_getMethodExceptionTypeName(void *hEntry, rtl_uString **pMethodExcpType, sal_uInt16 index, sal_uInt16 excIndex)
Returns the type name of an exception of a method of a type reader.
specifies a helper class for const values.