LibreOffice Module dbaccess (master) 1
storagexmlstream.hxx
Go to the documentation of this file.
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#pragma once
21
22#include "storagestream.hxx"
23
24#include <com/sun/star/xml/sax/XParser.hpp>
25#include <com/sun/star/embed/XStorage.hpp>
26#include <com/sun/star/uno/XComponentContext.hpp>
27#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
29#include <rtl/ref.hxx>
30#include <stack>
31
32namespace dbaccess
33{
34
36 {
37 public:
39 const css::uno::Reference< css::uno::XComponentContext >& i_rContext,
40 const css::uno::Reference< css::embed::XStorage >& i_rParentStorage,
41 const OUString& i_rStreamName
42 );
43 virtual ~StorageXMLOutputStream() override;
44
45 void close();
46
47 void addAttribute( const OUString& i_rName, const OUString& i_rValue ) const;
48
49 void startElement( const OUString& i_rElementName );
50 void endElement();
51
52 void ignorableWhitespace( const OUString& i_rWhitespace ) const;
53 void characters( const OUString& i_rCharacters ) const;
54
55 private:
58
59 private:
60 css::uno::Reference< css::xml::sax::XDocumentHandler > mxHandler;
61 std::stack< OUString > maElements;
63 };
64
66 {
67 public:
69 const css::uno::Reference< css::uno::XComponentContext >& i_rContext,
70 const css::uno::Reference< css::embed::XStorage >& i_rParentStorage,
71 const OUString& i_rStreamName
72 );
74
75 void import(
76 const css::uno::Reference< css::xml::sax::XDocumentHandler >& i_rHandler
77 );
78
81
82 private:
83 css::uno::Reference< css::xml::sax::XParser > m_xParser;
84 css::uno::Reference< css::io::XInputStream > m_xInputStream;
85 };
86
87} // namespace dbaccess
88
89/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
convenience wrapper around a stream living in a storage
StorageXMLInputStream(const css::uno::Reference< css::uno::XComponentContext > &i_rContext, const css::uno::Reference< css::embed::XStorage > &i_rParentStorage, const OUString &i_rStreamName)
StorageXMLInputStream & operator=(const StorageXMLInputStream &)=delete
css::uno::Reference< css::io::XInputStream > m_xInputStream
StorageXMLInputStream(const StorageXMLInputStream &)=delete
css::uno::Reference< css::xml::sax::XParser > m_xParser
::rtl::Reference< comphelper::AttributeList > mxAttributes
std::stack< OUString > maElements
StorageXMLOutputStream(const css::uno::Reference< css::uno::XComponentContext > &i_rContext, const css::uno::Reference< css::embed::XStorage > &i_rParentStorage, const OUString &i_rStreamName)
void startElement(const OUString &i_rElementName)
void characters(const OUString &i_rCharacters) const
StorageXMLOutputStream & operator=(const StorageXMLOutputStream &)=delete
css::uno::Reference< css::xml::sax::XDocumentHandler > mxHandler
virtual ~StorageXMLOutputStream() override
StorageXMLOutputStream(const StorageXMLOutputStream &)=delete
void addAttribute(const OUString &i_rName, const OUString &i_rValue) const
void ignorableWhitespace(const OUString &i_rWhitespace) const