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 TableImpl class.
32 * This class represents a generated (concrete version of a) TableDef.
34 * This class should not be instantiated manually.
35 * Instead, the generated ones from TableImpls should be used.
44 /** Constructs a new TableImpl based on this specific table. */
45 TableImpl(cstring name
);
47 /** Destructor, a noop. */
48 virtual ~TableImpl() { }
51 /** Returns the name of this table. */
52 cstring
getName() const;
56 * Returns a list of all rows in this table after applying mask.
58 * @param mask The mask to apply, an 'empty' (not NULL!) mask is allowed.
59 * @return The first entry is a header, the ones after that are the rows.
61 Strings
tableList(SelectionMaskPtr mask
);
64 /** Returns an iterator to the first element of the FieldImpl's of this table. */
65 FieldImplVector::const_iterator
begin() const { return m_fields
.begin(); }
67 /** Return the 'end' iterator of the FieldImpl's of this table. */
68 FieldImplVector::const_iterator
end() const { return m_fields
.end(); }
70 /** Returns the size of the FieldImpl's of this table. */
71 size_t size() const { return m_fields
.size(); }
73 /** Retursn the amount of primary keys this table has. */
74 size_t primarykeysize() const { return m_primarykeysize
; }
76 /** Returns the first key of this table, keysize is asserted to be 1. */
77 KeyImplPtr
firstkey() const;
80 /** Initializes the table's fields. */
81 virtual void Initialize() { updateFieldCount(); }
84 /** Updates the fieldcount. */
85 void updateFieldCount();
87 std::string m_name
; /**< The name of this table. */
88 FieldImplVector m_fields
; /**< The fields generated for this table. */
89 size_t m_primarykeysize
; /**< The amount of primary keys for this table. */