kwave
18.07.70
|
#include <MetaData.h>
Classes | |
class | MetaDataPriv |
Public Types | |
enum | Scope { None = 0, Signal = (1 << 0), Track = (1 << 1), Range = (1 << 2), Position = (1 << 3), All = ~0 } |
typedef QMap< QString, QVariant > | PropertyList |
Public Member Functions | |
MetaData () | |
MetaData (const MetaData &other) | |
MetaData (Scope scope) | |
virtual | ~MetaData () |
virtual void | clear () |
virtual bool | isNull () const |
QString | id () const |
Scope | scope () const |
void | setScope (Scope scope) |
void | setProperty (const QString &p, const QVariant &value) |
bool | hasProperty (const QString &p) const |
QVariant | property (const QString &p) const |
QVariant | operator[] (const QString p) const |
QVariant & | property (const QString &p) |
QVariant & | operator[] (const QString p) |
bool | operator== (const MetaData &other) const |
bool | operator!= (const MetaData &other) const |
QStringList | keys () const |
sample_index_t | firstSample () const |
sample_index_t | lastSample () const |
QList< unsigned int > | boundTracks () const |
virtual void | dump () const |
Static Public Member Functions | |
static QStringList | positionBoundPropertyNames () |
Static Public Attributes | |
static const QString | STDPROP_TYPE |
static const QString | STDPROP_TRACKS |
static const QString | STDPROP_START |
static const QString | STDPROP_END |
static const QString | STDPROP_POS |
static const QString | STDPROP_DESCRIPTION |
Private Attributes | |
QSharedDataPointer< MetaDataPriv > | m_data |
Definition at line 37 of file MetaData.h.
typedef QMap<QString, QVariant> Kwave::MetaData::PropertyList |
List of metadata properties
Definition at line 91 of file MetaData.h.
Definition at line 58 of file MetaData.h.
Kwave::MetaData::MetaData | ( | ) |
default constructor, generates a metadata object with a new ID
Definition at line 38 of file MetaData.cpp.
Kwave::MetaData::MetaData | ( | const MetaData & | other | ) |
copy constructor
other | the other meta data object to copy from |
Definition at line 44 of file MetaData.cpp.
|
explicit |
constructor
Definition at line 50 of file MetaData.cpp.
References setScope().
|
virtual |
QList< unsigned int > Kwave::MetaData::boundTracks | ( | ) | const |
Returns a list of tracks a meta data item is bound to
Definition at line 225 of file MetaData.cpp.
References hasProperty(), property(), and STDPROP_TRACKS.
Referenced by Kwave::MetaDataList::deleteRange(), Kwave::MetaDataList::merge(), Kwave::MetaDataList::scalePositions(), Kwave::MetaDataList::shiftLeft(), Kwave::MetaDataList::shiftRight(), and Kwave::MetaDataList::split().
|
virtual |
removes all properties
Definition at line 63 of file MetaData.cpp.
References m_data.
Referenced by Kwave::MetaDataList::cropByTracks().
|
virtual |
dump all properties to stdout, for debugging
Reimplemented in Kwave::FileInfo.
Definition at line 241 of file MetaData.cpp.
References _, All, DBG, keys(), Kwave::MetaData::MetaDataPriv::m_id_counter, Kwave::MetaData::MetaDataPriv::m_id_lock, Position, property(), Range, and scope().
Referenced by Kwave::MetaDataList::dump().
sample_index_t Kwave::MetaData::firstSample | ( | ) | const |
Returns the index of the first sample covered by a given meta data item
Definition at line 165 of file MetaData.cpp.
References hasProperty(), Position, property(), Range, scope(), STDPROP_POS, and STDPROP_START.
Referenced by Kwave::MetaDataList::deleteRange(), isLessThan(), Kwave::MetaDataList::merge(), Kwave::MetaDataList::scalePositions(), Kwave::MetaDataList::shiftLeft(), Kwave::MetaDataList::shiftRight(), and Kwave::MetaDataList::split().
bool Kwave::MetaData::hasProperty | ( | const QString & | p | ) | const |
Checks whether this metadata object contains a given property.
p | name of the property |
Definition at line 104 of file MetaData.cpp.
References m_data.
Referenced by boundTracks(), Kwave::FileInfo::contains(), Kwave::MetaDataList::cropByTracks(), Kwave::MetaDataList::deleteRange(), Kwave::MetaDataList::deleteTrack(), Kwave::UndoDeleteMetaDataAction::description(), Kwave::UndoModifyMetaDataAction::description(), Kwave::FileInfo::FileInfo(), firstSample(), Kwave::FileInfo::get(), Kwave::MetaDataList::insertTrack(), lastSample(), Kwave::MetaDataList::merge(), Kwave::SampleRatePlugin::run(), Kwave::MetaDataList::scalePositions(), Kwave::MetaDataList::selectByPosition(), Kwave::MetaDataList::selectByProperty(), Kwave::MetaDataList::selectByRange(), Kwave::MetaDataList::selectByTracks(), Kwave::MetaDataList::selectByValue(), Kwave::MetaDataList::shiftLeft(), Kwave::MetaDataList::shiftRight(), Kwave::MetaDataList::split(), and Kwave::UndoAddMetaDataAction::UndoAddMetaDataAction().
QString Kwave::MetaData::id | ( | ) | const |
returns the ID of the meta data
Definition at line 75 of file MetaData.cpp.
References m_data.
Referenced by Kwave::MetaDataList::add(), Kwave::MetaDataList::contains(), Kwave::UndoDeleteMetaDataAction::dump(), Kwave::UndoModifyMetaDataAction::dump(), Kwave::MetaDataList::remove(), Kwave::MetaDataList::selectByTracks(), and Kwave::UndoModifyMetaDataAction::undo().
|
virtual |
returns true if this is an empty record
Definition at line 69 of file MetaData.cpp.
References m_data.
Referenced by Kwave::MetaDataList::add(), Kwave::MainWidget::addLabel(), Kwave::SignalManager::executeCommand(), Kwave::TrackView::findItem(), Kwave::MainWidget::labelProperties(), Kwave::SignalManager::modifyLabel(), Kwave::Label::moveTo(), Kwave::LabelItem::moveTo(), Kwave::Label::rename(), Kwave::SaveBlocksPlugin::scanBlocksToSave(), Kwave::K3BExportPlugin::scanBlocksToSave(), Kwave::SaveBlocksPlugin::start(), and Kwave::WavEncoder::writeLabels().
QStringList Kwave::MetaData::keys | ( | ) | const |
returns a list with all property names
Definition at line 149 of file MetaData.cpp.
References m_data.
Referenced by Kwave::UndoDeleteMetaDataAction::dump(), Kwave::UndoModifyMetaDataAction::dump(), dump(), and Kwave::MetaDataList::merge().
sample_index_t Kwave::MetaData::lastSample | ( | ) | const |
Returns the index of the last sample covered by a given meta data item
Definition at line 190 of file MetaData.cpp.
References hasProperty(), Position, property(), Range, SAMPLE_INDEX_MAX, scope(), STDPROP_END, STDPROP_POS, and STDPROP_START.
Referenced by Kwave::MetaDataList::deleteRange(), Kwave::MetaDataList::merge(), Kwave::MetaDataList::scalePositions(), Kwave::MetaDataList::shiftLeft(), Kwave::MetaDataList::shiftRight(), and Kwave::MetaDataList::split().
|
inline |
bool Kwave::MetaData::operator== | ( | const MetaData & | other | ) | const |
equal operator, compares by data (not by ID)
Definition at line 131 of file MetaData.cpp.
References m_data.
|
inline |
|
inline |
|
static |
returns a list of position bount property names
Definition at line 155 of file MetaData.cpp.
References STDPROP_END, STDPROP_POS, and STDPROP_START.
Referenced by Kwave::MetaDataList::merge(), Kwave::SampleRatePlugin::run(), and Kwave::UndoAddMetaDataAction::UndoAddMetaDataAction().
QVariant Kwave::MetaData::property | ( | const QString & | p | ) | const |
Returns a QVariant with the copy of the value of a property or an empty QVariant if the property does not exist.
p | name of the property |
Definition at line 110 of file MetaData.cpp.
References m_data.
Referenced by boundTracks(), dump(), firstSample(), Kwave::FileInfo::get(), lastSample(), Kwave::Label::name(), and Kwave::Label::pos().
QVariant & Kwave::MetaData::property | ( | const QString & | p | ) |
Returns a mutable reference to an existing property (or the reference to an empty dummy if it did not exist).
p | name of the property |
Definition at line 119 of file MetaData.cpp.
References m_data.
Kwave::MetaData::Scope Kwave::MetaData::scope | ( | ) | const |
returns the scope of the meta data
Definition at line 81 of file MetaData.cpp.
Referenced by Kwave::MetaDataList::cropByRange(), Kwave::MetaDataList::cropByTracks(), Kwave::MetaDataList::deleteRange(), dump(), firstSample(), lastSample(), Kwave::MetaDataList::merge(), Kwave::MetaDataList::selectByPosition(), Kwave::MetaDataList::selectByRange(), Kwave::MetaDataList::selectByScope(), and setScope().
void Kwave::MetaData::setProperty | ( | const QString & | p, |
const QVariant & | value | ||
) |
Sets a property to a new value. If the property already exists it will be created and if it did not exist, a new one will be created. If the value is not valid (null), the property will be deleted.
p | name of the property |
value | a QVariant with the property's data |
Definition at line 93 of file MetaData.cpp.
References m_data.
Referenced by Kwave::MetaDataList::deleteRange(), Kwave::FileInfo::FileInfo(), Kwave::Label::Label(), Kwave::MetaDataList::merge(), Kwave::Label::moveTo(), Kwave::Label::rename(), Kwave::MetaDataList::scalePositions(), Kwave::FileInfo::set(), Kwave::MetaDataList::shiftLeft(), Kwave::MetaDataList::shiftRight(), and Kwave::MetaDataList::split().
void Kwave::MetaData::setScope | ( | Scope | scope | ) |
Sets the scope of the meta data
scope | the new scope |
Definition at line 87 of file MetaData.cpp.
References m_data, and scope().
Referenced by MetaData().
|
private |
pointer to the shared meta data
Definition at line 250 of file MetaData.h.
Referenced by clear(), hasProperty(), id(), isNull(), keys(), operator==(), property(), scope(), setProperty(), setScope(), and ~MetaData().
|
static |
standard property: description (string)
Definition at line 56 of file MetaData.h.
Referenced by Kwave::Label::Label(), Kwave::Label::name(), and Kwave::Label::rename().
|
static |
standard property: end sample index (inclusive)
Definition at line 50 of file MetaData.h.
Referenced by Kwave::MetaDataList::cropByRange(), Kwave::MetaDataList::deleteRange(), lastSample(), Kwave::MetaDataList::merge(), positionBoundPropertyNames(), Kwave::MetaDataList::scalePositions(), Kwave::MetaDataList::selectByRange(), Kwave::MetaDataList::shiftLeft(), Kwave::MetaDataList::shiftRight(), and Kwave::MetaDataList::split().
|
static |
standard property: position [zero based sample index]
Definition at line 53 of file MetaData.h.
Referenced by Kwave::MetaDataList::cropByRange(), Kwave::MetaDataList::deleteRange(), firstSample(), Kwave::Label::Label(), lastSample(), Kwave::Label::moveTo(), Kwave::Label::pos(), positionBoundPropertyNames(), Kwave::MetaDataList::scalePositions(), Kwave::MetaDataList::selectByPosition(), Kwave::MetaDataList::selectByRange(), Kwave::MetaDataList::shiftLeft(), and Kwave::MetaDataList::shiftRight().
|
static |
standard property: start sample index (inclusive)
Definition at line 47 of file MetaData.h.
Referenced by Kwave::MetaDataList::cropByRange(), Kwave::MetaDataList::deleteRange(), firstSample(), lastSample(), Kwave::MetaDataList::merge(), positionBoundPropertyNames(), Kwave::MetaDataList::scalePositions(), Kwave::MetaDataList::selectByRange(), Kwave::MetaDataList::shiftLeft(), Kwave::MetaDataList::shiftRight(), and Kwave::MetaDataList::split().
|
static |
standard property: list of zero based track indices
Definition at line 44 of file MetaData.h.
Referenced by boundTracks(), Kwave::MetaDataList::cropByTracks(), Kwave::MetaDataList::deleteRange(), Kwave::MetaDataList::deleteTrack(), Kwave::MetaDataList::insertTrack(), Kwave::MetaDataList::merge(), Kwave::MetaDataList::scalePositions(), Kwave::MetaDataList::selectByTracks(), Kwave::MetaDataList::shiftLeft(), Kwave::MetaDataList::shiftRight(), Kwave::MetaDataList::split(), and Kwave::UndoAddMetaDataAction::UndoAddMetaDataAction().
|
static |
standard property: type of the meta data object
Definition at line 41 of file MetaData.h.
Referenced by Kwave::UndoDeleteMetaDataAction::description(), Kwave::UndoModifyMetaDataAction::description(), Kwave::FileInfo::FileInfo(), Kwave::Label::Label(), Kwave::MetaDataList::merge(), Kwave::Label::moveTo(), Kwave::Label::rename(), Kwave::MetaDataList::replace(), Kwave::MetaDataList::selectByType(), and Kwave::UndoAddMetaDataAction::UndoAddMetaDataAction().