LibreOffice Module package (master) 1
ManifestImport.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#ifndef INCLUDED_PACKAGE_SOURCE_MANIFEST_MANIFESTIMPORT_HXX
21#define INCLUDED_PACKAGE_SOURCE_MANIFEST_MANIFESTIMPORT_HXX
22
24#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
25#include <com/sun/star/beans/NamedValue.hpp>
26#include <unordered_map>
27#include <utility>
28#include <vector>
29#include <rtl/ustrbuf.hxx>
30
31namespace com::sun::star {
32 namespace xml::sax { class XAttributeList; }
33 namespace beans { struct PropertyValue; }
34}
35
36typedef std::unordered_map< OUString, OUString > StringHashMap;
37
39{
43
44 ManifestScopeEntry( OUString aConvertedName, StringHashMap&& aNamespaces )
45 : m_aConvertedName(std::move( aConvertedName ))
46 , m_aNamespaces( std::move(aNamespaces) )
47 , m_bValid( true )
48 {}
49};
50
51typedef ::std::vector< ManifestScopeEntry > ManifestStack;
52
53class ManifestImport final : public cppu::WeakImplHelper < css::xml::sax::XDocumentHandler >
54{
55 std::vector< css::beans::NamedValue > aKeyInfoSequence;
56 std::vector< css::uno::Sequence< css::beans::NamedValue > > aKeys;
57 std::vector< css::beans::PropertyValue > aSequence;
58 OUStringBuffer aCurrentCharacters{64};
62 sal_Int32 nDerivedKeySize;
63 ::std::vector < css::uno::Sequence < css::beans::PropertyValue > > & rManVector;
64
65
66 OUString PushNameAndNamespaces( const OUString& aName,
67 const css::uno::Reference< css::xml::sax::XAttributeList >& xAttribs,
68 StringHashMap& o_aConvertedAttribs );
69 static OUString ConvertNameWithNamespace( const OUString& aName, const StringHashMap& aNamespaces );
70 OUString ConvertName( const OUString& aName );
71
72public:
73 ManifestImport( std::vector < css::uno::Sequence < css::beans::PropertyValue > > & rNewVector );
74 virtual ~ManifestImport() override;
75 virtual void SAL_CALL startDocument( ) override;
76 virtual void SAL_CALL endDocument( ) override;
77 virtual void SAL_CALL startElement( const OUString& aName, const css::uno::Reference< css::xml::sax::XAttributeList >& xAttribs ) override;
78 virtual void SAL_CALL endElement( const OUString& aName ) override;
79 virtual void SAL_CALL characters( const OUString& aChars ) override;
80 virtual void SAL_CALL ignorableWhitespace( const OUString& aWhitespaces ) override;
81 virtual void SAL_CALL processingInstruction( const OUString& aTarget, const OUString& aData ) override;
82 virtual void SAL_CALL setDocumentLocator( const css::uno::Reference< css::xml::sax::XLocator >& xLocator ) override;
83
84private:
86 void doFileEntry(StringHashMap &rConvertedAttribs);
88 void doEncryptionData(StringHashMap &rConvertedAttribs);
90 void doAlgorithm(StringHashMap &rConvertedAttribs);
92 void doKeyDerivation(StringHashMap &rConvertedAttribs);
94 void doStartKeyAlg(StringHashMap &rConvertedAttribs);
96 void doEncryptionMethod(StringHashMap &, const OUString &);
98 void doEncryptedKeyId();
100};
101#endif
102
103/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
::std::vector< ManifestScopeEntry > ManifestStack
std::unordered_map< OUString, OUString > StringHashMap
virtual void SAL_CALL startElement(const OUString &aName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttribs) override
ManifestStack aStack
virtual ~ManifestImport() override
void doStartKeyAlg(StringHashMap &rConvertedAttribs)
void doFileEntry(StringHashMap &rConvertedAttribs)
std::vector< css::beans::PropertyValue > aSequence
OUString ConvertName(const OUString &aName)
virtual void SAL_CALL ignorableWhitespace(const OUString &aWhitespaces) override
sal_Int32 nDerivedKeySize
std::vector< css::beans::NamedValue > aKeyInfoSequence
virtual void SAL_CALL endElement(const OUString &aName) override
void doEncryptedKeyPacket()
void doEncryptionData(StringHashMap &rConvertedAttribs)
virtual void SAL_CALL processingInstruction(const OUString &aTarget, const OUString &aData) override
virtual void SAL_CALL characters(const OUString &aChars) override
ManifestImport(std::vector< css::uno::Sequence< css::beans::PropertyValue > > &rNewVector)
OUStringBuffer aCurrentCharacters
void doKeyDerivation(StringHashMap &rConvertedAttribs)
static OUString ConvertNameWithNamespace(const OUString &aName, const StringHashMap &aNamespaces)
virtual void SAL_CALL startDocument() override
::std::vector< css::uno::Sequence< css::beans::PropertyValue > > & rManVector
void doEncryptionMethod(StringHashMap &, const OUString &)
virtual void SAL_CALL endDocument() override
void doAlgorithm(StringHashMap &rConvertedAttribs)
virtual void SAL_CALL setDocumentLocator(const css::uno::Reference< css::xml::sax::XLocator > &xLocator) override
OUString PushNameAndNamespaces(const OUString &aName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttribs, StringHashMap &o_aConvertedAttribs)
std::vector< css::uno::Sequence< css::beans::NamedValue > > aKeys
void doEncryptedKey(StringHashMap &)
void doEncryptedCipherValue()
std::unordered_map< OUString, OUString > StringHashMap
ManifestScopeEntry(OUString aConvertedName, StringHashMap &&aNamespaces)
StringHashMap m_aNamespaces