Blame view

src/objectdata.cpp 3.59 KB
30448f62   Peter M. Groen   Replace Qt with s...
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
  #include "objectdata.h"
  
  using namespace osdev::components;
  
  ObjectData::ObjectData()
      : m_objectType()
      , m_objectId()
      , m_targetName()
      , m_targetAction()
      , m_keyField()
      , m_keyValue()
      , m_foreignKeyField()
      , m_targetField()
      , m_targetResetValue()
      , m_useNonPersistentTimestamp(false)
      , m_npTimestampBufferSize(10)
      , m_qhInputs()
      , m_qhOutputs()
  {
  }
  
  void ObjectData::setObjectType(const QString& _objectType) { m_objectType = _objectType; }
  
  void ObjectData::setObjectId(const QString& _objectId) { m_objectId = _objectId; }
  
  void ObjectData::setTargetName(const QString& _targetName) { m_targetName = _targetName; }
  
  void ObjectData::setTargetAction(const QString& _targetAction) { m_targetAction = _targetAction; }
  
  void ObjectData::setKeyField(const QString& _keyField) { m_keyField = _keyField; }
  
  void ObjectData::setKeyValue(const QString& _keyValue) { m_keyValue = _keyValue; }
  
  void ObjectData::setForeignKeyField(const QString& foreignKeyField) { m_foreignKeyField = foreignKeyField; }
  
  void ObjectData::setTargetField(const QString& targetField) { m_targetField = targetField; }
  
  void ObjectData::setTargetResetValue(const QString& targetResetValue) { m_targetResetValue = targetResetValue; }
  
  void ObjectData::setNonPersistentTimestampUsage(bool value) { m_useNonPersistentTimestamp = value; }
  
  void ObjectData::setNonPersistentTimestampBufferSize(unsigned int value) { m_npTimestampBufferSize = value; }
  
  const QStringList ObjectData::getInputNames() const { return m_qhInputs.keys(); }
  
  const QString& ObjectData::getInputId(const QString& _inputName) const { return m_qhInputs.value(_inputName)->id(); }
  
  const QString& ObjectData::getInputType(const QString& _inputName) const { return m_qhInputs.value(_inputName)->type(); }
  
  const QString& ObjectData::getInputDefault(const QString& _inputName) const { return m_qhInputs.value(_inputName)->Default(); }
  
  bool ObjectData::getInputExcludeFromIdentityCheck(const QString& _inputName) const { return m_qhInputs.value(_inputName)->excludeFromIdentityCheck(); }
  
  const QStringList ObjectData::getOutputNames() const { return m_qhOutputs.keys(); }
  
  const QString& ObjectData::getOutputType(const QString& _outputName) const { return m_qhOutputs.value(_outputName)->type(); }
  
  const QString& ObjectData::getOutputDefault(const QString& _outputName) const { return m_qhOutputs.value(_outputName)->Default(); }
  
  void ObjectData::setInputData(const QString& _name, const QString& _type, const QString& _id, const QString& _default, bool excludeFromIdentityCheck)
  {
      // Use multiInsert in order to detect double entries at a later stage. The getters will return the last entry and in that sense the
      // behaviour is the same as when overwriting the value in the hash with an insert. The keys method used by getInputNames however will
      // return a list that holds a key multiple times if it was inserted multiple times.
      m_qhInputs.insertMulti(_name, (QSharedPointer<ConnectorData>(new ConnectorData(_name, _type, _id, _default, excludeFromIdentityCheck))));
  }
  
  void ObjectData::setOutputData(const QString& _name, const QString& _type, const QString& _default)
  {
      // Use multiInsert in order to detect double entries at a later stage. The getters will return the last entry and in that sense the
      // behaviour is the same as when overwriting the value in the hash with an insert. The keys method used by getOutputNames however will
      // return a list that holds a key multiple times if it was inserted multiple times.
      m_qhOutputs.insertMulti(_name, (QSharedPointer<ConnectorData>(new ConnectorData(_name, _type, QString{}, _default)))); // no id
  }