27 #include "../../common/Translator.h"
32 #include <boost/format.hpp>
34 std::map<std::string, te::da::DataSourceFactory::FactoryFnctType>
39 std::map<std::string, FactoryFnctType>::const_iterator it =
sm_factories.find(dsType);
42 throw Exception((boost::format(
TE_TR(
"Could not find a data source factory named: %1!")) % dsType).str());
51 std::map<std::string, FactoryFnctType>::const_iterator it = sm_factories.find(dsType);
53 return (it != sm_factories.end());
58 std::map<std::string, FactoryFnctType>::const_iterator it = sm_factories.find(dsType);
60 if(it != sm_factories.end())
61 throw Exception((boost::format(
TE_TR(
"A data source factory with name '%1' is already registered.")) % dsType).str());
63 sm_factories[dsType] = f;
68 std::map<std::string, FactoryFnctType>::iterator it = sm_factories.find(dsType);
70 if(it == sm_factories.end())
71 throw Exception((boost::format(
TE_TR(
"There is no registered data source factory named '%1'.")) % dsType).str());
73 sm_factories.erase(it);
static bool find(const std::string &dsType)
static std::map< std::string, FactoryFnctType > sm_factories
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
#define TE_TR(message)
It marks a string in order to get translated.
boost::function< DataSource *()> FactoryFnctType
static std::auto_ptr< DataSource > make(const std::string &dsType)
A factory for data sources.
static void add(const std::string &dsType, FactoryFnctType f)
static void remove(const std::string &dsType)