]> granicus.if.org Git - taglib/commitdiff
Hide a private static variable.
authorTsuda Kageyu <tsuda.kageyu@gmail.com>
Sun, 22 Nov 2015 16:32:12 +0000 (01:32 +0900)
committerTsuda Kageyu <tsuda.kageyu@gmail.com>
Sun, 22 Nov 2015 16:32:12 +0000 (01:32 +0900)
This is so-called Scott Mayers' singleton pattern.

taglib/mpeg/id3v2/id3v2framefactory.cpp
taglib/mpeg/id3v2/id3v2framefactory.h

index f387e93778af2458025f2bc18f46de4ce2ac5d93..1d6a6649c3ca0838b49b1cee85a32326f5195597 100644 (file)
@@ -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);
-
 }
index 3de59ac7b05b883b81fe38d635c3589ac03ddf09..225d4f5af05385cdbf4be1ad46dabe4ba31b9265 100644 (file)
@@ -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;
     };