update credits
[LibreOffice.git] / include / svl / strmadpt.hxx
blob167d3696d3a20b7104b7d571007058d778d9ed3d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef SVTOOLS_STRMADPT_HXX
21 #define SVTOOLS_STRMADPT_HXX
23 #include "svl/svldllapi.h"
24 #include <com/sun/star/io/XInputStream.hpp>
25 #include <com/sun/star/io/XOutputStream.hpp>
26 #include <com/sun/star/io/XSeekable.hpp>
27 #include <cppuhelper/weak.hxx>
28 #include <tools/stream.hxx>
30 //============================================================================
31 class SVL_DLLPUBLIC SvOutputStreamOpenLockBytes: public SvOpenLockBytes
33 com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >
34 m_xOutputStream;
35 sal_uInt32 m_nPosition;
37 public:
38 TYPEINFO();
40 SvOutputStreamOpenLockBytes(
41 const com::sun::star::uno::Reference<
42 com::sun::star::io::XOutputStream > &
43 rTheOutputStream):
44 m_xOutputStream(rTheOutputStream), m_nPosition(0) {}
46 virtual ErrCode ReadAt(sal_uLong, void *, sal_uLong, sal_uLong *) const;
48 virtual ErrCode WriteAt(sal_uLong nPos, const void * pBuffer, sal_uLong nCount,
49 sal_uLong * pWritten);
51 virtual ErrCode Flush() const;
53 virtual ErrCode SetSize(sal_uLong);
55 virtual ErrCode Stat(SvLockBytesStat * pStat, SvLockBytesStatFlag) const;
57 virtual ErrCode FillAppend(const void * pBuffer, sal_uLong nCount,
58 sal_uLong * pWritten);
60 virtual sal_uLong Tell() const;
62 virtual sal_uLong Seek(sal_uLong);
64 virtual void Terminate();
67 //============================================================================
68 class SVL_DLLPUBLIC SvLockBytesInputStream: public cppu::OWeakObject,
69 public com::sun::star::io::XInputStream,
70 public com::sun::star::io::XSeekable
72 SvLockBytesRef m_xLockBytes;
73 sal_Int64 m_nPosition;
75 public:
76 SvLockBytesInputStream(SvLockBytes * pTheLockBytes):
77 m_xLockBytes(pTheLockBytes), m_nPosition(0) {}
79 virtual com::sun::star::uno::Any SAL_CALL
80 queryInterface(const com::sun::star::uno::Type & rType)
81 throw (com::sun::star::uno::RuntimeException);
83 virtual void SAL_CALL acquire() throw();
85 virtual void SAL_CALL release() throw();
87 virtual sal_Int32 SAL_CALL
88 readBytes(com::sun::star::uno::Sequence< sal_Int8 > & rData,
89 sal_Int32 nBytesToRead)
90 throw (com::sun::star::io::IOException,
91 com::sun::star::uno::RuntimeException);
93 virtual sal_Int32 SAL_CALL
94 readSomeBytes(com::sun::star::uno::Sequence< sal_Int8 > & rData,
95 sal_Int32 nMaxBytesToRead)
96 throw (com::sun::star::io::IOException,
97 com::sun::star::uno::RuntimeException);
99 virtual void SAL_CALL skipBytes(sal_Int32 nBytesToSkip)
100 throw (com::sun::star::io::IOException,
101 com::sun::star::uno::RuntimeException);
103 virtual sal_Int32 SAL_CALL available()
104 throw (com::sun::star::io::IOException,
105 com::sun::star::uno::RuntimeException);
107 virtual void SAL_CALL closeInput()
108 throw (com::sun::star::io::IOException,
109 com::sun::star::uno::RuntimeException);
111 virtual void SAL_CALL seek(sal_Int64 nLocation)
112 throw (com::sun::star::lang::IllegalArgumentException,
113 com::sun::star::io::IOException,
114 com::sun::star::uno::RuntimeException);
116 virtual sal_Int64 SAL_CALL getPosition()
117 throw (com::sun::star::io::IOException,
118 com::sun::star::uno::RuntimeException);
120 virtual sal_Int64 SAL_CALL getLength()
121 throw (com::sun::star::io::IOException,
122 com::sun::star::uno::RuntimeException);
125 #endif // SVTOOLS_STRMADPT_HXX
127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */