Make the toString() method virtual

This commit is contained in:
Lukáš Lalinský
2012-11-12 16:22:23 +01:00
parent e8ae4ecd93
commit 60ba972244
6 changed files with 12 additions and 37 deletions

View File

@ -26,17 +26,11 @@
#include <stdlib.h>
#include <fileref.h>
#include <mp4file.h>
#include <tfile.h>
using namespace std;
using namespace TagLib;
#define MAYBE_PRINT_DESC(_Type) \
if(dynamic_cast<_Type *>(f.file())) { \
cout << dynamic_cast<_Type *>(f.file())->toString().to8Bit(true) << endl; \
found = 1; \
}
int main(int argc, char *argv[])
{
// process the command line args
@ -46,15 +40,8 @@ int main(int argc, char *argv[])
cout << "******************** \"" << argv[i] << "\"********************" << endl;
FileRef f(argv[i]);
bool found = 0;
if(!f.isNull() && f.file()) {
MAYBE_PRINT_DESC(MP4::File);
MAYBE_PRINT_DESC(File);
}
if(!found) {
cout << "could not find any information about the file" << endl;
cout << f.file()->toString().to8Bit(true) << endl;
}
}