/* Defined if your compiler supports codecvt */
#cmakedefine HAVE_STD_CODECVT 1
+/* Defined if your compiler supports some atomic operations */
+#cmakedefine HAVE_STD_ATOMIC 1
+#cmakedefine HAVE_BOOST_ATOMIC 1
+#cmakedefine HAVE_GCC_ATOMIC 1
+#cmakedefine HAVE_MAC_ATOMIC 1
+#cmakedefine HAVE_WIN_ATOMIC 1
+#cmakedefine HAVE_IA64_ATOMIC 1
+
/* Defined if you have libz */
#cmakedefine HAVE_ZLIB 1
toolkit/tmap.h
toolkit/tmap.tcc
toolkit/tpropertymap.h
+ toolkit/trefcounter.h
mpeg/mpegfile.h
mpeg/mpegproperties.h
mpeg/mpegheader.h
toolkit/tfilestream.cpp
toolkit/tdebug.cpp
toolkit/tpropertymap.cpp
+ toolkit/trefcounter.cpp
toolkit/unicode.cpp
)
#include <taglib.h>
#include <tdebug.h>
+#include "trefcounter.h"
#include "asfattribute.h"
#include "asffile.h"
#include <taglib.h>
#include <tdebug.h>
+#include "trefcounter.h"
#include "asfattribute.h"
#include "asffile.h"
#include "asfpicture.h"
#include <tfile.h>
#include <tstring.h>
#include <tdebug.h>
+#include "trefcounter.h"
#include "fileref.h"
#include "asffile.h"
#include <taglib.h>
#include <tdebug.h>
+#include "trefcounter.h"
#include "mp4coverart.h"
using namespace TagLib;
#include <taglib.h>
#include <tdebug.h>
+#include "trefcounter.h"
#include "mp4item.h"
using namespace TagLib;
#include <tbytevector.h>
#include <tstring.h>
#include <tdebug.h>
+#include "trefcounter.h"
#include "mpegheader.h"
/* Defined if your compiler supports std::wstring */
#cmakedefine TAGLIB_HAVE_STD_WSTRING 1
-/* Defined if your compiler supports some atomic operations */
-#cmakedefine TAGLIB_HAVE_STD_ATOMIC 1
-#cmakedefine TAGLIB_HAVE_BOOST_ATOMIC 1
-#cmakedefine TAGLIB_HAVE_GCC_ATOMIC 1
-#cmakedefine TAGLIB_HAVE_MAC_ATOMIC 1
-#cmakedefine TAGLIB_HAVE_WIN_ATOMIC 1
-#cmakedefine TAGLIB_HAVE_IA64_ATOMIC 1
-
#define TAGLIB_WITH_ASF 1
#define TAGLIB_WITH_MP4 1
#include <string>
-// Atomic increment/decrement operations
-
-#if defined(TAGLIB_HAVE_STD_ATOMIC)
-# include <atomic>
-# define TAGLIB_ATOMIC_INT std::atomic<unsigned int>
-# define TAGLIB_ATOMIC_INC(x) x.fetch_add(1)
-# define TAGLIB_ATOMIC_DEC(x) (x.fetch_sub(1) - 1)
-#elif defined(TAGLIB_HAVE_BOOST_ATOMIC)
-# include <boost/atomic.hpp>
-# define TAGLIB_ATOMIC_INT boost::atomic<unsigned int>
-# define TAGLIB_ATOMIC_INC(x) x.fetch_add(1)
-# define TAGLIB_ATOMIC_DEC(x) (x.fetch_sub(1) - 1)
-#elif defined(TAGLIB_HAVE_GCC_ATOMIC)
-# define TAGLIB_ATOMIC_INT int
-# define TAGLIB_ATOMIC_INC(x) __sync_add_and_fetch(&x, 1)
-# define TAGLIB_ATOMIC_DEC(x) __sync_sub_and_fetch(&x, 1)
-#elif defined(TAGLIB_HAVE_WIN_ATOMIC)
-# if !defined(NOMINMAX)
-# define NOMINMAX
-# endif
-# include <windows.h>
-# define TAGLIB_ATOMIC_INT long
-# define TAGLIB_ATOMIC_INC(x) InterlockedIncrement(&x)
-# define TAGLIB_ATOMIC_DEC(x) InterlockedDecrement(&x)
-#elif defined(TAGLIB_HAVE_MAC_ATOMIC)
-# include <libkern/OSAtomic.h>
-# define TAGLIB_ATOMIC_INT int32_t
-# define TAGLIB_ATOMIC_INC(x) OSAtomicIncrement32Barrier(&x)
-# define TAGLIB_ATOMIC_DEC(x) OSAtomicDecrement32Barrier(&x)
-#elif defined(TAGLIB_HAVE_IA64_ATOMIC)
-# include <ia64intrin.h>
-# define TAGLIB_ATOMIC_INT int
-# define TAGLIB_ATOMIC_INC(x) __sync_add_and_fetch(&x, 1)
-# define TAGLIB_ATOMIC_DEC(x) __sync_sub_and_fetch(&x, 1)
-#else
-# define TAGLIB_ATOMIC_INT int
-# define TAGLIB_ATOMIC_INC(x) (++x)
-# define TAGLIB_ATOMIC_DEC(x) (--x)
-#endif
-
//! A namespace for all TagLib related classes and functions
/*!
#else
typedef std::basic_string<wchar> wstring;
#endif
-
-#ifndef DO_NOT_DOCUMENT // Tell Doxygen to skip this class.
- /*!
- * \internal
- * This is just used as a base class for shared classes in TagLib.
- *
- * \warning This <b>is not</b> part of the TagLib public API!
- */
-
- class RefCounter
- {
- public:
- RefCounter() : refCount(1) {}
-
- void ref() { TAGLIB_ATOMIC_INC(refCount); }
- bool deref() { return (TAGLIB_ATOMIC_DEC(refCount) == 0); }
- int count() { return refCount; }
-
- private:
- volatile TAGLIB_ATOMIC_INT refCount;
- };
-
-#endif // DO_NOT_DOCUMENT
-
}
/*!
#include <tstring.h>
#include <tdebug.h>
+#include "trefcounter.h"
#include "tbytevector.h"
***************************************************************************/
#include <algorithm>
+#include "trefcounter.h"
namespace TagLib {
* http://www.mozilla.org/MPL/ *
***************************************************************************/
+#include "trefcounter.h"
+
namespace TagLib {
////////////////////////////////////////////////////////////////////////////////
--- /dev/null
+/***************************************************************************
+ copyright : (C) 2013 by Tsuda Kageyu
+ email : tsuda.kageyu@gmail.com
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#include "config.h"
+#include "trefcounter.h"
+
+#if defined(HAVE_STD_ATOMIC)
+# include <atomic>
+# define ATOMIC_INT std::atomic<unsigned int>
+# define ATOMIC_INC(x) x.fetch_add(1)
+# define ATOMIC_DEC(x) (x.fetch_sub(1) - 1)
+#elif defined(HAVE_BOOST_ATOMIC)
+# include <boost/atomic.hpp>
+# define ATOMIC_INT boost::atomic<unsigned int>
+# define ATOMIC_INC(x) x.fetch_add(1)
+# define ATOMIC_DEC(x) (x.fetch_sub(1) - 1)
+#elif defined(HAVE_GCC_ATOMIC)
+# define ATOMIC_INT int
+# define ATOMIC_INC(x) __sync_add_and_fetch(&x, 1)
+# define ATOMIC_DEC(x) __sync_sub_and_fetch(&x, 1)
+#elif defined(HAVE_WIN_ATOMIC)
+# if !defined(NOMINMAX)
+# define NOMINMAX
+# endif
+# include <windows.h>
+# define ATOMIC_INT long
+# define ATOMIC_INC(x) InterlockedIncrement(&x)
+# define ATOMIC_DEC(x) InterlockedDecrement(&x)
+#elif defined(HAVE_MAC_ATOMIC)
+# include <libkern/OSAtomic.h>
+# define ATOMIC_INT int32_t
+# define ATOMIC_INC(x) OSAtomicIncrement32Barrier(&x)
+# define ATOMIC_DEC(x) OSAtomicDecrement32Barrier(&x)
+#elif defined(HAVE_IA64_ATOMIC)
+# include <ia64intrin.h>
+# define ATOMIC_INT int
+# define ATOMIC_INC(x) __sync_add_and_fetch(&x, 1)
+# define ATOMIC_DEC(x) __sync_sub_and_fetch(&x, 1)
+#else
+# define ATOMIC_INT int
+# define ATOMIC_INC(x) (++x)
+# define ATOMIC_DEC(x) (--x)
+#endif
+
+namespace TagLib
+{
+ class RefCounter::RefCounterPrivate
+ {
+ public:
+ RefCounterPrivate() : refCount(1) {}
+
+ void ref() { ATOMIC_INC(refCount); }
+ bool deref() { return (ATOMIC_DEC(refCount) == 0); }
+ int count() const { return refCount; }
+
+ volatile ATOMIC_INT refCount;
+ };
+
+ RefCounter::RefCounter()
+ : d(new RefCounterPrivate())
+ {
+ }
+
+ RefCounter::~RefCounter()
+ {
+ delete d;
+ }
+
+ void RefCounter::ref()
+ {
+ d->ref();
+ }
+
+ bool RefCounter::deref()
+ {
+ return d->deref();
+ }
+
+ int RefCounter::count() const
+ {
+ return d->count();
+ }
+}
\ No newline at end of file
--- /dev/null
+/***************************************************************************
+ copyright : (C) 2013 by Tsuda Kageyu
+ email : tsuda.kageyu@gmail.com
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#ifndef TAGLIB_REFCOUNTER_H
+#define TAGLIB_REFCOUNTER_H
+
+#include "taglib.h"
+
+#ifndef DO_NOT_DOCUMENT // Tell Doxygen to skip this class.
+/*!
+ * \internal
+ * This is just used as a base class for shared classes in TagLib.
+ *
+ * \warning This <b>is not</b> part of the TagLib public API!
+ */
+namespace TagLib
+{
+ class RefCounter
+ {
+ public:
+ RefCounter();
+ virtual ~RefCounter();
+
+ void ref();
+ bool deref();
+ int count() const;
+
+ private:
+ class RefCounterPrivate;
+ RefCounterPrivate *d;
+ };
+}
+
+#endif // DO_NOT_DOCUMENT
+#endif
\ No newline at end of file
#include "tstring.h"
#include "tdebug.h"
#include "tstringlist.h"
+#include "trefcounter.h"
#include <iostream>
#include <string.h>