28#include <osl/endian.h>
29#include <osl/diagnose.h>
43const sal_uInt32
magic = 0x12345678;
55 struct BoundsError {};
58 sal_uInt32 m_bufferLen;
60 BlopObject(
const sal_uInt8* buffer, sal_uInt32 len);
65 if (
index >= m_bufferLen) {
71 sal_Int16 readINT16(sal_uInt32
index)
const
73 if (m_bufferLen < 2 || index >= m_bufferLen - 1) {
81 if (m_bufferLen < 2 || index >= m_bufferLen - 1) {
89 if (m_bufferLen < 4 || index >= m_bufferLen - 3) {
102 if (m_bufferLen < 4 || index >= m_bufferLen - 3) {
113 sal_Int64 readINT64(sal_uInt32
index)
const
115 if (m_bufferLen < 8 || index >= m_bufferLen - 7) {
130 sal_uInt64 readUINT64(sal_uInt32
index)
const
132 if (m_bufferLen < 8 || index >= m_bufferLen - 7) {
150BlopObject::BlopObject(
const sal_uInt8* buffer, sal_uInt32 len)
161 std::vector<std::unique_ptr<sal_Unicode[]>> m_stringTable;
162 sal_uInt16 m_stringsCopied;
164 explicit StringCache(sal_uInt16 size);
167 sal_uInt16 createString(
const sal_uInt8* buffer);
172StringCache::StringCache(sal_uInt16 size)
173 : m_stringTable(
size)
178const sal_Unicode* StringCache::getString(sal_uInt16 index)
const
180 if ((index > 0) && (index <= m_stringsCopied))
181 return m_stringTable[
index - 1].get();
186sal_uInt16 StringCache::createString(
const sal_uInt8* buffer)
188 if (m_stringsCopied < m_stringTable.size())
192 m_stringTable[m_stringsCopied].reset(
new sal_Unicode[len + 1] );
196 return ++m_stringsCopied;
204class ConstantPool :
public BlopObject
208 sal_uInt16 m_numOfEntries;
209 std::unique_ptr<sal_Int32[]> m_pIndex;
211 std::unique_ptr<StringCache> m_pStringCache;
213 ConstantPool(
const sal_uInt8* buffer, sal_uInt32 len, sal_uInt16 numEntries)
214 : BlopObject(buffer, len)
215 , m_numOfEntries(numEntries)
219 sal_uInt32 parseIndex();
221 CPInfoTag readTag(sal_uInt16 index)
const;
223 const char* readUTF8NameConstant(sal_uInt16 index)
const;
224 bool readBOOLConstant(sal_uInt16 index)
const;
225 sal_Int8 readBYTEConstant(sal_uInt16 index)
const;
226 sal_Int16 readINT16Constant(sal_uInt16 index)
const;
227 sal_uInt16 readUINT16Constant(sal_uInt16 index)
const;
228 sal_Int32 readINT32Constant(sal_uInt16 index)
const;
229 sal_uInt32 readUINT32Constant(sal_uInt16 index)
const;
230 sal_Int64 readINT64Constant(sal_uInt16 index)
const;
231 sal_uInt64 readUINT64Constant(sal_uInt16 index)
const;
232 float readFloatConstant(sal_uInt16 index)
const;
233 double readDoubleConstant(sal_uInt16 index)
const;
234 const sal_Unicode* readStringConstant(sal_uInt16 index)
const;
240sal_uInt32 ConstantPool::parseIndex()
243 m_pStringCache.reset();
245 sal_uInt32 offset = 0;
246 sal_uInt16 numOfStrings = 0;
250 m_pIndex.reset(
new sal_Int32[m_numOfEntries] );
252 for (
int i = 0;
i < m_numOfEntries;
i++)
254 m_pIndex[
i] = offset;
269 m_pStringCache.reset(
new StringCache(numOfStrings) );
272 m_bufferLen = offset;
277CPInfoTag ConstantPool::readTag(sal_uInt16 index)
const
281 if (m_pIndex && (index > 0) && (index <= m_numOfEntries))
289const char* ConstantPool::readUTF8NameConstant(sal_uInt16 index)
const
293 if (m_pIndex && (index > 0) && (index <= m_numOfEntries))
299 && std::memchr(m_pBuffer + n, 0, m_bufferLen - n) !=
nullptr)
309bool ConstantPool::readBOOLConstant(sal_uInt16 index)
const
313 if (m_pIndex && (index> 0) && (index <= m_numOfEntries))
324sal_Int8 ConstantPool::readBYTEConstant(sal_uInt16 index)
const
328 if (m_pIndex && (index> 0) && (index <= m_numOfEntries))
340sal_Int16 ConstantPool::readINT16Constant(sal_uInt16 index)
const
342 sal_Int16 aINT16 = 0;
344 if (m_pIndex && (index> 0) && (index <= m_numOfEntries))
355sal_uInt16 ConstantPool::readUINT16Constant(sal_uInt16 index)
const
357 sal_uInt16 asal_uInt16 = 0;
359 if (m_pIndex && (index> 0) && (index <= m_numOfEntries))
370sal_Int32 ConstantPool::readINT32Constant(sal_uInt16 index)
const
372 sal_Int32 aINT32 = 0;
374 if (m_pIndex && (index> 0) && (index <= m_numOfEntries))
385sal_uInt32 ConstantPool::readUINT32Constant(sal_uInt16 index)
const
387 sal_uInt32 aUINT32 = 0;
389 if (m_pIndex && (index> 0) && (index <= m_numOfEntries))
400sal_Int64 ConstantPool::readINT64Constant(sal_uInt16 index)
const
402 sal_Int64 aINT64 = 0;
404 if (m_pIndex && (index> 0) && (index <= m_numOfEntries))
415sal_uInt64 ConstantPool::readUINT64Constant(sal_uInt16 index)
const
417 sal_uInt64 aUINT64 = 0;
419 if (m_pIndex && (index> 0) && (index <= m_numOfEntries))
430float ConstantPool::readFloatConstant(sal_uInt16 index)
const
438 if (m_pIndex && (index> 0) && (index <= m_numOfEntries))
442#ifdef REGTYPE_IEEE_NATIVE
453double ConstantPool::readDoubleConstant(sal_uInt16 index)
const
465 if (m_pIndex && (index> 0) && (index <= m_numOfEntries))
470#ifdef REGTYPE_IEEE_NATIVE
487const sal_Unicode* ConstantPool::readStringConstant(sal_uInt16 index)
const
491 if (m_pIndex && (index> 0) && (index <= m_numOfEntries) && m_pStringCache)
493 if (m_pIndex[index - 1] >= 0)
501 || (std::memchr(m_pBuffer + n, 0, m_bufferLen - n)
506 m_pIndex[
index - 1] = -1 * m_pStringCache->createString(m_pBuffer + n);
510 aString = m_pStringCache->getString(
static_cast<sal_uInt16
>(m_pIndex[index - 1] * -1));
518class FieldList :
public BlopObject
522 sal_uInt16 m_numOfEntries;
523 size_t m_FIELD_ENTRY_SIZE;
526 FieldList(
const sal_uInt8* buffer, sal_uInt32 len, sal_uInt16 numEntries, ConstantPool* pCP)
527 : BlopObject(buffer, len)
528 , m_numOfEntries(numEntries)
531 if ( m_numOfEntries > 0 )
534 m_FIELD_ENTRY_SIZE = numOfFieldEntries *
sizeof(sal_uInt16);
537 m_FIELD_ENTRY_SIZE = 0;
541 sal_uInt32 parseIndex()
const {
return ((m_numOfEntries ?
sizeof(sal_uInt16) : 0) + (m_numOfEntries * m_FIELD_ENTRY_SIZE));}
548 const char* getFieldDoku(sal_uInt16 index)
const;
549 const char* getFieldFileName(sal_uInt16 index)
const;
554const char* FieldList::getFieldName(sal_uInt16 index)
const
556 const char*
aName =
nullptr;
558 if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
562 }
catch (BlopObject::BoundsError &) {
570const char* FieldList::getFieldType(sal_uInt16 index)
const
572 const char*
aName =
nullptr;
574 if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
578 }
catch (BlopObject::BoundsError &) {
586RTFieldAccess FieldList::getFieldAccess(sal_uInt16 index)
const
590 if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
594 }
catch (BlopObject::BoundsError &) {
606 if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
609 switch (m_pCP->readTag(cpIndex))
612 value->aBool = m_pCP->readBOOLConstant(cpIndex);
616 value->aByte = m_pCP->readBYTEConstant(cpIndex);
620 value->aShort = m_pCP->readINT16Constant(cpIndex);
624 value->aUShort = m_pCP->readUINT16Constant(cpIndex);
628 value->aLong = m_pCP->readINT32Constant(cpIndex);
632 value->aULong = m_pCP->readUINT32Constant(cpIndex);
636 value->aHyper = m_pCP->readINT64Constant(cpIndex);
640 value->aUHyper = m_pCP->readUINT64Constant(cpIndex);
644 value->aFloat = m_pCP->readFloatConstant(cpIndex);
648 value->aDouble = m_pCP->readDoubleConstant(cpIndex);
652 value->aString = m_pCP->readStringConstant(cpIndex);
659 }
catch (BlopObject::BoundsError &) {
665const char* FieldList::getFieldDoku(sal_uInt16 index)
const
667 const char* aDoku =
nullptr;
669 if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
673 }
catch (BlopObject::BoundsError &) {
681const char* FieldList::getFieldFileName(sal_uInt16 index)
const
683 const char* aFileName =
nullptr;
685 if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
689 }
catch (BlopObject::BoundsError &) {
699class ReferenceList :
public BlopObject
703 sal_uInt16 m_numOfEntries;
704 size_t m_REFERENCE_ENTRY_SIZE;
707 ReferenceList(
const sal_uInt8* buffer, sal_uInt32 len, sal_uInt16 numEntries, ConstantPool* pCP)
708 : BlopObject(buffer, len)
709 , m_numOfEntries(numEntries)
712 if ( m_numOfEntries > 0 )
714 sal_uInt16 numOfReferenceEntries =
readUINT16(0);
715 m_REFERENCE_ENTRY_SIZE = numOfReferenceEntries *
sizeof(sal_uInt16);
718 m_REFERENCE_ENTRY_SIZE = 0;
722 const char* getReferenceName(sal_uInt16 index)
const;
724 const char* getReferenceDoku(sal_uInt16 index)
const;
730const char* ReferenceList::getReferenceName(sal_uInt16 index)
const
732 const char*
aName =
nullptr;
734 if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
738 }
catch (BlopObject::BoundsError &) {
750 if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
754 }
catch (BlopObject::BoundsError &) {
762const char* ReferenceList::getReferenceDoku(sal_uInt16 index)
const
764 const char* aDoku =
nullptr;
766 if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
770 }
catch (BlopObject::BoundsError &) {
778RTFieldAccess ReferenceList::getReferenceAccess(sal_uInt16 index)
const
782 if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
786 }
catch (BlopObject::BoundsError &) {
796class MethodList :
public BlopObject
800 sal_uInt16 m_numOfEntries;
801 size_t m_PARAM_ENTRY_SIZE;
802 std::unique_ptr<sal_uInt32[]> m_pIndex;
805 MethodList(
const sal_uInt8* buffer, sal_uInt32 len, sal_uInt16 numEntries, ConstantPool* pCP)
806 : BlopObject(buffer, len)
807 , m_numOfEntries(numEntries)
810 if ( m_numOfEntries > 0 )
813 sal_uInt16 numOfParamEntries =
readUINT16(
sizeof(sal_uInt16));
814 m_PARAM_ENTRY_SIZE = numOfParamEntries *
sizeof(sal_uInt16);
817 m_PARAM_ENTRY_SIZE = 0;
821 sal_uInt32 parseIndex();
823 const char* getMethodName(sal_uInt16 index)
const;
824 sal_uInt16 getMethodParamCount(sal_uInt16 index)
const;
825 const char* getMethodParamType(sal_uInt16 index, sal_uInt16 paramIndex)
const;
826 const char* getMethodParamName(sal_uInt16 index, sal_uInt16 paramIndex)
const;
827 RTParamMode getMethodParamMode(sal_uInt16 index, sal_uInt16 paramIndex)
const;
828 sal_uInt16 getMethodExcCount(sal_uInt16 index)
const;
829 const char* getMethodExcType(sal_uInt16 index, sal_uInt16 excIndex)
const;
830 const char* getMethodReturnType(sal_uInt16 index)
const;
832 const char* getMethodDoku(sal_uInt16 index)
const;
835 sal_uInt16 calcMethodParamIndex(
const sal_uInt16 index )
const;
840sal_uInt16 MethodList::calcMethodParamIndex(
const sal_uInt16 index )
const
845sal_uInt32 MethodList::parseIndex()
849 sal_uInt32 offset = 0;
853 offset = 2 *
sizeof(sal_uInt16);
854 m_pIndex.reset(
new sal_uInt32[m_numOfEntries] );
856 for (
int i = 0;
i < m_numOfEntries;
i++)
858 m_pIndex[
i] = offset;
867const char* MethodList::getMethodName(sal_uInt16 index)
const
869 const char*
aName =
nullptr;
871 if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
875 }
catch (BlopObject::BoundsError &) {
883sal_uInt16 MethodList::getMethodParamCount(sal_uInt16 index)
const
885 sal_uInt16 aCount = 0;
887 if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
891 }
catch (BlopObject::BoundsError &) {
899const char* MethodList::getMethodParamType(sal_uInt16 index, sal_uInt16 paramIndex)
const
901 const char*
aName =
nullptr;
903 if ((m_numOfEntries > 0) &&
904 (index <= m_numOfEntries) &&
907 aName = m_pCP->readUTF8NameConstant(
910 calcMethodParamIndex(paramIndex) +
913 }
catch (BlopObject::BoundsError &) {
919const char* MethodList::getMethodParamName(sal_uInt16 index, sal_uInt16 paramIndex)
const
921 const char*
aName =
nullptr;
923 if ((m_numOfEntries > 0) &&
924 (index <= m_numOfEntries) &&
927 aName = m_pCP->readUTF8NameConstant(
930 calcMethodParamIndex(paramIndex) +
933 }
catch (BlopObject::BoundsError &) {
939RTParamMode MethodList::getMethodParamMode(sal_uInt16 index, sal_uInt16 paramIndex)
const
943 if ((m_numOfEntries > 0) &&
944 (index <= m_numOfEntries) &&
949 calcMethodParamIndex(paramIndex) +
952 }
catch (BlopObject::BoundsError &) {
958#if defined(__COVERITY__)
959extern "C" void __coverity_tainted_data_sanitize__(
void *);
962sal_uInt16 MethodList::getMethodExcCount(sal_uInt16 index)
const
964 sal_uInt16 aCount = 0;
966 if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
970#if defined(__COVERITY__)
971 __coverity_tainted_data_sanitize__(&aCount);
973 }
catch (BlopObject::BoundsError &) {
981const char* MethodList::getMethodExcType(sal_uInt16 index, sal_uInt16 excIndex)
const
983 const char*
aName =
nullptr;
985 if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
991 aName = m_pCP->readUTF8NameConstant(
995 (excIndex *
sizeof(sal_uInt16))));
997 }
catch (BlopObject::BoundsError &) {
1005const char* MethodList::getMethodReturnType(sal_uInt16 index)
const
1007 const char*
aName =
nullptr;
1009 if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
1013 }
catch (BlopObject::BoundsError &) {
1021RTMethodMode MethodList::getMethodMode(sal_uInt16 index)
const
1025 if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
1029 }
catch (BlopObject::BoundsError &) {
1037const char* MethodList::getMethodDoku(sal_uInt16 index)
const
1039 const char* aDoku =
nullptr;
1041 if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
1045 }
catch (BlopObject::BoundsError &) {
1055class TypeRegistryEntry:
public BlopObject {
1057 std::unique_ptr<ConstantPool> m_pCP;
1058 std::unique_ptr<FieldList> m_pFields;
1059 std::unique_ptr<MethodList> m_pMethods;
1060 std::unique_ptr<ReferenceList> m_pReferences;
1062 sal_uInt16 m_nSuperTypes;
1063 sal_uInt32 m_offset_SUPERTYPES;
1066 const sal_uInt8* buffer, sal_uInt32 len);
1074TypeRegistryEntry::TypeRegistryEntry(
1075 const sal_uInt8* buffer, sal_uInt32 len):
1076 BlopObject(buffer, len),
m_refCount(1), m_nSuperTypes(0),
1077 m_offset_SUPERTYPES(0)
1079 std::size_t
const entrySize =
sizeof(sal_uInt16);
1081 sal_uInt32 offset_N_SUPERTYPES =
OFFSET_N_ENTRIES + entrySize + (nHeaderEntries * entrySize);
1082 m_offset_SUPERTYPES = offset_N_SUPERTYPES + entrySize;
1083 m_nSuperTypes =
readUINT16(offset_N_SUPERTYPES);
1085 sal_uInt32 offset_CP_SIZE = m_offset_SUPERTYPES + (m_nSuperTypes * entrySize);
1086 sal_uInt32 offset_CP = offset_CP_SIZE + entrySize;
1088 if (offset_CP > m_bufferLen) {
1089 throw BoundsError();
1093 m_pBuffer + offset_CP, m_bufferLen - offset_CP,
1096 sal_uInt32 offset = offset_CP + m_pCP->parseIndex();
1098 assert(m_bufferLen >= entrySize);
1099 if (offset > m_bufferLen - entrySize) {
1100 throw BoundsError();
1104 m_pBuffer + offset + entrySize, m_bufferLen - (offset + entrySize),
1107 offset +=
sizeof(sal_uInt16) + m_pFields->parseIndex();
1109 assert(m_bufferLen >= entrySize);
1110 if (offset > m_bufferLen - entrySize) {
1111 throw BoundsError();
1115 m_pBuffer + offset + entrySize, m_bufferLen - (offset + entrySize),
1118 offset +=
sizeof(sal_uInt16) + m_pMethods->parseIndex();
1120 assert(m_bufferLen >= entrySize);
1121 if (offset > m_bufferLen - entrySize) {
1122 throw BoundsError();
1124 m_pReferences.reset(
1126 m_pBuffer + offset + entrySize, m_bufferLen - (offset + entrySize),
1136 void const * buffer, sal_uInt32 length,
1143 std::unique_ptr< TypeRegistryEntry > entry;
1147 new TypeRegistryEntry(
1149 }
catch (std::bad_alloc &) {
1161 *
result = entry.release();
1163 }
catch (BlopObject::BoundsError &) {
1171 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1173 if (pEntry !=
nullptr)
1174 pEntry->m_refCount++;
1179 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1181 if (pEntry !=
nullptr)
1183 if (--pEntry->m_refCount == 0)
1189 if (handle !=
nullptr) {
1191 return static_cast< TypeRegistryEntry
const *
>(handle)->getVersion();
1192 }
catch (BlopObject::BoundsError &) {
1201 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1202 if (pEntry !=
nullptr) {
1205 }
catch (BlopObject::BoundsError &) {
1214 TypeRegistryEntry * entry =
static_cast< TypeRegistryEntry *
>(hEntry);
1215 if (entry !=
nullptr) {
1218 }
catch (BlopObject::BoundsError &) {
1227 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1228 if (pEntry !=
nullptr) {
1230 const char* pTmp = pEntry->m_pCP->readUTF8NameConstant(pEntry->readUINT16(
OFFSET_THIS_TYPE));
1232 pTypeName, pTmp, pTmp ==
nullptr ? 0 : rtl_str_getLength(pTmp),
1233 RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1235 }
catch (BlopObject::BoundsError &) {
1239 rtl_uString_new(pTypeName);
1245 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1246 if (pEntry !=
nullptr) {
1248 const char* pTmp = pEntry->m_pCP->readUTF8NameConstant(pEntry->readUINT16(
OFFSET_DOKU));
1250 pDoku, pTmp, pTmp ==
nullptr ? 0 : rtl_str_getLength(pTmp),
1251 RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1253 }
catch (BlopObject::BoundsError &) {
1257 rtl_uString_new(pDoku);
1262 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1263 if (pEntry !=
nullptr) {
1265 const char* pTmp = pEntry->m_pCP->readUTF8NameConstant(pEntry->readUINT16(
OFFSET_FILENAME));
1267 pFileName, pTmp, pTmp ==
nullptr ? 0 : rtl_str_getLength(pTmp),
1268 RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1270 }
catch (BlopObject::BoundsError &) {
1274 rtl_uString_new(pFileName);
1280 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1282 if (pEntry ==
nullptr)
return 0;
1284 return pEntry->m_pFields->m_numOfEntries;
1289 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1291 if (pEntry ==
nullptr)
1293 rtl_uString_new(pFieldName);
1296 const char* pTmp = pEntry->m_pFields->getFieldName(
index);
1298 pFieldName, pTmp, pTmp ==
nullptr ? 0 : rtl_str_getLength(pTmp),
1299 RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1304 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1306 if (pEntry ==
nullptr)
1308 rtl_uString_new(pFieldType);
1312 const char* pTmp = pEntry->m_pFields->getFieldType(
index);
1314 pFieldType, pTmp, pTmp ==
nullptr ? 0 : rtl_str_getLength(pTmp),
1315 RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1320 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1324 return pEntry->m_pFields->getFieldAccess(
index);
1328 void * hEntry, sal_uInt16 index,
RTValueType * type,
1331 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1333 if (pEntry ==
nullptr) {
1340 }
catch (std::bad_alloc &) {
1348 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1350 if (pEntry ==
nullptr)
1352 rtl_uString_new(pDoku);
1356 const char* pTmp = pEntry->m_pFields->getFieldDoku(
index);
1358 pDoku, pTmp, pTmp ==
nullptr ? 0 : rtl_str_getLength(pTmp),
1359 RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1364 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1366 if (pEntry ==
nullptr)
1368 rtl_uString_new(pFieldFileName);
1372 const char* pTmp = pEntry->m_pFields->getFieldFileName(
index);
1374 pFieldFileName, pTmp, pTmp ==
nullptr ? 0 : rtl_str_getLength(pTmp),
1375 RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1381 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1383 if (pEntry ==
nullptr)
return 0;
1385 return pEntry->m_pMethods->m_numOfEntries;
1390 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1392 if (pEntry ==
nullptr)
1394 rtl_uString_new(pMethodName);
1398 const char* pTmp = pEntry->m_pMethods->getMethodName(
index);
1400 pMethodName, pTmp, pTmp ==
nullptr ? 0 : rtl_str_getLength(pTmp),
1401 RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1405 void * hEntry, sal_uInt16 index)
1407 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1409 if (pEntry ==
nullptr)
return 0;
1411 return pEntry->m_pMethods->getMethodParamCount(
index);
1416 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1418 if (pEntry ==
nullptr)
1420 rtl_uString_new(pMethodParamType);
1424 const char* pTmp = pEntry->m_pMethods->getMethodParamType(
index, paramIndex);
1426 pMethodParamType, pTmp, pTmp ==
nullptr ? 0 : rtl_str_getLength(pTmp),
1427 RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1432 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1434 if (pEntry ==
nullptr)
1436 rtl_uString_new(pMethodParamName);
1440 const char* pTmp = pEntry->m_pMethods->getMethodParamName(
index, paramIndex);
1442 pMethodParamName, pTmp, pTmp ==
nullptr ? 0 : rtl_str_getLength(pTmp),
1443 RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1448 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1452 return pEntry->m_pMethods->getMethodParamMode(
index, paramIndex);
1456 void * hEntry, sal_uInt16 index)
1458 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1460 if (pEntry ==
nullptr)
return 0;
1462 return pEntry->m_pMethods->getMethodExcCount(
index);
1467 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1469 if (pEntry ==
nullptr)
1471 rtl_uString_new(pMethodExcpType);
1475 const char* pTmp = pEntry->m_pMethods->getMethodExcType(
index, excIndex);
1477 pMethodExcpType, pTmp, pTmp ==
nullptr ? 0 : rtl_str_getLength(pTmp),
1478 RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1483 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1485 if (pEntry ==
nullptr)
1487 rtl_uString_new(pMethodReturnType);
1491 const char* pTmp = pEntry->m_pMethods->getMethodReturnType(
index);
1493 pMethodReturnType, pTmp, pTmp ==
nullptr ? 0 : rtl_str_getLength(pTmp),
1494 RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1499 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1503 return pEntry->m_pMethods->getMethodMode(
index);
1508 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1510 if (pEntry ==
nullptr)
1512 rtl_uString_new(pMethodDoku);
1516 const char* pTmp = pEntry->m_pMethods->getMethodDoku(
index);
1518 pMethodDoku, pTmp, pTmp ==
nullptr ? 0 : rtl_str_getLength(pTmp),
1519 RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1524 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1526 if (pEntry ==
nullptr)
return 0;
1528 return pEntry->m_pReferences->m_numOfEntries;
1533 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1535 if (pEntry ==
nullptr)
1537 rtl_uString_new(pReferenceName);
1541 const char* pTmp = pEntry->m_pReferences->getReferenceName(
index);
1543 pReferenceName, pTmp, pTmp ==
nullptr ? 0 : rtl_str_getLength(pTmp),
1544 RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1549 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1553 return pEntry->m_pReferences->getReferenceType(
index);
1558 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1560 if (pEntry ==
nullptr)
1562 rtl_uString_new(pReferenceDoku);
1566 const char* pTmp = pEntry->m_pReferences->getReferenceDoku(
index);
1568 pReferenceDoku, pTmp, pTmp ==
nullptr ? 0 : rtl_str_getLength(pTmp),
1569 RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1574 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1578 return pEntry->m_pReferences->getReferenceAccess(
index);
1583 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1585 if (pEntry ==
nullptr)
return 0;
1587 return pEntry->m_nSuperTypes;
1591 void * hEntry, rtl_uString ** pSuperTypeName, sal_uInt16 index)
1593 TypeRegistryEntry* pEntry =
static_cast<TypeRegistryEntry*
>(hEntry);
1594 if (pEntry !=
nullptr) {
1596 OSL_ASSERT(index < pEntry->m_nSuperTypes);
1597 const char* pTmp = pEntry->m_pCP->readUTF8NameConstant(pEntry->readUINT16(pEntry->m_offset_SUPERTYPES + (
index *
sizeof(sal_uInt16))));
1599 pSuperTypeName, pTmp, pTmp ==
nullptr ? 0 : rtl_str_getLength(pTmp),
1600 RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS);
1602 }
catch (BlopObject::BoundsError &) {
1606 rtl_uString_new(pSuperTypeName);
sal_uInt8 m_pBuffer[RTL_DIGEST_LENGTH_SHA1]
#define SAL_WARN(area, stream)
OUString getString(const Any &_rAny)
sal_Int32 getFieldType(guint nCol)
OUString getFieldName(guint nCol)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
#define METHOD_OFFSET_PARAM_COUNT
#define REFERENCE_OFFSET_TYPE
#define REFERENCE_OFFSET_NAME
sal_uInt32 readUINT16(const sal_uInt8 *buffer, sal_uInt16 &v)
#define REFERENCE_OFFSET_DOKU
#define CP_OFFSET_ENTRY_DATA
#define REFERENCE_OFFSET_ACCESS
#define FIELD_OFFSET_TYPE
#define PARAM_OFFSET_MODE
#define METHOD_OFFSET_DOKU
#define METHOD_OFFSET_RETURN
sal_uInt32 readString(const sal_uInt8 *buffer, sal_Unicode *v, sal_uInt32 maxSize)
sal_uInt32 readINT32(const sal_uInt8 *buffer, sal_Int32 &v)
#define FIELD_OFFSET_FILENAME
sal_uInt32 readUINT32(const sal_uInt8 *buffer, sal_uInt32 &v)
#define PARAM_OFFSET_NAME
#define PARAM_OFFSET_TYPE
#define FIELD_OFFSET_VALUE
sal_uInt32 UINT16StringLen(const sal_uInt8 *wstring)
#define FIELD_OFFSET_DOKU
#define CP_OFFSET_ENTRY_TAG
#define OFFSET_TYPE_CLASS
#define METHOD_OFFSET_MODE
#define FIELD_OFFSET_NAME
#define METHOD_OFFSET_NAME
#define FIELD_OFFSET_ACCESS
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_uInt16 TYPEREG_CALLTYPE typereg_reader_getMethodExceptionCount(void *hEntry, sal_uInt16 index)
Returns the number of exceptions of a method of a type reader.
sal_uInt16 TYPEREG_CALLTYPE typereg_reader_getReferenceCount(void *hEntry)
Returns the number of references of a type reader.
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.
void TYPEREG_CALLTYPE typereg_reader_getFileName(void *hEntry, rtl_uString **pFileName)
Returns the file name 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.
const sal_uInt16 majorVersion
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.
sal_uInt16 TYPEREG_CALLTYPE typereg_reader_getMethodCount(void *hEntry)
Returns the number of methods of a type reader.
void TYPEREG_CALLTYPE typereg_reader_acquire(void *hEntry)
Increments the reference count of a type reader.
void TYPEREG_CALLTYPE typereg_reader_getDocumentation(void *hEntry, rtl_uString **pDoku)
Returns the documentation 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.
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.
void TYPEREG_CALLTYPE typereg_reader_release(void *hEntry)
Decrements the reference count of a type reader.
typereg_Version TYPEREG_CALLTYPE typereg_reader_getVersion(void const *handle)
Returns the binary blob version of a type reader.
const sal_Unicode NULL_WSTRING[1]
RTTypeClass TYPEREG_CALLTYPE typereg_reader_getTypeClass(void *hEntry)
Returns the type class of a type reader.
const sal_uInt16 minorVersion
void TYPEREG_CALLTYPE typereg_reader_getFieldName(void *hEntry, rtl_uString **pFieldName, sal_uInt16 index)
Returns the name of a field of a type reader.
bool TYPEREG_CALLTYPE typereg_reader_isPublished(void *hEntry)
Returns whether a type reader is published.
void TYPEREG_CALLTYPE typereg_reader_getTypeName(void *hEntry, rtl_uString **pTypeName)
Returns the type name of a type reader.
RTMethodMode TYPEREG_CALLTYPE typereg_reader_getMethodFlags(void *hEntry, sal_uInt16 index)
Returns the flags 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.
sal_uInt16 TYPEREG_CALLTYPE typereg_reader_getSuperTypeCount(void *hEntry)
Returns the number of super types of a type reader.
RTFieldAccess TYPEREG_CALLTYPE typereg_reader_getFieldFlags(void *hEntry, sal_uInt16 index)
Returns the flags of a field of a type reader.
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.
void TYPEREG_CALLTYPE typereg_reader_getMethodName(void *hEntry, rtl_uString **pMethodName, sal_uInt16 index)
Returns the name of a method of a type reader.
void TYPEREG_CALLTYPE typereg_reader_getReferenceDocumentation(void *hEntry, rtl_uString **pReferenceDoku, sal_uInt16 index)
Returns the documentation 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.
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_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.
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_getMethodDocumentation(void *hEntry, rtl_uString **pMethodDoku, sal_uInt16 index)
Returns the documentation of a method of a type reader.
const char NULL_STRING[1]
RTFieldAccess TYPEREG_CALLTYPE typereg_reader_getReferenceFlags(void *hEntry, sal_uInt16 index)
Returns the flags of a reference of a type reader.
sal_uInt16 TYPEREG_CALLTYPE typereg_reader_getMethodParameterCount(void *hEntry, sal_uInt16 index)
Returns the number of parameters of a method of a type reader.
sal_uInt16 TYPEREG_CALLTYPE typereg_reader_getFieldCount(void *hEntry)
Returns the number of fields of a type reader.
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.
#define TYPEREG_CALLTYPE
specifies the calling convention for type reader/writer api
RTReferenceType
specifies the type of a reference used in a service description.
@ INVALID
the reference type is unknown
RTParamMode
specifies the mode of a parameter.
@ RT_PARAM_INVALID
indicates an invalid parameter mode
RTValueType
specifies the type of a field value.
RTFieldAccess
specifies the type for the field access.
@ INVALID
specifies an unknown flag
RTMethodMode
specifies the mode of a method.
@ INVALID
indicates an invalid mode
RTTypeClass
specifies the typeclass of a binary type blob.
@ RT_TYPE_INVALID
specifies that the structure of the given blob is unknown and can't be read.
specifies a variable container for field values.
typereg_Version
The version of a binary blob that represents a UNOIDL type.
@ TYPEREG_VERSION_0
Denotes the original version of UNOIDL type blobs.
@ TYPEREG_VERSION_1
Denotes the updated version of UNOIDL type blobs.