diff base/Selection.h @ 936:0c1d6de8f44b

Merge from branch warnfix_no_size_t
author Chris Cannam
date Wed, 18 Jun 2014 13:51:16 +0100
parents d03b3d956358
children cc27f35aa75c
line wrap: on
line diff
--- a/base/Selection.h	Tue Jun 03 11:05:49 2014 +0100
+++ b/base/Selection.h	Wed Jun 18 13:51:16 2014 +0100
@@ -21,26 +21,41 @@
 
 #include "XmlExportable.h"
 
+/**
+ * A selection object simply represents a range in time, via start and
+ * end frame.
+ *
+ * The end frame is the index of the frame just *after* the end of the
+ * selection. For example a selection of length 10 frames starting at
+ * time 0 will have start frame 0 and end frame 10. This will be
+ * contiguous with (rather than overlapping with) a selection that
+ * starts at frame 10.
+ *
+ * Any selection with equal start and end frames is empty,
+ * representing "no selection". All empty selections are equal under
+ * the comparison operators. The default constructor makes an empty
+ * selection with start and end frames equal to zero.
+ */
 class Selection
 {
 public:
     Selection();
-    Selection(size_t startFrame, size_t endFrame);
+    Selection(int startFrame, int endFrame);
     Selection(const Selection &);
     Selection &operator=(const Selection &);
     virtual ~Selection();
 
     bool isEmpty() const;
-    size_t getStartFrame() const;
-    size_t getEndFrame() const;
-    bool contains(size_t frame) const;
+    int getStartFrame() const;
+    int getEndFrame() const;
+    bool contains(int frame) const;
 
     bool operator<(const Selection &) const;
     bool operator==(const Selection &) const;
     
 protected:
-    size_t m_startFrame;
-    size_t m_endFrame;
+    int m_startFrame;
+    int m_endFrame;
 };
 
 class MultiSelection : public XmlExportable
@@ -57,7 +72,7 @@
     void removeSelection(const Selection &selection);
     void clearSelections();
 
-    void getExtents(size_t &startFrame, size_t &endFrame) const;
+    void getExtents(int &startFrame, int &endFrame) const;
 
     /**
      * Return the selection that contains a given frame.
@@ -65,7 +80,7 @@
      * selected area, return the next selection after the given frame.
      * Return the empty selection if no appropriate selection is found.
      */
-    Selection getContainingSelection(size_t frame, bool defaultToFollowing) const;
+    Selection getContainingSelection(int frame, bool defaultToFollowing) const;
 
     virtual void toXml(QTextStream &stream, QString indent = "",
                        QString extraAttributes = "") const;