diff --git a/sflphone-client-gnome/src/dbus/configurationmanager-introspec.xml b/sflphone-client-gnome/src/dbus/configurationmanager-introspec.xml index 66a92c3c14d585e896f497327617244526c50b5b..fd0ce183b1f0b4e5819ee130a8a6dd2414e81983 100755 --- a/sflphone-client-gnome/src/dbus/configurationmanager-introspec.xml +++ b/sflphone-client-gnome/src/dbus/configurationmanager-introspec.xml @@ -511,7 +511,7 @@ </arg> </method> - <method name="setAudioRingtoneDevice" tp:name-for-binding="setAudioRingtoneDevice"> + <method name="setAudioRingtoneDevice" tp:name-for-bindings="setAudioRingtoneDevice"> <tp:docstring> </tp:docstring> <arg type="i" name="index" direction="in"> @@ -572,12 +572,12 @@ </arg> </method> - <method name="setEchoCancelState" tp:name-for-binding="setEchoCancelState"> + <method name="setEchoCancelState" tp:name-for-bindings="setEchoCancelState"> <arg type="s" name="state" direction="in"> </arg> </method> - <method name="setEchoCancelTailLength" tp:name-for-binding="setEchoCancelTailLength"> + <method name="setEchoCancelTailLength" tp:name-for-bindings="setEchoCancelTailLength"> <tp:docstring> </tp:docstring> <arg type="i" name="index" direction="in"> @@ -586,7 +586,7 @@ </arg> </method> - <method name="getEchoCancelTailLength" tp:name-for-binding="getEchoCancelTailLength"> + <method name="getEchoCancelTailLength" tp:name-for-bindings="getEchoCancelTailLength"> <tp:docstring> </tp:docstring> <arg type="i" name="index" direction="out"> @@ -595,14 +595,14 @@ </arg> </method> - <method name="setEchoCancelDelay" tp:name-for-binding="setEchoCancelTailLength"> + <method name="setEchoCancelDelay" tp:name-for-bindings="setEchoCancelDelay"> <tp:docstring> </tp:docstring> <arg type="i" name="index" direction="in"> </arg> </method> - <method name="getEchoCancelDelay" tp:name-for-binding="getEchoCancelTailLength"> + <method name="getEchoCancelDelay" tp:name-for-bindings="getEchoCancelDelay"> <tp:docstring> </tp:docstring> <arg type="i" name="index" direction="out"> @@ -619,7 +619,7 @@ </arg> </method> - <method name="setNoiseSuppressState" tp:name-for-binding="setNoiseSuppressState"> + <method name="setNoiseSuppressState" tp:name-for-bindings="setNoiseSuppressState"> <arg type="s" name="state" direction="in"> </arg> </method> diff --git a/sflphone-common/configure.ac b/sflphone-common/configure.ac index c80347297bbeabc9340cddea61ff3a5c2f50625b..d6e761074ff1c040d99fac0ab80fbe0a33735c80 100644 --- a/sflphone-common/configure.ac +++ b/sflphone-common/configure.ac @@ -35,7 +35,6 @@ dnl AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h]) AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([libs/Makefile \ libs/utilspp/Makefile \ - libs/utilspp/functor/Makefile \ libs/utilspp/singleton/Makefile \ libs/dbus-c++/Makefile \ libs/dbus-c++/src/Makefile \ diff --git a/sflphone-common/libs/utilspp/EmptyType.hpp b/sflphone-common/libs/utilspp/EmptyType.hpp deleted file mode 100644 index 1b0b3378e01781992a58d91356920595418402d5..0000000000000000000000000000000000000000 --- a/sflphone-common/libs/utilspp/EmptyType.hpp +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef UTILSPP_EMPTYTYPE_HPP -#define UTILSPP_EMPTYTYPE_HPP - -namespace utilspp -{ - struct EmptyType {}; -} - -#endif diff --git a/sflphone-common/libs/utilspp/Functors.hpp b/sflphone-common/libs/utilspp/Functors.hpp deleted file mode 100644 index 1751185d962b83c77ee05aa1de71080586b358b5..0000000000000000000000000000000000000000 --- a/sflphone-common/libs/utilspp/Functors.hpp +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef UTILSPP_FUNCTORS_HPP -#define UTILSPP_FUNCTORS_HPP - -#include "functor/Functor.hpp" - -#endif diff --git a/sflphone-common/libs/utilspp/Makefile.am b/sflphone-common/libs/utilspp/Makefile.am index 01bff558414d75132d9819f1628c8574730913b2..2852c54fc302c2f9b9d48e837a62be9f69fd308b 100644 --- a/sflphone-common/libs/utilspp/Makefile.am +++ b/sflphone-common/libs/utilspp/Makefile.am @@ -1,16 +1,10 @@ -SUBDIRS = functor singleton +SUBDIRS = singleton noinst_LTLIBRARIES = libutilspp.la libutilspp_la_SOURCES = \ - EmptyType.hpp \ - Functors.hpp \ - NonCopyable.hpp \ NullType.hpp \ Singleton.hpp \ - SmartPtr.hpp \ - ThreadingFactoryMutex.hpp ThreadingFactoryMutex.inl \ - ThreadingSingle.hpp ThreadingSingle.inl \ - TypeList.hpp + ThreadingSingle.hpp ThreadingSingle.inl libutilspp_la_LIBADD = ./singleton/libsingleton.la diff --git a/sflphone-common/libs/utilspp/NonCopyable.hpp b/sflphone-common/libs/utilspp/NonCopyable.hpp deleted file mode 100644 index 2a684d136c22a130928204131f70802688c10253..0000000000000000000000000000000000000000 --- a/sflphone-common/libs/utilspp/NonCopyable.hpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef UTILSPP_NONCOPYABLE_HPP -#define UTILSPP_NONCOPYABLE_HPP - -namespace utilspp -{ - class NonCopyable - { - protected: - NonCopyable() - {} - ~NonCopyable() - {} - - private: - NonCopyable(const NonCopyable&); - const NonCopyable& operator=(const NonCopyable&); - }; -} - -#endif diff --git a/sflphone-common/libs/utilspp/SmartPtr.hpp b/sflphone-common/libs/utilspp/SmartPtr.hpp deleted file mode 100644 index b621bb74e625ad6f28f2fc933e7fee250b0c9dd2..0000000000000000000000000000000000000000 --- a/sflphone-common/libs/utilspp/SmartPtr.hpp +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef UTILSPP_SMARTPTR_HPP -#define UTILSPP_SMARTPTR_HPP - -#include <stdexcept> -#include "NonCopyable.hpp" - -#define NULL_BODY_ERROR "the smart pointer contain a NULL pointer" - -namespace utilspp -{ - - template < typename Type = unsigned int > - class FastCount - { - public: - FastCount(Type count = 1) : mCount(count) - {} - - FastCount &operator++() - { - mCount++; - return *this; - } - - FastCount &operator--() - { - mCount--; - return *this; - } - - operator Type() - { - return mCount; - } - - Type useCount() - { - return mCount; - } - - private: - Type mCount; - }; - - - template < typename ContentType, typename CountPolicy = FastCount > - class CountingBody : public utilspp::NonCopyable - { - public: - CountingBody(ContentType *body) : mBody(body) - {} - - void inc() - { - ++mCount; - } - - void dec() - { - --mCount; - if (mCount <= 0) { - delete this; - } - } - - ContentType *get() - { - return mBody; - } - - protected: - ~CountingBody() - { - if (mBody != NULL) { - delete mBody; - mBody = NULL; - } - } - - private: - CountPolicy mCount; - ContentType *mBody; - }; - - - template < typename ContentType, typename CountingBodyPolicy = CountingBody> - class SharedPtr - { - public: - SharedPtr() : mContent(new CountingPolicy< ContentType >(NULL)) - {} - - explicit SharedPtr(ContentType *content) : mContent(new CountingBodyPolicy< ContentType >(content)) - {} - - ~SharedPtr() - { - mContent->dec(); - } - - SharedPtr(const SharedPtr &other) : mContent(other.mContent) - { - mContent->inc(); - } - - SharedPtr& operator=(const SharedPtr &other) - { - if(mContent->get() != other.mContent->get()) { - mContent->dec(); - mContent = other.mContent; - mContent->inc(); - } - return ( *this ); - } - - SharedPtr& operator=(ContentType *content) - { - mContent--; - mContent = new CountingBodyPolicy< ContentType >(content); - } - - bool operator==(const SharedPtr &other) const - { - return (mContent->get() == other.mContent->get()); - } - - bool operator!=(const SharedPtr &other) const - { - return (mContent->get() != other.mContent->get()); - } - - bool operator<(const SharedPtr &other) const - { - return (mContent->get() < other.mContent->get()); - } - - operator ContentType*() - { - return mContent->get(); - } - - ContentType& operator*() - { - if(mContent->get() == NULL) { - throw std::runtime_error(NULL_BODY_ERROR); - } - return *mContent->get(); - } - - ContentType* operator->() - { - if(mContent->get() == NULL) { - throw std::runtime_error(NULL_BODY_ERROR); - } - return mContent->get(); - } - - private: - CountingBodyPolicy * mContent; - }; -} - -#endif diff --git a/sflphone-common/libs/utilspp/ThreadingFactoryMutex.hpp b/sflphone-common/libs/utilspp/ThreadingFactoryMutex.hpp deleted file mode 100644 index 4ded82e7adf2cbb0f8d76267542e503ec5d5bf7d..0000000000000000000000000000000000000000 --- a/sflphone-common/libs/utilspp/ThreadingFactoryMutex.hpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef THREADING_FACTORY_MUTEX_HPP -#define THREADING_FACTORY_MUTEX_HPP - -namespace utilspp -{ - template < typename T > - struct ThreadingFactoryMutex - { - struct lock - { - lock(); - lock( const T & ); - }; - - typedef T VolatileType; - }; -} - -#include "ThreadingFactoryMutex.inl" - -#endif diff --git a/sflphone-common/libs/utilspp/ThreadingFactoryMutex.inl b/sflphone-common/libs/utilspp/ThreadingFactoryMutex.inl deleted file mode 100644 index c9a9f62fbdb9ab4b40e6f5fab2c91e25f60db302..0000000000000000000000000000000000000000 --- a/sflphone-common/libs/utilspp/ThreadingFactoryMutex.inl +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef THREADING_FACTORY_MUTEX_INL -#define THREADING_FACTORY_MUTEX_INL - -template< typename T > -inline -utilspp::ThreadingSingle< T >::lock::lock() -{}; - -template< typename T > -inline -utilspp::ThreadingSingle< T >::lock::lock( const T & ) -{}; - -#endif \ No newline at end of file diff --git a/sflphone-common/libs/utilspp/TypeList.hpp b/sflphone-common/libs/utilspp/TypeList.hpp deleted file mode 100644 index 879fc364cbff18592901ba1f5f6d83eebeb68d25..0000000000000000000000000000000000000000 --- a/sflphone-common/libs/utilspp/TypeList.hpp +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef TYPE_LIST_HPP -#define TYPE_LIST_HPP - -#include "NullType.hpp" - - - -#define TYPE_LIST_1( T1 ) utilspp::tl::TypeList< T1, utilspp::NullType > -#define TYPE_LIST_2( T1, T2 ) ::utilspp::tl::TypeList< T1, TYPE_LIST_1( T2 ) > -#define TYPE_LIST_3( T1, T2, T3 ) ::utilspp::tl::TypeList< T1, TYPE_LIST_2( T2, T3 ) > -#define TYPE_LIST_4( T1, T2, T3, T4 ) ::utilspp::tl::TypeList< T1, TYPE_LIST_3( T2, T3, T4 ) > -#define TYPE_LIST_5( T1, T2, T3, T4, T5 ) \ - ::utilspp::tl::TypeList< T1, TYPE_LIST_4( T2, T3, T4, T5 ) > -#define TYPE_LIST_6( T1, T2, T3, T4, T5, T6 ) \ - ::utilspp::tl::TypeList< T1, TYPE_LIST_5( T2, T3, T4, T5, T6 ) > -#define TYPE_LIST_7( T1, T2, T3, T4, T5, T6, T7 ) \ - ::utilspp::tl::TypeList< T1, TYPE_LIST_6( T2, T3, T4, T5, T6, T7 ) > -#define TYPE_LIST_8( T1, T2, T3, T4, T5, T6, T7, T8 ) \ - ::utilspp::tl::TypeList< T1, TYPE_LIST_7( T2, T3, T4, T5, T6, T7, T8 ) > -#define TYPE_LIST_9( T1, T2, T3, T4, T5, T6, T7, T8, T9 ) \ - ::utilspp::tl::TypeList< T1, TYPE_LIST_8( T2, T3, T4, T5, T6, T7, T8, T9 ) > -#define TYPE_LIST_10( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 ) \ - ::utilspp::tl::TypeList< T1, TYPE_LIST_9( T2, T3, T4, T5, T6, T7, T8, T9, T10 ) > -#define TYPE_LIST_11( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11 ) \ - ::utilspp::tl::TypeList< T1, TYPE_LIST_10( T2, T3, T4, T5, T6, T7, T8, T9, T10, T11 ) > -#define TYPE_LIST_12( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12 ) \ - ::utilspp::tl::TypeList< T1, TYPE_LIST_11( T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12 ) > -#define TYPE_LIST_13( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13 ) \ - ::utilspp::tl::TypeList< T1, TYPE_LIST_12( T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13 ) > -#define TYPE_LIST_14( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 ) \ - ::utilspp::tl::TypeList< T1, TYPE_LIST_13( T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 ) > -#define TYPE_LIST_15( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 ) \ - ::utilspp::tl::TypeList< T1, TYPE_LIST_14( T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 ) > - - -namespace utilspp -{ - namespace tl - { - template< class T, class U > - struct TypeList - { - typedef T head; - typedef U tail; - }; - - //Calculating length of TypeLists - template< class TList > - struct length; - - template<> - struct length< NullType > - { - enum { value = 0 }; - }; - - template< class T, class U > - struct length< TypeList< T, U > > - { - enum { value = 1 + length< U >::value }; - }; - - /** - * Returns the type at a given position (zero-based) - * in TList. If the index is greather than or equal to - * the length of TList, a compile-time error occurs. - */ - template< class TList, unsigned int index > - struct TypeAt; - - template< class THead, class TTail > - struct TypeAt< TypeList< THead, TTail >, 0 > - { - typedef THead Result; - }; - - template< class THead, class TTail, unsigned int i > - struct TypeAt< TypeList< THead, TTail >, i > - { - typedef typename TypeAt< TTail, i - 1 >::Result Result; - }; - - /** - * Returns the type at a given position (zero-based) - * in TList. If the index is greather than or equal to - * the length of TList, OutOfBound template class is - * returned. - */ - template< class TList, unsigned int index, class OutOfBound = utilspp::NullType > - struct TypeAtNonStrict; - - template< class THead, class TTail, class OutOfBound > - struct TypeAtNonStrict< TypeList< THead, TTail >, 0, OutOfBound > - { - typedef THead Result; - }; - - template< class THead, class TTail, unsigned int i, class OutOfBound > - struct TypeAtNonStrict< TypeList< THead, TTail >, i, OutOfBound > - { - typedef typename TypeAtNonStrict< TTail, i - 1 >::Result Result; - }; - - template< unsigned int i, class OutOfBound > - struct TypeAtNonStrict< utilspp::NullType, i , OutOfBound> - { - typedef OutOfBound Result; - }; - - - //Searching TypeLists - template< class TList, class T > - struct IndexOf; - - template< class T > - struct IndexOf< NullType, T > - { - enum { value = -1 }; - }; - - template< class TTail, class T > - struct IndexOf< TypeList< T, TTail >, T > - { - enum { value = 0 }; - }; - - template< class THead, class TTail, class T > - struct IndexOf< TypeList< THead, TTail >, T > - { - private: - enum { temp = IndexOf< TTail, T >::value }; - - public: - enum { value = temp == -1 ? -1 : 1 + temp }; - }; - - //Appending to TypeLists - template< class TList, class T > - struct append; - - template <> - struct append< NullType, NullType > - { - typedef NullType Result; - }; - - template< class T > - struct append< NullType, T > - { - typedef TYPE_LIST_1( T ) Result; - }; - - template< class THead, class TTail > - struct append< NullType, TypeList< THead, TTail > > - { - typedef TypeList< THead, TTail > Result; - }; - - template < class THead, class TTail, class T > - struct append< TypeList< THead, TTail >, T > - { - typedef TypeList< THead, typename append< TTail, T >::Result > - Result; - }; - - //Erasing a type from a TypeList - template< class TList, class T > - struct erase; - - template< class T > - struct erase< NullType, T > - { - typedef NullType Result; - }; - - template< class T, class TTail > - struct erase< TypeList< T, TTail >, T > - { - typedef TTail Result; - }; - - template< class THead, class TTail, class T > - struct erase< TypeList< THead, TTail >, T > - { - typedef TypeList< THead, typename erase< TTail, T >::Result > - Result; - }; - }; -} - - -#endif - diff --git a/sflphone-common/libs/utilspp/TypeTrait.hpp b/sflphone-common/libs/utilspp/TypeTrait.hpp deleted file mode 100644 index 926b197f9eba480c80b382b0ee1cd43c7b53621d..0000000000000000000000000000000000000000 --- a/sflphone-common/libs/utilspp/TypeTrait.hpp +++ /dev/null @@ -1,916 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef UTILSPP_TYPETRAIT_HPP -#define UTILSPP_TYPETRAIT_HPP - -#include "NullType.hpp" - -namespace utilspp -{ - template< typename T > - class TypeTrait - { - private: - template< typename U > - struct unreference - { - typedef U type; - }; - - template< typename U > - struct unreference< U & > - { - typedef U type; - }; - - template< typename U > - struct unconst - { - typedef U type; - }; - - template< typename U > - struct unconst< const U > - { - typedef U type; - }; - - public: - typedef typename unreference< T >::type NonReference; - typedef typename unconst< T >::type NonConst; - typedef typename unconst< unreference< T >::type >::type NonParam; - }; - - template< class T > - struct PointerOnMemberFunction - { - typedef utilspp::NullType ClassType; - typedef utilspp::NullType ReturnType; - typedef utilspp::NullType Param1Type; - typedef utilspp::NullType Param2Type; - typedef utilspp::NullType Param3Type; - typedef utilspp::NullType Param4Type; - typedef utilspp::NullType Param5Type; - typedef utilspp::NullType Param6Type; - typedef utilspp::NullType Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef utilspp::NullType ParamList; - }; - - template< typename V, typename W > - struct PointerOnMemberFunction< W(V::*)() > - { - typedef V ClassType; - typedef W ReturnType; - - typedef utilspp::NullType Param1Type; - typedef utilspp::NullType Param2Type; - typedef utilspp::NullType Param3Type; - typedef utilspp::NullType Param4Type; - typedef utilspp::NullType Param5Type; - typedef utilspp::NullType Param6Type; - typedef utilspp::NullType Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef utilspp::NullType ParamList; - }; - - template< typename V, typename W, typename X > - struct PointerOnMemberFunction< W(V::*)(X) > - { - typedef V ClassType; - typedef W ReturnType; - typedef X ParamType; - typedef utilspp::NullType Param2Type; - typedef utilspp::NullType Param3Type; - typedef utilspp::NullType Param4Type; - typedef utilspp::NullType Param5Type; - typedef utilspp::NullType Param6Type; - typedef utilspp::NullType Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_1(X) ParamList; - }; - - template< typename V, typename W, typename X, typename Y > - struct PointerOnMemberFunction< W(V::*)(X, Y) > - { - typedef V ClassType; - typedef W ReturnType; - typedef X ParamType; - typedef Y Param2Type; - typedef utilspp::NullType Param3Type; - typedef utilspp::NullType Param4Type; - typedef utilspp::NullType Param5Type; - typedef utilspp::NullType Param6Type; - typedef utilspp::NullType Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_2(X, Y) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z > - struct PointerOnMemberFunction< W(V::*)(X, Y, Z) > - { - typedef V ClassType; - typedef W ReturnType; - typedef X ParamType; - typedef Y Param2Type; - typedef Z Param3Type; - typedef utilspp::NullType Param4Type; - typedef utilspp::NullType Param5Type; - typedef utilspp::NullType Param6Type; - typedef utilspp::NullType Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_3(X, Y, Z) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z > - struct PointerOnMemberFunction< W(V::*)(X, Y, Z) > - { - typedef V ClassType; - typedef W ReturnType; - typedef X ParamType; - typedef Y Param2Type; - typedef Z Param3Type; - typedef utilspp::NullType Param4Type; - typedef utilspp::NullType Param5Type; - typedef utilspp::NullType Param6Type; - typedef utilspp::NullType Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_3(X, Y, Z) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z > - struct PointerOnMemberFunction< W(V::*)(X, Y, Z) > - { - typedef V ClassType; - typedef W ReturnType; - typedef X ParamType; - typedef Y Param2Type; - typedef Z Param3Type; - typedef utilspp::NullType Param4Type; - typedef utilspp::NullType Param5Type; - typedef utilspp::NullType Param6Type; - typedef utilspp::NullType Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_3(X, Y, Z) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A > - struct PointerOnMemberFunction< W(V::*)(X, Y, Z, A) > - { - typedef V ClassType; - typedef W ReturnType; - typedef X ParamType; - typedef Y Param2Type; - typedef Z Param3Type; - typedef A Param4Type; - typedef utilspp::NullType Param5Type; - typedef utilspp::NullType Param6Type; - typedef utilspp::NullType Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_4(X, Y, Z, A) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B > - struct PointerOnMemberFunction< W(V::*)(X, Y, Z, A, B) > - { - typedef V ClassType; - typedef W ReturnType; - typedef X ParamType; - typedef Y Param2Type; - typedef Z Param3Type; - typedef A Param4Type; - typedef B Param5Type; - typedef utilspp::NullType Param6Type; - typedef utilspp::NullType Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_5(X, Y, Z, A, B) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B, typename C > - struct PointerOnMemberFunction< W(V::*)(X, Y, Z, A, B, C) > - { - typedef V ClassType; - typedef W ReturnType; - typedef X Param1Type; - typedef Y Param2Type; - typedef Z Param3Type; - typedef A Param4Type; - typedef B Param5Type; - typedef C Param6Type; - typedef utilspp::NullType Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_6(X, Y, Z, A, B, C) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B, typename C, typename D > - struct PointerOnMemberFunction< W(V::*)(X, Y, Z, A, B, C, D) > - { - typedef V ClassType; - typedef W ReturnType; - typedef X Param1Type; - typedef Y Param2Type; - typedef Z Param3Type; - typedef A Param4Type; - typedef B Param5Type; - typedef C Param6Type; - typedef D Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_7(X, Y, Z, A, B, C, D) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B, typename C, typename D, typename E > - struct PointerOnMemberFunction< W(V::*)(X, Y, Z, A, B, C, D, E) > - { - typedef V ClassType; - typedef W ReturnType; - typedef X Param1Type; - typedef Y Param2Type; - typedef Z Param3Type; - typedef A Param4Type; - typedef B Param5Type; - typedef C Param6Type; - typedef D Param7Type; - typedef E Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_8(X, Y, Z, A, B, C, D, E) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B, typename C, typename D, typename E, typename F > - struct PointerOnMemberFunction< W(V::*)(X, Y, Z, A, B, C, D, E, F) > - { - typedef V ClassType; - typedef W ReturnType; - typedef X Param1Type; - typedef Y Param2Type; - typedef Z Param3Type; - typedef A Param4Type; - typedef B Param5Type; - typedef C Param6Type; - typedef D Param7Type; - typedef E Param8Type; - typedef F Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_9(X, Y, Z, A, B, C, D, E, F) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B, typename C, typename D, typename E, typename F, typename G > - struct PointerOnMemberFunction< W(V::*)(X, Y, Z, A, B, C, D, E, F, G) > - { - typedef V ClassType; - typedef W ReturnType; - typedef X Param1Type; - typedef Y Param2Type; - typedef Z Param3Type; - typedef A Param4Type; - typedef B Param5Type; - typedef C Param6Type; - typedef D Param7Type; - typedef E Param8Type; - typedef F Param9Type; - typedef G Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_10(X, Y, Z, A, B, C, D, E, F, G) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H > - struct PointerOnMemberFunction< W(V::*)(X, Y, Z, A, B, C, D, E, F, G, H) > - { - typedef V ClassType; - typedef W ReturnType; - typedef X Param1Type; - typedef Y Param2Type; - typedef Z Param3Type; - typedef A Param4Type; - typedef B Param5Type; - typedef C Param6Type; - typedef D Param7Type; - typedef E Param8Type; - typedef F Param9Type; - typedef G Param10Type; - typedef H Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_11(X, Y, Z, A, B, C, D, E, F, G, H) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I > - struct PointerOnMemberFunction< W(V::*)(X, Y, Z, A, B, C, D, E, F, G, H, I) > - { - typedef V ClassType; - typedef W ReturnType; - typedef X Param1Type; - typedef Y Param2Type; - typedef Z Param3Type; - typedef A Param4Type; - typedef B Param5Type; - typedef C Param6Type; - typedef D Param7Type; - typedef E Param8Type; - typedef F Param9Type; - typedef G Param10Type; - typedef H Param11Type; - typedef I Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_12(X, Y, Z, A, B, C, D, E, F, G, H, I) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J > - struct PointerOnMemberFunction< W(V::*)(X, Y, Z, A, B, C, D, E, F, G, H, I, J) > - { - typedef V ClassType; - typedef W ReturnType; - typedef X Param1Type; - typedef Y Param2Type; - typedef Z Param3Type; - typedef A Param4Type; - typedef B Param5Type; - typedef C Param6Type; - typedef D Param7Type; - typedef E Param8Type; - typedef F Param9Type; - typedef G Param10Type; - typedef H Param11Type; - typedef I Param12Type; - typedef J Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_13(X, Y, Z, A, B, C, D, E, F, G, H, I, J) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K > - struct PointerOnMemberFunction< W(V::*)(X, Y, Z, A, B, C, D, E, F, G, H, I, J, K) > - { - typedef V ClassType; - typedef W ReturnType; - typedef X Param1Type; - typedef Y Param2Type; - typedef Z Param3Type; - typedef A Param4Type; - typedef B Param5Type; - typedef C Param6Type; - typedef D Param7Type; - typedef E Param8Type; - typedef F Param9Type; - typedef G Param10Type; - typedef H Param11Type; - typedef I Param12Type; - typedef J Param13Type; - typedef K Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_14(X, Y, Z, A, B, C, D, E, F, G, H, I, J, K) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K, typename L > - struct PointerOnMemberFunction< W(V::*)(X, Y, Z, A, B, C, D, E, F, G, H, I, J, K, L) > - { - typedef V ClassType; - typedef W ReturnType; - typedef X Param1Type; - typedef Y Param2Type; - typedef Z Param3Type; - typedef A Param4Type; - typedef B Param5Type; - typedef C Param6Type; - typedef D Param7Type; - typedef E Param8Type; - typedef F Param9Type; - typedef G Param10Type; - typedef H Param11Type; - typedef I Param12Type; - typedef J Param13Type; - typedef K Param14Type; - typedef L Param15Type; - - typedef TYPE_LIST_15(X, Y, Z, A, B, C, D, E, F, G, H, I, J, K, L) ParamList; - }; - - template< typename T > - struct PointerOnFunction - { - typedef utilspp::NullType ReturnType; - - typedef utilspp::NullType Param1Type; - typedef utilspp::NullType Param2Type; - typedef utilspp::NullType Param3Type; - typedef utilspp::NullType Param4Type; - typedef utilspp::NullType Param5Type; - typedef utilspp::NullType Param6Type; - typedef utilspp::NullType Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef utilspp::NullType ParamList; - }; - - template< typename V > - struct PointerOnFunction< V(*)() > - { - typedef V ReturnType; - typedef utilspp::NullType Param1Type; - typedef utilspp::NullType Param2Type; - typedef utilspp::NullType Param3Type; - typedef utilspp::NullType Param4Type; - typedef utilspp::NullType Param5Type; - typedef utilspp::NullType Param6Type; - typedef utilspp::NullType Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef utilspp::NullType ParamList; - }; - - template< typename V, typename W > - struct PointerOnFunction< V(*)(W) > - { - typedef V ReturnType; - typedef W Param1Type; - typedef utilspp::NullType Param2Type; - typedef utilspp::NullType Param3Type; - typedef utilspp::NullType Param4Type; - typedef utilspp::NullType Param5Type; - typedef utilspp::NullType Param6Type; - typedef utilspp::NullType Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_1(W) ParamList; - }; - - template< typename V, typename W, typename X > - struct PointerOnFunction< V(*)(W, X) > - { - typedef V ReturnType; - typedef W Param1Type; - typedef X Param2Type; - typedef utilspp::NullType Param3Type; - typedef utilspp::NullType Param4Type; - typedef utilspp::NullType Param5Type; - typedef utilspp::NullType Param6Type; - typedef utilspp::NullType Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_2(W, X) ParamList; - }; - - template< typename V, typename W, typename X, typename Y > - struct PointerOnFunction< V(*)(W, X, Y) > - { - typedef V ReturnType; - typedef W Param1Type; - typedef X Param2Type; - typedef Y Param3Type; - typedef utilspp::NullType Param4Type; - typedef utilspp::NullType Param5Type; - typedef utilspp::NullType Param6Type; - typedef utilspp::NullType Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_3(W, X, Y) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z > - struct PointerOnFunction< V(*)(W, X, Y, Z) > - { - typedef V ReturnType; - typedef W Param1Type; - typedef X Param2Type; - typedef Y Param3Type; - typedef Z Param4Type; - typedef utilspp::NullType Param5Type; - typedef utilspp::NullType Param6Type; - typedef utilspp::NullType Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_4(W, X, Y, Z) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A > - struct PointerOnFunction< V(*)(W, X, Y, Z, A) > - { - typedef V ReturnType; - typedef W Param1Type; - typedef X Param2Type; - typedef Y Param3Type; - typedef Z Param4Type; - typedef A Param5Type; - typedef utilspp::NullType Param6Type; - typedef utilspp::NullType Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_5(W, X, Y, Z, A) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B > - struct PointerOnFunction< V(*)(W, X, Y, Z, A, B) > - { - typedef V ReturnType; - typedef W Param1Type; - typedef X Param2Type; - typedef Y Param3Type; - typedef Z Param4Type; - typedef A Param5Type; - typedef B Param6Type; - typedef utilspp::NullType Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_6(W, X, Y, Z, A, B) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B, typename C > - struct PointerOnFunction< V(*)(W, X, Y, Z, A, B, C) > - { - typedef V ReturnType; - typedef W Param1Type; - typedef X Param2Type; - typedef Y Param3Type; - typedef Z Param4Type; - typedef A Param5Type; - typedef B Param6Type; - typedef C Param7Type; - typedef utilspp::NullType Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_7(W, X, Y, Z, A, B, C) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B, typename C, typename D > - struct PointerOnFunction< V(*)(W, X, Y, Z, A, B, C, D) > - { - typedef V ReturnType; - typedef W Param1Type; - typedef X Param2Type; - typedef Y Param3Type; - typedef Z Param4Type; - typedef A Param5Type; - typedef B Param6Type; - typedef C Param7Type; - typedef D Param8Type; - typedef utilspp::NullType Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_8(W, X, Y, Z, A, B, C, D) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B, typename C, typename D, typename E > - struct PointerOnFunction< V(*)(W, X, Y, Z, A, B, C, D, E) > - { - typedef V ReturnType; - typedef W Param1Type; - typedef X Param2Type; - typedef Y Param3Type; - typedef Z Param4Type; - typedef A Param5Type; - typedef B Param6Type; - typedef C Param7Type; - typedef D Param8Type; - typedef E Param9Type; - typedef utilspp::NullType Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_9(W, X, Y, Z, A, B, C, D, E) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B, typename C, typename D, typename E, typename F > - struct PointerOnFunction< V(*)(W, X, Y, Z, A, B, C, D, E, F) > - { - typedef V ReturnType; - typedef W Param1Type; - typedef X Param2Type; - typedef Y Param3Type; - typedef Z Param4Type; - typedef A Param5Type; - typedef B Param6Type; - typedef C Param7Type; - typedef D Param8Type; - typedef E Param9Type; - typedef F Param10Type; - typedef utilspp::NullType Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_10(W, X, Y, Z, A, B, C, D, E, F) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B, typename C, typename D, typename E, typename F, typename G > - struct PointerOnFunction< V(*)(W, X, Y, Z, A, B, C, D, E, F, G) > - { - typedef V ReturnType; - typedef W Param1Type; - typedef X Param2Type; - typedef Y Param3Type; - typedef Z Param4Type; - typedef A Param5Type; - typedef B Param6Type; - typedef C Param7Type; - typedef D Param8Type; - typedef E Param9Type; - typedef F Param10Type; - typedef G Param11Type; - typedef utilspp::NullType Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_11(W, X, Y, Z, A, B, C, D, E, F, G) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H > - struct PointerOnFunction< V(*)(W, X, Y, Z, A, B, C, D, E, F, G, H) > - { - typedef V ReturnType; - typedef W Param1Type; - typedef X Param2Type; - typedef Y Param3Type; - typedef Z Param4Type; - typedef A Param5Type; - typedef B Param6Type; - typedef C Param7Type; - typedef D Param8Type; - typedef E Param9Type; - typedef F Param10Type; - typedef G Param11Type; - typedef H Param12Type; - typedef utilspp::NullType Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_12(W, X, Y, Z, A, B, C, D, E, F, G, H) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I > - struct PointerOnFunction< V(*)(W, X, Y, Z, A, B, C, D, E, F, G, H, I) > - { - typedef V ReturnType; - typedef W Param1Type; - typedef X Param2Type; - typedef Y Param3Type; - typedef Z Param4Type; - typedef A Param5Type; - typedef B Param6Type; - typedef C Param7Type; - typedef D Param8Type; - typedef E Param9Type; - typedef F Param10Type; - typedef G Param11Type; - typedef H Param12Type; - typedef I Param13Type; - typedef utilspp::NullType Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_13(W, X, Y, Z, A, B, C, D, E, F, G, H, I ) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J > - struct PointerOnFunction< V(*)(W, X, Y, Z, A, B, C, D, E, F, G, H, I, J) > - { - typedef V ReturnType; - typedef W Param1Type; - typedef X Param2Type; - typedef Y Param3Type; - typedef Z Param4Type; - typedef A Param5Type; - typedef B Param6Type; - typedef C Param7Type; - typedef D Param8Type; - typedef E Param9Type; - typedef F Param10Type; - typedef G Param11Type; - typedef H Param12Type; - typedef I Param13Type; - typedef J Param14Type; - typedef utilspp::NullType Param15Type; - - typedef TYPE_LIST_14(W, X, Y, Z, A, B, C, D, E, F, G, H, I, J ) ParamList; - }; - - template< typename V, typename W, typename X, typename Y, typename Z, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K > - struct PointerOnFunction< V(*)(W, X, Y, Z, A, B, C, D, E, F, G, H, I, J, K) > - { - typedef V ReturnType; - typedef W Param1Type; - typedef X Param2Type; - typedef Y Param3Type; - typedef Z Param4Type; - typedef A Param5Type; - typedef B Param6Type; - typedef C Param7Type; - typedef D Param8Type; - typedef E Param9Type; - typedef F Param10Type; - typedef G Param11Type; - typedef H Param12Type; - typedef I Param13Type; - typedef J Param14Type; - typedef K Param15Type; - - typedef TYPE_LIST_15(W, X, Y, Z, A, B, C, D, E, F, G, H, I, J, K) ParamList; - }; - -} - -#endif diff --git a/sflphone-common/libs/utilspp/functor/Binder.hpp b/sflphone-common/libs/utilspp/functor/Binder.hpp deleted file mode 100644 index 6bd34cfe36e0f91fb42a38b2f4cd1f6d19c3f4d7..0000000000000000000000000000000000000000 --- a/sflphone-common/libs/utilspp/functor/Binder.hpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef CURLPP_BINDER_HPP -#define CURLPP_BINDER_HPP - -namespace utilspp -{ - template< typename Incoming > - class BinderFirst : FunctorImpl< typename Incoming::ResultType, - typename Incoming::ParamList::Tail > - { - typedef utilspp::Functor< typename Incoming::ResultType, typename Incoming::ParamList::Tail > Outgoing; - typedef typename Incoming::Parm1 Bound; - typedef typename Incoming::ResultType ResultType; - - public: - BinderFirst(const Incoming& fun, Bound bound) - : mFun(fun), mBound(bound) - {} - - BinderFirst* clone() const - {return new BinderFirst(*this);} - - ResultType operator()() - {return mFun(mBound)();} - - ResultType operator()(typename Outgoing::Parm1 p1) - {return mFun(mBound, p1);} - - ResultType operator()(typename Outgoing::Parm1 p1, typename Outgoing::Parm2 p2) - {return mFun(mBound, p1, p2);} - - ResultType operator()(typename Outgoing::Parm1 p1, typename Outgoing::Parm2 p2, typename Outgoing::Parm3 p3) - {return mFun(mBound, p1, p2, p3);} - - ResultType operator()(typename Outgoing::Parm1 p1, typename Outgoing::Parm2 p2, typename Outgoing::Parm3 p3, typename Outgoing::Parm4 p4) - {return mFun(mBound, p1, p2, p3, p4);} - - ResultType operator()(typename Outgoing::Parm1 p1, typename Outgoing::Parm2 p2, typename Outgoing::Parm3 p3, typename Outgoing::Parm4 p4, typename Outgoing::Parm5 p5) - {return mFun(mBound, p1, p2, p3, p4, p5);} - - ResultType operator()(typename Outgoing::Parm1 p1, typename Outgoing::Parm2 p2, typename Outgoing::Parm3 p3, typename Outgoing::Parm4 p4, typename Outgoing::Parm5 p5, typename Outgoing::Parm6 p6) - {return mFun(mBound, p1, p2, p3, p4, p5, p6);} - - ResultType operator()(typename Outgoing::Parm1 p1, typename Outgoing::Parm2 p2, typename Outgoing::Parm3 p3, typename Outgoing::Parm4 p4, typename Outgoing::Parm5 p5, typename Outgoing::Parm6 p6, typename Outgoing::Parm7 p7) - {return mFun(mBound, p1, p2, p3, p4, p5, p6, p7);} - - ResultType operator()(typename Outgoing::Parm1 p1, typename Outgoing::Parm2 p2, typename Outgoing::Parm3 p3, typename Outgoing::Parm4 p4, typename Outgoing::Parm5 p5, typename Outgoing::Parm6 p6, typename Outgoing::Parm7 p7, typename Outgoing::Parm8 p8) - {return mFun(mBound, p1, p2, p3, p4, p5, p6, p7, p8);} - - ResultType operator()(typename Outgoing::Parm1 p1, typename Outgoing::Parm2 p2, typename Outgoing::Parm3 p3, typename Outgoing::Parm4 p4, typename Outgoing::Parm5 p5, typename Outgoing::Parm6 p6, typename Outgoing::Parm7 p7, typename Outgoing::Parm8 p8, typename Outgoing::Parm9 p9) - {return mFun(mBound, p1, p2, p3, p4, p5, p6, p7, p8, p9);} - - ResultType operator()(typename Outgoing::Parm1 p1, typename Outgoing::Parm2 p2, typename Outgoing::Parm3 p3, typename Outgoing::Parm4 p4, typename Outgoing::Parm5 p5, typename Outgoing::Parm6 p6, typename Outgoing::Parm7 p7, typename Outgoing::Parm8 p8, typename Outgoing::Parm9 p9, typename Outgoing::Parm10 p10) - {return mFun(mBound, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);} - - ResultType operator()(typename Outgoing::Parm1 p1, typename Outgoing::Parm2 p2, typename Outgoing::Parm3 p3, typename Outgoing::Parm4 p4, typename Outgoing::Parm5 p5, typename Outgoing::Parm6 p6, typename Outgoing::Parm7 p7, typename Outgoing::Parm8 p8, typename Outgoing::Parm9 p9, typename Outgoing::Parm10 p10, typename Outgoing::Parm11 p11) - {return mFun(mBound, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11);} - - ResultType operator()(typename Outgoing::Parm1 p1, typename Outgoing::Parm2 p2, typename Outgoing::Parm3 p3, typename Outgoing::Parm4 p4, typename Outgoing::Parm5 p5, typename Outgoing::Parm6 p6, typename Outgoing::Parm7 p7, typename Outgoing::Parm8 p8, typename Outgoing::Parm9 p9, typename Outgoing::Parm10 p10, typename Outgoing::Parm11 p11, typename Outgoing::Parm12 p12) - {return mFun(mBound, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12);} - - ResultType operator()(typename Outgoing::Parm1 p1, typename Outgoing::Parm2 p2, typename Outgoing::Parm3 p3, typename Outgoing::Parm4 p4, typename Outgoing::Parm5 p5, typename Outgoing::Parm6 p6, typename Outgoing::Parm7 p7, typename Outgoing::Parm8 p8, typename Outgoing::Parm9 p9, typename Outgoing::Parm10 p10, typename Outgoing::Parm11 p11, typename Outgoing::Parm12 p12, typename Outgoing::Parm13 p13) - {return mFun(mBound, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13);} - - ResultType operator()(typename Outgoing::Parm1 p1, typename Outgoing::Parm2 p2, typename Outgoing::Parm3 p3, typename Outgoing::Parm4 p4, typename Outgoing::Parm5 p5, typename Outgoing::Parm6 p6, typename Outgoing::Parm7 p7, typename Outgoing::Parm8 p8, typename Outgoing::Parm9 p9, typename Outgoing::Parm10 p10, typename Outgoing::Parm11 p11, typename Outgoing::Parm12 p12, typename Outgoing::Parm13 p13, typename Outgoing::Parm14 p14) - {return mFun(mBound, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14);} - - private: - Incoming mFun; - Bound mBound; - }; - - template< typename R, class TList > - Functor<R, typename TList::Tail> BindFirst(const Functor<R, TList>& fun, - typename TList::THead bound); -}; - -#include "Binder.inl" - -#endif diff --git a/sflphone-common/libs/utilspp/functor/Binder.inl b/sflphone-common/libs/utilspp/functor/Binder.inl deleted file mode 100644 index a2167a9aaf426a2ab4bc4cd011a1eff34f215631..0000000000000000000000000000000000000000 --- a/sflphone-common/libs/utilspp/functor/Binder.inl +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef CURLPP_BINDER_HPP -#define CURLPP_BINDER_HPP - -template< R, class TList > -utilspp::Functor<R, typename TList::Tail> BindFirst(const Functor<R, TList>& fun, - TList::Head bound) -{ - typedef Functor< R, TList > Incoming; - typedef Functor< R, typename TList::Tail > Outgoing; - - return Outgoing(std::auto_ptr< - typename Outgoing::Impl >(new BinderFirst< Incoming >(fun, bound))); -} - -#endif - diff --git a/sflphone-common/libs/utilspp/functor/Functor.hpp b/sflphone-common/libs/utilspp/functor/Functor.hpp deleted file mode 100644 index e6255fadd281834f7eaa220197c7e4efe0da19e1..0000000000000000000000000000000000000000 --- a/sflphone-common/libs/utilspp/functor/Functor.hpp +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef UTILSPP_FUNCTOR_HPP -#define UTILSPP_FUNCTOR_HPP - -#include <memory> - -#include "../NullType.hpp" -#include "../EmptyType.hpp" -#include "../TypeList.hpp" - -#include "FunctorImpl.hpp" -#include "FunctorHandler.hpp" -#include "MemFunHandler.hpp" - -namespace utilspp -{ - template< typename R, class TList > - class Functor - { - public: - typedef R ResultType; - typedef TList ParmList; - - Functor(const Functor &functor); - Functor& operator=(const Functor &functor); - //explicit Functor(std::auto_ptr< Impl > impl); - template< class Fun > - Functor(Fun fun); - template< class PointerToObj, class MemFun > - Functor(const PointerToObj &obj, MemFun fun); - - typedef typename utilspp::tl::TypeAtNonStrict< TList, 0, utilspp::EmptyType >::Result Parm1; - typedef typename utilspp::tl::TypeAtNonStrict< TList, 1, utilspp::EmptyType >::Result Parm2; - typedef typename utilspp::tl::TypeAtNonStrict< TList, 2, utilspp::EmptyType >::Result Parm3; - typedef typename utilspp::tl::TypeAtNonStrict< TList, 3, utilspp::EmptyType >::Result Parm4; - typedef typename utilspp::tl::TypeAtNonStrict< TList, 4, utilspp::EmptyType >::Result Parm5; - typedef typename utilspp::tl::TypeAtNonStrict< TList, 5, utilspp::EmptyType >::Result Parm6; - typedef typename utilspp::tl::TypeAtNonStrict< TList, 6, utilspp::EmptyType >::Result Parm7; - typedef typename utilspp::tl::TypeAtNonStrict< TList, 7, utilspp::EmptyType >::Result Parm8; - typedef typename utilspp::tl::TypeAtNonStrict< TList, 8, utilspp::EmptyType >::Result Parm9; - typedef typename utilspp::tl::TypeAtNonStrict< TList, 9, utilspp::EmptyType >::Result Parm10; - typedef typename utilspp::tl::TypeAtNonStrict< TList, 10, utilspp::EmptyType >::Result Parm11; - typedef typename utilspp::tl::TypeAtNonStrict< TList, 11, utilspp::EmptyType >::Result Parm12; - typedef typename utilspp::tl::TypeAtNonStrict< TList, 12, utilspp::EmptyType >::Result Parm13; - typedef typename utilspp::tl::TypeAtNonStrict< TList, 13, utilspp::EmptyType >::Result Parm14; - typedef typename utilspp::tl::TypeAtNonStrict< TList, 14, utilspp::EmptyType >::Result Parm15; - - R operator()() - {return (*mImpl)();} - - R operator()(Parm1 p1) - {return (*mImpl)(p1);} - - R operator()(Parm1 p1, Parm2 p2) - {return (*mImpl)(p1, p2);} - - R operator()(Parm1 p1, Parm2 p2, Parm3 p3) - {return (*mImpl)(p1, p2, p3);} - - R operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4) - {return (*mImpl)(p1, p2, p3, p4);} - - R operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5) - {return (*mImpl)(p1, p2, p3, p4, p5);} - - R operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, Parm6 p6) - {return (*mImpl)(p1, p2, p3, p4, p5, p6);} - - R operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, Parm6 p6, Parm7 p7) - {return (*mImpl)(p1, p2, p3, p4, p5, p6, p7);} - - R operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, Parm6 p6, Parm7 p7, Parm8 p8) - {return (*mImpl)(p1, p2, p3, p4, p5, p6, p7, p8);} - - R operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9) - {return (*mImpl)(p1, p2, p3, p4, p5, p6, p7, p8, p9);} - - R operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10) - {return (*mImpl)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);} - - R operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11) - {return (*mImpl)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11);} - - R operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, Parm12 p12) - {return (*mImpl)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12);} - - R operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, Parm12 p12, Parm13 p13) - {return (*mImpl)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13);} - - R operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, Parm12 p12, Parm13 p13, Parm14 p14) - {return (*mImpl)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14);} - - R operator()(Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, Parm12 p12, Parm13 p13, Parm14 p14, Parm15 p15) - {return (*mImpl)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15);} - - private: - typedef FunctorImpl< R, TList > Impl; - std::auto_ptr<Impl> mImpl; - }; - - -}; - -#include "Functor.inl" -#include "Binder.hpp" - -#endif diff --git a/sflphone-common/libs/utilspp/functor/Functor.inl b/sflphone-common/libs/utilspp/functor/Functor.inl deleted file mode 100644 index f996ce814e5d9d23905a59ea62a1505bb092acee..0000000000000000000000000000000000000000 --- a/sflphone-common/libs/utilspp/functor/Functor.inl +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef UTILSPP_FUNCTOR_INL -#define UTILSPP_FUNCTOR_INL - -template <typename R, class TList> -template <typename Fun> -utilspp::Functor<R, TList>::Functor(Fun fun) -: mImpl(new FunctorHandler< Functor, Fun >(fun)) -{} - -template <typename R, class TList> -template <typename PointerToObj, typename MemFun> -utilspp::Functor<R, TList>::Functor(const PointerToObj &obj, MemFun fun) -: mImpl(new MemFunHandler< Functor, PointerToObj, MemFun >(obj, fun)) -{} - -template <typename R, class TList> -utilspp::Functor<R, TList>::Functor(const Functor &functor) -: mImpl(functor.mImpl->clone()) -{} - -template <typename R, class TList> -utilspp::Functor<R, TList> & -utilspp::Functor<R, TList>::operator=(const Functor &functor) -{ - mImpl = std::auto_ptr< Impl >(functor.mImpl->clone()); - return (*this); -} - -#endif - diff --git a/sflphone-common/libs/utilspp/functor/FunctorHandler.hpp b/sflphone-common/libs/utilspp/functor/FunctorHandler.hpp deleted file mode 100644 index 5556e8d56c6c604e469fa28ef0dc6bdc0bf1c69e..0000000000000000000000000000000000000000 --- a/sflphone-common/libs/utilspp/functor/FunctorHandler.hpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef UTILSPP_FUNCTORHANDLER_HPP -#define UTILSPP_FUNCTORHANDLER_HPP - -namespace utilspp -{ - template <class ParentFunctor, typename Fun> - class FunctorHandler : public FunctorImpl< typename ParentFunctor::ResultType, - typename ParentFunctor::ParmList > - { - public: - typedef typename ParentFunctor::ResultType ResultType; - - FunctorHandler(Fun fun) : mFun(fun) {} - FunctorHandler* clone() const - {return new FunctorHandler(*this);} - - ResultType operator()() - {return mFun();} - - ResultType operator()(typename ParentFunctor::Parm1 p1) - {return (mFun)(p1);} - - ResultType operator()(typename ParentFunctor::Parm1 p1, typename ParentFunctor::Parm2 p2) - {return (mFun)(p1, p2);} - - ResultType operator()(typename ParentFunctor::Parm1 p1, typename ParentFunctor::Parm2 p2, typename ParentFunctor::Parm3 p3) - {return (mFun)(p1, p2, p3);} - - ResultType operator()(typename ParentFunctor::Parm1 p1, typename ParentFunctor::Parm2 p2, typename ParentFunctor::Parm3 p3, typename ParentFunctor::Parm4 p4) - {return (mFun)(p1, p2, p3, p4);} - - ResultType operator()(typename ParentFunctor::Parm1 p1, typename ParentFunctor::Parm2 p2, typename ParentFunctor::Parm3 p3, typename ParentFunctor::Parm4 p4, typename ParentFunctor::Parm5 p5) - {return (mFun)(p1, p2, p3, p4, p5);} - - ResultType operator()(typename ParentFunctor::Parm1 p1, typename ParentFunctor::Parm2 p2, typename ParentFunctor::Parm3 p3, typename ParentFunctor::Parm4 p4, typename ParentFunctor::Parm5 p5, typename ParentFunctor::Parm6 p6) - {return (mFun)(p1, p2, p3, p4, p5, p6);} - - ResultType operator()(typename ParentFunctor::Parm1 p1, typename ParentFunctor::Parm2 p2, typename ParentFunctor::Parm3 p3, typename ParentFunctor::Parm4 p4, typename ParentFunctor::Parm5 p5, typename ParentFunctor::Parm6 p6, typename ParentFunctor::Parm7 p7) - {return (mFun)(p1, p2, p3, p4, p5, p6, p7);} - - ResultType operator()(typename ParentFunctor::Parm1 p1, typename ParentFunctor::Parm2 p2, typename ParentFunctor::Parm3 p3, typename ParentFunctor::Parm4 p4, typename ParentFunctor::Parm5 p5, typename ParentFunctor::Parm6 p6, typename ParentFunctor::Parm7 p7, typename ParentFunctor::Parm8 p8) - {return (mFun)(p1, p2, p3, p4, p5, p6, p7, p8);} - - ResultType operator()(typename ParentFunctor::Parm1 p1, typename ParentFunctor::Parm2 p2, typename ParentFunctor::Parm3 p3, typename ParentFunctor::Parm4 p4, typename ParentFunctor::Parm5 p5, typename ParentFunctor::Parm6 p6, typename ParentFunctor::Parm7 p7, typename ParentFunctor::Parm8 p8, typename ParentFunctor::Parm9 p9) - {return (mFun)(p1, p2, p3, p4, p5, p6, p7, p8, p9);} - - ResultType operator()(typename ParentFunctor::Parm1 p1, typename ParentFunctor::Parm2 p2, typename ParentFunctor::Parm3 p3, typename ParentFunctor::Parm4 p4, typename ParentFunctor::Parm5 p5, typename ParentFunctor::Parm6 p6, typename ParentFunctor::Parm7 p7, typename ParentFunctor::Parm8 p8, typename ParentFunctor::Parm9 p9, typename ParentFunctor::Parm10 p10) - {return (mFun)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);} - - ResultType operator()(typename ParentFunctor::Parm1 p1, typename ParentFunctor::Parm2 p2, typename ParentFunctor::Parm3 p3, typename ParentFunctor::Parm4 p4, typename ParentFunctor::Parm5 p5, typename ParentFunctor::Parm6 p6, typename ParentFunctor::Parm7 p7, typename ParentFunctor::Parm8 p8, typename ParentFunctor::Parm9 p9, typename ParentFunctor::Parm10 p10, typename ParentFunctor::Parm11 p11) - {return (mFun)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11);} - - ResultType operator()(typename ParentFunctor::Parm1 p1, typename ParentFunctor::Parm2 p2, typename ParentFunctor::Parm3 p3, typename ParentFunctor::Parm4 p4, typename ParentFunctor::Parm5 p5, typename ParentFunctor::Parm6 p6, typename ParentFunctor::Parm7 p7, typename ParentFunctor::Parm8 p8, typename ParentFunctor::Parm9 p9, typename ParentFunctor::Parm10 p10, typename ParentFunctor::Parm11 p11, typename ParentFunctor::Parm12 p12) - {return (mFun)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12);} - - ResultType operator()(typename ParentFunctor::Parm1 p1, typename ParentFunctor::Parm2 p2, typename ParentFunctor::Parm3 p3, typename ParentFunctor::Parm4 p4, typename ParentFunctor::Parm5 p5, typename ParentFunctor::Parm6 p6, typename ParentFunctor::Parm7 p7, typename ParentFunctor::Parm8 p8, typename ParentFunctor::Parm9 p9, typename ParentFunctor::Parm10 p10, typename ParentFunctor::Parm11 p11, typename ParentFunctor::Parm12 p12, typename ParentFunctor::Parm13 p13) - {return (mFun)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13);} - - ResultType operator()(typename ParentFunctor::Parm1 p1, typename ParentFunctor::Parm2 p2, typename ParentFunctor::Parm3 p3, typename ParentFunctor::Parm4 p4, typename ParentFunctor::Parm5 p5, typename ParentFunctor::Parm6 p6, typename ParentFunctor::Parm7 p7, typename ParentFunctor::Parm8 p8, typename ParentFunctor::Parm9 p9, typename ParentFunctor::Parm10 p10, typename ParentFunctor::Parm11 p11, typename ParentFunctor::Parm12 p12, typename ParentFunctor::Parm13 p13, typename ParentFunctor::Parm14 p14) - {return (mFun)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14);} - - ResultType operator()(typename ParentFunctor::Parm1 p1, typename ParentFunctor::Parm2 p2, typename ParentFunctor::Parm3 p3, typename ParentFunctor::Parm4 p4, typename ParentFunctor::Parm5 p5, typename ParentFunctor::Parm6 p6, typename ParentFunctor::Parm7 p7, typename ParentFunctor::Parm8 p8, typename ParentFunctor::Parm9 p9, typename ParentFunctor::Parm10 p10, typename ParentFunctor::Parm11 p11, typename ParentFunctor::Parm12 p12, typename ParentFunctor::Parm13 p13, typename ParentFunctor::Parm14 p14, typename ParentFunctor::Parm15 p15) - {return (mFun)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15);} - - private: - Fun mFun; - }; -}; - -#endif - - diff --git a/sflphone-common/libs/utilspp/functor/FunctorImpl.hpp b/sflphone-common/libs/utilspp/functor/FunctorImpl.hpp deleted file mode 100644 index 93f59716fddb77bbb48d8013f6c4805edb59bbb3..0000000000000000000000000000000000000000 --- a/sflphone-common/libs/utilspp/functor/FunctorImpl.hpp +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef UTILSPP_FUNCTORIMPL_HPP -#define UTILSPP_FUNCTORIMPL_HPP - -namespace utilspp -{ - template< typename R, class TList > - struct FunctorImpl; - - template< typename R > - struct FunctorImpl<R, utilspp::NullType > - { - R operator()() = 0; - virtual FunctorImpl *clone() const = 0; - virtual ~FunctorImpl(){}; - }; - - template< typename R, typename P1 > - struct FunctorImpl<R, TYPE_LIST_1(P1) > - { - virtual R operator()(P1) = 0; - virtual FunctorImpl *clone() const = 0; - virtual ~FunctorImpl(){}; - }; - - template< typename R, typename P1, typename P2 > - struct FunctorImpl<R, TYPE_LIST_2(P1, P2) > - { - virtual R operator()(P1, P2) = 0; - virtual FunctorImpl *clone() const = 0; - virtual ~FunctorImpl(){}; - }; - - template< typename R, typename P1, typename P2, typename P3 > - struct FunctorImpl<R, TYPE_LIST_3(P1, P2, P3) > - { - virtual R operator()(P1, P2, P3) = 0; - virtual FunctorImpl *clone() const = 0; - virtual ~FunctorImpl(){}; - }; - - template< typename R, typename P1, typename P2, typename P3, typename P4 > - struct FunctorImpl<R, TYPE_LIST_4(P1, P2, P3, P4) > - { - virtual R operator()(P1, P2, P3, P4) = 0; - virtual FunctorImpl *clone() const = 0; - virtual ~FunctorImpl(){}; - }; - - template< typename R, typename P1, typename P2, typename P3, typename P4, typename P5 > - struct FunctorImpl<R, TYPE_LIST_5(P1, P2, P3, P4, P5) > - { - virtual R operator()(P1, P2, P3, P4, P5) = 0; - virtual FunctorImpl *clone() const = 0; - virtual ~FunctorImpl(){}; - }; - - template< - typename R, - typename P1, - typename P2, - typename P3, - typename P4, - typename P5, - typename P6 > - struct FunctorImpl<R, TYPE_LIST_6(P1, P2, P3, P4, P5, P6) > - { - virtual R operator()(P1, P2, P3, P4, P5, P6) = 0; - virtual FunctorImpl *clone() const = 0; - virtual ~FunctorImpl(){}; - }; - - template< - typename R, - typename P1, - typename P2, - typename P3, - typename P4, - typename P5, - typename P6, - typename P7 > - struct FunctorImpl<R, TYPE_LIST_7(P1, P2, P3, P4, P5, P6, P7) > - { - virtual R operator()(P1, P2, P3, P4, P5, P6, P7) = 0; - virtual FunctorImpl *clone() const = 0; - virtual ~FunctorImpl(){}; - }; - - template< - typename R, - typename P1, - typename P2, - typename P3, - typename P4, - typename P5, - typename P6, - typename P7, - typename P8 > - struct FunctorImpl<R, TYPE_LIST_8(P1, P2, P3, P4, P5, P6, P7, P8) > - { - virtual R operator()(P1, P2, P3, P4, P5, P6, P7, P8) = 0; - virtual FunctorImpl *clone() const = 0; - virtual ~FunctorImpl(){}; - }; - - template< - typename R, - typename P1, - typename P2, - typename P3, - typename P4, - typename P5, - typename P6, - typename P7, - typename P8, - typename P9 > - struct FunctorImpl<R, TYPE_LIST_9(P1, P2, P3, P4, P5, P6, P7, P8, P9) > - { - virtual R operator()(P1, P2, P3, P4, P5, P6, P7, P8, P9) = 0; - virtual FunctorImpl *clone() const = 0; - virtual ~FunctorImpl(){}; - }; - - template< - typename R, - typename P1, - typename P2, - typename P3, - typename P4, - typename P5, - typename P6, - typename P7, - typename P8, - typename P9, - typename P10 > - struct FunctorImpl<R, TYPE_LIST_10(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10) > - { - virtual R operator()(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10) = 0; - virtual FunctorImpl *clone() const = 0; - virtual ~FunctorImpl(){}; - }; - - template< typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10, typename P11 > - struct FunctorImpl<R, TYPE_LIST_11(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11) > - { - virtual R operator()(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11) = 0; - virtual FunctorImpl *clone() const = 0; - virtual ~FunctorImpl(){}; - }; - - template< typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10, typename P11, typename P12 > - struct FunctorImpl<R, TYPE_LIST_12(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12) > - { - virtual R operator()(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12) = 0; - virtual FunctorImpl *clone() const = 0; - virtual ~FunctorImpl(){}; - }; - - template< typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10, typename P11, typename P12, typename P13 > - struct FunctorImpl<R, TYPE_LIST_13(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13) > - { - virtual R operator()(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13) = 0; - virtual FunctorImpl *clone() const = 0; - virtual ~FunctorImpl(){}; - }; - - template< typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10, typename P11, typename P12, typename P13, typename P14 > - struct FunctorImpl<R, TYPE_LIST_14(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14) > - { - virtual R operator()(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14) = 0; - virtual FunctorImpl *clone() const = 0; - virtual ~FunctorImpl(){}; - }; - - template< typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10, typename P11, typename P12, typename P13, typename P14, typename P15 > - struct FunctorImpl<R, TYPE_LIST_15(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15) > - { - virtual R operator()(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15) = 0; - virtual FunctorImpl *clone() const = 0; - virtual ~FunctorImpl(){}; - }; -}; - -#endif diff --git a/sflphone-common/libs/utilspp/functor/Makefile.am b/sflphone-common/libs/utilspp/functor/Makefile.am deleted file mode 100644 index 0ca9eff77d01187ddd28ab87c57383c4a5e7921b..0000000000000000000000000000000000000000 --- a/sflphone-common/libs/utilspp/functor/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -#pkginclude_HEADERS = \ -# Binder.hpp Binder.inl \ -# FunctorHandler.hpp \ -# Functor.hpp \ -# FunctorImpl.hpp \ -# Functor.inl \ -# MemFunHandler.hpp - -#pkgincludedir=$(includedir)/utilspp/functor diff --git a/sflphone-common/libs/utilspp/functor/MemFunHandler.hpp b/sflphone-common/libs/utilspp/functor/MemFunHandler.hpp deleted file mode 100644 index 2e92cee85b86850266bf46f043526f352adae6b1..0000000000000000000000000000000000000000 --- a/sflphone-common/libs/utilspp/functor/MemFunHandler.hpp +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef UTILSPP_MEMFUNHANDLER_HPP -#define UTILSPP_MEMFUNHANDLER_HPP - -namespace utilspp -{ - template <class ParentFunctor, typename PointerToObj, typename PointerToMemFn> - class MemFunHandler : public FunctorImpl< typename ParentFunctor::ResultType, - typename ParentFunctor::ParmList > - { - public: - typedef typename ParentFunctor::ResultType ResultType; - MemFunHandler(PointerToObj obj, PointerToMemFn memFn) - : mObj(obj) - , mMemFn(memFn) - {} - - MemFunHandler* clone() const - {return new MemFunHandler(*this);} - - ResultType operator()() - {return ((*mObj).*mMemFn)();} - - ResultType operator()(typename ParentFunctor::Parm1 p1) - {return ((*mObj).*mMemFn)(p1);} - - ResultType operator()(typename ParentFunctor::Parm1 p1, typename ParentFunctor::Parm2 p2) - {return ((*mObj).*mMemFn)(p1, p2);} - - ResultType operator()(typename ParentFunctor::Parm1 p1, - typename ParentFunctor::Parm2 p2, - typename ParentFunctor::Parm3 p3) - {return ((*mObj).*mMemFn)(p1, p2, p3);} - - ResultType operator()(typename ParentFunctor::Parm1 p1, typename ParentFunctor::Parm2 p2, typename ParentFunctor::Parm3 p3, typename ParentFunctor::Parm4 p4) - {return ((*mObj).*mMemFn)(p1, p2, p3, p4);} - - ResultType operator()(typename ParentFunctor::Parm1 p1, typename ParentFunctor::Parm2 p2, typename ParentFunctor::Parm3 p3, typename ParentFunctor::Parm4 p4, typename ParentFunctor::Parm5 p5) - {return ((*mObj).*mMemFn)(p1, p2, p3, p4, p5);} - - ResultType operator()(typename ParentFunctor::Parm1 p1, typename ParentFunctor::Parm2 p2, typename ParentFunctor::Parm3 p3, typename ParentFunctor::Parm4 p4, typename ParentFunctor::Parm5 p5, typename ParentFunctor::Parm6 p6) - {return ((*mObj).*mMemFn)(p1, p2, p3, p4, p5, p6);} - - ResultType operator()(typename ParentFunctor::Parm1 p1, typename ParentFunctor::Parm2 p2, typename ParentFunctor::Parm3 p3, typename ParentFunctor::Parm4 p4, typename ParentFunctor::Parm5 p5, typename ParentFunctor::Parm6 p6, typename ParentFunctor::Parm7 p7) - {return ((*mObj).*mMemFn)(p1, p2, p3, p4, p5, p6, p7);} - - ResultType operator()(typename ParentFunctor::Parm1 p1, typename ParentFunctor::Parm2 p2, typename ParentFunctor::Parm3 p3, typename ParentFunctor::Parm4 p4, typename ParentFunctor::Parm5 p5, typename ParentFunctor::Parm6 p6, typename ParentFunctor::Parm7 p7, typename ParentFunctor::Parm8 p8) - {return ((*mObj).*mMemFn)(p1, p2, p3, p4, p5, p6, p7, p8);} - - ResultType operator()(typename ParentFunctor::Parm1 p1, typename ParentFunctor::Parm2 p2, typename ParentFunctor::Parm3 p3, typename ParentFunctor::Parm4 p4, typename ParentFunctor::Parm5 p5, typename ParentFunctor::Parm6 p6, typename ParentFunctor::Parm7 p7, typename ParentFunctor::Parm8 p8, typename ParentFunctor::Parm9 p9) - {return ((*mObj).*mMemFn)(p1, p2, p3, p4, p5, p6, p7, p8, p9);} - - ResultType operator()(typename ParentFunctor::Parm1 p1, typename ParentFunctor::Parm2 p2, typename ParentFunctor::Parm3 p3, typename ParentFunctor::Parm4 p4, typename ParentFunctor::Parm5 p5, typename ParentFunctor::Parm6 p6, typename ParentFunctor::Parm7 p7, typename ParentFunctor::Parm8 p8, typename ParentFunctor::Parm9 p9, typename ParentFunctor::Parm10 p10) - {return ((*mObj).*mMemFn)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);} - - ResultType operator()(typename ParentFunctor::Parm1 p1, typename ParentFunctor::Parm2 p2, typename ParentFunctor::Parm3 p3, typename ParentFunctor::Parm4 p4, typename ParentFunctor::Parm5 p5, typename ParentFunctor::Parm6 p6, typename ParentFunctor::Parm7 p7, typename ParentFunctor::Parm8 p8, typename ParentFunctor::Parm9 p9, typename ParentFunctor::Parm10 p10, typename ParentFunctor::Parm11 p11) - {return ((*mObj).*mMemFn)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11);} - - ResultType operator()(typename ParentFunctor::Parm1 p1, typename ParentFunctor::Parm2 p2, typename ParentFunctor::Parm3 p3, typename ParentFunctor::Parm4 p4, typename ParentFunctor::Parm5 p5, typename ParentFunctor::Parm6 p6, typename ParentFunctor::Parm7 p7, typename ParentFunctor::Parm8 p8, typename ParentFunctor::Parm9 p9, typename ParentFunctor::Parm10 p10, typename ParentFunctor::Parm11 p11, typename ParentFunctor::Parm12 p12) - {return ((*mObj).*mMemFn)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12);} - - ResultType operator()(typename ParentFunctor::Parm1 p1, typename ParentFunctor::Parm2 p2, typename ParentFunctor::Parm3 p3, typename ParentFunctor::Parm4 p4, typename ParentFunctor::Parm5 p5, typename ParentFunctor::Parm6 p6, typename ParentFunctor::Parm7 p7, typename ParentFunctor::Parm8 p8, typename ParentFunctor::Parm9 p9, typename ParentFunctor::Parm10 p10, typename ParentFunctor::Parm11 p11, typename ParentFunctor::Parm12 p12, typename ParentFunctor::Parm13 p13) - {return ((*mObj).*mMemFn)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13);} - - ResultType operator()(typename ParentFunctor::Parm1 p1, typename ParentFunctor::Parm2 p2, typename ParentFunctor::Parm3 p3, typename ParentFunctor::Parm4 p4, typename ParentFunctor::Parm5 p5, typename ParentFunctor::Parm6 p6, typename ParentFunctor::Parm7 p7, typename ParentFunctor::Parm8 p8, typename ParentFunctor::Parm9 p9, typename ParentFunctor::Parm10 p10, typename ParentFunctor::Parm11 p11, typename ParentFunctor::Parm12 p12, typename ParentFunctor::Parm13 p13, typename ParentFunctor::Parm14 p14) - {return ((*mObj).*mMemFn)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14);} - - ResultType operator()(typename ParentFunctor::Parm1 p1, typename ParentFunctor::Parm2 p2, typename ParentFunctor::Parm3 p3, typename ParentFunctor::Parm4 p4, typename ParentFunctor::Parm5 p5, typename ParentFunctor::Parm6 p6, typename ParentFunctor::Parm7 p7, typename ParentFunctor::Parm8 p8, typename ParentFunctor::Parm9 p9, typename ParentFunctor::Parm10 p10, typename ParentFunctor::Parm11 p11, typename ParentFunctor::Parm12 p12, typename ParentFunctor::Parm13 p13, typename ParentFunctor::Parm14 p14, typename ParentFunctor::Parm15 p15) - {return ((*mObj).*mMemFn)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15);} - - private: - PointerToObj mObj; - PointerToMemFn mMemFn; - }; -}; - -#endif - diff --git a/sflphone-common/src/Makefile.am b/sflphone-common/src/Makefile.am index 551786ad48f53329842f8eef1f963ab9e09b2012..cd1365389762863e8c6ee3da0935eff98e2417f1 100644 --- a/sflphone-common/src/Makefile.am +++ b/sflphone-common/src/Makefile.am @@ -15,7 +15,6 @@ sflphoned_SOURCES = \ preferences.cpp \ managerimpl.cpp \ managerimpl_registration.cpp \ - observer.cpp \ eventthread.cpp \ accountcreator.cpp \ call.cpp \ @@ -54,7 +53,6 @@ noinst_HEADERS = \ managerimpl.h \ manager.h \ global.h \ - observer.h \ eventthread.h \ user_cfg.h \ account.h \ diff --git a/sflphone-common/src/dbus/configurationmanager-introspec.xml b/sflphone-common/src/dbus/configurationmanager-introspec.xml index 779a3f23d75ceb1758019106c952218862155323..ab7dfa36171c5f1b941d5a9c559511691ab44277 100755 --- a/sflphone-common/src/dbus/configurationmanager-introspec.xml +++ b/sflphone-common/src/dbus/configurationmanager-introspec.xml @@ -511,7 +511,7 @@ </arg> </method> - <method name="setAudioRingtoneDevice" tp:name-for-binding="setAudioRingtoneDevice"> + <method name="setAudioRingtoneDevice" tp:name-for-bindings="setAudioRingtoneDevice"> <tp:docstring> </tp:docstring> <arg type="i" name="index" direction="in"> @@ -572,7 +572,7 @@ </arg> </method> - <method name="setNoiseSuppressState" tp:name-for-binding="setNoiseSuppressState"> + <method name="setNoiseSuppressState" tp:name-for-bindings="setNoiseSuppressState"> <arg type="s" name="state" direction="in"> </arg> </method> @@ -586,12 +586,12 @@ </arg> </method> - <method name="setEchoCancelState" tp:name-for-binding="setEchoCancelState"> + <method name="setEchoCancelState" tp:name-for-bindings="setEchoCancelState"> <arg type="s" name="state" direction="in"> </arg> </method> - <method name="setEchoCancelTailLength" tp:name-for-binding="setEchoCancelTailLength"> + <method name="setEchoCancelTailLength" tp:name-for-bindings="setEchoCancelTailLength"> <tp:docstring> </tp:docstring> <arg type="i" name="index" direction="in"> @@ -600,7 +600,7 @@ </arg> </method> - <method name="getEchoCancelTailLength" tp:name-for-binding="getEchoCancelTailLength"> + <method name="getEchoCancelTailLength" tp:name-for-bindings="getEchoCancelTailLength"> <tp:docstring> </tp:docstring> <arg type="i" name="index" direction="out"> @@ -609,14 +609,14 @@ </arg> </method> - <method name="setEchoCancelDelay" tp:name-for-binding="setEchoCancelTailLength"> + <method name="setEchoCancelDelay" tp:name-for-bindings="setEchoCancelDelay"> <tp:docstring> </tp:docstring> <arg type="i" name="index" direction="in"> </arg> </method> - <method name="getEchoCancelDelay" tp:name-for-binding="getEchoCancelTailLength"> + <method name="getEchoCancelDelay" tp:name-for-bindings="getEchoCancelDelay"> <tp:docstring> </tp:docstring> <arg type="i" name="index" direction="out"> diff --git a/sflphone-common/src/managerimpl.h b/sflphone-common/src/managerimpl.h index e34fc262dc3453315f350c936074ec33c77d5e21..447bc21dc928ebae0bcf08ea81b326263008ed3b 100644 --- a/sflphone-common/src/managerimpl.h +++ b/sflphone-common/src/managerimpl.h @@ -42,7 +42,6 @@ #include <cc++/thread.h> #include "dbus/dbusmanager.h" -#include "observer.h" #include "config/config.h" #include "account.h" diff --git a/sflphone-common/src/observer.cpp b/sflphone-common/src/observer.cpp deleted file mode 100644 index a5f14136cb5ccedad0d74219e809bb60eea3bc4c..0000000000000000000000000000000000000000 --- a/sflphone-common/src/observer.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2004, 2005, 2006, 2009, 2008, 2009, 2010, 2011 Savoir-Faire Linux Inc. - * Author: Yan Morin <yan.morin@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Additional permission under GNU GPL version 3 section 7: - * - * If you modify this program, or any covered work, by linking or - * combining it with the OpenSSL project's OpenSSL library (or a - * modified version of that library), containing parts covered by the - * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. - * grants you additional permission to convey the resulting work. - * Corresponding Source for a non-source form of such a combination - * shall include the source code for the parts of OpenSSL used as well - * as that of the covered work. - */ - -#include "observer.h" -#include <algorithm> - -namespace Pattern -{ - -void -Subject::attach (Observer& observer) -{ - if (std::find (_observers.begin(), _observers.end(), &observer) == _observers.end()) { - _observers.push_back (&observer); - } -} - -void -Subject::detach (Observer& observer) -{ - std::list<Observer*>::iterator iter = std::find (_observers.begin(), _observers.end(), &observer); - - if (iter != _observers.end()) { - _observers.erase (iter); - } -} - -void -Subject::notify() -{ - std::list<Observer*>::iterator iter = _observers.begin(); - - while (iter != _observers.end()) { - if (*iter) { - (*iter)->update(); - } - - iter++; - } -} - -} // end of namespace diff --git a/sflphone-common/src/observer.h b/sflphone-common/src/observer.h deleted file mode 100644 index ea5ae8cfeda7fe8a0dc0e0756540e13540652409..0000000000000000000000000000000000000000 --- a/sflphone-common/src/observer.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) 2004, 2005, 2006, 2009, 2008, 2009, 2010, 2011 Savoir-Faire Linux Inc. - * Author: Yan Morin <yan.morin@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Additional permission under GNU GPL version 3 section 7: - * - * If you modify this program, or any covered work, by linking or - * combining it with the OpenSSL project's OpenSSL library (or a - * modified version of that library), containing parts covered by the - * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. - * grants you additional permission to convey the resulting work. - * Corresponding Source for a non-source form of such a combination - * shall include the source code for the parts of OpenSSL used as well - * as that of the covered work. - */ - -#ifndef __PATTERN_OBSERVER_H_ -#define __PATTERN_OBSERVER_H_ - -#include <list> - -/** - * Observer design pattern interface - */ -namespace Pattern -{ - -/** - * Observer interface - */ -class Observer -{ - public: - virtual ~Observer() {}; - virtual void update() = 0; -}; - -class Subject -{ - public: - virtual ~Subject() {}; - void attach (Observer& observer); - void detach (Observer& observer); - void notify(); - - private: - std::list<Observer*> _observers; -}; - -} // end namespace - -#endif // __PATTERN_OBSERVER_H_ diff --git a/sflphone-common/src/sip/sdp.cpp b/sflphone-common/src/sip/sdp.cpp index 92be7e3afaf5a64a1ef3fc4c8d9abc0528d57889..4f9acb388eabda3c14d7dd726b3a902bcee063dc 100644 --- a/sflphone-common/src/sip/sdp.cpp +++ b/sflphone-common/src/sip/sdp.cpp @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Additional permission under GNU GPL version 3 section 7: * @@ -34,7 +34,7 @@ #include "sdpmedia.h" #include "global.h" #include "manager.h" -#define ZRTP_VERSION "1.10" +static const char* const ZRTP_VERSION = "1.10"; static const pj_str_t STR_AUDIO = { (char*) "audio", 5}; static const pj_str_t STR_VIDEO = { (char*) "video", 5}; @@ -51,25 +51,21 @@ static const pj_str_t STR_TELEPHONE_EVENT = { (char*) "telephone-event", 15}; Sdp::Sdp (pj_pool_t *pool) - : memPool (pool) - , negociator (NULL) - , localSession (NULL) - , remoteSession(NULL) - , activeLocalSession (NULL) - , activeRemoteSession (NULL) - , localAudioMediaCap() - , sessionAudioMedia (0) - , localIpAddr ("") - , remoteIpAddr ("") - , localAudioPort (0) - , remoteAudioPort (0) - , zrtpHelloHash ("") - , srtpCrypto() - , telephoneEventPayload(101) // same as asterisk -{ -} - -Sdp::~Sdp() + : memPool_(pool) + , negotiator_(NULL) + , localSession_(NULL) + , remoteSession_(NULL) + , activeLocalSession_(NULL) + , activeRemoteSession_(NULL) + , localAudioMediaCap_() + , sessionAudioMedia_(0) + , localIpAddr_("") + , remoteIpAddr_("") + , localAudioPort_(0) + , remoteAudioPort_(0) + , zrtpHelloHash_("") + , srtpCrypto_() + , telephoneEventPayload_(101) // same as asterisk { } @@ -77,7 +73,7 @@ void Sdp::setActiveLocalSdpSession (const pjmedia_sdp_session *sdp) { int nb_media, nb_codecs; - int i,j, port; + int port; pjmedia_sdp_media *current; sdpMedia *media = NULL; std::string type, dir; @@ -87,72 +83,64 @@ void Sdp::setActiveLocalSdpSession (const pjmedia_sdp_session *sdp) _debug ("SDP: Set active local SDP session"); - activeLocalSession = (pjmedia_sdp_session*) sdp; + activeLocalSession_ = (pjmedia_sdp_session*) sdp; codecs_list = Manager::instance().getAudioCodecFactory().getCodecsMap(); // retrieve the media information - nb_media = activeLocalSession->media_count; + nb_media = activeLocalSession_->media_count; - for (i=0; i<nb_media ; i++) { + for (int i = 0; i < nb_media ; i++) { // Retrieve the media - current = activeLocalSession->media[i]; + current = activeLocalSession_->media[i]; type = current->desc.media.ptr; port = current->desc.port; media = new sdpMedia (type, port); // Retrieve the payload nb_codecs = current->desc.fmt_count; // Must be one - for (j=0 ; j<nb_codecs ; j++) { - attribute = pjmedia_sdp_media_find_attr (current, &STR_RTPMAP, NULL); + for (int j = 0; j < nb_codecs; j++) { + attribute = pjmedia_sdp_media_find_attr(current, &STR_RTPMAP, NULL); // pj_strtoul(attribute->pt) if (!attribute) + { + delete media; return; + } - pjmedia_sdp_attr_to_rtpmap (memPool, attribute, &rtpmap); + pjmedia_sdp_attr_to_rtpmap (memPool_, attribute, &rtpmap); CodecsMap::iterator iter = codecs_list.find ( (AudioCodecType) pj_strtoul (&rtpmap->pt)); - if (iter==codecs_list.end()) + if (iter == codecs_list.end()) + { + delete media; return; + } media->add_codec (iter->second); } - sessionAudioMedia.push_back (media); + sessionAudioMedia_.push_back (media); } } void Sdp::setActiveRemoteSdpSession (const pjmedia_sdp_session *sdp) { - - std::string type, dir; - CodecsMap codecs_list; - _debug ("SDP: Set negotiated SDP"); - activeRemoteSession = (pjmedia_sdp_session*) sdp; + activeRemoteSession_ = (pjmedia_sdp_session*) sdp; getRemoteSdpTelephoneEventFromOffer(sdp); } -bool Sdp::hasSessionMedia(void) +bool Sdp::hasSessionMedia(void) const { - std::vector<sdpMedia *> mediaList = getSessionMediaList(); - bool listNotEmpty; - - if(mediaList.size() > 0) { - listNotEmpty = true; - } - else { - listNotEmpty = false; - } - - return listNotEmpty; + return not sessionAudioMedia_.empty(); } -sfl::AudioCodec* Sdp::getSessionMedia (void) throw(SdpException) +sfl::AudioCodec* Sdp::getSessionMedia (void) { int nbMedia; @@ -162,26 +150,36 @@ sfl::AudioCodec* Sdp::getSessionMedia (void) throw(SdpException) _debug ("SDP: Get session media"); - mediaList = getSessionMediaList (); - nbMedia = mediaList.size(); + nbMedia = sessionAudioMedia_.size(); - if(nbMedia <= 0) { - _error("SDP: Error: No media in session description"); - throw SdpException("No media description for this SDP"); + if (nbMedia <= 0) { + _error("SDP: Error: No media in session description"); + throw SdpException("No media description for this SDP"); } - nbCodec = mediaList[0]->get_media_codec_list().size(); + nbCodec = sessionAudioMedia_[0]->get_media_codec_list().size(); if (nbCodec <= 0) { - _error("SDP: Error: No codec description for this media"); - throw SdpException("No codec description for this media"); + _error("SDP: Error: No codec description for this media"); + throw SdpException("No codec description for this media"); } - codec = mediaList[0]->get_media_codec_list() [0]; + codec = sessionAudioMedia_[0]->get_media_codec_list()[0]; return static_cast<sfl::AudioCodec *>(codec); } +namespace +{ +std::string convertIntToString (int value) +{ + std::ostringstream result; + result << value; + return result.str(); +} +} // end anonymous namespace + + void Sdp::setMediaDescriptorLine (sdpMedia *media, pjmedia_sdp_media** p_med) { @@ -192,20 +190,20 @@ void Sdp::setMediaDescriptorLine (sdpMedia *media, pjmedia_sdp_media** p_med) int count, i; std::string tmp; - med = PJ_POOL_ZALLOC_T (memPool, pjmedia_sdp_media); + med = PJ_POOL_ZALLOC_T (memPool_, pjmedia_sdp_media); // Get the right media format - pj_strdup (memPool, &med->desc.media, + pj_strdup (memPool_, &med->desc.media, (media->get_media_type() == MIME_TYPE_AUDIO) ? &STR_AUDIO : &STR_VIDEO); med->desc.port_count = 1; med->desc.port = media->get_port(); // in case of sdes, media are tagged as "RTP/SAVP", RTP/AVP elsewhere - if (srtpCrypto.empty()) { - pj_strdup (memPool, &med->desc.transport, &STR_RTP_AVP); + if (srtpCrypto_.empty()) { + pj_strdup (memPool_, &med->desc.transport, &STR_RTP_AVP); } else { - pj_strdup (memPool, &med->desc.transport, &STR_RTP_SAVP); + pj_strdup (memPool_, &med->desc.transport, &STR_RTP_SAVP); } // Media format ( RTP payload ) @@ -216,9 +214,9 @@ void Sdp::setMediaDescriptorLine (sdpMedia *media, pjmedia_sdp_media** p_med) for (i=0; i<count; i++) { codec = media->get_media_codec_list() [i]; - tmp = this->convertIntToString (codec->getPayloadType ()); + tmp = convertIntToString (codec->getPayloadType ()); _debug ("%s", tmp.c_str()); - pj_strdup2 (memPool, &med->desc.fmt[i], tmp.c_str()); + pj_strdup2 (memPool_, &med->desc.fmt[i], tmp.c_str()); // Add a rtpmap field for each codec // We could add one only for dynamic payloads because the codecs with static RTP payloads @@ -236,24 +234,20 @@ void Sdp::setMediaDescriptorLine (sdpMedia *media, pjmedia_sdp_media** p_med) rtpmap.param.slen = 0; - pjmedia_sdp_rtpmap_to_attr (memPool, &rtpmap, &attr); + pjmedia_sdp_rtpmap_to_attr (memPool_, &rtpmap, &attr); med->attr[med->attr_count++] = attr; } // Add the direction stream - attr = (pjmedia_sdp_attr*) pj_pool_zalloc (memPool, sizeof (pjmedia_sdp_attr)); + attr = (pjmedia_sdp_attr*) pj_pool_zalloc (memPool_, sizeof (pjmedia_sdp_attr)); - pj_strdup2 (memPool, &attr->name, media->get_stream_direction_str().c_str()); + pj_strdup2 (memPool_, &attr->name, media->get_stream_direction_str().c_str()); med->attr[ med->attr_count++] = attr; - if (!zrtpHelloHash.empty()) { - try { - addZrtpAttribute (med,zrtpHelloHash); - } catch (...) { - throw; - } + if (!zrtpHelloHash_.empty()) { + addZrtpAttribute (med, zrtpHelloHash_); } setTelephoneEventRtpmap(med); @@ -266,13 +260,13 @@ void Sdp::setTelephoneEventRtpmap(pjmedia_sdp_media *med) pjmedia_sdp_attr *attr_rtpmap = NULL; pjmedia_sdp_attr *attr_fmtp = NULL; - attr_rtpmap = static_cast<pjmedia_sdp_attr *>(pj_pool_zalloc(memPool, sizeof(pjmedia_sdp_attr))); + attr_rtpmap = static_cast<pjmedia_sdp_attr *>(pj_pool_zalloc(memPool_, sizeof(pjmedia_sdp_attr))); attr_rtpmap->name = pj_str((char *) "rtpmap"); attr_rtpmap->value = pj_str((char *) "101 telephone-event/8000"); med->attr[med->attr_count++] = attr_rtpmap; - attr_fmtp = static_cast<pjmedia_sdp_attr *>(pj_pool_zalloc(memPool, sizeof(pjmedia_sdp_attr))); + attr_fmtp = static_cast<pjmedia_sdp_attr *>(pj_pool_zalloc(memPool_, sizeof(pjmedia_sdp_attr))); attr_fmtp->name = pj_str((char *) "fmtp"); attr_fmtp->value = pj_str((char *) "101 0-15"); @@ -288,7 +282,7 @@ void Sdp::setLocalMediaCapabilities (CodecOrder selectedCodecs) CodecsMap::iterator iter; // Clean it first - localAudioMediaCap.clear(); + localAudioMediaCap_.clear(); _debug ("SDP: Fetch local media capabilities. Local extern audio port: %i" , getLocalPublishedAudioPort()); @@ -313,7 +307,7 @@ void Sdp::setLocalMediaCapabilities (CodecOrder selectedCodecs) } } - localAudioMediaCap.push_back (audio); + localAudioMediaCap_.push_back (audio); } int Sdp::createLocalSession (CodecOrder selectedCodecs) @@ -328,8 +322,8 @@ int Sdp::createLocalSession (CodecOrder selectedCodecs) // Reference: RFC 4566 [5] /* Create and initialize basic SDP session */ - localSession = PJ_POOL_ZALLOC_T (memPool, pjmedia_sdp_session); - localSession->conn = PJ_POOL_ZALLOC_T (memPool, pjmedia_sdp_conn); + localSession_ = PJ_POOL_ZALLOC_T (memPool_, pjmedia_sdp_session); + localSession_->conn = PJ_POOL_ZALLOC_T (memPool_, pjmedia_sdp_conn); /* Initialize the fields of the struct */ addProtocol(); @@ -339,16 +333,16 @@ int Sdp::createLocalSession (CodecOrder selectedCodecs) addTiming(); addAudioMediaDescription(); - if (!srtpCrypto.empty()) { - addSdesAttribute (srtpCrypto); + if (!srtpCrypto_.empty()) { + addSdesAttribute (srtpCrypto_); } memset(buffer, 0, 1000); - pjmedia_sdp_print(getLocalSdpSession(), buffer, 1000); + pjmedia_sdp_print(localSession_, buffer, 1000); _debug("SDP: Local SDP Session:\n%s", buffer); // Validate the sdp session - return pjmedia_sdp_validate (localSession); + return pjmedia_sdp_validate (localSession_); } @@ -366,21 +360,21 @@ int Sdp::createOffer (CodecOrder selectedCodecs) return status; } - // Create the SDP negociator instance with local offer - status = pjmedia_sdp_neg_create_w_local_offer (memPool, getLocalSdpSession(), &negociator); + // Create the SDP negotiator_ instance with local offer + status = pjmedia_sdp_neg_create_w_local_offer (memPool_, localSession_, &negotiator_); if (status != PJ_SUCCESS) { - _error ("SDP: Error: Failed to create an initial SDP negociator"); + _error ("SDP: Error: Failed to create an initial SDP negotiator"); return status; } - state = pjmedia_sdp_neg_get_state (negociator); + state = pjmedia_sdp_neg_get_state (negotiator_); PJ_ASSERT_RETURN (status == PJ_SUCCESS, 1); return PJ_SUCCESS; } -int Sdp::recieveOffer (const pjmedia_sdp_session* remote, CodecOrder selectedCodecs) +int Sdp::receiveOffer (const pjmedia_sdp_session* remote, CodecOrder selectedCodecs) { char buffer[1000]; @@ -397,7 +391,7 @@ int Sdp::recieveOffer (const pjmedia_sdp_session* remote, CodecOrder selectedCod _debug("SDP: Remote SDP Session:\n%s", buffer); // If called for the first time - if(localSession == NULL) { + if(localSession_ == NULL) { // Build the local offer to respond status = createLocalSession (selectedCodecs); if (status != PJ_SUCCESS) { @@ -406,9 +400,10 @@ int Sdp::recieveOffer (const pjmedia_sdp_session* remote, CodecOrder selectedCod } } - remoteSession = pjmedia_sdp_session_clone (memPool, remote); + remoteSession_ = pjmedia_sdp_session_clone (memPool_, remote); - status = pjmedia_sdp_neg_create_w_remote_offer (memPool, getLocalSdpSession(), getRemoteSdpSession(), &negociator); + status = pjmedia_sdp_neg_create_w_remote_offer (memPool_, localSession_, + remoteSession_, &negotiator_); PJ_ASSERT_RETURN (status == PJ_SUCCESS, 1); @@ -419,17 +414,17 @@ int Sdp::receivingAnswerAfterInitialOffer(const pjmedia_sdp_session* remote) { pj_status_t status; - if(pjmedia_sdp_neg_get_state(negociator) != PJMEDIA_SDP_NEG_STATE_LOCAL_OFFER) { + if(pjmedia_sdp_neg_get_state(negotiator_) != PJMEDIA_SDP_NEG_STATE_LOCAL_OFFER) { _warn("SDP: Session not in a valid state for receiving answer"); } - status = pjmedia_sdp_neg_set_remote_answer(memPool, negociator, remote); + status = pjmedia_sdp_neg_set_remote_answer(memPool_, negotiator_, remote); if(status != PJ_SUCCESS) { _warn("SDP: Error: Could not set SDP remote answer"); } - if(pjmedia_sdp_neg_get_state(negociator) != PJMEDIA_SDP_NEG_STATE_WAIT_NEGO) { + if(pjmedia_sdp_neg_get_state(negotiator_) != PJMEDIA_SDP_NEG_STATE_WAIT_NEGO) { _warn("SDP: Session not in a valid state after receiving answer"); } @@ -440,17 +435,17 @@ int Sdp::generateAnswerAfterInitialOffer(void) { pj_status_t status; - if(pjmedia_sdp_neg_get_state(negociator) != PJMEDIA_SDP_NEG_STATE_REMOTE_OFFER) { + if(pjmedia_sdp_neg_get_state(negotiator_) != PJMEDIA_SDP_NEG_STATE_REMOTE_OFFER) { _warn("SDP: Session not in a valid state for generating answer"); } - status = pjmedia_sdp_neg_set_local_answer (memPool, negociator, localSession); + status = pjmedia_sdp_neg_set_local_answer (memPool_, negotiator_, localSession_); if(status != PJ_SUCCESS) { _warn("SDP: Error: could not set SDP local answer"); } - if(pjmedia_sdp_neg_get_state(negociator) != PJMEDIA_SDP_NEG_STATE_WAIT_NEGO) { + if(pjmedia_sdp_neg_get_state(negotiator_) != PJMEDIA_SDP_NEG_STATE_WAIT_NEGO) { _warn("SDP: Session not in a valid state after generating answer"); } @@ -458,7 +453,7 @@ int Sdp::generateAnswerAfterInitialOffer(void) } -pj_status_t Sdp::startNegociation() +pj_status_t Sdp::startNegotiation() { pj_status_t status; const pjmedia_sdp_session *active_local; @@ -466,27 +461,27 @@ pj_status_t Sdp::startNegociation() _debug ("SDP: Start negotiation"); - if(negociator == NULL) { - _error("SDP: Error: Negociator is NULL in SDP session"); + if(negotiator_ == NULL) { + _error("SDP: Error: negotiator is NULL in SDP session"); } - if(pjmedia_sdp_neg_get_state(negociator) != PJMEDIA_SDP_NEG_STATE_WAIT_NEGO) { - _warn("SDP: Warning: negociator not in wright state for negotiation"); + if(pjmedia_sdp_neg_get_state(negotiator_) != PJMEDIA_SDP_NEG_STATE_WAIT_NEGO) { + _warn("SDP: Warning: negotiator not in wright state for negotiation"); } - status = pjmedia_sdp_neg_negotiate (memPool, negociator, 0); + status = pjmedia_sdp_neg_negotiate (memPool_, negotiator_, 0); if(status != PJ_SUCCESS) { return status; } - status = pjmedia_sdp_neg_get_active_local(negociator, &active_local); + status = pjmedia_sdp_neg_get_active_local(negotiator_, &active_local); if(status != PJ_SUCCESS) { _error("SDP: Could not retrieve local active session"); } setActiveLocalSdpSession(active_local); - status = pjmedia_sdp_neg_get_active_remote(negociator, &active_remote); + status = pjmedia_sdp_neg_get_active_remote(negotiator_, &active_remote); if(status != PJ_SUCCESS) { _error("SDP: Could not retrieve remote active session"); } @@ -499,66 +494,62 @@ pj_status_t Sdp::startNegociation() void Sdp::updateInternalState() { // Populate internal field - setMediaTransportInfoFromRemoteSdp (activeRemoteSession); + setMediaTransportInfoFromRemoteSdp (activeRemoteSession_); } -void Sdp::addProtocol (void) +void Sdp::addProtocol () { - - this->localSession->origin.version = 0; + localSession_->origin.version = 0; } -void Sdp::addOrigin (void) +void Sdp::addOrigin () { - pj_time_val tv; pj_gettimeofday (&tv); - this->localSession->origin.user = pj_str (pj_gethostname()->ptr); + localSession_->origin.user = pj_str (pj_gethostname()->ptr); // Use Network Time Protocol format timestamp to ensure uniqueness. - this->localSession->origin.id = tv.sec + 2208988800UL; + localSession_->origin.id = tv.sec + 2208988800UL; // The type of network ( IN for INternet ) - this->localSession->origin.net_type = STR_IN; + localSession_->origin.net_type = STR_IN; // The type of address - this->localSession->origin.addr_type = STR_IP4; + localSession_->origin.addr_type = STR_IP4; // The address of the machine from which the session was created - this->localSession->origin.addr = pj_str ( (char*) localIpAddr.c_str()); + localSession_->origin.addr = pj_str ( (char*) localIpAddr_.c_str()); } -void Sdp::addSessionName (void) +void Sdp::addSessionName () { - this->localSession->name = STR_SDP_NAME; + localSession_->name = STR_SDP_NAME; } -void Sdp::addConnectionInfo (void) +void Sdp::addConnectionInfo () { - - this->localSession->conn->net_type = localSession->origin.net_type; - this->localSession->conn->addr_type = localSession->origin.addr_type; - this->localSession->conn->addr = localSession->origin.addr; + localSession_->conn->net_type = localSession_->origin.net_type; + localSession_->conn->addr_type = localSession_->origin.addr_type; + localSession_->conn->addr = localSession_->origin.addr; } -void Sdp::addTiming (void) +void Sdp::addTiming () { - // RFC 3264: An offer/answer model session description protocol // As the session is created and destroyed through an external signaling mean (SIP), the line // should have a value of "0 0". - this->localSession->time.start = this->localSession->time.stop = 0; + localSession_->time.start = localSession_->time.stop = 0; } void Sdp::addAttributes() { pjmedia_sdp_attr *a; - this->localSession->attr_count = 1; - a = PJ_POOL_ZALLOC_T (memPool, pjmedia_sdp_attr); + localSession_->attr_count = 1; + a = PJ_POOL_ZALLOC_T (memPool_, pjmedia_sdp_attr); a->name=STR_SENDRECV; - localSession->attr[0] = a; + localSession_->attr[0] = a; } @@ -567,33 +558,30 @@ void Sdp::addAudioMediaDescription() pjmedia_sdp_media* med; int nb_media, i; - med = PJ_POOL_ZALLOC_T (memPool, pjmedia_sdp_media); - nb_media = getLocalMediaCap().size(); + med = PJ_POOL_ZALLOC_T (memPool_, pjmedia_sdp_media); + nb_media = localAudioMediaCap_.size(); // For DTMF RTP events - localSession->media_count = nb_media; + localSession_->media_count = nb_media; for (i=0; i<nb_media; i++) { - setMediaDescriptorLine (getLocalMediaCap() [i], &med); - localSession->media[i] = med; + setMediaDescriptorLine (localAudioMediaCap_[i], &med); + localSession_->media[i] = med; } - - } -void Sdp::addSdesAttribute (std::vector<std::string>& crypto) throw (SdpException) +void Sdp::addSdesAttribute (const std::vector<std::string>& crypto) { - // temporary buffer used to store crypto attribute char tempbuf[256]; - std::vector<std::string>::iterator iter = crypto.begin(); + std::vector<std::string>::const_iterator iter = crypto.begin(); while (iter != crypto.end()) { // the attribute to add to sdp - pjmedia_sdp_attr *attribute = (pjmedia_sdp_attr*) pj_pool_zalloc (memPool, sizeof (pjmedia_sdp_attr)); + pjmedia_sdp_attr *attribute = (pjmedia_sdp_attr*) pj_pool_zalloc (memPool_, sizeof (pjmedia_sdp_attr)); - attribute->name = pj_strdup3 (memPool, "crypto"); + attribute->name = pj_strdup3 (memPool_, "crypto"); // _debug("crypto from sdp: %s", crypto.c_str()); @@ -602,36 +590,36 @@ void Sdp::addSdesAttribute (std::vector<std::string>& crypto) throw (SdpExceptio "%.*s", (int) (*iter).size(), (*iter).c_str()); attribute->value.slen = len; - attribute->value.ptr = (char*) pj_pool_alloc (memPool, attribute->value.slen+1); + attribute->value.ptr = (char*) pj_pool_alloc (memPool_, attribute->value.slen+1); pj_memcpy (attribute->value.ptr, tempbuf, attribute->value.slen+1); // get number of media for this SDP - int media_count = localSession->media_count; + int media_count = localSession_->media_count; // add crypto attribute to media for (int i = 0; i < media_count; i++) { - if (pjmedia_sdp_media_add_attr (localSession->media[i], attribute) != PJ_SUCCESS) { + if (pjmedia_sdp_media_add_attr (localSession_->media[i], attribute) != PJ_SUCCESS) { // if(pjmedia_sdp_attr_add(&(_local_offer->attr_count), _local_offer->attr, attribute) != PJ_SUCCESS){ throw SdpException ("Could not add sdes attribute to media"); } } - iter++; + ++iter; } } -void Sdp::addZrtpAttribute (pjmedia_sdp_media* media, std::string hash) throw (SdpException) +void Sdp::addZrtpAttribute (pjmedia_sdp_media* media, std::string hash) { pjmedia_sdp_attr *attribute; char tempbuf[256]; int len; - attribute = (pjmedia_sdp_attr*) pj_pool_zalloc (memPool, sizeof (pjmedia_sdp_attr)); + attribute = (pjmedia_sdp_attr*) pj_pool_zalloc (memPool_, sizeof (pjmedia_sdp_attr)); - attribute->name = pj_strdup3 (memPool, "zrtp-hash"); + attribute->name = pj_strdup3 (memPool_, "zrtp-hash"); /* Format: ":version value" */ len = pj_ansi_snprintf (tempbuf, sizeof (tempbuf), @@ -642,7 +630,7 @@ void Sdp::addZrtpAttribute (pjmedia_sdp_media* media, std::string hash) throw (S hash.c_str()); attribute->value.slen = len; - attribute->value.ptr = (char*) pj_pool_alloc (memPool, attribute->value.slen+1); + attribute->value.ptr = (char*) pj_pool_alloc (memPool_, attribute->value.slen+1); pj_memcpy (attribute->value.ptr, tempbuf, attribute->value.slen+1); if (pjmedia_sdp_media_add_attr (media, attribute) != PJ_SUCCESS) { @@ -650,39 +638,23 @@ void Sdp::addZrtpAttribute (pjmedia_sdp_media* media, std::string hash) throw (S } } -std::string Sdp::mediaToString (void) -{ - int size, i; - std::ostringstream res; - - size = localAudioMediaCap.size(); - - for (i = 0; i < size ; i++) { - res << localAudioMediaCap[i]->to_string(); - } - - res << std::endl; - - return res.str(); -} - void Sdp::cleanSessionMedia() { _info ("SDP: Clean session media"); - if (sessionAudioMedia.size() > 0) { + if (not sessionAudioMedia_.empty()) { - std::vector<sdpMedia *>::iterator iter = sessionAudioMedia.begin(); + std::vector<sdpMedia *>::iterator iter = sessionAudioMedia_.begin(); sdpMedia *media; - while (iter != sessionAudioMedia.end()) { + while (iter != sessionAudioMedia_.end()) { _debug ("delete media"); media = *iter; delete media; - iter++; + ++iter; } - sessionAudioMedia.clear(); + sessionAudioMedia_.clear(); } } @@ -691,94 +663,44 @@ void Sdp::cleanLocalMediaCapabilities() { _info ("SDP: Clean local media capabilities"); - if (localAudioMediaCap.size() > 0) { + if (not localAudioMediaCap_.empty()) { - std::vector<sdpMedia *>::iterator iter = localAudioMediaCap.begin(); + std::vector<sdpMedia *>::iterator iter = localAudioMediaCap_.begin(); sdpMedia *media; - while (iter != localAudioMediaCap.end()) { + while (iter != localAudioMediaCap_.end()) { media = *iter; delete media; - iter++; + ++iter; } - localAudioMediaCap.clear(); - } -} - -void Sdp::toString (void) -{ - - std::ostringstream sdp; - int count, i; - - sdp << "origin= " << localSession->origin.user.ptr << "\n"; - sdp << "origin.id= " << localSession->origin.id << "\n"; - sdp << "origin.version= " << localSession->origin.version<< "\n"; - sdp << "origin.net_type= " << localSession->origin.net_type.ptr<< "\n"; - sdp << "origin.addr_type= " << localSession->origin.addr_type.ptr<< "\n"; - - sdp << "name=" << localSession->name.ptr<< "\n"; - - sdp << "conn.net_type=" << localSession->conn->net_type.ptr<< "\n"; - sdp << "conn.addr_type=" << localSession->conn->addr_type.ptr<< "\n"; - sdp << "conn.addr=" << localSession->conn->addr.ptr<< "\n"; - - sdp << "start=" <<localSession->time.start<< "\n"; - sdp << "stop=" <<localSession->time.stop<< "\n"; - - sdp << "attr_count=" << localSession->attr_count << "\n"; - sdp << "media_count=" << localSession->media_count << "\n"; - sdp << "m=" << localSession->media[0]->desc.media.ptr << " "; - sdp << localSession->media[0]->desc.port << " "; - sdp << localSession->media[0]->desc.transport.ptr << " "; - count = localSession->media[0]->desc.fmt_count; - - for (i=0; i<count; i++) { - sdp << localSession->media[0]->desc.fmt[i].ptr << " "; + localAudioMediaCap_.clear(); } - - sdp << "\n"; - - _debug ("LOCAL SDP: \n%s", sdp.str().c_str()); } void Sdp::setPortToAllMedia (int port) { - - std::vector<sdpMedia*> medias; - int i, size; - setLocalPublishedAudioPort (port); - medias = getLocalMediaCap (); - size = medias.size(); + int size = localAudioMediaCap_.size(); - for (i=0; i<size; i++) { - medias[i]->set_port (port); - } + for (int i = 0; i < size; i++) + localAudioMediaCap_[i]->set_port (port); } void Sdp::addAttributeToLocalAudioMedia(std::string attr) { pjmedia_sdp_attr *attribute; - attribute = pjmedia_sdp_attr_create (memPool, attr.c_str(), NULL); + attribute = pjmedia_sdp_attr_create (memPool_, attr.c_str(), NULL); - pjmedia_sdp_media_add_attr (getLocalSdpSession()->media[0], attribute); + pjmedia_sdp_media_add_attr (localSession_->media[0], attribute); } void Sdp::removeAttributeFromLocalAudioMedia(std::string attr) { - pjmedia_sdp_media_remove_all_attr (getLocalSdpSession()->media[0], attr.c_str()); - -} + pjmedia_sdp_media_remove_all_attr (localSession_->media[0], attr.c_str()); -std::string Sdp::convertIntToString (int value) -{ - std::ostringstream result; - result << value; - return result.str(); } void Sdp::setRemoteIpFromSdp (const pjmedia_sdp_session *r_sdp) @@ -791,12 +713,8 @@ void Sdp::setRemoteIpFromSdp (const pjmedia_sdp_session *r_sdp) void Sdp::setRemoteAudioPortFromSdp (pjmedia_sdp_media *r_media) { - - int remote_port; - - remote_port = r_media->desc.port; - _info ("SDP: Remote Audio Port from fetching SDP: %d", remote_port); - this->setRemoteAudioPort (remote_port); + _info ("SDP: Remote Audio Port from fetching SDP: %d", r_media->desc.port); + this->setRemoteAudioPort (r_media->desc.port); } void Sdp::setMediaTransportInfoFromRemoteSdp (const pjmedia_sdp_session *remote_sdp) @@ -873,9 +791,9 @@ void Sdp::getRemoteSdpTelephoneEventFromOffer(const pjmedia_sdp_session *remote_ if(attribute != NULL) { - pjmedia_sdp_attr_to_rtpmap (memPool, attribute, &rtpmap); + pjmedia_sdp_attr_to_rtpmap (memPool_, attribute, &rtpmap); - telephoneEventPayload = pj_strtoul (&rtpmap->pt); + telephoneEventPayload_ = pj_strtoul (&rtpmap->pt); } } @@ -918,9 +836,7 @@ void Sdp::getRemoteSdpCryptoFromOffer (const pjmedia_sdp_session* remote_sdp, Cr crypto_offer.push_back (full_attr); } - } } - } diff --git a/sflphone-common/src/sip/sdp.h b/sflphone-common/src/sip/sdp.h index 7534d409ddd08490f98e1f23c886311fbe678b8c..9b6cca4579f680beed04d1152e6108958c5707c6 100644 --- a/sflphone-common/src/sip/sdp.h +++ b/sflphone-common/src/sip/sdp.h @@ -42,7 +42,7 @@ #include <pj/assert.h> #include <vector> #include <string> -#include <exception> +#include <stdexcept> #include "global.h" // FIXME: CodecOrder shouldn't be in global.h class sdpMedia; @@ -51,24 +51,14 @@ namespace sfl { class AudioCodec; } -class SdpException : public std::exception +class SdpException : public std::runtime_error { public: - SdpException (const std::string& str="") throw() : errstr (str) {} - - virtual ~SdpException() throw() {} - - virtual const char *what() const throw() { - std::string expt ("SDP: SdpException occured: "); - expt.append (errstr); - return expt.c_str(); - } - private: - std::string errstr; + SdpException (const std::string& str="") : + std::runtime_error("SDP: SdpException occured: " + str) {} }; typedef std::vector<std::string> CryptoOffer; -typedef std::vector<sdpMedia *> SdpMediaList; class Sdp { @@ -82,24 +72,11 @@ class Sdp */ Sdp (pj_pool_t *pool); - /* Class destructor */ - ~Sdp(); - - /* - * Read accessor. Get the list of the local media capabilities. - * - * @return std::vector<sdpMedia*> the vector containing the different media - */ - std::vector<sdpMedia *> getLocalMediaCap (void) { - return localAudioMediaCap; - } - - /** * Accessor for the internal memory pool */ pj_pool_t *getMemoryPool (void) const { - return memPool; + return memPool_; } /** @@ -108,7 +85,7 @@ class Sdp * @return The structure that describes a SDP session */ pjmedia_sdp_session *getLocalSdpSession (void) { - return localSession; + return localSession_; } /** @@ -117,70 +94,71 @@ class Sdp * @return The structure that describe the SDP session */ pjmedia_sdp_session *getRemoteSdpSession(void) { - return remoteSession; + return remoteSession_; } /** - * Set the negociated sdp offer from the sip payload. + * Set the negotiated sdp offer from the sip payload. * - * @param sdp the negociated offer + * @param sdp the negotiated offer */ void setActiveLocalSdpSession (const pjmedia_sdp_session *sdp); /** - * read accessor. Return the negociated local session + * read accessor. Return the negotiated local session * - * @return pjmedia_sdp_session The negociated offer + * @return pjmedia_sdp_session The negotiated offer */ pjmedia_sdp_session* getActiveLocalSdpSession (void) { - return activeLocalSession; + return activeLocalSession_; } /** - * Retrieve the negociated sdp offer from the sip payload. + * Retrieve the negotiated sdp offer from the sip payload. * - * @param sdp the negociated offer + * @param sdp the negotiated offer */ void setActiveRemoteSdpSession (const pjmedia_sdp_session *sdp); /** - * read accessor. Return the negociated offer + * read accessor. Return the negotiated offer * - * @return pjmedia_sdp_session The negociated offer + * @return pjmedia_sdp_session The negotiated offer */ pjmedia_sdp_session* getActiveRemoteSdpSession (void) { - return activeRemoteSession; + return activeRemoteSession_; } /** - * Return wether or not the media have been determined for this sdp session - */ - bool hasSessionMedia(void); + * Return whether or not the media have been determined for this sdp session + */ + bool hasSessionMedia(void) const; /** - * Return the codec of the first media after negociation + * Return the codec of the first media after negotiation + * @throw SdpException */ - sfl::AudioCodec* getSessionMedia (void) throw(SdpException); + sfl::AudioCodec* getSessionMedia (void); /* * On building an invite outside a dialog, build the local offer and create the - * SDP negociator instance with it. + * SDP negotiator instance with it. */ int createOffer (CodecOrder selectedCodecs); /* * On receiving an invite outside a dialog, build the local offer and create the - * SDP negociator instance with the remote offer. + * SDP negotiator instance with the remote offer. * * @param remote The remote offer */ - int recieveOffer (const pjmedia_sdp_session* remote, CodecOrder selectedCodecs); + int receiveOffer (const pjmedia_sdp_session* remote, CodecOrder selectedCodecs); /* * On receiving a message, check if it contains SDP and negotiate. Should be used for * SDP answer and offer but currently is only used for answer. - * SDP negociator instance with the remote offer. + * SDP negotiator instance with the remote offer. * * @param inv The the invitation * @param rdata The remote data @@ -193,12 +171,12 @@ class Sdp int generateAnswerAfterInitialOffer(void); /** - * Start the sdp negociation. + * Start the sdp negotiation. * * @return pj_status_t 0 on success * 1 otherwise */ - pj_status_t startNegociation (void); + pj_status_t startNegotiation (void); /** * Update internal state after negotiation @@ -215,12 +193,6 @@ class Sdp */ void cleanLocalMediaCapabilities (void); - /** - * Return a string description of the media added to the session, - * ie the local media capabilities - */ - std::string mediaToString (void); - /* * Attribute the specified port to every medias provided * This is valid only because we are using one media @@ -230,33 +202,32 @@ class Sdp */ void setPortToAllMedia (int port); - /* * Write accessor. Set the local IP address that will be used in the sdp session */ - void setLocalIP (std::string ip_addr) { - localIpAddr = ip_addr; + void setLocalIP (const std::string &ip_addr) { + localIpAddr_ = ip_addr; } /* * Read accessor. Get the local IP address */ - std::string getLocalIP (void) { - return localIpAddr; + std::string getLocalIP (void) const { + return localIpAddr_; } /** * @param Set the published audio port */ void setLocalPublishedAudioPort (int port) { - localAudioPort = port; + localAudioPort_ = port; } /** * @return The published audio port */ - int getLocalPublishedAudioPort (void) { - return localAudioPort; + int getLocalPublishedAudioPort (void) const { + return localAudioPort_; } /** @@ -264,7 +235,7 @@ class Sdp * @param ip The remote IP address */ void setRemoteIP (const std::string& ip) { - remoteIpAddr = ip; + remoteIpAddr_ = ip; } /** @@ -272,7 +243,7 @@ class Sdp * @return const std:string The remote IP address */ const std::string& getRemoteIP() { - return remoteIpAddr; + return remoteIpAddr_; } /** @@ -280,22 +251,23 @@ class Sdp * @param port The remote audio port */ void setRemoteAudioPort (unsigned int port) { - remoteAudioPort = port; + remoteAudioPort_ = port; } /** * Return audio port at destination [mutex protected] * @return unsigned int The remote audio port */ - unsigned int getRemoteAudioPort() { - return remoteAudioPort; + unsigned int getRemoteAudioPort() const { + return remoteAudioPort_; } + /** * Get media list for this session */ - SdpMediaList getSessionMediaList (void) { - return sessionAudioMedia; + std::vector<sdpMedia *> getSessionMediaList (void) const { + return sessionAudioMedia_; } /** @@ -308,7 +280,6 @@ class Sdp */ void removeAttributeFromLocalAudioMedia(std::string); - /** * Get SRTP master key * @param remote sdp session @@ -321,7 +292,7 @@ class Sdp * @param mk The Master Key of a srtp session. */ void setLocalSdpCrypto (const std::vector<std::string> lc) { - srtpCrypto = lc; + srtpCrypto_ = lc; } /** @@ -331,99 +302,91 @@ class Sdp * @param hash The hello hash of a rtp session. (Only audio at the moment) */ void setZrtpHash (const std::string& hash) { - zrtpHelloHash = hash; + zrtpHelloHash_ = hash; } - - unsigned int getTelephoneEventType() { - return telephoneEventPayload; + unsigned int getTelephoneEventType() const { + return telephoneEventPayload_; } - - /** - * Print internal state info - */ - void toString (void); - - private: /** * The pool to allocate memory, ownership to SipCall * SDP should not release the pool itself */ - pj_pool_t *memPool; + pj_pool_t *memPool_; - /** negociator */ - pjmedia_sdp_neg *negociator; + /** negotiator */ + pjmedia_sdp_neg *negotiator_; /** * Local SDP */ - pjmedia_sdp_session *localSession; + pjmedia_sdp_session *localSession_; /** * Remote SDP */ - pjmedia_sdp_session *remoteSession; + pjmedia_sdp_session *remoteSession_; /** - * The negociated SDP remote session - * Explanation: each endpoint's offer is negociated, and a new sdp offer results from this - * negociation, with the compatible media from each part + * The negotiated SDP remote session + * Explanation: each endpoint's offer is negotiated, and a new sdp offer results from this + * negotiation, with the compatible media from each part */ - pjmedia_sdp_session *activeLocalSession; + pjmedia_sdp_session *activeLocalSession_; /** - * The negociated SDP remote session - * Explanation: each endpoint's offer is negociated, and a new sdp offer results from this - * negociation, with the compatible media from each part + * The negotiated SDP remote session + * Explanation: each endpoint's offer is negotiated, and a new sdp offer results from this + * negotiation, with the compatible media from each part */ - pjmedia_sdp_session *activeRemoteSession; + pjmedia_sdp_session *activeRemoteSession_; /** * Codec Map used for offer */ - SdpMediaList localAudioMediaCap; + std::vector<sdpMedia *> localAudioMediaCap_; /** - * The media that will be used by the session (after the SDP negociation) + * The media that will be used by the session (after the SDP negotiation) */ - SdpMediaList sessionAudioMedia; + std::vector<sdpMedia *> sessionAudioMedia_; /** * IP address */ - std::string localIpAddr; + std::string localIpAddr_; /** * Remote's IP address */ - std::string remoteIpAddr; + std::string remoteIpAddr_; /** * Local audio port */ - int localAudioPort; + int localAudioPort_; /** * Remote audio port */ - unsigned int remoteAudioPort; + unsigned int remoteAudioPort_; /** * Zrtp hello hash */ - std::string zrtpHelloHash; + std::string zrtpHelloHash_; /** * "a=crypto" sdes local attributes obtained from AudioSrtpSession */ - std::vector<std::string> srtpCrypto; + std::vector<std::string> srtpCrypto_; /** * Payload type for dtmf telephone event */ - unsigned int telephoneEventPayload; + unsigned int telephoneEventPayload_; Sdp (const Sdp&); //No Copy Constructor @@ -482,7 +445,6 @@ class Sdp */ void addTiming (void); - /* * Optional field: Session information ("s=") * Provides textual information about the session. @@ -532,8 +494,9 @@ class Sdp * Adds a sdes attribute to the given media section. * * @param media The media to add the srtp attribute to + * @throw SdpException */ - void addSdesAttribute (std::vector<std::string>& crypto) throw (SdpException); + void addSdesAttribute (const std::vector<std::string>& crypto); /* * Adds a zrtp-hash attribute to @@ -543,10 +506,9 @@ class Sdp * * @param media The media to add the zrtp-hash attribute to * @param hash The hash to which the attribute should be set to + * @throw SdpException */ - void addZrtpAttribute (pjmedia_sdp_media* media, std::string hash) throw (SdpException); - - std::string convertIntToString (int value); + void addZrtpAttribute (pjmedia_sdp_media* media, std::string hash); void setRemoteIpFromSdp (const pjmedia_sdp_session *r_sdp); @@ -557,8 +519,6 @@ class Sdp void getRemoteSdpTelephoneEventFromOffer(const pjmedia_sdp_session *remote_sdp); void getRemoteSdpMediaFromOffer (const pjmedia_sdp_session* remote_sdp, pjmedia_sdp_media** r_media); - - }; diff --git a/sflphone-common/src/sip/sipvoiplink.cpp b/sflphone-common/src/sip/sipvoiplink.cpp index 70138bd3aebe81528fdf4506034ea429b0b5b660..7d41dd3d755acb951456b4350f1b6bcf70704c05 100644 --- a/sflphone-common/src/sip/sipvoiplink.cpp +++ b/sflphone-common/src/sip/sipvoiplink.cpp @@ -764,7 +764,7 @@ SIPVoIPLink::answer (const CallID& id) throw (VoipLinkException) if (status == PJ_SUCCESS) { - _debug ("UserAgent: SDP Negociation success! : call %s ", call->getCallId().c_str()); + _debug ("UserAgent: SDP negotiation success! : call %s ", call->getCallId().c_str()); // Create and send a 200(OK) response if((status = pjsip_inv_answer (inv_session, PJSIP_SC_OK, NULL, NULL, &tdata)) != PJ_SUCCESS) { throw VoipLinkException("Could not init invite request answer (200 OK)"); @@ -778,7 +778,7 @@ SIPVoIPLink::answer (const CallID& id) throw (VoipLinkException) return true; } else { - // Create and send a 488/Not acceptable because the SDP negociation failed + // Create and send a 488/Not acceptable because the SDP negotiation failed if((status = pjsip_inv_answer (inv_session, PJSIP_SC_NOT_ACCEPTABLE_HERE, NULL, NULL, &tdata)) != PJ_SUCCESS) { throw VoipLinkException("Could not init invite answer (488 not acceptable here)"); } @@ -786,7 +786,7 @@ SIPVoIPLink::answer (const CallID& id) throw (VoipLinkException) throw VoipLinkException("Could not init invite request answer (488 NOT ACCEPTABLE HERE)"); } // Terminate the call - _debug ("UserAgent: SDP Negociation failed, terminate call %s ", call->getCallId().c_str()); + _debug ("UserAgent: SDP negotiation failed, terminate call %s ", call->getCallId().c_str()); if(call->getAudioRtp()) { throw VoipLinkException("No audio rtp session for this call"); @@ -1021,7 +1021,7 @@ SIPVoIPLink::offhold (const CallID& id) throw (VoipLinkException) call->getAudioRtp()->start (static_cast<sfl::AudioCodec *>(audiocodec)); } - catch (SdpException &e) { + catch (const SdpException &e) { _error("UserAgent: Exception: %s", e.what()); } catch (...) { @@ -1373,7 +1373,7 @@ SIPVoIPLink::getCurrentCodecName(const CallID& id) return name; } } - catch (SdpException &e) { + catch (const SdpException &e) { _error("UserAgent: Exception: %s", e.what()); } @@ -3329,8 +3329,8 @@ void sdp_request_offer_cb (pjsip_inv_session *inv, const pjmedia_sdp_session *of SIPAccount *account = dynamic_cast<SIPAccount *> (Manager::instance().getAccount (accId)); - status = call->getLocalSDP()->recieveOffer (offer, account->getActiveCodecs ()); - call->getLocalSDP()->startNegociation(); + status = call->getLocalSDP()->receiveOffer (offer, account->getActiveCodecs ()); + call->getLocalSDP()->startNegotiation(); status = pjsip_inv_set_sdp_answer (call->getInvSession(), call->getLocalSDP()->getLocalSdpSession()); @@ -3397,7 +3397,7 @@ void sdp_media_update_cb (pjsip_inv_session *inv, pj_status_t status) call = reinterpret_cast<SIPCall *> (inv->mod_data[getModId()]); if (call == NULL) { - _debug ("UserAgent: Call declined by peer, SDP negociation stopped"); + _debug ("UserAgent: Call declined by peer, SDP negotiation stopped"); return; } @@ -3470,7 +3470,7 @@ void sdp_media_update_cb (pjsip_inv_session *inv, pj_status_t status) sfl::SdesNegotiator sdesnego (localCapabilities, crypto_offer); if (sdesnego.negotiate()) { - _debug ("UserAgent: SDES negociation successfull"); + _debug ("UserAgent: SDES negotiation successfull"); nego_success = true; _debug ("UserAgent: Set remote cryptographic context"); @@ -3492,7 +3492,7 @@ void sdp_media_update_cb (pjsip_inv_session *inv, pj_status_t status) // We did not found any crypto context for this media // @TODO if SRTPONLY, CallFail - _debug ("UserAgent: Did not found any crypto or negociation failed but Sdes enabled"); + _debug ("UserAgent: Did not found any crypto or negotiation failed but Sdes enabled"); call->getAudioRtp()->stop(); call->getAudioRtp()->setSrtpEnabled (false); @@ -3972,7 +3972,7 @@ transaction_request_cb (pjsip_rx_data *rdata) // Set the codec map, IP, peer number and so on... for the SIPCall object setCallMediaLocal (call, addrToUse); - // We retrieve the remote sdp offer in the rdata struct to begin the negociation + // We retrieve the remote sdp offer in the rdata struct to begin the negotiation call->getLocalSDP()->setLocalIP (addrSdp); // Init audio rtp session @@ -4017,7 +4017,7 @@ transaction_request_cb (pjsip_rx_data *rdata) sfl::SdesNegotiator sdesnego (localCapabilities, crypto_offer); if (sdesnego.negotiate()) { - _debug ("UserAgent: SDES negociation successfull \n"); + _debug ("UserAgent: SDES negotiation successfull \n"); nego_success = true; try { @@ -4033,7 +4033,7 @@ transaction_request_cb (pjsip_rx_data *rdata) } - status = call->getLocalSDP()->recieveOffer (r_sdp, account->getActiveCodecs ()); + status = call->getLocalSDP()->receiveOffer (r_sdp, account->getActiveCodecs ()); if (status!=PJ_SUCCESS) { delete call; call = NULL; @@ -4687,8 +4687,6 @@ bool setCallMediaLocal (SIPCall* call, const std::string &localIP) account = dynamic_cast<SIPAccount *> (Manager::instance().getAccount (account_id)); - - // Setting Audio unsigned int callLocalAudioPort = RANDOM_LOCAL_PORT; unsigned int callLocalExternAudioPort = callLocalAudioPort; diff --git a/sflphone-common/test/Makefile.am b/sflphone-common/test/Makefile.am index c95764ebfdd82887c4f8a2b396762ee0cc9962a4..42741e2b361b03c89d7c8bed0c15e9935a852112 100644 --- a/sflphone-common/test/Makefile.am +++ b/sflphone-common/test/Makefile.am @@ -48,7 +48,6 @@ LLIBS=$(CPPUNIT_LIBS) \ ../src/sflphoned-eventthread.o \ ../src/sflphoned-managerimpl_registration.o \ ../src/sflphoned-numbercleaner.o \ - ../src/sflphoned-observer.o \ ../src/sflphoned-voiplink.o \ ../src/sflphoned-preferences.o \ ../src/libsflphone.la diff --git a/sflphone-common/test/sdptest.cpp b/sflphone-common/test/sdptest.cpp index d548e8a3a63e72d9105c1a8e628e6e4a63cff42f..b85102feff640b73e4da9b112ec5ba90b7aa698e 100644 --- a/sflphone-common/test/sdptest.cpp +++ b/sflphone-common/test/sdptest.cpp @@ -144,7 +144,7 @@ void SDPTest::testInitialOfferFirstCodec () _session->receivingAnswerAfterInitialOffer(remoteAnswer); - _session->startNegociation(); + _session->startNegotiation(); _session->updateInternalState(); @@ -177,9 +177,9 @@ void SDPTest::testInitialAnswerFirstCodec () _session->setLocalIP("127.0.0.1"); _session->setLocalPublishedAudioPort(49567); - _session->recieveOffer(remoteOffer, codecSelection); + _session->receiveOffer(remoteOffer, codecSelection); - _session->startNegociation(); + _session->startNegotiation(); _session->updateInternalState(); @@ -217,7 +217,7 @@ void SDPTest::testInitialOfferLastCodec () _session->receivingAnswerAfterInitialOffer(remoteAnswer); - _session->startNegociation(); + _session->startNegotiation(); _session->updateInternalState(); @@ -250,9 +250,9 @@ void SDPTest::testInitialAnswerLastCodec () _session->setLocalIP("127.0.0.1"); _session->setLocalPublishedAudioPort(49567); - _session->recieveOffer(remoteOffer, codecSelection); + _session->receiveOffer(remoteOffer, codecSelection); - _session->startNegociation(); + _session->startNegotiation(); _session->updateInternalState(); @@ -292,7 +292,7 @@ void SDPTest::testReinvite () _session->receivingAnswerAfterInitialOffer(remoteAnswer); - _session->startNegociation(); + _session->startNegotiation(); _session->updateInternalState(); @@ -304,9 +304,9 @@ void SDPTest::testReinvite () pjmedia_sdp_parse(_testPool, (char*)sdp_reinvite, strlen(sdp_reinvite), &reinviteOffer); - _session->recieveOffer(reinviteOffer, codecSelection); + _session->receiveOffer(reinviteOffer, codecSelection); - _session->startNegociation(); + _session->startNegotiation(); _session->updateInternalState();