LayoutAppender.hh 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * LayoutAppender.hh
  3. *
  4. * Copyright 2000, LifeLine Networks BV (www.lifeline.nl). All rights reserved.
  5. * Copyright 2000, Bastiaan Bakker. All rights reserved.
  6. *
  7. * See the COPYING file for the terms of usage and distribution.
  8. */
  9. #ifndef _LOG4CPP_LAYOUTAPPENDER_HH
  10. #define _LOG4CPP_LAYOUTAPPENDER_HH
  11. #include <string>
  12. #include <log4cpp/Portability.hh>
  13. #include <log4cpp/AppenderSkeleton.hh>
  14. #include <log4cpp/BasicLayout.hh>
  15. namespace log4cpp {
  16. /**
  17. * LayoutAppender is a common superclass for all Appenders that require
  18. * a Layout.
  19. **/
  20. class LOG4CPP_EXPORT LayoutAppender : public AppenderSkeleton {
  21. public:
  22. typedef BasicLayout DefaultLayoutType;
  23. LayoutAppender(const std::string& name);
  24. virtual ~LayoutAppender();
  25. /**
  26. * Check if the appender requires a layout. All LayoutAppenders do,
  27. * therefore this method returns true for all subclasses.
  28. *
  29. * @returns true.
  30. **/
  31. virtual bool requiresLayout() const;
  32. virtual void setLayout(Layout* layout = NULL);
  33. protected:
  34. /**
  35. * Return the layout of the appender.
  36. * This method is the Layout accessor for subclasses of LayoutAppender.
  37. * @returns the Layout.
  38. **/
  39. Layout& _getLayout();
  40. private:
  41. Layout* _layout;
  42. };
  43. }
  44. #endif // _LOG4CPP_LAYOUTAPPENDER_HH