Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef SVTOOLS_STRMADPT_HXX
21 : #define SVTOOLS_STRMADPT_HXX
22 :
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>
29 :
30 : //============================================================================
31 0 : class SVL_DLLPUBLIC SvOutputStreamOpenLockBytes: public SvOpenLockBytes
32 : {
33 : com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >
34 : m_xOutputStream;
35 : sal_uInt32 m_nPosition;
36 :
37 : public:
38 : TYPEINFO();
39 :
40 0 : SvOutputStreamOpenLockBytes(
41 : const com::sun::star::uno::Reference<
42 : com::sun::star::io::XOutputStream > &
43 : rTheOutputStream):
44 0 : m_xOutputStream(rTheOutputStream), m_nPosition(0) {}
45 :
46 : virtual ErrCode ReadAt(sal_uLong, void *, sal_uLong, sal_uLong *) const;
47 :
48 : virtual ErrCode WriteAt(sal_uLong nPos, const void * pBuffer, sal_uLong nCount,
49 : sal_uLong * pWritten);
50 :
51 : virtual ErrCode Flush() const;
52 :
53 : virtual ErrCode SetSize(sal_uLong);
54 :
55 : virtual ErrCode Stat(SvLockBytesStat * pStat, SvLockBytesStatFlag) const;
56 :
57 : virtual ErrCode FillAppend(const void * pBuffer, sal_uLong nCount,
58 : sal_uLong * pWritten);
59 :
60 : virtual sal_uLong Tell() const;
61 :
62 : virtual sal_uLong Seek(sal_uLong);
63 :
64 : virtual void Terminate();
65 : };
66 :
67 : //============================================================================
68 0 : class SVL_DLLPUBLIC SvLockBytesInputStream: public cppu::OWeakObject,
69 : public com::sun::star::io::XInputStream,
70 : public com::sun::star::io::XSeekable
71 : {
72 : SvLockBytesRef m_xLockBytes;
73 : sal_Int64 m_nPosition;
74 :
75 : public:
76 : SvLockBytesInputStream(SvLockBytes * pTheLockBytes):
77 : m_xLockBytes(pTheLockBytes), m_nPosition(0) {}
78 :
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);
82 :
83 : virtual void SAL_CALL acquire() throw();
84 :
85 : virtual void SAL_CALL release() throw();
86 :
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);
92 :
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);
98 :
99 : virtual void SAL_CALL skipBytes(sal_Int32 nBytesToSkip)
100 : throw (com::sun::star::io::IOException,
101 : com::sun::star::uno::RuntimeException);
102 :
103 : virtual sal_Int32 SAL_CALL available()
104 : throw (com::sun::star::io::IOException,
105 : com::sun::star::uno::RuntimeException);
106 :
107 : virtual void SAL_CALL closeInput()
108 : throw (com::sun::star::io::IOException,
109 : com::sun::star::uno::RuntimeException);
110 :
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);
115 :
116 : virtual sal_Int64 SAL_CALL getPosition()
117 : throw (com::sun::star::io::IOException,
118 : com::sun::star::uno::RuntimeException);
119 :
120 : virtual sal_Int64 SAL_CALL getLength()
121 : throw (com::sun::star::io::IOException,
122 : com::sun::star::uno::RuntimeException);
123 : };
124 :
125 : #endif // SVTOOLS_STRMADPT_HXX
126 :
127 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|