annotate base/Clipboard.h @ 353:1c6816220185

* more handy functions
author Chris Cannam
date Mon, 10 Dec 2007 17:37:13 +0000
parents 516819f2b97b
children 007b01b971a6 94fc0591ea43
rev   line source
Chris@74 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@74 2
Chris@74 3 /*
Chris@74 4 Sonic Visualiser
Chris@74 5 An audio file viewer and annotation editor.
Chris@74 6 Centre for Digital Music, Queen Mary, University of London.
Chris@74 7 This file copyright 2006 Chris Cannam.
Chris@74 8
Chris@74 9 This program is free software; you can redistribute it and/or
Chris@74 10 modify it under the terms of the GNU General Public License as
Chris@74 11 published by the Free Software Foundation; either version 2 of the
Chris@74 12 License, or (at your option) any later version. See the file
Chris@74 13 COPYING included with this distribution for more information.
Chris@74 14 */
Chris@74 15
Chris@74 16 #ifndef _CLIPBOARD_H_
Chris@74 17 #define _CLIPBOARD_H_
Chris@74 18
Chris@74 19 #include <QString>
Chris@74 20 #include <vector>
Chris@74 21
Chris@74 22 class Clipboard
Chris@74 23 {
Chris@74 24 public:
Chris@74 25 class Point
Chris@74 26 {
Chris@74 27 public:
Chris@74 28 Point(long frame, QString label);
Chris@74 29 Point(long frame, float value, QString label);
Chris@74 30 Point(long frame, float value, size_t duration, QString label);
Chris@340 31 Point(long frame, float value, size_t duration, float level, QString label);
Chris@74 32 Point(const Point &point);
Chris@74 33 Point &operator=(const Point &point);
Chris@74 34
Chris@74 35 bool haveFrame() const;
Chris@74 36 long getFrame() const;
Chris@74 37
Chris@74 38 bool haveValue() const;
Chris@74 39 float getValue() const;
Chris@74 40
Chris@74 41 bool haveDuration() const;
Chris@74 42 size_t getDuration() const;
Chris@74 43
Chris@74 44 bool haveLabel() const;
Chris@74 45 QString getLabel() const;
Chris@74 46
Chris@340 47 bool haveLevel() const;
Chris@340 48 float getLevel() const;
Chris@340 49
Chris@340 50 bool haveReferenceFrame() const;
Chris@340 51 long getReferenceFrame() const;
Chris@340 52 void setReferenceFrame(long);
Chris@340 53
Chris@74 54 private:
Chris@74 55 bool m_haveFrame;
Chris@74 56 long m_frame;
Chris@74 57 bool m_haveValue;
Chris@74 58 float m_value;
Chris@74 59 bool m_haveDuration;
Chris@74 60 size_t m_duration;
Chris@74 61 bool m_haveLabel;
Chris@74 62 QString m_label;
Chris@340 63 bool m_haveLevel;
Chris@340 64 float m_level;
Chris@340 65 bool m_haveReferenceFrame;
Chris@340 66 long m_referenceFrame;
Chris@74 67 };
Chris@74 68
Chris@74 69 Clipboard();
Chris@74 70 ~Clipboard();
Chris@74 71
Chris@74 72 typedef std::vector<Point> PointList;
Chris@74 73
Chris@74 74 void clear();
Chris@74 75 bool empty() const;
Chris@74 76 const PointList &getPoints() const;
Chris@74 77 void setPoints(const PointList &points);
Chris@74 78 void addPoint(const Point &point);
Chris@74 79
Chris@340 80 bool haveReferenceFrames() const;
Chris@340 81
Chris@74 82 protected:
Chris@74 83 PointList m_points;
Chris@74 84 };
Chris@74 85
Chris@74 86 #endif