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, size_t duration, QString label);
00031         Point(long frame, float value, size_t 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 
00038         bool haveValue() const;
00039         float getValue() const;
00040         
00041         bool haveDuration() const;
00042         size_t getDuration() const;
00043         
00044         bool haveLabel() const;
00045         QString getLabel() const;
00046 
00047         bool haveLevel() const;
00048         float getLevel() const;
00049 
00050         bool haveReferenceFrame() const;
00051         bool referenceFrameDiffers() const; // from point frame
00052 
00053         long getReferenceFrame() const;
00054         void setReferenceFrame(long);
00055 
00056     private:
00057         bool m_haveFrame;
00058         long m_frame;
00059         bool m_haveValue;
00060         float m_value;
00061         bool m_haveDuration;
00062         size_t m_duration;
00063         bool m_haveLabel;
00064         QString m_label;
00065         bool m_haveLevel;
00066         float m_level;
00067         bool m_haveReferenceFrame;
00068         long m_referenceFrame;
00069     };
00070 
00071     Clipboard();
00072     ~Clipboard();
00073 
00074     typedef std::vector<Point> PointList;
00075 
00076     void clear();
00077     bool empty() const;
00078     const PointList &getPoints() const;
00079     void setPoints(const PointList &points);
00080     void addPoint(const Point &point);
00081 
00082     bool haveReferenceFrames() const;
00083     bool referenceFramesDiffer() const;
00084 
00085 protected:
00086     PointList m_points;
00087 };
00088 
00089 #endif

Generated on Wed Feb 20 15:45:25 2008 for SonicVisualiser by  doxygen 1.5.1