Commit 66c8355a authored by jpbl's avatar jpbl

See changelog

parent 58420831
SFLphone (0.4.1-rc1) / 2005-08-11
SFLphone (0.4.1-pre2) / now
* rearranged utilspp use
SFLphone (0.4.1-pre1) / 2005-08-11
* Use libeXosip2
* Add blink notification for voice-message
* Add scrolling text
......
Jean-Philippe Barette-LaPierre (28 April 2005) version 0.4.1-pre1
- Manager has now a LifetimeLibrary policy.
- Utilspp has been rearranged.
Laurielle LEA (10 August 2005) version 0.4
- Add blink notification for voice-message
- Cleanup code
......
......@@ -2,4 +2,4 @@ PortAudio: http://portaudio.com/archives/pa_snapshot_v19.tar.gz
Common C++ 2 1.3.6: http://sourceforge.net/projects/cplusplus/
ccRTP 1.3.0: http://sourceforge.net/projects/cplusplus/
libosip 2.2.1: http://savannah.gnu.org/projects/osip/
libeXosip2-1.9.1-pre15: http://www.antisip.com/download/
libeXosip2-1.9.1-pre15: http://www.antisip.com/download/
\ No newline at end of file
Installation Instructions
*************************
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
Software Foundation, Inc.
......
SUBDIRS = stund src skins rings pixmaps utilspp
SUBDIRS = utilspp stund src skins rings pixmaps
......@@ -137,11 +137,12 @@ src/audio/pacpp/source/Makefile \
src/audio/pacpp/source/portaudiocpp/Makefile \
src/gui/Makefile \
src/gui/qt/Makefile \
utilspp/Makefile \
utilspp/singleton/Makefile \
stund/Makefile \
pixmaps/Makefile \
skins/Makefile \
skins/emetal/Makefile \
skins/metal/Makefile \
rings/Makefile \
utilspp/Makefile \
)
......@@ -36,8 +36,8 @@ sflphone_SOURCES = \
sflphone_CXXFLAGS = -DPREFIX=\"$(prefix)\" -DPROGSHAREDIR=\"${datadir}/sflphone\"
sflphone_LDFLAGS = $(QT_LDFLAGS) $(X_LDFLAGS)
sflphone_LDADD = gui/libguiframework.la audio/libaudio.la ../stund/libstun.la -lpthread $(LIBQT) $(SFLPHONE_LIBS)
sflphone_LDFLAGS = $(QT_LDFLAGS) $(X_LDFLAGS) -static
sflphone_LDADD = gui/libguiframework.la audio/libaudio.la ../stund/libstun.la ../utilspp/libutilspp.la -lpthread $(LIBQT) $(SFLPHONE_LIBS)
KDE_CXXFLAGS = $(USE_EXCEPTIONS)
AM_CPPFLAGS = $(QT_INCLUDES) $(X_INCLUDES) -Iaudio/pacpp/include $(libccext2_CFLAGS) $(libccgnu2_CFLAGS) $(portaudio_CFLAGS)
......
......@@ -17,7 +17,6 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <string.h>
#include <iostream>
#include <string>
......
......@@ -36,22 +36,29 @@
int
main (int argc, char **argv) {
int exit_code;
Config::setTree(new ConfigurationTree());
GuiFramework *GUI;
#if defined(GUI_QT)
QApplication a(argc, argv);
Manager::instance().initConfigFile();
GUI = new QtGUIMainWindow (0, 0 ,
Qt::WDestructiveClose |
Qt::WStyle_Customize |
Qt::WStyle_NoBorder);
Manager::instance().setGui(GUI);
Manager::instance().init();
a.setMainWidget((QtGUIMainWindow*)GUI);
return a.exec();
{
utilspp::LifetimeLibraryGuard< utilspp::LifetimeLibrarySingleton > guard();
(void)guard;
QApplication a(argc, argv);
Manager::instance().initConfigFile();
GUI = new QtGUIMainWindow (0, 0 ,
Qt::WDestructiveClose |
Qt::WStyle_Customize |
Qt::WStyle_NoBorder);
Manager::instance().setGui(GUI);
Manager::instance().init();
a.setMainWidget((QtGUIMainWindow*)GUI);
exit_code = a.exec();
}
#endif
return exit_code;
}
......
......@@ -21,12 +21,14 @@
#ifndef SFLPHONE_MANAGER_H
#define SFLPHONE_MANAGER_H
#include "utilspp/singleton_holder.hpp"
#include "utilspp/Singleton.hpp"
#include "managerimpl.h"
typedef utilspp::singleton_holder< ManagerImpl > Manager;
typedef utilspp::SingletonHolder< ManagerImpl,
utilspp::CreationUsingNew,
utilspp::LifetimeLibrary,
utilspp::ThreadingSingle > Manager;
#endif
SUBDIRS = singleton
lib_LTLIBRARIES=libutilspp.la
libutilspp_la_SOURCES = \
NonCopyable.hpp \
NullType.hpp \
Singleton.hpp \
SmartPtr.hpp \
ThreadingFactoryMutex.hpp \
ThreadingSingle.hpp \
TypeList.hpp \
TypeTrait.hpp
pkginclude_HEADERS = \
NonCopyable.hpp \
NullType.hpp \
Singleton.hpp \
SmartPtr.hpp \
ThreadingFactoryMutex.hpp \
ThreadingSingle.hpp \
TypeList.hpp \
TypeTrait.hpp
pkgincludedir=$(includedir)/utilspp
libutilspp_la_LIBADD = ./singleton/libsingleton.la
/*
* 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
{
public:
NonCopyable()
{}
private:
NonCopyable(const NonCopyable& r)
{}
};
};
#endif
/*
* 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_NULLTYPE_HPP
#define UTILSPP_NULLTYPE_HPP
namespace utilspp
{
struct NullType;
};
#endif
#include "ThreadingSingle.hpp"
#include "singleton/SingletonHolder.hpp"
#include "singleton/LifetimeLibrary.hpp"
/*
* 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
/*
* 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
/*
* 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
/*
* 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 SINGLE_THREADED_HPP
#define SINGLE_THREADED_HPP
#include "NullType.hpp"
namespace utilspp
{
template < typename T = utilspp::NullType >
struct ThreadingSingle
{
struct mutex
{
void lock();
void unlock();
};
struct lock
{
lock();
lock( mutex &m );
};
typedef T VolatileType;
};
};
#include "ThreadingSingle.inl"
#endif
/*
* 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 SINGLE_THREADED_INL
#define SINGLE_THREADED_INL
template< typename T >
inline
utilspp::ThreadingSingle< T >::lock::lock()
{};
template< typename T >
inline
utilspp::ThreadingSingle< T >::lock::lock(
utilspp::ThreadingSingle< T >::mutex & )
{}
template< typename T >
inline
void
utilspp::ThreadingSingle< T >::mutex::lock()
{};
template< typename T >
inline
void
utilspp::ThreadingSingle< T >::mutex::unlock()
{};
#endif
/*
* 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"
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 };
};
//Indexed access
template< class TList, unsigned int index >
struct TypeAt;
template< class THead, class TTail >
struct TypeAt< TypeList< THead, TTail >, 0 >
{
typedef head result;
}
template< class THead, class TTail, unsigned int i >
struct TypeAt< TypeList< THead, TTail >, i >
{
typedef typename TypeAt< TTail, i - 1 >::result result;
};
//Searching TypeLists
template< class TList, class T >
struct index_of;
template< class T >
struct index_of< NullType, T >
{
enum { value = -1 };
};
template< class TTail, class T >
struct index_of< TypeList< T, TTail >, T >
{
enum { value = 0 };
};
template< class THead, class TTail, class T >
struct index_of< TypeList< THead, TTail >, T >
{
private:
enum { temp = index_of< 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 TYPELIST_1( T ) result;
};
template< class THead, class TTail >
struct append< NullType, 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 >