LCOV - code coverage report
Current view: top level - package/source/manifest - ManifestImport.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 6 6 100.0 %
Date: 2015-06-13 12:38:46 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : 
      23             : #include <cppuhelper/implbase1.hxx>
      24             : #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
      25             : #include <vector>
      26             : 
      27             : #include <HashMaps.hxx>
      28             : 
      29             : namespace com { namespace sun { namespace star {
      30             :     namespace xml { namespace sax { class XAttributeList; } }
      31             :     namespace beans { struct PropertyValue; }
      32             : } } }
      33             : 
      34             : typedef std::unordered_map< OUString, OUString, OUStringHash, eqFunc > StringHashMap;
      35             : 
      36       11364 : struct ManifestScopeEntry
      37             : {
      38             :     OUString m_aConvertedName;
      39             :     StringHashMap   m_aNamespaces;
      40             :     bool            m_bValid;
      41             : 
      42       11364 :     ManifestScopeEntry( const OUString& aConvertedName, const StringHashMap& aNamespaces )
      43             :     : m_aConvertedName( aConvertedName )
      44             :     , m_aNamespaces( aNamespaces )
      45       11364 :     , m_bValid( true )
      46       11364 :     {}
      47             : 
      48       22728 :     ~ManifestScopeEntry()
      49       22728 :     {}
      50             : };
      51             : 
      52             : typedef ::std::vector< ManifestScopeEntry > ManifestStack;
      53             : 
      54             : class ManifestImport : public cppu::WeakImplHelper1 < com::sun::star::xml::sax::XDocumentHandler >
      55             : {
      56             : protected:
      57             :     std::vector< com::sun::star::beans::PropertyValue > aSequence;
      58             :     ManifestStack aStack;
      59             :     bool bIgnoreEncryptData;
      60             :     sal_Int32 nDerivedKeySize;
      61             :     ::std::vector < ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue > > & rManVector;
      62             : 
      63             :     const OUString sFileEntryElement;
      64             :     const OUString sManifestElement;
      65             :     const OUString sEncryptionDataElement;
      66             :     const OUString sAlgorithmElement;
      67             :     const OUString sStartKeyAlgElement;
      68             :     const OUString sKeyDerivationElement;
      69             : 
      70             :     const OUString sCdataAttribute;
      71             :     const OUString sMediaTypeAttribute;
      72             :     const OUString sVersionAttribute;
      73             :     const OUString sFullPathAttribute;
      74             :     const OUString sSizeAttribute;
      75             :     const OUString sSaltAttribute;
      76             :     const OUString sInitialisationVectorAttribute;
      77             :     const OUString sIterationCountAttribute;
      78             :     const OUString sKeySizeAttribute;
      79             :     const OUString sAlgorithmNameAttribute;
      80             :     const OUString sStartKeyAlgNameAttribute;
      81             :     const OUString sKeyDerivationNameAttribute;
      82             :     const OUString sChecksumAttribute;
      83             :     const OUString sChecksumTypeAttribute;
      84             : 
      85             :     const OUString sFullPathProperty;
      86             :     const OUString sMediaTypeProperty;
      87             :     const OUString sVersionProperty;
      88             :     const OUString sIterationCountProperty;
      89             :     const OUString sDerivedKeySizeProperty;
      90             :     const OUString sSaltProperty;
      91             :     const OUString sInitialisationVectorProperty;
      92             :     const OUString sSizeProperty;
      93             :     const OUString sDigestProperty;
      94             :     const OUString sEncryptionAlgProperty;
      95             :     const OUString sStartKeyAlgProperty;
      96             :     const OUString sDigestAlgProperty;
      97             : 
      98             :     const OUString sWhiteSpace;
      99             : 
     100             :     const OUString sSHA256_URL;
     101             :     const OUString sSHA1_Name;
     102             :     const OUString sSHA1_URL;
     103             : 
     104             :     const OUString sSHA256_1k_URL;
     105             :     const OUString sSHA1_1k_Name;
     106             :     const OUString sSHA1_1k_URL;
     107             : 
     108             :     const OUString sBlowfish_Name;
     109             :     const OUString sBlowfish_URL;
     110             :     const OUString sAES128_URL;
     111             :     const OUString sAES192_URL;
     112             :     const OUString sAES256_URL;
     113             : 
     114             :     const OUString sPBKDF2_Name;
     115             :     const OUString sPBKDF2_URL;
     116             : 
     117             :     OUString PushNameAndNamespaces( const OUString& aName,
     118             :                                            const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttribs,
     119             :                                            StringHashMap& o_aConvertedAttribs );
     120             :     static OUString ConvertNameWithNamespace( const OUString& aName, const StringHashMap& aNamespaces );
     121             :     OUString ConvertName( const OUString& aName );
     122             : 
     123             : public:
     124             :     ManifestImport( std::vector < ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue > > & rNewVector );
     125             :     virtual ~ManifestImport();
     126             :     virtual void SAL_CALL startDocument(  )
     127             :         throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     128             :     virtual void SAL_CALL endDocument(  )
     129             :         throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     130             :     virtual void SAL_CALL startElement( const OUString& aName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttribs )
     131             :         throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     132             :     virtual void SAL_CALL endElement( const OUString& aName )
     133             :         throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     134             :     virtual void SAL_CALL characters( const OUString& aChars )
     135             :         throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     136             :     virtual void SAL_CALL ignorableWhitespace( const OUString& aWhitespaces )
     137             :         throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     138             :     virtual void SAL_CALL processingInstruction( const OUString& aTarget, const OUString& aData )
     139             :         throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     140             :     virtual void SAL_CALL setDocumentLocator( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator >& xLocator )
     141             :         throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     142             : private:
     143             :     void doFileEntry(StringHashMap &rConvertedAttribs) throw(::com::sun::star::uno::RuntimeException);
     144             :     void doEncryptionData(StringHashMap &rConvertedAttribs) throw(::com::sun::star::uno::RuntimeException);
     145             :     void doAlgorithm(StringHashMap &rConvertedAttribs) throw(::com::sun::star::uno::RuntimeException);
     146             :     void doKeyDerivation(StringHashMap &rConvertedAttribs) throw(::com::sun::star::uno::RuntimeException);
     147             :     void doStartKeyAlg(StringHashMap &rConvertedAttribs) throw(::com::sun::star::uno::RuntimeException);
     148             : };
     149             : #endif
     150             : 
     151             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11