You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
2.6 KiB

  1. // -*- C++ -*-
  2. // Module: Log4CPLUS
  3. // File: appenderattachable.h
  4. // Created: 6/2001
  5. // Author: Tad E. Smith
  6. //
  7. //
  8. // Copyright 2001-2013 Tad E. Smith
  9. //
  10. // Licensed under the Apache License, Version 2.0 (the "License");
  11. // you may not use this file except in compliance with the License.
  12. // You may obtain a copy of the License at
  13. //
  14. // http://www.apache.org/licenses/LICENSE-2.0
  15. //
  16. // Unless required by applicable law or agreed to in writing, software
  17. // distributed under the License is distributed on an "AS IS" BASIS,
  18. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  19. // See the License for the specific language governing permissions and
  20. // limitations under the License.
  21. /** @file */
  22. #ifndef LOG4CPLUS_SPI_APPENDER_ATTACHABLE_HEADER_
  23. #define LOG4CPLUS_SPI_APPENDER_ATTACHABLE_HEADER_
  24. #include <log4cplus/config.hxx>
  25. #if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
  26. #pragma once
  27. #endif
  28. #include <log4cplus/appender.h>
  29. #include <log4cplus/tstring.h>
  30. #include <log4cplus/helpers/pointer.h>
  31. #include <vector>
  32. namespace log4cplus {
  33. // Forward Declarations
  34. typedef helpers::SharedObjectPtr<Appender> SharedAppenderPtr;
  35. typedef std::vector<log4cplus::SharedAppenderPtr> SharedAppenderPtrList;
  36. namespace spi {
  37. /**
  38. * This Interface is for attaching Appenders to objects.
  39. */
  40. class LOG4CPLUS_EXPORT AppenderAttachable {
  41. public:
  42. // Methods
  43. /**
  44. * Add an appender.
  45. */
  46. virtual void addAppender(SharedAppenderPtr newAppender) = 0;
  47. /**
  48. * Get all previously added appenders as an Enumeration.
  49. */
  50. virtual SharedAppenderPtrList getAllAppenders() = 0;
  51. /**
  52. * Get an appender by name.
  53. */
  54. virtual SharedAppenderPtr getAppender(const log4cplus::tstring& name) = 0;
  55. /**
  56. * Remove all previously added appenders.
  57. */
  58. virtual void removeAllAppenders() = 0;
  59. /**
  60. * Remove the appender passed as parameter from the list of appenders.
  61. */
  62. virtual void removeAppender(SharedAppenderPtr appender) = 0;
  63. /**
  64. * Remove the appender with the name passed as parameter from the
  65. * list of appenders.
  66. */
  67. virtual void removeAppender(const log4cplus::tstring& name) = 0;
  68. // Dtor
  69. virtual ~AppenderAttachable() = 0;
  70. };
  71. } // end namespace spi
  72. } // end namespace log4cplus
  73. #endif // LOG4CPLUS_SPI_APPENDER_ATTACHABLE_HEADER_