MythTV  master
recRuleFilterList.h
Go to the documentation of this file.
1 
2 #ifndef RECRULEFILTERLIST_H_
3 #define RECRULEFILTERLIST_H_
4 
5 #include <QVariantList>
6 #include <QDateTime>
7 
10 
11 #include "recRuleFilter.h"
12 
13 namespace DTC
14 {
15 
16 class SERVICE_PUBLIC RecRuleFilterList : public QObject
17 {
18  Q_OBJECT
19  Q_CLASSINFO( "version", "1.0" );
20 
21  // Q_CLASSINFO Used to augment Metadata for properties.
22  // See datacontracthelper.h for details
23 
24  Q_CLASSINFO( "RecRuleFilters", "type=DTC::RecRuleFilter");
25  Q_CLASSINFO( "AsOf" , "transient=true" );
26 
27  Q_PROPERTY( int StartIndex READ StartIndex WRITE setStartIndex )
28  Q_PROPERTY( int Count READ Count WRITE setCount )
29  Q_PROPERTY( int TotalAvailable READ TotalAvailable WRITE setTotalAvailable )
30  Q_PROPERTY( QDateTime AsOf READ AsOf WRITE setAsOf )
31  Q_PROPERTY( QString Version READ Version WRITE setVersion )
32  Q_PROPERTY( QString ProtoVer READ ProtoVer WRITE setProtoVer )
33 
34  Q_PROPERTY( QVariantList RecRuleFilters READ RecRuleFilters )
35 
36  PROPERTYIMP ( int , StartIndex )
37  PROPERTYIMP ( int , Count )
38  PROPERTYIMP ( int , TotalAvailable )
39  PROPERTYIMP_REF ( QDateTime , AsOf )
40  PROPERTYIMP_REF ( QString , Version )
41  PROPERTYIMP_REF ( QString , ProtoVer )
42 
43  PROPERTYIMP_RO_REF( QVariantList, RecRuleFilters );
44 
45  public:
46 
47  static inline void InitializeCustomTypes();
48 
49  Q_INVOKABLE RecRuleFilterList(QObject *parent = nullptr)
50  : QObject ( parent ),
51  m_StartIndex ( 0 ),
52  m_Count ( 0 ),
53  m_TotalAvailable ( 0 )
54  {
55  }
56 
57  void Copy( const RecRuleFilterList *src )
58  {
59  m_AsOf = src->m_AsOf ;
60  m_Version = src->m_Version ;
61  m_ProtoVer = src->m_ProtoVer ;
62 
63  CopyListContents< RecRuleFilter >( this, m_RecRuleFilters, src->m_RecRuleFilters );
64  }
65 
67  {
68  // We must make sure the object added to the QVariantList has
69  // a parent of 'this'
70 
71  auto *pObject = new RecRuleFilter( this );
72  m_RecRuleFilters.append( QVariant::fromValue<QObject *>( pObject ));
73 
74  return pObject;
75  }
76 
77  private:
78  Q_DISABLE_COPY(RecRuleFilterList);
79 };
80 
82 {
83  qRegisterMetaType< RecRuleFilterList* >();
84 
86 }
87 
88 } // namespace DTC
89 
90 #endif
DTC::RecRuleFilterList::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: recRuleFilterList.h:81
recRuleFilter.h
DTC::RecRuleFilterList
Definition: recRuleFilterList.h:16
SERVICE_PUBLIC
#define SERVICE_PUBLIC
Definition: serviceexp.h:9
PROPERTYIMP_RO_REF
#define PROPERTYIMP_RO_REF(type, name)
Definition: datacontracthelper.h:114
datacontracthelper.h
DTC::RecRuleFilterList::Copy
void Copy(const RecRuleFilterList *src)
Definition: recRuleFilterList.h:57
serviceexp.h
PROPERTYIMP
#define PROPERTYIMP(type, name)
Definition: datacontracthelper.h:56
DTC
Definition: datacontracthelper.h:123
DTC::RecRuleFilter::InitializeCustomTypes
static void InitializeCustomTypes()
Definition: recRuleFilter.h:46
PROPERTYIMP_REF
#define PROPERTYIMP_REF(type, name)
Definition: datacontracthelper.h:70
DTC::RecRuleFilter
Definition: recRuleFilter.h:15
DTC::RecRuleFilterList::AddNewRecRuleFilter
RecRuleFilter * AddNewRecRuleFilter()
Definition: recRuleFilterList.h:66