diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2018-06-11 13:14:07 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2018-06-12 07:35:25 +0200 |
commit | 51aa57cd8ed46d28262e0d315328231f0fa814f4 (patch) | |
tree | a1b850e365eea2a80307e59febe3b20272e14d97 | |
parent | f9e9012e75afe4418f4ebe652fa99a1fa2348a71 (diff) |
tdf#96099 Remove some trivial std::vector typedefs
Cleanup package, reportdesign, sal.
Change-Id: I8622465886f7ec97700b00740ea37d40767ec98e
Reviewed-on: https://gerrit.libreoffice.org/55616
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
-rw-r--r-- | package/source/xstor/ohierarchyholder.cxx | 12 | ||||
-rw-r--r-- | package/source/xstor/ohierarchyholder.hxx | 11 | ||||
-rw-r--r-- | package/source/xstor/xstorage.cxx | 6 | ||||
-rw-r--r-- | reportdesign/source/filter/xml/xmlExport.cxx | 12 | ||||
-rw-r--r-- | reportdesign/source/filter/xml/xmlExport.hxx | 5 | ||||
-rw-r--r-- | sal/osl/all/debugbase.cxx | 12 | ||||
-rw-r--r-- | sal/osl/w32/procimpl.cxx | 21 | ||||
-rw-r--r-- | sal/qa/osl/process/osl_process.cxx | 44 |
8 files changed, 56 insertions, 67 deletions
diff --git a/package/source/xstor/ohierarchyholder.cxx b/package/source/xstor/ohierarchyholder.cxx index 508107ac7c53..5f6cf2291b54 100644 --- a/package/source/xstor/ohierarchyholder.cxx +++ b/package/source/xstor/ohierarchyholder.cxx @@ -35,7 +35,7 @@ using namespace ::com::sun::star; // OHierarchyHolder_Impl -uno::Reference< embed::XExtendedStorageStream > OHierarchyHolder_Impl::GetStreamHierarchically( sal_Int32 nStorageMode, OStringList_Impl& aListPath, sal_Int32 nStreamMode, const ::comphelper::SequenceAsHashMap& aEncryptionData ) +uno::Reference< embed::XExtendedStorageStream > OHierarchyHolder_Impl::GetStreamHierarchically( sal_Int32 nStorageMode, std::vector<OUString>& aListPath, sal_Int32 nStreamMode, const ::comphelper::SequenceAsHashMap& aEncryptionData ) { uno::Reference< embed::XStorage > xOwnStor( m_xWeakOwnStorage.get(), uno::UNO_QUERY_THROW ); @@ -50,7 +50,7 @@ uno::Reference< embed::XExtendedStorageStream > OHierarchyHolder_Impl::GetStream return xResult; } -void OHierarchyHolder_Impl::RemoveStreamHierarchically( OStringList_Impl& aListPath ) +void OHierarchyHolder_Impl::RemoveStreamHierarchically( std::vector<OUString>& aListPath ) { uno::Reference< embed::XStorage > xOwnStor( m_xWeakOwnStorage.get(), uno::UNO_QUERY_THROW ); @@ -58,9 +58,9 @@ void OHierarchyHolder_Impl::RemoveStreamHierarchically( OStringList_Impl& aListP } // static -OStringList_Impl OHierarchyHolder_Impl::GetListPathFromString( const OUString& aPath ) +std::vector<OUString> OHierarchyHolder_Impl::GetListPathFromString( const OUString& aPath ) { - OStringList_Impl aResult; + std::vector<OUString> aResult; sal_Int32 nIndex = 0; do { @@ -77,7 +77,7 @@ OStringList_Impl OHierarchyHolder_Impl::GetListPathFromString( const OUString& a // OHierarchyElement_Impl -uno::Reference< embed::XExtendedStorageStream > OHierarchyElement_Impl::GetStreamHierarchically( sal_Int32 nStorageMode, OStringList_Impl& aListPath, sal_Int32 nStreamMode, const ::comphelper::SequenceAsHashMap& aEncryptionData ) +uno::Reference< embed::XExtendedStorageStream > OHierarchyElement_Impl::GetStreamHierarchically( sal_Int32 nStorageMode, std::vector<OUString>& aListPath, sal_Int32 nStreamMode, const ::comphelper::SequenceAsHashMap& aEncryptionData ) { ::osl::MutexGuard aGuard( m_aMutex ); @@ -161,7 +161,7 @@ uno::Reference< embed::XExtendedStorageStream > OHierarchyElement_Impl::GetStrea return xResult; } -void OHierarchyElement_Impl::RemoveStreamHierarchically( OStringList_Impl& aListPath ) +void OHierarchyElement_Impl::RemoveStreamHierarchically( std::vector<OUString>& aListPath ) { ::osl::MutexGuard aGuard( m_aMutex ); diff --git a/package/source/xstor/ohierarchyholder.hxx b/package/source/xstor/ohierarchyholder.hxx index 3d18c8d407da..317a4d9b329c 100644 --- a/package/source/xstor/ohierarchyholder.hxx +++ b/package/source/xstor/ohierarchyholder.hxx @@ -38,7 +38,6 @@ struct OHierarchyElement_Impl; typedef std::unordered_map< OUString, ::rtl::Reference< OHierarchyElement_Impl > > OHierarchyElementList_Impl; -typedef ::std::vector< OUString > OStringList_Impl; typedef ::std::list< css::uno::WeakReference< css::embed::XExtendedStorageStream > > OWeakStorRefList_Impl; @@ -75,11 +74,11 @@ public: css::uno::Reference< css::embed::XExtendedStorageStream > GetStreamHierarchically( sal_Int32 nStorageMode, - OStringList_Impl& aPath, + std::vector<OUString>& aPath, sal_Int32 nStreamMode, const ::comphelper::SequenceAsHashMap& aEncryptionData ); - void RemoveStreamHierarchically( OStringList_Impl& aListPath ); + void RemoveStreamHierarchically( std::vector<OUString>& aListPath ); // XEventListener virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; @@ -102,15 +101,15 @@ public: , m_xChild( new OHierarchyElement_Impl( css::uno::WeakReference< css::embed::XStorage >( xOwnStorage ) ) ) {} - static OStringList_Impl GetListPathFromString( const OUString& aPath ); + static std::vector<OUString> GetListPathFromString( const OUString& aPath ); css::uno::Reference< css::embed::XExtendedStorageStream > GetStreamHierarchically( sal_Int32 nStorageMode, - OStringList_Impl& aListPath, + std::vector<OUString>& aListPath, sal_Int32 nStreamMode, const ::comphelper::SequenceAsHashMap& aEncryptionData = ::comphelper::SequenceAsHashMap() ); - void RemoveStreamHierarchically( OStringList_Impl& aListPath ); + void RemoveStreamHierarchically( std::vector<OUString>& aListPath ); }; #endif // _OHIERARCHYHOLDER diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index 2796976ea872..ca646e10f41b 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -5431,7 +5431,7 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL OStorage::openStreamEle && ( nOpenMode & embed::ElementModes::WRITE ) ) throw io::IOException( THROW_WHERE ); // Access denied - OStringList_Impl aListPath = OHierarchyHolder_Impl::GetListPathFromString( aStreamPath ); + std::vector<OUString> aListPath = OHierarchyHolder_Impl::GetListPathFromString( aStreamPath ); OSL_ENSURE( aListPath.size(), "The result list must not be empty!" ); uno::Reference< embed::XExtendedStorageStream > xResult; @@ -5493,7 +5493,7 @@ void SAL_CALL OStorage::removeStreamElementByHierarchicalName( const OUString& a if ( !( m_pImpl->m_nStorageMode & embed::ElementModes::WRITE ) ) throw io::IOException( THROW_WHERE ); // Access denied - OStringList_Impl aListPath = OHierarchyHolder_Impl::GetListPathFromString( aStreamPath ); + std::vector<OUString> aListPath = OHierarchyHolder_Impl::GetListPathFromString( aStreamPath ); OSL_ENSURE( aListPath.size(), "The result list must not be empty!" ); if ( !m_pData->m_rHierarchyHolder.is() ) @@ -5527,7 +5527,7 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL OStorage::openEncrypted && ( nOpenMode & embed::ElementModes::WRITE ) ) throw io::IOException( THROW_WHERE ); // Access denied - OStringList_Impl aListPath = OHierarchyHolder_Impl::GetListPathFromString( aStreamPath ); + std::vector<OUString> aListPath = OHierarchyHolder_Impl::GetListPathFromString( aStreamPath ); OSL_ENSURE( aListPath.size(), "The result list must not be empty!" ); uno::Reference< embed::XExtendedStorageStream > xResult; diff --git a/reportdesign/source/filter/xml/xmlExport.cxx b/reportdesign/source/filter/xml/xmlExport.cxx index 80f25884cf28..6e11dc0d32e5 100644 --- a/reportdesign/source/filter/xml/xmlExport.cxx +++ b/reportdesign/source/filter/xml/xmlExport.cxx @@ -493,7 +493,7 @@ void lcl_calculate(const ::std::vector<sal_Int32>& _aPosX,const ::std::vector<sa } } -void ORptExport::collectStyleNames(sal_Int32 _nFamily,const ::std::vector< sal_Int32>& _aSize, ORptExport::TStringVec& _rStyleNames) +void ORptExport::collectStyleNames(sal_Int32 _nFamily,const ::std::vector< sal_Int32>& _aSize, std::vector<OUString>& _rStyleNames) { ::std::vector< XMLPropertyState > aPropertyStates; aPropertyStates.emplace_back(0); @@ -570,9 +570,9 @@ void ORptExport::exportSectionAutoStyle(const Reference<XSection>& _xProp) ).first; lcl_calculate(aColumnPos,aRowPos,aInsert->second); - TGridStyleMap::iterator aPos = m_aColumnStyleNames.emplace(_xProp.get(),TStringVec()).first; + TGridStyleMap::iterator aPos = m_aColumnStyleNames.emplace(_xProp.get(),std::vector<OUString>()).first; collectStyleNames(XML_STYLE_FAMILY_TABLE_COLUMN,aColumnPos,aPos->second); - aPos = m_aRowStyleNames.emplace(_xProp.get(),TStringVec()).first; + aPos = m_aRowStyleNames.emplace(_xProp.get(),std::vector<OUString>()).first; collectStyleNames(XML_STYLE_FAMILY_TABLE_ROW,aRowPos,aPos->second); sal_Int32 x1 = 0; @@ -737,8 +737,8 @@ void ORptExport::exportTableColumns(const Reference< XSection>& _xSection) if ( aColFind == m_aColumnStyleNames.end() ) return; - TStringVec::const_iterator aColIter = aColFind->second.begin(); - TStringVec::const_iterator aColEnd = aColFind->second.end(); + auto aColIter = aColFind->second.cbegin(); + auto aColEnd = aColFind->second.cend(); for (; aColIter != aColEnd; ++aColIter) { AddAttribute( m_sTableStyle,*aColIter ); @@ -760,7 +760,7 @@ void ORptExport::exportContainer(const Reference< XSection>& _xSection) TGrid::const_iterator aRowEnd = aFind->second.end(); TGridStyleMap::const_iterator aRowFind = m_aRowStyleNames.find(_xSection.get()); - TStringVec::const_iterator aHeightIter = aRowFind->second.begin(); + auto aHeightIter = aRowFind->second.cbegin(); OSL_ENSURE(aRowFind->second.size() == aFind->second.size(),"Different count for rows"); bool bShapeHandled = false; diff --git a/reportdesign/source/filter/xml/xmlExport.hxx b/reportdesign/source/filter/xml/xmlExport.hxx index 07bdc342e811..aef3f6cad58c 100644 --- a/reportdesign/source/filter/xml/xmlExport.hxx +++ b/reportdesign/source/filter/xml/xmlExport.hxx @@ -83,9 +83,8 @@ public: {} }; typedef ::std::pair< OUString ,OUString> TStringPair; - typedef ::std::vector< OUString> TStringVec; typedef ::std::map< Reference<XPropertySet> ,OUString > TPropertyStyleMap; - typedef ::std::map< Reference<XPropertySet> , TStringVec> TGridStyleMap; + typedef ::std::map< Reference<XPropertySet> , std::vector<OUString>> TGridStyleMap; typedef ::std::vector< TCell > TRow; typedef ::std::vector< ::std::pair< bool, TRow > > TGrid; typedef ::std::map< Reference<XPropertySet> ,TGrid > TSectionsGrid; @@ -130,7 +129,7 @@ private: void exportAutoStyle(const Reference<XSection>& _xProp); void exportReportComponentAutoStyles(const Reference<XSection>& _xProp); void collectComponentStyles(); - void collectStyleNames(sal_Int32 _nFamily,const ::std::vector< sal_Int32>& _aSize, ORptExport::TStringVec& _rStyleNames); + void collectStyleNames(sal_Int32 _nFamily,const ::std::vector< sal_Int32>& _aSize, std::vector<OUString>& _rStyleNames); void exportParagraph(const Reference< XReportControlModel >& _xReportElement); bool exportFormula(enum ::xmloff::token::XMLTokenEnum eName,const OUString& _sFormula); void exportGroupsExpressionAsFunction(const Reference< XGroups>& _xGroups); diff --git a/sal/osl/all/debugbase.cxx b/sal/osl/all/debugbase.cxx index 3534b9a828c4..ea46777dc640 100644 --- a/sal/osl/all/debugbase.cxx +++ b/sal/osl/all/debugbase.cxx @@ -29,12 +29,10 @@ namespace { -typedef std::vector<rtl::OString> OStringVec; - struct StaticDebugBaseAddressFilter - : rtl::StaticWithInit<OStringVec, StaticDebugBaseAddressFilter> { - OStringVec operator()() const { - OStringVec vec; + : rtl::StaticWithInit<std::vector<OString>, StaticDebugBaseAddressFilter> { + std::vector<OString> operator()() const { + std::vector<OString> vec; rtl_uString * pStr = nullptr; rtl::OUString const name( "OSL_DEBUGBASE_STORE_ADDRESSES" ); @@ -83,14 +81,14 @@ osl::Mutex & SAL_CALL osl_detail_ObjectRegistry_getMutex() bool SAL_CALL osl_detail_ObjectRegistry_storeAddresses( char const* pName ) SAL_THROW_EXTERN_C() { - OStringVec const& rVec = StaticDebugBaseAddressFilter::get(); + std::vector<OString> const& rVec = StaticDebugBaseAddressFilter::get(); if (rVec.empty()) return false; // check for "all": rtl::OString const& rFirst = rVec[0]; if ( rFirst == "all" ) return true; - OStringVec::const_iterator const iEnd( rVec.end() ); + auto const iEnd( rVec.cend() ); return std::find_if( rVec.begin(), iEnd, [pName] (OString const& it) { return isSubStr(pName, it); }) != iEnd; } diff --git a/sal/osl/w32/procimpl.cxx b/sal/osl/w32/procimpl.cxx index 967fbd359d62..c4e2390f94b6 100644 --- a/sal/osl/w32/procimpl.cxx +++ b/sal/osl/w32/procimpl.cxx @@ -36,11 +36,6 @@ namespace /* private */ { - typedef std::vector<rtl::OUString> string_container_t; - typedef string_container_t::iterator string_container_iterator_t; - typedef string_container_t::const_iterator string_container_const_iterator_t; - typedef std::vector<sal_Unicode> environment_container_t; - /* Function object that compares two strings that are expected to be environment variables in the form "name=value". Only the 'name' part will be compared. @@ -91,13 +86,13 @@ namespace /* private */ size_t sum_; }; - inline size_t calc_sum_of_string_lengths(const string_container_t& string_cont) + inline size_t calc_sum_of_string_lengths(const std::vector<OUString>& string_cont) { return std::for_each( string_cont.begin(), string_cont.end(), sum_of_string_lengths()); } - void read_environment(/*out*/ string_container_t* environment) + void read_environment(/*out*/ std::vector<OUString>* environment) { // GetEnvironmentStrings returns a sorted list, Windows // sorts environment variables upper case @@ -124,7 +119,7 @@ namespace /* private */ bool create_merged_environment( rtl_uString* env_vars[], sal_uInt32 env_vars_count, - /*in|out*/ string_container_t* merged_env) + /*in|out*/ std::vector<OUString>* merged_env) { OSL_ASSERT(env_vars && env_vars_count > 0 && merged_env); @@ -162,9 +157,9 @@ namespace /* private */ bool setup_process_environment( rtl_uString* environment_vars[], sal_uInt32 n_environment_vars, - /*in|out*/ environment_container_t& environment) + /*in|out*/ std::vector<sal_Unicode>& environment) { - string_container_t merged_env; + std::vector<OUString> merged_env; if (!create_merged_environment(environment_vars, n_environment_vars, &merged_env)) return false; @@ -172,8 +167,8 @@ namespace /* private */ // a final '\0' environment.resize(calc_sum_of_string_lengths(merged_env) + 1); - string_container_const_iterator_t iter = merged_env.begin(); - string_container_const_iterator_t iter_end = merged_env.end(); + auto iter = merged_env.cbegin(); + auto iter_end = merged_env.cend(); sal_uInt32 pos = 0; for (/**/; iter != iter_end; ++iter) @@ -445,7 +440,7 @@ oslProcessError SAL_CALL osl_executeProcess_WithRedirectedIO( command_line.append(ustrArguments[n]); } - environment_container_t environment; + std::vector<sal_Unicode> environment; LPVOID p_environment = nullptr; if (nEnvironmentVars && ustrEnvironmentVars) diff --git a/sal/qa/osl/process/osl_process.cxx b/sal/qa/osl/process/osl_process.cxx index b7997209bd09..317682238e49 100644 --- a/sal/qa/osl/process/osl_process.cxx +++ b/sal/qa/osl/process/osl_process.cxx @@ -84,18 +84,16 @@ inline ::rtl::OUString getExecutablePath() //rtl::OUString CWD = getExecutablePath(); -typedef std::vector<OString> string_container_t; - #if !defined _WIN32 class exclude { public: - explicit exclude(const string_container_t& exclude_list) + explicit exclude(const std::vector<OString>& exclude_list) { - string_container_t::const_iterator iter = exclude_list.begin(); - string_container_t::const_iterator iter_end = exclude_list.end(); + auto iter = exclude_list.cbegin(); + auto iter_end = exclude_list.cend(); for (/**/; iter != iter_end; ++iter) exclude_list_.push_back(env_var_name(*iter)); } @@ -125,12 +123,12 @@ private: } private: - string_container_t exclude_list_; + std::vector<OString> exclude_list_; }; namespace { - void tidy_container(string_container_t &env_container) + void tidy_container(std::vector<OString> &env_container) { //sort them because there are no guarantees to ordering std::sort(env_container.begin(), env_container.end()); @@ -147,7 +145,7 @@ namespace } } - void read_parent_environment(string_container_t* env_container) + void read_parent_environment(std::vector<OString>* env_container) { for (int i = 0; environ[i] != nullptr; i++) env_container->push_back(OString(environ[i])); @@ -208,7 +206,7 @@ public: #if !defined _WIN32 - void read_child_environment(string_container_t* env_container) + void read_child_environment(std::vector<OString>* env_container) { OString temp_file_name = OUStringToOString(OUString( parameters_[1]), osl_getThreadTextEncoding()); @@ -232,10 +230,10 @@ public: // environment into a file void compare_environments() { - string_container_t parent_env; + std::vector<OString> parent_env; read_parent_environment(&parent_env); - string_container_t child_env; + std::vector<OString> child_env; read_child_environment(&child_env); OString msg( @@ -256,12 +254,12 @@ public: // compare the equal environment parts and the // different part of the child environment - bool compare_merged_environments(const string_container_t& different_env_vars) + bool compare_merged_environments(const std::vector<OString>& different_env_vars) { - string_container_t parent_env; + std::vector<OString> parent_env; read_parent_environment(&parent_env); - for (string_container_t::const_iterator iter = parent_env.begin(), end = parent_env.end(); iter != end; ++iter) + for (auto iter = parent_env.cbegin(), end = parent_env.cend(); iter != end; ++iter) std::cout << "initially parent env: " << *iter << "\n"; //remove the environment variables that we have changed @@ -270,36 +268,36 @@ public: std::remove_if(parent_env.begin(), parent_env.end(), exclude(different_env_vars)), parent_env.end()); - for (string_container_t::const_iterator iter = parent_env.begin(), end = parent_env.end(); iter != end; ++iter) + for (auto iter = parent_env.cbegin(), end = parent_env.cend(); iter != end; ++iter) std::cout << "stripped parent env: " << *iter << "\n"; //read the child environment and exclude the variables that //are different - string_container_t child_env; + std::vector<OString> child_env; read_child_environment(&child_env); - for (string_container_t::const_iterator iter = child_env.begin(), end = child_env.end(); iter != end; ++iter) + for (auto iter = child_env.cbegin(), end = child_env.cend(); iter != end; ++iter) std::cout << "initial child env: " << *iter << "\n"; //partition the child environment into the variables that //are different to the parent environment (they come first) //and the variables that should be equal between parent //and child environment - string_container_t::iterator iter_logical_end = + auto iter_logical_end = std::stable_partition(child_env.begin(), child_env.end(), exclude(different_env_vars)); - string_container_t different_child_env_vars(child_env.begin(), iter_logical_end); + std::vector<OString> different_child_env_vars(child_env.begin(), iter_logical_end); child_env.erase(child_env.begin(), iter_logical_end); - for (string_container_t::const_iterator iter = child_env.begin(), end = child_env.end(); iter != end; ++iter) + for (auto iter = child_env.cbegin(), end = child_env.cend(); iter != end; ++iter) std::cout << "stripped child env: " << *iter << "\n"; bool common_env_size_equals = (parent_env.size() == child_env.size()); bool common_env_content_equals = std::equal(child_env.begin(), child_env.end(), parent_env.begin()); - for (string_container_t::const_iterator iter = different_env_vars.begin(), end = different_env_vars.end(); iter != end; ++iter) + for (auto iter = different_env_vars.cbegin(), end = different_env_vars.cend(); iter != end; ++iter) std::cout << "different should be: " << *iter << "\n"; - for (string_container_t::const_iterator iter = different_child_env_vars.begin(), end = different_child_env_vars.end(); iter != end; ++iter) + for (auto iter = different_child_env_vars.cbegin(), end = different_child_env_vars.cend(); iter != end; ++iter) std::cout << "different are: " << *iter << "\n"; bool different_env_size_equals = (different_child_env_vars.size() == different_env_vars.size()); @@ -393,7 +391,7 @@ public: osl_freeProcessHandle(process); - string_container_t different_child_env_vars; + std::vector<OString> different_child_env_vars; different_child_env_vars.push_back(ENV1); different_child_env_vars.push_back(ENV2); different_child_env_vars.push_back(ENV4); |