svcore  1.9
Clipboard.h
Go to the documentation of this file.
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
00002 
00003 /*
00004     Sonic Visualiser
00005     An audio file viewer and annotation editor.
00006     Centre for Digital Music, Queen Mary, University of London.
00007     This file copyright 2006 Chris Cannam.
00008     
00009     This program is free software; you can redistribute it and/or
00010     modify it under the terms of the GNU General Public License as
00011     published by the Free Software Foundation; either version 2 of the
00012     License, or (at your option) any later version.  See the file
00013     COPYING included with this distribution for more information.
00014 */
00015 
00016 #ifndef _CLIPBOARD_H_
00017 #define _CLIPBOARD_H_
00018 
00019 #include <QString>
00020 #include <vector>
00021 
00022 class Clipboard
00023 {
00024 public:
00025     class Point
00026     {
00027     public:
00028         Point(long frame, QString label);
00029         Point(long frame, float value, QString label);
00030         Point(long frame, float value, int duration, QString label);
00031         Point(long frame, float value, int duration, float level, QString label);
00032         Point(const Point &point);
00033         Point &operator=(const Point &point);
00034 
00035         bool haveFrame() const;
00036         long getFrame() const;
00037         Point withFrame(long frame) const;
00038 
00039         bool haveValue() const;
00040         float getValue() const;
00041         Point withValue(float value) const;
00042         
00043         bool haveDuration() const;
00044         int getDuration() const;
00045         Point withDuration(int duration) const;
00046         
00047         bool haveLabel() const;
00048         QString getLabel() const;
00049         Point withLabel(QString label) const;
00050 
00051         bool haveLevel() const;
00052         float getLevel() const;
00053         Point withLevel(float level) const;
00054 
00055         bool haveReferenceFrame() const;
00056         bool referenceFrameDiffers() const; // from point frame
00057 
00058         long getReferenceFrame() const;
00059         void setReferenceFrame(long);
00060 
00061     private:
00062         bool m_haveFrame;
00063         long m_frame;
00064         bool m_haveValue;
00065         float m_value;
00066         bool m_haveDuration;
00067         int m_duration;
00068         bool m_haveLabel;
00069         QString m_label;
00070         bool m_haveLevel;
00071         float m_level;
00072         bool m_haveReferenceFrame;
00073         long m_referenceFrame;
00074     };
00075 
00076     Clipboard();
00077     ~Clipboard();
00078 
00079     typedef std::vector<Point> PointList;
00080 
00081     void clear();
00082     bool empty() const;
00083     const PointList &getPoints() const;
00084     void setPoints(const PointList &points);
00085     void addPoint(const Point &point);
00086 
00087     bool haveReferenceFrames() const;
00088     bool referenceFramesDiffer() const;
00089 
00090 protected:
00091     PointList m_points;
00092 };
00093 
00094 #endif