kwave  18.07.70
Kwave::Selection Class Reference

#include <Selection.h>

Inheritance diagram for Kwave::Selection:
Inheritance graph
Collaboration diagram for Kwave::Selection:
Collaboration graph

Signals

void changed (sample_index_t offset, sample_index_t length)
 

Public Member Functions

 Selection (sample_index_t offset, sample_index_t length)
 
 Selection (const Selection &other)
 
virtual ~Selection ()
 
void select (sample_index_t offset, sample_index_t length)
 
void clear ()
 
sample_index_t offset () const
 
sample_index_t length () const
 
sample_index_t first () const
 
sample_index_t last () const
 
bool operator== (const Selection &other) const
 
Selectionoperator= (const Selection &source)
 

Private Attributes

sample_index_t m_offset
 
sample_index_t m_length
 

Detailed Description

Definition at line 31 of file Selection.h.

Constructor & Destructor Documentation

◆ Selection() [1/2]

Kwave::Selection::Selection ( sample_index_t  offset,
sample_index_t  length 
)

constructor.

Parameters
offsetindex of the first item
lengthnumber of items

Definition at line 21 of file Selection.cpp.

22  :QObject(), m_offset(offset), m_length(length)
23 {
24 }
sample_index_t m_offset
Definition: Selection.h:104
sample_index_t length() const
Definition: Selection.h:66
sample_index_t m_length
Definition: Selection.h:107
sample_index_t offset() const
Definition: Selection.h:61

◆ Selection() [2/2]

Kwave::Selection::Selection ( const Selection other)

copy constructor

Definition at line 27 of file Selection.cpp.

28  :QObject(), m_offset(other.offset()), m_length(other.length())
29 {
30 }
sample_index_t m_offset
Definition: Selection.h:104
sample_index_t m_length
Definition: Selection.h:107

◆ ~Selection()

Kwave::Selection::~Selection ( )
virtual

Destructor

Definition at line 33 of file Selection.cpp.

34 {
35 }

Member Function Documentation

◆ changed

void Kwave::Selection::changed ( sample_index_t  offset,
sample_index_t  length 
)
signal

Emits a change in the selected range.

Parameters
offsetindex of the first selected items
lengthnumber of selected items

Referenced by select().

Here is the caller graph for this function:

◆ clear()

void Kwave::Selection::clear ( )
inline

Clears the selection (0 samples at offset 0)

Definition at line 56 of file Selection.h.

Referenced by Kwave::SignalManager::close().

56  {
57  select(0, 0);
58  }
void select(sample_index_t offset, sample_index_t length)
Definition: Selection.cpp:38
Here is the caller graph for this function:

◆ first()

◆ last()

◆ length()

◆ offset()

sample_index_t Kwave::Selection::offset ( ) const
inline

Returns the index of the first selected item.

Definition at line 61 of file Selection.h.

Referenced by Kwave::SignalManager::executeCommand(), operator=(), operator==(), Kwave::SignalManager::save(), select(), Kwave::UndoSelection::store(), Kwave::UndoSelection::undo(), Kwave::SignalManager::undo(), and Kwave::MainWidget::zoomSelection().

61  {
62  return m_offset;
63  }
sample_index_t m_offset
Definition: Selection.h:104
Here is the caller graph for this function:

◆ operator=()

Selection& Kwave::Selection::operator= ( const Selection source)
inline

Assignment operator

Definition at line 87 of file Selection.h.

References length(), and offset().

87  {
88  m_offset = source.offset();
89  m_length = source.length();
90  return *this;
91  }
sample_index_t m_offset
Definition: Selection.h:104
sample_index_t m_length
Definition: Selection.h:107
Here is the call graph for this function:

◆ operator==()

bool Kwave::Selection::operator== ( const Selection other) const
inline

compare operator

Definition at line 81 of file Selection.h.

References length(), and offset().

81  {
82  return ((m_offset == other.offset()) &&
83  (m_length == other.length()));
84  }
sample_index_t m_offset
Definition: Selection.h:104
sample_index_t m_length
Definition: Selection.h:107
Here is the call graph for this function:

◆ select()

void Kwave::Selection::select ( sample_index_t  offset,
sample_index_t  length 
)

Sets a new offset and length.

Parameters
offsetindex of the first item
lengthnumber of items

Definition at line 38 of file Selection.cpp.

References changed(), length(), m_length, m_offset, and offset().

Referenced by Kwave::SignalManager::selectRange().

39 {
40  m_offset = offset;
41  m_length = length;
42  emit changed(m_offset, m_length);
43 }
sample_index_t m_offset
Definition: Selection.h:104
void changed(sample_index_t offset, sample_index_t length)
sample_index_t length() const
Definition: Selection.h:66
sample_index_t m_length
Definition: Selection.h:107
sample_index_t offset() const
Definition: Selection.h:61
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_length

sample_index_t Kwave::Selection::m_length
private

number of items

Definition at line 107 of file Selection.h.

Referenced by select().

◆ m_offset

sample_index_t Kwave::Selection::m_offset
private

index of the first selected item

Definition at line 104 of file Selection.h.

Referenced by select().


The documentation for this class was generated from the following files: