Add missing functions to VorbisComment class.
authorErik de Castro Lopo <erikd@mega-nerd.com>
Tue, 8 May 2012 09:12:58 +0000 (19:12 +1000)
committerErik de Castro Lopo <erikd@mega-nerd.com>
Tue, 8 May 2012 09:12:58 +0000 (19:12 +1000)
Patch from Bastiaan Timmer <basjetimmer@yahoo.com> sent to the
<flac-dev@xiph.org> mailing list.

include/FLAC++/metadata.h
src/libFLAC++/metadata.cpp

index 94eb6fc..adf18b5 100644 (file)
@@ -675,6 +675,9 @@ namespace FLAC {
                        //! See FLAC__metadata_object_vorbiscomment_set_vendor_string()
                        bool set_vendor_string(const FLAC__byte *string); // NUL-terminated UTF-8 string
 
+                       //! See FLAC__metadata_object_vorbiscomment_resize_comments()
+                       bool resize_comments(unsigned new_num_comments);
+
                        //! See FLAC__metadata_object_vorbiscomment_set_comment()
                        bool set_comment(unsigned index, const Entry &entry);
 
@@ -684,8 +687,20 @@ namespace FLAC {
                        //! See FLAC__metadata_object_vorbiscomment_append_comment()
                        bool append_comment(const Entry &entry);
 
+                       //! See FLAC__metadata_object_vorbiscomment_replace_comment()
+                       bool replace_comment(const Entry &entry, bool all);
+
                        //! See FLAC__metadata_object_vorbiscomment_delete_comment()
                        bool delete_comment(unsigned index);
+
+                       //! See FLAC__metadata_object_vorbiscomment_find_entry_from()
+                       int find_entry_from(unsigned offset, const char *field_name);
+
+                       //! See FLAC__metadata_object_vorbiscomment_remove_entry_matching()
+                       int remove_entry_matching(const char *field_name);
+
+                       //! See FLAC__metadata_object_vorbiscomment_remove_entries_matching()
+                       int remove_entries_matching(const char *field_name);
                };
 
                /** CUESHEET metadata block.
index 0870d02..5c11dfd 100644 (file)
@@ -849,6 +849,12 @@ namespace FLAC {
                        return (bool)::FLAC__metadata_object_vorbiscomment_set_vendor_string(object_, vendor_string, /*copy=*/true);
                }
 
+               bool VorbisComment::resize_comments(unsigned new_num_comments)
+               {
+                       FLAC__ASSERT(is_valid());
+                       return (bool)::FLAC__metadata_object_vorbiscomment_resize_comments(object_, new_num_comments);
+               }
+
                bool VorbisComment::set_comment(unsigned index, const VorbisComment::Entry &entry)
                {
                        FLAC__ASSERT(is_valid());
@@ -869,6 +875,12 @@ namespace FLAC {
                        return (bool)::FLAC__metadata_object_vorbiscomment_append_comment(object_, entry.get_entry(), /*copy=*/true);
                }
 
+               bool VorbisComment::replace_comment(const VorbisComment::Entry &entry, bool all)
+               {
+                       FLAC__ASSERT(is_valid());
+                       return (bool)::FLAC__metadata_object_vorbiscomment_replace_comment(object_, entry.get_entry(), all, /*copy=*/true);
+               }
+
                bool VorbisComment::delete_comment(unsigned index)
                {
                        FLAC__ASSERT(is_valid());
@@ -876,6 +888,24 @@ namespace FLAC {
                        return (bool)::FLAC__metadata_object_vorbiscomment_delete_comment(object_, index);
                }
 
+               int VorbisComment::find_entry_from(unsigned offset, const char *field_name)
+               {
+                       FLAC__ASSERT(is_valid());
+                       return ::FLAC__metadata_object_vorbiscomment_find_entry_from(object_, offset, field_name);
+               }
+
+               int VorbisComment::remove_entry_matching(const char *field_name)
+               {
+                       FLAC__ASSERT(is_valid());
+                       return ::FLAC__metadata_object_vorbiscomment_remove_entry_matching(object_, field_name);
+               }
+
+               int VorbisComment::remove_entries_matching(const char *field_name)
+               {
+                       FLAC__ASSERT(is_valid());
+                       return ::FLAC__metadata_object_vorbiscomment_remove_entries_matching(object_, field_name);
+               }
+
 
                //
                // CueSheet::Track