From 15b601f053685ff592c1c59827c87d62034329e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Lalinsk=C3=BD?= Date: Wed, 21 Nov 2012 14:40:26 +0100 Subject: [PATCH] Use PropertyMap in tagreader --- examples/tagreader.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/examples/tagreader.cpp b/examples/tagreader.cpp index 76fe0d1a..cc978eba 100644 --- a/examples/tagreader.cpp +++ b/examples/tagreader.cpp @@ -23,10 +23,12 @@ */ #include +#include #include #include #include +#include using namespace std; @@ -49,7 +51,7 @@ int main(int argc, char *argv[]) TagLib::Tag *tag = f.tag(); - cout << "-- TAG --" << endl; + cout << "-- TAG (basic) --" << endl; cout << "title - \"" << tag->title() << "\"" << endl; cout << "artist - \"" << tag->artist() << "\"" << endl; cout << "album - \"" << tag->album() << "\"" << endl; @@ -57,6 +59,23 @@ int main(int argc, char *argv[]) cout << "comment - \"" << tag->comment() << "\"" << endl; cout << "track - \"" << tag->track() << "\"" << endl; cout << "genre - \"" << tag->genre() << "\"" << endl; + + TagLib::PropertyMap tags = f.file()->properties(); + + unsigned int longest = 0; + for(TagLib::PropertyMap::ConstIterator i = tags.begin(); i != tags.end(); ++i) { + if (i->first.size() > longest) { + longest = i->first.size(); + } + } + + cout << "-- TAG (properties) --" << endl; + for(TagLib::PropertyMap::ConstIterator i = tags.begin(); i != tags.end(); ++i) { + for(TagLib::StringList::ConstIterator j = i->second.begin(); j != i->second.end(); ++j) { + cout << left << std::setw(longest) << i->first << " - " << '"' << *j << '"' << endl; + } + } + } if(!f.isNull() && f.audioProperties()) {