return d->tagAlterPreservation;
}
+void Frame::Header::setTagAlterPreservation(bool preserve)
+{
+ d->tagAlterPreservation = preserve;
+}
+
bool Frame::Header::fileAlterPreservation() const
{
return d->fileAlterPreservation;
namespace ID3v2 {
+ class Tag;
class FrameFactory;
//! ID3v2 frame implementation
class Frame
{
+ friend class Tag;
friend class FrameFactory;
public:
/*!
* Returns true if the flag for tag alter preservation is set.
*
- * \note This flag is currently ignored internally in TagLib.
+ * The semantics are a little backwards from what would seem natural
+ * (setting the preservation flag to throw away the frame), but this
+ * follows the ID3v2 standard.
+ *
+ * \see setTagAlterPreservation()
*/
bool tagAlterPreservation() const;
+ /*!
+ * Sets the flag for preservation of this frame if the tag is set. If
+ * this is set to true the frame will not be written when the tag is
+ * saved.
+ *
+ * The semantics are a little backwards from what would seem natural
+ * (setting the preservation flag to throw away the frame), but this
+ * follows the ID3v2 standard.
+ *
+ * \see tagAlterPreservation()
+ */
+ void setTagAlterPreservation(bool discard);
+
/*!
* Returns true if the flag for file alter preservation is set.
*
}
if(!updateFrame(header)) {
- delete header;
- return 0;
+ header->setTagAlterPreservation(true);
+ return new UnknownFrame(data, header);
}
// updateFrame() might have updated the frame ID.
// Loop through the frames rendering them and adding them to the tagData.
- for(FrameList::Iterator it = d->frameList.begin(); it != d->frameList.end(); it++)
- tagData.append((*it)->render());
+ for(FrameList::Iterator it = d->frameList.begin(); it != d->frameList.end(); it++) {
+ if(!(*it)->header()->tagAlterPreservation())
+ tagData.append((*it)->render());
+ }
// Compute the amount of padding, and append that to tagData.