diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2008-11-19 15:47:23 +0100 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2008-11-19 15:47:23 +0100 |
commit | a3b3e7d83cab57673ba3daf5d71244598cf73f0c (patch) | |
tree | c8a4b2e57ce2821dc9588a32ce4dc2103dd23a44 /src | |
parent | 8f5086e03d80620ededcad052192e7247a91dcd8 (diff) | |
download | mad-a3b3e7d83cab57673ba3daf5d71244598cf73f0c.tar mad-a3b3e7d83cab57673ba3daf5d71244598cf73f0c.zip |
UserBackend-Interface begonnen
Diffstat (limited to 'src')
-rw-r--r-- | src/Common/Makefile.am | 6 | ||||
-rw-r--r-- | src/Common/Makefile.in | 7 | ||||
-rw-r--r-- | src/Core/Backends/Makefile.am | 4 | ||||
-rw-r--r-- | src/Core/Backends/Makefile.in | 377 | ||||
-rw-r--r-- | src/Core/Makefile.am | 8 | ||||
-rw-r--r-- | src/Core/Makefile.in | 15 | ||||
-rw-r--r-- | src/Core/UserBackend.cpp | 56 | ||||
-rw-r--r-- | src/Core/UserBackend.h | 97 |
8 files changed, 555 insertions, 15 deletions
diff --git a/src/Common/Makefile.am b/src/Common/Makefile.am index bf4df4e..20daebb 100644 --- a/src/Common/Makefile.am +++ b/src/Common/Makefile.am @@ -1,8 +1,10 @@ SUBDIRS = Backends Requests RequestHandlers noinst_LTLIBRARIES = libcommon.la -libcommon_la_SOURCES = ConfigEntry.cpp ConfigManager.cpp Exception.cpp Initializable.cpp Logger.cpp LogManager.cpp RequestManager.cpp SystemBackend.cpp Tokenizer.cpp +libcommon_la_SOURCES = ConfigEntry.cpp ConfigManager.cpp Exception.cpp Initializable.cpp Logger.cpp \ + LogManager.cpp RequestManager.cpp SystemBackend.cpp Tokenizer.cpp libcommon_la_LIBADD = Backends/libbackends.la Requests/librequests.la RequestHandlers/librequesthandlers.la -noinst_HEADERS = ConfigEntry.h ConfigManager.h Configurable.h Exception.h HostInfo.h Initializable.h Logger.h LoggerBase.h LogManager.h RemoteLogger.h Request.h RequestBase.h \ +noinst_HEADERS = ConfigEntry.h ConfigManager.h Configurable.h Exception.h HostInfo.h Initializable.h \ + Logger.h LoggerBase.h LogManager.h RemoteLogger.h Request.h RequestBase.h \ RequestHandler.h RequestManager.h SharedPtr.h SystemBackend.h Tokenizer.h diff --git a/src/Common/Makefile.in b/src/Common/Makefile.in index 15cf675..3bd9f4a 100644 --- a/src/Common/Makefile.in +++ b/src/Common/Makefile.in @@ -201,9 +201,12 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = Backends Requests RequestHandlers noinst_LTLIBRARIES = libcommon.la -libcommon_la_SOURCES = ConfigEntry.cpp ConfigManager.cpp Exception.cpp Initializable.cpp Logger.cpp LogManager.cpp RequestManager.cpp SystemBackend.cpp Tokenizer.cpp +libcommon_la_SOURCES = ConfigEntry.cpp ConfigManager.cpp Exception.cpp Initializable.cpp Logger.cpp \ + LogManager.cpp RequestManager.cpp SystemBackend.cpp Tokenizer.cpp + libcommon_la_LIBADD = Backends/libbackends.la Requests/librequests.la RequestHandlers/librequesthandlers.la -noinst_HEADERS = ConfigEntry.h ConfigManager.h Configurable.h Exception.h HostInfo.h Initializable.h Logger.h LoggerBase.h LogManager.h RemoteLogger.h Request.h RequestBase.h \ +noinst_HEADERS = ConfigEntry.h ConfigManager.h Configurable.h Exception.h HostInfo.h Initializable.h \ + Logger.h LoggerBase.h LogManager.h RemoteLogger.h Request.h RequestBase.h \ RequestHandler.h RequestManager.h SharedPtr.h SystemBackend.h Tokenizer.h all: all-recursive diff --git a/src/Core/Backends/Makefile.am b/src/Core/Backends/Makefile.am new file mode 100644 index 0000000..3f08197 --- /dev/null +++ b/src/Core/Backends/Makefile.am @@ -0,0 +1,4 @@ +noinst_LTLIBRARIES = libbackends.la +libbackends_la_SOURCES = + +noinst_HEADERS = diff --git a/src/Core/Backends/Makefile.in b/src/Core/Backends/Makefile.in new file mode 100644 index 0000000..8dc24b8 --- /dev/null +++ b/src/Core/Backends/Makefile.in @@ -0,0 +1,377 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/Core/Backends +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/src/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libbackends_la_LIBADD = +am_libbackends_la_OBJECTS = +libbackends_la_OBJECTS = $(am_libbackends_la_OBJECTS) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libbackends_la_SOURCES) +DIST_SOURCES = $(libbackends_la_SOURCES) +HEADERS = $(noinst_HEADERS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +GSSAPI_LIBS = @GSSAPI_LIBS@ +GnuTLS_CFLAGS = @GnuTLS_CFLAGS@ +GnuTLS_LIBS = @GnuTLS_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +RANLIB = @RANLIB@ +READLINE_LIBS = @READLINE_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sigc_CFLAGS = @sigc_CFLAGS@ +sigc_LIBS = @sigc_LIBS@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +noinst_LTLIBRARIES = libbackends.la +libbackends_la_SOURCES = +noinst_HEADERS = +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Core/Backends/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/Core/Backends/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libbackends.la: $(libbackends_la_OBJECTS) $(libbackends_la_DEPENDENCIES) + $(LINK) $(libbackends_la_OBJECTS) $(libbackends_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + clean-noinstLTLIBRARIES distclean distclean-compile \ + distclean-generic distclean-libtool distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + uninstall uninstall-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/Core/Makefile.am b/src/Core/Makefile.am index fa7bb9e..f7d6289 100644 --- a/src/Core/Makefile.am +++ b/src/Core/Makefile.am @@ -1,8 +1,8 @@ -SUBDIRS = Requests RequestHandlers +SUBDIRS = Backends Requests RequestHandlers noinst_LTLIBRARIES = libcore.la -libcore_la_SOURCES = ConnectionManager.cpp -libcore_la_LIBADD = Requests/librequests.la RequestHandlers/librequesthandlers.la +libcore_la_SOURCES = ConnectionManager.cpp UserBackend.cpp +libcore_la_LIBADD = Backends/libbackends.la Requests/librequests.la RequestHandlers/librequesthandlers.la -noinst_HEADERS = ConnectionManager.h +noinst_HEADERS = ConnectionManager.h UserBackend.h diff --git a/src/Core/Makefile.in b/src/Core/Makefile.in index a190ccd..db598e5 100644 --- a/src/Core/Makefile.in +++ b/src/Core/Makefile.in @@ -47,9 +47,9 @@ mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) -libcore_la_DEPENDENCIES = Requests/librequests.la \ - RequestHandlers/librequesthandlers.la -am_libcore_la_OBJECTS = ConnectionManager.lo +libcore_la_DEPENDENCIES = Backends/libbackends.la \ + Requests/librequests.la RequestHandlers/librequesthandlers.la +am_libcore_la_OBJECTS = ConnectionManager.lo UserBackend.lo libcore_la_OBJECTS = $(am_libcore_la_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src depcomp = $(SHELL) $(top_srcdir)/depcomp @@ -197,11 +197,11 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -SUBDIRS = Requests RequestHandlers +SUBDIRS = Backends Requests RequestHandlers noinst_LTLIBRARIES = libcore.la -libcore_la_SOURCES = ConnectionManager.cpp -libcore_la_LIBADD = Requests/librequests.la RequestHandlers/librequesthandlers.la -noinst_HEADERS = ConnectionManager.h +libcore_la_SOURCES = ConnectionManager.cpp UserBackend.cpp +libcore_la_LIBADD = Backends/libbackends.la Requests/librequests.la RequestHandlers/librequesthandlers.la +noinst_HEADERS = ConnectionManager.h UserBackend.h all: all-recursive .SUFFIXES: @@ -254,6 +254,7 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ConnectionManager.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UserBackend.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< diff --git a/src/Core/UserBackend.cpp b/src/Core/UserBackend.cpp new file mode 100644 index 0000000..ccb5e18 --- /dev/null +++ b/src/Core/UserBackend.cpp @@ -0,0 +1,56 @@ +/* + * UserBackend.cpp + * + * Copyright (C) 2008 Matthias Schiffer <matthias@gamezock.de> + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "UserBackend.h" + +namespace Mad { +namespace Core { + +std::set<UserBackend*, UserBackend::Compare> UserBackend::backends; + + +bool UserBackend::getUserList(const sigc::slot<void, const std::map<unsigned long, UserInfo>& > &callback) { + for(std::set<UserBackend*>::iterator backend = backends.begin(); backend != backends.end(); ++backend) { + if((*backend)->userList(callback)) + return true; + } + + return false; +} + +bool UserBackend::getUserInfo(unsigned long uid, const sigc::slot<void, const UserInfo&> &callback) { + for(std::set<UserBackend*>::iterator backend = backends.begin(); backend != backends.end(); ++backend) { + if((*backend)->userInfo(uid, callback)) + return true; + } + + return false; +} + +bool UserBackend::setPassword(unsigned long uid, const std::string &password, const sigc::slot<void, bool> &callback) { + for(std::set<UserBackend*>::iterator backend = backends.begin(); backend != backends.end(); ++backend) { + if((*backend)->password(uid, password, callback)) + return true; + } + + return false; +} + +} +} diff --git a/src/Core/UserBackend.h b/src/Core/UserBackend.h new file mode 100644 index 0000000..6031d2f --- /dev/null +++ b/src/Core/UserBackend.h @@ -0,0 +1,97 @@ +/* + * UserBackend.h + * + * Copyright (C) 2008 Matthias Schiffer <matthias@gamezock.de> + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef MAD_CORE_USERBACKEND_H_ +#define MAD_CORE_USERBACKEND_H_ + +#include <map> +#include <set> +#include <string> +#include <vector> + +#include <sigc++/signal.h> + + +namespace Mad { +namespace Core { + +class UserBackend { + private: + struct Compare { + bool operator() (const UserBackend *b1, const UserBackend *b2) { + if(b1->getPriority() == b2->getPriority()) + return (b1 > b2); + else + return (b1->getPriority() > b2->getPriority()); + } + }; + + static std::set<UserBackend*, Compare> backends; + + public: + struct UserInfo { + unsigned long uid; + unsigned long gid; + + std::vector<unsigned long> gids; + + std::string username; + std::string fullName; + }; + + protected: + UserBackend() {} + + static void registerBackend(UserBackend *backend) { + backends.insert(backend); + } + + static void unregisterBackend(UserBackend *backend) { + backends.erase(backend); + } + + virtual bool userList(const sigc::slot<void, const std::map<unsigned long, UserInfo>& >&) { + return false; + } + + virtual bool userInfo(unsigned long, const sigc::slot<void, const UserInfo&>&) { + return false; + } + + virtual bool password(unsigned long, const std::string&, const sigc::slot<void, bool>&) { + return false; + } + + virtual int getPriority() const { + return 0; + } + + public: + virtual ~UserBackend() {} + + static bool getUserList(const sigc::slot<void, const std::map<unsigned long, UserInfo>& > &callback); + static bool getUserInfo(unsigned long uid, const sigc::slot<void, const UserInfo&> &callback); + + static bool setPassword(unsigned long uid, const std::string &password, const sigc::slot<void, bool> &callback); +}; + +} +} + +#endif /* MAD_CORE_USERBACKEND_H_ */ |