Log4Qt::Factory Class Reference

The class Factory provides factories for Appender, Filter and Layout objects. More...

#include <factory.h>

List of all members.

Public Types

typedef Appender *(* AppenderFactoryFunc )()
typedef Filter *(* FilterFactoryFunc )()
typedef Layout *(* LayoutFactoryFunc )()

Static Public Member Functions

static AppendercreateAppender (const QString &rAppenderClassName)
static AppendercreateAppender (const char *pAppenderClassName)
static FiltercreateFilter (const QString &rFilterClassName)
static FiltercreateFilter (const char *pFilterClassName)
static LayoutcreateLayout (const QString &rLayoutClassName)
static LayoutcreateLayout (const char *pLayoutClassName)
static Factoryinstance ()
static void registerAppender (const QString &rAppenderClassName, AppenderFactoryFunc pAppenderFactoryFunc)
static void registerAppender (const char *pAppenderClassName, AppenderFactoryFunc pAppenderFactoryFunc)
static void registerFilter (const QString &rFilterClassName, FilterFactoryFunc pFilterFactoryFunc)
static void registerFilter (const char *pFilterClassName, FilterFactoryFunc pFilterFactoryFunc)
static void registerLayout (const QString &rLayoutClassName, LayoutFactoryFunc pLayoutFactoryFunc)
static void registerLayout (const char *pLayoutClassName, LayoutFactoryFunc pLayoutFactoryFunc)
static QStringList registeredAppenders ()
static QStringList registeredFilters ()
static QStringList registeredLayouts ()
static void setObjectProperty (QObject *pObject, const QString &rProperty, const QString &rValue)
static void setObjectProperty (QObject *pObject, const char *pProperty, const QString &rValue)
static void unregisterAppender (const QString &rAppenderClassName)
static void unregisterAppender (const char *pAppenderClassName)
static void unregisterFilter (const QString &rFilterClassName)
static void unregisterFilter (const char *pFilterClassName)
static void unregisterLayout (const QString &rLayoutClassName)
static void unregisterLayout (const char *pLayoutClassName)

Related Functions

(Note that these are not member functions.)

QDebug operator<< (QDebug debug, const Factory &rFactory)


Detailed Description

The class Factory provides factories for Appender, Filter and Layout objects.

The functions createAppender(), createFilter() and createLayout() allow to create objects by specifying their class names. By default all classes of the package are recognised with their Log4j and Log4Qt classanmes. For example an object of the class FileAppender can be craeted using "org.apache.log4j.FileAppender" or "Log4Qt::FileAppender". Additional classes can be registered using registerAppender(), registerFilter() and registerLayout().

An QObject property can be set from a string value with setObjectProperty(). The function handles the required error checking and type conversion.

Note:
All the functions declared in this class are thread-safe.
See also:
PropertyConfigurator

Member Typedef Documentation

Prototype for an Appender factory function. The function creates an Appender object on the heap and returns a pointer to it.

See also:
registerAppender(), createAppender()

Prototype for a Filter factory function. The function creates a Filter object on the heap and returns a pointer to it.

See also:
registerFilter(), createFilter()

Prototype for a Layout factory function. The function creates a Layout object on the heap and returns a pointer to it.

See also:
registerLayout(), createLayout()


Member Function Documentation

Appender * Log4Qt::Factory::createAppender ( const QString &  rAppenderClassName  )  [inline, static]

Creates an object for the class rAppenderClassName on the heap and returns a pointer to it. If the class has no registered factory function a null pointer is returned.

See also:
registerAppender(), unregisterAppender(), registeredAppenders()

References doCreateAppender(), and instance().

Appender * Log4Qt::Factory::createAppender ( const char *  pAppenderClassName  )  [inline, static]

This is an overloaded member function, provided for convenience.

References doCreateAppender(), and instance().

Filter * Log4Qt::Factory::createFilter ( const QString &  rFilterClassName  )  [inline, static]

Creates an object for the class rFilterClassName on the heap and returns a pointer to it. If the class has no registered factory function a null pointer is returned.

See also:
registerFilter(), unregisterFilter(), registeredFilters()

References doCreateFilter(), and instance().

Filter * Log4Qt::Factory::createFilter ( const char *  pFilterClassName  )  [inline, static]

This is an overloaded member function, provided for convenience.

References doCreateFilter(), and instance().

Layout * Log4Qt::Factory::createLayout ( const QString &  rLayoutClassName  )  [inline, static]

Creates an object for the class rLayoutClassName on the heap and returns a pointer to it. If the class has no registered factory function a null pointer is returned.

See also:
registerLayout(), unregisterLayout(), registeredLayouts()

References doCreateLayout(), and instance().

Layout * Log4Qt::Factory::createLayout ( const char *  pLayoutClassName  )  [inline, static]

This is an overloaded member function, provided for convenience.

References doCreateLayout(), and instance().

static Factory* Log4Qt::Factory::instance (  )  [static]

void Log4Qt::Factory::registerAppender ( const QString &  rAppenderClassName,
AppenderFactoryFunc  pAppenderFactoryFunc 
) [inline, static]

Registers the Appender factory function pAppenderFactoryFunc for the class rAppenderClassName. If a registered factory function exists for the class, it is replaced with pAppenderFactoryFunc.

See also:
unregisterAppender(), registeredAppenders(), createAppender()

References doRegisterAppender(), and instance().

void Log4Qt::Factory::registerAppender ( const char *  pAppenderClassName,
AppenderFactoryFunc  pAppenderFactoryFunc 
) [inline, static]

This is an overloaded member function, provided for convenience.

References doRegisterAppender(), and instance().

