Stop determining whether to enable C++11 features at compile time

This commit is contained in:
Tsuda Kageyu 2013-03-20 08:39:13 +09:00
parent 96cf908232
commit cab68e2152
12 changed files with 77 additions and 31 deletions

View File

@ -11,6 +11,11 @@ else()
endif()
OPTION(ENABLE_STATIC_RUNTIME "Visual Studio, link with runtime statically" OFF)
option(ENABLE_CXX11 "Enable C++11 features" OFF)
if(ENABLE_CXX11)
add_definitions(-DTAGLIB_USE_CXX11)
endif()
option(VISIBILITY_HIDDEN "Build with -fvisibility=hidden" OFF)
if(VISIBILITY_HIDDEN)
add_definitions (-fvisibility=hidden)

View File

@ -119,6 +119,8 @@ namespace TagLib
/*!
* Moves the contents of \a other into this item.
*
* \note Not available unless TAGLIB_USE_CXX11 macro is defined.
*/
ASF::Attribute &operator=(Attribute &&other);

View File

@ -111,6 +111,8 @@ namespace TagLib
/*!
* Constructs an picture equivalent to \a other.
*
* \note Not available unless TAGLIB_USE_CXX11 macro is defined.
*/
Picture(Picture &&other);
@ -130,7 +132,9 @@ namespace TagLib
/*!
* Moves the contents of \a other into this picture.
*/
*
* \note Not available unless TAGLIB_USE_CXX11 macro is defined.
*/
Picture& operator=(Picture &&other);
#endif

View File

