msttsappender.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. // -*- C++ -*-
  2. // Module: Log4cplus
  3. // File: msttsappender.h
  4. // Created: 10/2012
  5. // Author: Vaclav Zeman
  6. //
  7. //
  8. // Copyright (C) 2012-2015, 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_MSTTSAPPENDER_H
  33. #define LOG4CPLUS_MSTTSAPPENDER_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_MSTTSAPPENDER_BUILD_DLL
  44. #define LOG4CPLUS_MSTTSAPPENDER_BUILD_DLL
  45. #endif
  46. #if defined (LOG4CPLUS_MSTTSAPPENDER_BUILD_DLL)
  47. #if defined (INSIDE_LOG4CPLUS_MSTTSAPPENDER)
  48. #define LOG4CPLUS_MSTTSAPPENDER_EXPORT __declspec(dllexport)
  49. #else
  50. #define LOG4CPLUS_MSTTSAPPENDER_EXPORT __declspec(dllimport)
  51. #endif
  52. #else
  53. #define LOG4CPLUS_MSTTSAPPENDER_EXPORT
  54. #endif
  55. #else
  56. #if defined (INSIDE_LOG4CPLUS_MSTTSAPPENDER)
  57. #define LOG4CPLUS_MSTTSAPPENDER_EXPORT LOG4CPLUS_DECLSPEC_EXPORT
  58. #else
  59. #define LOG4CPLUS_MSTTSAPPENDER_EXPORT LOG4CPLUS_DECLSPEC_IMPORT
  60. #endif // defined (INSIDE_LOG4CPLUS_MSTTSAPPENDER)
  61. #endif // !_WIN32
  62. namespace log4cplus
  63. {
  64. class LOG4CPLUS_MSTTSAPPENDER_EXPORT MSTTSAppender
  65. : public Appender
  66. {
  67. public:
  68. MSTTSAppender ();
  69. explicit MSTTSAppender (helpers::Properties const &);
  70. virtual ~MSTTSAppender ();
  71. virtual void close ();
  72. static void registerAppender ();
  73. protected:
  74. virtual void append (spi::InternalLoggingEvent const &);
  75. struct Data;
  76. Data * data;
  77. private:
  78. LOG4CPLUS_PRIVATE void init (long const * rate = 0,
  79. unsigned long const * volume = 0, bool speak_punc = false,
  80. bool async = false);
  81. MSTTSAppender (MSTTSAppender const &);
  82. MSTTSAppender & operator = (MSTTSAppender const &);
  83. };
  84. typedef helpers::SharedObjectPtr<MSTTSAppender> MSTTSAppenderPtr;
  85. } // namespace log4cplus
  86. #endif // LOG4CPLUS_MSTTSAPPENDER_H