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