Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

use PDL for non-core resolver plugins

  • Loading branch information...
commit e0a49b8098e5bad97b617a3e7e88c8dd935f73a9 1 parent 051aa3f
@RJ authored
Showing with 2,890 additions and 501 deletions.
  1. +21 −46 playdar-daemon/CMakeLists.txt
  2. BIN  playdar-daemon/deps/pdl-0.3.0/AUTHORS
  3. +167 −0 playdar-daemon/deps/pdl-0.3.0/CMakeLists.txt
  4. +13 −0 playdar-daemon/deps/pdl-0.3.0/ChangeLog
  5. +265 −0 playdar-daemon/deps/pdl-0.3.0/Doxyfile
  6. +4 −0 playdar-daemon/deps/pdl-0.3.0/INSTALL
  7. +24 −0 playdar-daemon/deps/pdl-0.3.0/LICENSE
  8. 0  playdar-daemon/deps/pdl-0.3.0/NEWS
  9. +1 −0  playdar-daemon/deps/pdl-0.3.0/README
  10. +7 −0 playdar-daemon/deps/pdl-0.3.0/TESTING
  11. +1 −0  playdar-daemon/deps/pdl-0.3.0/TODO
  12. +191 −0 playdar-daemon/deps/pdl-0.3.0/doc/Introduction.html
  13. +76 −0 playdar-daemon/deps/pdl-0.3.0/doc/Readme.html
  14. +92 −0 playdar-daemon/deps/pdl-0.3.0/include/DynamicClass.hpp
  15. +136 −0 playdar-daemon/deps/pdl-0.3.0/include/DynamicLibrary.hpp
  16. +94 −0 playdar-daemon/deps/pdl-0.3.0/include/DynamicLibraryManager.hpp
  17. +176 −0 playdar-daemon/deps/pdl-0.3.0/include/DynamicLoader.hpp
  18. +75 −0 playdar-daemon/deps/pdl-0.3.0/include/LoaderException.hpp
  19. +84 −0 playdar-daemon/deps/pdl-0.3.0/include/platform.h
  20. +226 −0 playdar-daemon/deps/pdl-0.3.0/src/DynamicLibrary.cpp
  21. +142 −0 playdar-daemon/deps/pdl-0.3.0/src/DynamicLibraryManager.cpp
  22. +89 −0 playdar-daemon/deps/pdl-0.3.0/src/DynamicLoader.cpp
  23. +66 −0 playdar-daemon/deps/pdl-0.3.0/src/LoaderException.cpp
  24. +45 −0 playdar-daemon/deps/pdl-0.3.0/tests/TestClass1.cpp
  25. +63 −0 playdar-daemon/deps/pdl-0.3.0/tests/TestClass1.hpp
  26. +45 −0 playdar-daemon/deps/pdl-0.3.0/tests/TestClass2.cpp
  27. +63 −0 playdar-daemon/deps/pdl-0.3.0/tests/TestClass2.hpp
  28. +127 −0 playdar-daemon/deps/pdl-0.3.0/tests/TestDynamicLibrary.cpp
  29. +96 −0 playdar-daemon/deps/pdl-0.3.0/tests/TestDynamicLibraryManager.cpp
  30. +80 −0 playdar-daemon/deps/pdl-0.3.0/tests/TestDynamicLoader.cpp
  31. +53 −0 playdar-daemon/deps/pdl-0.3.0/tests/TestInterface.hpp
  32. +71 −0 playdar-daemon/deps/pdl-0.3.0/tests/TestLoaderException.cpp
  33. +42 −0 playdar-daemon/deps/pdl-0.3.0/tests/UnitTest.hpp
  34. +0 −1  playdar-daemon/playdar.kdevelop.filelist
  35. BIN  playdar-daemon/playdar.kdevelop.pcs
  36. +2 −78 playdar-daemon/playdar.kdevses
  37. +3 −1 playdar-daemon/src/playdar/main.cpp
  38. +49 −0 playdar-daemon/src/resolvers/darknet/CMakeLists.txt
  39. +8 −17 playdar-daemon/src/resolvers/darknet/rs_darknet.cpp
  40. +14 −8 playdar-daemon/src/resolvers/darknet/rs_darknet.h
  41. +49 −0 playdar-daemon/src/resolvers/gateway_script/CMakeLists.txt
  42. +4 −0 playdar-daemon/src/resolvers/gateway_script/README.txt
  43. +13 −8 playdar-daemon/src/resolvers/{rs_http_gateway_script.cpp → gateway_script/gateway_script.cpp}
  44. +7 −3 playdar-daemon/src/resolvers/{rs_http_gateway_script.h → gateway_script/gateway_script.h}
  45. +2 −2 playdar-daemon/src/resolvers/lan/CMakeLists.txt
  46. +71 −7 playdar-daemon/src/resolvers/resolver.cpp
  47. +3 −0  playdar-daemon/src/resolvers/resolver.h
  48. +16 −4 playdar-daemon/src/resolvers/resolver_service.h
  49. +4 −1 playdar-daemon/src/resolvers/rs_http_playdar.h
  50. +0 −273 playdar-daemon/src/resolvers/rs_lan_udp.cpp
  51. +0 −47 playdar-daemon/src/resolvers/rs_lan_udp.h
  52. +5 −3 playdar-daemon/src/resolvers/rs_local_library.cpp
  53. +5 −2 playdar-daemon/src/resolvers/rs_local_library.h
