1 /***************************************************************************
2 * Copyright (C) 2008 by Sverre Rabbelier *
3 * sverre@rabbelier.nl *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 3 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
21 #include "FieldValue.h"
22 #include "FieldImpl.h"
23 #include "TableImpl.h"
26 FieldValue::FieldValue(FieldImplPtr field
) :
35 FieldValue::FieldValue(FieldImplPtr field
, cstring value
) :
44 FieldValue::FieldValue(FieldImplPtr field
, value_type value
) :
47 m_integervalue(value
),
53 FieldValue::~FieldValue()
58 FieldImplPtr
FieldValue::getField() const
63 TableImplPtr
FieldValue::getTable() const
65 return m_field
->getTable();
68 cstring
FieldValue::getName() const
70 return m_field
->getName();
73 const std::string
& FieldValue::getStringValue() const
75 Assert(m_field
->isText());
79 value_type
FieldValue::getIntegerValue() const
81 Assert(!m_field
->isText());
82 return m_integervalue
;
85 bool FieldValue::getBoolValue() const
87 Assert(!m_field
->isText());
88 return m_integervalue
== 1 ? true : false;
91 bool FieldValue::isDirty() const
96 void FieldValue::setTextValue(const std::string
& value
)
98 Assert(m_field
->isText());
102 void FieldValue::setIntegerValue(value_type value
)
104 Assert(!m_field
->isText());
105 m_integervalue
= value
;
108 void FieldValue::setBoolValue(bool value
)
110 Assert(!m_field
->isText());
111 m_integervalue
= (value
? 1 : 0);
114 void FieldValue::setDirty(bool dirty
)