Blame view

src/ormtablerow.cpp 855 Bytes
5251bf3a   Steven de Ridder   Initial commit. d...
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
  #include "ormtablerow.h"
  
  using namespace osdev::components;
  
  OrmTableRow::OrmTableRow()
      : m_stoData()
  {
  
  }
  
  OrmTableRow::~OrmTableRow()
  {
      m_stoData.clear();
  }
  
  void OrmTableRow::setField( QVariant vData, int column )
  {
      if( -1 == column || column >= m_stoData.count() )
      {
          m_stoData.append( vData );
      }
      else if( -1 < column && column < m_stoData.count() )
      {
          m_stoData.replace( column, vData );
      }
  }
  
  QVariant OrmTableRow::getField( int column )
  {
      if( -1 < column && column < m_stoData.count() )
      {
          return m_stoData.at( column );
      }
      return QVariant();
  }
  
  void OrmTableRow::setFields( QList<QVariant> values )
  {
      // Replace the entire internal structure with the new list.
      m_stoData.clear();
      for( const QVariant& value : values )
      {
          m_stoData.append( value );
      }
  }