diff options
-rw-r--r-- | dbaccess/source/filter/xml/xmlExport.cxx | 8 | ||||
-rw-r--r-- | include/comphelper/sequence.hxx | 73 | ||||
-rw-r--r-- | svl/source/items/grabbagitem.cxx | 4 | ||||
-rw-r--r-- | xmloff/source/forms/propertyexport.cxx | 8 |
4 files changed, 11 insertions, 82 deletions
diff --git a/dbaccess/source/filter/xml/xmlExport.cxx b/dbaccess/source/filter/xml/xmlExport.cxx index 53363f09d6fd..e0cd1a11f5e7 100644 --- a/dbaccess/source/filter/xml/xmlExport.cxx +++ b/dbaccess/source/filter/xml/xmlExport.cxx @@ -644,12 +644,14 @@ void ODBExport::exportConnectionData() template< typename T > void ODBExport::exportDataSourceSettingsSequence( std::vector< TypedPropertyValue >::iterator const & in) { - OSequenceIterator< T > i( in->Value ); - while (i.hasMoreElements()) + css::uno::Sequence<T> anySeq; + bool bSuccess = in->Value >>= anySeq; + assert(bSuccess); (void)bSuccess; + for (T const & i : anySeq ) { SvXMLElementExport aDataValue(*this,XML_NAMESPACE_DB, XML_DATA_SOURCE_SETTING_VALUE, true, false); // (no whitespace inside the tag) - Characters(implConvertAny(i.nextElement())); + Characters(implConvertAny(css::uno::Any(i))); } } diff --git a/include/comphelper/sequence.hxx b/include/comphelper/sequence.hxx index 7f134294ea57..3c52c4715965 100644 --- a/include/comphelper/sequence.hxx +++ b/include/comphelper/sequence.hxx @@ -97,79 +97,6 @@ namespace comphelper _rSeq.realloc(nLength-1); } - - //= iterating through sequences - - /** a helper class for iterating through a sequence - */ - template <class TYPE> - class OSequenceIterator - { - const TYPE* m_pElements; - sal_Int32 m_nLen; - const TYPE* m_pCurrent; - - public: - /** construct a sequence iterator from a sequence - */ - OSequenceIterator(const css::uno::Sequence< TYPE >& _rSeq); - /** construct a sequence iterator from a Any containing a sequence - */ - OSequenceIterator(const css::uno::Any& _rSequenceAny); - - bool hasMoreElements() const; - css::uno::Any nextElement(); - - private: - inline void construct(const css::uno::Sequence< TYPE >& _rSeq); - }; - - - template <class TYPE> - inline OSequenceIterator<TYPE>::OSequenceIterator(const css::uno::Sequence< TYPE >& _rSeq) - :m_pElements(nullptr) - ,m_nLen(0) - ,m_pCurrent(nullptr) - { - construct(_rSeq); - } - - - template <class TYPE> - inline OSequenceIterator<TYPE>::OSequenceIterator(const css::uno::Any& _rSequenceAny) - :m_pElements(nullptr) - ,m_nLen(0) - ,m_pCurrent(nullptr) - { - css::uno::Sequence< TYPE > aContainer; - bool bSuccess = _rSequenceAny >>= aContainer; - OSL_ENSURE(bSuccess, "OSequenceIterator::OSequenceIterator: invalid Any!"); - construct(aContainer); - } - - - template <class TYPE> - void OSequenceIterator<TYPE>::construct(const css::uno::Sequence< TYPE >& _rSeq) - { - m_pElements = _rSeq.getConstArray(); - m_nLen = _rSeq.getLength(); - m_pCurrent = m_pElements; - } - - - template <class TYPE> - inline bool OSequenceIterator<TYPE>::hasMoreElements() const - { - return m_pCurrent - m_pElements < m_nLen; - } - - - template <class TYPE> - inline css::uno::Any OSequenceIterator<TYPE>::nextElement() - { - return css::uno::toAny(*m_pCurrent++); - } - /** Copy from a plain C/C++ array into a Sequence. @tpl SrcType diff --git a/svl/source/items/grabbagitem.cxx b/svl/source/items/grabbagitem.cxx index c476fe27e0c1..e5d04da41d7d 100644 --- a/svl/source/items/grabbagitem.cxx +++ b/svl/source/items/grabbagitem.cxx @@ -43,10 +43,8 @@ bool SfxGrabBagItem::PutValue(const uno::Any& rVal, sal_uInt8 /*nMemberId*/) if (rVal >>= aValue) { m_aMap.clear(); - comphelper::OSequenceIterator<beans::PropertyValue> i(aValue); - while (i.hasMoreElements()) + for (beans::PropertyValue const& aPropertyValue : aValue) { - auto aPropertyValue = i.nextElement().get<beans::PropertyValue>(); m_aMap[aPropertyValue.Name] = aPropertyValue.Value; } return true; diff --git a/xmloff/source/forms/propertyexport.cxx b/xmloff/source/forms/propertyexport.cxx index 61844b78e3c7..80d5a97f0752 100644 --- a/xmloff/source/forms/propertyexport.cxx +++ b/xmloff/source/forms/propertyexport.cxx @@ -93,10 +93,12 @@ namespace xmloff OPropertyExport::exportRemainingPropertiesSequence( Any const & value, token::XMLTokenEnum eValueAttName) { - OSequenceIterator< T > i(value); - while (i.hasMoreElements()) + css::uno::Sequence<T> anySeq; + bool bSuccess = value >>= anySeq; + assert(bSuccess); (void)bSuccess; + for (T const & i : anySeq) { - OUString sValue(implConvertAny(i.nextElement())); + OUString sValue(implConvertAny(makeAny(i))); AddAttribute(XML_NAMESPACE_OFFICE, eValueAttName, sValue ); SvXMLElementExport aValueTag( m_rContext.getGlobalContext(), XML_NAMESPACE_FORM, |