MythTV  master
logMessage.h
Go to the documentation of this file.
1 // Program Name: logMessage.h
3 //
4 // Licensed under the GPL v2 or later, see COPYING for details
5 //
7 
8 #ifndef LOGMESSAGE_H_
9 #define LOGMESSAGE_H_
10 
11 #include <QString>
12 #include <QDateTime>
13 
14 #include "serviceexp.h"
15 #include "datacontracthelper.h"
16 
17 namespace DTC
18 {
19 
20 class SERVICE_PUBLIC LogMessage : public QObject
21 {
22  Q_OBJECT
23  Q_CLASSINFO( "version" , "1.0" );
24 
25  Q_PROPERTY( QString HostName READ HostName
26  WRITE setHostName )
27  Q_PROPERTY( QString Application READ Application
28  WRITE setApplication )
29  Q_PROPERTY( int PID READ PID
30  WRITE setPID )
31  Q_PROPERTY( int TID READ TID
32  WRITE setTID )
33  Q_PROPERTY( QString Thread READ Thread
34  WRITE setThread )
35  Q_PROPERTY( QString Filename READ Filename
36  WRITE setFilename )
37  Q_PROPERTY( int Line READ Line
38  WRITE setLine )
39  Q_PROPERTY( QString Function READ Function
40  WRITE setFunction )
41  Q_PROPERTY( QDateTime Time READ Time
42  WRITE setTime )
43  Q_PROPERTY( QString Level READ Level
44  WRITE setLevel )
45  Q_PROPERTY( QString Message READ Message
46  WRITE setMessage )
47 
48  PROPERTYIMP( QString , HostName )
49  PROPERTYIMP( QString , Application )
50  PROPERTYIMP( int , PID )
51  PROPERTYIMP( int , TID )
52  PROPERTYIMP( QString , Thread )
53  PROPERTYIMP( QString , Filename )
54  PROPERTYIMP( int , Line )
55  PROPERTYIMP( QString , Function )
56  PROPERTYIMP( QDateTime, Time )
57  PROPERTYIMP( QString , Level )
58  PROPERTYIMP( QString , Message );
59 
60  public:
61 
62  static inline void InitializeCustomTypes();
63 
64  Q_INVOKABLE LogMessage(QObject *parent = nullptr)
65  : QObject ( parent ),
66  m_HostName ( ),
67  m_Application ( ),
68  m_PID ( 0 ),
69  m_TID ( 0 ),
70  m_Thread ( ),
71  m_Filename ( ),
72  m_Line ( 0 ),
73  m_Function ( ),
74  m_Time ( ),
75  m_Level ( ),
76  m_Message ( )
77  {
78  }
79 
80  void Copy( const LogMessage *src )
81  {
82  m_HostName = src->m_HostName ;
83  m_Application = src->m_Application ;
84  m_PID = src->m_PID ;
85  m_TID = src->m_TID ;
86  m_Thread = src->m_Thread ;
87  m_Filename = src->m_Filename ;
88  m_Line = src->m_Line ;
89  m_Function = src->m_Function ;
90  m_Time = src->m_Time ;
91  m_Level = src->m_Level ;
92  m_Message = src->m_Message ;
93  }
94 
95  private:
96  Q_DISABLE_COPY(LogMessage);
97 };
98 
100 {
101  qRegisterMetaType< LogMessage* >();
102 }
103 
104 } // namespace DTC
105 
106 #endif
Q_INVOKABLE LogMessage(QObject *parent=nullptr)
Definition: logMessage.h:64
void Copy(const LogMessage *src)
Definition: logMessage.h:80
#define PROPERTYIMP(type, name)
static void InitializeCustomTypes()
Definition: logMessage.h:99
#define SERVICE_PUBLIC
Definition: serviceexp.h:9