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

Generated by: LCOV version 1.10