226 void remove(std::size_t index); |
226 void remove(std::size_t index); |
227 int rowCount(const QModelIndex&) const override; |
227 int rowCount(const QModelIndex&) const override; |
228 QVariant data(const QModelIndex& index, int role) const override; |
228 QVariant data(const QModelIndex& index, int role) const override; |
229 const ModelElement& operator[](std::size_t index) const; |
229 const ModelElement& operator[](std::size_t index) const; |
230 std::size_t size() const; |
230 std::size_t size() const; |
|
231 void clear(); |
231 auto operator[](const std::size_t index) { |
232 auto operator[](const std::size_t index) { |
232 struct { |
233 struct { |
233 Model& model; |
234 Model& model; |
234 const std::size_t index; |
235 const std::size_t index; |
235 operator const ModelElement&() { |
236 operator const ModelElement&() { |
245 } result{*this, index}; |
246 } result{*this, index}; |
246 return result; |
247 return result; |
247 } |
248 } |
248 }; |
249 }; |
249 |
250 |
250 void save(const Model& model, QIODevice *device); |
251 void save(const Model& model, QTextStream* stream); |
251 void updateHeaderNameField(Model& model, const QString &name); |
252 void updateHeaderNameField(Model& model, const QString &name); |
252 |
253 |
253 template<typename T> |
254 template<typename T> |
254 void iterate(const Model& model, std::function<void(const T&)> fn) |
255 void iterate(const Model& model, std::function<void(const T&)> fn) |
255 { |
256 { |