76b933351e889b931da8e834133863e7a1104c48
[mussa.git] / qui / SequenceLocationModel.hpp
1 #ifndef _SEQUENCE_LOCATION_MODEL_HPP_
2 #define _SEQUENCE_LOCATION_MODEL_HPP_
3
4 #include <QAbstractTableModel>
5 #include "alg/sequence_location.hpp"
6 #include <vector>
7
8 class SequenceLocationModel : public QAbstractTableModel
9 {
10   Q_OBJECT
11
12   public:
13     SequenceLocationModel(QObject *parent = 0);
14
15     typedef std::vector<SequenceLocation> model_type;
16     typedef model_type::size_type size_type;
17     typedef model_type::iterator iterator; 
18     typedef model_type::const_iterator const_iterator; 
19     //! \defgroup VectorInterface
20     //! \addtogroup VectorInterface
21     //! \@{
22     //! assign num copies of val to our vector
23     void assign(size_type num, const SequenceLocation& val);
24     //! return a specific element
25     SequenceLocation& at(size_type index);
26     //! return the last element
27     SequenceLocation& back();
28     //! return an iterator to the beginning of the model
29     iterator begin();
30     //! return an iterator to the beginning of the model
31     const_iterator begin() const;
32     //! return an iterator to the end of the model
33     iterator end();
34     //! return an iterator to the end of the model
35     const_iterator end() const;
36     //! is the model empty?
37     bool empty() const;
38     //! return a specific element
39     SequenceLocation& operator[](size_type index);
40     //! remove the last element from our model
41     void pop_back();
42     //! add a sequence location to the end of our model
43     void push_back(SequenceLocation&);
44     //! how many elements are in our model.
45     size_type size() const;
46     //! \@}
47
48     //! \defgroup QtModelInterface
49     //! \addtogroup QtModel
50     //! \@{
51     int rowCount(const QModelIndex& parent=QModelIndex()) const;
52     int columnCount(const QModelIndex& parent=QModelIndex()) const;
53     QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const;
54
55     QVariant headerData(int section, Qt::Orientation orentation, int role=Qt::DisplayRole);
56
57     //bool setData(const QModelIndex& index, const QVariant &value, 
58     //             int role=Qt::EditRole);
59     //Qt::ItemFlags flags(const QModelIndex& index) const;
60
61     //bool insertRows(int row, int count, 
62     //                const QModelIndex& parent=QModelIndex());
63     //bool removeRows(int row, int count);
64     //                const QModelIndex& parent=QModelIndex());
65     //! \@}
66   private:
67     model_type sequence_locations;
68 };
69
70 #endif