fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / dbaccess / source / core / recovery / storagestream.cxx
blob90761120e6bc16d8a68801c8bd3fb905a77a3065
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 #include "storagestream.hxx"
22 #include <com/sun/star/embed/ElementModes.hpp>
24 #include <tools/diagnose_ex.h>
26 namespace dbaccess
29 using ::com::sun::star::uno::Reference;
30 using ::com::sun::star::uno::XInterface;
31 using ::com::sun::star::uno::UNO_QUERY;
32 using ::com::sun::star::uno::UNO_QUERY_THROW;
33 using ::com::sun::star::uno::UNO_SET_THROW;
34 using ::com::sun::star::uno::Exception;
35 using ::com::sun::star::uno::RuntimeException;
36 using ::com::sun::star::uno::Any;
37 using ::com::sun::star::uno::makeAny;
38 using ::com::sun::star::uno::Sequence;
39 using ::com::sun::star::uno::Type;
40 using ::com::sun::star::uno::XComponentContext;
41 using ::com::sun::star::embed::XStorage;
42 using ::com::sun::star::io::XStream;
44 namespace ElementModes = ::com::sun::star::embed::ElementModes;
46 // StorageOutputStream
47 StorageOutputStream::StorageOutputStream( const Reference<XComponentContext>& i_rContext,
48 const Reference< XStorage >& i_rParentStorage,
49 const OUString& i_rStreamName
51 :m_rContext( i_rContext )
53 ENSURE_OR_THROW( i_rParentStorage.is(), "illegal stream" );
55 const Reference< XStream > xStream(
56 i_rParentStorage->openStreamElement( i_rStreamName, ElementModes::READWRITE ), UNO_QUERY_THROW );
57 m_xOutputStream.set( xStream->getOutputStream(), UNO_SET_THROW );
60 StorageOutputStream::~StorageOutputStream()
64 void StorageOutputStream::close()
66 ENSURE_OR_RETURN_VOID( m_xOutputStream.is(), "already closed" );
67 m_xOutputStream->closeOutput();
68 m_xOutputStream.clear();
70 // if you add additional functionality here, be aware that there are derived classes which
71 // (legitimately) do not call this method here.
74 // StorageInputStream
75 StorageInputStream::StorageInputStream( const Reference<XComponentContext>& i_rContext,
76 const Reference< XStorage >& i_rParentStorage,
77 const OUString& i_rStreamName
79 :m_rContext( i_rContext )
81 ENSURE_OR_THROW( i_rParentStorage.is(), "illegal stream" );
83 const Reference< XStream > xStream(
84 i_rParentStorage->openStreamElement( i_rStreamName, ElementModes::READ ), UNO_QUERY_THROW );
85 m_xInputStream.set( xStream->getInputStream(), UNO_SET_THROW );
88 StorageInputStream::~StorageInputStream()
92 void StorageInputStream::close()
94 ENSURE_OR_RETURN_VOID( m_xInputStream.is(), "already closed" );
95 m_xInputStream->closeInput();
96 m_xInputStream.clear();
98 // if you add additional functionality here, be aware that there are derived classes which
99 // (legitimately) do not call this method here.
102 } // namespace dbaccess
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */