1*02d11301SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*02d11301SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*02d11301SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*02d11301SAndrew Rist * distributed with this work for additional information 6*02d11301SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*02d11301SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*02d11301SAndrew Rist * "License"); you may not use this file except in compliance 9*02d11301SAndrew Rist * with the License. You may obtain a copy of the License at 10*02d11301SAndrew Rist * 11*02d11301SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*02d11301SAndrew Rist * 13*02d11301SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*02d11301SAndrew Rist * software distributed under the License is distributed on an 15*02d11301SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*02d11301SAndrew Rist * KIND, either express or implied. See the License for the 17*02d11301SAndrew Rist * specific language governing permissions and limitations 18*02d11301SAndrew Rist * under the License. 19*02d11301SAndrew Rist * 20*02d11301SAndrew Rist *************************************************************/ 21*02d11301SAndrew Rist 22*02d11301SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef INCLUDED_UNODEVTOOLS_TYPEMANAGER_HXX 25cdf0e10cSrcweir #define INCLUDED_UNODEVTOOLS_TYPEMANAGER_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <codemaker/typemanager.hxx> 28cdf0e10cSrcweir #include <com/sun/star/container/XHierarchicalNameAccess.hpp> 29cdf0e10cSrcweir 30cdf0e10cSrcweir #include <hash_map> 31cdf0e10cSrcweir #include <vector> 32cdf0e10cSrcweir 33cdf0e10cSrcweir class RegistryKey; 34cdf0e10cSrcweir 35cdf0e10cSrcweir namespace typereg { class Reader; } 36cdf0e10cSrcweir 37cdf0e10cSrcweir #if defined( _MSC_VER ) && ( _MSC_VER < 1200 ) 38cdf0e10cSrcweir typedef ::std::__hash_map__ 39cdf0e10cSrcweir < 40cdf0e10cSrcweir ::rtl::OString, // Typename 41cdf0e10cSrcweir RTTypeClass, // TypeClass 42cdf0e10cSrcweir HashString, 43cdf0e10cSrcweir EqualString, 44cdf0e10cSrcweir NewAlloc 45cdf0e10cSrcweir > T2TypeClassMap; 46cdf0e10cSrcweir #else 47cdf0e10cSrcweir typedef ::std::hash_map 48cdf0e10cSrcweir < 49cdf0e10cSrcweir ::rtl::OString, // Typename 50cdf0e10cSrcweir RTTypeClass, // TypeClass 51cdf0e10cSrcweir HashString, 52cdf0e10cSrcweir EqualString 53cdf0e10cSrcweir > T2TypeClassMap; 54cdf0e10cSrcweir #endif 55cdf0e10cSrcweir 56cdf0e10cSrcweir namespace unodevtools { 57cdf0e10cSrcweir 58cdf0e10cSrcweir struct UnoTypeManagerImpl 59cdf0e10cSrcweir { UnoTypeManagerImplunodevtools::UnoTypeManagerImpl60cdf0e10cSrcweir UnoTypeManagerImpl() {} 61cdf0e10cSrcweir 62cdf0e10cSrcweir T2TypeClassMap m_t2TypeClass; 63cdf0e10cSrcweir ::com::sun::star::uno::Reference< 64cdf0e10cSrcweir ::com::sun::star::container::XHierarchicalNameAccess> m_tdmgr; 65cdf0e10cSrcweir }; 66cdf0e10cSrcweir 67cdf0e10cSrcweir class UnoTypeManager : public TypeManager 68cdf0e10cSrcweir { 69cdf0e10cSrcweir public: 70cdf0e10cSrcweir UnoTypeManager(); 71cdf0e10cSrcweir ~UnoTypeManager(); 72cdf0e10cSrcweir UnoTypeManager(const UnoTypeManager & value)73cdf0e10cSrcweir UnoTypeManager( const UnoTypeManager& value ) 74cdf0e10cSrcweir : TypeManager(value) 75cdf0e10cSrcweir , m_pImpl( value.m_pImpl ) 76cdf0e10cSrcweir {} 77cdf0e10cSrcweir 78cdf0e10cSrcweir sal_Bool init(const ::std::vector< ::rtl::OUString > registries); 79cdf0e10cSrcweir 80cdf0e10cSrcweir sal_Bool isValidType(const ::rtl::OString& name) const; 81cdf0e10cSrcweir ::rtl::OString getTypeName(RegistryKey& rTypeKey) const; 82cdf0e10cSrcweir typereg::Reader getTypeReader( 83cdf0e10cSrcweir const ::rtl::OString& name, sal_Bool * pIsExtraType = 0 ) const; 84cdf0e10cSrcweir typereg::Reader getTypeReader(RegistryKey& rTypeKey) const; 85cdf0e10cSrcweir RTTypeClass getTypeClass(const ::rtl::OString& name) const; 86cdf0e10cSrcweir RTTypeClass getTypeClass(RegistryKey& rTypeKey) const; 87cdf0e10cSrcweir 88cdf0e10cSrcweir protected: 89cdf0e10cSrcweir void release(); 90cdf0e10cSrcweir 91cdf0e10cSrcweir UnoTypeManagerImpl* m_pImpl; 92cdf0e10cSrcweir }; 93cdf0e10cSrcweir 94cdf0e10cSrcweir } 95cdf0e10cSrcweir 96cdf0e10cSrcweir #endif // _UNODEVTOOLS_TYPEMANAGER_HXX_ 97