diff --git a/examples/inspect.cpp b/examples/inspect.cpp
index 90a94dbb..90559331 100644
--- a/examples/inspect.cpp
+++ b/examples/inspect.cpp
@@ -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;
}
}
diff --git a/taglib/audioproperties.h b/taglib/audioproperties.h
index 12400b9f..750924d4 100644
--- a/taglib/audioproperties.h
+++ b/taglib/audioproperties.h
@@ -87,7 +87,10 @@ namespace TagLib {
*/
virtual int channels() const = 0;
- String toString() const;
+ /*!
+ * Returns description of the audio file.
+ */
+ virtual String toString() const;
protected:
diff --git a/taglib/mp4/mp4file.cpp b/taglib/mp4/mp4file.cpp
index 8d6a99a3..a9543211 100644
--- a/taglib/mp4/mp4file.cpp
+++ b/taglib/mp4/mp4file.cpp
@@ -149,16 +149,3 @@ MP4::File::save()
return d->tag->save();
}
-String
-MP4::File::toString() const
-{
- StringList desc;
- if(d->properties) {
- desc.append(d->properties->toString());
- }
- if(d->tag) {
- desc.append(d->tag->toString());
- }
- return desc.toString("\n");
-}
-
diff --git a/taglib/mp4/mp4file.h b/taglib/mp4/mp4file.h
index d8468490..2ed3bea5 100644
--- a/taglib/mp4/mp4file.h
+++ b/taglib/mp4/mp4file.h
@@ -100,11 +100,6 @@ namespace TagLib {
*/
bool save();
- /*!
- * Description of the file.
- */
- String toString() const;
-
private:
void read(bool readProperties, Properties::ReadStyle audioPropertiesStyle);
diff --git a/taglib/tag.h b/taglib/tag.h
index f8a77a28..96612110 100644
--- a/taglib/tag.h
+++ b/taglib/tag.h
@@ -179,7 +179,10 @@ namespace TagLib {
*/
static void duplicate(const Tag *source, Tag *target, bool overwrite = true);
- String toString() const;
+ /*!
+ * Returns description of the tag.
+ */
+ virtual String toString() const;
protected:
/*!
diff --git a/taglib/toolkit/tfile.h b/taglib/toolkit/tfile.h
index 5ef39daa..860a889a 100644
--- a/taglib/toolkit/tfile.h
+++ b/taglib/toolkit/tfile.h
@@ -246,9 +246,9 @@ namespace TagLib {
static bool isWritable(const char *name);
/*!
- * Description of the file.
+ * Returns description of the audio file and its tags.
*/
- String toString() const;
+ virtual String toString() const;
protected:
/*!