You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(622) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(303) |
Feb
(64) |
Mar
(5) |
Apr
(63) |
May
(82) |
Jun
(53) |
Jul
(50) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Christian P. <cp...@us...> - 2005-06-03 09:49:42
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/IO In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24858/include/pclasses/IO Modified Files: IOStream.h Log Message: - Added missing #include guard Index: IOStream.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/IO/IOStream.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- IOStream.h 17 Jan 2005 21:55:23 -0000 1.3 +++ IOStream.h 3 Jun 2005 09:49:11 -0000 1.4 @@ -18,6 +18,9 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ +#ifndef P_IO_IOStream_h +#define P_IO_IOStream_h + #include <pclasses/Export.h> #include <pclasses/IO/IODevice.h> #include <iostream> @@ -62,3 +65,5 @@ } // !namespace IO } // !namespace P + +#endif |
From: Christian P. <cp...@us...> - 2005-06-03 09:48:45
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24442/include/pclasses Modified Files: Trace.h Log Message: - Fixed non-debug P_TRACE-macros Index: Trace.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/Trace.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- Trace.h 29 May 2005 17:42:31 -0000 1.6 +++ Trace.h 3 Jun 2005 09:48:36 -0000 1.7 @@ -90,8 +90,8 @@ # define P_TRACE(c) P::TraceLog::instance().stream(P_SOURCEINFO,#c,this)() # define P_TRACE_GLOBAL() P::TraceLog::instance().stream(P_SOURCEINFO)() #else -# define P_TRACE(c) NullTraceStream() -# define P_TRACE_GLOBAL() NullTraceStream() +# define P_TRACE(c) P::NullTraceStream() +# define P_TRACE_GLOBAL() P::NullTraceStream() #endif } // !namespace P |
From: Christian P. <cp...@us...> - 2005-06-03 09:47:53
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23915/include/pclasses Modified Files: Makefile.am Added Files: Buffer.h Log Message: - Added P::Buffer<> Index: Makefile.am =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/Makefile.am,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- Makefile.am 6 May 2005 15:28:23 -0000 1.14 +++ Makefile.am 3 Jun 2005 09:47:42 -0000 1.15 @@ -18,7 +18,7 @@ CircularQueue.h List.h NonCopyable.h Phoenix.h CoreMutex.h Factory.h \ SharingContext.h Time.h Date.h DateTime.h TimeSpan.h Callback.h Signal.h \ CallbackN1.h CallbackN2.h CallbackN3.h CallbackN4.h \ - Trace.h PropertyMap.h Export.h pclasses-config.h + Trace.h PropertyMap.h Export.h Buffer.h pclasses-config.h all: all_callbacks --- NEW FILE: Buffer.h --- /*************************************************************************** * Copyright (C) 2005 by Christian Prochnow * * cp...@se... * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU Library General Public License as * * published by the Free Software Foundation; either version 2 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 Library General Public * * License along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef P_Buffer_h #define P_Buffer_h #include <pclasses/Algorithm.h> #include <pclasses/Exception.h> namespace P { template <class Type> class Buffer { public: Buffer(size_t size = 1024, bool autoResize = true) : _autoResize(autoResize), _buffer((Type*)new char[sizeof(Type) * size]), _size(size), _count(0) { } Buffer(const Buffer& b) : _autoResize(b._autoResize), _buffer((Type*)new char[sizeof(Type) * b._size]), _size(b._size), _count(b._count) { copy_construct(_buffer, b._buffer, _count); } ~Buffer() throw() { clear(); delete[] (char*)_buffer; } void swap(Buffer& b) throw() { bool autoResize = b._autoResize; Type* buffer = b._buffer; size_t size = b._size; size_t count = b._count; b._autoResize = _autoResize; b._buffer = _buffer; b._size = _size; b._count = _count; _autoResize = autoResize; _buffer = buffer; _size = size; _count = count; } void clear() throw() { destruct(_buffer, _count); _count = 0; } inline size_t size() const throw() { return _count; } void resize(size_t sz) throw(OverrunError) { if(_count > sz) throw OverrunError("Buffer overrun", P_SOURCEINFO); Type* newBuffer = (Type*)new char[sizeof(Type) * sz]; copy_construct(newBuffer, _buffer, _count); destruct(_buffer, _count); delete[] (char*)_buffer; _buffer = newBuffer; _size = sz; } inline size_t capacity() const throw() { return _size; } inline bool empty() const throw() { return _count == 0; } inline Type* data() throw() { return _buffer; } void pop(size_t count) throw(UnderrunError) { if(_count >= count) { destruct(_buffer, count); copy(_buffer, _buffer + count, _count - count); _count -= count; return; } throw UnderrunError("Buffer underrun", P_SOURCEINFO); } void push(const Type* buff, size_t count) throw(OverrunError) { if(_size < _count + count) { if(!_autoResize) throw OverrunError("Buffer overrun", P_SOURCEINFO); resize(_count + count); } copy_construct(_buffer + _count, buff, count); _count += count; } inline Buffer& operator=(const Buffer& b) { Buffer(b).swap(*this); return *this; } private: bool _autoResize; Type* _buffer; size_t _size; size_t _count; }; template <class Type> inline void swap(Buffer<Type>& a, Buffer<Type>& b) throw() { a.swap(b); } } // !namespace P #endif |
From: Christian P. <cp...@us...> - 2005-05-29 17:57:22
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/IO In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv885/include/pclasses/IO Modified Files: IOHandler.h Log Message: - IOHandler is a NonCopyable Index: IOHandler.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/IO/IOHandler.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- IOHandler.h 25 May 2005 08:02:56 -0000 1.1 +++ IOHandler.h 29 May 2005 17:56:50 -0000 1.2 @@ -22,6 +22,7 @@ #define P_IO_IOHandler_h #include <pclasses/Export.h> +#include <pclasses/NonCopyable.h> #include <pclasses/IO/URL.h> #include <pclasses/IO/IORequest.h> @@ -30,7 +31,7 @@ namespace IO { //! IORequest handler -class PIO_EXPORT IOHandler { +class PIO_EXPORT IOHandler: public NonCopyable { public: IOHandler(); virtual ~IOHandler(); |
From: Christian P. <cp...@us...> - 2005-05-29 17:48:40
|
Update of /cvsroot/pclasses/pclasses2/src/IO In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28526/src/IO Modified Files: IODevice.cpp Makefile.am Added Files: IOListener.cpp Log Message: - Added beginning of async IOListeners --- NEW FILE: IOListener.cpp --- /*************************************************************************** * Copyright (C) 2004 by Christian Prochnow * * cp...@se... * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU Library General Public License as * * published by the Free Software Foundation; either version 2 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 Library General Public * * License along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "pclasses/IO/IOListener.h" namespace P { namespace IO { IOListener::IOListener(IODevice& dev, int flags) : _dev(dev) { dev.addListener(this); } IOListener::~IOListener() { _dev.removeListener(this); } } } Index: Makefile.am =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/IO/Makefile.am,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- Makefile.am 25 May 2005 08:02:55 -0000 1.11 +++ Makefile.am 29 May 2005 17:48:31 -0000 1.12 @@ -6,7 +6,7 @@ libpclasses_io_la_SOURCES = IOError.cpp IODevice.cpp IOStream.cpp \ IOFilter.cpp URL.cpp ZLib.cpp ZLibIOFilter.cpp BZip2.cpp BZip2IOFilter.cpp \ - IORequest.cpp IOHandler.cpp IOManager.cpp + IORequest.cpp IOHandler.cpp IOManager.cpp IOListener.cpp libpclasses_io_la_LDFLAGS = -no-nundefined Index: IODevice.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/IO/IODevice.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- IODevice.cpp 30 Jan 2005 17:09:13 -0000 1.8 +++ IODevice.cpp 29 May 2005 17:48:31 -0000 1.9 @@ -197,6 +197,15 @@ return _filter; } +void IODevice::addListener(IOListener*) throw(IOError) +{ + throw IOError(0, "Listening on this device is not supported", P_SOURCEINFO); +} + +void IODevice::removeListener(IOListener*) throw() +{ +} + size_t IODevice::_peek(char* buffer, size_t count) throw(IOError) { return 0; |
From: Christian P. <cp...@us...> - 2005-05-29 17:48:40
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/IO In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28526/include/pclasses/IO Modified Files: IODevice.h Makefile.am Added Files: IOListener.h Log Message: - Added beginning of async IOListeners Index: IODevice.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/IO/IODevice.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- IODevice.h 30 Jan 2005 17:08:48 -0000 1.7 +++ IODevice.h 29 May 2005 17:48:31 -0000 1.8 @@ -31,6 +31,7 @@ // forward declaration class IOFilter; +class IOListener; //! I/O Device base class /*! @@ -197,9 +198,14 @@ IOFilter* filter() const throw(); protected: + friend class IOListener; + IODevice(const IODevice& dev) throw(); IODevice& operator=(const IODevice& dev) throw(); + virtual void addListener(IOListener*) throw(IOError); + virtual void removeListener(IOListener*) throw(); + //! Called when device should be closed /*! precondition: valid()==true Index: Makefile.am =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/IO/Makefile.am,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- Makefile.am 25 May 2005 08:02:56 -0000 1.8 +++ Makefile.am 29 May 2005 17:48:31 -0000 1.9 @@ -4,4 +4,4 @@ METASOURCES = AUTO pclasses_io_include_HEADERS = IOError.h IODevice.h IOStream.h IOFilter.h \ URL.h ZLib.h ZLibIOFilter.h BZip2.h BZip2IOFilter.h IORequest.h \ - IOHandler.h IOManager.h + IOHandler.h IOManager.h IOListener.h --- NEW FILE: IOListener.h --- /*************************************************************************** * Copyright (C) 2004 by Christian Prochnow * * cp...@se... * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU Library General Public License as * * published by the Free Software Foundation; either version 2 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 Library General Public * * License along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef P_IO_IOListener_h #define P_IO_IOListener_h #include <pclasses/Export.h> #include <pclasses/IO/IODevice.h> namespace P { namespace IO { class PIO_EXPORT IOListener { public: //! Notify flags enum NotifyFlags { NotifyNone = 0x0, NotifyRead = 0x1, NotifyWrite = 0x2 }; IOListener(IODevice& dev, int flags = 0); virtual ~IOListener(); virtual int flags() const = 0; virtual void setFlags(int flags) = 0; virtual void onRead() = 0; virtual void onWrite() = 0; private: IODevice& _dev; }; } // !namespace IO } // !namespace P #endif |
From: Christian P. <cp...@us...> - 2005-05-29 17:42:40
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25752/include/pclasses Modified Files: Trace.h Log Message: - Fixed the global trace macros Index: Trace.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/Trace.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Trace.h 20 May 2005 14:19:52 -0000 1.5 +++ Trace.h 29 May 2005 17:42:31 -0000 1.6 @@ -33,6 +33,7 @@ class TraceLog; +//! Debug tracing stream class PCORE_EXPORT TraceStream: private std::ostream { @@ -73,6 +74,7 @@ static TraceLog _trace; }; +//! A Tracing stream that outputs nothing class NullTraceStream { public: inline NullTraceStream& operator()(const SourceInfo& si) @@ -86,10 +88,10 @@ #if defined(_DEBUG) && !defined(NO_DEBUG) # define P_TRACE(c) P::TraceLog::instance().stream(P_SOURCEINFO,#c,this)() -# define P_TRACE_GLOBAL(c) P::TraceLog::instance().stream(P_SOURCEINFO)() +# define P_TRACE_GLOBAL() P::TraceLog::instance().stream(P_SOURCEINFO)() #else # define P_TRACE(c) NullTraceStream() -# define P_TRACE_GLOBAL(c) NullTraceStream() +# define P_TRACE_GLOBAL() NullTraceStream() #endif } // !namespace P |
From: Christian P. <cp...@us...> - 2005-05-29 17:42:17
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25065/include/pclasses Modified Files: Factory.h Log Message: - Added a Factory::registerType() method which does not require constructing a temportary object of the registered type. Index: Factory.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/Factory.h,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- Factory.h 7 May 2005 11:55:47 -0000 1.23 +++ Factory.h 29 May 2005 17:42:09 -0000 1.24 @@ -258,6 +258,12 @@ registerFactory(key, &typeCreateHook<TypeName>); } + template <class TypeName> + void registerType(const std::string& key) + { + registerFactory(key, &typeCreateHook<TypeName>); + } + //! Returns the shared instance of the Factory static Factory& instance() { @@ -286,7 +292,7 @@ //! Register type with the Factory #define P_FACTORY_REGISTER_TYPE(Iface, c) \ - P::Factory<Iface>::instance().registerType(#c, c()) + P::Factory<Iface>::instance().registerType<c>(#c) //! Register alias with the Factory #define P_FACTORY_REGISTER_ALIAS(Iface, a, c) \ |
From: Christian P. <cp...@us...> - 2005-05-27 15:29:05
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15817/include/pclasses/System Modified Files: Plugin.h Log Message: - Forgot to include Factory.h Index: Plugin.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/System/Plugin.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Plugin.h 7 May 2005 11:55:47 -0000 1.2 +++ Plugin.h 27 May 2005 15:28:57 -0000 1.3 @@ -26,6 +26,7 @@ #include <pclasses/Export.h> #include <pclasses/NonCopyable.h> +#include <pclasses/Factory.h> #include <pclasses/Unicode/String.h> #include <pclasses/System/PathFinder.h> #include <pclasses/System/SharedLib.h> |
From: Christian P. <cp...@us...> - 2005-05-27 15:28:43
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15748/src/System Modified Files: Directory.posix.cpp Log Message: - Small fix when reading directory entries Index: Directory.posix.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/Directory.posix.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Directory.posix.cpp 26 Jan 2005 10:27:00 -0000 1.3 +++ Directory.posix.cpp 27 May 2005 15:28:34 -0000 1.4 @@ -58,7 +58,7 @@ struct dirent* de; while((de = readdir((DIR*)_handle))) - _entries.push_back(Unicode::String(de->d_name)); + _entries.push_back(Unicode::String::fromUtf8(de->d_name)); } Directory::Iterator Directory::begin() const |
From: stephan b. <sg...@us...> - 2005-05-27 14:02:30
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/Util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28079/include/pclasses/Util Modified Files: StringTool.h Log Message: added a fixmenot note. Index: StringTool.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/Util/StringTool.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- StringTool.h 26 Apr 2005 12:19:56 -0000 1.8 +++ StringTool.h 27 May 2005 14:02:17 -0000 1.9 @@ -253,6 +253,11 @@ { //@@fixme 050110 cproch: // why is this a Phoenix ? could be a simple statically allocated structure? + // @fixmenot 050310 sgbeal: + // Because in libs11n (where this code came from) i once had a + // case where serialization of the app's config file post-main + // called this func and stepped on a dead reference. + // The phoenix provides us with a valid map post-main(). typedef ::P::Phoenix<EntityMap, StrSharingContext<EntityMap>, defaultEscapesInitializer |
From: stephan b. <sg...@us...> - 2005-05-27 14:01:01
|
Update of /cvsroot/pclasses/pclasses2/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27798/doc Modified Files: Makefile.toc Log Message: Added a var to please DOXYGEN.make Index: Makefile.toc =================================================================== RCS file: /cvsroot/pclasses/pclasses2/doc/Makefile.toc,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Makefile.toc 30 Dec 2004 15:45:04 -0000 1.3 +++ Makefile.toc 27 May 2005 14:00:52 -0000 1.4 @@ -6,6 +6,7 @@ INCLUDES_DIRS = $(addprefix $(top_includesdir)/,s11n) TOPDIR_ABS = $(shell cd $(top_srcdir); echo $$PWD;) +DOXYGEN_HTML_OUTDIR = $(TOPDIR_ABS)/doxygen# Used by DOXYGEN.make for clean target DOXYGEN_ATPARSE_ARGS = \ DOXYGEN_OUTPUT_PATH="$(TOPDIR_ABS)/doxygen" \ DOXYGEN_STRIP_PATH="$(TOPDIR_ABS)" \ |
From: stephan b. <sg...@us...> - 2005-05-27 14:00:20
|
Update of /cvsroot/pclasses/pclasses2/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27474/doc Modified Files: Doxyfile.at Log Message: Added S11nNode.* to exclude pattern. Can't remember why, but i must have had a reason. Index: Doxyfile.at =================================================================== RCS file: /cvsroot/pclasses/pclasses2/doc/Doxyfile.at,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Doxyfile.at 25 Dec 2004 21:30:49 -0000 1.1 +++ Doxyfile.at 27 May 2005 13:59:55 -0000 1.2 @@ -111,7 +111,7 @@ RECURSIVE = YES EXCLUDE = EXCLUDE_SYMLINKS = NO -EXCLUDE_PATTERNS = +EXCLUDE_PATTERNS = S11nNode.* EXAMPLE_PATH = EXAMPLE_PATTERNS = * EXAMPLE_RECURSIVE = NO |
From: Christian P. <cp...@us...> - 2005-05-25 09:35:08
|
Update of /cvsroot/pclasses/pclasses2/plugins/IOHandler/file In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24740/plugins/IOHandler/file Modified Files: IOHandler_file.cpp Log Message: - Renamed IORequest::open() to IORequest::connect() and IORequest::close() to IORequest::disconnect() to support deriving from IODevice - Derived IORequest_Get and IORequest_Put from IODevice Index: IOHandler_file.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/plugins/IOHandler/file/IOHandler_file.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- IOHandler_file.cpp 25 May 2005 08:06:10 -0000 1.1 +++ IOHandler_file.cpp 25 May 2005 09:34:59 -0000 1.2 @@ -33,18 +33,30 @@ IORequest_file_Get(const URL& url) : IORequest_Get(url) { } - ~IORequest_file_Get() { } + ~IORequest_file_Get() throw() { } - void open() + void connect() throw(IOError) { _file.open(url().path(), IODevice::Read, IODevice::OpenFail, IODevice::AllowWrite); + setValid(true); + setEof(false); + setAccess(IODevice::Read); } - void close() { _file.close(); } + void disconnect() throw(IOError) + { + _file.close(); + setValid(false); + setEof(true); + } - size_t read(char* buffer, size_t count) + size_t _read(char* buffer, size_t count) throw(IOError) { - return _file.read(buffer, count); + size_t ret = _file.read(buffer, count); + if(!ret) + setEof(true); + + return true; } private: @@ -56,16 +68,24 @@ IORequest_file_Put(const URL& url) : IORequest_Put(url) { } - ~IORequest_file_Put() { } + ~IORequest_file_Put() throw() { } - void open() + void connect() throw(IOError) { _file.open(url().path(), IODevice::Write, IODevice::OpenCreate, IODevice::AllowRead); + setValid(true); + setEof(false); + setAccess(IODevice::Write); } - void close() { _file.close(); } + void disconnect() throw(IOError) + { + _file.close(); + setValid(false); + setEof(true); + } - size_t write(const char* buffer, size_t count) + size_t _write(const char* buffer, size_t count) throw(IOError) { return _file.write(buffer, count); } @@ -79,11 +99,11 @@ IORequest_file_Unlink(const URL& url) : IORequest_Unlink(url) { } - ~IORequest_file_Unlink() { } + ~IORequest_file_Unlink() throw() { } - void open() { } + void connect() throw(IOError) { } - void close() { } + void disconnect() throw(IOError) { } void doit() { File::unlink(url().path()); } @@ -94,11 +114,11 @@ IORequest_file_MakeDir(const URL& url) : IORequest_MakeDir(url) { } - ~IORequest_file_MakeDir() { } + ~IORequest_file_MakeDir() throw() { } - void open() { } + void connect() throw(IOError) { } - void close() { } + void disconnect() throw(IOError) { } void doit() { Directory::create(url().path()); } @@ -109,11 +129,11 @@ IORequest_file_RemoveDir(const URL& url) : IORequest_RemoveDir(url) { } - ~IORequest_file_RemoveDir() { } + ~IORequest_file_RemoveDir() throw() { } - void open() { } + void connect() throw(IOError) { } - void close() { } + void disconnect() throw(IOError) { } void doit() { Directory::remove(url().path()); } |
From: Christian P. <cp...@us...> - 2005-05-25 09:35:08
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/IO In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24740/include/pclasses/IO Modified Files: IORequest.h Log Message: - Renamed IORequest::open() to IORequest::connect() and IORequest::close() to IORequest::disconnect() to support deriving from IODevice - Derived IORequest_Get and IORequest_Put from IODevice Index: IORequest.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/IO/IORequest.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- IORequest.h 25 May 2005 08:02:56 -0000 1.1 +++ IORequest.h 25 May 2005 09:34:59 -0000 1.2 @@ -23,6 +23,7 @@ #include <pclasses/Export.h> #include <pclasses/NonCopyable.h> +#include <pclasses/IO/IODevice.h> #include <pclasses/IO/URL.h> namespace P { @@ -32,37 +33,43 @@ class PIO_EXPORT IORequest: public NonCopyable { public: IORequest(const URL& url); - virtual ~IORequest(); + virtual ~IORequest() throw(); const URL& url() const throw(); - virtual void open() = 0; - virtual void close() = 0; + virtual void connect() throw(IOError) = 0; + virtual void disconnect() throw(IOError) = 0; private: URL _url; }; -class PIO_EXPORT IORequest_Get: public IORequest { +class PIO_EXPORT IORequest_Get: public IORequest, public IODevice { public: IORequest_Get(const URL& url); - ~IORequest_Get(); + ~IORequest_Get() throw(); - virtual size_t read(char* buffer, size_t count) = 0; + private: + size_t _read(char* buffer, size_t count) throw(IOError) = 0; + size_t _write(const char* buffer, size_t count) throw(IOError); + void _close() throw(IOError); }; -class PIO_EXPORT IORequest_Put: public IORequest { +class PIO_EXPORT IORequest_Put: public IORequest, public IODevice { public: IORequest_Put(const URL& url); - ~IORequest_Put(); + ~IORequest_Put() throw(); - virtual size_t write(const char* buffer, size_t count) = 0; + private: + size_t _read(char* buffer, size_t count) throw(IOError); + size_t _write(const char* buffer, size_t count) throw(IOError) = 0; + void _close() throw(IOError); }; class PIO_EXPORT IORequest_Unlink: public IORequest { public: IORequest_Unlink(const URL& url); - ~IORequest_Unlink(); + ~IORequest_Unlink() throw(); virtual void doit() = 0; }; @@ -70,7 +77,7 @@ class PIO_EXPORT IORequest_MakeDir: public IORequest { public: IORequest_MakeDir(const URL& url); - ~IORequest_MakeDir(); + ~IORequest_MakeDir() throw(); virtual void doit() = 0; }; @@ -78,7 +85,7 @@ class PIO_EXPORT IORequest_RemoveDir: public IORequest { public: IORequest_RemoveDir(const URL& url); - ~IORequest_RemoveDir(); + ~IORequest_RemoveDir() throw(); virtual void doit() = 0; }; @@ -86,7 +93,7 @@ class PIO_EXPORT IORequest_ListDir: public IORequest { public: IORequest_ListDir(const URL& url); - ~IORequest_ListDir(); + ~IORequest_ListDir() throw(); virtual size_t read(char* buffer, size_t count) = 0; }; |
From: Christian P. <cp...@us...> - 2005-05-25 09:35:08
|
Update of /cvsroot/pclasses/pclasses2/src/IO In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24740/src/IO Modified Files: IORequest.cpp Log Message: - Renamed IORequest::open() to IORequest::connect() and IORequest::close() to IORequest::disconnect() to support deriving from IODevice - Derived IORequest_Get and IORequest_Put from IODevice Index: IORequest.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/IO/IORequest.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- IORequest.cpp 25 May 2005 08:02:55 -0000 1.1 +++ IORequest.cpp 25 May 2005 09:34:59 -0000 1.2 @@ -29,7 +29,7 @@ { } -IORequest::~IORequest() +IORequest::~IORequest() throw() { } @@ -44,18 +44,38 @@ { } -IORequest_Get::~IORequest_Get() +IORequest_Get::~IORequest_Get() throw() { } +void IORequest_Get::_close() throw(IOError) +{ + disconnect(); +} + +size_t IORequest_Get::_write(const char* buffer, size_t count) throw(IOError) +{ + return 0; +} + IORequest_Put::IORequest_Put(const URL& url) : IORequest(url) { } -IORequest_Put::~IORequest_Put() +IORequest_Put::~IORequest_Put() throw() +{ +} + +void IORequest_Put::_close() throw(IOError) { + disconnect(); +} + +size_t IORequest_Put::_read(char* buffer, size_t count) throw(IOError) +{ + return 0; } @@ -64,7 +84,7 @@ { } -IORequest_Unlink::~IORequest_Unlink() +IORequest_Unlink::~IORequest_Unlink() throw() { } @@ -74,7 +94,7 @@ { } -IORequest_MakeDir::~IORequest_MakeDir() +IORequest_MakeDir::~IORequest_MakeDir() throw() { } @@ -84,7 +104,7 @@ { } -IORequest_RemoveDir::~IORequest_RemoveDir() +IORequest_RemoveDir::~IORequest_RemoveDir() throw() { } @@ -94,7 +114,7 @@ { } -IORequest_ListDir::~IORequest_ListDir() +IORequest_ListDir::~IORequest_ListDir() throw() { } |
From: Christian P. <cp...@us...> - 2005-05-25 08:06:20
|
Update of /cvsroot/pclasses/pclasses2/plugins/IOHandler In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5478/plugins/IOHandler Added Files: Makefile.am Log Message: - Added IOHandler plugin for file protocol --- NEW FILE: Makefile.am --- SUBDIRS = file |
From: Christian P. <cp...@us...> - 2005-05-25 08:06:20
|
Update of /cvsroot/pclasses/pclasses2/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5478/plugins Modified Files: Makefile.am Log Message: - Added IOHandler plugin for file protocol Index: Makefile.am =================================================================== RCS file: /cvsroot/pclasses/pclasses2/plugins/Makefile.am,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Makefile.am 10 Jan 2005 13:05:00 -0000 1.1 +++ Makefile.am 25 May 2005 08:06:09 -0000 1.2 @@ -1,2 +1,2 @@ -SUBDIRS = LogTarget +SUBDIRS = IOHandler LogTarget |
From: Christian P. <cp...@us...> - 2005-05-25 08:06:20
|
Update of /cvsroot/pclasses/pclasses2/plugins/IOHandler/file In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5478/plugins/IOHandler/file Added Files: Makefile.am IOHandler_file.cpp Log Message: - Added IOHandler plugin for file protocol --- NEW FILE: Makefile.am --- INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include $(all_includes) METASOURCES = AUTO pkglib_LTLIBRARIES = IOHandler_file.la IOHandler_file_la_SOURCES = IOHandler_file.cpp IOHandler_file_la_LDFLAGS = -module -avoid-version IOHandler_file_la_LIBADD = $(top_builddir)/src/libpclasses.la \ $(top_builddir)/src/IO/libpclasses_io.la \ $(top_builddir)/src/System/libpclasses_system.la --- NEW FILE: IOHandler_file.cpp --- /*************************************************************************** * Copyright (C) 2005 by Christian Prochnow, SecuLogiX GmbH * * cp...@se... * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU Library General Public License as * * published by the Free Software Foundation; either version 2 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 Library General Public * * License along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "pclasses/IO/IOHandler.h" #include "pclasses/IO/IORequest.h" #include "pclasses/System/Plugin.h" #include "pclasses/System/File.h" #include "pclasses/System/Directory.h" using namespace P; using namespace P::IO; using namespace P::System; class IORequest_file_Get: public IORequest_Get { public: IORequest_file_Get(const URL& url) : IORequest_Get(url) { } ~IORequest_file_Get() { } void open() { _file.open(url().path(), IODevice::Read, IODevice::OpenFail, IODevice::AllowWrite); } void close() { _file.close(); } size_t read(char* buffer, size_t count) { return _file.read(buffer, count); } private: File _file; }; class IORequest_file_Put: public IORequest_Put { public: IORequest_file_Put(const URL& url) : IORequest_Put(url) { } ~IORequest_file_Put() { } void open() { _file.open(url().path(), IODevice::Write, IODevice::OpenCreate, IODevice::AllowRead); } void close() { _file.close(); } size_t write(const char* buffer, size_t count) { return _file.write(buffer, count); } private: File _file; }; class IORequest_file_Unlink: public IORequest_Unlink { public: IORequest_file_Unlink(const URL& url) : IORequest_Unlink(url) { } ~IORequest_file_Unlink() { } void open() { } void close() { } void doit() { File::unlink(url().path()); } }; class IORequest_file_MakeDir: public IORequest_MakeDir { public: IORequest_file_MakeDir(const URL& url) : IORequest_MakeDir(url) { } ~IORequest_file_MakeDir() { } void open() { } void close() { } void doit() { Directory::create(url().path()); } }; class IORequest_file_RemoveDir: public IORequest_RemoveDir { public: IORequest_file_RemoveDir(const URL& url) : IORequest_RemoveDir(url) { } ~IORequest_file_RemoveDir() { } void open() { } void close() { } void doit() { Directory::remove(url().path()); } }; class IOHandler_file: public IOHandler { public: IOHandler_file() { } ~IOHandler_file() { } IORequest_Get* get(const URL& url) { return new IORequest_file_Get(url); } IORequest_Put* put(const URL& url) { return new IORequest_file_Put(url); } IORequest_Unlink* unlink(const URL& url) { return new IORequest_file_Unlink(url); } IORequest_MakeDir* mkdir(const URL& url) { return new IORequest_file_MakeDir(url); } IORequest_RemoveDir* rmdir(const URL& url) { return new IORequest_file_RemoveDir(url); } IORequest_ListDir* lsdir(const URL& url) { return 0; } void finish(IORequest* req) { delete req; } }; P_PLUGIN_REGISTER_TYPE(IOHandler, IOHandler_file); P_PLUGIN_REGISTER_ALIAS(IOHandler, file, IOHandler_file); |
From: Christian P. <cp...@us...> - 2005-05-25 08:06:20
|
Update of /cvsroot/pclasses/pclasses2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5478 Modified Files: configure.in Log Message: - Added IOHandler plugin for file protocol Index: configure.in =================================================================== RCS file: /cvsroot/pclasses/pclasses2/configure.in,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- configure.in 7 May 2005 11:52:11 -0000 1.12 +++ configure.in 25 May 2005 08:06:08 -0000 1.13 @@ -279,6 +279,8 @@ plugins/LogTarget/Makefile \ plugins/LogTarget/Console/Makefile \ plugins/LogTarget/File/Makefile \ + plugins/IOHandler/Makefile \ + plugins/IOHandler/file/Makefile \ test/Makefile) AC_PREFIX_CONFIG_H("PCLASSES", include/pclasses/config.h, |
From: Christian P. <cp...@us...> - 2005-05-25 08:04:42
|
Update of /cvsroot/pclasses/pclasses2/plugins/IOHandler/file In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5209/plugins/IOHandler/file Log Message: Directory /cvsroot/pclasses/pclasses2/plugins/IOHandler/file added to the repository |
From: Christian P. <cp...@us...> - 2005-05-25 08:04:21
|
Update of /cvsroot/pclasses/pclasses2/plugins/IOHandler In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5133/plugins/IOHandler Log Message: Directory /cvsroot/pclasses/pclasses2/plugins/IOHandler added to the repository |
From: Christian P. <cp...@us...> - 2005-05-25 08:03:05
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/IO In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4874/include/pclasses/IO Modified Files: IOManager.h Makefile.am Added Files: IOHandler.h IORequest.h Log Message: - Reintroducing Transparent Network I/O architecture --- NEW FILE: IOHandler.h --- /*************************************************************************** * Copyright (C) 2005 by Christian Prochnow, SecuLogiX GmbH * * cp...@se... * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU Library General Public License as * * published by the Free Software Foundation; either version 2 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 Library General Public * * License along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef P_IO_IOHandler_h #define P_IO_IOHandler_h #include <pclasses/Export.h> #include <pclasses/IO/URL.h> #include <pclasses/IO/IORequest.h> namespace P { namespace IO { //! IORequest handler class PIO_EXPORT IOHandler { public: IOHandler(); virtual ~IOHandler(); virtual IORequest_Get* get(const URL& url); virtual IORequest_Put* put(const URL& url); virtual IORequest_Unlink* unlink(const URL& url); virtual IORequest_MakeDir* mkdir(const URL& url); virtual IORequest_RemoveDir* rmdir(const URL& url); virtual IORequest_ListDir* lsdir(const URL& url); virtual void finish(IORequest* req) = 0; }; } // !namespace IO } // !namespace P #endif // !P_IO_IOHandler_h --- NEW FILE: IORequest.h --- /*************************************************************************** * Copyright (C) 2005 by Christian Prochnow, SecuLogiX GmbH * * cp...@se... * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU Library General Public License as * * published by the Free Software Foundation; either version 2 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 Library General Public * * License along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef P_IO_IORequest_h #define P_IO_IORequest_h #include <pclasses/Export.h> #include <pclasses/NonCopyable.h> #include <pclasses/IO/URL.h> namespace P { namespace IO { class PIO_EXPORT IORequest: public NonCopyable { public: IORequest(const URL& url); virtual ~IORequest(); const URL& url() const throw(); virtual void open() = 0; virtual void close() = 0; private: URL _url; }; class PIO_EXPORT IORequest_Get: public IORequest { public: IORequest_Get(const URL& url); ~IORequest_Get(); virtual size_t read(char* buffer, size_t count) = 0; }; class PIO_EXPORT IORequest_Put: public IORequest { public: IORequest_Put(const URL& url); ~IORequest_Put(); virtual size_t write(const char* buffer, size_t count) = 0; }; class PIO_EXPORT IORequest_Unlink: public IORequest { public: IORequest_Unlink(const URL& url); ~IORequest_Unlink(); virtual void doit() = 0; }; class PIO_EXPORT IORequest_MakeDir: public IORequest { public: IORequest_MakeDir(const URL& url); ~IORequest_MakeDir(); virtual void doit() = 0; }; class PIO_EXPORT IORequest_RemoveDir: public IORequest { public: IORequest_RemoveDir(const URL& url); ~IORequest_RemoveDir(); virtual void doit() = 0; }; class PIO_EXPORT IORequest_ListDir: public IORequest { public: IORequest_ListDir(const URL& url); ~IORequest_ListDir(); virtual size_t read(char* buffer, size_t count) = 0; }; } // !namespace IO } // !namespace P #endif // !P_IO_IORequest_h Index: Makefile.am =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/IO/Makefile.am,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- Makefile.am 16 Jan 2005 00:08:01 -0000 1.7 +++ Makefile.am 25 May 2005 08:02:56 -0000 1.8 @@ -2,4 +2,6 @@ INCLUDES = METASOURCES = AUTO -pclasses_io_include_HEADERS = IOError.h IODevice.h IOStream.h IOFilter.h URL.h ZLib.h ZLibIOFilter.h BZip2.h BZip2IOFilter.h +pclasses_io_include_HEADERS = IOError.h IODevice.h IOStream.h IOFilter.h \ + URL.h ZLib.h ZLibIOFilter.h BZip2.h BZip2IOFilter.h IORequest.h \ + IOHandler.h IOManager.h Index: IOManager.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/IO/IOManager.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- IOManager.h 6 Jan 2005 17:02:03 -0000 1.5 +++ IOManager.h 25 May 2005 08:02:56 -0000 1.6 @@ -1,73 +1,72 @@ -#ifndef P_IOMANAGER_HPP_INCLUDED -#define P_IOMANAGER_HPP_INCLUDED 1 +/*************************************************************************** + * Copyright (C) 2005 by Christian Prochnow, SecuLogiX GmbH * + * cp...@se... * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Library General Public License as * + * published by the Free Software Foundation; either version 2 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 Library General Public * + * License along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef P_IO_IOManager_h +#define P_IO_IOManager_h + +#include <pclasses/Export.h> +#include <pclasses/IO/URL.h> +#include <pclasses/IO/IORequest.h> + +#include <map> +#include <string> -#include "pclasses/Factory.h" -#include "pclasses/Plugin/Plugin.h" -#include "pclasses/IO/URL.h" namespace P { + namespace IO { - /** - IOManager is a PluginManager intended specifically for use with - the P::IO layer. - */ - template <typename InterfaceT> - class IOManager : public ::P::Factory<InterfaceT> - { +class IOHandler; + +class PIO_EXPORT IOManager { public: - typdef IOManager<InterfaceT> ThisType; - typedef ::P::PluginManager<InterfaceT> ParentType; - typedef typename ParentType::FactoryFuncType FactoryFuncType; - typedef typename ParentType::ResultType ResultType; - IOManager(){} - virtual ~IOManager(){} + IOManager(); + ~IOManager(); + IORequest_Get* get(const URL& url); + IORequest_Put* put(const URL& url); - /** - Returns a shared instance of this object. + IORequest_Unlink* unlink(const URL& url); - Clients may transparently replace or modify the - default returned object by specializing - P::Hook::FactoryInstanceHook<ThisType>. + IORequest_MakeDir* mkdir(const URL& url); + IORequest_RemoveDir* rmdir(const URL& url); - InterfaceT's which want to be loadable via DLL's - should install a FactoryInstanceHook to plug in the - DLL awareness. - */ - static ThisType & instance() - { - return ::P::Hook::FactoryInstanceHook<ThisType>::instance(); - } + IORequest_ListDir* lsdir(const URL& url); - /** - Returns this->registerFactory(_protocol.protocol()). - */ - void - registerFactory(const URL &_protocol, FactoryFuncType fp) - { - this->registerFactory( _protocol.protocol(), fp ) - } + void finish(IORequest* req); - /** - Returns this->create(_protocol.protocol()). - */ - ResultType create( const URL & _protocol ) - { - return this->create( _protocol.protocol() ); - } + static IOManager& instance(); + private: + IOHandler* findHandler(const std::string& proto); - /** - Returns this->provides(_protocol.protocol()). - */ - bool - provides(const URL &_protocol) const - { - return this->provides( _protocol.protocol() ); - } - }; // class IOManager + typedef std::map<std::string, IOHandler*> handler_map; + typedef std::map<IORequest*, IOHandler*> request_map; -} } // namespace P::IO + handler_map _handlers; + request_map _requests; +}; -#endif // P_IOMANAGER_HPP_INCLUDED +} // !namespace IO + +} // !namespace P + + +#endif // !P_IO_IOManager_h |
From: Christian P. <cp...@us...> - 2005-05-25 08:03:05
|
Update of /cvsroot/pclasses/pclasses2/src/IO In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4874/src/IO Modified Files: Makefile.am Added Files: IOHandler.cpp IOManager.cpp IORequest.cpp Log Message: - Reintroducing Transparent Network I/O architecture --- NEW FILE: IOManager.cpp --- /*************************************************************************** * Copyright (C) 2005 by Christian Prochnow, SecuLogiX GmbH * * cp...@se... * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU Library General Public License as * * published by the Free Software Foundation; either version 2 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 Library General Public * * License along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "pclasses/Phoenix.h" #include "pclasses/Factory.h" #include "pclasses/IO/IOManager.h" #include "pclasses/IO/IOHandler.h" namespace P { namespace IO { IOManager::IOManager() { } IOManager::~IOManager() { // cleanup requests ... request_map::iterator ri = _requests.begin(); while(ri != _requests.end()) { ri->second->finish(ri->first); request_map::iterator di = ri++; _requests.erase(di); } // cleanup handlers ... handler_map::iterator hi = _handlers.begin(); while(hi != _handlers.end()) { delete hi->second; handler_map::iterator di = hi++; _handlers.erase(di); } } IORequest_Get* IOManager::get(const URL& url) { IOHandler* handler = findHandler(url.protocol()); IORequest_Get* request = 0; if(handler) { request = handler->get(url); if(request) _requests.insert(std::make_pair(request, handler)); } return request; } IORequest_Put* IOManager::put(const URL& url) { IOHandler* handler = findHandler(url.protocol()); IORequest_Put* request = 0; if(handler) { request = handler->put(url); if(request) _requests.insert(std::make_pair(request, handler)); } return request; } IORequest_Unlink* IOManager::unlink(const URL& url) { IOHandler* handler = findHandler(url.protocol()); IORequest_Unlink* request = 0; if(handler) { request = handler->unlink(url); if(request) _requests.insert(std::make_pair(request, handler)); } return request; } IORequest_MakeDir* IOManager::mkdir(const URL& url) { IOHandler* handler = findHandler(url.protocol()); IORequest_MakeDir* request = 0; if(handler) { request = handler->mkdir(url); if(request) _requests.insert(std::make_pair(request, handler)); } return request; } IORequest_RemoveDir* IOManager::rmdir(const URL& url) { IOHandler* handler = findHandler(url.protocol()); IORequest_RemoveDir* request = 0; if(handler) { request = handler->rmdir(url); if(request) _requests.insert(std::make_pair(request, handler)); } return request; } IORequest_ListDir* IOManager::lsdir(const URL& url) { IOHandler* handler = findHandler(url.protocol()); IORequest_ListDir* request = 0; if(handler) { request = handler->lsdir(url); if(request) _requests.insert(std::make_pair(request, handler)); } return request; } void IOManager::finish(IORequest* req) { request_map::iterator i = _requests.find(req); if(i != _requests.end()) { i->second->finish(req); _requests.erase(i); } } IOHandler* IOManager::findHandler(const std::string& proto) { handler_map::const_iterator i = _handlers.find(proto); if(i != _handlers.end()) return i->second; IOHandler* handler = Factory<IOHandler>::instance().create("IOHandler_" + proto); if(handler) _handlers.insert(std::make_pair(proto, handler)); return handler; } struct IOManager_context_t { }; IOManager& IOManager::instance() { typedef Phoenix<IOManager, IOManager_context_t> PHX; return PHX::instance(); } } // !namespace IO } // !namespace P Index: Makefile.am =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/IO/Makefile.am,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- Makefile.am 20 May 2005 14:19:15 -0000 1.10 +++ Makefile.am 25 May 2005 08:02:55 -0000 1.11 @@ -5,7 +5,8 @@ CPPFLAGS = -DPIO_BUILD libpclasses_io_la_SOURCES = IOError.cpp IODevice.cpp IOStream.cpp \ - IOFilter.cpp URL.cpp ZLib.cpp ZLibIOFilter.cpp BZip2.cpp BZip2IOFilter.cpp + IOFilter.cpp URL.cpp ZLib.cpp ZLibIOFilter.cpp BZip2.cpp BZip2IOFilter.cpp \ + IORequest.cpp IOHandler.cpp IOManager.cpp libpclasses_io_la_LDFLAGS = -no-nundefined --- NEW FILE: IOHandler.cpp --- /*************************************************************************** * Copyright (C) 2005 by Christian Prochnow, SecuLogiX GmbH * * cp...@se... * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU Library General Public License as * * published by the Free Software Foundation; either version 2 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 Library General Public * * License along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "pclasses/IO/IOHandler.h" namespace P { namespace IO { IOHandler::IOHandler() { } IOHandler::~IOHandler() { } IORequest_Get* IOHandler::get(const URL& url) { return 0; } IORequest_Put* IOHandler::put(const URL& url) { return 0; } IORequest_Unlink* IOHandler::unlink(const URL& url) { return 0; } IORequest_MakeDir* IOHandler::mkdir(const URL& url) { return 0; } IORequest_RemoveDir* IOHandler::rmdir(const URL& url) { return 0; } IORequest_ListDir* IOHandler::lsdir(const URL& url) { return 0; } } // !namespace IO } // !namespace P --- NEW FILE: IORequest.cpp --- /*************************************************************************** * Copyright (C) 2005 by Christian Prochnow, SecuLogiX GmbH * * cp...@se... * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU Library General Public License as * * published by the Free Software Foundation; either version 2 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 Library General Public * * License along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "pclasses/IO/IORequest.h" namespace P { namespace IO { IORequest::IORequest(const URL& url) : _url(url) { } IORequest::~IORequest() { } const URL& IORequest::url() const throw() { return _url; } IORequest_Get::IORequest_Get(const URL& url) : IORequest(url) { } IORequest_Get::~IORequest_Get() { } IORequest_Put::IORequest_Put(const URL& url) : IORequest(url) { } IORequest_Put::~IORequest_Put() { } IORequest_Unlink::IORequest_Unlink(const URL& url) : IORequest(url) { } IORequest_Unlink::~IORequest_Unlink() { } IORequest_MakeDir::IORequest_MakeDir(const URL& url) : IORequest(url) { } IORequest_MakeDir::~IORequest_MakeDir() { } IORequest_RemoveDir::IORequest_RemoveDir(const URL& url) : IORequest(url) { } IORequest_RemoveDir::~IORequest_RemoveDir() { } IORequest_ListDir::IORequest_ListDir(const URL& url) : IORequest(url) { } IORequest_ListDir::~IORequest_ListDir() { } } // !namespace IO } // !namespace P |
From: Christian P. <cp...@us...> - 2005-05-24 04:41:31
|
Update of /cvsroot/pclasses/pclasses2/src/Unicode In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14310/src/Unicode Modified Files: String.cpp Log Message: - Do not throw errors reported when pre-flighting strings Index: String.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/Unicode/String.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- String.cpp 24 May 2005 03:08:21 -0000 1.9 +++ String.cpp 24 May 2005 04:41:21 -0000 1.10 @@ -208,9 +208,6 @@ int32_t strSize = u_strToLower(0, 0, _data->str, _data->length, locale, &errorCode); - if(U_FAILURE(errorCode)) - throw UnicodeError(errorCode, "Could not convert string to lowercase", P_SOURCEINFO); - SharedPtr<Data> newData(alloc(strSize + 1)); errorCode = U_ZERO_ERROR; @@ -231,9 +228,6 @@ int32_t strSize = u_strToUpper(0, 0, _data->str, _data->length, locale, &errorCode); - if(U_FAILURE(errorCode)) - throw UnicodeError(errorCode, "Could not convert string to uppercase", P_SOURCEINFO); - SharedPtr<Data> newData(alloc(strSize + 1)); errorCode = U_ZERO_ERROR; @@ -254,9 +248,6 @@ int32_t strSize = u_strFoldCase(0, 0, _data->str, _data->length, 0, &errorCode); - if(U_FAILURE(errorCode)) - throw UnicodeError(errorCode, "Could not convert string to foldcase", P_SOURCEINFO); - SharedPtr<Data> newData(alloc(strSize + 1)); errorCode = U_ZERO_ERROR; @@ -282,12 +273,14 @@ if(str._data.null() || str._data->length == 0) return *this; - if(_data->size <= _data->length + str._data->length) - resize(_data->length + str._data->length); + if(_data->size <= _data->length + str._data->length + 1) + resize(_data->length + str._data->length + 1); else deepCopy(); - u_strncat(_data->str, str._data->str, str._data->length); + u_strncpy(_data->str + _data->length, str._data->str, str._data->length); + _data->length += str._data->length; + return *this; } @@ -764,9 +757,6 @@ // pre-flight .. get the required storage ... u_strToUTF8(0, 0, &resultLen, _data->str, _data->length, &errorCode); - if(U_FAILURE(errorCode)) - throw UnicodeError(errorCode, "Could not convert string to UTF8", P_SOURCEINFO); - ScopedArrayPtr<char> ret(new char[resultLen + 1]); ::int32_t retLen = 0; @@ -791,9 +781,6 @@ u_strFromUTF8(0, 0, &destLen, str, count, &errorCode); - if(U_FAILURE(errorCode)) - throw UnicodeError(errorCode, "Could not convert UTF8 string to unicode", P_SOURCEINFO); - SharedPtr<Data> data(alloc(destLen + 1)); errorCode = U_ZERO_ERROR; |