simplelayout.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /******************************************************************************
  2. *
  3. * package: Log4Qt
  4. * file: simplelayout.h
  5. * created: September 2007
  6. * author: Martin Heinrich
  7. *
  8. *
  9. * Copyright 2007 Martin Heinrich
  10. *
  11. * Licensed under the Apache License, Version 2.0 (the "License");
  12. * you may not use this file except in compliance with the License.
  13. * You may obtain a copy of the License at
  14. *
  15. * http://www.apache.org/licenses/LICENSE-2.0
  16. *
  17. * Unless required by applicable law or agreed to in writing, software
  18. * distributed under the License is distributed on an "AS IS" BASIS,
  19. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  20. * See the License for the specific language governing permissions and
  21. * limitations under the License.
  22. *
  23. ******************************************************************************/
  24. #ifndef LOG4QT_SIMPLELAYOUT_H
  25. #define LOG4QT_SIMPLELAYOUT_H
  26. /******************************************************************************
  27. * Dependencies
  28. ******************************************************************************/
  29. #include "log4qt/layout.h"
  30. /******************************************************************************
  31. * Declarations
  32. ******************************************************************************/
  33. namespace Log4Qt
  34. {
  35. /*!
  36. * \brief The class SimpleLayout outputs the level and message of a logging
  37. * event.
  38. *
  39. * \note The ownership and lifetime of objects of this class are managed.
  40. * See \ref Ownership "Object ownership" for more details.
  41. */
  42. class SimpleLayout : public Layout
  43. {
  44. Q_OBJECT
  45. public:
  46. SimpleLayout(QObject *pParent = 0);
  47. // virtual ~SimpleLayout(); // Use compiler default
  48. private:
  49. SimpleLayout(const SimpleLayout &rOther); // Not implemented
  50. SimpleLayout &operator=(const SimpleLayout &rOther); // Not implemented
  51. public:
  52. virtual QString format(const LoggingEvent &rEvent);
  53. protected:
  54. #ifndef QT_NO_DEBUG_STREAM
  55. /*!
  56. * Writes all object member variables to the given debug stream
  57. * \a rDebug and returns the stream.
  58. *
  59. * <tt>
  60. * %SimpleLayout(name:"SL" referencecount:1)
  61. * </tt>
  62. * \sa QDebug, operator<<(QDebug debug, const LogObject &rLogObject)
  63. */
  64. virtual QDebug debug(QDebug &rDebug) const;
  65. #endif // QT_NO_DEBUG_STREAM
  66. };
  67. /**************************************************************************
  68. * Operators, Helper
  69. **************************************************************************/
  70. /**************************************************************************
  71. * Inline
  72. **************************************************************************/
  73. inline SimpleLayout::SimpleLayout(QObject *pParent) :
  74. Layout(pParent)
  75. {}
  76. } // namespace Log4Qt
  77. // Q_DECLARE_TYPEINFO(Log4Qt::SimpleLayout, Q_COMPLEX_TYPE); // Use default
  78. #endif // LOG4QT_SIMPLELAYOUT_H