diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2016-02-16 19:58:33 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-04-01 07:33:45 +0000 |
commit | 3f7f497192deb486b1b959996c14f8f094146945 (patch) | |
tree | b830caec984a7ac9fb71ce92663f35c3f5f221a1 /framework/source/jobs | |
parent | dba6451b2f25b3d8510e0a848977166ee5e6c8e3 (diff) |
sequence->vector in framework
Change-Id: I457c3da4f4a31f58d688dcd96a2ccfc36518490d
Reviewed-on: https://gerrit.libreoffice.org/23692
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'framework/source/jobs')
-rw-r--r-- | framework/source/jobs/job.cxx | 7 | ||||
-rw-r--r-- | framework/source/jobs/jobdata.cxx | 35 | ||||
-rw-r--r-- | framework/source/jobs/jobdispatch.cxx | 4 | ||||
-rw-r--r-- | framework/source/jobs/jobexecutor.cxx | 6 | ||||
-rw-r--r-- | framework/source/jobs/jobresult.cxx | 9 |
5 files changed, 31 insertions, 30 deletions
diff --git a/framework/source/jobs/job.cxx b/framework/source/jobs/job.cxx index 8980495651b2..527c4545c5da 100644 --- a/framework/source/jobs/job.cxx +++ b/framework/source/jobs/job.cxx @@ -29,6 +29,7 @@ #include <com/sun/star/lang/DisposedException.hpp> #include <comphelper/processfactory.hxx> +#include <comphelper/sequence.hxx> #include <rtl/ustrbuf.hxx> #include <vcl/svapp.hxx> @@ -364,7 +365,7 @@ css::uno::Sequence< css::beans::NamedValue > Job::impl_generateJobArgs( /*IN*/ c // Means: if this job has any configuration data. Note: only really // filled lists will be set to the return structure at the end of this method. css::uno::Sequence< css::beans::NamedValue > lConfigArgs; - css::uno::Sequence< css::beans::NamedValue > lJobConfigArgs; + std::vector< css::beans::NamedValue > lJobConfigArgs; if (eMode==JobData::E_ALIAS || eMode==JobData::E_EVENT) { lConfigArgs = m_aJobCfg.getConfig(); @@ -382,12 +383,12 @@ css::uno::Sequence< css::beans::NamedValue > Job::impl_generateJobArgs( /*IN*/ c lAllArgs[nLength].Name = "Config"; lAllArgs[nLength].Value <<= lConfigArgs; } - if (lJobConfigArgs.getLength()>0) + if (!lJobConfigArgs.empty()) { sal_Int32 nLength = lAllArgs.getLength(); lAllArgs.realloc(nLength+1); lAllArgs[nLength].Name = "JobConfig"; - lAllArgs[nLength].Value <<= lJobConfigArgs; + lAllArgs[nLength].Value <<= comphelper::containerToSequence(lJobConfigArgs); } if (lEnvArgs.getLength()>0) { diff --git a/framework/source/jobs/jobdata.cxx b/framework/source/jobs/jobdata.cxx index 14f4ddc6f6e1..c3b453d83691 100644 --- a/framework/source/jobs/jobdata.cxx +++ b/framework/source/jobs/jobdata.cxx @@ -151,7 +151,7 @@ void JobData::setAlias( const OUString& sAlias ) { css::uno::Sequence< OUString > lArgumentNames = xArgumentList->getElementNames(); sal_Int32 nCount = lArgumentNames.getLength(); - m_lArguments.realloc(nCount); + m_lArguments.resize(nCount); for (sal_Int32 i=0; i<nCount; ++i) { m_lArguments[i].Name = lArgumentNames[i]; @@ -222,7 +222,7 @@ void JobData::setEvent( const OUString& sEvent , @param lArguments list of arguments, which should be set for this job */ -void JobData::setJobConfig( const css::uno::Sequence< css::beans::NamedValue >& lArguments ) +void JobData::setJobConfig( const std::vector< css::beans::NamedValue >& lArguments ) { SolarMutexGuard g; @@ -246,7 +246,7 @@ void JobData::setJobConfig( const css::uno::Sequence< css::beans::NamedValue >& css::uno::Reference< css::beans::XMultiHierarchicalPropertySet > xArgumentList(aConfig.cfg(), css::uno::UNO_QUERY); if (xArgumentList.is()) { - sal_Int32 nCount = m_lArguments.getLength(); + sal_Int32 nCount = m_lArguments.size(); css::uno::Sequence< OUString > lNames (nCount); css::uno::Sequence< css::uno::Any > lValues(nCount); @@ -350,7 +350,7 @@ OUString JobData::getEvent() const return m_sEvent; } -css::uno::Sequence< css::beans::NamedValue > JobData::getJobConfig() const +std::vector< css::beans::NamedValue > JobData::getJobConfig() const { SolarMutexGuard g; return m_lArguments; @@ -471,9 +471,9 @@ void JobData::appendEnabledJobsForEvent( const css::uno::Reference< css::uno::XC const OUString& sEvent , ::std::vector< JobData::TJob2DocEventBinding >& lJobs ) { - css::uno::Sequence< OUString > lAdditionalJobs = JobData::getEnabledJobsForEvent(rxContext, sEvent); - sal_Int32 c = lAdditionalJobs.getLength(); - sal_Int32 i = 0; + std::vector< OUString > lAdditionalJobs = JobData::getEnabledJobsForEvent(rxContext, sEvent); + sal_Int32 c = lAdditionalJobs.size(); + sal_Int32 i = 0; for (i=0; i<c; ++i) { @@ -505,32 +505,30 @@ bool JobData::hasCorrectContext(const OUString& rModuleIdent) const return false; } -/** - */ -css::uno::Sequence< OUString > JobData::getEnabledJobsForEvent( const css::uno::Reference< css::uno::XComponentContext >& rxContext, +std::vector< OUString > JobData::getEnabledJobsForEvent( const css::uno::Reference< css::uno::XComponentContext >& rxContext, const OUString& sEvent ) { // create a config access to "/org.openoffice.Office.Jobs/Events" ConfigAccess aConfig(rxContext, "/org.openoffice.Office.Jobs/Events"); aConfig.open(ConfigAccess::E_READONLY); if (aConfig.getMode()==ConfigAccess::E_CLOSED) - return css::uno::Sequence< OUString >(); + return std::vector< OUString >(); css::uno::Reference< css::container::XHierarchicalNameAccess > xEventRegistry(aConfig.cfg(), css::uno::UNO_QUERY); if (!xEventRegistry.is()) - return css::uno::Sequence< OUString >(); + return std::vector< OUString >(); // check if the given event exist inside list of registered ones OUString sPath(sEvent + "/JobList"); if (!xEventRegistry->hasByHierarchicalName(sPath)) - return css::uno::Sequence< OUString >(); + return std::vector< OUString >(); // step to the job list, which is a child of the event node inside cfg // e.g. "/org.openoffice.Office.Jobs/Events/<event name>/JobList" css::uno::Any aJobList = xEventRegistry->getByHierarchicalName(sPath); css::uno::Reference< css::container::XNameAccess > xJobList; if (!(aJobList >>= xJobList) || !xJobList.is()) - return css::uno::Sequence< OUString >(); + return std::vector< OUString >(); // get all alias names of jobs, which are part of this job list // But Some of them can be disabled by its time stamp values. @@ -541,8 +539,7 @@ css::uno::Sequence< OUString > JobData::getEnabledJobsForEvent( const css::uno:: OUString* pAllJobs = lAllJobs.getArray(); sal_Int32 c = lAllJobs.getLength(); - css::uno::Sequence< OUString > lEnabledJobs(c); - OUString* pEnabledJobs = lEnabledJobs.getArray(); + std::vector< OUString > lEnabledJobs(c); sal_Int32 d = 0; for (sal_Int32 s=0; s<c; ++s) @@ -565,10 +562,10 @@ css::uno::Sequence< OUString > JobData::getEnabledJobsForEvent( const css::uno:: if (!isEnabled(sAdminTime, sUserTime)) continue; - pEnabledJobs[d] = pAllJobs[s]; + lEnabledJobs[d] = pAllJobs[s]; ++d; } - lEnabledJobs.realloc(d); + lEnabledJobs.resize(d); aConfig.close(); @@ -595,7 +592,7 @@ void JobData::impl_reset() m_sService.clear(); m_sContext.clear(); m_sEvent.clear(); - m_lArguments = css::uno::Sequence< css::beans::NamedValue >(); + m_lArguments.clear(); } } // namespace framework diff --git a/framework/source/jobs/jobdispatch.cxx b/framework/source/jobs/jobdispatch.cxx index e855de85d053..78e014c30c40 100644 --- a/framework/source/jobs/jobdispatch.cxx +++ b/framework/source/jobs/jobdispatch.cxx @@ -311,7 +311,7 @@ void JobDispatch::impl_dispatchEvent( /*IN*/ const OUString& // filter disabled jobs using it's time stamp values. /* SAFE { */ SolarMutexResettableGuard aReadLock; - css::uno::Sequence< OUString > lJobs = JobData::getEnabledJobsForEvent(m_xContext, sEvent); + std::vector< OUString > lJobs = JobData::getEnabledJobsForEvent(m_xContext, sEvent); aReadLock.clear(); /* } SAFE */ @@ -323,7 +323,7 @@ void JobDispatch::impl_dispatchEvent( /*IN*/ const OUString& // It's not really an error, if no registered jobs could be located. // Step over all found jobs and execute it int nExecutedJobs=0; - for (int j=0; j<lJobs.getLength(); ++j) + for (size_t j=0; j<lJobs.size(); ++j) { /* SAFE { */ aReadLock.reset(); diff --git a/framework/source/jobs/jobexecutor.cxx b/framework/source/jobs/jobexecutor.cxx index 05fd77de3eb0..f53c02531a86 100644 --- a/framework/source/jobs/jobexecutor.cxx +++ b/framework/source/jobs/jobexecutor.cxx @@ -205,7 +205,7 @@ void SAL_CALL JobExecutor::trigger( const OUString& sEvent ) throw(css::uno::Run { SAL_INFO( "fwk", "JobExecutor::trigger()"); - css::uno::Sequence< OUString > lJobs; + std::vector< OUString > lJobs; /* SAFE */ { osl::MutexGuard g(rBHelper.rMutex); @@ -223,8 +223,8 @@ void SAL_CALL JobExecutor::trigger( const OUString& sEvent ) throw(css::uno::Run } /* SAFE */ // step over all enabled jobs and execute it - sal_Int32 c = lJobs.getLength(); - for (sal_Int32 j=0; j<c; ++j) + size_t c = lJobs.size(); + for (size_t j=0; j<c; ++j) { rtl::Reference<Job> pJob; diff --git a/framework/source/jobs/jobresult.cxx b/framework/source/jobs/jobresult.cxx index 05771828692e..01adf16c9981 100644 --- a/framework/source/jobs/jobresult.cxx +++ b/framework/source/jobs/jobresult.cxx @@ -25,6 +25,7 @@ #include <rtl/ustrbuf.hxx> #include <vcl/svapp.hxx> #include <comphelper/sequenceashashmap.hxx> +#include <comphelper/sequence.hxx> namespace framework{ @@ -113,8 +114,10 @@ JobResult::JobResult( /*IN*/ const css::uno::Any& aResult ) pIt = aProtocol.find(JobConst::ANSWER_SAVE_ARGUMENTS()); if (pIt != aProtocol.end()) { - pIt->second >>= m_lArguments; - if (m_lArguments.getLength() > 0) + css::uno::Sequence<css::beans::NamedValue> aTmp; + pIt->second >>= aTmp; + comphelper::sequenceToContainer(m_lArguments, aTmp); + if (!m_lArguments.size()) m_eParts |= E_ARGUMENTS; } @@ -190,7 +193,7 @@ bool JobResult::existPart( sal_uInt32 eParts ) const @return It returns the state of the internal member without any checks! */ -css::uno::Sequence< css::beans::NamedValue > JobResult::getArguments() const +std::vector< css::beans::NamedValue > JobResult::getArguments() const { SolarMutexGuard g; return m_lArguments; |