24 #ifndef LOG4CPLUS_SPI_FACTORY_HEADER_
25 #define LOG4CPLUS_SPI_FACTORY_HEADER_
29 #if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
164 bool put(std::unique_ptr<T>
object) {
165 bool putValResult = putVal(object->getTypeName(),
object.get());
175 return static_cast<T*
>(getVal(name));
180 delete static_cast<T*
>(object);
212 template <
typename ProductFactoryBase>
214 :
public ProductFactoryBase
231 template <
typename LocalProduct,
typename ProductFactoryBase>
249 #define LOG4CPLUS_REG_PRODUCT(reg, productprefix, productname, productns, productfact) \
251 std::unique_ptr<productfact> ( \
252 new log4cplus::spi::FactoryTempl<productns productname, productfact> ( \
253 LOG4CPLUS_TEXT(productprefix) \
254 LOG4CPLUS_TEXT(#productname))))
256 #define LOG4CPLUS_REG_APPENDER(reg, appendername) \
257 LOG4CPLUS_REG_PRODUCT (reg, "log4cplus::", appendername, log4cplus::, \
258 log4cplus::spi::AppenderFactory)
260 #define LOG4CPLUS_REG_LAYOUT(reg, layoutname) \
261 LOG4CPLUS_REG_PRODUCT (reg, "log4cplus::", layoutname, log4cplus::, \
262 log4cplus::spi::LayoutFactory)
264 #define LOG4CPLUS_REG_FILTER(reg, filtername) \
265 LOG4CPLUS_REG_PRODUCT (reg, "log4cplus::spi::", filtername, log4cplus::spi::, \
266 log4cplus::spi::FilterFactory)
268 #define LOG4CPLUS_REG_LOCALE(reg, name, factory) \
269 reg.put (std::unique_ptr<log4cplus::spi::LocaleFactory> ( \
Extend this class for implementing your own strategies for printing log statements.
This class is used to layout strings sent to an {}.
This abstract class defines the "Factory" interface to create "Appender" objects.
SharedAppenderPtr ProductPtr
virtual ~AppenderFactory()=0
virtual SharedAppenderPtr createObject(const log4cplus::helpers::Properties &props)=0
Create an "Appender" object.
This is the base class for all factories.
virtual log4cplus::tstring const & getTypeName() const =0
Returns the typename of the objects this factory creates.
This template class is used as a "Factory Registry".
bool put(std::unique_ptr< T > object)
Used to enter an object into the registry.
virtual ~FactoryRegistry()
T * get(const log4cplus::tstring &name) const
Used to retrieve an object from the registry.
virtual void deleteObject(void *object) const
Deletes object.
FactoryTempl(tchar const *n)
ProductFactoryBase::ProductPtr ProductPtr
virtual ProductPtr createObject(helpers::Properties const &props)
This abstract class defines the "Factory" interface to create "Appender" objects.
virtual FilterPtr createObject(const log4cplus::helpers::Properties &props)=0
Create a "Filter" object.
virtual ~FilterFactory()=0
Users should extend this class to implement customized logging event filtering.
This abstract class defines the "Factory" interface to create "Layout" objects.
std::unique_ptr< Layout > ProductPtr
virtual std::unique_ptr< Layout > createObject(const log4cplus::helpers::Properties &props)=0
Create a "Layout" object.
virtual ~LayoutFactory()=0
virtual log4cplus::tstring const & getTypeName() const
LocalFactoryBase(tchar const *n)
This abstract class defines the "Factory" interface to create std::locale instances.
virtual ~LocaleFactory()=0
virtual ProductPtr createObject(const log4cplus::helpers::Properties &props)=0
This is the base class used to implement the functionality required by the ObjectRegistry template cl...
This header defines Filter and all of it's subclasses.
LOG4CPLUS_EXPORT LocaleFactoryRegistry & getLocaleFactoryRegistry()
Returns the "singleton" LocaleFactoryRegistry.
LOG4CPLUS_EXPORT AppenderFactoryRegistry & getAppenderFactoryRegistry()
Returns the "singleton" AppenderFactoryRegistry.
FactoryRegistry< FilterFactory > FilterFactoryRegistry
LOG4CPLUS_EXPORT FilterFactoryRegistry & getFilterFactoryRegistry()
Returns the "singleton" FilterFactoryRegistry.
LOG4CPLUS_EXPORT LayoutFactoryRegistry & getLayoutFactoryRegistry()
Returns the "singleton" LayoutFactoryRegistry.
FactoryRegistry< AppenderFactory > AppenderFactoryRegistry
FactoryRegistry< LocaleFactory > LocaleFactoryRegistry
FactoryRegistry< LayoutFactory > LayoutFactoryRegistry
std::basic_string< tchar > tstring