comparison base/Selection.h @ 1038:cc27f35aa75c cxx11

Introducing the signed 64-bit frame index type, and fixing build failures from inclusion of -Wconversion with -Werror. Not finished yet.
author Chris Cannam
date Tue, 03 Mar 2015 15:18:24 +0000
parents d03b3d956358
children 6e9615bde1f9
comparison
equal deleted inserted replaced
1037:bf0e5944289b 1038:cc27f35aa75c
18 18
19 #include <cstddef> 19 #include <cstddef>
20 #include <set> 20 #include <set>
21 21
22 #include "XmlExportable.h" 22 #include "XmlExportable.h"
23 #include "BaseTypes.h"
23 24
24 /** 25 /**
25 * A selection object simply represents a range in time, via start and 26 * A selection object simply represents a range in time, via start and
26 * end frame. 27 * end frame.
27 * 28 *
38 */ 39 */
39 class Selection 40 class Selection
40 { 41 {
41 public: 42 public:
42 Selection(); 43 Selection();
43 Selection(int startFrame, int endFrame); 44 Selection(sv_frame_t startFrame, sv_frame_t endFrame);
44 Selection(const Selection &); 45 Selection(const Selection &);
45 Selection &operator=(const Selection &); 46 Selection &operator=(const Selection &);
46 virtual ~Selection(); 47 virtual ~Selection();
47 48
48 bool isEmpty() const; 49 bool isEmpty() const;
49 int getStartFrame() const; 50 sv_frame_t getStartFrame() const;
50 int getEndFrame() const; 51 sv_frame_t getEndFrame() const;
51 bool contains(int frame) const; 52 bool contains(sv_frame_t frame) const;
52 53
53 bool operator<(const Selection &) const; 54 bool operator<(const Selection &) const;
54 bool operator==(const Selection &) const; 55 bool operator==(const Selection &) const;
55 56
56 protected: 57 protected:
57 int m_startFrame; 58 sv_frame_t m_startFrame;
58 int m_endFrame; 59 sv_frame_t m_endFrame;
59 }; 60 };
60 61
61 class MultiSelection : public XmlExportable 62 class MultiSelection : public XmlExportable
62 { 63 {
63 public: 64 public:
70 void setSelection(const Selection &selection); 71 void setSelection(const Selection &selection);
71 void addSelection(const Selection &selection); 72 void addSelection(const Selection &selection);
72 void removeSelection(const Selection &selection); 73 void removeSelection(const Selection &selection);
73 void clearSelections(); 74 void clearSelections();
74 75
75 void getExtents(int &startFrame, int &endFrame) const; 76 void getExtents(sv_frame_t &startFrame, sv_frame_t &endFrame) const;
76 77
77 /** 78 /**
78 * Return the selection that contains a given frame. 79 * Return the selection that contains a given frame.
79 * If defaultToFollowing is true, and if the frame is not in a 80 * If defaultToFollowing is true, and if the frame is not in a
80 * selected area, return the next selection after the given frame. 81 * selected area, return the next selection after the given frame.
81 * Return the empty selection if no appropriate selection is found. 82 * Return the empty selection if no appropriate selection is found.
82 */ 83 */
83 Selection getContainingSelection(int frame, bool defaultToFollowing) const; 84 Selection getContainingSelection(sv_frame_t frame, bool defaultToFollowing) const;
84 85
85 virtual void toXml(QTextStream &stream, QString indent = "", 86 virtual void toXml(QTextStream &stream, QString indent = "",
86 QString extraAttributes = "") const; 87 QString extraAttributes = "") const;
87 88
88 protected: 89 protected: