From 2e626373db2412ac22e8c5c27a60d11cd29e875b Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Sat, 28 Jan 2012 20:52:45 +0100 Subject: replace obsolete "master" branch with README that points at new repo --- xmlsecurity/tools/standalone/mscsfit/helper.hxx | 204 ------------------------ 1 file changed, 204 deletions(-) delete mode 100644 xmlsecurity/tools/standalone/mscsfit/helper.hxx (limited to 'xmlsecurity/tools/standalone/mscsfit/helper.hxx') diff --git a/xmlsecurity/tools/standalone/mscsfit/helper.hxx b/xmlsecurity/tools/standalone/mscsfit/helper.hxx deleted file mode 100644 index 3fe345ffd..000000000 --- a/xmlsecurity/tools/standalone/mscsfit/helper.hxx +++ /dev/null @@ -1,204 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -using namespace ::rtl ; -using namespace ::cppu ; -using namespace ::com::sun::star ; -using namespace ::com::sun::star::uno ; -using namespace ::com::sun::star::io ; -using namespace ::com::sun::star::ucb ; -using namespace ::com::sun::star::beans ; -using namespace ::com::sun::star::document ; -using namespace ::com::sun::star::lang ; -using namespace ::com::sun::star::bridge ; -using namespace ::com::sun::star::registry ; -using namespace ::com::sun::star::task ; -using namespace ::com::sun::star::xml ; -using namespace ::com::sun::star::xml::wrapper ; -using namespace ::com::sun::star::xml::sax ; - - -/** - * Helper: Implementation of XInputStream - */ -class OInputStream : public WeakImplHelper1 < XInputStream > -{ - public: - OInputStream( const Sequence< sal_Int8 >&seq ) : m_seq( seq ), nPos( 0 ) {} - - virtual sal_Int32 SAL_CALL readBytes( - Sequence< sal_Int8 >& aData , - sal_Int32 nBytesToRead - ) throw( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException ) - { - nBytesToRead = ( nBytesToRead > m_seq.getLength() - nPos ) ? - m_seq.getLength() - nPos : - nBytesToRead ; - aData = Sequence< sal_Int8 > ( &( m_seq.getConstArray()[nPos] ), nBytesToRead ) ; - nPos += nBytesToRead ; - return nBytesToRead ; - } - - virtual sal_Int32 SAL_CALL readSomeBytes( - ::com::sun::star::uno::Sequence< sal_Int8 >& aData , - sal_Int32 nMaxBytesToRead - ) throw( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException ) - { - return readBytes( aData, nMaxBytesToRead ) ; - } - - virtual void SAL_CALL skipBytes( - sal_Int32 nBytesToSkip - ) throw( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException ) - { - // not implemented - } - - virtual sal_Int32 SAL_CALL available( - void - ) throw( NotConnectedException, IOException, RuntimeException ) - { - return m_seq.getLength() - nPos ; - } - - virtual void SAL_CALL closeInput( - void - ) throw( NotConnectedException, IOException, RuntimeException ) - { - // not needed - } - - private: - sal_Int32 nPos; - Sequence< sal_Int8> m_seq; -} ; - -/** - * Helper : create a input stream from a file - */ -Reference< XInputStream > createStreamFromFile( const OUString sFile ) ; - -/** - * Helper: Implementation of XOutputStream - */ -class OOutputStream : public WeakImplHelper1 < XOutputStream > -{ - public: - OOutputStream( const char *pcFile ) { - strcpy( m_pcFile , pcFile ) ; - m_f = 0 ; - } - - virtual void SAL_CALL writeBytes( - const Sequence< sal_Int8 >& aData - ) throw( NotConnectedException , BufferSizeExceededException , RuntimeException ) { - if( !m_f ) { - m_f = fopen( m_pcFile , "w" ) ; - } - - fwrite( aData.getConstArray() , 1 , aData.getLength() , m_f ) ; - } - - virtual void SAL_CALL flush( - void - ) throw( NotConnectedException , BufferSizeExceededException , RuntimeException ) { - fflush( m_f ) ; - } - - virtual void SAL_CALL closeOutput( - void - ) throw( NotConnectedException , BufferSizeExceededException , RuntimeException ) { - fclose( m_f ) ; - m_f = 0 ; - } - - private: - char m_pcFile[256]; - FILE *m_f; -} ; - -/** - * Helper: Implementation of XUriBinding - */ -class OUriBinding : public WeakImplHelper1 < ::com::sun::star::xml::crypto::XUriBinding > -{ - public: - OUriBinding() { - //Do nothing - } - - OUriBinding( - ::rtl::OUString& aUri, - ::com::sun::star::uno::Reference< com::sun::star::io::XInputStream >& aInputStream ) { - m_vUris.push_back( aUri ) ; - m_vStreams.push_back( aInputStream ) ; - } - - virtual void SAL_CALL setUriBinding( - const ::rtl::OUString& aUri , - const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& aInputStream - ) throw( ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException ) { - m_vUris.push_back( aUri ) ; - m_vStreams.push_back( aInputStream ) ; - } - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getUriBinding( const ::rtl::OUString& uri ) throw( ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException ) { - ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > xInputStream ; - - int size = m_vUris.size() ; - for( int i = 0 ; i m_vUris ; - std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > > m_vStreams ; -} ; - -/** - * Helper : set a output stream to a file - */ -Reference< XOutputStream > createStreamToFile( const OUString sFile ) ; - -/** - * Helper : get service manager and context - */ -Reference< XMultiComponentFactory > serviceManager( Reference< XComponentContext >& xContext , OUString sUnoUrl , OUString sRdbUrl ) throw( RuntimeException , Exception ) ; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.3