Added count functionality in SavableManager.
[UnsignedByte.git] / src / DAL / KeyValue.h
blob4de32b3a81a46e0d5a0631b9606b8739e8431dc1
1 /***************************************************************************
2 * Copyright (C) 2008 by Sverre Rabbelier *
3 * sverre@rabbelier.nl *
4 * *
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. *
9 * *
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. *
14 * *
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 ***************************************************************************/
20 #pragma once
22 /**
23 * @file KeyValue.h
24 * @brief This file contains the KeyValue class.
26 * @see KeyValue
27 */
29 #include "Types.h"
30 #include "FieldValue.h"
32 /**
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.
38 * @see Value
39 */
40 class KeyValue : public FieldValue
42 public:
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. */
47 ~KeyValue();
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. */
62 bool isDirty() const;
64 /** Sets wether there are any unsaved changes to this key. */
65 void setDirty(bool dirty);
67 private:
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. */