@ -143,6 +143,8 @@ namespace TagLib {
/*!
* Move \a ref into the FileRef.
*
* \note Not available unless TAGLIB_USE_CXX11 macro is defined.
*/
FileRef(FileRef &&ref);
@ -239,7 +241,9 @@ namespace TagLib {
#ifdef TAGLIB_USE_CXX11
/*!
* Assign the file pointed to by \a ref to this FileRef.
* Moves \a ref into this FileRef.
*
* \note Not available unless TAGLIB_USE_CXX11 macro is defined.
*/
FileRef &operator=(FileRef &&ref);

View File

@ -59,8 +59,10 @@ namespace TagLib {
#ifdef TAGLIB_USE_CXX11
/*!
* Moves \a h into the \e Header.
*/
* Moves \a h into this Header.
*
* \note Not available unless TAGLIB_USE_CXX11 macro is defined.
*/
Header(Header &&h);
#endif
@ -166,7 +168,9 @@ namespace TagLib {
#ifdef TAGLIB_USE_CXX11
/*!
* Moves \a h into the \e Header.
* Moves \a h into this Header.
*
* \note Not available unless TAGLIB_USE_CXX11 macro is defined.
*/
Header &operator=(Header &&h);

View File

@ -52,22 +52,9 @@
#endif
// Determines if std::shared_ptr<T> and rvalue reference are available.
// TAGLIB_USE_CXX11 determines whether or not to enable C++11 features.
// Replaces RefCounter capability with std::shared_ptr<T> if available.
#ifndef __has_feature
# define __has_feature(x) 0
#endif
#ifndef TAGLIB_USE_CXX11
# if (defined(_MSC_VER) && _MSC_VER >= 1600) \
|| (defined(__clang__) && __has_feature(cxx_rvalue_references)) \
|| (defined(__GNUC__) && defined(__GXX_EXPERIMENTAL_CXX0X__))
# define TAGLIB_USE_CXX11
# endif
#endif
#ifdef TAGLIB_USE_CXX11
# include <memory>
#endif

View File

@ -70,6 +70,8 @@ namespace TagLib {
/*!
* Constructs a byte vector equivalent to \a v.
*
* \note Not available unless TAGLIB_USE_CXX11 macro is defined.
*/
ByteVector(ByteVector &&v);
@ -392,7 +394,9 @@ namespace TagLib {
#ifdef TAGLIB_USE_CXX11
/*!
* Moves \a v into the ByteVector.
* Moves \a v into this ByteVector.
*
* \note Not available unless TAGLIB_USE_CXX11 macro is defined.
*/
ByteVector &operator=(ByteVector &&v);

View File

@ -57,7 +57,9 @@ namespace TagLib {
#ifdef TAGLIB_USE_CXX11
/*!
* Moves \a l into the StringList.
* Moves \a l into this ByteVectorList.
*
* \note Not available unless TAGLIB_USE_CXX11 macro is defined.
*/
ByteVectorList(ByteVectorList &&l);
@ -73,7 +75,9 @@ namespace TagLib {
#ifdef TAGLIB_USE_CXX11
/*!
* Moves \a l into the \e ByteVectorList.
* Moves \a l into this ByteVectorList.
*
* \note Not available unless TAGLIB_USE_CXX11 macro is defined.
*/
ByteVectorList &operator=(ByteVectorList &&l);

View File

@ -73,7 +73,9 @@ namespace TagLib {
#ifdef TAGLIB_USE_CXX11
/*!
* Moves \a l into the \e List.
* Moves \a l into this List.
*
* \note Not available unless TAGLIB_USE_CXX11 macro is defined.
*/
List(List<T> &&l);
@ -138,12 +140,16 @@ namespace TagLib {
/*!
* Appends \a item to the end of the list and returns a reference to the
* list.
*
* \note Not available unless TAGLIB_USE_CXX11 macro is defined.
*/
List<T> &append(T &&item);
/*!
* Appends all of the values in \a l to the end of the list and returns a
* reference to the list.
*
* \note Not available unless TAGLIB_USE_CXX11 macro is defined.
*/
List<T> &append(List<T> &&l);
@ -166,12 +172,16 @@ namespace TagLib {
/*!
* Prepends \a item to the beginning list and returns a reference to the
* list.
*
* \note Not available unless TAGLIB_USE_CXX11 macro is defined.
*/
List<T> &prepend(T &&item);
/*!
* Prepends all of the items in \a l to the beginning list and returns a
* reference to the list.
*
* \note Not available unless TAGLIB_USE_CXX11 macro is defined.
*/
List<T> &prepend(List<T> &&l);
@ -265,7 +275,9 @@ namespace TagLib {
#ifdef TAGLIB_USE_CXX11
/*!
* Moves \a l into the \e List.
* Moves \a l into this List.
*
* \note Not available unless TAGLIB_USE_CXX11 macro is defined.
*/
List<T> &operator=(List<T> &&l);

View File

@ -76,7 +76,9 @@ namespace TagLib {
#ifdef TAGLIB_USE_CXX11
/*!
* Moves \a m into the Map.
* Moves \a m into this Map.
*
* \note Not available unless TAGLIB_USE_CXX11 macro is defined.
*/
Map(Map<Key, T> &&m);
@ -122,6 +124,8 @@ namespace TagLib {
/*!
* Inserts \a value under \a key in the map. If a value for \a key already
* exists it will be overwritten.
*
* \note Not available unless TAGLIB_USE_CXX11 macro is defined.
*/
Map<Key, T> &insert(const Key &key, T &&value);
@ -196,7 +200,9 @@ namespace TagLib {
#ifdef TAGLIB_USE_CXX11
/*!
* Moves \a m into the Map.
* Moves \a m into this Map.
*
* \note Not available unless TAGLIB_USE_CXX11 macro is defined.
*/
Map<Key, T> &operator=(Map<Key, T> &&m);

View File

@ -126,7 +126,9 @@ namespace TagLib {
#ifdef TAGLIB_USE_CXX11
/*!
* Moves \a s into the \e String.
* Constructs a String equivalent to \a s.
*
* \note Not available unless TAGLIB_USE_CXX11 macro is defined.
*/
String(String &&s);
@ -408,7 +410,9 @@ namespace TagLib {
#ifdef TAGLIB_USE_CXX11
/*!
* Moves \a s into the \e String.
* Moves \a s into this String.
*
* \note Not available unless TAGLIB_USE_CXX11 macro is defined.
*/
String &operator=(String &&s);
@ -427,7 +431,9 @@ namespace TagLib {
#ifdef TAGLIB_USE_CXX11
/*!
* Moves \a s into the \e String.
* Moves \a s into this String.
*
* \note Not available unless TAGLIB_USE_CXX11 macro is defined.
*/
String &operator=(wstring &&s);

View File

@ -61,7 +61,9 @@ namespace TagLib {
#ifdef TAGLIB_USE_CXX11
/*!
* Moves \a l into the StringList.
* Constructs a StringList equivalent to \a l.
*
* \note Not available unless TAGLIB_USE_CXX11 macro is defined.
*/
StringList(StringList &&l);
@ -102,12 +104,16 @@ namespace TagLib {
/*!
* Appends \a s to the end of the list and returns a reference to the
* list.
*
* \note Not available unless TAGLIB_USE_CXX11 macro is defined.
*/
StringList &append(String &&s);
/*!
* Appends all of the values in \a l to the end of the list and returns a
* reference to the list.
*
* \note Not available unless TAGLIB_USE_CXX11 macro is defined.
*/
StringList &append(StringList &&l);
@ -123,7 +129,9 @@ namespace TagLib {
#ifdef TAGLIB_USE_CXX11
/*!
* Moves \a l into the \e StringList.
* Moves \a l into this StringList.
*
* \note Not available unless TAGLIB_USE_CXX11 macro is defined.
*/
StringList &operator=(StringList &&l);