xref: /AOO41X/main/unodevtools/inc/unodevtools/typemanager.hxx (revision 02d1130125c0e8e885c8cb83681fd8bd56d0e35a)
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 
23 
24 #ifndef INCLUDED_UNODEVTOOLS_TYPEMANAGER_HXX
25 #define INCLUDED_UNODEVTOOLS_TYPEMANAGER_HXX
26 
27 #include <codemaker/typemanager.hxx>
28 #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
29 
30 #include <hash_map>
31 #include <vector>
32 
33 class RegistryKey;
34 
35 namespace typereg { class Reader; }
36 
37 #if defined( _MSC_VER ) && ( _MSC_VER < 1200 )
38 typedef ::std::__hash_map__
39 <
40     ::rtl::OString, // Typename
41     RTTypeClass,    // TypeClass
42     HashString,
43     EqualString,
44     NewAlloc
45 > T2TypeClassMap;
46 #else
47 typedef ::std::hash_map
48 <
49     ::rtl::OString, // Typename
50     RTTypeClass,    // TypeClass
51     HashString,
52     EqualString
53 > T2TypeClassMap;
54 #endif
55 
56 namespace unodevtools {
57 
58 struct UnoTypeManagerImpl
59 {
UnoTypeManagerImplunodevtools::UnoTypeManagerImpl60     UnoTypeManagerImpl() {}
61 
62     T2TypeClassMap  m_t2TypeClass;
63     ::com::sun::star::uno::Reference<
64         ::com::sun::star::container::XHierarchicalNameAccess> m_tdmgr;
65 };
66 
67 class UnoTypeManager : public TypeManager
68 {
69 public:
70     UnoTypeManager();
71     ~UnoTypeManager();
72 
UnoTypeManager(const UnoTypeManager & value)73     UnoTypeManager( const UnoTypeManager& value )
74         : TypeManager(value)
75         , m_pImpl( value.m_pImpl )
76     {}
77 
78     sal_Bool init(const ::std::vector< ::rtl::OUString > registries);
79 
80     sal_Bool    isValidType(const ::rtl::OString& name) const;
81     ::rtl::OString getTypeName(RegistryKey& rTypeKey) const;
82     typereg::Reader getTypeReader(
83         const ::rtl::OString& name, sal_Bool * pIsExtraType = 0 ) const;
84     typereg::Reader getTypeReader(RegistryKey& rTypeKey) const;
85     RTTypeClass getTypeClass(const ::rtl::OString& name) const;
86     RTTypeClass getTypeClass(RegistryKey& rTypeKey) const;
87 
88 protected:
89     void release();
90 
91     UnoTypeManagerImpl* m_pImpl;
92 };
93 
94 }
95 
96 #endif // _UNODEVTOOLS_TYPEMANAGER_HXX_
97