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.

103 lines
3.2 KiB

  1. // -*- C++ -*-
  2. // Module: Log4cplus
  3. // File: qt4debugappender.h
  4. // Created: 5/2012
  5. // Author: Vaclav Zeman
  6. //
  7. //
  8. // Copyright (C) 2012, Vaclav Zeman. All rights reserved.
  9. //
  10. // Redistribution and use in source and binary forms, with or without modifica-
  11. // tion, are permitted provided that the following conditions are met:
  12. //
  13. // 1. Redistributions of source code must retain the above copyright notice,
  14. // this list of conditions and the following disclaimer.
  15. //
  16. // 2. Redistributions in binary form must reproduce the above copyright notice,
  17. // this list of conditions and the following disclaimer in the documentation
  18. // and/or other materials provided with the distribution.
  19. //
  20. // THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  21. // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  22. // FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  23. // APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  24. // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
  25. // DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  26. // OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  27. // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  28. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  29. // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30. //
  31. /** @file */
  32. #ifndef LOG4CPLUS_QT4DEBUGAPPENDER_H
  33. #define LOG4CPLUS_QT4DEBUGAPPENDER_H
  34. #include <log4cplus/config.hxx>
  35. #if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
  36. #pragma once
  37. #endif
  38. #include <log4cplus/appender.h>
  39. #if defined (_WIN32)
  40. #if defined (log4cplusqt4debugappender_EXPORTS) \
  41. || defined (log4cplusqt4debugappenderU_EXPORTS) \
  42. || defined (DLL_EXPORT)
  43. #undef LOG4CPLUS_QT4DEBUGAPPENDER_BUILD_DLL
  44. #define LOG4CPLUS_QT4DEBUGAPPENDER_BUILD_DLL
  45. #endif
  46. #if defined (LOG4CPLUS_QT4DEBUGAPPENDER_BUILD_DLL)
  47. #if defined (INSIDE_LOG4CPLUS_QT4DEBUGAPPENDER)
  48. #define LOG4CPLUS_QT4DEBUGAPPENDER_EXPORT __declspec(dllexport)
  49. #else
  50. #define LOG4CPLUS_QT4DEBUGAPPENDER_EXPORT __declspec(dllimport)
  51. #endif
  52. #else
  53. #define LOG4CPLUS_QT4DEBUGAPPENDER_EXPORT
  54. #endif
  55. #else
  56. #if defined (INSIDE_LOG4CPLUS_QT4DEBUGAPPENDER)
  57. #define LOG4CPLUS_QT4DEBUGAPPENDER_EXPORT LOG4CPLUS_DECLSPEC_EXPORT
  58. #else
  59. #define LOG4CPLUS_QT4DEBUGAPPENDER_EXPORT LOG4CPLUS_DECLSPEC_IMPORT
  60. #endif // defined (INSIDE_LOG4CPLUS_QT4DEBUGAPPENDER)
  61. #endif // !_WIN32
  62. namespace log4cplus
  63. {
  64. class LOG4CPLUS_QT4DEBUGAPPENDER_EXPORT Qt4DebugAppender
  65. : public Appender
  66. {
  67. public:
  68. Qt4DebugAppender ();
  69. explicit Qt4DebugAppender (helpers::Properties const &);
  70. virtual ~Qt4DebugAppender ();
  71. virtual void close ();
  72. static void registerAppender ();
  73. protected:
  74. virtual void append (spi::InternalLoggingEvent const &);
  75. private:
  76. Qt4DebugAppender (Qt4DebugAppender const &);
  77. Qt4DebugAppender & operator = (Qt4DebugAppender const &);
  78. };
  79. typedef helpers::SharedObjectPtr<Qt4DebugAppender> Qt4DebugAppenderPtr;
  80. } // namespace log4cplus
  81. #endif // LOG4CPLUS_QT4DEBUGAPPENDER_H