23 #ifndef ABSTRACT_XIPH_FRAME_H_ 24 #define ABSTRACT_XIPH_FRAME_H_ 26 #include "Utils/Tagging/AbstractFrame.h" 28 #include <taglib/tag.h> 29 #include <taglib/xiphcomment.h> 30 #include <taglib/tstring.h> 31 #include <taglib/tstringlist.h> 35 template<
typename Model_t>
40 virtual bool map_tag_to_model(Model_t& model)=0;
41 virtual bool map_model_to_tag(
const Model_t& model)=0;
45 bool value(TagLib::String& str)
const 47 TagLib::Ogg::XiphComment* tag = this->tag();
48 const TagLib::Ogg::FieldListMap& map = tag->fieldListMap();
49 TagLib::Ogg::FieldListMap::ConstIterator it = map.find( this->tag_key() );
51 str = TagLib::String();
55 str = it->second.front();
59 void set_value(
const TagLib::String& value)
61 TagLib::Ogg::XiphComment* tag = this->tag();
62 tag->addField(this->tag_key(), value,
true);
65 void set_value(
const QString& value)
67 TagLib::String str = this->cvt_string(value);
72 XiphFrame(TagLib::Ogg::XiphComment* tag,
const QString& identifier) :
77 bool read(Model_t& model)
83 bool success = map_tag_to_model(model);
88 bool write(
const Model_t& model)
90 TagLib::Ogg::XiphComment* tag = this->tag();
95 TagLib::String key = this->tag_key();
98 tag->removeField( this->tag_key() );
101 return map_model_to_tag(model);
104 virtual bool is_frame_found()
const 106 if(this->tag_key().isEmpty())
111 return this->tag()->contains(
"METADTA_BLOCK_PICTURE");
116 #endif // ABSTRACTFRAME_H Definition: XiphFrame.h:36
Definition: AlbumArtist.h:32
Definition: AbstractFrame.h:55