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 ***************************************************************************/
24 * @brief This file contains the KeyValue class.
30 #include "FieldValue.h"
33 * This class stores the value of the key of a row.
35 * It may be used as if it were a regular Value object.
36 * Calls to getStringValue are illegal, but this is already asserted due to the field not being a text field.
40 class KeyValue
: public FieldValue
43 /** Constructs a new KeyValue for to the specified field with the specified value. */
44 KeyValue(KeyImplPtr key
, value_type value
);
46 /** Destructor, a noop. */
50 /** Returns what field this key belongs to. */
51 KeyImplPtr
getKeyImpl() const;
54 /** Returns that this is a key. */
55 bool isKey() const { return true; }
57 /** Whether this is a primary key. */
58 bool isPrimaryKey() const;
61 /** Wether there are any unsaved changes to this key. */
64 /** Sets wether there are any unsaved changes to this key. */
65 void setDirty(bool dirty
);
68 KeyImplPtr m_key
; /**< The field this KeyValue belongs to. */
69 value_type m_value
; /**< The value of this key. */
70 bool m_dirty
; /**< Wether there are unsaved changes to this key. */