jobdata.cpp
1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#include "jobdata.h"
using namespace osdev::components;
JobData::JobData()
: m_jobName()
, m_runDate()
, m_runTime()
, m_interval( 0 )
, m_targetObject()
, m_parameters()
{
}
JobData::JobData( const QString& _jobName, const QHash<QString, QVariant>& _paramList,
const QTime& _runTime, const int _interval,
const QString &_targetObject, const QDate& _runDate )
: m_jobName( _jobName )
, m_runDate( _runDate )
, m_runTime( _runTime )
, m_interval( _interval )
, m_targetObject( _targetObject )
, m_parameters( _paramList )
{
}
JobData::JobData(const JobData& source )
: m_jobName( source.jobName() )
, m_runDate( source.runDate() )
, m_runTime( source.runTime() )
, m_interval( source.runInterval() )
, m_targetObject( source.targetObject() )
, m_parameters( source.paramList() )
{
}
JobData& JobData::operator=( const JobData& origin )
{
if( &origin != this )
{
origin.copyImpl( this );
}
return *this;
}
void JobData::copyImpl( JobData* dest ) const
{
dest->m_interval = m_interval;
dest->m_targetObject = m_targetObject;
dest->m_jobName = m_jobName;
dest->m_parameters = m_parameters;
dest->m_runDate = m_runDate;
dest->m_runTime = m_runTime;
}
JobData::~JobData()
{
}
void JobData::addParameter( const QString& _varName, const QVariant &_value )
{
m_parameters.insert( _varName, _value );
}
void JobData::setParameters( const QHash<QString, QVariant>& _paramList )
{
// Clear the old parameter list before assigning the new parameter list. Just to be shure.
m_parameters.clear();
m_parameters = _paramList;
}
QVariant JobData::paramValue( const QString& _varName ) const
{
if( m_parameters.contains( _varName ) )
{
return m_parameters.value( _varName );
}
return QVariant();
}
QStringList JobData::varNames() const
{
return QStringList( m_parameters.keys() );
}