View
67 playdar-daemon/CMakeLists.txt
@@ -5,21 +5,25 @@ SET(CMAKE_MODULE_PATH "CMakeModules")
FIND_PACKAGE(Taglib 1.5.0 REQUIRED)
FIND_PACKAGE(Boost 1.35 REQUIRED COMPONENTS filesystem system regex thread program_options)
FIND_PACKAGE(OsspUuid)
-FIND_PACKAGE(UriParser 0.7.0)
+#FIND_PACKAGE(Uriparser 0.7.0)
FIND_PACKAGE(Sqlite3)
-INCLUDE_DIRECTORIES(${URIPARSER_INCLUDE_DIR}
+INCLUDE_DIRECTORIES(#${URIPARSER_INCLUDE_DIR}
${OSSPUUID_INCLUDE_DIR}
${Boost_INCLUDE_DIR}
${SQLITE3_INCLUDE_DIR}
${TAGLIB_INCLUDES}
+ /usr/local/include
src
deps/moost_http/include # our httpd server, from erikf's moost
deps/sqlite3pp-read-only # cpp wrapper for sqlite api
deps/json_spirit_v3.00 # json parser, using boost spirit
- deps/boost.process # x-platform spawn processes and manage stdin/out
+ deps/pdl-0.3.0/include # x-platform dynamic loading of libraries
)
+LINK_DIRECTORIES(/usr/local/lib) # for uriparser
+
+
SET(CMAKE_VERBOSE_MAKEFILE ON)
INCLUDE(InstallRequiredSystemLibraries)
@@ -55,29 +59,36 @@ ADD_EXECUTABLE( playdar
src/resolvers/resolver.cpp
src/resolvers/resolver_service.cpp
src/resolvers/rs_local_library.cpp
- src/resolvers/rs_lan_udp.cpp
- src/resolvers/rs_http_gateway_script.cpp
- src/resolvers/darknet/rs_darknet.cpp
- src/resolvers/darknet/servent.cpp
src/library/library.cpp
src/playdar/playdar_request_handler.cpp
+ src/playdar/main.cpp
+
+ # sqlite wrapper:
deps/sqlite3pp-read-only/sqlite3pp.cpp
+
+ # json parser:
deps/json_spirit_v3.00/json_spirit/json_spirit_reader.cpp
deps/json_spirit_v3.00/json_spirit/json_spirit_value.cpp
deps/json_spirit_v3.00/json_spirit/json_spirit_writer.cpp
- src/playdar/main.cpp
+
# moost http:
deps/moost_http/src/http/filesystem_request_handler.cpp
deps/moost_http/src/http/mime_types.cpp
deps/moost_http/src/http/reply.cpp
deps/moost_http/src/http/request_parser.cpp
- )
+ # Portable Dynamic Loader:
+ deps/pdl-0.3.0/src/DynamicLibrary.cpp
+ deps/pdl-0.3.0/src/DynamicLibraryManager.cpp
+ deps/pdl-0.3.0/src/DynamicLoader.cpp
+ deps/pdl-0.3.0/src/LoaderException.cpp
+ )
TARGET_LINK_LIBRARIES( playdar
${TAGLIB_LIBRARIES} # LGPL/MPL
${SQLITE3_LIBRARIES} # public domain
- ${URIPARSER_LIBRARIES} # BSD
+ #${URIPARSER_LIBRARIES} # BSD
+ uriparser
${OSSPUUID_LIBRARIES} # BSD-like
${Boost_REGEX_LIBRARY} # Boost license
${Boost_SYSTEM_LIBRARY}
@@ -86,42 +97,6 @@ TARGET_LINK_LIBRARIES( playdar
${Boost_PROGRAM_OPTIONS_LIBRARY}
)
-#cui18n icuuc icudata icuio #TODO ;)
-
-
INSTALL(TARGETS scanner RUNTIME DESTINATION bin)
INSTALL(TARGETS playdar RUNTIME DESTINATION bin)
-
-
-########### CPack
-# this isn't really working properly yet
-
-SET(CPACK_GENERATOR "DEB") # "DEB;TGZ;TBZ"...;TGZ;TZ")
-
-SET(CPACK_PACKAGE_VERSION "0.1.0")
-SET(CPACK_PACKAGE_VERSION_MAJOR "0")
-SET(CPACK_PACKAGE_VERSION_MINOR "1")
-SET(CPACK_PACKAGE_VERSION_PATCH "0")
-
-SET(CPACK_DEBIAN_PACKAGE_NAME "playdar")
-SET(CPACK_DEBIAN_PACKAGE_DEPENDS "sqlite3 (>=3), libtag1-dev (>=1.5), liburiparser1 (>=0.6), liburiparser-dev (>=0.6), libossp-uuid-dev (>=1.5), libossp-uuid15 (>=1.5)")
-SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "rj@playdar.org")
-SET(CPACK_DEBIAN_PACKAGE_SECTION "utils")
-
-SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Playdar - the music content resolver service")
-
-SET(CPACK_PACKAGE_VENDOR "www.playdar.org")
-SET(CPACK_PACKAGE_DESCRIPTION_FILE "README.txt")
-SET(CPACK_RESOURCE_FILE_LICENSE "LICENSE.txt")
-SET(CPACK_RESOURCE_FILE_WELCOME "README.txt")
-SET(CPACK_PACKAGE_INSTALL_DIRECTORY "Playdar ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}")
-SET(CPACK_SOURCE_PACKAGE_FILE_NAME "playdar-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}-${CMake_VERSION_PATCH}")
-SET(CPACK_SYSTEM_NAME "linux-i686")
-
-#IF(UNIX)
-# SET(CPACK_STRIP_FILES "bin/playdar;bin/scanner")
-# SET(CPACK_SOURCE_STRIP_FILES "")
-# SET(CPACK_PACKAGE_EXECUTABLES "playdar" "scanner")
-#ENDIF(UNIX)
-INCLUDE(CPack)
View
BIN  playdar-daemon/deps/pdl-0.3.0/AUTHORS
Binary file not shown
View
167 playdar-daemon/deps/pdl-0.3.0/CMakeLists.txt
@@ -0,0 +1,167 @@
+# ################################################################################
+# Project name
+#
+
+PROJECT(PDL)
+
+# ################################################################################
+# Project version
+#
+
+SET(PDL_VERSION_MAJOR 0)
+SET(PDL_VERSION_MINOR 3)
+SET(PDL_VERSION_PATCH 0)
+
+# ################################################################################
+# CMake version check
+#
+
+CMAKE_MINIMUM_REQUIRED(VERSION 2.4.2 FATAL_ERROR)
+
+# ################################################################################
+# Check Includes
+#
+
+INCLUDE(CheckIncludeFiles)
+INCLUDE(CheckCXXSourceCompiles)
+
+INCLUDE_DIRECTORIES(include)
+
+# ################################################################################
+# Check libraries
+#
+
+IF("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
+
+#DL_LIBRARY
+FIND_LIBRARY(DL_LIBRARY
+ NAMES dl
+ PATHS /opt/lib /usr/lib /usr/local/lib
+ DOC "Can't find DL library")
+
+ENDIF("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
+
+# ################################################################################
+# Compiler settings
+#
+
+IF(WIN32)
+ IF(NOT UNIX)
+ IF(NOT BORLAND)
+ IF(NOT MINGW )
+ SET(CMAKE_BUILD_ON_VISUAL_STUDIO 1)
+ ENDIF(NOT MINGW )
+ ENDIF(NOT BORLAND)
+ ENDIF(NOT UNIX)
+ENDIF(WIN32)
+
+IF("${CMAKE_COMPILER_IS_GNUCXX}" MATCHES "1")
+SET(CMAKE_CXX_FLAGS "${CXX_FLAGS} -Wall -O3 -funroll-loops -pedantic -Wno-long-long")
+#SET(CMAKE_CXX_FLAGS "${CXX_FLAGS} -Wall -O3 -funroll-loops -pedantic -Wno-long-long -D_DEBUG")
+#SET(CMAKE_CXX_FLAGS "${CXX_FLAGS} -Wall -Wno-long-long -Weffc++ -pedantic -Wno-long-long -g")
+#SET(CMAKE_CXX_FLAGS "${CXX_FLAGS} -Wall -Wno-long-long -pedantic -Wno-long-long -g")
+ENDIF("${CMAKE_COMPILER_IS_GNUCXX}" MATCHES "1")
+
+# ################################################################################
+# Library source
+#
+
+SET(LIBSRC src/DynamicLibrary.cpp
+ src/DynamicLibraryManager.cpp
+ src/DynamicLoader.cpp
+ src/LoaderException.cpp )
+
+# ################################################################################
+# Library binary
+#
+
+ADD_LIBRARY( pdl SHARED ${LIBSRC} )
+IF("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
+TARGET_LINK_LIBRARIES( pdl c ${DL_LIBRARY})
+ENDIF("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
+SET_TARGET_PROPERTIES( pdl PROPERTIES OUTPUT_NAME pdl )
+SET_TARGET_PROPERTIES( pdl PROPERTIES LINKER_LANGUAGE CXX )
+SET_TARGET_PROPERTIES( pdl PROPERTIES DEFINE_SYMBOL PDL_EXPORT )
+SET_TARGET_PROPERTIES( pdl PROPERTIES COMPILE_FLAGS -DPDL_SHARED )
+SET_TARGET_PROPERTIES( pdl PROPERTIES VERSION ${PDL_VERSION_MAJOR}.${PDL_VERSION_MINOR}.${PDL_VERSION_PATCH}
+ SOVERSION ${PDL_VERSION_MAJOR} )
+
+ADD_LIBRARY( pdl-st STATIC ${LIBSRC} )
+IF("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
+TARGET_LINK_LIBRARIES( pdl-st c ${DL_LIBRARY} )
+ENDIF("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
+SET_TARGET_PROPERTIES( pdl-st PROPERTIES OUTPUT_NAME pdl-st )
+SET_TARGET_PROPERTIES( pdl-st PROPERTIES LINKER_LANGUAGE CXX )
+SET_TARGET_PROPERTIES( pdl-st PROPERTIES VERSION ${PDL_VERSION_MAJOR}.${PDL_VERSION_MINOR}.${PDL_VERSION_PATCH}
+ SOVERSION ${PDL_VERSION_MAJOR} )
+
+# ################################################################################
+# Installation
+
+# Install headers
+INSTALL( FILES include/platform.h
+ include/DynamicClass.hpp
+ include/DynamicLoader.hpp
+ include/LoaderException.hpp
+ DESTINATION include/pdl)
+
+# Install binaries
+INSTALL( TARGETS pdl
+ pdl-st
+ DESTINATION lib )
+
+
+# ################################################################################
+# Test suite
+#
+
+ENABLE_TESTING()
+
+# Test libraries
+ADD_LIBRARY( test_module1 SHARED tests/TestClass1.cpp )
+SET_TARGET_PROPERTIES( test_module1 PROPERTIES OUTPUT_NAME test_module1 )
+ADD_LIBRARY( test_module2 SHARED tests/TestClass2.cpp )
+SET_TARGET_PROPERTIES( test_module2 PROPERTIES OUTPUT_NAME test_module2 )
+
+# Test LoaderException class
+ADD_EXECUTABLE( TestLoaderException tests/TestLoaderException.cpp
+ ${LIBSRC} )
+IF("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
+TARGET_LINK_LIBRARIES( TestLoaderException ${DL_LIBRARY})
+ENDIF("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
+ADD_TEST( TestLoaderException TestLoaderException )
+
+# Test DynamicLibrary class
+ADD_EXECUTABLE( TestDynamicLibrary tests/TestDynamicLibrary.cpp
+ ${LIBSRC} )
+IF("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
+TARGET_LINK_LIBRARIES( TestDynamicLibrary ${DL_LIBRARY})
+ENDIF("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
+IF (WIN32)
+ADD_TEST( TestDynamicLibrary TestDynamicLibrary test_module1.dll )
+ELSE (WIN32)
+ADD_TEST( TestDynamicLibrary TestDynamicLibrary ./libtest_module1 )
+ENDIF (WIN32)
+
+# Test DynamicLibraryManager class
+ADD_EXECUTABLE( TestDynamicLibraryManager tests/TestDynamicLibraryManager.cpp
+ ${LIBSRC} )
+IF("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
+TARGET_LINK_LIBRARIES( TestDynamicLibraryManager ${DL_LIBRARY})
+ENDIF("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
+IF (WIN32)
+ADD_TEST( TestDynamicLibraryManager TestDynamicLibraryManager test_module1.dll test_module2.dll )
+ELSE (WIN32)
+ADD_TEST( TestDynamicLibraryManager TestDynamicLibraryManager ./libtest_module1 ./libtest_module2 )
+ENDIF (WIN32)
+
+# Test DynamicLoader class
+ADD_EXECUTABLE( TestDynamicLoader tests/TestDynamicLoader.cpp )
+TARGET_LINK_LIBRARIES( TestDynamicLoader pdl )
+IF (WIN32)
+ADD_TEST( TestDynamicLoader1 TestDynamicLoader test_module1.dll MyTestClass1 MyTestClass2 )
+ADD_TEST( TestDynamicLoader2 TestDynamicLoader test_module2.dll MyTestClass3 MyTestClass4 )
+ELSE (WIN32)
+ADD_TEST( TestDynamicLoader1 TestDynamicLoader ./libtest_module1 MyTestClass1 MyTestClass2 )
+ADD_TEST( TestDynamicLoader2 TestDynamicLoader ./libtest_module2 MyTestClass3 MyTestClass4 )
+ENDIF (WIN32)
View
13 playdar-daemon/deps/pdl-0.3.0/ChangeLog
@@ -0,0 +1,13 @@
+Thu Aug 16 11:27:00 2007 Igor Semenov <igor@progz.ru>
+
+ * PDL: initial release:
+ Developed and tested on Windows XP, FreeBSD 6.2 and Debian 2.6
+
+Thu Aug 21 15:40:00 2007 Igor Semenov <igor@progz.ru>
+ * Added Doxygen documentation
+
+Fri Sep 15 00:46:00 2007 Igor Semenov <igor@progz.ru>
+ * Added Readme.html and Introduction.html
+
+Fri Nov 16 14:10:00 2007 Igor Semenov <igor@progz.ru>
+ * Several small changes. Release 0.2.
View
265 playdar-daemon/deps/pdl-0.3.0/Doxyfile
@@ -0,0 +1,265 @@
+# Doxyfile 1.5.2
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+DOXYFILE_ENCODING = UTF-8
+PROJECT_NAME = PDL
+PROJECT_NUMBER = 0.3.0
+OUTPUT_DIRECTORY = doc
+CREATE_SUBDIRS = NO
+OUTPUT_LANGUAGE = English
+BRIEF_MEMBER_DESC = YES
+REPEAT_BRIEF = YES
+ABBREVIATE_BRIEF = "The $name class" \
+ "The $name widget" \
+ "The $name file" \
+ is \
+ provides \
+ specifies \
+ contains \
+ represents \
+ a \
+ an \
+ the
+ALWAYS_DETAILED_SEC = NO
+INLINE_INHERITED_MEMB = NO
+FULL_PATH_NAMES = YES
+STRIP_FROM_PATH = "./include"
+STRIP_FROM_INC_PATH =
+SHORT_NAMES = NO
+JAVADOC_AUTOBRIEF = NO
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP = NO
+INHERIT_DOCS = YES
+SEPARATE_MEMBER_PAGES = NO
+TAB_SIZE = 8
+ALIASES =
+OPTIMIZE_OUTPUT_FOR_C = NO
+OPTIMIZE_OUTPUT_JAVA = NO
+BUILTIN_STL_SUPPORT = NO
+CPP_CLI_SUPPORT = NO
+DISTRIBUTE_GROUP_DOC = NO
+SUBGROUPING = YES
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL = NO
+EXTRACT_PRIVATE = NO
+EXTRACT_STATIC = NO
+EXTRACT_LOCAL_CLASSES = YES
+EXTRACT_LOCAL_METHODS = NO
+HIDE_UNDOC_MEMBERS = YES
+HIDE_UNDOC_CLASSES = YES
+HIDE_FRIEND_COMPOUNDS = NO
+HIDE_IN_BODY_DOCS = NO
+INTERNAL_DOCS = NO
+CASE_SENSE_NAMES = NO
+HIDE_SCOPE_NAMES = NO
+SHOW_INCLUDE_FILES = YES
+INLINE_INFO = YES
+SORT_MEMBER_DOCS = YES
+SORT_BRIEF_DOCS = NO
+SORT_BY_SCOPE_NAME = NO
+GENERATE_TODOLIST = YES
+GENERATE_TESTLIST = YES
+GENERATE_BUGLIST = YES
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS =
+MAX_INITIALIZER_LINES = 30
+SHOW_USED_FILES = YES
+SHOW_DIRECTORIES = NO
+FILE_VERSION_FILTER =
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET = NO
+WARNINGS = YES
+WARN_IF_UNDOCUMENTED = YES
+WARN_IF_DOC_ERROR = YES
+WARN_NO_PARAMDOC = NO
+WARN_FORMAT = "$file:$line: $text"
+WARN_LOGFILE =
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT = include/DynamicClass.hpp \
+ include/LoaderException.hpp \
+ include/DynamicLoader.hpp
+INPUT_ENCODING = UTF-8
+FILE_PATTERNS = *.c \
+ *.cc \
+ *.cxx \
+ *.cpp \
+ *.c++ \
+ *.d \
+ *.java \
+ *.ii \
+ *.ixx \
+ *.ipp \
+ *.i++ \
+ *.inl \
+ *.h \
+ *.hh \
+ *.hxx \
+ *.hpp \
+ *.h++ \
+ *.idl \
+ *.odl \
+ *.cs \
+ *.php \
+ *.php3 \
+ *.inc \
+ *.m \
+ *.mm \
+ *.dox \
+ *.py
+RECURSIVE = YES
+EXCLUDE =
+EXCLUDE_SYMLINKS = NO
+EXCLUDE_PATTERNS =
+EXCLUDE_SYMBOLS =
+EXAMPLE_PATH =
+EXAMPLE_PATTERNS = *
+EXAMPLE_RECURSIVE = NO
+IMAGE_PATH =
+INPUT_FILTER =
+FILTER_PATTERNS =
+FILTER_SOURCE_FILES = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER = YES
+INLINE_SOURCES = NO
+STRIP_CODE_COMMENTS = YES
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION = YES
+REFERENCES_LINK_SOURCE = YES
+USE_HTAGS = NO
+VERBATIM_HEADERS = YES
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX = NO
+COLS_IN_ALPHA_INDEX = 5
+IGNORE_PREFIX =
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML = YES
+HTML_OUTPUT = html
+HTML_FILE_EXTENSION = .html
+HTML_HEADER =
+HTML_FOOTER =
+HTML_STYLESHEET =
+HTML_ALIGN_MEMBERS = YES
+GENERATE_HTMLHELP = NO
+CHM_FILE = pdl.chm
+HHC_LOCATION =
+GENERATE_CHI = NO
+BINARY_TOC = NO
+TOC_EXPAND = NO
+DISABLE_INDEX = NO
+ENUM_VALUES_PER_LINE = 4
+GENERATE_TREEVIEW = NO
+TREEVIEW_WIDTH = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX = NO
+LATEX_OUTPUT = latex
+LATEX_CMD_NAME = latex
+MAKEINDEX_CMD_NAME = makeindex
+COMPACT_LATEX = NO
+PAPER_TYPE = a4wide
+EXTRA_PACKAGES =
+LATEX_HEADER =
+PDF_HYPERLINKS = NO
+USE_PDFLATEX = NO
+LATEX_BATCHMODE = NO
+LATEX_HIDE_INDICES = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF = NO
+RTF_OUTPUT = rtf
+COMPACT_RTF = NO
+RTF_HYPERLINKS = NO
+RTF_STYLESHEET_FILE =
+RTF_EXTENSIONS_FILE =
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN = YES
+MAN_OUTPUT = man
+MAN_EXTENSION = .3
+MAN_LINKS = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML = NO
+XML_OUTPUT = xml
+XML_SCHEMA =
+XML_DTD =
+XML_PROGRAMLISTING = YES
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD = NO
+PERLMOD_LATEX = NO
+PERLMOD_PRETTY = YES
+PERLMOD_MAKEVAR_PREFIX =
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING = YES
+MACRO_EXPANSION = NO
+EXPAND_ONLY_PREDEF = NO
+SEARCH_INCLUDES = YES
+INCLUDE_PATH =
+INCLUDE_FILE_PATTERNS =
+PREDEFINED =
+EXPAND_AS_DEFINED =
+SKIP_FUNCTION_MACROS = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+TAGFILES =
+GENERATE_TAGFILE =
+ALLEXTERNALS = NO
+EXTERNAL_GROUPS = YES
+PERL_PATH = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS = NO
+MSCGEN_PATH =
+HIDE_UNDOC_RELATIONS = YES
+HAVE_DOT = YES
+CLASS_GRAPH = YES
+COLLABORATION_GRAPH = YES
+GROUP_GRAPHS = YES
+UML_LOOK = NO
+TEMPLATE_RELATIONS = NO
+INCLUDE_GRAPH = YES
+INCLUDED_BY_GRAPH = YES
+CALL_GRAPH = YES
+CALLER_GRAPH = NO
+GRAPHICAL_HIERARCHY = YES
+DIRECTORY_GRAPH = YES
+DOT_IMAGE_FORMAT = png
+DOT_PATH =
+DOTFILE_DIRS =
+DOT_GRAPH_MAX_NODES = 50
+DOT_TRANSPARENT = NO
+DOT_MULTI_TARGETS = NO
+GENERATE_LEGEND = YES
+DOT_CLEANUP = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine
+#---------------------------------------------------------------------------
+SEARCHENGINE = NO
View
4 playdar-daemon/deps/pdl-0.3.0/INSTALL
@@ -0,0 +1,4 @@
+cmake .
+make
+make test
+make install
View
24 playdar-daemon/deps/pdl-0.3.0/LICENSE
@@ -0,0 +1,24 @@
+* Copyright (c) 2007-2008, Igor Semenov
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+* * Neither the name of Igor Semenov nor the names of its contributors
+* may be used to endorse or promote products derived from this software
+* without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY IGOR SEMENOV ``AS IS'' AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL IGOR SEMENOV BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
View
0  playdar-daemon/deps/pdl-0.3.0/NEWS
No changes.
View
1  playdar-daemon/deps/pdl-0.3.0/README
@@ -0,0 +1 @@
+See doc/Readme.html
View
7 playdar-daemon/deps/pdl-0.3.0/TESTING
@@ -0,0 +1,7 @@
+FreeBSD 6.2-STABLE i386
+Debian GNU/Linux 4.0 \n \l Linux amd64 2.6.18-4-xen-amd64 SMP x86_64 GNU/Linux
+openSUSE 10.2 (X86-64) - Kernel \r (\l) Linux stein 2.6.18.8-0.5-default SMP x86_64 GNU/Linux
+SuSE Linux 9.1 (i586) - Kernel \r (\l) Linux linux 2.6.4-52-default i686 i686 i386 GNU/Linux
+Windows XP
+HP-UX td192 B.11.11 U 9000/800 1839940656
+HP-UX td176 B.11.23 U ia64 1928826293
View
1  playdar-daemon/deps/pdl-0.3.0/TODO
@@ -0,0 +1 @@
+TODO: Test library on various platforms.
View
191 playdar-daemon/deps/pdl-0.3.0/doc/Introduction.html
@@ -0,0 +1,191 @@
+<html>
+<head>
+ <title>Introduction to PDL</title>
+</head>
+<body>
+
+<H2 align="center">Introduction to PDL</H2>
+
+<H3>What is PDL?</H3>
+
+<P>PDL (Portable Dynamic Loader) is light, simple and portable library designed especially for creating and using dynamically loaded class objects.
+
+
+<H3>Why do we need to load classes dynamically?</H3>
+
+<P>The main purpose of dynamically loadable class technology is creating plug-ins, which extends the functionality of the main program. The main problem with dynamically loaded modules on many platforms is that they support procedure programming paradigm only. When you try to load classes, many problems appear. The PDL library solves most of these problems (but not all of them, sadly).
+
+<P>On Win32 platform PDL is very simple alternative to COM technology, without reference counting, global class registration and many other features. There are several similar libraries for Unix/Linux platforms, for example, C++ Dynamic Class Loader. The dynamic class loading support feature also presents in large cross-platform library called WxWidgets.
+
+<P>The main goal of PDL development was to create a cross-platform library, which could support single dynamic class loading mechanism for both Win32 and Unix/Linux platforms (unlike COM and C++ Dynamic Class Loader). This library should also be lightweight and independent (unlike huge WxWidgets one).
+
+
+<H3>Creating the dynamically loadable class.</H3>
+
+<P>Let's consider creation of dynamically loadable class using PDL library in detail. First of all, we need to declare an interface, which will be used to work with the instance of a loadable class instance. Indispensable condition: this interface must be inherited from PDL::DynamicClass. Let's look at the DynamicClass declaration:
+
+<PRE>class DynamicClass
+{
+public:
+ /**
+ * @brief Get class name
+ * return class name
+ */
+ virtual const char * GetClassName() const throw() = 0;
+
+ /**
+ * @brief Destroy class instance
+ */
+ void Destroy() throw() { delete this; }
+
+protected:
+ /**
+ * @brief Destructor
+ */
+ virtual ~DynamicClass() throw() { ;; }
+};</PRE>
+
+<P>The pure virtual method GetClassName() returns the name of the class. You don't have to worry about its definition, and later I'll explain why.
+
+<P>The non-virtual method Destroy() destroys the class instance. The class destructor is declared as protected, to prevent its direct call. I'll describe later, why we need such a trick.
+
+<P>We have to inherit our interface from PDL::DynamicClass and define protected virtual destructor (according to PDL ideology).
+
+<P>We also need to insert DECLARE_DYNAMIC_CLASS macro inside of a class declaration with the class name as a parameter. If we look at the definition of this macro, we'll see, that it simply defines the virtual method GetClassName():
+
+<PRE>#define DECLARE_DYNAMIC_CLASS( className ) \
+public: \
+ virtual const char * GetClassName() const throw() { return #className; }</PRE>
+
+<P>Finally, let's add to our interface pure virtual methods, which implement useful functionality of dynamically loadable class. Let it be DoSomething() method for example.
+
+<P>As a result we have the following interface:
+
+<PRE>#include &lt;DynamicClass.hpp&gt;
+
+class MyTestInterface : public PDL::DynamicClass
+{
+public:
+ /**
+ * @brief Test method
+ */
+ virtual void DoSomething() throw() = 0;
+
+ /**
+ * @brief Declare this class dynamically loadable
+ */
+ DECLARE_DYNAMIC_CLASS( MyTestInterface )
+};</PRE>
+
+<P>We should put this declaration to a separate header file, in our case - MyTestInterface.hpp. For compatibility purpose this file must be included both for building the dynamically loadable class and its direct usage.
+
+<P>Then, we should declare a class, inherited from our abstract interface, MyTestInterface, and define methods, which implement its useful functionality. We also need to export this class using EXPORT_DYNAMIC_CLASS macro. Please note, that this macro should be placed outside of a class declaration:
+
+<PRE>#include &lt;MyTestInterface.hpp&gt;
+#include &lt;stdio.h&gt;
+
+class MyTestClass1 : public MyTestInterface
+{
+public:
+ /**
+ * @brief Test method
+ */
+ void DoSomething() throw()
+ {
+ fprintf( stderr, "MyTestClass1::DoSomething()\n" );
+ }
+};
+EXPORT_DYNAMIC_CLASS( MyTestClass1 )</PRE>
+
+<P>Let's look at the definition of EXPORT_DYNAMIC_CLASS macro (DynamicClass.hpp file):
+
+<PRE>#define EXPORT_DYNAMIC_CLASS( className ) \
+extern "C" PDL_DECL_EXPORT PDL::DynamicClass * Create##className() \
+{ \
+ try { return new className(); } \
+ catch( ... ) { ;; } \
+ return NULL; \
+}</PRE>
+
+<P>This macro defines and exports the function with name Create<class_name> (a builder function), which creates an instance of the class, given as a parameter. The extern "C" modifier is required to prevent function name mangling. The PDL_DECL_EXPORT macro declares this function as exportable. Its definition in platform.h is specific for different platforms.
+
+<P>There are several important issues. The builder function (Create<class_name>) catches all the exceptions, thrown by class constructor, returning NULL in case of exception. That solves all problems with handling of exceptions thrown by plug-in in the main program. In case of instance creation, our builder function returns pointer to PDL::DynamicClass, so, if you forgot to inherit your interface from this class, the compiler will remind you producing casting error.
+
+<P>Now we can build our plug-in. Single plug-in can contain several different classes, but their names should be unique at module level. Each class must be exported using EXPORT_DYNAMIC_CLASS macro.
+
+
+<H3>Using of dynamically loadable classes.</H3>
+
+<P>At this moment we have a plug-in, which contains dynamically loadable class. Let's try to use it.
+
+<P>First, we need to get an instance of dynamic class loader - PDL::DynamicLoader. This class is a singleton. To get a reference to the instance we should use static method DynamicLoader::Instance():
+
+<PRE>PDL::DynamicLoader &amp; dynamicLoader = PDL::DynamicLoader::Instance();</PRE>
+
+<P>Then, we need to load the class instance and get a pointer to it:
+
+<PRE>MyTestInterface * instance =
+ dynamicLoader.GetClassInstance&lt; MyTestInterface &gt;( myLibName, "MyTestClass1" );</PRE>
+
+<P>Here myLibName is a filename of the plug-in library, for example "MyTestClass1.dll" or "MyTestClass.so". Don't forget to include header file with interface declaration - in our case it is MyTestInterface.hpp, as described before.
+
+<P>Finally we invoke useful method of loaded class:
+
+<PRE>instance -&gt; DoSomething();</PRE>
+
+<P>As the dynamic class loader throws PDL::LoaderException in case of failure, it will be correct to catch it. Here is the full source of our example:
+
+<PRE>#include &lt;MyTestInterface.hpp&gt;
+#include &lt;stdio.h&gt;
+
+try
+{
+ PDL::DynamicLoader &amp; dynamicLoader = PDL::DynamicLoader::Instance();
+ MyTestInterface * instance =
+ dynamicLoader.GetClassInstance&lt; MyTestInterface &gt;( myLibName, "MyTestClass1" );
+ instance -&gt; DoSomething();
+}
+catch( PDL::LoaderException &amp; ex )
+{
+ fprintf( stderr, "Loader exception: %s\n", ex.what() );
+}</PRE>
+
+<P>There is an important feature: all the dynamically loaded classes are singletons. This means that repeated calls of DynamicLoader::GetInstance() with the same both library name and class name will return a pointer to the same class instance. This simplifies the control over loaded instances and prevents memory leaks. If you need to create many class instances, you may implement dynamically loadable class factory.
+
+<P>Let's examine how loaded class instances are being destroyed. This is responsibility of method DynamicClass::Destroy(). You don't need to invoke it directly - the DynamicLoader will do it in its destructor or in DynamicLoader::Reset(). Why shouldn't we use a generic destructor? This is because of the memory allocation/freeing mechanism issues, which are slightly different in different compilers. Let's imagine: we build a plug-in with compiler A, and a main program with compiler B. When we load a class by dynamic loader, its instance is created by a code produced by A compiler. But if we call a destructor, we invoke a code produced by compiler B. This may lead to unexpected problems.
+
+<P>To prevent such problems the destructor ~DynamicClass() is declared as protected, and you need to call DynamicClass::Destroy() method instead. This method guarantees that the code of destructor is compiled by the same compiler, as the code of constructor.
+
+
+<H3>Fly in the ointment.</H3>
+
+<P>There is an issue with libraries names. If the filename of the library changes, PDL considers that it is a different library. However different names may point to a single library, for example: C:\MyProg\libs\mylib.dll P8 MyLIB.DLL.
+
+<P>Pay your attention that PDL doesn't solve problems with name mangling, used by different compilers. This problem is not set at the current moment.
+
+<P>The PDL library was tested on the following platforms:
+<UL>
+<LI>FreeBSD 6.2</LI>
+<LI>Debian 4.0 Linux 2.6.18-4</LI>
+<LI>openSUSE 10.2</LI>
+<LI>Windows XP</LI>
+</UL>
+
+<P>I will be grateful for any information about usage of PDL on other platforms.
+
+
+<H3>Thanks.</H3>
+
+<P>Special thanks to Vladimir and Asya Storozhevykh, Alexander Ledenev and Valery Artukhin, who helped me to make this article better (I hope).
+
+
+<H3>Links.</H3>
+
+<P>Webpage at Sourceforge:<br>
+<A href="http://sourceforge.net/projects/pdl-cpp/">http://sourceforge.net/projects/pdl-cpp/</A>
+
+<P>Original article in Russian:<br>
+<A href="http://www.progz.ru/forum/index.php?showtopic=33359">http://www.progz.ru/forum/index.php?showtopic=33359</A>
+
+</body>
+</html>
View
76 playdar-daemon/deps/pdl-0.3.0/doc/Readme.html
@@ -0,0 +1,76 @@
+<html>
+<head>
+ <title>Introduction to PDL</title>
+</head>
+<body>
+
+<h2 align="center">PDL (Portable Dynamic Loader)</h2>
+
+<h3 align="center">0.3.0</h3>
+
+<h3>Introduction</h3>
+
+<b>PDL</b> is a simple and lightweight C++ library, which provides common cross-platform interface for creating and using dynamically loaded classes.
+
+Project home:<br>
+<a href="http://sourceforge.net/projects/pdl-cpp/">http://sourceforge.net/projects/pdl-cpp/</a><br>
+Project downloads:<br>
+<a href="http://sourceforge.net/project/showfiles.php?group_id=203000">http://sourceforge.net/project/showfiles.php?group_id=203000</a><br>
+
+<h3>Example</h3>
+
+<p>
+Dynamically loaded class interface:
+<pre><b>class</b> MyTestInterface : <b>public</b> PDL::DynamicClass
+{
+<b>public</b>:
+ <b>virtual</b> <b>void</b> DoSomething() throw() = 0;
+ DECLARE_DYNAMIC_CLASS( MyTestInterface )
+};</pre>
+
+<p>
+Dynamically loaded class implementation:
+<pre><b>class</b> MyTestClass1 : <b>public</b> MyTestInterface
+{
+<b>public</b>:
+ <b>void</b> DoSomething() throw()
+ {
+ <i>// Do something</i>
+ }
+};</pre>
+
+<p>
+Dynamically loaded class usage:
+<pre><b>try</b>
+{
+ PDL::DynamicLoader &amp; dynamicLoader = PDL::DynamicLoader::Instance();
+ MyTestInterface * instance =
+ dynamicLoader.GetClassInstance&lt; MyTestInterface &gt;( <i>"./MyTestClass.so"</i>, <i>"MyTestClass"</i> );
+ instance -&gt; DoSomething();
+}
+<b>catch</b>( PDL::LoaderException &amp; ex )
+{
+ fprintf( stderr, <i>"Loader exception: %s\n"</i>, ex.what() );
+}</pre>
+
+<h3>Status</h3>
+
+
+The library is under development and testing now.
+
+<p>
+<b>Author:</b> Igor Semenov &lt;<a href="mailto:igor@progz.ru">igor@progz.ru</a>&gt;<br>
+<b>Version:</b> 0.1.0<br>
+<b>License:</b> Copyright (c) 2007, Igor Semenov<br>
+All rights reserved.<br>
+
+<br>
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: <br>
+* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. <br>
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. <br>
+* Neither the name of Igor Semenov nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. <br>
+<br>
+THIS SOFTWARE IS PROVIDED BY IGOR SEMENOV ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IGOR SEMENOV BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <br>
+
+</body>
+</html>
View
92 playdar-daemon/deps/pdl-0.3.0/include/DynamicClass.hpp
@@ -0,0 +1,92 @@
+/**
+ * Copyright (c) 2007-2008, Igor Semenov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Igor Semenov nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY IGOR SEMENOV ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL IGOR SEMENOV BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __PDL_DYNAMIC_CLASS_HPP__
+#define __PDL_DYNAMIC_CLASS_HPP__
+
+#include <platform.h>
+
+/**
+ * @namespace PDL
+ * @brief Portable Dynamic Loader
+ */
+namespace PDL
+{
+
+/**
+ * @class DynamicClass DynamicClass.hpp <DynamicClass.hpp>
+ * @brief Common interface for all dynamically loaded classes
+ */
+class DynamicClass
+{
+
+public:
+ /**
+ * @brief Get class name
+ * return class name
+ */
+ virtual const PDL_CHAR * GetClassName() const throw() = 0;
+
+ /**
+ * @brief Destroy class instance
+ */
+ void Destroy() throw() { delete this; }
+
+protected:
+ /**
+ * @brief Destructor
+ */
+ virtual ~DynamicClass() throw() { ;; }
+
+}; // class DynamicClass
+
+} // namespace PDL
+
+/**
+ * @def DECLARE_DYNAMIC_CLASS DynamicClass.hpp <DynamicClass.hpp>
+ * @brief Declare dynamically loaded class
+ * @param className - [in] name of the class
+ * Class should be derived from DynamicClass
+ */
+#define DECLARE_DYNAMIC_CLASS( className ) \
+public: \
+ virtual const PDL_CHAR * GetClassName() const throw() { return #className; }
+
+/**
+ * @def EXPORT_DYNAMIC_CLASS DynamicClass.hpp <DynamicClass.hpp>
+ * @brief Export constructor for dynamically loaded class
+ * @param className - [in] name of the class
+ */
+#define EXPORT_DYNAMIC_CLASS( className ) \
+extern "C" PDL_DECL_EXPORT PDL::DynamicClass * Create##className() \
+{ \
+ try { return new className(); } \
+ catch( ... ) { ;; } \
+ return 0; \
+}
+
+#endif // __PDL_DYNAMIC_CLASS_HPP__
View
136 playdar-daemon/deps/pdl-0.3.0/include/DynamicLibrary.hpp
@@ -0,0 +1,136 @@
+/**
+ * Copyright (c) 2007-2008, Igor Semenov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Igor Semenov nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY IGOR SEMENOV ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL IGOR SEMENOV BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __PDL_DYNAMIC_LIBRARY_HPP__
+#define __PDL_DYNAMIC_LIBRARY_HPP__
+
+#include <platform.h>
+#include <string>
+#include <map>
+
+#if PLATFORM_WIN32
+#include <windows.h>
+#endif
+
+/**
+ * @namespace PDL
+ * @brief Portable Dynamic Loader
+ */
+namespace PDL
+{
+
+/// FWD
+class DynamicClass;
+
+/**
+ * @class DynamicLibrary DynamicLibrary.hpp <DynamicLibrary.hpp>
+ * @brief Platform-specific dynamic library
+ */
+class DynamicLibrary
+{
+
+public:
+ /**
+ * @brief Constructor
+ */
+ DynamicLibrary();
+
+ /**
+ * @brief Destructor
+ */
+ ~DynamicLibrary() throw();
+
+ /**
+ * @brief Open library
+ * @param libName - [in] library file name
+ * @return true - loaded successfully, false otherwise
+ */
+ bool Open( const PDL_CHAR * libName, bool resolveSymbols = true );
+
+ /**
+ * @brief Get default library filename extention (platform-specific)
+ * @return default library filename extention
+ */
+ static const PDL_CHAR * GetDefaultExt();
+
+ /**
+ * @brief Check if library is opened
+ * @return true if library is opened, false otherwise
+ */
+ bool Opened() const { return ( library_ ); }
+
+ /**
+ * @brief Get class instance
+ * @param className - [in] class name
+ * @return pointer to class instance
+ */
+ DynamicClass * GetInstance( const PDL_CHAR * className );
+
+ /**
+ * @brief Get last error description
+ * @return last error description
+ */
+ pdl_string GetLastError() const;
+
+ /**
+ * @brief Close library
+ * @return true if closed successfully, false otherwise
+ */
+ bool Close();
+
+private:
+ /**
+ * @brief Get symbol by name
+ * @param symbolName - [in] symbol name
+ * @return pointer to symbol, 0 if not found
+ */
+ void * GetSymbolByName( const PDL_CHAR * symbolName );
+
+ /// Forbid copy constructor and assignment operator
+ DynamicLibrary( const DynamicLibrary & );
+ DynamicLibrary & operator=( const DynamicLibrary & );
+
+private:
+ // Library handle
+#if PLATFORM_WIN32
+ HMODULE library_;
+#elif PLATFORM_POSIX
+ void * library_;
+#endif
+
+ // Library name
+ pdl_string libraryName_;
+
+ // Symbol map
+ typedef std::map< pdl_string, DynamicClass * > InstanceMap;
+ InstanceMap instances_;
+
+}; // class DynamicLibrary
+
+} // namespace PDL
+
+#endif // __PDL_DYNAMIC_LIBRARY_HPP__
View
94 playdar-daemon/deps/pdl-0.3.0/include/DynamicLibraryManager.hpp
@@ -0,0 +1,94 @@
+/**
+ * Copyright (c) 2007-2008, Igor Semenov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Igor Semenov nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY IGOR SEMENOV ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL IGOR SEMENOV BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __PDL_DYNAMIC_LIBRARY_MANAGER_HPP__
+#define __PDL_DYNAMIC_LIBRARY_MANAGER_HPP__
+
+#include <platform.h>
+#include <string>
+#include <map>
+
+/**
+ * @namespace PDL
+ * @brief Portable Dynamic Loader
+ */
+namespace PDL
+{
+
+/// FWD
+class DynamicLibrary;
+
+/**
+ * @class DynamicLibraryManager DynamicLibraryManager.hpp <DynamicLibraryManager.hpp>
+ * @brief Dynamic library instance manager
+ */
+class DynamicLibraryManager
+{
+
+public:
+ /**
+ * @brief Constructor
+ */
+ DynamicLibraryManager();
+
+ /**
+ * @brief Destructor
+ */
+ ~DynamicLibraryManager() throw();
+
+ /**
+ * @brief Reset library manager
+ * Free all libraries and set initial state
+ */
+ void Reset();
+
+ /**
+ * @brief Get dynamic library
+ * @param libName - [in] library file name
+ * @return dynamic library
+ * @throw LoaderException - cannot load library
+ */
+ DynamicLibrary & GetLibrary( const PDL_CHAR * libName );
+
+private:
+ /**
+ * @brief Get dynamic library instance
+ * @param libName - [in] library file name
+ * @return dynamic library instance
+ */
+ DynamicLibrary & GetLibraryInstance( const PDL_CHAR * libName );
+
+private:
+ // Libraries map
+ typedef std::map< pdl_string, DynamicLibrary * > LibraryMap;
+ LibraryMap libraries_;
+
+}; // class DynamicLibraryManager
+
+} // namespace PDL
+
+#endif // __PDL_DYNAMIC_LIBRARY_MANAGER_HPP__
View
176 playdar-daemon/deps/pdl-0.3.0/include/DynamicLoader.hpp
@@ -0,0 +1,176 @@
+/**
+ * @mainpage PDL (Portable Dynamic Loader)
+ *
+ * @section Introduction
+ *
+ * PDL is a simple and lightweight C++ library, which provides common
+ * cross-platform interface for creating and using dynamically loaded classes.
+ *
+ * Project home:@n
+ * http://sourceforge.net/projects/pdl-cpp/ @n
+ * Project downloads:@n
+ * http://sourceforge.net/project/showfiles.php?group_id=203000 @n
+ *
+ *
+ * @section Example
+ *
+ * Dynamically loaded class interface:
+ * @code
+ * class MyTestInterface : public PDL::DynamicClass
+ * {
+ * public:
+ * /// Class functionality
+ * virtual void DoSomething() throw() = 0;
+ * /// Declare this class as dynamically loaded
+ * DECLARE_DYNAMIC_CLASS( MyTestInterface )
+ * };
+ * @endcode
+ *
+ * Dynamically loaded class implementation:
+ * @code
+ * class MyTestClass1 : public MyTestInterface
+ * {
+ * public:
+ * /// Class functionality
+ * void DoSomething() throw()
+ * {
+ * // Do something
+ * }
+ * };
+ * @endcode
+ *
+ * Dynamically loaded class usage:
+ * @code
+ * try
+ * {
+ * PDL::DynamicLoader & dynamicLoader = PDL::DynamicLoader::Instance();
+ * MyTestInterface * instance =
+ * dynamicLoader.GetClassInstance< MyTestInterface >( "./MyTestClass.so", "MyTestClass" );
+ * instance -> DoSomething();
+ * }
+ * catch( PDL::LoaderException & ex )
+ * {
+ * fprintf( stderr, "Loader exception: %s\n", ex.what() );
+ * }
+ * @endcode
+ *
+ *
+ * @section Status
+ *
+ * The library is under development and testing now.
+ *
+ *
+ * @author Igor Semenov <igor@progz.ru>
+ *
+ * @version 0.0.1
+ *
+ * @par License:
+ * Copyright (c) 2007-2008, Igor Semenov @n
+ * All rights reserved. @n
+ * @n
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: @n
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer. @n
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution. @n
+ * * Neither the name of Igor Semenov nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission. @n
+ * @n
+ * THIS SOFTWARE IS PROVIDED BY IGOR SEMENOV ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL IGOR SEMENOV BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @n
+ * @n
+ */
+
+#ifndef __PDL_DYNAMIC_LOADER_HPP__
+#define __PDL_DYNAMIC_LOADER_HPP__
+
+#include <platform.h>
+#include <memory>
+
+/**
+ * @namespace PDL
+ * @brief Portable Dynamic Loader
+ */
+namespace PDL
+{
+
+/// FWD
+class DynamicClass;
+class DynamicLibraryManager;
+
+/**
+ * @class DynamicLoader DynamicLoader.hpp <DynamicLoader.hpp>
+ * @brief Dynamic loader
+ */
+class PDL_DECL DynamicLoader
+{
+
+public:
+ /**
+ * @brief Create class instance
+ * @param libName - [in] library file name
+ * @param className - [in] class name
+ * @return class instance, 0 if failed
+ * Class should be derived from DynamicClass
+ */
+ template< typename Class >
+ Class * GetClassInstance( const PDL_CHAR * libName, const PDL_CHAR * className )
+ {
+ return reinterpret_cast< Class * >( GetDynamicInstance( libName, className ) );
+ }
+
+ /**
+ * @brief Reset dynamic loader
+ * Unload all loaded libraries and free instances
+ */
+ void Reset();
+
+ /**
+ * @brief Get dynamic loader instance
+ * @return dynamic loader instance
+ */
+ static DynamicLoader & Instance();
+
+ /**
+ * @brief Destructor
+ */
+ ~DynamicLoader() throw();
+
+private:
+ /**
+ * @brief Constructor
+ */
+ DynamicLoader();
+
+ /**
+ * @brief Create class instance
+ * @param libName - [in] library file name
+ * @param className - [in] class name
+ * @return class instance, 0 if failed
+ */
+ DynamicClass * GetDynamicInstance( const PDL_CHAR * libName, const PDL_CHAR * className );
+
+ /// Forbid copy constructor and assignment operator
+ DynamicLoader( const DynamicLoader & );
+ DynamicLoader & operator= ( const DynamicLoader & );
+
+private:
+ /// Library manager
+ std::auto_ptr< DynamicLibraryManager > libraryManager_;
+
+}; // class PDL_DECL DynamicLoader
+
+} // namespace PDL
+
+#endif // __PDL_DYNAMIC_CLASS_FACTORY_HPP__
View
75 playdar-daemon/deps/pdl-0.3.0/include/LoaderException.hpp
@@ -0,0 +1,75 @@
+/**
+ * Copyright (c) 2007-2008, Igor Semenov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Igor Semenov nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY IGOR SEMENOV ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL IGOR SEMENOV BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __PDL_LOADER_EXCEPTION_HPP__
+#define __PDL_LOADER_EXCEPTION_HPP__
+
+#include <platform.h>
+#include <exception>
+#include <string>
+
+/**
+ * @namespace PDL
+ * @brief Portable Dynamic Loader
+ */
+namespace PDL
+{
+
+/**
+ * @class LoaderException LoaderException.hpp <LoaderException.hpp>
+ * @brief Dynamic loader exception class
+ */
+class PDL_DECL LoaderException: public std::exception
+{
+
+public:
+ /**
+ * @brief Constructor
+ * @param text - [in] exception description
+ */
+ LoaderException( const pdl_string & text );
+
+ /**
+ * @brief Destructor
+ */
+ ~LoaderException() throw();
+
+ /**
+ * @brief Get exception description
+ * @return exception description
+ */
+ const char * what() const throw();
+
+private:
+ // Exception description
+ const pdl_string text_;
+
+}; // class PDL_DECL LoaderException
+
+} // namespace PDL
+
+#endif // __PDL_LOADER_EXCEPTION_HPP__
View
84 playdar-daemon/deps/pdl-0.3.0/include/platform.h
@@ -0,0 +1,84 @@
+/**
+ * Copyright (c) 2007-2008, Igor Semenov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Igor Semenov nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY IGOR SEMENOV ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL IGOR SEMENOV BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __PDL_PLATFORM_H__
+#define __PDL_PLATFORM_H__
+
+#include <string>
+
+#if defined( WIN32 ) || defined( _WIN32 )
+
+/**
+ * @brief Windows platform
+ */
+#define PLATFORM_WIN32 1
+
+#define PDL_DECL_EXPORT __declspec( dllexport )
+
+#ifdef PDL_SHARED
+#ifdef PDL_EXPORT
+#define PDL_DECL PDL_DECL_EXPORT
+#else
+#define PDL_DECL __declspec( dllimport )
+#endif
+#else
+#define PDL_DECL
+#endif
+
+/// Char types
+#include <tchar.h>
+#define PDL_CHAR char
+
+#elif defined( unix ) || defined( __unix__ )
+
+/**
+ * @brief POSIX platform
+ */
+#define PLATFORM_POSIX 1
+
+#define PDL_DECL_EXPORT
+#define PDL_DECL
+
+/// Char types
+#define PDL_CHAR char
+
+#else
+
+/**
+ * @brief Unknown platform. Cannot build
+ */
+#if defined( _MSC_VER )
+#pragma error( "Unknown platform" )
+#elif defined ( __GNUC__ )
+#error( "Unknown platform" )
+#endif
+
+#endif
+
+namespace PDL { typedef std::basic_string< PDL_CHAR > pdl_string; }
+
+#endif // __PDL_PLATFORM_H__
View
226 playdar-daemon/deps/pdl-0.3.0/src/DynamicLibrary.cpp
@@ -0,0 +1,226 @@
+/**
+ * Copyright (c) 2007-2008, Igor Semenov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Igor Semenov nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY IGOR SEMENOV ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL IGOR SEMENOV BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <DynamicClass.hpp>
+#include <DynamicLibrary.hpp>
+#include <LoaderException.hpp>
+#include <string>
+
+#if PLATFORM_WIN32
+#include <windows.h>
+#elif PLATFORM_POSIX
+#include <dlfcn.h>
+#endif
+
+/**
+ * @namespace PDL
+ * @brief Portable Dynamic Loader
+ */
+namespace PDL
+{
+
+/**
+ * @brief Dynamic instance builder
+ */
+typedef DynamicClass * ( ( * DynamicBuilder )() );
+
+/**
+ * @brief Constructor
+ */
+DynamicLibrary::DynamicLibrary() : library_( 0 ), libraryName_(), instances_()
+{
+ ;;
+}
+
+/**
+ * @brief Destructor
+ */
+DynamicLibrary::~DynamicLibrary() throw()
+{
+ ( void ) Close();
+}
+
+/**
+ * @brief Open library
+ * @param libName - [in] library file name
+ * @return true - loaded successfully, false otherwise
+ */
+bool DynamicLibrary::Open( const PDL_CHAR * libName, bool resolveSymbols )
+{
+ if ( !libName ) { return false; }
+
+ library_ =
+#if PLATFORM_WIN32
+ ::LoadLibraryExA( libName, NULL,
+ ( resolveSymbols ) ? 0 : DONT_RESOLVE_DLL_REFERENCES );
+#elif PLATFORM_POSIX
+ dlopen( libName, RTLD_GLOBAL | ( ( resolveSymbols ) ? RTLD_NOW : RTLD_LAZY ) );
+#endif
+
+ if ( library_ ) { libraryName_ = libName; }
+ else
+ {
+ const pdl_string nameWithExt( pdl_string( libName ) + pdl_string( GetDefaultExt() ) );
+ library_ =
+#if PLATFORM_WIN32
+ ::LoadLibraryExA( nameWithExt.c_str(), NULL,
+ ( resolveSymbols ) ? 0 : DONT_RESOLVE_DLL_REFERENCES );
+#elif PLATFORM_POSIX
+ dlopen( nameWithExt.c_str(), RTLD_GLOBAL | ( ( resolveSymbols ) ? RTLD_NOW : RTLD_LAZY ) );
+#endif
+ if ( library_ ) { libraryName_ = libName; }
+ }
+
+ return ( library_ );
+}
+
+/**
+ * @brief Get default library filename extention (platform-specific)
+ * @return default library filename extention
+ */
+const PDL_CHAR * DynamicLibrary::GetDefaultExt()
+{
+#if PLATFORM_WIN32
+ return ".dll";
+#elif defined( hpux ) || defined( _hpux ) || defined( __hpux )
+ return ".sl";
+#elif PLATFORM_POSIX
+ return ".so";
+#endif
+}
+
+/**
+ * @brief Get class instance
+ * @param className - [in] class name
+ * @return pointer to class instance
+ */
+DynamicClass * DynamicLibrary::GetInstance( const PDL_CHAR * className )
+{
+ const InstanceMap::iterator loadedInstance( instances_.find( className ) );
+ if ( loadedInstance != instances_.end() ) { return ( loadedInstance -> second ); }
+
+ const pdl_string builderName( pdl_string( "Create" ) + pdl_string( className ) );
+
+ // Tricky code to prevent compiler error
+ // ISO C++ forbids casting between pointer-to-function and pointer-to-object
+ DynamicBuilder builder = 0;
+ void * symbol = GetSymbolByName( builderName.c_str() );
+ ( void ) memcpy( &builder, &symbol, sizeof( void * ) );
+
+ if ( !builder )
+ {
+ instances_[ className ] = 0;
+ throw LoaderException( pdl_string( "Class `" ) + pdl_string( className ) +
+ pdl_string( "` not found in " ) + libraryName_ );
+ }
+
+ DynamicClass * instance = ( DynamicClass * )( *builder )();
+ instances_[ className ] = instance;
+ return instance;
+}
+
+/**
+ * @brief Get symbol by name
+ * @param symbolName - [in] symbol name
+ * @return pointer to symbol, 0 if not found
+ */
+void * DynamicLibrary::GetSymbolByName( const PDL_CHAR * symbolName )
+{
+ if ( !library_ )
+ {
+ throw LoaderException( pdl_string( "Library is not opened" ) );
+ }
+
+ return
+#if PLATFORM_WIN32
+ static_cast< void * >( ::GetProcAddress( _library, symbolName ) );
+#elif PLATFORM_POSIX
+ dlsym( library_, symbolName );
+#endif
+}
+
+/**
+ * @brief Get last error description
+ * @return last error description
+ */
+pdl_string DynamicLibrary::GetLastError() const
+{
+ try
+ {
+#if PLATFORM_WIN32
+ LPSTR lpMsgBuf = NULL;
+ const DWORD res =
+ ::FormatMessageA( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL, ::GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ reinterpret_cast< LPSTR >( &lpMsgBuf ), 0, NULL );
+ pdl_string errorText;
+ if ( res != 0 )
+ {
+ errorText.assign( lpMsgBuf );
+ ( void ) ::LocalFree( lpMsgBuf );
+ }
+#elif PLATFORM_POSIX
+ const pdl_string errorText( dlerror() );
+#endif
+ return errorText;
+ }
+ catch ( ... )
+ {
+ return pdl_string();
+ }
+}
+
+/**
+ * @brief Close library
+ * @return true if closed successfully, false otherwise
+ */
+bool DynamicLibrary::Close()
+{
+ const InstanceMap::iterator end( instances_.end() );
+ for ( InstanceMap::iterator i( instances_.begin() ); i != end; ++i )
+ {
+ ( i -> second ) -> Destroy();
+ }
+ instances_.clear();
+
+ bool closeSuccess = true;
+ if ( library_ )
+ {
+ closeSuccess =
+#if PLATFORM_WIN32
+ ( ::FreeLibrary( library_ ) != FALSE );
+#elif PLATFORM_POSIX
+ ( dlclose( library_ ) == 0 );
+#endif
+ library_ = 0;
+ }
+ libraryName_.clear();
+
+ return closeSuccess;
+}
+
+} // namespace PDL
View
142 playdar-daemon/deps/pdl-0.3.0/src/DynamicLibraryManager.cpp
@@ -0,0 +1,142 @@
+/**
+ * Copyright (c) 2007-2008, Igor Semenov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Igor Semenov nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY IGOR SEMENOV ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL IGOR SEMENOV BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <platform.h>
+#include <DynamicLibrary.hpp>
+#include <DynamicLibraryManager.hpp>
+#include <LoaderException.hpp>
+
+/**
+ * @namespace PDL
+ * @brief Portable Dynamic Loader
+ */
+namespace PDL
+{
+
+/**
+ * @brief Constructor
+ */
+DynamicLibraryManager::DynamicLibraryManager() : libraries_()
+{
+ ;;
+}
+
+/**
+ * @brief Destructor
+ */
+DynamicLibraryManager::~DynamicLibraryManager() throw()
+{
+ Reset();
+}
+
+/**
+ * @brief Reset library manager
+ * Free all libraries and set initial state
+ */
+void DynamicLibraryManager::Reset()
+{
+ // Free all libraries
+ const DynamicLibraryManager::LibraryMap::iterator end( libraries_.end() );
+ for ( DynamicLibraryManager::LibraryMap::iterator i( libraries_.begin() );
+ i != end;
+ ++i )
+ {
+ DynamicLibrary * library = i -> second;
+ if ( library )
+ {
+ library -> Close();
+ delete library;
+ }
+ }
+
+ // Clear map
+ libraries_.clear();
+}
+
+/**
+ * @brief Get dynamic library
+ * @param libName - [in] library file name
+ * @return dynamic library
+ * @throw LoaderException - cannot load library
+ */
+DynamicLibrary & DynamicLibraryManager::GetLibrary( const PDL_CHAR * libName )
+{
+ DynamicLibrary & library = GetLibraryInstance( libName );
+
+ if ( !library.Opened() )
+ {
+ // We tried to load this library before, but we've failed
+ throw LoaderException( pdl_string( "Cannot load library `" ) +
+ pdl_string( libName ) + pdl_string( "`" ) );
+ }
+
+ return library;
+}
+
+/**
+ * @brief Get dynamic library instance
+ * @param libName - [in] library file name
+ * @return dynamic library instance
+ */
+DynamicLibrary & DynamicLibraryManager::GetLibraryInstance( const PDL_CHAR * libName )
+{
+ if ( !libName )
+ {
+ throw LoaderException( pdl_string( "Library name is 0" ) );
+ }
+
+ DynamicLibrary * library = 0;
+ const LibraryMap::iterator libraryInstance( libraries_.find( libName ) );
+ if ( libraryInstance != libraries_.end() )
+ {
+ library = libraryInstance -> second;
+ }
+ else
+ {
+ library = new DynamicLibrary();
+ libraries_[ libName ] = library;
+ if ( ( library ) && ( !library -> Open( libName, true ) ) )
+ {
+ // This is the first time we try to load this library.
+ // We are able to specify the reason of failure.
+ throw LoaderException( pdl_string( "Cannot load library `" ) +
+ pdl_string( libName ) + pdl_string( "`: " ) +
+ library -> GetLastError() );
+ }
+ }
+
+ if ( !library )
+ {
+ // Actually, this should never happen.
+ // If it has happened, this means serious memory damage
+ throw LoaderException( pdl_string( "Internal error" ) );
+ }
+
+ return ( *library );
+}
+
+} // namespace PDL
View
89 playdar-daemon/deps/pdl-0.3.0/src/DynamicLoader.cpp
@@ -0,0 +1,89 @@
+/**
+ * Copyright (c) 2007-2008, Igor Semenov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Igor Semenov nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY IGOR SEMENOV ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL IGOR SEMENOV BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <DynamicClass.hpp>
+#include <DynamicLibrary.hpp>
+#include <DynamicLibraryManager.hpp>
+#include <DynamicLoader.hpp>
+#include <memory>
+
+/**
+ * @namespace PDL
+ * @brief Portable Dynamic Loader
+ */
+namespace PDL
+{
+
+/**
+ * @brief Constructor
+ */
+PDL_DECL DynamicLoader::DynamicLoader() : libraryManager_( new DynamicLibraryManager() )
+{
+ ;;
+}
+
+/**
+ * @brief Destructor
+ */
+PDL_DECL DynamicLoader::~DynamicLoader() throw()
+{
+ ;;
+}
+
+/**
+ * @brief Get dynamic loader instance
+ * @return dynamic loader instance
+ */
+PDL_DECL DynamicLoader & DynamicLoader::Instance()
+{
+ static DynamicLoader _dynamicLoader;
+ return _dynamicLoader;
+}
+
+/**
+ * @brief Create class instance
+ * @param libName - [in] library file name
+ * @param className - [in] class name
+ * @return class instance, 0 if failed
+ */
+PDL_DECL DynamicClass * DynamicLoader::GetDynamicInstance( const PDL_CHAR * libName,
+ const PDL_CHAR * className )
+{
+ DynamicLibrary & library = libraryManager_ -> GetLibrary( libName );
+ return library.GetInstance( className );
+}
+
+/**
+ * @brief Reset dynamic loader
+ * Unload all loaded libraries and free instances
+ */
+PDL_DECL void DynamicLoader::Reset()
+{
+ libraryManager_ -> Reset();
+}
+
+} // namespace PDL
View
66 playdar-daemon/deps/pdl-0.3.0/src/LoaderException.cpp
@@ -0,0 +1,66 @@
+/**
+ * Copyright (c) 2007-2008, Igor Semenov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Igor Semenov nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY IGOR SEMENOV ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL IGOR SEMENOV BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <platform.h>
+#include <LoaderException.hpp>
+#include <exception>
+#include <string>
+
+/**
+ * @namespace PDL
+ * @brief Portable Dynamic Loader
+ */
+namespace PDL
+{
+
+/**
+ * @brief Constructor
+ * @param text - [in] exception description
+ */
+PDL_DECL LoaderException::LoaderException( const pdl_string & text ) : text_( text )
+{
+ ;;
+}
+
+/**
+ * @brief Destructor
+ */
+PDL_DECL LoaderException::~LoaderException() throw()
+{
+ ;;
+}
+
+/**
+ * @brief Get exception description
+ * @return exception description
+ */
+PDL_DECL const char * LoaderException::what() const throw()
+{
+ return ( text_.c_str() );
+}
+
+} // namespace PDL
View
45 playdar-daemon/deps/pdl-0.3.0/tests/TestClass1.cpp
@@ -0,0 +1,45 @@
+/**
+ * Copyright (c) 2007-2008, Igor Semenov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Igor Semenov nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY IGOR SEMENOV ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL IGOR SEMENOV BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "TestClass1.hpp"
+#include <stdio.h>
+
+/**
+ * @brief Test method
+ */
+void MyTestClass1::DoSomething() throw()
+{
+ fprintf(stderr, "MyTestClass1::DoSomething()\n");
+}
+
+/**
+ * @brief Test method
+ */
+void MyTestClass2::DoSomething() throw()
+{
+ fprintf(stderr, "MyTestClass2::DoSomething()\n");
+}
View
63 playdar-daemon/deps/pdl-0.3.0/tests/TestClass1.hpp
@@ -0,0 +1,63 @@
+/**
+ * Copyright (c) 2007-2008, Igor Semenov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Igor Semenov nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY IGOR SEMENOV ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL IGOR SEMENOV BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <DynamicClass.hpp>
+#include "TestInterface.hpp"
+
+/**
+ * @class MyTestClass1
+ * @brief Test class 1
+ */
+class MyTestClass1 : public MyTestInterface
+{
+
+public:
+ /**
+ * @brief Test method
+ */
+ void DoSomething() throw();
+
+};
+
+EXPORT_DYNAMIC_CLASS( MyTestClass1 )
+
+/**
+ * @class MyTestClass2
+ * @brief Test class 2
+ */
+class MyTestClass2 : public MyTestInterface
+{
+
+public:
+ /**
+ * @brief Test method
+ */
+ void DoSomething() throw();
+
+};
+
+EXPORT_DYNAMIC_CLASS( MyTestClass2 )
View
45 playdar-daemon/deps/pdl-0.3.0/tests/TestClass2.cpp
@@ -0,0 +1,45 @@
+/**
+ * Copyright (c) 2007-2008, Igor Semenov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Igor Semenov nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY IGOR SEMENOV ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL IGOR SEMENOV BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "TestClass2.hpp"
+#include <stdio.h>
+
+/**
+ * @brief Test method
+ */
+void MyTestClass3::DoSomething() throw()
+{
+ fprintf(stderr, "MyTestClass3::DoSomething()\n");
+}
+
+/**
+ * @brief Test method
+ */
+void MyTestClass4::DoSomething() throw()
+{
+ fprintf(stderr, "MyTestClass4::DoSomething()\n");
+}
View
63 playdar-daemon/deps/pdl-0.3.0/tests/TestClass2.hpp
@@ -0,0 +1,63 @@
+/**
+ * Copyright (c) 2007-2008, Igor Semenov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Igor Semenov nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY IGOR SEMENOV ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL IGOR SEMENOV BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <DynamicClass.hpp>
+#include "TestInterface.hpp"
+
+/**
+ * @class MyTestClass3
+ * @brief Test class 3
+ */
+class MyTestClass3 : public MyTestInterface
+{
+
+public:
+ /**
+ * @brief Test method
+ */
+ void DoSomething() throw();
+
+};
+
+EXPORT_DYNAMIC_CLASS( MyTestClass3 )
+
+/**
+ * @class MyTestClass4
+ * @brief Test class 4
+ */
+class MyTestClass4 : public MyTestInterface
+{
+
+public:
+ /**
+ * @brief Test method
+ */
+ void DoSomething() throw();
+
+};
+
+EXPORT_DYNAMIC_CLASS( MyTestClass4 )
View
127 playdar-daemon/deps/pdl-0.3.0/tests/TestDynamicLibrary.cpp
@@ -0,0 +1,127 @@
+/**
+ * Copyright (c) 2007-2008, Igor Semenov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Igor Semenov nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY IGOR SEMENOV ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL IGOR SEMENOV BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <DynamicClass.hpp>
+#include <DynamicLibrary.hpp>
+#include <LoaderException.hpp>
+#include "UnitTest.hpp"
+
+int main( int argc, char ** argv )
+{
+ if ( argc != 2 )
+ {
+ fprintf( stderr, "ERROR: Usage %s <libName>\n", argv[ 0 ] );\
+ return -1;
+ }
+
+ PDL::DynamicLibrary lib1;
+ PDL::DynamicLibrary lib2;
+ PDL::DynamicLibrary lib3;
+
+ // Test DynamicLibrary::Open()
+ UNIT_TEST( !lib1.Open( "SomeDefinitelyNotExistentFile" ) );
+ fprintf( stderr, "LastError: (%s)\n", lib1.GetLastError().c_str() );
+
+ UNIT_TEST( lib2.Open( argv[ 1 ] ) );
+ fprintf( stderr, "LastError: (%s)\n", lib2.GetLastError().c_str() );
+
+ UNIT_TEST( !lib3.Open( 0 ) );
+ fprintf( stderr, "LastError: (%s)\n", lib3.GetLastError().c_str() );
+
+ // Test DynamicLibrary::Opened()
+ UNIT_TEST( !lib1.Opened() );
+ UNIT_TEST( lib2.Opened() );
+
+ // Test DynamicLibrary::GetInstance()
+ try
+ {
+ lib1.GetInstance( "MyTestClass1" );
+ UNIT_TEST( false );
+ }
+ catch( PDL::LoaderException & ex )
+ {
+ fprintf( stderr, "Exception: %s, LastError: (%s)\n", ex.what(), lib1.GetLastError().c_str() );
+ UNIT_TEST( true );
+ }
+ catch( ... )
+ {
+ UNIT_TEST( false );
+ }
+
+ try
+ {
+ lib2.GetInstance( "NonExistentClass" );
+ UNIT_TEST( false );
+ }
+ catch( PDL::LoaderException & ex )
+ {
+ fprintf( stderr, "Exception: %s, LastError: (%s)\n", ex.what(), lib2.GetLastError().c_str() );
+ UNIT_TEST( true );
+ }
+ catch( ... )
+ {
+ UNIT_TEST( false );
+ }
+
+ try
+ {
+ lib2.GetInstance( "MyTestClass1" );
+ lib2.GetInstance( "MyTestClass2" );
+ UNIT_TEST( true );
+ }
+ catch( PDL::LoaderException & ex )
+ {
+ fprintf( stderr, "Exception: %s, LastError: (%s)\n", ex.what(), lib2.GetLastError().c_str() );
+ UNIT_TEST( false );
+ }
+ catch( ... )
+ {
+ UNIT_TEST( false );
+ }
+
+ try
+ {
+ PDL::DynamicClass * class1 = lib2.GetInstance( "MyTestClass1" );
+ PDL::DynamicClass * class2 = lib2.GetInstance( "MyTestClass1" );
+ UNIT_TEST( ( class1 ) && ( class2 ) && ( class1 == class2 ) );
+ }
+ catch( PDL::LoaderException & ex )
+ {
+ fprintf( stderr, "Exception: %s, LastError: (%s)\n", ex.what(), lib2.GetLastError().c_str() );
+ UNIT_TEST( false );
+ }
+ catch( ... )
+ {
+ UNIT_TEST( false );