bump product version to 6.3.0.0.beta1
[LibreOffice.git] / include / xmlscript / xml_helper.hxx
blobb5fde5dfb13a31b18a455a5d7bf5730cc79c501e
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 .
19 #ifndef INCLUDED_XMLSCRIPT_XML_HELPER_HXX
20 #define INCLUDED_XMLSCRIPT_XML_HELPER_HXX
22 #include <vector>
23 #include <cppuhelper/implbase.hxx>
24 #include <com/sun/star/xml/sax/XAttributeList.hpp>
26 #include <xmlscript/xmlscriptdllapi.h>
28 namespace com { namespace sun { namespace star { namespace xml { namespace sax { class XDocumentHandler; } } } } }
29 namespace com { namespace sun { namespace star { namespace io { class XInputStream; } } } }
30 namespace com { namespace sun { namespace star { namespace io { class XOutputStream; } } } }
32 namespace xmlscript
35 /*##################################################################################################
37 EXPORTING
39 ##################################################################################################*/
42 class XMLSCRIPT_DLLPUBLIC XMLElement
43 : public cppu::WeakImplHelper< css::xml::sax::XAttributeList >
45 public:
46 XMLElement( OUString const & name )
47 : _name( name )
50 /** Adds a sub element of element.
52 @param xElem element reference
54 void addSubElement(
55 css::uno::Reference< css::xml::sax::XAttributeList > const & xElem );
57 /** Gets sub element of given index. The index follows order in which sub elements were added.
59 @param nIndex index of sub element
61 css::uno::Reference< css::xml::sax::XAttributeList > const & getSubElement( sal_Int32 nIndex );
63 /** Adds an attribute to elements.
65 @param rAttrName qname of attribute
66 @param rValue value string of element
68 void addAttribute( OUString const & rAttrName, OUString const & rValue );
70 /** Dumps out element (and all sub elements).
72 @param xOut document handler to be written to
74 void dump(
75 css::uno::Reference< css::xml::sax::XDocumentHandler > const & xOut );
76 /** Dumps out sub elements (and all further sub elements).
78 @param xOut document handler to be written to
80 void dumpSubElements(
81 css::uno::Reference< css::xml::sax::XDocumentHandler > const & xOut );
83 // XAttributeList
84 virtual sal_Int16 SAL_CALL getLength() override;
85 virtual OUString SAL_CALL getNameByIndex( sal_Int16 nPos ) override;
86 virtual OUString SAL_CALL getTypeByIndex( sal_Int16 nPos ) override;
87 virtual OUString SAL_CALL getTypeByName( OUString const & rName ) override;
88 virtual OUString SAL_CALL getValueByIndex( sal_Int16 nPos ) override;
89 virtual OUString SAL_CALL getValueByName( OUString const & rName ) override;
91 protected:
92 ::std::vector< css::uno::Reference<
93 css::xml::sax::XAttributeList > > _subElems;
94 private:
95 OUString const _name;
96 ::std::vector< OUString > _attrNames;
97 ::std::vector< OUString > _attrValues;
102 /*##################################################################################################
104 STREAMING
106 ##################################################################################################*/
108 XMLSCRIPT_DLLPUBLIC css::uno::Reference< css::io::XInputStream >
109 createInputStream(
110 std::vector<sal_Int8> const & rInData );
112 XMLSCRIPT_DLLPUBLIC css::uno::Reference< css::io::XInputStream >
113 createInputStream(
114 const sal_Int8* pData, int len );
116 XMLSCRIPT_DLLPUBLIC css::uno::Reference< css::io::XOutputStream >
117 createOutputStream(
118 std::vector<sal_Int8> * pOutData );
122 #endif
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */