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 INCLUDED_XMLHELP_SOURCE_CXXHELP_PROVIDER_INPUTSTREAM_HXX
21 : #define INCLUDED_XMLHELP_SOURCE_CXXHELP_PROVIDER_INPUTSTREAM_HXX
22 :
23 : #include <rtl/ustring.hxx>
24 : #include <osl/file.hxx>
25 : #include <cppuhelper/weak.hxx>
26 : #include <com/sun/star/uno/XInterface.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 :
32 : namespace chelp {
33 :
34 : class XInputStream_impl
35 : : public cppu::OWeakObject,
36 : public com::sun::star::io::XInputStream,
37 : public com::sun::star::io::XSeekable
38 : {
39 :
40 : public:
41 : explicit XInputStream_impl( const OUString& aUncPath );
42 :
43 : virtual ~XInputStream_impl();
44 :
45 : /**
46 : * Returns an error code as given by filerror.hxx
47 : */
48 :
49 0 : bool SAL_CALL CtorSuccess() { return m_bIsOpen;}
50 :
51 : virtual com::sun::star::uno::Any SAL_CALL
52 : queryInterface(
53 : const com::sun::star::uno::Type& rType )
54 : throw( com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
55 :
56 : virtual void SAL_CALL
57 : acquire(
58 : void )
59 : throw() SAL_OVERRIDE;
60 :
61 : virtual void SAL_CALL
62 : release(
63 : void )
64 : throw() SAL_OVERRIDE;
65 :
66 : virtual sal_Int32 SAL_CALL
67 : readBytes(
68 : com::sun::star::uno::Sequence< sal_Int8 >& aData,
69 : sal_Int32 nBytesToRead )
70 : throw( com::sun::star::io::NotConnectedException,
71 : com::sun::star::io::BufferSizeExceededException,
72 : com::sun::star::io::IOException,
73 : com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
74 :
75 : virtual sal_Int32 SAL_CALL
76 : readSomeBytes(
77 : com::sun::star::uno::Sequence< sal_Int8 >& aData,
78 : sal_Int32 nMaxBytesToRead )
79 : throw( com::sun::star::io::NotConnectedException,
80 : com::sun::star::io::BufferSizeExceededException,
81 : com::sun::star::io::IOException,
82 : com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
83 :
84 : virtual void SAL_CALL
85 : skipBytes(
86 : sal_Int32 nBytesToSkip )
87 : throw( com::sun::star::io::NotConnectedException,
88 : com::sun::star::io::BufferSizeExceededException,
89 : com::sun::star::io::IOException,
90 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
91 :
92 : virtual sal_Int32 SAL_CALL
93 : available(
94 : void )
95 : throw( com::sun::star::io::NotConnectedException,
96 : com::sun::star::io::IOException,
97 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
98 :
99 : virtual void SAL_CALL
100 : closeInput(
101 : void )
102 : throw( com::sun::star::io::NotConnectedException,
103 : com::sun::star::io::IOException,
104 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
105 :
106 : virtual void SAL_CALL
107 : seek(
108 : sal_Int64 location )
109 : throw( com::sun::star::lang::IllegalArgumentException,
110 : com::sun::star::io::IOException,
111 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
112 :
113 : virtual sal_Int64 SAL_CALL
114 : getPosition(
115 : void )
116 : throw( com::sun::star::io::IOException,
117 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
118 :
119 : virtual sal_Int64 SAL_CALL
120 : getLength(
121 : void )
122 : throw( com::sun::star::io::IOException,
123 : com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
124 :
125 : private:
126 : bool m_bIsOpen;
127 : osl::File m_aFile;
128 : };
129 :
130 :
131 : } // end namespace XInputStream_impl
132 :
133 : #endif
134 :
135 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|