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 : #ifndef INCLUDED_UCB_SOURCE_UCP_FILE_FILINPSTR_HXX
20 : #define INCLUDED_UCB_SOURCE_UCP_FILE_FILINPSTR_HXX
21 :
22 : #include <rtl/ustring.hxx>
23 : #include <cppuhelper/weak.hxx>
24 : #include <ucbhelper/macros.hxx>
25 : #include <com/sun/star/uno/XInterface.hpp>
26 : #include <com/sun/star/lang/XTypeProvider.hpp>
27 : #include <com/sun/star/io/XSeekable.hpp>
28 : #include <com/sun/star/io/XInputStream.hpp>
29 : #include <com/sun/star/ucb/XContentProvider.hpp>
30 :
31 : #include "filrec.hxx"
32 :
33 : namespace fileaccess {
34 :
35 : // forward declaration
36 :
37 : class shell;
38 :
39 :
40 : class XInputStream_impl
41 : : public cppu::OWeakObject,
42 : public com::sun::star::lang::XTypeProvider,
43 : public com::sun::star::io::XInputStream,
44 : public com::sun::star::io::XSeekable
45 : {
46 : public:
47 :
48 : XInputStream_impl( shell* pMyShell,const OUString& aUncPath, bool bLock );
49 :
50 : virtual ~XInputStream_impl();
51 :
52 : /**
53 : * Returns an error code as given by filerror.hxx
54 : */
55 :
56 14623 : sal_Int32 SAL_CALL CtorSuccess() { return m_nErrorCode;}
57 27 : sal_Int32 SAL_CALL getMinorError() { return m_nMinorErrorCode;}
58 :
59 :
60 : // XTypeProvider
61 :
62 : virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
63 : throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
64 : virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes()
65 : throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
66 :
67 : virtual com::sun::star::uno::Any SAL_CALL
68 : queryInterface(
69 : const com::sun::star::uno::Type& rType )
70 : throw( com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
71 :
72 : virtual void SAL_CALL
73 : acquire(
74 : void )
75 : throw() SAL_OVERRIDE;
76 :
77 : virtual void SAL_CALL
78 : release(
79 : void )
80 : throw() SAL_OVERRIDE;
81 :
82 : virtual sal_Int32 SAL_CALL
83 : readBytes(
84 : com::sun::star::uno::Sequence< sal_Int8 >& aData,
85 : sal_Int32 nBytesToRead )
86 : throw( com::sun::star::io::NotConnectedException,
87 : com::sun::star::io::BufferSizeExceededException,
88 : com::sun::star::io::IOException,
89 : com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
90 :
91 : virtual sal_Int32 SAL_CALL
92 : readSomeBytes(
93 : com::sun::star::uno::Sequence< sal_Int8 >& aData,
94 : sal_Int32 nMaxBytesToRead )
95 : throw( com::sun::star::io::NotConnectedException,
96 : com::sun::star::io::BufferSizeExceededException,
97 : com::sun::star::io::IOException,
98 : com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
99 :
100 : virtual void SAL_CALL
101 : skipBytes(
102 : sal_Int32 nBytesToSkip )
103 : throw( com::sun::star::io::NotConnectedException,
104 : com::sun::star::io::BufferSizeExceededException,
105 : com::sun::star::io::IOException,
106 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
107 :
108 : virtual sal_Int32 SAL_CALL
109 : available(
110 : void )
111 : throw( com::sun::star::io::NotConnectedException,
112 : com::sun::star::io::IOException,
113 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
114 :
115 : virtual void SAL_CALL
116 : closeInput(
117 : void )
118 : throw( com::sun::star::io::NotConnectedException,
119 : com::sun::star::io::IOException,
120 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
121 :
122 : virtual void SAL_CALL
123 : seek(
124 : sal_Int64 location )
125 : throw( com::sun::star::lang::IllegalArgumentException,
126 : com::sun::star::io::IOException,
127 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
128 :
129 : virtual sal_Int64 SAL_CALL
130 : getPosition(
131 : void )
132 : throw( com::sun::star::io::IOException,
133 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
134 :
135 : virtual sal_Int64 SAL_CALL
136 : getLength(
137 : void )
138 : throw( com::sun::star::io::IOException,
139 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
140 :
141 : private:
142 :
143 : com::sun::star::uno::Reference<
144 : com::sun::star::ucb::XContentProvider > m_xProvider;
145 : bool m_nIsOpen;
146 :
147 : ReconnectingFile m_aFile;
148 :
149 : sal_Int32 m_nErrorCode;
150 : sal_Int32 m_nMinorErrorCode;
151 : };
152 :
153 :
154 : } // end namespace XInputStream_impl
155 :
156 : #endif
157 :
158 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|