xref: /trunk/main/sax/source/fastparser/facreg.cxx (revision ffd38472365e95f6a578737bc9a5eb0fac624a86)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 #include <cppuhelper/factory.hxx>
23 #include <cppuhelper/weak.hxx>
24 #include <cppuhelper/implbase2.hxx>
25 #include <cppuhelper/implementationentry.hxx>
26 
27 #include "../tools/fastserializer.hxx"
28 #include "fastparser.hxx"
29 
30 using namespace sax_fastparser;
31 using namespace ::cppu;
32 using namespace ::com::sun::star::uno;
33 using namespace ::com::sun::star::registry;
34 using ::rtl::OUString;
35 using namespace ::com::sun::star::lang;
36 
37 namespace sax_fastparser
38 {
39 
40 //--------------------------------------
41 // the extern interface
42 //---------------------------------------
43 Reference< XInterface > SAL_CALL FastSaxParser_CreateInstance( const Reference< XComponentContext >  & ) throw(Exception)
44 {
45     FastSaxParser *p = new FastSaxParser;
46     return Reference< XInterface > ( (OWeakObject * ) p );
47 }
48 
49 Reference< XInterface > SAL_CALL FastSaxSerializer_CreateInstance( const Reference< XComponentContext >  & ) throw(Exception)
50 {
51     FastSaxSerializer *p = new FastSaxSerializer;
52     return Reference< XInterface > ( (OWeakObject * ) p );
53 }
54 
55 struct ::cppu::ImplementationEntry g_component_entries[] =
56 {
57     {
58         FastSaxParser_CreateInstance,
59         FastSaxParser::getImplementationName_Static,
60         FastSaxParser::getSupportedServiceNames_Static,
61         ::cppu::createSingleComponentFactory,
62         0,
63         0
64     },
65     {
66         FastSaxSerializer_CreateInstance,
67         FastSaxSerializer::getImplementationName_Static,
68         FastSaxSerializer::getSupportedServiceNames_Static,
69         ::cppu::createSingleComponentFactory,
70         0,
71         0
72     },
73     { 0, 0, 0, 0, 0, 0 }
74 };
75 
76 }
77 
78 extern "C"
79 {
80 
81 SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
82     const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
83 {
84     *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
85 }
86 
87 SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
88 {
89     return ::cppu::component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey, g_component_entries );
90 }
91 
92 
93 }
94