From 681297e10b666e13cc463f6fbb16236f36c3266c Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Tue, 12 Jul 2005 22:28:02 +0000 Subject: Reference counting and smart pointers. --- src/textPartFactory.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'src/textPartFactory.cpp') diff --git a/src/textPartFactory.cpp b/src/textPartFactory.cpp index c76697b2..2c910be0 100644 --- a/src/textPartFactory.cpp +++ b/src/textPartFactory.cpp @@ -49,18 +49,16 @@ textPartFactory* textPartFactory::getInstance() } -textPart* textPartFactory::create(const mediaType& type) +ref textPartFactory::create(const mediaType& type) { - NameMap::const_iterator pos = m_nameMap.find(type.generate()); - - if (pos != m_nameMap.end()) - { - return ((*pos).second)(); - } - else + for (MapType::const_iterator it = m_map.begin() ; + it != m_map.end() ; ++it) { - throw exceptions::no_factory_available(); + if ((*it).first == type) + return ((*it).second)(); } + + throw exceptions::no_factory_available(); } -- cgit v1.2.3