bump product version to 4.1.6.2
[LibreOffice.git] / xmlsecurity / source / xmlsec / xmlelementwrapper_xmlsecimpl.cxx
blob6dd1853486f845bb9721b6d092ee662413121630
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 .
20 #include <string.h>
22 #include "xmlelementwrapper_xmlsecimpl.hxx"
23 #include <cppuhelper/typeprovider.hxx>
25 namespace cssu = com::sun::star::uno;
27 #define SERVICE_NAME "com.sun.star.xml.wrapper.XMLElementWrapper"
28 #define IMPLEMENTATION_NAME "com.sun.star.xml.security.bridge.xmlsec.XMLElementWrapper_XmlSecImpl"
30 XMLElementWrapper_XmlSecImpl::XMLElementWrapper_XmlSecImpl(const xmlNodePtr pNode)
31 : m_pElement( pNode )
35 /* XXMLElementWrapper */
38 /* XUnoTunnel */
39 cssu::Sequence< sal_Int8 > XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementationId( void )
40 throw (cssu::RuntimeException)
42 static ::cppu::OImplementationId* pId = 0;
43 if (! pId)
45 ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
46 if (! pId)
48 static ::cppu::OImplementationId aId;
49 pId = &aId;
52 return pId->getImplementationId();
55 sal_Int64 SAL_CALL XMLElementWrapper_XmlSecImpl::getSomething( const cssu::Sequence< sal_Int8 >& aIdentifier )
56 throw (cssu::RuntimeException)
58 if (aIdentifier.getLength() == 16 &&
59 0 == memcmp(
60 getUnoTunnelImplementationId().getConstArray(),
61 aIdentifier.getConstArray(),
62 16 ))
64 return reinterpret_cast < sal_Int64 > ( this );
66 else
68 return 0;
73 OUString XMLElementWrapper_XmlSecImpl_getImplementationName ()
74 throw (cssu::RuntimeException)
76 return OUString ( IMPLEMENTATION_NAME );
79 sal_Bool SAL_CALL XMLElementWrapper_XmlSecImpl_supportsService( const OUString& ServiceName )
80 throw (cssu::RuntimeException)
82 return ServiceName == SERVICE_NAME;
85 cssu::Sequence< OUString > SAL_CALL XMLElementWrapper_XmlSecImpl_getSupportedServiceNames( )
86 throw (cssu::RuntimeException)
88 cssu::Sequence < OUString > aRet(1);
89 OUString* pArray = aRet.getArray();
90 pArray[0] = OUString ( SERVICE_NAME );
91 return aRet;
93 #undef SERVICE_NAME
95 cssu::Reference< cssu::XInterface > SAL_CALL
96 XMLElementWrapper_XmlSecImpl_createInstance(
97 const cssu::Reference< cssu::XComponentContext > &)
98 throw( cssu::Exception )
100 return (cppu::OWeakObject*) new XMLElementWrapper_XmlSecImpl(NULL);
103 /* XServiceInfo */
104 OUString SAL_CALL XMLElementWrapper_XmlSecImpl::getImplementationName( )
105 throw (cssu::RuntimeException)
107 return XMLElementWrapper_XmlSecImpl_getImplementationName();
109 sal_Bool SAL_CALL XMLElementWrapper_XmlSecImpl::supportsService( const OUString& rServiceName )
110 throw (cssu::RuntimeException)
112 return XMLElementWrapper_XmlSecImpl_supportsService( rServiceName );
114 cssu::Sequence< OUString > SAL_CALL XMLElementWrapper_XmlSecImpl::getSupportedServiceNames( )
115 throw (cssu::RuntimeException)
117 return XMLElementWrapper_XmlSecImpl_getSupportedServiceNames();
120 xmlNodePtr XMLElementWrapper_XmlSecImpl::getNativeElement( ) const
121 /****** XMLElementWrapper_XmlSecImpl/getNativeElement *************************
123 * NAME
124 * getNativeElement -- Retrieves the libxml2 node wrapped by this object
126 * SYNOPSIS
127 * pNode = getNativeElement();
129 * FUNCTION
130 * see NAME
132 * INPUTS
133 * empty
135 * RESULT
136 * pNode - the libxml2 node wrapped by this object
138 * AUTHOR
139 * Michael Mi
140 * Email: michael.mi@sun.com
141 ******************************************************************************/
143 return m_pElement;
146 void XMLElementWrapper_XmlSecImpl::setNativeElement(const xmlNodePtr pNode)
147 /****** XMLElementWrapper_XmlSecImpl/setNativeElement *************************
149 * NAME
150 * setNativeElement -- Configures the libxml2 node wrapped by this object
152 * SYNOPSIS
153 * setNativeElement( pNode );
155 * FUNCTION
156 * see NAME
158 * INPUTS
159 * pNode - the new libxml2 node to be wrapped by this object
161 * RESULT
162 * empty
164 * AUTHOR
165 * Michael Mi
166 * Email: michael.mi@sun.com
167 ******************************************************************************/
169 m_pElement = pNode;
172 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */