oflog/include/dcmtk/oflog/spi/filter.h

Go to the documentation of this file.
00001 // Module:  Log4CPLUS
00002 // File:    filter.h
00003 // Created: 5/2003
00004 // Author:  Tad E. Smith
00005 //
00006 //
00007 // Copyright 1999-2009 Tad E. Smith
00008 //
00009 // Licensed under the Apache License, Version 2.0 (the "License");
00010 // you may not use this file except in compliance with the License.
00011 // You may obtain a copy of the License at
00012 //
00013 //     http://www.apache.org/licenses/LICENSE-2.0
00014 //
00015 // Unless required by applicable law or agreed to in writing, software
00016 // distributed under the License is distributed on an "AS IS" BASIS,
00017 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00018 // See the License for the specific language governing permissions and
00019 // limitations under the License.
00020 
00024 #ifndef LOG4CPLUS_SPI_FILTER_HEADER_
00025 #define LOG4CPLUS_SPI_FILTER_HEADER_
00026 
00027 #include "dcmtk/oflog/config.h"
00028 #include "dcmtk/oflog/helpers/pointer.h"
00029 #include "dcmtk/oflog/helpers/property.h"
00030 #include "dcmtk/oflog/spi/logevent.h"
00031 
00032 
00033 namespace log4cplus {
00034     namespace spi {
00035 
00036 
00037         enum FilterResult { DENY, 
00040                             NEUTRAL, 
00044                             ACCEPT 
00047                           };
00048 
00049         // Forward Declarations
00050         class Filter;
00051 
00052 
00058         LOG4CPLUS_EXPORT FilterResult checkFilter(const Filter* filter,
00059                                                   const InternalLoggingEvent& event);
00060 
00061         typedef helpers::SharedObjectPtr<Filter> FilterPtr;
00062 
00063 
00091         class LOG4CPLUS_EXPORT Filter
00092             : public virtual log4cplus::helpers::SharedObject
00093         {
00094         public:
00095           // ctor and dtor
00096             Filter();
00097             virtual ~Filter();
00098 
00099           // Methods
00103             void appendFilter(FilterPtr filter);
00104 
00115             virtual FilterResult decide(const InternalLoggingEvent& event) const = 0;
00116 
00117           // Data
00121             FilterPtr next;
00122         };
00123 
00124 
00125 
00134         class LOG4CPLUS_EXPORT DenyAllFilter : public Filter {
00135         public:
00136             DenyAllFilter ();
00137             DenyAllFilter (const log4cplus::helpers::Properties&, log4cplus::tstring& error);
00138 
00143             virtual FilterResult decide(const InternalLoggingEvent& event) const;
00144         };
00145 
00146 
00158         class LOG4CPLUS_EXPORT LogLevelMatchFilter : public Filter {
00159         public:
00160             LogLevelMatchFilter();
00161             LogLevelMatchFilter(const log4cplus::helpers::Properties& p, log4cplus::tstring&);
00162 
00173             virtual FilterResult decide(const InternalLoggingEvent& event) const;
00174 
00175         private:
00176           // Methods
00177             void init();
00178 
00179           // Data
00181             bool acceptOnMatch;
00182             LogLevel logLevelToMatch;
00183         };
00184 
00185 
00186 
00212         class LOG4CPLUS_EXPORT LogLevelRangeFilter : public Filter {
00213         public:
00214           // ctors
00215             LogLevelRangeFilter();
00216             LogLevelRangeFilter(const log4cplus::helpers::Properties& p, log4cplus::tstring& error);
00217 
00221             virtual FilterResult decide(const InternalLoggingEvent& event) const;
00222 
00223         private:
00224           // Methods
00225             void init();
00226 
00227           // Data
00229             bool acceptOnMatch;
00230             LogLevel logLevelMin;
00231             LogLevel logLevelMax;
00232         };
00233 
00234 
00235 
00247         class LOG4CPLUS_EXPORT StringMatchFilter : public Filter {
00248         public:
00249           // ctors
00250             StringMatchFilter();
00251             StringMatchFilter(const log4cplus::helpers::Properties& p, log4cplus::tstring& error);
00252 
00256             virtual FilterResult decide(const InternalLoggingEvent& event) const;
00257 
00258         private:
00259           // Methods
00260             void init();
00261 
00262           // Data
00264             bool acceptOnMatch;
00265             log4cplus::tstring stringToMatch;
00266         };
00267 
00268     } // end namespace spi
00269 } // end namespace log4cplus
00270 
00271 #endif /* LOG4CPLUS_SPI_FILTER_HEADER_ */
00272 
00273 


Generated on 6 Jan 2011 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.5.1