Add a convenience function to create a Metadata::Padding object with a
authorErik de Castro Lopo <erikd@mega-nerd.com>
Tue, 11 Sep 2012 05:52:24 +0000 (15:52 +1000)
committerErik de Castro Lopo <erikd@mega-nerd.com>
Tue, 11 Sep 2012 05:52:24 +0000 (15:52 +1000)
certain size in one statement.

Patch from Bastiaan Timmer <basjetimmer@yahoo.com>

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

index 90bf198..bbf4e89 100644 (file)
@@ -359,6 +359,10 @@ namespace FLAC {
                         */
                        inline Padding(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
 
+                       /** Constructs an object with the given length.
+                        */
+                       Padding(unsigned length);
+
                        ~Padding();
 
                        //@{
@@ -387,6 +391,8 @@ namespace FLAC {
                        inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
                        //@}
 
+                       /** Sets the length in bytes of the padding block.
+                        */
                        void set_length(unsigned length);
                };
 
index ee671a0..a378624 100644 (file)
@@ -361,6 +361,12 @@ namespace FLAC {
                Prototype(FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING), /*copy=*/false)
                { }
 
+               Padding::Padding(unsigned length):
+               Prototype(FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING), /*copy=*/false)
+               {
+                       set_length(length);
+               }
+
                Padding::~Padding()
                { }