diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-12-14 11:14:39 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-12-14 11:15:41 +0100 |
commit | 007bf2b8c04090920b54e914ac75fc13720b450c (patch) | |
tree | dc090a521f5c89c277581e38f05efebcbd17a883 | |
parent | af7b4eca3db99a63202df285a7df7402e523ff54 (diff) |
utl::TempFile should not be copied
Change-Id: I35d0c96d52b490ef70a0238e715d874f0ecd1012
-rw-r--r-- | chart2/qa/extras/chart2export.cxx | 4 | ||||
-rw-r--r-- | chart2/qa/extras/charttest.hxx | 19 | ||||
-rw-r--r-- | include/unotools/tempfile.hxx | 4 |
3 files changed, 17 insertions, 10 deletions
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx index 6c0f54925837..8088894c6ba6 100644 --- a/chart2/qa/extras/chart2export.cxx +++ b/chart2/qa/extras/chart2export.cxx @@ -85,10 +85,10 @@ void Chart2ExportTest::test() xmlDocPtr Chart2ExportTest::parseExport(const OUString& rStreamName, const OUString& rFilterFormat) { - utl::TempFile aTempFile = reload(rFilterFormat); + boost::shared_ptr<utl::TempFile> pTempFile = reload(rFilterFormat); // Read the XML stream we're interested in. - uno::Reference<packages::zip::XZipFileAccess2> xNameAccess = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory), aTempFile.GetURL()); + uno::Reference<packages::zip::XZipFileAccess2> xNameAccess = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory), pTempFile->GetURL()); uno::Reference<io::XInputStream> xInputStream(xNameAccess->getByName(rStreamName), uno::UNO_QUERY); CPPUNIT_ASSERT(xInputStream.is()); boost::shared_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(xInputStream, sal_True)); diff --git a/chart2/qa/extras/charttest.hxx b/chart2/qa/extras/charttest.hxx index b50f4fd6cd0f..def88c313aac 100644 --- a/chart2/qa/extras/charttest.hxx +++ b/chart2/qa/extras/charttest.hxx @@ -43,6 +43,9 @@ #include <libxml/xmlwriter.h> #include <libxml/xpath.h> +#include <boost/shared_ptr.hpp> +#include <boost/make_shared.hpp> + using namespace com::sun::star; using namespace com::sun::star::uno; @@ -51,7 +54,7 @@ class ChartTest : public test::BootstrapFixture, public unotest::MacrosTest { public: void load( const OUString& rDir, const OUString& rFileName ); - utl::TempFile reload( const OUString& rFileName ); + boost::shared_ptr<utl::TempFile> reload( const OUString& rFileName ); uno::Sequence < OUString > getImpressChartColumnDescriptions( const char* pDir, const char* pName ); OUString getFileExtension( const OUString& rFileName ); @@ -88,20 +91,20 @@ void ChartTest::load( const OUString& aDir, const OUString& aName ) CPPUNIT_ASSERT(mxComponent.is()); } -utl::TempFile ChartTest::reload(const OUString& rFilterName) +boost::shared_ptr<utl::TempFile> ChartTest::reload(const OUString& rFilterName) { uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); uno::Sequence<beans::PropertyValue> aArgs(1); aArgs[0].Name = "FilterName"; aArgs[0].Value <<= rFilterName; - utl::TempFile aTempFile; - aTempFile.EnableKillingFile(); - xStorable->storeToURL(aTempFile.GetURL(), aArgs); + boost::shared_ptr<utl::TempFile> pTempFile = boost::make_shared<utl::TempFile>(); + pTempFile->EnableKillingFile(); + xStorable->storeToURL(pTempFile->GetURL(), aArgs); mxComponent->dispose(); - mxComponent = loadFromDesktop(aTempFile.GetURL(), maServiceName); - std::cout << aTempFile.GetURL(); + mxComponent = loadFromDesktop(pTempFile->GetURL(), maServiceName); + std::cout << pTempFile->GetURL(); CPPUNIT_ASSERT(mxComponent.is()); - return aTempFile; + return pTempFile; } void ChartTest::setUp() diff --git a/include/unotools/tempfile.hxx b/include/unotools/tempfile.hxx index 85eda3dc75bd..26c0581c73ff 100644 --- a/include/unotools/tempfile.hxx +++ b/include/unotools/tempfile.hxx @@ -49,6 +49,10 @@ class UNOTOOLS_DLLPUBLIC TempFile TempFile_Impl* pImp; bool bKillingFileEnabled; + // prevent copy c'tor + TempFile( const TempFile& ); + TempFile& operator=(const TempFile&); + protected: public: |