23 #ifndef ABSTRACT_XIPH_FRAME_H_
24 #define ABSTRACT_XIPH_FRAME_H_
26 #include "Utils/Tagging/AbstractFrame.h"
29 #include "taglib/tag.h"
30 #include "taglib/xiphcomment.h"
31 #include "taglib/tstring.h"
32 #include "taglib/tstringlist.h"
36 template<
typename Model_t>
41 virtual bool map_tag_to_model(Model_t& model)=0;
42 virtual bool map_model_to_tag(
const Model_t& model)=0;
46 bool value(TagLib::String& str)
const
48 TagLib::Ogg::XiphComment* tag = this->tag();
49 const TagLib::Ogg::FieldListMap& map = tag->fieldListMap();
50 TagLib::Ogg::FieldListMap::ConstIterator it = map.find( this->tag_key() );
52 str = TagLib::String();
56 str = it->second.front();
60 void set_value(
const TagLib::String& value)
62 TagLib::Ogg::XiphComment* tag = this->tag();
63 tag->addField(this->tag_key(), value,
true);
66 void set_value(
const QString& value)
68 TagLib::String str = this->convert_string(value);
73 XiphFrame(TagLib::Ogg::XiphComment* tag,
const QString& identifier) :
78 bool read(Model_t& model)
84 bool success = map_tag_to_model(model);
89 bool write(
const Model_t& model)
91 TagLib::Ogg::XiphComment* tag = this->tag();
96 TagLib::String key = this->tag_key();
99 tag->removeField( this->tag_key() );
102 return map_model_to_tag(model);
105 virtual bool is_frame_found()
const
107 if(this->tag_key().isEmpty())
112 return this->tag()->contains(
"METADTA_BLOCK_PICTURE");
117 #endif // ABSTRACTFRAME_H