00001 /****************************************************************************** 00002 * 00003 * package: Log4Qt 00004 * file: appender.h 00005 * created: September 2007 00006 * author: Martin Heinrich 00007 * 00008 * 00009 * Copyright 2007 Martin Heinrich 00010 * 00011 * Licensed under the Apache License, Version 2.0 (the "License"); 00012 * you may not use this file except in compliance with the License. 00013 * You may obtain a copy of the License at 00014 * 00015 * http://www.apache.org/licenses/LICENSE-2.0 00016 * 00017 * Unless required by applicable law or agreed to in writing, software 00018 * distributed under the License is distributed on an "AS IS" BASIS, 00019 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00020 * See the License for the specific language governing permissions and 00021 * limitations under the License. 00022 * 00023 ********************************************************************************/ 00024 00025 #ifndef LOG4QT_APPENDER_H 00026 #define LOG4QT_APPENDER_H 00027 00028 00029 /****************************************************************************** 00030 * Dependencies 00031 ******************************************************************************/ 00032 00033 #include "log4qt/helpers/logobject.h" 00034 00035 #include "log4qt/helpers/logobjectptr.h" 00036 00037 #include "log4qt/logger.h" 00038 00039 00040 /****************************************************************************** 00041 * Declarations 00042 ******************************************************************************/ 00043 00044 namespace Log4Qt 00045 { 00046 00047 class Filter; 00048 class Layout; 00049 class LoggingEvent; 00050 00062 class Appender : public LogObject 00063 { 00064 Q_OBJECT 00065 00071 Q_PROPERTY(Layout* layout READ layout WRITE setLayout) 00072 00073 00078 Q_PROPERTY(QString name READ name WRITE setName) 00079 00085 Q_PROPERTY(bool requiresLayout READ requiresLayout) 00086 00087 public: 00088 Appender(QObject *pParent = 0); 00089 virtual ~Appender(); 00090 private: 00091 Appender(const Appender &rOther); // Not implemented 00092 Appender &operator=(const Appender &rOther); // Not implemented 00093 00094 public: 00095 // JAVA: ErrorHandler* errorHandler(); 00096 virtual Filter *filter() const = 0; 00097 virtual QString name() const = 0; 00098 virtual Layout *layout() const = 0; 00099 virtual bool requiresLayout() const = 0; 00100 // JAVA: void setErrorHandler(ErrorHandler *pErrorHandler); 00101 virtual void setLayout(Layout *pLayout) = 0; 00102 virtual void setName(const QString &rName) = 0; 00103 00104 virtual void addFilter(Filter *pFilter) = 0; 00105 virtual void clearFilters() = 0; 00106 virtual void close() = 0; 00107 virtual void doAppend(const LoggingEvent &rEvent) = 0; 00108 }; 00109 00110 00111 /************************************************************************** 00112 * Operators, Helper 00113 **************************************************************************/ 00114 00115 00116 /************************************************************************** 00117 * Inline 00118 **************************************************************************/ 00119 00120 inline Appender::Appender(QObject *pParent) : 00121 LogObject(pParent) 00122 {} 00123 00124 inline Appender::~Appender() 00125 {} 00126 00127 00128 } // namespace Log4Qt 00129 00130 00131 // Q_DECLARE_TYPEINFO(Log4Qt::Appender, Q_COMPLEX_TYPE); // Use default 00132 Q_DECLARE_TYPEINFO(Log4Qt::LogObjectPtr<Log4Qt::Appender>, Q_MOVABLE_TYPE); 00133 00134 00135 #endif // LOG4QT_APPENDER_H