diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2013-03-26 14:59:34 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-03-27 09:36:54 +0100 |
commit | bb1f0c667f8b38bf27818fe1608beb4295d9c429 (patch) | |
tree | 36e98fecb1fb3fed8e28155763d858620c70fce1 /codemaker/inc | |
parent | aaaeec55c6ca86a4871a59e058f80498e898b29b (diff) |
Clean up codemaker/typemanager.hxx
Change-Id: I650efd6780070410eaf34993dd41ed1b8ada7c9a
Diffstat (limited to 'codemaker/inc')
-rw-r--r-- | codemaker/inc/codemaker/codemaker.hxx | 3 | ||||
-rw-r--r-- | codemaker/inc/codemaker/dependencies.hxx | 7 | ||||
-rw-r--r-- | codemaker/inc/codemaker/exceptiontree.hxx | 5 | ||||
-rw-r--r-- | codemaker/inc/codemaker/typemanager.hxx | 104 |
4 files changed, 26 insertions, 93 deletions
diff --git a/codemaker/inc/codemaker/codemaker.hxx b/codemaker/inc/codemaker/codemaker.hxx index c7aebf8f23bc..a1c3a14eea6c 100644 --- a/codemaker/inc/codemaker/codemaker.hxx +++ b/codemaker/inc/codemaker/codemaker.hxx @@ -23,6 +23,7 @@ #include "sal/config.h" #include "codemaker/unotype.hxx" #include "registry/types.h" +#include "rtl/ref.hxx" #include "sal/types.h" #include <vector> @@ -38,7 +39,7 @@ namespace codemaker { rtl::OString convertString(rtl::OUString const & string); codemaker::UnoType::Sort decomposeAndResolve( - TypeManager const & manager, rtl::OString const & type, + rtl::Reference< TypeManager > const & manager, rtl::OString const & type, bool resolveTypedefs, bool allowVoid, bool allowExtraEntities, RTTypeClass * typeClass, rtl::OString * name, sal_Int32 * rank, std::vector< rtl::OString > * arguments); diff --git a/codemaker/inc/codemaker/dependencies.hxx b/codemaker/inc/codemaker/dependencies.hxx index b46e7f35d1c3..157939208e5b 100644 --- a/codemaker/inc/codemaker/dependencies.hxx +++ b/codemaker/inc/codemaker/dependencies.hxx @@ -20,6 +20,9 @@ #ifndef INCLUDED_CODEMAKER_DEPENDENCIES_HXX #define INCLUDED_CODEMAKER_DEPENDENCIES_HXX +#include "sal/config.h" + +#include "rtl/ref.hxx" #include "rtl/string.hxx" #include <boost/unordered_map.hpp> @@ -58,7 +61,9 @@ public: type, polymorphic struct type template, exception type, interface type, typedef, module, constant group, service, or singleton */ - Dependencies(TypeManager const & manager, rtl::OString const & type); + Dependencies( + rtl::Reference< TypeManager > const & manager, + rtl::OString const & type); ~Dependencies(); diff --git a/codemaker/inc/codemaker/exceptiontree.hxx b/codemaker/inc/codemaker/exceptiontree.hxx index e6fded6af3c8..fed0e5b9e4d7 100644 --- a/codemaker/inc/codemaker/exceptiontree.hxx +++ b/codemaker/inc/codemaker/exceptiontree.hxx @@ -21,6 +21,7 @@ #define INCLUDED_CODEMAKER_EXCEPTIONTREE_HXX #include "codemaker/global.hxx" +#include "rtl/ref.hxx" #include "rtl/string.hxx" #include <vector> @@ -92,7 +93,9 @@ public: if different calls to this member function use different, incompatible type managers */ - void add(rtl::OString const & name, TypeManager const & manager) + void add( + rtl::OString const & name, + rtl::Reference< TypeManager > const & manager) throw( CannotDumpException ); /** diff --git a/codemaker/inc/codemaker/typemanager.hxx b/codemaker/inc/codemaker/typemanager.hxx index 2024f8c42ddb..1b16115b85da 100644 --- a/codemaker/inc/codemaker/typemanager.hxx +++ b/codemaker/inc/codemaker/typemanager.hxx @@ -23,6 +23,7 @@ #include "codemaker/global.hxx" #include "registry/registry.hxx" #include "registry/types.h" +#include "salhelper/simplereferenceobject.hxx" #include <boost/unordered_map.hpp> #include <list> @@ -42,91 +43,10 @@ typedef ::boost::unordered_map EqualString > T2TypeClassMap; -struct TypeManagerImpl -{ - TypeManagerImpl() - : m_refCount(0) - {} - - sal_Int32 m_refCount; -}; - -class TypeManager +class TypeManager : public salhelper::SimpleReferenceObject { public: TypeManager(); - virtual ~TypeManager(); - - TypeManager( const TypeManager& value ) - : m_pImpl( value.m_pImpl ) - { - acquire(); - } - - TypeManager& operator = ( const TypeManager& value ) - { - release(); - m_pImpl = value.m_pImpl; - acquire(); - return *this; - } - - virtual sal_Bool isValidType(const ::rtl::OString&) const - { return sal_False; } - - virtual ::rtl::OString getTypeName(RegistryKey&) const - { return ::rtl::OString(); } - - virtual RegistryKey getTypeKey(const ::rtl::OString&, sal_Bool * = 0 ) const - { return RegistryKey(); } - virtual RegistryKeyList getTypeKeys(const ::rtl::OString&) const - { return RegistryKeyList(); } - virtual typereg::Reader getTypeReader( - const ::rtl::OString& name, sal_Bool * pIsExtraType = 0 ) const = 0; - virtual typereg::Reader getTypeReader(RegistryKey& rTypeKey) const = 0; - virtual RTTypeClass getTypeClass(const ::rtl::OString&) const - { return RT_TYPE_INVALID; } - virtual RTTypeClass getTypeClass(RegistryKey&) const - { return RT_TYPE_INVALID; } - - virtual void setBase(const ::rtl::OString&) {} - virtual ::rtl::OString getBase() const { return ::rtl::OString(); } - - virtual sal_Int32 getSize() const { return 0; } - - static sal_Bool isBaseType(const ::rtl::OString& name); -protected: - sal_Int32 acquire(); - sal_Int32 release(); - -protected: - TypeManagerImpl* m_pImpl; -}; - -struct RegistryTypeManagerImpl -{ - RegistryTypeManagerImpl() - : m_base("/") - {} - - T2TypeClassMap m_t2TypeClass; - RegistryList m_registries; - RegistryList m_extra_registries; - ::rtl::OString m_base; -}; - -class RegistryTypeManager : public TypeManager -{ -public: - RegistryTypeManager(); - virtual ~RegistryTypeManager(); - - RegistryTypeManager( const RegistryTypeManager& value ) - : TypeManager(value) - , m_pImpl( value.m_pImpl ) - { - acquire(); - } sal_Bool init(const StringVector& regFiles, const StringVector& extraFiles = StringVector() ); @@ -145,19 +65,23 @@ public: RTTypeClass getTypeClass(RegistryKey& rTypeKey) const; void setBase(const ::rtl::OString& base); - ::rtl::OString getBase() const { return m_pImpl->m_base; } + ::rtl::OString getBase() const { return m_base; } + + sal_Int32 getSize() const { return m_t2TypeClass.size(); } + + static sal_Bool isBaseType(const ::rtl::OString& name); + +private: + virtual ~TypeManager(); - sal_Int32 getSize() const { return m_pImpl->m_t2TypeClass.size(); } -protected: RegistryKey searchTypeKey( const ::rtl::OString& name, sal_Bool * pIsExtraType = 0 ) const; void freeRegistries(); - void acquire(); - void release(); - -protected: - RegistryTypeManagerImpl* m_pImpl; + mutable T2TypeClassMap m_t2TypeClass; + RegistryList m_registries; + RegistryList m_extra_registries; + ::rtl::OString m_base; }; #endif // INCLUDED_CODEMAKER_TYPEMANAGER_HXX |