23 #ifndef ABSTRACT_MP4_FRAME_H_
24 #define ABSTRACT_MP4_FRAME_H_
26 #include "Utils/Tagging/AbstractFrame.h"
28 #include "taglib/tag.h"
29 #include "taglib/tstringlist.h"
30 #include "taglib/mp4tag.h"
36 template<
typename Model_t>
41 TagLib::MP4::ItemListMap::ConstIterator find_key(
const TagLib::MP4::ItemListMap& ilm)
const
43 for(TagLib::MP4::ItemListMap::ConstIterator it=ilm.begin(); it!=ilm.end(); it++){
44 QString key = this->key();
45 if( this->convert_string(it->first).compare(key, Qt::CaseInsensitive) == 0){
53 virtual bool map_tag_to_model(Model_t& model)=0;
54 virtual bool map_model_to_tag(
const Model_t& model)=0;
58 MP4Frame(TagLib::MP4::Tag* tag,
const QString& identifier) :
63 bool read(Model_t& model)
65 TagLib::MP4::Tag* key = this->tag();
70 const TagLib::MP4::ItemListMap& ilm = key->itemListMap();
72 bool found = (find_key(ilm) != ilm.end());
77 bool success = map_tag_to_model(model);
82 bool write(
const Model_t& model)
84 TagLib::MP4::Tag* tag = this->tag();
89 TagLib::MP4::ItemListMap& ilm = tag->itemListMap();
91 auto itcopy=ilm.begin();
92 for(
auto it=ilm.begin(); it!=ilm.end(); it++)
94 QString key = this->key();
95 if( this->convert_string(it->first).compare(key, Qt::CaseInsensitive) == 0)
106 return map_model_to_tag(model);
109 bool is_frame_found()
111 TagLib::MP4::Tag* key = this->tag();
116 const TagLib::MP4::ItemListMap& ilm = key->itemListMap();
118 return (find_key(ilm) != ilm.end());
123 #endif // ABSTRACT_MP4_FRAME_H_