LayoutAppender.hh 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. LOG4CPP_NS_BEGIN
  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. private:
  43. // suppress assignment operator
  44. LayoutAppender & operator=(const LayoutAppender &);
  45. };
  46. LOG4CPP_NS_END
  47. #endif // _LOG4CPP_LAYOUTAPPENDER_HH