MythTV  master
connectionInfo.h
Go to the documentation of this file.
1 // Program Name: connectionInfo.h
3 // Created : Jan. 15, 2010
4 //
5 // Copyright (c) 2010 David Blain <dblain@mythtv.org>
6 //
7 // Licensed under the GPL v2 or later, see COPYING for details
8 //
10 
11 #ifndef CONNECTIONINFO_H_
12 #define CONNECTIONINFO_H_
13 
14 #include "serviceexp.h"
15 #include "datacontracthelper.h"
16 
17 #include "versionInfo.h"
18 #include "databaseInfo.h"
19 #include "wolInfo.h"
20 
21 namespace DTC
22 {
23 
24 class SERVICE_PUBLIC ConnectionInfo : public QObject
25 {
26  Q_OBJECT
27 
28  Q_CLASSINFO( "version" , "1.1" );
29 
30  Q_PROPERTY( QObject* Version READ Version )
31  Q_PROPERTY( QObject* Database READ Database )
32  Q_PROPERTY( QObject* WOL READ WOL )
33 
34  PROPERTYIMP_PTR( VersionInfo , Version )
35  PROPERTYIMP_PTR( DatabaseInfo, Database )
36  PROPERTYIMP_PTR( WOLInfo , WOL );
37 
38  public:
39 
40  static inline void InitializeCustomTypes();
41 
42  Q_INVOKABLE ConnectionInfo(QObject *parent = nullptr)
43  : QObject ( parent ),
44  m_Version ( nullptr ),
45  m_Database ( nullptr ),
46  m_WOL ( nullptr )
47  {
48  }
49 
50  void Copy( const ConnectionInfo *src )
51  {
52  // We always need to make sure the child object is
53  // created with the correct parent *
54 
55  if (src->m_Version)
56  Version()->Copy( src->m_Version );
57 
58  if (src->m_Database)
59  Database()->Copy( src->m_Database );
60 
61  if (src->m_WOL)
62  WOL ()->Copy( src->m_WOL );
63  }
64 
65  private:
66  Q_DISABLE_COPY(ConnectionInfo);
67 };
68 
70 
72 {
73  qRegisterMetaType< ConnectionInfo* >();
74 
78 }
79 
80 } // namespace DTC
81 
82 #endif
static void InitializeCustomTypes()
Definition: wolInfo.h:65
#define SERVICE_PUBLIC
Definition: serviceexp.h:9
static void InitializeCustomTypes()
Definition: databaseInfo.h:78
static void InitializeCustomTypes()
Definition: versionInfo.h:70
ConnectionInfo * ConnectionInfoPtr
#define PROPERTYIMP_PTR(type, name)
static void InitializeCustomTypes()
void Copy(const ConnectionInfo *src)