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;
43 bool value(TagLib::String& str)
const 45 TagLib::Ogg::XiphComment* tag = this->tag();
46 const TagLib::Ogg::FieldListMap& map = tag->fieldListMap();
47 TagLib::Ogg::FieldListMap::ConstIterator it = map.find( this->tag_key() );
49 str = TagLib::String();
53 str = it->second.front();
57 void set_value(
const TagLib::String& value)
59 TagLib::Ogg::XiphComment* tag = this->tag();
60 tag->addField(this->tag_key(), value,
true);
63 void set_value(
const QString& value)
65 TagLib::String str = this->cvt_string(value);
70 XiphFrame(TagLib::Tag* tag,
const QString& identifier) :
75 bool read(Model_t& model)
81 bool success = map_tag_to_model(model);
86 bool write(
const Model_t& model)
88 TagLib::Ogg::XiphComment* tag = this->tag();
93 tag->removeField( this->tag_key() );
95 return map_model_to_tag(model);
100 #endif // ABSTRACTFRAME_H Definition: XiphFrame.h:36
Definition: AlbumArtist.h:32
Definition: AbstractFrame.h:57