From: Tsuda Kageyu Date: Sun, 22 Nov 2015 16:32:12 +0000 (+0900) Subject: Hide a private static variable. X-Git-Tag: v1.11beta~99 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=25ffbcb4b9b04326edd1d25a785b686951a0f235;p=taglib Hide a private static variable. This is so-called Scott Mayers' singleton pattern. --- diff --git a/taglib/mpeg/id3v2/id3v2framefactory.cpp b/taglib/mpeg/id3v2/id3v2framefactory.cpp index f387e937..1d6a6649 100644 --- a/taglib/mpeg/id3v2/id3v2framefactory.cpp +++ b/taglib/mpeg/id3v2/id3v2framefactory.cpp @@ -71,14 +71,13 @@ public: } }; -FrameFactory FrameFactory::factory; - //////////////////////////////////////////////////////////////////////////////// // public members //////////////////////////////////////////////////////////////////////////////// FrameFactory *FrameFactory::instance() { + static FrameFactory factory; return &factory; } @@ -519,5 +518,4 @@ void FrameFactory::updateGenre(TextIdentificationFrame *frame) const fields.append(String()); frame->setText(newfields); - } diff --git a/taglib/mpeg/id3v2/id3v2framefactory.h b/taglib/mpeg/id3v2/id3v2framefactory.h index 3de59ac7..225d4f5a 100644 --- a/taglib/mpeg/id3v2/id3v2framefactory.h +++ b/taglib/mpeg/id3v2/id3v2framefactory.h @@ -66,6 +66,7 @@ namespace TagLib { { public: static FrameFactory *instance(); + /*! * Create a frame based on \a data. \a synchSafeInts should only be set * false if we are parsing an old tag (v2.3 or older) that does not support @@ -162,8 +163,6 @@ namespace TagLib { void updateGenre(TextIdentificationFrame *frame) const; - static FrameFactory factory; - class FrameFactoryPrivate; FrameFactoryPrivate *d; };