]> granicus.if.org Git - taglib/commitdiff
Adding accessors for the various tag type for FLAC tags (similar to those
authorScott Wheeler <wheeler@kde.org>
Sat, 10 Apr 2004 17:55:23 +0000 (17:55 +0000)
committerScott Wheeler <wheeler@kde.org>
Sat, 10 Apr 2004 17:55:23 +0000 (17:55 +0000)
in MPEG::File).

CCMAIL:Jorn Baayen <jbaayen@gnome.org>

git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@302658 283d02a7-25f6-0310-bc7c-ecb5cbfe19da

flac/flacfile.cpp
flac/flacfile.h

index 046eef54920866bc4d1bfeb58382beb2dbff586c..50fa324b24bce434ce686e5eda2f0e25bda854fc 100644 (file)
@@ -24,6 +24,8 @@
 #include <tdebug.h>
 
 #include <id3v2header.h>
+#include <id3v2tag.h>
+#include <id3v1tag.h>
 
 #include "flacfile.h"
 #include "flactag.h"
@@ -214,6 +216,38 @@ void FLAC::File::save()
 
 }
 
+ID3v2::Tag *FLAC::File::ID3v2Tag(bool create)
+{
+  if(!create || d->ID3v2Tag)
+    return d->ID3v2Tag;
+
+  // no ID3v2 tag exists and we've been asked to create one
+
+  d->ID3v2Tag = new ID3v2::Tag;
+  return d->ID3v2Tag;
+}
+
+ID3v1::Tag *FLAC::File::ID3v1Tag(bool create)
+{
+  if(!create || d->ID3v1Tag)
+    return d->ID3v1Tag;
+
+  // no ID3v1 tag exists and we've been asked to create one
+
+  d->ID3v1Tag = new ID3v1::Tag;
+  return d->ID3v1Tag;
+}
+
+Ogg::XiphComment *FLAC::File::xiphComment(bool create)
+{
+  if(!create || d->comment)
+    return d->comment;
+
+  // no XiphComment exists and we've been asked to create one
+
+  d->comment = new Ogg::XiphComment;
+  return d->comment;
+}
 void FLAC::File::setID3v2FrameFactory(const ID3v2::FrameFactory *factory)
 {
   d->ID3v2FrameFactory = factory;
index 2096fe6f43114dc678f05193bae7756cbb278549..81dc181054285d540fd033fad661266df57e24e0 100644 (file)
 namespace TagLib {
 
   class Tag;
-  namespace ID3v2 { class FrameFactory; }
+
+  namespace ID3v2 { class FrameFactory; class Tag; }
+  namespace ID3v1 { class Tag; }
+  namespace Ogg { class XiphComment; }
 
   //! An implementation of FLAC metadata
 
@@ -83,8 +86,12 @@ namespace TagLib {
       virtual ~File();
 
       /*!
-       * Returns the Tag for this file.  This will be a union of XiphComment
-       * with ID3v1 and ID3v2 tags.
+       * Returns the Tag for this file.  This will be a union of XiphComment,
+       * ID3v1 and ID3v2 tags.
+       *
+       * \see ID3v2Tag()
+       * \see ID3v1Tag()
+       * \see XiphComment()
        */
       virtual TagLib::Tag *tag() const;
 
@@ -101,6 +108,45 @@ namespace TagLib {
        */
       virtual void save();
 
+      /*!
+       * Returns a pointer to the ID3v2 tag of the file.
+       *
+       * If \a create is false (the default) this will return a null pointer
+       * if there is no valid ID3v2 tag.  If \a create is true it will create
+       * an ID3v2 tag if one does not exist.
+       *
+       * \note The Tag <b>is still</b> owned by the FLAC::File and should not be
+       * deleted by the user.  It will be deleted when the file (object) is
+       * destroyed.
+       */
+      ID3v2::Tag *ID3v2Tag(bool create = false);
+
+      /*!
+       * Returns a pointer to the ID3v1 tag of the file.
+       *
+       * If \a create is false (the default) this will return a null pointer
+       * if there is no valid ID3v1 tag.  If \a create is true it will create
+       * an ID3v1 tag if one does not exist.
+       *
+       * \note The Tag <b>is still</b> owned by the FLAC::File and should not be
+       * deleted by the user.  It will be deleted when the file (object) is
+       * destroyed.
+       */
+      ID3v1::Tag *ID3v1Tag(bool create = false);
+
+      /*!
+       * Returns a pointer to the XiphComment for the file.
+       *
+       * If \a create is false (the default) this will return a null pointer
+       * if there is no valid XiphComment.  If \a create is true it will create
+       * a XiphComment if one does not exist.
+       *
+       * \note The Tag <b>is still</b> owned by the FLAC::File and should not be
+       * deleted by the user.  It will be deleted when the file (object) is
+       * destroyed.
+       */
+      Ogg::XiphComment *xiphComment(bool create = false);
+
       /*!
        * Set the ID3v2::FrameFactory to something other than the default.  This
        * can be used to specify the way that ID3v2 frames will be interpreted