1 #ifndef CSM_WOLRD_NESTEDIDCOLLECTION_H
2 #define CSM_WOLRD_NESTEDIDCOLLECTION_H
17 struct NestedTableWrapperBase;
20 template<
typename T,
typename AT>
23 template<
typename ESXRecordT,
typename IdAccessorT = IdAccessor<ESXRecordT> >
26 std::map<const ColumnBase*, NestedColumnAdapter<ESXRecordT>* >
mAdapters;
35 virtual void addNestedRow(
int row,
int column,
int position);
39 virtual QVariant
getNestedData(
int row,
int column,
int subRow,
int subColumn)
const;
41 virtual void setNestedData(
int row,
int column,
const QVariant& data,
int subRow,
int subColumn);
57 template<
typename ESXRecordT,
typename IdAccessorT>
61 template<
typename ESXRecordT,
typename IdAccessorT>
65 iter (mAdapters.begin()); iter!=mAdapters.end(); ++iter)
67 delete (*iter).second;
71 template<
typename ESXRecordT,
typename IdAccessorT>
75 mAdapters.insert(adapter);
78 template<
typename ESXRecordT,
typename IdAccessorT>
81 typename std::map<const ColumnBase *, NestedColumnAdapter<ESXRecordT>* >::const_iterator iter =
82 mAdapters.find (&column);
84 if (iter==mAdapters.end())
85 throw std::logic_error(
"No such column in the nestedidadapter");
90 template<
typename ESXRecordT,
typename IdAccessorT>
101 template<
typename ESXRecordT,
typename IdAccessorT>
112 template<
typename ESXRecordT,
typename IdAccessorT>
114 int column,
int subRow,
int subColumn)
const
120 template<
typename ESXRecordT,
typename IdAccessorT>
122 int column,
const QVariant& data,
int subRow,
int subColumn)
128 record, data, subRow, subColumn);
133 template<
typename ESXRecordT,
typename IdAccessorT>
141 template<
typename ESXRecordT,
typename IdAccessorT>
149 record, nestedTable);
154 template<
typename ESXRecordT,
typename IdAccessorT>
161 template<
typename ESXRecordT,
typename IdAccessorT>
166 if (row >= 0 && row < numRecords)
169 return getAdapter(nestedColumn).getColumnsCount(record);
175 return getAdapter(nestedColumn).getColumnsCount(record);
179 template<
typename ESXRecordT,
typename IdAccessorT>
186 #endif // CSM_WOLRD_NESTEDIDCOLLECTION_H
Single type collection of top level records.
Definition: idcollection.hpp:12
Definition: nestedtablewrapper.hpp:6
virtual int getNestedColumnsCount(int row, int column) const
Definition: nestedidcollection.hpp:162
virtual void removeNestedRows(int row, int column, int subRow)
Definition: nestedidcollection.hpp:102
virtual NestedTableWrapperBase * nestedTable(int row, int column) const
Definition: nestedidcollection.hpp:134
Definition: columnbase.hpp:167
virtual void setNestedTable(int row, int column, const NestedTableWrapperBase &nestedTable)
Definition: nestedidcollection.hpp:142
Single-type record collection.
Definition: collection.hpp:44
virtual const Record< ESXRecordT > & getRecord(const std::string &id) const
Definition: collection.hpp:430
std::map< const ColumnBase *, NestedColumnAdapter< ESXRecordT > * > mAdapters
Definition: nestedidcollection.hpp:26
virtual NestableColumn * getNestableColumn(int column)
Definition: nestedidcollection.hpp:180
virtual void setNestedData(int row, int column, const QVariant &data, int subRow, int subColumn)
Definition: nestedidcollection.hpp:121
Definition: nestedcolumnadapter.hpp:11
void setRecord(int index, const Record< ESXRecordT > &record)
Definition: collection.hpp:466
virtual void assign(const RecordBase &record)
Will throw an exception if the types don't match.
Definition: record.hpp:100
virtual const ColumnBase & getColumn(int column) const
Definition: collection.hpp:295
virtual int getNestedRowsCount(int row, int column) const
Definition: nestedidcollection.hpp:155
virtual QVariant getNestedData(int row, int column, int subRow, int subColumn) const
Definition: nestedidcollection.hpp:113
void addAdapter(std::pair< const ColumnBase *, NestedColumnAdapter< ESXRecordT > * > adapter)
Definition: nestedidcollection.hpp:72
Definition: columnbase.hpp:15
virtual int getSize() const
Definition: collection.hpp:254
Definition: nestedcolumnadapter.hpp:14
NestedIdCollection()
Definition: nestedidcollection.hpp:58
NestableColumn * getNestableColumn(int column) const
Definition: collection.hpp:301
~NestedIdCollection()
Definition: nestedidcollection.hpp:62
Definition: nestedidcollection.hpp:24
Definition: nestedcollection.hpp:13
virtual void addNestedRow(int row, int column, int position)
Definition: nestedidcollection.hpp:91
const NestedColumnAdapter< ESXRecordT > & getAdapter(const ColumnBase &column) const
Definition: nestedidcollection.hpp:79