annotate base/Clipboard.h @ 760:b6bb0ecb7958

Avoid crash on CoreAudio reader dtor after failing to open file (fixing #504)
author Chris Cannam
date Sat, 09 Mar 2013 11:45:15 +0000
parents e73a1a1e8f24
children afeb580b1b57
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@370 50 bool haveReferenceFrame() const;
Chris@370 51 bool referenceFrameDiffers() const; // from point frame
Chris@370 52
Chris@340 53 long getReferenceFrame() const;
Chris@340 54 void setReferenceFrame(long);
Chris@340 55
Chris@74 56 private:
Chris@74 57 bool m_haveFrame;
Chris@74 58 long m_frame;
Chris@74 59 bool m_haveValue;
Chris@74 60 float m_value;
Chris@74 61 bool m_haveDuration;
Chris@74 62 size_t m_duration;
Chris@74 63 bool m_haveLabel;
Chris@74 64 QString m_label;
Chris@340 65 bool m_haveLevel;
Chris@340 66 float m_level;
Chris@370 67 bool m_haveReferenceFrame;
Chris@340 68 long m_referenceFrame;
Chris@74 69 };
Chris@74 70
Chris@74 71 Clipboard();
Chris@74 72 ~Clipboard();
Chris@74 73
Chris@74 74 typedef std::vector<Point> PointList;
Chris@74 75
Chris@74 76 void clear();
Chris@74 77 bool empty() const;
Chris@74 78 const PointList &getPoints() const;
Chris@74 79 void setPoints(const PointList &points);
Chris@74 80 void addPoint(const Point &point);
Chris@74 81
Chris@370 82 bool haveReferenceFrames() const;
Chris@369 83 bool referenceFramesDiffer() const;
Chris@340 84
Chris@74 85 protected:
Chris@74 86 PointList m_points;
Chris@74 87 };
Chris@74 88
Chris@74 89 #endif