kwave  18.07.70
Kwave::Label Class Reference

#include <Label.h>

Inheritance diagram for Kwave::Label:
Inheritance graph
Collaboration diagram for Kwave::Label:
Collaboration graph

Public Member Functions

 Label ()
 
 Label (const Kwave::MetaData &meta_data)
 
 Label (sample_index_t position, const QString &name)
 
virtual ~Label ()
 
virtual void moveTo (sample_index_t position)
 
virtual sample_index_t pos () const
 
virtual void rename (const QString &name)
 
virtual QString name () const
 
bool operator< (const Kwave::Label &other) const
 
bool operator== (const Kwave::Label &other) const
 

Static Public Member Functions

static QString metaDataType ()
 

Additional Inherited Members

Detailed Description

Definition at line 34 of file Label.h.

Constructor & Destructor Documentation

◆ Label() [1/3]

Kwave::Label::Label ( )

Default constructor, creates an empty label

Definition at line 22 of file Label.cpp.

23  :Kwave::MetaData() // must be empty, isNull() should return true
24 {
25 }

◆ Label() [2/3]

Kwave::Label::Label ( const Kwave::MetaData meta_data)
explicit

Constructor, takes over the identity of a MetaData object

Parameters
meta_datareference to a meta data object

Definition at line 28 of file Label.cpp.

29  :Kwave::MetaData(meta_data)
30 {
31 }

◆ Label() [3/3]

Kwave::Label::Label ( sample_index_t  position,
const QString &  name 
)

Constructor

Parameters
positionthe label position [samples]
namethe name of the label, user defined

Definition at line 34 of file Label.cpp.

References metaDataType(), Kwave::MetaData::setProperty(), Kwave::MetaData::STDPROP_DESCRIPTION, Kwave::MetaData::STDPROP_POS, and Kwave::MetaData::STDPROP_TYPE.

36 {
39  if (name.length())
41 }
static const QString STDPROP_POS
Definition: MetaData.h:53
static QString metaDataType()
Definition: Label.h:59
static const QString STDPROP_TYPE
Definition: MetaData.h:41
virtual QString name() const
Definition: Label.cpp:74
void setProperty(const QString &p, const QVariant &value)
Definition: MetaData.cpp:93
static const QString STDPROP_DESCRIPTION
Definition: MetaData.h:56
Here is the call graph for this function:

◆ ~Label()

Kwave::Label::~Label ( )
virtual

destructor

Definition at line 44 of file Label.cpp.

45 {
46 }

Member Function Documentation

◆ metaDataType()

static QString Kwave::Label::metaDataType ( )
inlinestatic

returns the identifier of the "type" of this meta data object

Definition at line 59 of file Label.h.

References _, and name.

Referenced by Label(), Kwave::LabelList::LabelList(), moveTo(), and rename().

59 { return _("Label"); }
#define _(m)
Definition: memcpy.c:66
Here is the caller graph for this function:

◆ moveTo()

void Kwave::Label::moveTo ( sample_index_t  position)
virtual

Set a new position of the label

Parameters
positionthe new position [samples]

Definition at line 49 of file Label.cpp.

References Kwave::MetaData::isNull(), metaDataType(), Kwave::MetaData::setProperty(), Kwave::MetaData::STDPROP_POS, and Kwave::MetaData::STDPROP_TYPE.

Referenced by Kwave::MainWidget::labelProperties(), and Kwave::SignalManager::modifyLabel().

50 {
53 }
static const QString STDPROP_POS
Definition: MetaData.h:53
static QString metaDataType()
Definition: Label.h:59
static const QString STDPROP_TYPE
Definition: MetaData.h:41
virtual bool isNull() const
Definition: MetaData.cpp:69
void setProperty(const QString &p, const QVariant &value)
Definition: MetaData.cpp:93
Here is the call graph for this function:
Here is the caller graph for this function:

◆ name()

QString Kwave::Label::name ( ) const
virtual

returns the name of the string

Definition at line 74 of file Label.cpp.

References Kwave::MetaData::property(), and Kwave::MetaData::STDPROP_DESCRIPTION.

Referenced by Kwave::AsciiEncoder::encode(), Kwave::MainWidget::labelProperties(), operator==(), Kwave::MainWidget::saveLabels(), Kwave::SaveBlocksPlugin::scanBlocksToSave(), Kwave::K3BExportPlugin::scanBlocksToSave(), Kwave::TopWidget::updateMenu(), and Kwave::WavEncoder::writeLabels().

75 {
77 }
QVariant property(const QString &p) const
Definition: MetaData.cpp:110
static const QString STDPROP_DESCRIPTION
Definition: MetaData.h:56
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator<()

bool Kwave::Label::operator< ( const Kwave::Label other) const
inline

less-than operator, needed for sorting the list

Definition at line 80 of file Label.h.

References pos().

80  {
81  return (pos() < other.pos());
82  }
virtual sample_index_t pos() const
Definition: Label.cpp:56
Here is the call graph for this function:

◆ operator==()

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

equal operator

Definition at line 85 of file Label.h.

References name(), name, and pos().

85  {
86  return ((pos() == other.pos()) && (name() == other.name()));
87  }
virtual sample_index_t pos() const
Definition: Label.cpp:56
virtual QString name() const
Definition: Label.cpp:74
Here is the call graph for this function:

◆ pos()

◆ rename()

void Kwave::Label::rename ( const QString &  name)
virtual

change the name of the label

Parameters
namethe new name, user defined

Definition at line 64 of file Label.cpp.

References Kwave::MetaData::isNull(), metaDataType(), Kwave::MetaData::setProperty(), Kwave::MetaData::STDPROP_DESCRIPTION, and Kwave::MetaData::STDPROP_TYPE.

Referenced by Kwave::MainWidget::labelProperties(), and Kwave::SignalManager::modifyLabel().

65 {
67  if (name.length())
69  else
71 }
static QString metaDataType()
Definition: Label.h:59
static const QString STDPROP_TYPE
Definition: MetaData.h:41
virtual bool isNull() const
Definition: MetaData.cpp:69
virtual QString name() const
Definition: Label.cpp:74
void setProperty(const QString &p, const QVariant &value)
Definition: MetaData.cpp:93
static const QString STDPROP_DESCRIPTION
Definition: MetaData.h:56
Here is the call graph for this function:
Here is the caller graph for this function:

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