1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: binaryreader.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef CONFIGMGR_BINARYREADER_HXX
31 #define CONFIGMGR_BINARYREADER_HXX
33 #include <rtl/ref.hxx>
34 #include <rtl/ustring.hxx>
35 #include <osl/file.hxx>
36 #include <com/sun/star/uno/Any.hxx>
37 #include <com/sun/star/io/IOException.hpp>
38 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
42 // -----------------------------------------------------------------------------
45 namespace css
= com::sun::star
;
47 namespace io
= css::io
;
48 namespace uno
= css::uno
;
49 namespace lang
= css::lang
;
50 // -----------------------------------------------------------------------------
51 class BinaryReader_Impl
;
54 rtl::OUString m_sFileURL
;
56 rtl::Reference
<BinaryReader_Impl
> m_xDataInputStream
;
58 explicit BinaryReader (rtl::OUString
const & _sFileURL
);
63 bool open() SAL_THROW( (io::IOException
, uno::RuntimeException
) );
65 void read(sal_Bool
&_nValue
) SAL_THROW( (io::IOException
, uno::RuntimeException
) );
66 void read(sal_Int8
&_nValue
) SAL_THROW( (io::IOException
, uno::RuntimeException
) );
67 void read(sal_Int16
&_nValue
) SAL_THROW( (io::IOException
, uno::RuntimeException
) );
68 void read(sal_Int32
&_nValue
) SAL_THROW( (io::IOException
, uno::RuntimeException
) );
69 void read(sal_Int64
&_nValue
) SAL_THROW( (io::IOException
, uno::RuntimeException
) );
70 void read(double &_nValue
) SAL_THROW( (io::IOException
, uno::RuntimeException
) );
71 void read(rtl::OUString
& _aStr
) SAL_THROW( (io::IOException
, uno::RuntimeException
) );
72 void read(uno::Sequence
< sal_Int8
> &_aValue
) SAL_THROW( (io::IOException
, uno::RuntimeException
) );
73 void read(uno::Sequence
< rtl::OUString
> &_aValue
) SAL_THROW( (io::IOException
, uno::RuntimeException
) );
76 inline BinaryReader_Impl
* getDataInputStream();
78 // --------------------------------------------------------------------------
80 bool readSequenceValue (
81 BinaryReader
& _rReader
,
83 uno::Type
const & _aElementType
) SAL_THROW( (io::IOException
, uno::RuntimeException
) );
85 // --------------------------------------------------------------------------