void Log4Qt::Factory::registerFilter ( const QString &  rFilterClassName,
FilterFactoryFunc  pFilterFactoryFunc 
) [inline, static]

Registers the Filter factory function pFilterFactoryFunc for the class rFilterClassName. If a registered factory function exists for the class, it is replaced with pFilterFactoryFunc.

See also:
unregisterFilter(), registeredFilters(), createFilter()

References doRegisterFilter(), and instance().

void Log4Qt::Factory::registerFilter ( const char *  pFilterClassName,
FilterFactoryFunc  pFilterFactoryFunc 
) [inline, static]

This is an overloaded member function, provided for convenience.

References doRegisterFilter(), and instance().

void Log4Qt::Factory::registerLayout ( const QString &  rLayoutClassName,
LayoutFactoryFunc  pLayoutFactoryFunc 
) [inline, static]

Registers the Layout factory function pLayoutFactoryFunc for the class rLayoutClassName. If a registered factory function exists for the class, it is replaced with pLayoutFactoryFunc.

See also:
unregisterLayout(), registeredLayout(), createLayout()

References doRegisterLayout(), and instance().

void Log4Qt::Factory::registerLayout ( const char *  pLayoutClassName,
LayoutFactoryFunc  pLayoutFactoryFunc 
) [inline, static]

This is an overloaded member function, provided for convenience.

References doRegisterLayout(), and instance().

QStringList Log4Qt::Factory::registeredAppenders (  )  [inline, static]

Returns a list of the class names for registered Appender factory functions.

See also:
registerAppender(), unregisterAppender()

References instance(), and mAppenderRegistry.

QStringList Log4Qt::Factory::registeredFilters (  )  [inline, static]

Returns a list of the class names for registered Filter factory functions.

See also:
registerFilter(), unregisterFilter()

References instance(), and mFilterRegistry.

QStringList Log4Qt::Factory::registeredLayouts (  )  [inline, static]

Returns a list of the class names for registered Layout factory functions.

See also:
registerLayout(), unregisterLayout()

References instance(), and mLayoutRegistry.

void Log4Qt::Factory::setObjectProperty ( QObject *  pObject,
const QString &  rProperty,
const QString &  rValue 
) [inline, static]

Sets the property rProperty of the object pObject to the value rValue. The function will test that the property rProperty is writeable and of a type the function can convert to. The types bool, int, Level and QString are supported.

See also:
OptionConverter

References doSetObjectProperty(), and instance().

void Log4Qt::Factory::setObjectProperty ( QObject *  pObject,
const char *  pProperty,
const QString &  rValue 
) [inline, static]

This is an overloaded member function, provided for convenience.

References doSetObjectProperty(), and instance().

void Log4Qt::Factory::unregisterAppender ( const QString &  rAppenderClassName  )  [inline, static]

Unregisters the Appender factory function for the class rAppenderClassName.

See also:
registerAppender(), registeredAppenders()

References doUnregisterAppender(), and instance().

void Log4Qt::Factory::unregisterAppender ( const char *  pAppenderClassName  )  [inline, static]

This is an overloaded member function, provided for convenience.

References doUnregisterAppender(), and instance().

void Log4Qt::Factory::unregisterFilter ( const QString &  rFilterClassName  )  [inline, static]

Unregisters the Filter factory function for the class rFilterClassName.

See also:
registerFilter(), registeredFilters()

References doUnregisterFilter(), and instance().

void Log4Qt::Factory::unregisterFilter ( const char *  pFilterClassName  )  [inline, static]

This is an overloaded member function, provided for convenience.

References doUnregisterFilter(), and instance().

void Log4Qt::Factory::unregisterLayout ( const QString &  rLayoutClassName  )  [inline, static]

Unregisters the Layout factory function for the class rLayoutClassName.

See also:
registerLayout(), registeredLayouts()

References doUnregisterLayout(), and instance().

void Log4Qt::Factory::unregisterLayout ( const char *  pLayoutClassName  )  [inline, static]

This is an overloaded member function, provided for convenience.

References doUnregisterLayout(), and instance().


Friends And Related Function Documentation

QDebug operator<< ( QDebug  debug,
const Factory rFactory 
) [related]

Writes all object member variables to the given debug stream rDebug and returns the stream.

Factory(appenderfactories:("Log4Qt::DebugAppender", "Log4Qt::NullAppender", "Log4Qt::ConsoleAppender", "org.apache.log4j.varia.DebugAppender", "org.apache.log4j.FileAppender", "org.apache.log4j.RollingFileAppender", "org.apache.log4j.DailyRollingFileAppender", "org.apache.log4j.varia.ListAppender", "org.apache.log4j.varia.NullAppender", "Log4Qt::FileAppender", "org.apache.log4j.ConsoleAppender", "Log4Qt::DailyRollingFileAppender", "Log4Qt::ListAppender", "Log4Qt::RollingFileAppender") filterfactories: ("Log4Qt::DenyAllFilter", "Log4Qt::StringMatchFilter", "Log4Qt::LevelRangeFilter", "org.apache.log4j.varia.DenyAllFilter", "org.apache.log4j.varia.LevelRangeFilter", "org.apache.log4j.varia.StringMatchFilter", "Log4Qt::LevelMatchFilter", "org.apache.log4j.varia.LevelMatchFilter") layoutfactories: ("org.apache.log4j.SimpleLayout", "Log4Qt::PatternLayout", "Log4Qt::SimpleLayout", "org.apache.log4j.TTCCLayout", "Log4Qt::TTCCLayout", "org.apache.log4j.PatternLayout") )

See also:
QDebug, Factory::logManager()


The documentation for this class was generated from the following file:

Generated on Sun Mar 1 16:40:45 2009 for Log4Qt by  doxygen 1.5.6