summaryrefslogtreecommitdiff
path: root/stoc
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-12-21 09:56:08 +0200
committerNoel Grandin <noel@peralex.com>2016-02-15 11:04:11 +0200
commit045ec6aa6241939e402594e6f69b7d8fb1560717 (patch)
tree8cea640259c5d69a8c90e40fa58e69129b0c13b5 /stoc
parenta20d5dedc3ad04ce8a7a1413554b78b2777c349d (diff)
uno::Sequence->std::vector in stoc/introspection
Change-Id: I6427bc26d77e4ace2a827b9ae81716d62b5050ba
Diffstat (limited to 'stoc')
-rw-r--r--stoc/source/inspect/introspection.cxx302
1 files changed, 130 insertions, 172 deletions
diff --git a/stoc/source/inspect/introspection.cxx b/stoc/source/inspect/introspection.cxx
index 9483a1482b6e..80e742d463e6 100644
--- a/stoc/source/inspect/introspection.cxx
+++ b/stoc/source/inspect/introspection.cxx
@@ -38,6 +38,7 @@
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <cppuhelper/typeprovider.hxx>
+#include <comphelper/sequence.hxx>
#include <salhelper/simplereferenceobject.hxx>
#include <com/sun/star/uno/DeploymentException.hpp>
@@ -167,22 +168,22 @@ class IntrospectionAccessStatic_Impl: public salhelper::SimpleReferenceObject
// InterfaceSequences, to save additional information in a property
// for example the Field at MAP_FIELD, the get/set-Methods at MAP_GETSET, et cetera
- Sequence< Reference<XInterface> > aInterfaceSeq1;
- Sequence< Reference<XInterface> > aInterfaceSeq2;
+ std::vector< Reference<XInterface> > aInterfaceSeq1;
+ std::vector< Reference<XInterface> > aInterfaceSeq2;
// Hashtables for names
IntrospectionNameMap maPropertyNameMap;
IntrospectionNameMap maMethodNameMap;
LowerToExactNameMap maLowerToExactNameMap;
- // Sequence of all Properties, also for delivering from getProperties()
- Sequence<Property> maAllPropertySeq;
+ // Vector of all Properties, also for delivering from getProperties()
+ std::vector<Property> maAllPropertySeq;
// Mapping of properties to Access-Types
- Sequence<sal_Int16> maMapTypeSeq;
+ std::vector<sal_Int16> maMapTypeSeq;
// Classification of found methods
- Sequence<sal_Int32> maPropertyConceptSeq;
+ std::vector<sal_Int32> maPropertyConceptSeq;
// Number of Properties
sal_Int32 mnPropCount;
@@ -210,26 +211,20 @@ class IntrospectionAccessStatic_Impl: public salhelper::SimpleReferenceObject
sal_Int32* mpOrgPropertyHandleArray;
// MethodSequence, that accepts all methods
- Sequence< Reference<XIdlMethod> > maAllMethodSeq;
+ std::vector< Reference<XIdlMethod> > maAllMethodSeq;
// Classification of found methods
- Sequence<sal_Int32> maMethodConceptSeq;
+ std::vector<sal_Int32> maMethodConceptSeq;
// Number of methods
sal_Int32 mnMethCount;
// Sequence of Listener, that can be registered
- Sequence< Type > maSupportedListenerSeq;
+ std::vector< Type > maSupportedListenerSeq;
// Helper-methods for adjusting sizes of Sequences
- void checkPropertyArraysSize
- (
- Property*& rpAllPropArray,
- sal_Int16*& rpMapTypeArray,
- sal_Int32*& rpPropertyConceptArray,
- sal_Int32 iNextIndex
- );
- static void checkInterfaceArraySize( Sequence< Reference<XInterface> >& rSeq, Reference<XInterface>*& rpInterfaceArray,
+ void checkPropertyArraysSize( sal_Int32 iNextIndex );
+ static void checkInterfaceArraySize( std::vector< Reference<XInterface> >& rSeq, std::vector<Reference<XInterface>>& rInterfaceVec,
sal_Int32 iNextIndex );
public:
@@ -249,11 +244,11 @@ public:
// void setPropertyValueByIndex(Any& obj, sal_Int32 nIndex, const Any& aValue) const;
Any getPropertyValueByIndex(const Any& obj, sal_Int32 nIndex) const;
- Sequence<Property> getProperties() const { return maAllPropertySeq; }
- Sequence< Reference<XIdlMethod> > getMethods() const { return maAllMethodSeq; }
- Sequence< Type > getSupportedListeners() const { return maSupportedListenerSeq; }
- Sequence<sal_Int32> getPropertyConcepts() const { return maPropertyConceptSeq; }
- Sequence<sal_Int32> getMethodConcepts() const { return maMethodConceptSeq; }
+ const std::vector<Property>& getProperties() const { return maAllPropertySeq; }
+ const std::vector< Reference<XIdlMethod> >& getMethods() const { return maAllMethodSeq; }
+ const std::vector< Type >& getSupportedListeners() const { return maSupportedListenerSeq; }
+ const std::vector<sal_Int32>& getPropertyConcepts() const { return maPropertyConceptSeq; }
+ const std::vector<sal_Int32>& getMethodConcepts() const { return maMethodConceptSeq; }
};
@@ -261,13 +256,13 @@ public:
IntrospectionAccessStatic_Impl::IntrospectionAccessStatic_Impl( Reference< XIdlReflection > xCoreReflection_ )
: mxCoreReflection( xCoreReflection_ )
{
- aInterfaceSeq1.realloc( ARRAY_SIZE_STEP );
- aInterfaceSeq2.realloc( ARRAY_SIZE_STEP );
+ aInterfaceSeq1.resize( ARRAY_SIZE_STEP );
+ aInterfaceSeq2.resize( ARRAY_SIZE_STEP );
// Property-Data
- maAllPropertySeq.realloc( ARRAY_SIZE_STEP );
- maMapTypeSeq.realloc( ARRAY_SIZE_STEP );
- maPropertyConceptSeq.realloc( ARRAY_SIZE_STEP );
+ maAllPropertySeq.resize( ARRAY_SIZE_STEP );
+ maMapTypeSeq.resize( ARRAY_SIZE_STEP );
+ maPropertyConceptSeq.resize( ARRAY_SIZE_STEP );
mbFastPropSet = false;
mbElementAccess = false;
@@ -340,8 +335,7 @@ sal_Int32 IntrospectionAccessStatic_Impl::getMethodIndex( const OUString& aMetho
// Could be the right method, type has to be checked
iHashResult = (*aIt).second;
- const Reference<XIdlMethod>* pMethods = maAllMethodSeq.getConstArray();
- const Reference<XIdlMethod> xMethod = pMethods[ iHashResult ];
+ const Reference<XIdlMethod> xMethod = maAllMethodSeq[ iHashResult ];
Reference< XIdlClass > xMethClass = xMethod->getDeclaringClass();
if( xClass->equals( xMethClass ) )
@@ -354,10 +348,10 @@ sal_Int32 IntrospectionAccessStatic_Impl::getMethodIndex( const OUString& aMetho
// Could also be another method with the same name
// Iterate over all methods
- sal_Int32 nLen = maAllMethodSeq.getLength();
+ sal_Int32 nLen = (sal_Int32)maAllMethodSeq.size();
for( int i = 0 ; i < nLen ; ++i )
{
- const Reference<XIdlMethod> xMethod2 = pMethods[ i ];
+ const Reference<XIdlMethod> xMethod2 = maAllMethodSeq[ i ];
if( xMethod2->getName() == aPureMethodName )
{
Reference< XIdlClass > xMethClass2 = xMethod2->getDeclaringClass();
@@ -411,19 +405,17 @@ void IntrospectionAccessStatic_Impl::setPropertyValueByIndex(const Any& obj, sal
}
// Test flags
- const Property* pProps = maAllPropertySeq.getConstArray();
- if( (pProps[ nSequenceIndex ].Attributes & READONLY) != 0 )
+ if( (maAllPropertySeq[ nSequenceIndex ].Attributes & READONLY) != 0 )
{
throw UnknownPropertyException();
}
- const sal_Int16* pMapTypeArray = maMapTypeSeq.getConstArray();
- switch( pMapTypeArray[ nSequenceIndex ] )
+ switch( maMapTypeSeq[ nSequenceIndex ] )
{
case MAP_PROPERTY_SET:
{
// Get Property
- const Property& rProp = maAllPropertySeq.getConstArray()[ nSequenceIndex ];
+ const Property& rProp = maAllPropertySeq[ nSequenceIndex ];
// Convert Interface-Parameter to the correct type
bool bUseCopy = false;
@@ -487,7 +479,7 @@ void IntrospectionAccessStatic_Impl::setPropertyValueByIndex(const Any& obj, sal
case MAP_FIELD:
{
- Reference<XIdlField> xField = static_cast<XIdlField*>(aInterfaceSeq1.getConstArray()[ nSequenceIndex ].get());
+ Reference<XIdlField> xField = static_cast<XIdlField*>(aInterfaceSeq1[ nSequenceIndex ].get());
Reference<XIdlField2> xField2(xField, UNO_QUERY);
if( xField2.is() )
{
@@ -512,7 +504,7 @@ void IntrospectionAccessStatic_Impl::setPropertyValueByIndex(const Any& obj, sal
case MAP_SETONLY:
{
// Fetch set method
- Reference<XIdlMethod> xMethod = static_cast<XIdlMethod*>(aInterfaceSeq2.getConstArray()[ nSequenceIndex ].get());
+ Reference<XIdlMethod> xMethod = static_cast<XIdlMethod*>(aInterfaceSeq2[ nSequenceIndex ].get());
if( xMethod.is() )
{
Sequence<Any> args( 1 );
@@ -555,13 +547,12 @@ Any IntrospectionAccessStatic_Impl::getPropertyValueByIndex(const Any& obj, sal_
return aRet;
}
- const sal_Int16* pMapTypeArray = maMapTypeSeq.getConstArray();
- switch( pMapTypeArray[ nSequenceIndex ] )
+ switch( maMapTypeSeq[ nSequenceIndex ] )
{
case MAP_PROPERTY_SET:
{
// Acquire property
- const Property& rProp = maAllPropertySeq.getConstArray()[ nSequenceIndex ];
+ const Property& rProp = maAllPropertySeq[ nSequenceIndex ];
// Do we have a FastPropertySet and a valid handle?
// NOTE: At this point is exploited that the PropertySet
@@ -603,7 +594,7 @@ Any IntrospectionAccessStatic_Impl::getPropertyValueByIndex(const Any& obj, sal_
case MAP_FIELD:
{
- Reference<XIdlField> xField = static_cast<XIdlField*>(aInterfaceSeq1.getConstArray()[ nSequenceIndex ].get());
+ Reference<XIdlField> xField = static_cast<XIdlField*>(aInterfaceSeq1[ nSequenceIndex ].get());
if( xField.is() )
{
aRet = xField->get( obj );
@@ -621,7 +612,7 @@ Any IntrospectionAccessStatic_Impl::getPropertyValueByIndex(const Any& obj, sal_
case MAP_GETSET:
{
// Fetch get method
- Reference<XIdlMethod> xMethod = static_cast<XIdlMethod*>(aInterfaceSeq1.getConstArray()[ nSequenceIndex ].get());
+ Reference<XIdlMethod> xMethod = static_cast<XIdlMethod*>(aInterfaceSeq1[ nSequenceIndex ].get());
if( xMethod.is() )
{
Sequence<Any> args;
@@ -644,33 +635,22 @@ Any IntrospectionAccessStatic_Impl::getPropertyValueByIndex(const Any& obj, sal_
}
-// Helper method to adjust the size of the sequences
-void IntrospectionAccessStatic_Impl::checkPropertyArraysSize
-(
- Property*& rpAllPropArray,
- sal_Int16*& rpMapTypeArray,
- sal_Int32*& rpPropertyConceptArray,
- sal_Int32 iNextIndex
-)
+// Helper method to adjust the size of the vectors
+void IntrospectionAccessStatic_Impl::checkPropertyArraysSize( sal_Int32 iNextIndex )
{
- sal_Int32 nLen = maAllPropertySeq.getLength();
+ sal_Int32 nLen = (sal_Int32)maAllPropertySeq.size();
if( iNextIndex >= nLen )
{
- maAllPropertySeq.realloc( nLen + ARRAY_SIZE_STEP );
- rpAllPropArray = maAllPropertySeq.getArray();
-
- maMapTypeSeq.realloc( nLen + ARRAY_SIZE_STEP );
- rpMapTypeArray = maMapTypeSeq.getArray();
-
- maPropertyConceptSeq.realloc( nLen + ARRAY_SIZE_STEP );
- rpPropertyConceptArray = maPropertyConceptSeq.getArray();
+ maAllPropertySeq.resize( nLen + ARRAY_SIZE_STEP );
+ maMapTypeSeq.resize( nLen + ARRAY_SIZE_STEP );
+ maPropertyConceptSeq.resize( nLen + ARRAY_SIZE_STEP );
}
}
-void IntrospectionAccessStatic_Impl::checkInterfaceArraySize( Sequence< Reference<XInterface> >& rSeq,
- Reference<XInterface>*& rpInterfaceArray, sal_Int32 iNextIndex )
+void IntrospectionAccessStatic_Impl::checkInterfaceArraySize( std::vector< Reference<XInterface> >& rSeq,
+ std::vector<Reference<XInterface>>& rInterfaceVec, sal_Int32 iNextIndex )
{
- sal_Int32 nLen = rSeq.getLength();
+ sal_Int32 nLen = rSeq.size();
if( iNextIndex >= nLen )
{
// Synchronize new size with ARRAY_SIZE_STEP
@@ -678,8 +658,8 @@ void IntrospectionAccessStatic_Impl::checkInterfaceArraySize( Sequence< Referenc
sal_Int32 nSteps = nMissingSize / ARRAY_SIZE_STEP + 1;
sal_Int32 nNewSize = nLen + nSteps * ARRAY_SIZE_STEP;
- rSeq.realloc( nNewSize );
- rpInterfaceArray = rSeq.getArray();
+ rSeq.resize( nNewSize );
+ rInterfaceVec = rSeq;
}
}
@@ -1185,7 +1165,7 @@ Any ImplIntrospectionAccess::getFastPropertyValue(sal_Int32)
// Methods from XPropertySetInfo
Sequence< Property > ImplIntrospectionAccess::getProperties() throw( RuntimeException, std::exception )
{
- return mpStaticImpl->getProperties();
+ return comphelper::containerToSequence(mpStaticImpl->getProperties());
}
Property ImplIntrospectionAccess::getPropertyByName(const OUString& Name)
@@ -1352,11 +1332,10 @@ Property ImplIntrospectionAccess::getProperty(const OUString& Name, sal_Int32 Pr
bool bFound = false;
if( i != -1 )
{
- sal_Int32 nConcept = mpStaticImpl->getPropertyConcepts().getConstArray()[ i ];
+ sal_Int32 nConcept = mpStaticImpl->getPropertyConcepts()[ i ];
if( (PropertyConcepts & nConcept) != 0 )
{
- const Property* pProps = mpStaticImpl->getProperties().getConstArray();
- aRet = pProps[ i ];
+ aRet = mpStaticImpl->getProperties()[ i ];
bFound = true;
}
}
@@ -1372,7 +1351,7 @@ sal_Bool ImplIntrospectionAccess::hasProperty(const OUString& Name, sal_Int32 Pr
bool bRet = false;
if( i != -1 )
{
- sal_Int32 nConcept = mpStaticImpl->getPropertyConcepts().getConstArray()[ i ];
+ sal_Int32 nConcept = mpStaticImpl->getPropertyConcepts()[ i ];
if( (PropertyConcepts & nConcept) != 0 )
bRet = true;
}
@@ -1383,12 +1362,12 @@ Sequence< Property > ImplIntrospectionAccess::getProperties(sal_Int32 PropertyCo
throw( RuntimeException, std::exception )
{
// If all supported concepts are required, simply pass through the sequence
- sal_Int32 nAllSupportedMask = PROPERTYSET |
+ sal_Int32 nAllSupportedMask = PROPERTYSET |
ATTRIBUTES |
METHODS;
if( ( PropertyConcepts & nAllSupportedMask ) == nAllSupportedMask )
{
- return mpStaticImpl->getProperties();
+ return comphelper::containerToSequence(mpStaticImpl->getProperties());
}
// Same sequence as last time?
@@ -1415,17 +1394,16 @@ Sequence< Property > ImplIntrospectionAccess::getProperties(sal_Int32 PropertyCo
Property* pDestProps = maLastPropertySeq.getArray();
// Go through all the properties and apply according to the concept
- Sequence<Property> aPropSeq = mpStaticImpl->getProperties();
- const Property* pSourceProps = aPropSeq.getConstArray();
- const sal_Int32* pConcepts = mpStaticImpl->getPropertyConcepts().getConstArray();
- sal_Int32 nLen = aPropSeq.getLength();
+ const std::vector<Property>& rPropSeq = mpStaticImpl->getProperties();
+ const std::vector<sal_Int32>& rConcepts = mpStaticImpl->getPropertyConcepts();
+ sal_Int32 nLen = (sal_Int32)rPropSeq.size();
sal_Int32 iDest = 0;
for( sal_Int32 i = 0 ; i < nLen ; i++ )
{
- sal_Int32 nConcept = pConcepts[ i ];
+ sal_Int32 nConcept = rConcepts[ i ];
if( nConcept & PropertyConcepts )
- pDestProps[ iDest++ ] = pSourceProps[ i ];
+ pDestProps[ iDest++ ] = rPropSeq[ i ];
}
// Remember PropertyConcept representing maLastPropertySeq
@@ -1443,11 +1421,10 @@ Reference<XIdlMethod> ImplIntrospectionAccess::getMethod(const OUString& Name, s
if( i != -1 )
{
- sal_Int32 nConcept = mpStaticImpl->getMethodConcepts().getConstArray()[ i ];
+ sal_Int32 nConcept = mpStaticImpl->getMethodConcepts()[ i ];
if( (MethodConcepts & nConcept) != 0 )
{
- const Reference<XIdlMethod>* pMethods = mpStaticImpl->getMethods().getConstArray();
- xRet = pMethods[i];
+ xRet = mpStaticImpl->getMethods()[i];
}
}
if( !xRet.is() )
@@ -1462,7 +1439,7 @@ sal_Bool ImplIntrospectionAccess::hasMethod(const OUString& Name, sal_Int32 Meth
bool bRet = false;
if( i != -1 )
{
- sal_Int32 nConcept = mpStaticImpl->getMethodConcepts().getConstArray()[ i ];
+ sal_Int32 nConcept = mpStaticImpl->getMethodConcepts()[ i ];
if( (MethodConcepts & nConcept) != 0 )
bRet = true;
}
@@ -1473,7 +1450,7 @@ Sequence< Reference<XIdlMethod> > ImplIntrospectionAccess::getMethods(sal_Int32
throw( RuntimeException, std::exception )
{
// If all supported concepts are required, simply pass through the sequence
- sal_Int32 nAllSupportedMask = MethodConcept::DANGEROUS |
+ sal_Int32 nAllSupportedMask = MethodConcept::DANGEROUS |
PROPERTY |
LISTENER |
ENUMERATION |
@@ -1482,7 +1459,7 @@ Sequence< Reference<XIdlMethod> > ImplIntrospectionAccess::getMethods(sal_Int32
MethodConcept_NORMAL_IMPL;
if( ( MethodConcepts & nAllSupportedMask ) == nAllSupportedMask )
{
- return mpStaticImpl->getMethods();
+ return comphelper::containerToSequence(mpStaticImpl->getMethods());
}
// Same sequence as last time?
@@ -1492,10 +1469,8 @@ Sequence< Reference<XIdlMethod> > ImplIntrospectionAccess::getMethods(sal_Int32
}
// Get method sequences
- Sequence< Reference<XIdlMethod> > aMethodSeq = mpStaticImpl->getMethods();
- const Reference<XIdlMethod>* pSourceMethods = aMethodSeq.getConstArray();
- const sal_Int32* pConcepts = mpStaticImpl->getMethodConcepts().getConstArray();
- sal_Int32 nLen = aMethodSeq.getLength();
+ const std::vector< Reference<XIdlMethod> >& aMethodSeq = mpStaticImpl->getMethods();
+ sal_Int32 nLen = (sal_Int32)aMethodSeq.size();
// Realloc sequence according to the required number
// Unlike Properties, the number can not be determined by counters in
@@ -1507,9 +1482,9 @@ Sequence< Reference<XIdlMethod> > ImplIntrospectionAccess::getMethods(sal_Int32
sal_Int32 iDest = 0;
for( sal_Int32 i = 0 ; i < nLen ; i++ )
{
- sal_Int32 nConcept = pConcepts[ i ];
+ sal_Int32 nConcept = mpStaticImpl->getMethodConcepts()[ i ];
if( nConcept & MethodConcepts )
- pDestMethods[ iDest++ ] = pSourceMethods[ i ];
+ pDestMethods[ iDest++ ] = aMethodSeq[ i ];
}
// Bring to the correct length
@@ -1525,7 +1500,7 @@ Sequence< Reference<XIdlMethod> > ImplIntrospectionAccess::getMethods(sal_Int32
Sequence< Type > ImplIntrospectionAccess::getSupportedListeners()
throw( RuntimeException, std::exception )
{
- return mpStaticImpl->getSupportedListeners();
+ return comphelper::containerToSequence(mpStaticImpl->getSupportedListeners());
}
Reference<XInterface> SAL_CALL ImplIntrospectionAccess::queryAdapter( const Type& rType )
@@ -1572,7 +1547,7 @@ OUString ImplIntrospectionAccess::getExactName( const OUString& rApproximateName
struct TypeKey {
TypeKey(
css::uno::Reference<css::beans::XPropertySetInfo> const & theProperties,
- css::uno::Sequence<css::uno::Type> const & theTypes):
+ std::vector<css::uno::Type> const & theTypes):
properties(theProperties)
{
//TODO: Could even sort the types lexicographically first, to increase
@@ -1580,8 +1555,8 @@ struct TypeKey {
// but the old scheme of using getImplementationId() would have missed
// those matches, too:
OUStringBuffer b;
- for (sal_Int32 i = 0; i != theTypes.getLength(); ++i) {
- b.append(theTypes[i].getTypeName());
+ for (const css::uno::Type& rType : theTypes) {
+ b.append(rType.getTypeName());
b.append('*'); // arbitrary delimiter not used by type grammar
}
types = b.makeStringAndClear();
@@ -1746,9 +1721,9 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
rtl::Reference< IntrospectionAccessStatic_Impl > pAccess;
// Check: Is a matching access object already cached?
- Sequence< Reference<XIdlClass> > SupportedClassSeq;
- Sequence< Type > SupportedTypesSeq;
- Reference<XTypeProvider> xTypeProvider;
+ std::vector< Reference<XIdlClass> > SupportedClassSeq;
+ std::vector< Type > SupportedTypesSeq;
+ Reference<XTypeProvider> xTypeProvider;
Reference<XPropertySetInfo> xPropSetInfo;
Reference<XPropertySet> xPropSet;
@@ -1758,13 +1733,13 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
xTypeProvider.set( x, UNO_QUERY );
if( xTypeProvider.is() )
{
- SupportedTypesSeq = xTypeProvider->getTypes();
+ SupportedTypesSeq = comphelper::sequenceToContainer<std::vector<Type>>(xTypeProvider->getTypes());
} else {
SAL_WARN(
"stoc",
"object of type \"" << aToInspectObj.getValueTypeName()
<< "\" lacks XTypeProvider");
- SupportedTypesSeq = Sequence<Type>(&aToInspectObj.getValueType(), 1);
+ SupportedTypesSeq = { aToInspectObj.getValueType() };
}
// Now try to get the PropertySetInfo
xPropSet.set( x, UNO_QUERY );
@@ -1772,7 +1747,7 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
xPropSetInfo = xPropSet->getPropertySetInfo();
} else {
- SupportedTypesSeq = Sequence<Type>(&aToInspectObj.getValueType(), 1);
+ SupportedTypesSeq = { aToInspectObj.getValueType() };
}
{
@@ -1791,11 +1766,11 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
}
// No access cached -> create new
- Property* pAllPropArray;
- Reference<XInterface>* pInterfaces1;
- Reference<XInterface>* pInterfaces2;
- sal_Int16* pMapTypeArray;
- sal_Int32* pPropertyConceptArray;
+ std::vector<Property>& rAllPropArray = pAccess->maAllPropertySeq;
+ std::vector<Reference<XInterface>>& rInterfaces1 = pAccess->aInterfaceSeq1;
+ std::vector<Reference<XInterface>>& rInterfaces2 = pAccess->aInterfaceSeq2;
+ std::vector<sal_Int16>& rMapTypeArray = pAccess->maMapTypeSeq;
+ std::vector<sal_Int32>& rPropertyConceptArray = pAccess->maPropertyConceptSeq;
sal_Int32 i;
// References to important data from pAccess
@@ -1804,27 +1779,18 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
IntrospectionNameMap& rMethodNameMap = pAccess->maMethodNameMap;
LowerToExactNameMap& rLowerToExactNameMap = pAccess->maLowerToExactNameMap;
- // Fetch pointers to its property fields
- pAllPropArray = pAccess->maAllPropertySeq.getArray();
- pInterfaces1 = pAccess->aInterfaceSeq1.getArray();
- pInterfaces2 = pAccess->aInterfaceSeq2.getArray();
- pMapTypeArray = pAccess->maMapTypeSeq.getArray();
- pPropertyConceptArray = pAccess->maPropertyConceptSeq.getArray();
-
//*** Perform analysis ***
if( eType == TypeClass_INTERFACE )
{
- sal_Int32 nTypeCount = SupportedTypesSeq.getLength();
+ size_t nTypeCount = SupportedTypesSeq.size();
if( nTypeCount )
{
- SupportedClassSeq.realloc( nTypeCount );
- Reference<XIdlClass>* pClasses = SupportedClassSeq.getArray();
+ SupportedClassSeq.resize( nTypeCount );
- const Type* pTypes = SupportedTypesSeq.getConstArray();
- for( i = 0 ; i < nTypeCount ; i++ )
- pClasses[i] = reflection->forName( pTypes[i].getTypeName() );
+ for( i = 0 ; i < (sal_Int32)nTypeCount ; i++ )
+ SupportedClassSeq[i] = reflection->forName( SupportedTypesSeq[i].getTypeName() );
}
// First look for particular interfaces that are of particular
@@ -1848,9 +1814,8 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
for( i = 0 ; i < nLen ; i++ )
{
// Put property in its own list
- pAccess->checkPropertyArraysSize
- ( pAllPropArray, pMapTypeArray, pPropertyConceptArray, rPropCount );
- Property& rProp = pAllPropArray[ rPropCount ];
+ pAccess->checkPropertyArraysSize( rPropCount );
+ Property& rProp = rAllPropArray[ rPropCount ];
rProp = pProps[ i ];
if( bFast )
@@ -1860,8 +1825,8 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
rProp.Handle = rPropCount;
// Remember type of property
- pMapTypeArray[ rPropCount ] = MAP_PROPERTY_SET;
- pPropertyConceptArray[ rPropCount ] = PROPERTYSET;
+ rMapTypeArray[ rPropCount ] = MAP_PROPERTY_SET;
+ rPropertyConceptArray[ rPropCount ] = PROPERTYSET;
pAccess->mnPropertySetPropCount++;
// Enter name in hash table if not already known
@@ -1903,10 +1868,10 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
// loop, and XInterface methods are cut off thereafter.
bool bFoundXInterface = false;
- sal_Int32 nClassCount = SupportedClassSeq.getLength();
- for( sal_Int32 nIdx = 0 ; nIdx < nClassCount; nIdx++ )
+ size_t nClassCount = SupportedClassSeq.size();
+ for( sal_Int32 nIdx = 0 ; nIdx < (sal_Int32)nClassCount; nIdx++ )
{
- Reference<XIdlClass> xImplClass2 = SupportedClassSeq.getConstArray()[nIdx];
+ Reference<XIdlClass> xImplClass2 = SupportedClassSeq[nIdx];
while( xImplClass2.is() )
{
// Fetch interfaces from the implementation
@@ -1939,11 +1904,10 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
Reference<XIdlClass> xPropType = xField->getType();
// Is the property sequence big enough?
- pAccess->checkPropertyArraysSize
- ( pAllPropArray, pMapTypeArray, pPropertyConceptArray, rPropCount );
+ pAccess->checkPropertyArraysSize( rPropCount );
// Enter in own property array
- Property& rProp = pAllPropArray[ rPropCount ];
+ Property& rProp = rAllPropArray[ rPropCount ];
OUString aFieldName = xField->getName();
rProp.Name = aFieldName;
rProp.Handle = rPropCount;
@@ -1970,12 +1934,12 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
// Remember field
IntrospectionAccessStatic_Impl::checkInterfaceArraySize( pAccess->aInterfaceSeq1,
- pInterfaces1, rPropCount );
- pInterfaces1[ rPropCount ] = xField;
+ rInterfaces1, rPropCount );
+ rInterfaces1[ rPropCount ] = xField;
// Remember type of property
- pMapTypeArray[ rPropCount ] = MAP_FIELD;
- pPropertyConceptArray[ rPropCount ] = ATTRIBUTES;
+ rMapTypeArray[ rPropCount ] = MAP_FIELD;
+ rPropertyConceptArray[ rPropCount ] = ATTRIBUTES;
pAccess->mnAttributePropCount++;
// Adjust count
@@ -2151,11 +2115,10 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
Reference<XIdlClass> xGetRetType = rxMethod_i->getReturnType();
// Is the property sequence big enough?
- pAccess->checkPropertyArraysSize
- ( pAllPropArray, pMapTypeArray, pPropertyConceptArray, rPropCount );
+ pAccess->checkPropertyArraysSize( rPropCount );
// Write it in its property array
- Property& rProp = pAllPropArray[ rPropCount ];
+ Property& rProp = rAllPropArray[ rPropCount ];
rProp.Name = aPropName;
rProp.Handle = rPropCount;
rProp.Type = Type( xGetRetType->getTypeClass(), xGetRetType->getName() );
@@ -2169,12 +2132,12 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
// Remember get method
IntrospectionAccessStatic_Impl::checkInterfaceArraySize( pAccess->aInterfaceSeq1,
- pInterfaces1, rPropCount );
- pInterfaces1[ rPropCount ] = rxMethod_i;
+ rInterfaces1, rPropCount );
+ rInterfaces1[ rPropCount ] = rxMethod_i;
// Remember type of property
- pMapTypeArray[ rPropCount ] = MAP_GETSET;
- pPropertyConceptArray[ rPropCount ] = METHODS;
+ rMapTypeArray[ rPropCount ] = MAP_GETSET;
+ rPropertyConceptArray[ rPropCount ] = METHODS;
pAccess->mnMethodPropCount++;
// Search for matching set method
@@ -2224,8 +2187,8 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
// Remember set method
IntrospectionAccessStatic_Impl::checkInterfaceArraySize( pAccess->aInterfaceSeq2,
- pInterfaces2, rPropCount );
- pInterfaces2[ rPropCount ] = rxMethod_k;
+ rInterfaces2, rPropCount );
+ rInterfaces2[ rPropCount ] = rxMethod_k;
}
}
@@ -2341,11 +2304,10 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
Reference<XIdlClass> xGetRetType = setParams.getConstArray()[0];
// Is the property sequence big enough?
- pAccess->checkPropertyArraysSize
- ( pAllPropArray, pMapTypeArray, pPropertyConceptArray, rPropCount );
+ pAccess->checkPropertyArraysSize( rPropCount );
// Write it in its property array
- Property& rProp = pAllPropArray[ rPropCount ];
+ Property& rProp = rAllPropArray[ rPropCount ];
rProp.Name = aPropName;
rProp.Handle = rPropCount;
rProp.Type = Type( xGetRetType->getTypeClass(), xGetRetType->getName() );
@@ -2359,12 +2321,12 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
// Remember set method
IntrospectionAccessStatic_Impl::checkInterfaceArraySize( pAccess->aInterfaceSeq2,
- pInterfaces2, rPropCount );
- pInterfaces2[ rPropCount ] = rxMethod_i;
+ rInterfaces2, rPropCount );
+ rInterfaces2[ rPropCount ] = rxMethod_i;
// Remember type of property
- pMapTypeArray[ rPropCount ] = MAP_SETONLY;
- pPropertyConceptArray[ rPropCount ] = METHODS;
+ rMapTypeArray[ rPropCount ] = MAP_SETONLY;
+ rPropertyConceptArray[ rPropCount ] = METHODS;
pAccess->mnMethodPropCount++;
// Adjust count
@@ -2391,14 +2353,11 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
}
// Enlarge sequences in the access object accordingly
- pAccess->maAllMethodSeq.realloc( nExportedMethodCount + iAllExportedMethod );
- pAccess->maMethodConceptSeq.realloc( nExportedMethodCount + iAllExportedMethod );
- pAccess->maSupportedListenerSeq.realloc( nSupportedListenerCount + iAllSupportedListener );
+ pAccess->maAllMethodSeq.resize( nExportedMethodCount + iAllExportedMethod );
+ pAccess->maMethodConceptSeq.resize( nExportedMethodCount + iAllExportedMethod );
+ pAccess->maSupportedListenerSeq.resize( nSupportedListenerCount + iAllSupportedListener );
// Write in methods
- Reference<XIdlMethod>* pDestMethods = pAccess->maAllMethodSeq.getArray();
- sal_Int32* pMethodConceptArray = pAccess->maMethodConceptSeq.getArray();
- Type* pListenerClassRefs = pAccess->maSupportedListenerSeq.getArray();
for( i = 0 ; i < nSourceMethodCount ; i++ )
{
if( pMethodTypes[ i ] != INVALID_METHOD )
@@ -2421,7 +2380,7 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
{
sal_Int32 iHashResult = (*aIt).second;
- Reference<XIdlMethod> xExistingMethod = pDestMethods[ iHashResult ];
+ Reference<XIdlMethod> xExistingMethod = pAccess->maAllMethodSeq[ iHashResult ];
Reference< XIdlClass > xExistingMethClass =
xExistingMethod->getDeclaringClass();
@@ -2430,13 +2389,13 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
continue;
}
- pDestMethods[ iAllExportedMethod ] = rxMethod;
+ pAccess->maAllMethodSeq[ iAllExportedMethod ] = rxMethod;
// If a concept has been set, is the method "normal"?
sal_Int32& rMethodConcept_i = pLocalMethodConcepts[ i ];
if( !rMethodConcept_i )
rMethodConcept_i = MethodConcept_NORMAL_IMPL;
- pMethodConceptArray[ iAllExportedMethod ] = rMethodConcept_i;
+ pAccess->maMethodConceptSeq[ iAllExportedMethod ] = rMethodConcept_i;
iAllExportedMethod++;
}
if( pMethodTypes[ i ] == ADD_LISTENER_METHOD )
@@ -2485,7 +2444,7 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
//aListenerName = aMethName.Copy( 3, aMethName.Len()-8-3 );
//Reference<XIdlClass> xListenerClass = reflection->forName( aListenerName );
Type aListenerType( TypeClass_INTERFACE, xListenerClass->getName() );
- pListenerClassRefs[ iAllSupportedListener ] = aListenerType;
+ pAccess->maSupportedListenerSeq[ iAllSupportedListener ] = aListenerType;
iAllSupportedListener++;
}
}
@@ -2520,13 +2479,13 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
// out only after the determination of nExportedMethodCount)
sal_Int32& rMethCount = pAccess->mnMethCount;
rMethCount = iAllExportedMethod;
- pAccess->maAllMethodSeq.realloc( rMethCount );
- pAccess->maMethodConceptSeq.realloc( rMethCount );
+ pAccess->maAllMethodSeq.resize( rMethCount );
+ pAccess->maMethodConceptSeq.resize( rMethCount );
// Resize the property sequences
- pAccess->maAllPropertySeq.realloc( rPropCount );
- pAccess->maPropertyConceptSeq.realloc( rPropCount );
- pAccess->maMapTypeSeq.realloc( rPropCount );
+ pAccess->maAllPropertySeq.resize( rPropCount );
+ pAccess->maPropertyConceptSeq.resize( rPropCount );
+ pAccess->maMapTypeSeq.resize( rPropCount );
}
// Register struct fields as properties
else //if( eType == TypeClass_STRUCT )
@@ -2553,11 +2512,10 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
OUString aPropName = xField->getName();
// Is the property sequence big enough?
- pAccess->checkPropertyArraysSize
- ( pAllPropArray, pMapTypeArray, pPropertyConceptArray, rPropCount );
+ pAccess->checkPropertyArraysSize( rPropCount );
// Write it in its property array
- Property& rProp = pAllPropArray[ rPropCount ];
+ Property& rProp = rAllPropArray[ rPropCount ];
rProp.Name = aPropName;
rProp.Handle = rPropCount;
rProp.Type = Type( xPropType->getTypeClass(), xPropType->getName() );
@@ -2578,12 +2536,12 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
// Remember field
IntrospectionAccessStatic_Impl::checkInterfaceArraySize( pAccess->aInterfaceSeq1,
- pInterfaces1, rPropCount );
- pInterfaces1[ rPropCount ] = xField;
+ rInterfaces1, rPropCount );
+ rInterfaces1[ rPropCount ] = xField;
// Remember type of property
- pMapTypeArray[ rPropCount ] = MAP_FIELD;
- pPropertyConceptArray[ rPropCount ] = ATTRIBUTES;
+ rMapTypeArray[ rPropCount ] = MAP_FIELD;
+ rPropertyConceptArray[ rPropCount ] = ATTRIBUTES;
pAccess->mnAttributePropCount++;
// Adjust count
@@ -2592,7 +2550,7 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
}
// Set property sequence to the correct length
- pAccess->maAllPropertySeq.realloc( pAccess->mnPropCount );
+ pAccess->maAllPropertySeq.resize( pAccess->mnPropCount );
return new ImplIntrospectionAccess(aToInspectObj, pAccess);
}