kwave
18.07.70
|
#include <MetaDataList.h>
Public Types | |
typedef QMapIterator< QString, MetaData > | Iterator |
typedef QMutableMapIterator< QString, MetaData > | MutableIterator |
Public Member Functions | |
MetaDataList () | |
MetaDataList (const MetaData &meta) | |
virtual | ~MetaDataList () |
virtual QList< Kwave::MetaData > | toSortedList () const |
virtual MetaDataList | selectByType (const QString &type) const |
virtual MetaDataList | selectByScope (MetaData::Scope scope) const |
virtual MetaDataList | selectByTracks (const QList< unsigned int > &tracks) const |
virtual MetaDataList | selectByRange (sample_index_t first, sample_index_t last) const |
virtual MetaDataList | selectByPosition (sample_index_t pos) const |
virtual MetaDataList | selectByProperty (const QString &property) const |
virtual MetaDataList | selectByValue (const QString &property, QVariant value) const |
virtual bool | contains (const MetaData &metadata) const |
virtual void | replace (const MetaDataList &list) |
virtual void | add (const MetaData &metadata) |
virtual void | add (const MetaDataList &list) |
virtual void | remove (const MetaData &metadata) |
virtual void | remove (const MetaDataList &list) |
virtual void | cropByRange (sample_index_t first, sample_index_t last) |
virtual void | cropByTracks (const QList< unsigned int > &tracks) |
virtual MetaDataList | copy (sample_index_t offset, sample_index_t length, const QList< unsigned int > &tracks) const |
void | merge (const MetaDataList &meta_data) |
virtual void | deleteRange (sample_index_t offset, sample_index_t length, const QList< unsigned int > &tracks) |
virtual void | shiftLeft (sample_index_t offset, sample_index_t shift, const QList< unsigned int > &tracks) |
virtual void | shiftRight (sample_index_t offset, sample_index_t shift, const QList< unsigned int > &tracks) |
virtual void | scalePositions (double scale, const QList< unsigned int > &tracks) |
virtual void | insertTrack (unsigned int track) |
virtual void | deleteTrack (unsigned int track) |
virtual void | dump () const |
Protected Member Functions | |
void | split (sample_index_t offset, const QList< unsigned int > &tracks) |
Definition at line 36 of file MetaDataList.h.
typedef QMapIterator<QString, MetaData> Kwave::MetaDataList::Iterator |
const iterator for the meta data list
Definition at line 41 of file MetaDataList.h.
typedef QMutableMapIterator<QString, MetaData> Kwave::MetaDataList::MutableIterator |
mutable iterator for the meta data list
Definition at line 44 of file MetaDataList.h.
Kwave::MetaDataList::MetaDataList | ( | ) |
Default constructor
Definition at line 27 of file MetaDataList.cpp.
|
explicit |
Constructor, creates a meta data list with only one single meta data item. In some cases you need to pass a meta data list to a function but you have only a single meta data item, so this might be quite handy
meta | const reference to a single meta data item |
Definition at line 33 of file MetaDataList.cpp.
References add().
|
virtual |
|
virtual |
Adds a single meta data object to the list. If it is already present, the old version will be silently replaced. If the object is a null object and an object with the same ID exists in the list, this will work as remove().
metadata | the meta data object that should be added |
Definition at line 260 of file MetaDataList.cpp.
References Kwave::MetaData::id(), and Kwave::MetaData::isNull().
Referenced by add(), Kwave::SignalManager::addLabel(), Kwave::MimeData::decode(), deleteRange(), merge(), MetaDataList(), Kwave::SignalManager::modifyLabel(), Kwave::AsciiDecoder::open(), replace(), scalePositions(), selectByPosition(), selectByProperty(), selectByRange(), selectByScope(), selectByTracks(), selectByValue(), shiftLeft(), shiftRight(), split(), Kwave::LabelList::toMetaDataList(), and Kwave::UndoModifyMetaDataAction::undo().
|
virtual |
Adds a list of meta data objects to the list. Old versions of existing objects will be silently replaced.
list | list of meta data objects that should be added |
Definition at line 269 of file MetaDataList.cpp.
References add().
|
virtual |
Checks whether a meta data object is contained in this list, the check is based on the unique id of the meta data object.
metadata | the object to search |
Definition at line 214 of file MetaDataList.cpp.
References Kwave::MetaData::id().
Referenced by remove(), replace(), selectByTracks(), and Kwave::UndoModifyMetaDataAction::undo().
|
virtual |
copy elements from the meta data list that overlap a given range of samples (selects elements with scope "Range" as well as elements with scope "Position") and have a binding to a track.
offset | index of the first sample |
length | number of samples of the range |
tracks | list of track indices |
Definition at line 390 of file MetaDataList.cpp.
References cropByRange(), and cropByTracks().
Referenced by Kwave::SignalManager::deleteRange(), deleteRange(), merge(), Kwave::SampleRatePlugin::run(), scalePositions(), shiftLeft(), shiftRight(), split(), Kwave::UndoDeleteAction::store(), and Kwave::UndoAddMetaDataAction::undo().
|
virtual |
Crops this list to a given range of samples. All position aware elements that are not covered by the given range will be removed, all covered elements will be adjusted.
first | index of the first sample |
last | index of the last sample |
Definition at line 290 of file MetaDataList.cpp.
References Kwave::MetaData::Position, Kwave::MetaData::Range, Kwave::MetaData::scope(), Kwave::MetaData::STDPROP_END, Kwave::MetaData::STDPROP_POS, and Kwave::MetaData::STDPROP_START.
Referenced by copy(), and Kwave::SignalManager::save().
|
virtual |
Crops this list to a given set of tracks. All elements that are bound to a track or list of tracks which are not covered by the given selection will be removed. The tracks of the remaining elements will be re-numbered to start from zero and counted up without gaps.
tracks | list of track indices |
Definition at line 350 of file MetaDataList.cpp.
References Kwave::MetaData::clear(), Kwave::MetaData::hasProperty(), Kwave::MetaData::scope(), Kwave::MetaData::STDPROP_TRACKS, Kwave::toUint(), and Kwave::MetaData::Track.
Referenced by copy(), and Kwave::SignalManager::save().
|
virtual |
delete elements from the meta data list that overlap a given range of samples (selects elements with scope "Range" as well as elements with scope "Position") and have a binding to a track.
offset | index of the first sample |
length | number of samples to delete |
tracks | list of track indices, will be filled with copies of found meta data objects |
Definition at line 530 of file MetaDataList.cpp.
References add(), Kwave::MetaData::boundTracks(), copy(), Kwave::MetaData::firstSample(), Kwave::MetaData::hasProperty(), Kwave::MetaData::lastSample(), Kwave::MetaData::Range, Kwave::MetaData::scope(), Kwave::MetaData::setProperty(), Kwave::MetaData::STDPROP_END, Kwave::MetaData::STDPROP_POS, Kwave::MetaData::STDPROP_START, and Kwave::MetaData::STDPROP_TRACKS.
Referenced by Kwave::SignalManager::deleteRange(), Kwave::SampleRatePlugin::run(), and Kwave::UndoAddMetaDataAction::undo().
|
virtual |
delete all meta data that was bound to a specific track and adjust the track indices of all meta data items after that track by minus one
track | index of the track that is to be deleted |
Definition at line 959 of file MetaDataList.cpp.
References Kwave::MetaData::hasProperty(), and Kwave::MetaData::STDPROP_TRACKS.
Referenced by Kwave::SignalManager::deleteTrack().
|
virtual |
dump all meta data to stdout (for debugging)
Definition at line 1062 of file MetaDataList.cpp.
References DBG, and Kwave::MetaData::dump().
Referenced by Kwave::SignalManager::executeCommand(), Kwave::SignalManager::loadFile(), and Kwave::DebugPlugin::run().
|
virtual |
makes place for a new track by adjusting the track indices of all meta data items after that track by plus one
track | index of the track that is inserted |
Definition at line 934 of file MetaDataList.cpp.
References Kwave::MetaData::hasProperty(), and Kwave::MetaData::STDPROP_TRACKS.
Referenced by Kwave::SignalManager::insertTrack().
void Kwave::MetaDataList::merge | ( | const MetaDataList & | meta_data | ) |
Merges a list of other meta data items
meta_data | list of meta data items |
Definition at line 403 of file MetaDataList.cpp.
References add(), Kwave::MetaData::boundTracks(), copy(), Kwave::MetaData::firstSample(), Kwave::MetaData::hasProperty(), Kwave::MetaData::keys(), Kwave::MetaData::lastSample(), Kwave::MetaData::positionBoundPropertyNames(), Kwave::MetaData::scope(), Kwave::MetaData::setProperty(), Kwave::MetaData::STDPROP_END, Kwave::MetaData::STDPROP_START, Kwave::MetaData::STDPROP_TRACKS, and Kwave::MetaData::STDPROP_TYPE.
Referenced by Kwave::SignalManager::mergeMetaData(), Kwave::SampleRatePlugin::run(), Kwave::UndoDeleteMetaDataAction::undo(), and Kwave::UndoDeleteAction::undo().
|
virtual |
Removes one meta data object from the list (if it exists).
metadata | the object that should be removed |
Definition at line 276 of file MetaDataList.cpp.
References contains(), and Kwave::MetaData::id().
Referenced by Kwave::MimeData::decode(), and Kwave::SignalManager::deleteLabel().
|
virtual |
Removes a list of meta data objects from this list (if they exist).
list | the list of meta data objects to remove |
Definition at line 283 of file MetaDataList.cpp.
|
virtual |
Replaces all meta data objects that have the same type as one of the objects in the passed list with newer versions. If an object did not exist, it will be created. If an object is not in the passed list, it will be deleted.
list | listof meta data objects that should be replaced |
Definition at line 229 of file MetaDataList.cpp.
References add(), contains(), and Kwave::MetaData::STDPROP_TYPE.
Referenced by Kwave::OggDecoder::decode(), Kwave::AsciiDecoder::decode(), Kwave::FlacDecoder::decode(), Kwave::MimeData::encode(), Kwave::SignalManager::executeCommand(), Kwave::SignalManager::loadFile(), Kwave::SignalManager::newSignal(), Kwave::AudiofileDecoder::open(), Kwave::AsciiDecoder::open(), Kwave::MP3Decoder::open(), Kwave::FlacDecoder::open(), Kwave::WavDecoder::open(), Kwave::OggDecoder::parseHeader(), Kwave::MP3Decoder::parseID3Tags(), Kwave::MP3Decoder::parseMp3Header(), Kwave::FlacDecoder::parseStreamInfo(), Kwave::FlacDecoder::parseVorbisComments(), Kwave::SignalManager::save(), Kwave::K3BExportPlugin::saveBlocks(), Kwave::SignalManager::setFileInfo(), Kwave::SignalManager::slotSamplesDeleted(), Kwave::SignalManager::slotSamplesInserted(), Kwave::SignalManager::slotTrackDeleted(), Kwave::SignalManager::slotTrackInserted(), Kwave::SaveBlocksPlugin::start(), and Kwave::MP3EncoderDialog::testSettings().
|
virtual |
scale the positions or start/end of all elements by a given factor
scale | the factor that is applied to all positions |
tracks | list of track indices |
Definition at line 839 of file MetaDataList.cpp.
References add(), Kwave::MetaData::boundTracks(), copy(), Kwave::MetaData::firstSample(), Kwave::MetaData::hasProperty(), Kwave::MetaData::lastSample(), SAMPLE_INDEX_MAX, Kwave::MetaData::setProperty(), Kwave::MetaData::STDPROP_END, Kwave::MetaData::STDPROP_POS, Kwave::MetaData::STDPROP_START, and Kwave::MetaData::STDPROP_TRACKS.
Referenced by Kwave::MimeData::decode().
|
virtual |
select elements from the meta data list that are exactly at a given position.
pos | index of the sample to select |
Definition at line 158 of file MetaDataList.cpp.
References add(), Kwave::MetaData::hasProperty(), Kwave::MetaData::Position, Kwave::MetaData::scope(), and Kwave::MetaData::STDPROP_POS.
|
virtual |
select elements from the meta data list that contain a given property.
property | the property to search for |
Definition at line 182 of file MetaDataList.cpp.
References add(), and Kwave::MetaData::hasProperty().
|
virtual |
select elements from the meta data list that overlap a given range of samples (selects elements with scope "Range" as well as elements with scope "Position")
first | index of the first sample |
last | index of the last sample |
Definition at line 118 of file MetaDataList.cpp.
References add(), Kwave::MetaData::hasProperty(), Kwave::MetaData::Position, Kwave::MetaData::Range, Kwave::MetaData::scope(), Kwave::MetaData::STDPROP_END, Kwave::MetaData::STDPROP_POS, and Kwave::MetaData::STDPROP_START.
Referenced by Kwave::MimeData::encode().
|
virtual |
select elements from the meta data list that have a specific scope
scope | the scope to select |
Definition at line 68 of file MetaDataList.cpp.
References add(), and Kwave::MetaData::scope().
|
virtual |
select elements from the meta data list that belong to a given track.
tracks | list of track indices to select |
Definition at line 84 of file MetaDataList.cpp.
References add(), contains(), Kwave::MetaData::hasProperty(), Kwave::MetaData::id(), and Kwave::MetaData::STDPROP_TRACKS.
Referenced by Kwave::SignalManager::deleteTrack(), Kwave::SignalManager::insertTrack(), and Kwave::SelectionItem::startDragging().
|
virtual |
select elements from the meta data list that have the standard property STDPROP_TYPE set to a specific value.
type | the type to select |
Definition at line 62 of file MetaDataList.cpp.
References selectByValue(), and Kwave::MetaData::STDPROP_TYPE.
Referenced by Kwave::MimeData::decode(), and Kwave::LabelList::LabelList().
|
virtual |
select elements from the meta data list that contain a given property and a given value
property | the property to search for |
value | the value that the property should have |
Definition at line 198 of file MetaDataList.cpp.
References add(), and Kwave::MetaData::hasProperty().
Referenced by selectByType().
|
virtual |
shift the positions or start/end of all elements that are after a given offset to the left.
offset | index of the first sample |
shift | number of samples to shift left |
tracks | list of track indices |
Definition at line 635 of file MetaDataList.cpp.
References add(), Kwave::MetaData::boundTracks(), copy(), Kwave::MetaData::firstSample(), Kwave::MetaData::hasProperty(), Kwave::MetaData::lastSample(), Kwave::MetaData::setProperty(), Kwave::MetaData::STDPROP_END, Kwave::MetaData::STDPROP_POS, Kwave::MetaData::STDPROP_START, and Kwave::MetaData::STDPROP_TRACKS.
Referenced by Kwave::MimeData::encode(), and Kwave::SignalManager::slotSamplesDeleted().
|
virtual |
shift the positions or start/end of all elements that are after a given offset to the right.
offset | index of the first sample |
shift | number of samples to shift right |
tracks | list of track indices |
Definition at line 735 of file MetaDataList.cpp.
References add(), Kwave::MetaData::boundTracks(), copy(), Kwave::MetaData::firstSample(), Kwave::MetaData::hasProperty(), Kwave::MetaData::lastSample(), SAMPLE_INDEX_MAX, Kwave::MetaData::setProperty(), Kwave::MetaData::STDPROP_END, Kwave::MetaData::STDPROP_POS, Kwave::MetaData::STDPROP_START, and Kwave::MetaData::STDPROP_TRACKS.
Referenced by Kwave::MimeData::decode(), and Kwave::SignalManager::slotSamplesInserted().
|
protected |
Splits the list at a given position. The given position will be the start of the new fragment(s), so that splitting multiple times at the same offset does not produce further fragments.
offset | index of the sample position before which the list should be split |
tracks | list of track indices |
Definition at line 989 of file MetaDataList.cpp.
References add(), Kwave::MetaData::boundTracks(), copy(), Kwave::MetaData::firstSample(), Kwave::MetaData::hasProperty(), Kwave::MetaData::lastSample(), Kwave::MetaData::setProperty(), Kwave::MetaData::STDPROP_END, Kwave::MetaData::STDPROP_START, and Kwave::MetaData::STDPROP_TRACKS.
|
virtual |
Create a simple list of meta data items, sorted by the position of the first sample. All meta data items that do not correspond to a position or a "first" sample are mapped to the start (zero).
Definition at line 51 of file MetaDataList.cpp.
References isLessThan().
Referenced by Kwave::LabelList::LabelList().