Branch data 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 : : #include <cppuhelper/factory.hxx>
21 : : #include <cppuhelper/weak.hxx>
22 : : #include <cppuhelper/implbase2.hxx>
23 : :
24 : : #include "../tools/fastserializer.hxx"
25 : : #include "fastparser.hxx"
26 : :
27 : : using namespace sax_fastparser;
28 : : using namespace ::cppu;
29 : : using namespace ::com::sun::star::uno;
30 : : using namespace ::com::sun::star::registry;
31 : : using ::rtl::OUString;
32 : : using namespace ::com::sun::star::lang;
33 : :
34 : : namespace sax_fastparser
35 : : {
36 : :
37 : : //--------------------------------------
38 : : // the extern interface
39 : : //---------------------------------------
40 : 775 : Reference< XInterface > SAL_CALL FastSaxParser_CreateInstance(
41 : : SAL_UNUSED_PARAMETER const Reference< XMultiServiceFactory > & )
42 : : throw(Exception)
43 : : {
44 [ + - ]: 775 : FastSaxParser *p = new FastSaxParser;
45 : 775 : return Reference< XInterface > ( (OWeakObject * ) p );
46 : : }
47 : :
48 : 0 : Reference< XInterface > SAL_CALL FastSaxSerializer_CreateInstance(
49 : : SAL_UNUSED_PARAMETER const Reference< XMultiServiceFactory > & )
50 : : throw(Exception)
51 : : {
52 [ # # ]: 0 : FastSaxSerializer *p = new FastSaxSerializer;
53 : 0 : return Reference< XInterface > ( (OWeakObject * ) p );
54 : : }
55 : : }
56 : :
57 : : extern "C"
58 : : {
59 : :
60 : 26 : SAL_DLLPUBLIC_EXPORT void * SAL_CALL fastsax_component_getFactory(
61 : : const sal_Char * pImplName, void * pServiceManager,
62 : : SAL_UNUSED_PARAMETER void * /*pRegistryKey*/ )
63 : : {
64 : 26 : void * pRet = 0;
65 : :
66 [ + - ]: 26 : if (pServiceManager )
67 : : {
68 : 26 : Reference< XSingleServiceFactory > xRet;
69 [ + - ]: 26 : Reference< XMultiServiceFactory > xSMgr( reinterpret_cast< XMultiServiceFactory * > ( pServiceManager ) );
70 : :
71 : 26 : OUString aImplementationName( OUString::createFromAscii( pImplName ) );
72 : :
73 [ + - ]: 26 : if ( aImplementationName == PARSER_IMPLEMENTATION_NAME )
74 : : {
75 : : xRet = createSingleFactory( xSMgr, aImplementationName,
76 : : FastSaxParser_CreateInstance,
77 [ + - ][ + - ]: 26 : FastSaxParser::getSupportedServiceNames_Static() );
[ + - ][ + - ]
78 : : }
79 [ # # ]: 0 : else if ( aImplementationName == SERIALIZER_IMPLEMENTATION_NAME )
80 : : {
81 : : xRet = createSingleFactory( xSMgr, aImplementationName,
82 : : FastSaxSerializer_CreateInstance,
83 [ # # ][ # # ]: 0 : FastSaxSerializer::getSupportedServiceNames_Static() );
[ # # ][ # # ]
84 : : }
85 : :
86 [ + - ]: 26 : if (xRet.is())
87 : : {
88 [ + - ]: 26 : xRet->acquire();
89 [ + - ]: 26 : pRet = xRet.get();
90 : 26 : }
91 : : }
92 : :
93 : 26 : return pRet;
94 : : }
95 : :
96 : :
97 : : }
98 : :
99 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|