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: stephan b. <sg...@us...> - 2004-12-23 05:50:03
|
Update of /cvsroot/pclasses/pclasses2/src/Unicode In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30613 Modified Files: TextStream.cpp Log Message: added several returns to NYI operators to please gcc Index: TextStream.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/Unicode/TextStream.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- TextStream.cpp 23 Dec 2004 04:32:18 -0000 1.1 +++ TextStream.cpp 23 Dec 2004 05:49:52 -0000 1.2 @@ -67,49 +67,60 @@ TextStream& TextStream::operator<<(Int8 val) { + return *this; } TextStream& TextStream::operator<<(UInt8 val) { + return *this; } TextStream& TextStream::operator<<(Int16 val) { + return *this; } TextStream& TextStream::operator<<(UInt16 val) { + return *this; } TextStream& TextStream::operator<<(Int32 val) { + return *this; } TextStream& TextStream::operator<<(UInt32 val) { + return *this; } #ifdef PCLASSES_HAVE_64BIT_INT TextStream& TextStream::operator<<(Int64 val) { + return *this; } TextStream& TextStream::operator<<(UInt64 val) { + return *this; } #endif TextStream& TextStream::operator<<(float val) { + return *this; } TextStream& TextStream::operator<<(double val) { + return *this; } #ifdef PCLASSES_HAVE_LONG_DOUBLE TextStream& TextStream::operator<<(long double val) { + return *this; } #endif |
From: stephan b. <sg...@us...> - 2004-12-23 05:46:08
|
Update of /cvsroot/pclasses/pclasses2/src/Unicode In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29950 Modified Files: Char.cpp Log Message: added a couple returns to NYI operators to please gcc Index: Char.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/Unicode/Char.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Char.cpp 23 Dec 2004 04:32:18 -0000 1.1 +++ Char.cpp 23 Dec 2004 05:45:58 -0000 1.2 @@ -296,11 +296,13 @@ bool Char::operator<(const Char& ch) const { //@todo Char::operator< + return false; } bool Char::operator>(const Char& ch) const { //@todo Char::operator> + return false; } bool Char::operator<=(const Char& ch) const |
From: Christian P. <cp...@us...> - 2004-12-23 05:27:58
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24631/src/System Modified Files: SharedLib.dl.cpp SharedLib.dyld.cpp SharedLib.shl.cpp SharedLib.win32.cpp Log Message: Added std::string support. Append platform specific file extenstion to shared lib name. Converted SharedLib::_handle to unsigned long. Index: SharedLib.dyld.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/SharedLib.dyld.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- SharedLib.dyld.cpp 22 Dec 2004 17:54:37 -0000 1.1.1.1 +++ SharedLib.dyld.cpp 23 Dec 2004 05:27:49 -0000 1.2 @@ -1,55 +1,89 @@ -/* - * P::Classes - Portable C++ Application Framework - * Copyright (C) 2000-2003 Christian Prochnow <cp...@se...> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ +/*************************************************************************** + * 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/System/Sharedlib.h" + #include <mach-o/dyld.h> +#ifdef PCLASSES_WITH_STL +# include <string> +# include <sstream> +#endif + namespace P { namespace System { -struct SharedLib::Handle {}; - -SharedLib::SharedLib(const char* name, BindMode mode) throw(SystemError) +int BindMode2Flags(SharedLib::BindMode mode) { int flags = 0; switch(mode) { - case BindLazy: + case SharedLib::BindLazy: break; - case BindNow: + + case SharedLib::BindNow: flags = NSLINKMODULE_OPTION_BINDNOW; break; } - flags |= NSLINKMODULE_OPTION_RETURN_ON_ERROR; + return flags; +} + +SharedLib::SharedLib(const Unicode::String& name, BindMode mode) throw(SystemError) +{ + Unicode::String realName = name; + realName.append(".dyld"); + + int flags = BindMode2Flags(mode) | NSLINKMODULE_OPTION_RETURN_ON_ERROR; NSObjectFileImage file; NSObjectFileImageReturnCode ret; - ret = NSCreateObjectFileImageFromFile(name, &file); + ret = NSCreateObjectFileImageFromFile(realName.utf8(), &file); if(ret != NSObjectFileImageSuccess) throw SystemError(0, "Could not load shared library", P_SOURCEINFO); - NSModule out = NSLinkModule(file, name, flags); - _handle = (Handle*)out; + NSModule out = NSLinkModule(file, realName.utf8(), flags); + _handle = (unsigned long)out; } +#ifndef PCLASSES_WITH_STL +SharedLib::SharedLib(const std::string& name, BindMode mode) throw(SystemError) +{ + std::ostringstream realName; + realName << name; + realName << ".dyld"; + + int flags = BindMode2Flags(mode) | NSLINKMODULE_OPTION_RETURN_ON_ERROR; + + NSObjectFileImage file; + NSObjectFileImageReturnCode ret; + ret = NSCreateObjectFileImageFromFile(realName.c_str(), &file); + if(ret != NSObjectFileImageSuccess) + throw SystemError(0, "Could not load shared library", P_SOURCEINFO); + + NSModule out = NSLinkModule(file, realName.c_str(), flags); + _handle = (unsigned long)out; +} +#endif + SharedLib::~SharedLib() throw() { NSUnLinkModule((NSModule)_handle, NSUNLINKMODULE_OPTION_NONE); @@ -64,6 +98,13 @@ return (void*)addr; } +#ifdef PCLASSES_WITH_STL +void* SharedLib::operator[](const std::string& symbol) throw(RuntimeError) +{ + return operator[](symbol.c_str()); +} +#endif + } // !namespace System } // !namespace P Index: SharedLib.dl.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/SharedLib.dl.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- SharedLib.dl.cpp 23 Dec 2004 04:32:18 -0000 1.2 +++ SharedLib.dl.cpp 23 Dec 2004 05:27:49 -0000 1.3 @@ -22,36 +22,56 @@ #include <dlfcn.h> #include <errno.h> -#include <string.h> + +#ifdef PCLASSES_WITH_STL +# include <string> +# include <sstream> +#endif namespace P { namespace System { -struct SharedLib::Handle {}; - -SharedLib::SharedLib(const Unicode::String& name, BindMode mode) throw(SystemError) +int BindMode2Flags(SharedLib::BindMode mode) { int flags = 0; switch(mode) { - case BindLazy: - flags = RTLD_LAZY; - break; - case BindNow: - flags = RTLD_NOW; - break; + case SharedLib::BindLazy: + flags = RTLD_LAZY; + break; + + case SharedLib::BindNow: + flags = RTLD_NOW; + break; } - //flags |= RTLD_GLOBAL; this causes a SIGSEGV when loading multiple plugins with same exported vars - Unicode::String so_name = name; - so_name.append(".so"); + return flags; +} - //_handle = (Handle*)dlopen(name.utf8(), flags); +SharedLib::SharedLib(const Unicode::String& name, BindMode mode) throw(SystemError) +{ + Unicode::String realName = name; + realName.append(".so"); + + //@fixme _handle = (unsigned long)dlopen(realName.utf8(), BindMode2Flags(mode)); if(!_handle) throw SystemError(errno, dlerror(), P_SOURCEINFO); } +#ifndef PCLASSES_WITH_STL +SharedLib::SharedLib(const std::string& name, BindMode mode) throw(SystemError) +{ + std::ostringstream realName; + realName << name; + realName << ".so"; + + _handle = (unsigned long)dlopen(realName.str().c_str(), BindMode2Flags(mode)); + if(!_handle) + throw SystemError(errno, dlerror(), P_SOURCEINFO); +} +#endif + SharedLib::~SharedLib() throw() { dlclose((void*)_handle); @@ -66,6 +86,13 @@ return addr; } +#ifdef PCLASSES_WITH_STL +void* SharedLib::operator[](const std::string& symbol) throw(RuntimeError) +{ + return operator[](symbol.c_str()); +} +#endif + } // !namespace System } // !namespace P Index: SharedLib.win32.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/SharedLib.win32.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- SharedLib.win32.cpp 22 Dec 2004 17:54:36 -0000 1.1.1.1 +++ SharedLib.win32.cpp 23 Dec 2004 05:27:49 -0000 1.2 @@ -21,22 +21,42 @@ #include "pclasses/System/SharedLib.h" #include <windows.h> +#ifdef PCLASSES_WITH_STL +# include <string> +# include <sstream> +#endif + namespace P { namespace System { -struct SharedLib::Handle {}; +SharedLib::SharedLib(const Unicode::String& name, BindMode mode) throw(SystemError) +{ + Unicode::String realName = name; + realName.append(".dll"); -SharedLib::SharedLib(const char* name, BindMode mode) throw(SystemError) + //@fixme _handle = (unsigned long)LoadLibrary(name); + if(!_handle) + throw SystemError(GetLastError(), "Could not load shared library", P_SOURCEINFO); +} + +#ifndef PCLASSES_WITH_STL +SharedLib::SharedLib(const std::string& name, BindMode mode) throw(SystemError) { - _handle = (Handle*)LoadLibrary(name); - if(_handle == 0) - throw SystemError(GetLastError(), "Could not load shared library", P_SOURCEINFO); + std::ostringstream realName; + realName << name; + realName << ".dll"; + + _handle = (unsigned long)LoadLibrary(realName.c_str()); + + if(!_handle) + throw SystemError(GetLastError(), "Could not load shared library", P_SOURCEINFO); } +#endif SharedLib::~SharedLib() throw() { - FreeLibrary((HMODULE)_handle); + FreeLibrary((HMODULE)_handle); } void* SharedLib::operator[](const char* symbol) throw(RuntimeError) @@ -48,6 +68,13 @@ return addr; } +#ifdef PCLASSES_WITH_STL +void* SharedLib::operator[](const std::string& symbol) throw(RuntimeError) +{ + return operator[](symbol.c_str()); +} +#endif + } // !namespace System } // !namespace P Index: SharedLib.shl.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/SharedLib.shl.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- SharedLib.shl.cpp 22 Dec 2004 17:54:35 -0000 1.1.1.1 +++ SharedLib.shl.cpp 23 Dec 2004 05:27:49 -0000 1.2 @@ -19,32 +19,63 @@ ***************************************************************************/ #include "pclasses/System/SharedLib.h" + #include <dl.h> #include <errno.h> +#ifdef PCLASSES_WITH_STL +# include <string> +# include <sstream> +#endif + namespace P { namespace System { -struct SharedLib::Handle {}; - -SharedLib::SharedLib(const char* name, BindMode mode) throw(SystemError) +int BindMode2Flags(SharedLib::BindMode mode) { int flags = 0; switch(mode) { - case BindLazy: + case SharedLib::BindLazy: flags = BIND_DEFERRED; break; - case BindNow: + + case SharedLib::BindNow: flags = BIND_IMMEDIATE; break; } - - _handle = (Handle*)shl_load(name, flags); + + return flags; +} + +SharedLib::SharedLib(const Unicode::String& name, BindMode mode) throw(SystemError) +{ + Unicode::String realName = name; + realName.append(".sl"); + + _handle = (unsigned long)shl_load(realName.utf8(), BindMode2Flags(mode)); + + //@fixme dlerror() on hpux ?? + if(!_handle) + throw SystemError(errno, dlerror(), P_SOURCEINFO); +} + +#ifndef PCLASSES_WITH_STL +SharedLib::SharedLib(const std::string& name, BindMode mode) throw(SystemError) +{ + std::ostringstream realName; + realName << name; + realName << ".sl"; + + _handle = (unsigned long)shl_load(realName.str().c_str(), + BindMode2Flags(mode)); + + //@fixme dlerror() on hpux ?? if(!_handle) throw SystemError(errno, dlerror(), P_SOURCEINFO); } +#endif SharedLib::~SharedLib() throw() { @@ -60,6 +91,13 @@ return address; } +#ifdef PCLASSES_WITH_STL +void* SharedLib::operator[](const std::string& symbol) throw(RuntimeError) +{ + return operator[](symbol.c_str()); +} +#endif + } // !namespace System } // !namespace P |
From: Christian P. <cp...@us...> - 2004-12-23 05:27:57
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24631/include/pclasses/System Modified Files: SharedLib.h Log Message: Added std::string support. Append platform specific file extenstion to shared lib name. Converted SharedLib::_handle to unsigned long. Index: SharedLib.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/System/SharedLib.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- SharedLib.h 23 Dec 2004 04:32:17 -0000 1.2 +++ SharedLib.h 23 Dec 2004 05:27:48 -0000 1.3 @@ -21,10 +21,15 @@ #ifndef P_System_SharedLib_h #define P_System_SharedLib_h +#include <pclasses/pclasses-config.h> #include <pclasses/NonCopyable.h> #include <pclasses/Unicode/String.h> #include <pclasses/System/SystemError.h> +#ifdef PCLASSES_WITH_STL +# include <string> +#endif + namespace P { namespace System { @@ -61,6 +66,11 @@ SharedLib(const Unicode::String& name, BindMode mode = BindLazy) throw(SystemError); +#ifdef PCLASSES_WITH_STL + SharedLib(const std::string& name, BindMode mode = BindLazy) + throw(SystemError); +#endif + //! Destructor /*! The destructor unloads the shared library from memory. @@ -76,9 +86,12 @@ */ void* operator[](const char* symbol) throw(RuntimeError); +#ifdef PCLASSES_WITH_STL + void* operator[](const std::string& symbol) throw(RuntimeError); +#endif + private: - struct Handle; - Handle* _handle; + unsigned long _handle; }; } // !namespace System |
From: stephan b. <sg...@us...> - 2004-12-23 05:26:12
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26192 Added Files: pclasses-config.h.at Log Message: egg --- NEW FILE: pclasses-config.h.at --- #ifndef P_CONFIG_HPP_INCLUDED #define P_CONFIG_HPP_INCLUDED 1 namespace P { } // namespace P #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif #if @PCLASSES_HAVE_LARGEFILE@ == 0 # undef PCLASSES_HAVE_LARGEFILE #else # define PCLASSES_HAVE_LARGEFILE @PCLASSES_HAVE_LARGEFILE@ #endif #if @PCLASSES_HAVE_DLFCN_H@ == 0 # undef PCLASSES_HAVE_DLFCN_H #else # define PCLASSES_HAVE_DLFCN_H @PCLASSES_HAVE_DLFCN_H@ #endif #if @PCLASSES_HAVE_DLOPEN@ == 0 # undef PCLASSES_HAVE_DLOPEN #else # define PCLASSES_HAVE_DLOPEN @PCLASSES_HAVE_DLOPEN@ #endif #if @PCLASSES_HAVE_DYLD@ == 0 # undef PCLASSES_HAVE_DYLD #else # define PCLASSES_HAVE_DYLD @PCLASSES_HAVE_DYLD@ #endif #if @PCLASSES_HAVE_FUNC_GETSERVBYNAME_R_4@ == 0 # undef PCLASSES_HAVE_FUNC_GETSERVBYNAME_R_4 #else # define PCLASSES_HAVE_FUNC_GETSERVBYNAME_R_4 @PCLASSES_HAVE_FUNC_GETSERVBYNAME_R_4@ #endif #if @PCLASSES_HAVE_FUNC_GETSERVBYNAME_R_5@ == 0 # undef PCLASSES_HAVE_FUNC_GETSERVBYNAME_R_5 #else # define PCLASSES_HAVE_FUNC_GETSERVBYNAME_R_5 @PCLASSES_HAVE_FUNC_GETSERVBYNAME_R_5@ #endif #if @PCLASSES_HAVE_FUNC_GETSERVBYNAME_R_6@ == 0 # undef PCLASSES_HAVE_FUNC_GETSERVBYNAME_R_6 #else # define PCLASSES_HAVE_FUNC_GETSERVBYNAME_R_6 @PCLASSES_HAVE_FUNC_GETSERVBYNAME_R_6@ #endif #if @PCLASSES_HAVE_GETPAGESIZE@ == 0 # undef PCLASSES_HAVE_GETPAGESIZE #else # define PCLASSES_HAVE_GETPAGESIZE @PCLASSES_HAVE_GETPAGESIZE@ #endif #if @PCLASSES_HAVE_INTTYPES_H@ == 0 # undef PCLASSES_HAVE_INTTYPES_H #else # define PCLASSES_HAVE_INTTYPES_H @PCLASSES_HAVE_INTTYPES_H@ #endif #if @PCLASSES_HAVE_LIBRT@ == 0 # undef PCLASSES_HAVE_LIBRT #else # define PCLASSES_HAVE_LIBRT @PCLASSES_HAVE_LIBRT@ #endif #if @PCLASSES_HAVE_LONG_DOUBLE@ == 0 # undef PCLASSES_HAVE_LONG_DOUBLE #else # define PCLASSES_HAVE_LONG_DOUBLE @PCLASSES_HAVE_LONG_DOUBLE@ #endif #if @PCLASSES_HAVE_MEMORY_H@ == 0 # undef PCLASSES_HAVE_MEMORY_H #else # define PCLASSES_HAVE_MEMORY_H @PCLASSES_HAVE_MEMORY_H@ #endif #if @PCLASSES_HAVE_MMAP@ == 0 # undef PCLASSES_HAVE_MMAP #else # define PCLASSES_HAVE_MMAP @PCLASSES_HAVE_MMAP@ #endif #if @PCLASSES_HAVE_PTHREAD@ == 0 # undef PCLASSES_HAVE_PTHREAD #else # define PCLASSES_HAVE_PTHREAD @PCLASSES_HAVE_PTHREAD@ #endif #if @PCLASSES_HAVE_PTHREAD_CREATE_JOINABLE@ == 0 # undef PCLASSES_HAVE_PTHREAD_CREATE_JOINABLE #else # define PCLASSES_HAVE_PTHREAD_CREATE_JOINABLE @PCLASSES_HAVE_PTHREAD_CREATE_JOINABLE@ #endif #if @PCLASSES_HAVE_PTHREAD_GET_EXPIRATION_NP@ == 0 # undef PCLASSES_HAVE_PTHREAD_GET_EXPIRATION_NP #else # define PCLASSES_HAVE_PTHREAD_GET_EXPIRATION_NP @PCLASSES_HAVE_PTHREAD_GET_EXPIRATION_NP@ #endif #if @PCLASSES_HAVE_PTHREAD_MUTEXATTR_SETPSHARED@ == 0 # undef PCLASSES_HAVE_PTHREAD_MUTEXATTR_SETPSHARED #else # define PCLASSES_HAVE_PTHREAD_MUTEXATTR_SETPSHARED @PCLASSES_HAVE_PTHREAD_MUTEXATTR_SETPSHARED@ #endif #if @PCLASSES_HAVE_PTHREAD_MUTEX_TIMEDLOCK@ == 0 # undef PCLASSES_HAVE_PTHREAD_MUTEX_TIMEDLOCK #else # define PCLASSES_HAVE_PTHREAD_MUTEX_TIMEDLOCK @PCLASSES_HAVE_PTHREAD_MUTEX_TIMEDLOCK@ #endif #if @PCLASSES_HAVE_PTHREAD_MUTEX_TIMED_NP@ == 0 # undef PCLASSES_HAVE_PTHREAD_MUTEX_TIMED_NP #else # define PCLASSES_HAVE_PTHREAD_MUTEX_TIMED_NP @PCLASSES_HAVE_PTHREAD_MUTEX_TIMED_NP@ #endif #if @PCLASSES_HAVE_PTHREAD_RWLOCK_TIMEDLOCK@ == 0 # undef PCLASSES_HAVE_PTHREAD_RWLOCK_TIMEDLOCK #else # define PCLASSES_HAVE_PTHREAD_RWLOCK_TIMEDLOCK @PCLASSES_HAVE_PTHREAD_RWLOCK_TIMEDLOCK@ #endif #if @PCLASSES_HAVE_PTHREAD_YIELD@ == 0 # undef PCLASSES_HAVE_PTHREAD_YIELD #else # define PCLASSES_HAVE_PTHREAD_YIELD @PCLASSES_HAVE_PTHREAD_YIELD@ #endif #if @PCLASSES_HAVE_SHL_LOAD@ == 0 # undef PCLASSES_HAVE_SHL_LOAD #else # define PCLASSES_HAVE_SHL_LOAD @PCLASSES_HAVE_SHL_LOAD@ #endif #if @PCLASSES_HAVE_SHM_OPEN@ == 0 # undef PCLASSES_HAVE_SHM_OPEN #else # define PCLASSES_HAVE_SHM_OPEN @PCLASSES_HAVE_SHM_OPEN@ #endif #if @PCLASSES_HAVE_STDINT_H@ == 0 # undef PCLASSES_HAVE_STDINT_H #else # define PCLASSES_HAVE_STDINT_H @PCLASSES_HAVE_STDINT_H@ #endif #if @PCLASSES_HAVE_STDLIB_H@ == 0 # undef PCLASSES_HAVE_STDLIB_H #else # define PCLASSES_HAVE_STDLIB_H @PCLASSES_HAVE_STDLIB_H@ #endif #if @PCLASSES_HAVE_STRINGS_H@ == 0 # undef PCLASSES_HAVE_STRINGS_H #else # define PCLASSES_HAVE_STRINGS_H @PCLASSES_HAVE_STRINGS_H@ #endif #if @PCLASSES_HAVE_STRING_H@ == 0 # undef PCLASSES_HAVE_STRING_H #else # define PCLASSES_HAVE_STRING_H @PCLASSES_HAVE_STRING_H@ #endif #if @PCLASSES_HAVE_SYSV_IPC@ == 0 # undef PCLASSES_HAVE_SYSV_IPC #else # define PCLASSES_HAVE_SYSV_IPC @PCLASSES_HAVE_SYSV_IPC@ #endif #if @PCLASSES_HAVE_SYS_STAT_H@ == 0 # undef PCLASSES_HAVE_SYS_STAT_H #else # define PCLASSES_HAVE_SYS_STAT_H @PCLASSES_HAVE_SYS_STAT_H@ #endif #if @PCLASSES_HAVE_SYS_TYPES_H@ == 0 # undef PCLASSES_HAVE_SYS_TYPES_H #else # define PCLASSES_HAVE_SYS_TYPES_H @PCLASSES_HAVE_SYS_TYPES_H@ #endif #if @PCLASSES_HAVE_UNISTD_H@ == 0 # undef PCLASSES_HAVE_UNISTD_H #else # define PCLASSES_HAVE_UNISTD_H @PCLASSES_HAVE_UNISTD_H@ #endif #if @PCLASSES_WITH_STL@ == 0 # undef PCLASSES_WITH_STL #else # define PCLASSES_WITH_STL @PCLASSES_WITH_STL@ #endif #define PCLASSES_SIZEOF_CHAR @PCLASSES_SIZEOF_CHAR@ #define PCLASSES_SIZEOF_INT @PCLASSES_SIZEOF_INT@ #define PCLASSES_SIZEOF_LONG @PCLASSES_SIZEOF_LONG@ #define PCLASSES_SIZEOF_LONG_LONG @PCLASSES_SIZEOF_LONG_LONG@ #define PCLASSES_SIZEOF_SHORT @PCLASSES_SIZEOF_SHORT@ #define PCLASSES_SIZEOF___INT64 @PCLASSES_SIZEOF___INT64@ /********** PCLASSES_HAVE_LARGEFILE PCLASSES_HAVE_DLFCN_H PCLASSES_HAVE_DLOPEN PCLASSES_HAVE_DYLD PCLASSES_HAVE_FUNC_GETSERVBYNAME_R_4 PCLASSES_HAVE_FUNC_GETSERVBYNAME_R_5 PCLASSES_HAVE_FUNC_GETSERVBYNAME_R_6 PCLASSES_HAVE_GETPAGESIZE PCLASSES_HAVE_INTTYPES_H PCLASSES_HAVE_LIBRT PCLASSES_HAVE_LONG_DOUBLE PCLASSES_HAVE_MEMORY_H PCLASSES_HAVE_MMAP PCLASSES_HAVE_PTHREAD PCLASSES_HAVE_PTHREAD_GET_EXPIRATION_NP PCLASSES_HAVE_PTHREAD_MUTEXATTR_SETPSHARED PCLASSES_HAVE_PTHREAD_MUTEX_TIMEDLOCK PCLASSES_HAVE_PTHREAD_MUTEX_TIMED_NP PCLASSES_HAVE_PTHREAD_RWLOCK_TIMEDLOCK PCLASSES_HAVE_PTHREAD_YIELD PCLASSES_HAVE_SHL_LOAD PCLASSES_HAVE_SHM_OPEN PCLASSES_HAVE_STDINT_H PCLASSES_HAVE_STDLIB_H PCLASSES_HAVE_STRINGS_H PCLASSES_HAVE_STRING_H PCLASSES_HAVE_SYSV_IPC PCLASSES_HAVE_SYS_STAT_H PCLASSES_HAVE_SYS_TYPES_H PCLASSES_HAVE_UNISTD_H PCLASSES_WITH_STL PTHREAD_CREATE_JOINABLE SIZEOF_CHAR SIZEOF_INT SIZEOF_LONG SIZEOF_LONG_LONG SIZEOF_SHORT SIZEOF___INT64 STDC_HEADERS WORDS_BIGENDIAN _FILE_OFFSET_BITS _LARGE_FILES _MINIX _POSIX_1_SOURCE _POSIX_SOURCE *********/ #endif // P_CONFIG_HPP_INCLUDED |
From: stephan b. <sg...@us...> - 2004-12-23 05:24:56
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25980 Modified Files: File.posix.cpp Log Message: corrected missing "case" words. Index: File.posix.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/File.posix.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- File.posix.cpp 23 Dec 2004 04:32:18 -0000 1.2 +++ File.posix.cpp 23 Dec 2004 05:24:47 -0000 1.3 @@ -187,15 +187,15 @@ int whence; switch(mode) { - SeekSet: + case SeekSet: whence = SEEK_SET; break; - SeekCurrent: + case SeekCurrent: whence = SEEK_CUR; break; - SeekEnd: + case SeekEnd: whence = SEEK_END; break; } |
From: stephan b. <sg...@us...> - 2004-12-23 05:23:40
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/IO In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25730 Modified Files: IOError.h Log Message: added missing virtual on the dtor - gcc complains about it. Index: IOError.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/IO/IOError.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- IOError.h 23 Dec 2004 04:32:16 -0000 1.1 +++ IOError.h 23 Dec 2004 05:23:31 -0000 1.2 @@ -33,7 +33,7 @@ public: IOError(long errorNo, const char* what, const SourceInfo& si) throw(); IOError(const IOError& err) throw(); - ~IOError() throw(); + virtual ~IOError() throw(); long errorNo() const throw(); virtual Unicode::String text() const throw(); |
From: stephan b. <sg...@us...> - 2004-12-23 05:03:20
|
Update of /cvsroot/pclasses/pclasses2/toc/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22590 Modified Files: create_makefile_stubs.sh Log Message: corrected a mis-placed echo Index: create_makefile_stubs.sh =================================================================== RCS file: /cvsroot/pclasses/pclasses2/toc/bin/create_makefile_stubs.sh,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- create_makefile_stubs.sh 23 Dec 2004 00:37:17 -0000 1.2 +++ create_makefile_stubs.sh 23 Dec 2004 05:03:11 -0000 1.3 @@ -70,11 +70,11 @@ ######################################################################## check_make_flexes () { # hanles *.flex - echo "############## FLEXES:" export flext=flex local flexes="$(ls *.${flext} 2>/dev/null)" test "x$flexes" != "x" && { stderr "Adding FLEXES" + echo "############## FLEXES:" echo "# WARNING: FLEXES stuff only works for C++-based flexers" echo -n "FLEXES = " echo $flexes | sed s/\.${flext}//g |
From: stephan b. <sg...@us...> - 2004-12-23 04:59:34
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21672 Modified Files: Makefile.toc Log Message: added Phoenix and Factory Index: Makefile.toc =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/Makefile.toc,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Makefile.toc 23 Dec 2004 00:18:59 -0000 1.1 +++ Makefile.toc 23 Dec 2004 04:59:26 -0000 1.2 @@ -1,23 +1,10 @@ -################################################### -# AUTO-GENERATED guess at a toc-aware Makefile, -# based off of the contents of directory: -# ./include/pclasses -# Created by ./toc/bin/create_makefile_stubs.sh -# Wed Dec 22 23:10:45 CET 2004 -# It must be tweaked to suit your needs. -################################################### +#!/usr/bin/make -f + include toc.make + SUBDIRS = Net System Util -DIST_FILES += pclasses_config.h.at -############## FLEXES: -# WARNING: FLEXES stuff only works for C++-based flexers -FLEXES = -FLEXES_ARGS = -+ -p -OBJECTS += -include $(TOC_MAKESDIR)/flex.make -# Run target FLEXES to process these. -# REMINDER: add the generated C++ files to your SOURCES, if needed. -############## /FLEXES + + HEADERS = Algorithm.h \ Alloc.h \ Atomic.h \ @@ -27,6 +14,7 @@ Char.h \ CircularQueue.h \ Exception.h \ + Factory.h \ IntrusivePtr.h \ IntTypeLimits.h \ IntTypes.h \ @@ -37,6 +25,7 @@ NonCopyable.h \ Pair.h \ pclasses_config.h \ + Phoenix.h \ Queue.h \ ScopedArrayPtr.h \ ScopedPtr.h \ @@ -48,10 +37,12 @@ TypeTraits.h \ ValueType.h \ Vector.h -DIST_FILES += $(HEADERS) -INSTALL_PACKAGE_HEADERS += $(HEADERS) + +CONF_H = pclasses-config.h +CONF_H_IN = pclasses-config.h.at +INSTALL_PACKAGE_HEADERS += $(HEADERS) $(CONF_H) + +DIST_FILES += $(HEADERS) $(CONF_H_IN) +DISTCLEAN_FILES += $(CONF_H) all: -################################################### -# end auto-generated rules -################################################### |
From: stephan b. <sg...@us...> - 2004-12-23 04:46:02
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18827 Added Files: Phoenix.h Factory.h Log Message: egg --- NEW FILE: Factory.h --- #ifndef p_BASICFACTORY_H_INCLUDED #define p_BASICFACTORY_H_INCLUDED 1 // Author: stephan beal <st...@s1...> // License: Public Domain #include <string> #include <map> #include <functional> #include <pclasses/Phoenix.h> // i don't like this dep, but i also don't like // what happens in some cases when i don't use // phoenix. :/ namespace P { /** Namespace Sharing holds internal "sharing context" marker classes. */ namespace Sharing { /** Internal marker class. */ struct FactoryContext {}; } /** The Hook namespace holds classes intended to be used to allow client-side code to hook in to the framework's behaviour, replacing certain parts of the core with their own. */ namespace Hook { /** FactoryCreateHook is a helper object factory for the P::Factory API. General conventions: SubT must derive from (or be) T and must be Default Constructuable on the heap. In short, the following must be able to succeed: <pre> T * foo = new SubT; </pre> Clients may freely specialize this type to hook their factories in to P, and the above requirement may not be imposed by client-side specializations. */ template < class T, class SubT > struct FactoryCreateHook { /** The type returned by create() and operator(). */ typedef T * result_type; /** A typedef for the second template parameter for this type. */ typedef SubT actual_type; /** This creates a new SubT, which is assumed to be a subclass of T. It can be used as a factory for Factory & class_loader. If T or SubT are abstract types, you must specialize this type such that create() returns 0 for those. That is, we "simulate" creation of abstract types by returning 0. The caller owns the returned pointer, which may be 0. */ static result_type create() { return new actual_type; } /** Same as create(). */ result_type operator()() const { return create(); } }; /** FactoryInstanceHook provides a way for non-core code to manipulate or swap out the object returned by Factory::instance(). Client code may want to specialize this to, e.g., plug in a DLL-aware object lookups, auto-loading of plugins, etc. Specializing this type on a specific T will cause: MyFacT & fac = MyFacT::instance(); to trigger a call to operator()( fac ) the first time fac is initialized AND on any re-initializations (which may get called post-main()). */ template <typename FactoryT> struct FactoryInstanceHook { typedef FactoryInstanceHook<FactoryT> ThisType; /** Specializations of this type may initialize instance() here. It will be called whenever Phoenix initializes the object. See Phoenix for details. The default implementation does nothing. */ void operator()( FactoryT & ) throw() { } /** The default implementation returns a shared Factory object. THIS type's operator() will be called on the factory immediately after creating the factory. */ static FactoryT & instance() { typedef ::P::Phoenix<FactoryT, ::P::Sharing::FactoryContext, ThisType > PHX; return PHX::instance(); } }; } // namespace Hook /** Factory is essentially a static classloader, capable of loading classes by using registered factories for a given set of keys (e.g., class names). Classloaders, at least in my experience, need to be able to load all classes which derive from some given type. Without a common base class, one can't safely attempt to cast from an arbitrary pointer to the type we want to load. That's where the InterfaceT parameter comes in. All objects instantiated via this loader must inherit from InterfaceT. KeyType is a type which specifies the type of key used to look up classes, defaulting to std::string. Both InterfaceT and KeyType must be Default Constructable, and InterfaceT must be constructable on the heap (e.g., via new InterfaceT()). The default ipmlementation holds no per-instance state, thus it can be copied quickly. Sample usage: <pre> typedef Factory<MyClass> CL; CL::register_factory( "my_key" ); MyClass *foo = CL::load( "some_key" ); // == NULL foo = CL::instantiate( "my_key" ); // == a new object </pre> Note that all instantiators of the same type use the same object factories. The ContextType template parameter can be used to limit the scope of the object factory registrations to a specific context: instantiators with different Contexts use different maps. ContextType is only used as a type, and is never instantiated by this class. */ template < class InterfaceT, class KeyType = std::string, class ContextType = Sharing::FactoryContext > class Factory { public: /** A typedef for the InterfaceT used by this class. */ typedef InterfaceT value_type; /** A typedef for the KeyType used by this class. */ typedef KeyType key_type; /** Same as ContextType */ typedef ContextType context_type; /** Same as KeyType, for conformance with the the Adaptable Unary Functor model. */ typedef KeyType key_type; /** Same as (InterfaceT *), for conformance with the Adaptable Unary Functor model. */ typedef InterfaceT * result_type; /** Convenience typedef. */ typedef Factory< InterfaceT, KeyType, ContextType > ThisType; Factory() {} virtual ~Factory() {} /** The type of factories used by this class: a function taking void and returning (value_type *). See factoryMap(). todo: implement proper functor support. */ typedef result_type ( *factory_type ) (); /** Internal container type used for mapping keys to factories. */ typedef std::map < key_type, factory_type > FactoryMap; /** returns instance().internal_instantiate( key ). The caller takes responsibility for the returned pointer. */ static result_type instantiate( const key_type & key ) { return instance().internal_instantiate( key ); } /** Returns this->internal_instantiate(key). */ result_type operator()( const key_type & key ) { return this->internal_instantiate( key ); } /** Registers a factory using the given key. If fp is NULL then a default factory is used. Note that fp may not return a type other than ThisType::value_type *, but the actual object it creates may be a polymorphic subclass of value_type. See the FactoryCreateHook class for a factory which does this subtype-to-base conversion. */ void registerFactory( const key_type & key, factory_type fp ) { factoryMap().insert( FactoryMap::value_type( key, fp ) ); } /** Returns the internal key-to-factory map. It is safe for clients to modify this except in multi-threaded environments, and then all guarantees go out the window. That said, it should never be necessary for clients to use this. It is safe to call this post-main(), but such calls may return an empty map! */ static FactoryMap & factoryMap() { return Phoenix<FactoryMap,ThisType>::instance(); } /** Returns true if the given key is registered. This is sometimes useful for checking whether a factory needs to be re-registered, which is sometimes necessary post-main(), when the internal map gets hosed before clients are done using it. */ bool isRegistered( const key_type & key ) const { return factoryMap().end() != factoryMap().find( key ); } /** Returns a shared reference to a Factory. Client code may plug in a new default instance() by specializing Hook::FactoryInstanceHook< FactoryT >. See that type for details. */ static Factory & instance() { return Hook::FactoryInstanceHook<ThisType>::instance(); } protected: /** Tries to instantiate an instance of value_type using the given key. Returns NULL if no class could be loaded for the given key. This is the virtual equivalent to the static instantiate(). Subtypes are free to implement, e.g., DLL lookups. */ virtual result_type internal_instantiate( const key_type & key ) { typename FactoryMap::const_iterator it = factoryMap().find( key ); if ( it != factoryMap().end() ) // found a factory? { return ( it->second ) (); // run our factory. } return 0; } }; // class Factory /** NamedTypeFactory works for string-keyed types. It is expected that this will be the most-used factory implementation, as non-string-keyed factories are rare in practice (but sometimes very useful). */ template <typename InterfaceT> struct NamedTypeFactory : public Factory< InterfaceT, std::string, Sharing::FactoryContext > { virtual ~NamedTypeFactory(){} }; /** The CL namespace encapsulates P's classloader-related API. All of the functions in this API use the obbject NamedTypeFactory<InterfaceT>::instance() for factory-related operations. Thus, using the various Hook classes you can force these functions to use your factory. */ namespace CL { using namespace ::P; using namespace ::P::Sharing; /** Registers classname with InterfaceT. If factory_function is 0 then ::P::Hook::FactoryCreateHook<InterfaceT,InterfaceT>::create is used. If InterfaceT is abstract then you must specialize ::P::Hook::FactoryCreateHook<InterfaceT,InterfaceT>, as documented in FactoryCreateHook::create(). */ template <typename InterfaceT> void registerBase( const std::string & classname, InterfaceT *(*factory_function)() = 0 ) { NamedTypeFactory<InterfaceT>::instance().registerFactory( classname, ( 0 != factory_function ) ? factory_function : ::P::Hook::FactoryCreateHook<InterfaceT,InterfaceT>::create ); } /** Registers a factory creating ImplT objects with the InterfaceT classloader. If factory_function is 0 then ::P::Hook::FactoryCreateHook<InterfaceT,ImplT>::create is used. */ template <typename InterfaceT, typename ImplT> void registerSubtype( const std::string & classname, InterfaceT *(*factory_function)() = 0 ) { NamedTypeFactory<InterfaceT>::instance().registerFactory( classname, ( 0 != factory_function ) ? factory_function : ::P::Hook::FactoryCreateHook<InterfaceT,ImplT>::create ); } /** Returns the same as NamedTypeFactory<InterfaceT>::instance().instantiate( classname ). */ template <typename InterfaceT> InterfaceT * classload( const std::string & classname ) { return NamedTypeFactory<InterfaceT>::instance().instantiate( classname ); } } // namespace CL } // namespace P #endif // p_BASICFACTORY_H_INCLUDED --- NEW FILE: Phoenix.h --- #ifndef p_PHOENIX_HPP_INCLUDED #define p_PHOENIX_HPP_INCLUDED 1 //////////////////////////////////////////////////////////////////////////////// // Phoenix.hpp // Phoenix<> provides "context singletons" with "phoenixing" capabilities. // // Author: stephan beal <st...@s1...> // License: Public Domain // CVS Revision: $Revision: 1.1 $ //////////////////////////////////////////////////////////////////////////////// #include <stdlib.h> // atexit() #include <iostream> // cout/cerr #ifndef phoenix_DEBUG // enable debuggering to see when phoenixes are (re)created. # define phoenix_DEBUG 0 #endif #if phoenix_DEBUG # include <typeinfo> # define phoenix_CERR std::cerr << __FILE__ << ":" << std::dec << __LINE__ << " : " \ << "Phoenix<"<<typeid((base_type *)NULL).name()<<" , " \ << typeid((context_type *)NULL).name()<<"> " #else # define phoenix_CERR if(0) std::cerr #endif // phoenix_DEBUG /** The Phoenix class acts as a wrapper for adding "phoenixing" behaviour to arbitrary shared objects, as covered in detail in Alexandrescu's "Modern C++ Design". */ namespace P { /** Internal helper class to provide a default no-op initializer for phoenixed objects. See the Phoenix<> class. */ struct no_op_phoenix_initializer { /** Does nothing: This class is called no_op for a reason ;) */ template <typename T> void operator()( T & ) throw() { return; } }; /** Phoenix is class for holding singleton-style instances of BaseType objects. Rather than requiring that BaseType be a Singleton type, Phoenix subclasses BaseType to add the Phoenix-like capabilities. Phoenixing makes the shared object post-main() safe, in terms of object destruction order. Parameterized on: - BaseType: must be struct or class type and must be default-constructable. i have no clue what is supposed to happen if BaseType's dtor is not virtual. That said, Phoenix has been successfully demonstrated with a BaseType of std::map, which has no virtual dtor. - ContextType: These objects are only singletons within the given ContextType. That is, Phoenix<T,X>::instance() will return a different object than Phoenix<T,Y> will. - InitializerType: must be a unary functor accepting a BaseType &. It's return value is ignored. The default functor does nothing. The InitializerType is called when a to-be-phoenixed object is initially created and whenever it is phoenixed. This is intended to be used, e.g., for re-populating a phoenixed shared object. TODO: investigate the implications of a predicate initializer, which would return false if the object could not be initialized. InitializerType::operator() must not throw. Whether or not BaseType is technically a singleton depends on entirely BaseType itself. This class is more often used to provide easy access to context-dependent shared objects, rather than pure singletons. The Phoenix class itself is a true Singleton, but each combination of template arguments provides a different Singleton *type*, so the end effect is "context singletons." This is another attempt to solve the classic Keyboard-Console-Log problem, as discussed at length in <i>Modern C++ Design</i>. It relies on sane behaviour in the C library's atexit() function, which, as is shown in MC++D, is not the case on all systems. That said, the Phoenix-specific behaviours are undefined on those systems, which is only to say that it might not be post-main() safe. Caveats: i am not 100% clear on all of the implications of this implementation's approach... my gut tells me i'm missing some significant bits. i mean, it <i>can't</i> have been this straightforward to solve ;). The very nature of the Phoenix Singleton problem makes it difficult to reliably test in real-world applications. That said, i have seen a objects be successfully phoenixed and atexit()ed, so it is known to at least "basically" work. There's a paper about "context singletons", this class, and some of it's implications, at: http://s11n.net/misccode/context_singletons.html [Much later: i've gotten more re-use out of this class than probably any other single class i've ever written.] */ template < typename BaseType, typename ContextType = BaseType, typename InitializerType = no_op_phoenix_initializer > struct Phoenix : public BaseType { /** context_type is unused by this class, but might be useful for type identification at some point. */ typedef ContextType context_type; /** The BaseType parameterized type. */ typedef BaseType base_type; /** The functor type used to initialize this phoenixed object. */ typedef InitializerType initializer_type; /** Returns a shared instance of this object. The instance() method will always return the same address, though it is potentially possible (post-main()) that the actual object living at that address is different from previous calls. It is never a good idea to hold on to the returned reference for the life of an object, as that bypasses the phoenixing capabilities. If you ever delete it you're on you're own. That's a Bad Idea. */ static base_type & instance() { static this_type meyers; static bool donethat = false; if( this_type::m_destroyed ) { phoenix_CERR << "Phoenixing!" << std::endl; donethat = false; new( &meyers ) this_type; atexit( this_type::do_atexit ); } if( !donethat ) { phoenix_CERR << "initializing instance" << std::endl; donethat = true; initializer_type()( meyers ); } phoenix_CERR << "instance() == " <<std::hex<<&meyers<<std::endl; return meyers; } private: /** A convenience typedef. */ typedef Phoenix<base_type,context_type,initializer_type> this_type; static bool m_destroyed; Phoenix() { phoenix_CERR << "Phoenix() @" << std::hex<< this << std::endl; m_destroyed = false; } virtual ~Phoenix() { phoenix_CERR << "~Phoenix() @" << std::hex<< this << std::endl; m_destroyed = true; } /** Destroys the shared object via a manual call to it's dtor. */ static void do_atexit() { if( m_destroyed ) return; phoenix_CERR << "::do_atexit() @ " << std::hex << &instance() << std::endl; static_cast<this_type &>(instance()).~Phoenix(); // will eventually trigger the BaseType dtor } }; template <typename T, typename C, typename I> bool Phoenix<T,C,I>::m_destroyed = false; } // namespace #undef phoenix_DEBUG #undef phoenix_CERR #endif // p_PHOENIX_HPP_INCLUDED |
From: Christian P. <cp...@us...> - 2004-12-23 04:32:58
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14702/include/pclasses Modified Files: Makefile.am Removed Files: Char.h IODevice.h String.h TextStream.h Log Message: Moved IODevice, IOError into P::IO namespace. Moved Char, String, TextStream into P::Unicode namespace. --- Char.h DELETED --- --- IODevice.h DELETED --- Index: Makefile.am =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/Makefile.am,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- Makefile.am 22 Dec 2004 17:54:39 -0000 1.1.1.1 +++ Makefile.am 23 Dec 2004 04:32:15 -0000 1.2 @@ -1,8 +1,8 @@ -SUBDIRS = System Net Util +SUBDIRS = Unicode IO System Net Util INCLUDES = METASOURCES = AUTO pkginclude_HEADERS = Exception.h IntTypes.h ScopedArrayPtr.h ScopedPtr.h \ SharedPtr.h Alloc.h SourceInfo.h Atomic.h AtomicTraits.h ValueType.h LockTraits.h \ - ByteOrderTraits.h BasicTypes.h Vector.h Algorithm.h TypeTraits.h Char.h TextStream.h \ - Stack.h LinkedItem.h Pair.h IntTypeLimits.h Queue.h String.h IntrusivePtr.h \ - CircularQueue.h List.h IODevice.h NonCopyable.h + ByteOrderTraits.h BasicTypes.h Vector.h Algorithm.h TypeTraits.h \ + Stack.h LinkedItem.h Pair.h IntTypeLimits.h Queue.h IntrusivePtr.h \ + CircularQueue.h List.h NonCopyable.h --- String.h DELETED --- --- TextStream.h DELETED --- |
From: Christian P. <cp...@us...> - 2004-12-23 04:32:55
|
Update of /cvsroot/pclasses/pclasses2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14702 Modified Files: configure.in pclasses2.kdevelop Log Message: Moved IODevice, IOError into P::IO namespace. Moved Char, String, TextStream into P::Unicode namespace. Index: pclasses2.kdevelop =================================================================== RCS file: /cvsroot/pclasses/pclasses2/pclasses2.kdevelop,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- pclasses2.kdevelop 22 Dec 2004 17:54:32 -0000 1.1.1.1 +++ pclasses2.kdevelop 23 Dec 2004 04:32:14 -0000 1.2 @@ -196,4 +196,11 @@ <usermanualurl/> </projectdoc> </kdevdocumentation> + <kdevcvsservice> + <recursivewhenupdate>true</recursivewhenupdate> + <prunedirswhenupdate>true</prunedirswhenupdate> + <createdirswhenupdate>true</createdirswhenupdate> + <recursivewhencommitremove>true</recursivewhencommitremove> + <revertoptions>-C</revertoptions> + </kdevcvsservice> </kdevelop> Index: configure.in =================================================================== RCS file: /cvsroot/pclasses/pclasses2/configure.in,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- configure.in 22 Dec 2004 17:54:31 -0000 1.1.1.1 +++ configure.in 23 Dec 2004 04:32:13 -0000 1.2 @@ -193,11 +193,14 @@ AC_OUTPUT(Makefile \ include/Makefile \ include/pclasses/Makefile \ + include/pclasses/Unicode/Makefile \ + include/pclasses/IO/Makefile \ include/pclasses/System/Makefile \ include/pclasses/Net/Makefile \ include/pclasses/Util/Makefile \ src/Makefile \ src/Unicode/Makefile \ + src/IO/Makefile \ src/System/Makefile \ src/Net/Makefile \ src/Util/Makefile \ |
From: Christian P. <cp...@us...> - 2004-12-23 04:32:40
|
Update of /cvsroot/pclasses/pclasses2/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14702/src Modified Files: Makefile.am Removed Files: Char.cpp IODevice.cpp String.cpp TextStream.cpp Log Message: Moved IODevice, IOError into P::IO namespace. Moved Char, String, TextStream into P::Unicode namespace. Index: Makefile.am =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/Makefile.am,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- Makefile.am 22 Dec 2004 17:54:34 -0000 1.1.1.1 +++ Makefile.am 23 Dec 2004 04:32:17 -0000 1.2 @@ -7,6 +7,6 @@ lib_LTLIBRARIES = libpclasses.la libpclasses_la_SOURCES = Alloc.cpp Exception.cpp AtomicInt.gcc-x86.cpp \ - ByteOrderTraits.cpp Char.cpp String.cpp TextStream.cpp LinkedItem.cpp IODevice.cpp + ByteOrderTraits.cpp LinkedItem.cpp -SUBDIRS = Unicode . System Net Util +SUBDIRS = . Unicode IO System Net Util --- String.cpp DELETED --- --- Char.cpp DELETED --- --- TextStream.cpp DELETED --- --- IODevice.cpp DELETED --- |
From: Christian P. <cp...@us...> - 2004-12-23 04:32:32
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14702/src/System Modified Files: File.posix.cpp Makefile.am Pipe.posix.cpp SharedLib.dl.cpp SystemError.cpp Log Message: Moved IODevice, IOError into P::IO namespace. Moved Char, String, TextStream into P::Unicode namespace. Index: File.posix.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/File.posix.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- File.posix.cpp 22 Dec 2004 17:54:35 -0000 1.1.1.1 +++ File.posix.cpp 23 Dec 2004 04:32:18 -0000 1.2 @@ -35,18 +35,18 @@ { } -File::File(const File& f) throw(IOError) +File::File(const File& f) throw(IO::IOError) : IODevice(f), _handle(0) { int handle = ::dup((int)f._handle); if(handle == -1) - throw IOError(errno, "Could not duplicate file handle", P_SOURCEINFO); + throw IO::IOError(errno, "Could not duplicate file handle", P_SOURCEINFO); _handle = (Handle*)handle; } File::File(const char* name, OpenMode omode, AccessMode amode, - ShareMode smode) throw(IOError) + ShareMode smode) throw(IO::IOError) : _handle(0) { open(name,omode,amode,smode); @@ -61,7 +61,7 @@ } void File::open(const char* name, OpenMode omode, AccessMode amode, - ShareMode smode) throw(LogicError, IOError) + ShareMode smode) throw(LogicError, IO::IOError) { if(!valid()) { @@ -100,7 +100,7 @@ int handle = ::open(name, flags); if(handle == -1) - throw IOError(errno, "Could not open file", P_SOURCEINFO); + throw IO::IOError(errno, "Could not open file", P_SOURCEINFO); _handle = (Handle*)handle; IODevice::setAccess(amode); @@ -111,12 +111,12 @@ throw LogicError("File is already open", P_SOURCEINFO); } -void File::close() throw(LogicError, IOError) +void File::close() throw(LogicError, IO::IOError) { if(valid()) { if(::close((int)_handle) == -1) - throw IOError(errno, "Could not close file", P_SOURCEINFO); + throw IO::IOError(errno, "Could not close file", P_SOURCEINFO); IODevice::setAccess(None); IODevice::setValid(false); @@ -125,7 +125,7 @@ throw LogicError("File is not open", P_SOURCEINFO); } -size_t File::read(char* buffer, size_t count) throw(IOError) +size_t File::read(char* buffer, size_t count) throw(IO::IOError) { if(count > SSIZE_MAX) count = SSIZE_MAX; @@ -137,7 +137,7 @@ if(errno == EINTR) goto File_read; - throw IOError(errno, "Could not read from file", P_SOURCEINFO); + throw IO::IOError(errno, "Could not read from file", P_SOURCEINFO); } else if(ret == 0 && !eof()) setEof(true); @@ -145,7 +145,7 @@ return ret; } -size_t File::peek(char* buffer, size_t count) throw(IOError) +size_t File::peek(char* buffer, size_t count) throw(IO::IOError) { if(count > SSIZE_MAX) count = SSIZE_MAX; @@ -157,14 +157,14 @@ if(errno == EINTR) goto File_peek; - throw IOError(errno, "Could not read from file", P_SOURCEINFO); + throw IO::IOError(errno, "Could not read from file", P_SOURCEINFO); } seek(-count, SeekCurrent); return ret; } -size_t File::write(const char* buffer, size_t count) throw(IOError) +size_t File::write(const char* buffer, size_t count) throw(IO::IOError) { if(count > SSIZE_MAX) count = SSIZE_MAX; @@ -176,13 +176,13 @@ if(errno == EINTR) goto File_write; - throw IOError(errno, "Could not read from file", P_SOURCEINFO); + throw IO::IOError(errno, "Could not read from file", P_SOURCEINFO); } return ret; } -offset_t File::seek(offset_t offset, SeekMode mode) throw(IOError) +offset_t File::seek(offset_t offset, SeekMode mode) throw(IO::IOError) { int whence; switch(mode) @@ -202,7 +202,7 @@ off_t ret = lseek((int)_handle, offset, whence); if(ret == (off_t)-1) - throw IOError(errno, "Could not seek on file", P_SOURCEINFO); + throw IO::IOError(errno, "Could not seek on file", P_SOURCEINFO); return ret; } @@ -220,28 +220,28 @@ return false; } -void File::commit() const throw(IOError) +void File::commit() const throw(IO::IOError) { int ret = fsync((int)_handle); if(ret == -1) - throw IOError(errno, "Could not commit file to disk", P_SOURCEINFO); + throw IO::IOError(errno, "Could not commit file to disk", P_SOURCEINFO); } -offset_t File::size() const throw(IOError) +offset_t File::size() const throw(IO::IOError) { struct stat buff; int ret = fstat((int)_handle, &buff); if(ret == -1) - throw IOError(errno, "Could not stat file", P_SOURCEINFO); + throw IO::IOError(errno, "Could not stat file", P_SOURCEINFO); return buff.st_size; } -File& File::operator=(const File& f) throw(IOError) +File& File::operator=(const File& f) throw(IO::IOError) { int handle = ::dup((int)f._handle); if(handle == -1) - throw IOError(errno, "Could not duplicate file handle", P_SOURCEINFO); + throw IO::IOError(errno, "Could not duplicate file handle", P_SOURCEINFO); if(valid()) { Index: SharedLib.dl.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/SharedLib.dl.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- SharedLib.dl.cpp 22 Dec 2004 17:54:37 -0000 1.1.1.1 +++ SharedLib.dl.cpp 23 Dec 2004 04:32:18 -0000 1.2 @@ -30,7 +30,7 @@ struct SharedLib::Handle {}; -SharedLib::SharedLib(const String& name, BindMode mode) throw(SystemError) +SharedLib::SharedLib(const Unicode::String& name, BindMode mode) throw(SystemError) { int flags = 0; switch(mode) @@ -44,7 +44,7 @@ } //flags |= RTLD_GLOBAL; this causes a SIGSEGV when loading multiple plugins with same exported vars - String so_name = name; + Unicode::String so_name = name; so_name.append(".so"); //_handle = (Handle*)dlopen(name.utf8(), flags); Index: Pipe.posix.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/Pipe.posix.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- Pipe.posix.cpp 22 Dec 2004 17:54:36 -0000 1.1.1.1 +++ Pipe.posix.cpp 23 Dec 2004 04:32:18 -0000 1.2 @@ -37,12 +37,12 @@ IODevice::setEof(false); } -Pipe::Pipe(const Pipe& p) throw(IOError) +Pipe::Pipe(const Pipe& p) throw(IO::IOError) : IODevice(p), _handle(0) { int handle = ::dup((int)p._handle); if(handle == -1) - throw IOError(errno, "Could not duplicate pipe handle", P_SOURCEINFO); + throw IO::IOError(errno, "Could not duplicate pipe handle", P_SOURCEINFO); _handle = (Handle*)handle; } @@ -55,12 +55,12 @@ } } -Pipe::Pair Pipe::create() throw(IOError) +Pipe::Pair Pipe::create() throw(IO::IOError) { int fds[2]; if(pipe(fds) == -1) - throw IOError(errno, "Could not create pipe", P_SOURCEINFO); + throw IO::IOError(errno, "Could not create pipe", P_SOURCEINFO); Pipe readPipe((Handle*)fds[0], true); Pipe writePipe((Handle*)fds[1], false); @@ -68,12 +68,12 @@ return Pair(readPipe, writePipe); } -void Pipe::close() throw(LogicError, IOError) +void Pipe::close() throw(LogicError, IO::IOError) { if(valid()) { if(::close((int)_handle) == -1) - throw IOError(errno, "Could not close pipe", P_SOURCEINFO); + throw IO::IOError(errno, "Could not close pipe", P_SOURCEINFO); IODevice::setAccess(None); IODevice::setValid(false); @@ -82,7 +82,7 @@ throw LogicError("Pipe is not open", P_SOURCEINFO); } -size_t Pipe::read(char* buffer, size_t count) throw(IOError) +size_t Pipe::read(char* buffer, size_t count) throw(IO::IOError) { if(count > SSIZE_MAX) count = SSIZE_MAX; @@ -94,7 +94,7 @@ if(errno == EINTR) goto Pipe_read; - throw IOError(errno, "Could not read from pipe", P_SOURCEINFO); + throw IO::IOError(errno, "Could not read from pipe", P_SOURCEINFO); } else if(ret == 0 && !eof()) setEof(true); @@ -102,7 +102,7 @@ return ret; } -size_t Pipe::write(const char* buffer, size_t count) throw(IOError) +size_t Pipe::write(const char* buffer, size_t count) throw(IO::IOError) { if(count > SSIZE_MAX) count = SSIZE_MAX; @@ -116,24 +116,24 @@ if(errno == EINTR) goto Pipe_write; - throw IOError(errno, "Could not read from pipe", P_SOURCEINFO); + throw IO::IOError(errno, "Could not read from pipe", P_SOURCEINFO); } return ret; } -void Pipe::commit() const throw(IOError) +void Pipe::commit() const throw(IO::IOError) { int ret = fsync((int)_handle); if(ret == -1) - throw IOError(errno, "Could not commit to pipe", P_SOURCEINFO); + throw IO::IOError(errno, "Could not commit to pipe", P_SOURCEINFO); } -Pipe& Pipe::operator=(const Pipe& p) throw(IOError) +Pipe& Pipe::operator=(const Pipe& p) throw(IO::IOError) { int handle = ::dup((int)p._handle); if(handle == -1) - throw IOError(errno, "Could not duplicate pipe handle", P_SOURCEINFO); + throw IO::IOError(errno, "Could not duplicate pipe handle", P_SOURCEINFO); if(valid()) { Index: SystemError.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/SystemError.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- SystemError.cpp 22 Dec 2004 17:54:36 -0000 1.1.1.1 +++ SystemError.cpp 23 Dec 2004 04:32:18 -0000 1.2 @@ -23,7 +23,7 @@ namespace P { namespace System { - + SystemError::SystemError(long errorNo, const char* what, const SourceInfo& si) throw() : RuntimeError(what, si), _errorNo(errorNo) @@ -44,10 +44,10 @@ return _errorNo; } -String SystemError::text() const throw() +Unicode::String SystemError::text() const throw() { //@todo return the real system error text - return String(); + return Unicode::String(); } } // !namespace System Index: Makefile.am =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/Makefile.am,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- Makefile.am 22 Dec 2004 17:54:36 -0000 1.1.1.1 +++ Makefile.am 23 Dec 2004 04:32:18 -0000 1.2 @@ -76,6 +76,9 @@ $(IO_Sources) libpclasses_system_la_LDFLAGS = -no-undefined -libpclasses_system_la_LIBADD = $(top_builddir)/src/libpclasses.la $(DL_LIBS) +libpclasses_system_la_LIBADD = $(top_builddir)/src/libpclasses.la \ + $(top_builddir)/src/Unicode/libpclasses_unicode.la \ + $(top_builddir)/src/IO/libpclasses_io.la \ + $(DL_LIBS) noinst_HEADERS = timeout.h |
From: Christian P. <cp...@us...> - 2004-12-23 04:32:31
|
Update of /cvsroot/pclasses/pclasses2/src/Net In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14702/src/Net Modified Files: InetAddress.cpp InetSocket.cpp Socket.cpp SocketOption.h Log Message: Moved IODevice, IOError into P::IO namespace. Moved Char, String, TextStream into P::Unicode namespace. Index: Socket.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/Net/Socket.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- Socket.cpp 22 Dec 2004 17:54:35 -0000 1.1.1.1 +++ Socket.cpp 23 Dec 2004 04:32:18 -0000 1.2 @@ -160,7 +160,7 @@ { } -Socket::Socket(Domain domain, Type type, int proto) throw(IOError) +Socket::Socket(Domain domain, Type type, int proto) throw(IO::IOError) : IODevice(), _handle(-1) { open(domain, type, proto); @@ -196,7 +196,7 @@ } void Socket::open(Domain domain, Type type, int proto) - throw(LogicError, IOError) + throw(LogicError, IO::IOError) { if(!valid()) { @@ -230,7 +230,7 @@ int ret = ::socket(d, t, proto); if(ret == -1) - throw IOError(errno, "Could not open socket", P_SOURCEINFO); + throw IO::IOError(errno, "Could not open socket", P_SOURCEINFO); IODevice::setAccess(ReadWrite); IODevice::setValid(true); @@ -247,13 +247,13 @@ throw LogicError("Socket is already open", P_SOURCEINFO); } -void Socket::close() throw(LogicError, IOError) +void Socket::close() throw(LogicError, IO::IOError) { if(valid()) { int ret = ::close(_handle); if(ret == -1) - throw IOError(errno, "Could not close socket", P_SOURCEINFO); + throw IO::IOError(errno, "Could not close socket", P_SOURCEINFO); IODevice::setAccess(None); IODevice::setValid(false); @@ -263,12 +263,12 @@ throw LogicError("Socket is not open", P_SOURCEINFO); } -size_t Socket::read(char* buffer, size_t count) throw(IOError) +size_t Socket::read(char* buffer, size_t count) throw(IO::IOError) { ssize_t ret = ::recv(_handle, (void*)buffer, count, MSG_NOSIGNAL); if(ret == -1) { - throw IOError(errno, "Could not read from socket", P_SOURCEINFO); + throw IO::IOError(errno, "Could not read from socket", P_SOURCEINFO); } else if(ret == 0 && !eof()) setEof(true); @@ -276,28 +276,28 @@ return ret; } -size_t Socket::peek(char* buffer, size_t count) throw(IOError) +size_t Socket::peek(char* buffer, size_t count) throw(IO::IOError) { ssize_t ret = ::recv(_handle, (void*)buffer, count, MSG_PEEK|MSG_NOSIGNAL); if(ret == -1) - throw IOError(errno, "Could not read from socket", P_SOURCEINFO); + throw IO::IOError(errno, "Could not read from socket", P_SOURCEINFO); return ret; } -size_t Socket::write(const char* buffer, size_t count) throw(IOError) +size_t Socket::write(const char* buffer, size_t count) throw(IO::IOError) { ssize_t ret = ::send(_handle, (const void*)buffer, count, MSG_NOSIGNAL); if(ret == -1) - throw IOError(errno, "Could not write to socket", P_SOURCEINFO); + throw IO::IOError(errno, "Could not write to socket", P_SOURCEINFO); return ret; } -int Socket::wait(int wait, unsigned int timeout) throw(IOError) +int Socket::wait(int wait, unsigned int timeout) throw(IO::IOError) { fd_set readFds, writeFds; @@ -324,7 +324,7 @@ if(errno == EINTR) goto select_loop; - throw IOError(errno, "Could not write to socket", P_SOURCEINFO); + throw IO::IOError(errno, "Could not write to socket", P_SOURCEINFO); } ret = 0; @@ -338,7 +338,7 @@ return ret; } -void Socket::bind(const NetworkAddress& addr, port_t port) throw(IOError) +void Socket::bind(const NetworkAddress& addr, port_t port) throw(IO::IOError) { size_t socketAddrLen = 0; sockaddr* socketAddr = makeSocketAddress(addr, port, socketAddrLen); @@ -347,58 +347,58 @@ delete socketAddr; if(ret == -1) - throw IOError(errno, "Could not bind address to socket", P_SOURCEINFO); + throw IO::IOError(errno, "Could not bind address to socket", P_SOURCEINFO); } -void Socket::setSendTimeout(unsigned int timeout) throw(IOError) +void Socket::setSendTimeout(unsigned int timeout) throw(IO::IOError) { SocketOption<SOL_SOCKET, SO_SNDTIMEO, int> opt(_handle); opt.set(timeout); } -unsigned int Socket::sendTimeout() const throw(IOError) +unsigned int Socket::sendTimeout() const throw(IO::IOError) { SocketOption<SOL_SOCKET, SO_SNDTIMEO, int> opt(_handle); return opt.get(); } -void Socket::setReceiveTimeout(unsigned int timeout) throw(IOError) +void Socket::setReceiveTimeout(unsigned int timeout) throw(IO::IOError) { SocketOption<SOL_SOCKET, SO_RCVTIMEO, int> opt(_handle); opt.set(timeout); } -unsigned int Socket::receiveTimeout() const throw(IOError) +unsigned int Socket::receiveTimeout() const throw(IO::IOError) { SocketOption<SOL_SOCKET, SO_RCVTIMEO, int> opt(_handle); return opt.get(); } -void Socket::setSendBufferSize(size_t sz) throw(IOError) +void Socket::setSendBufferSize(size_t sz) throw(IO::IOError) { SocketOption<SOL_SOCKET, SO_SNDBUF, int> opt(_handle); opt.set(sz); } -size_t Socket::sendBufferSize() const throw(IOError) +size_t Socket::sendBufferSize() const throw(IO::IOError) { SocketOption<SOL_SOCKET, SO_SNDBUF, int> opt(_handle); return opt.get(); } -void Socket::setReceiveBufferSize(size_t sz) throw(IOError) +void Socket::setReceiveBufferSize(size_t sz) throw(IO::IOError) { SocketOption<SOL_SOCKET, SO_RCVBUF, int> opt(_handle); opt.set(sz); } -size_t Socket::receiveBufferSize() const throw(IOError) +size_t Socket::receiveBufferSize() const throw(IO::IOError) { SocketOption<SOL_SOCKET, SO_RCVBUF, int> opt(_handle); return opt.get(); } -void Socket::setLinger(bool enable, unsigned int timeout) throw(IOError) +void Socket::setLinger(bool enable, unsigned int timeout) throw(IO::IOError) { linger lopt; lopt.l_onoff = enable ? 1 : 0; @@ -408,7 +408,7 @@ opt.set(lopt); } -void Socket::setRouting(bool enable) throw(IOError) +void Socket::setRouting(bool enable) throw(IO::IOError) { SocketOption<SOL_SOCKET, SO_DONTROUTE, int> opt(_handle); opt.set(enable ? 1 : 0); @@ -419,15 +419,15 @@ return _handle; } -void Socket::addListener(IOListener& l) +void Socket::addListener(IO::IOListener& l) { } -void Socket::updateListener(IOListener& l) +void Socket::updateListener(IO::IOListener& l) { } -void Socket::removeListener(IOListener& l) +void Socket::removeListener(IO::IOListener& l) { } @@ -441,13 +441,13 @@ { } -void DatagramSocket::setBroadcast(bool enable) throw(IOError) +void DatagramSocket::setBroadcast(bool enable) throw(IO::IOError) { SocketOption<SOL_SOCKET, SO_BROADCAST, int> opt(handle()); opt.set(enable ? 1 : 0); } -bool DatagramSocket::broadcast() const throw(IOError) +bool DatagramSocket::broadcast() const throw(IO::IOError) { SocketOption<SOL_SOCKET, SO_BROADCAST, int> opt(handle()); return opt.get() == 1 ? true : false; Index: InetAddress.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/Net/InetAddress.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- InetAddress.cpp 22 Dec 2004 17:54:34 -0000 1.1.1.1 +++ InetAddress.cpp 23 Dec 2004 04:32:18 -0000 1.2 @@ -61,7 +61,7 @@ return (*this == InetAddress(Loopback)); } -String InetAddress::str() const +Unicode::String InetAddress::str() const { //@todo InetAddress::str() } Index: SocketOption.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/Net/SocketOption.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- SocketOption.h 22 Dec 2004 17:54:35 -0000 1.1.1.1 +++ SocketOption.h 23 Dec 2004 04:32:18 -0000 1.2 @@ -18,9 +18,10 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef _P_SocketOption_h_ -#define _P_SocketOption_h_ +#ifndef P_Net_SocketOption_h +#define P_Net_SocketOption_h +#include "pclasses/IO/IOError.h" #include <errno.h> namespace P { @@ -39,7 +40,7 @@ sizeof(Type)); if(ret == -1) - throw IOError(errno, "Could not set socket option", P_SOURCEINFO); + throw IO::IOError(errno, "Could not set socket option", P_SOURCEINFO); } inline Type get() @@ -50,7 +51,7 @@ &len); if(ret == -1) - throw IOError(errno, "Could not get socket option", P_SOURCEINFO); + throw IO::IOError(errno, "Could not get socket option", P_SOURCEINFO); return val; } Index: InetSocket.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/Net/InetSocket.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- InetSocket.cpp 22 Dec 2004 17:54:35 -0000 1.1.1.1 +++ InetSocket.cpp 23 Dec 2004 04:32:18 -0000 1.2 @@ -35,7 +35,7 @@ { } -InetSocket::InetSocket(Type t, int proto) throw(IOError) +InetSocket::InetSocket(Type t, int proto) throw(IO::IOError) : Socket(Socket::Inet, t, proto) { } @@ -44,37 +44,37 @@ { } -void InetSocket::open(Type type, int proto) throw(LogicError, IOError) +void InetSocket::open(Type type, int proto) throw(LogicError, IO::IOError) { Socket::open(Socket::Inet, type, proto); } -void InetSocket::setTypeOfSerice(uint8_t type) throw(IOError) +void InetSocket::setTypeOfSerice(uint8_t type) throw(IO::IOError) { SocketOption<SOL_IP, IP_TOS, uint8_t> opt(handle()); opt.set(type); } -uint8_t InetSocket::typeOfService() const throw(IOError) +uint8_t InetSocket::typeOfService() const throw(IO::IOError) { SocketOption<SOL_IP, IP_TOS, uint8_t> opt(handle()); return opt.get(); } -void InetSocket::setTimeToLive(int ttl) throw(IOError) +void InetSocket::setTimeToLive(int ttl) throw(IO::IOError) { SocketOption<SOL_IP, IP_TTL, int> opt(handle()); opt.set(ttl); } -int InetSocket::timeToLive() const throw(IOError) +int InetSocket::timeToLive() const throw(IO::IOError) { SocketOption<SOL_IP, IP_TTL, int> opt(handle()); return opt.get(); } -UDPSocket::UDPSocket() throw(IOError) +UDPSocket::UDPSocket() throw(IO::IOError) : InetSocket(), DatagramSocket() { InetSocket::open(Socket::Datagram, IPPROTO_UDP); @@ -84,36 +84,36 @@ { } -void UDPSocket::open() throw(LogicError, IOError) +void UDPSocket::open() throw(LogicError, IO::IOError) { InetSocket::open(Socket::Datagram, IPPROTO_UDP); } -void UDPSocket::setMulticastTTL(int ttl) throw(IOError) +void UDPSocket::setMulticastTTL(int ttl) throw(IO::IOError) { SocketOption<SOL_IP, IP_MULTICAST_TTL, int> opt(handle()); opt.set(ttl); } -int UDPSocket::multicastTTL() const throw(IOError) +int UDPSocket::multicastTTL() const throw(IO::IOError) { SocketOption<SOL_IP, IP_MULTICAST_TTL, int> opt(handle()); return opt.get(); } -void UDPSocket::setMulticastLoop(bool enable) throw(IOError) +void UDPSocket::setMulticastLoop(bool enable) throw(IO::IOError) { SocketOption<SOL_IP, IP_MULTICAST_LOOP, int> opt(handle()); opt.set(enable ? 1 : 0); } -bool UDPSocket::multicastLoop() const throw(IOError) +bool UDPSocket::multicastLoop() const throw(IO::IOError) { SocketOption<SOL_IP, IP_MULTICAST_LOOP, int> opt(handle()); return opt.get(); } -void UDPSocket::addMembership(const InetAddress& addr) throw(IOError) +void UDPSocket::addMembership(const InetAddress& addr) throw(IO::IOError) { InetAddress anyAddr(InetAddress::Any); @@ -135,7 +135,7 @@ #endif } -void UDPSocket::dropMembership(const InetAddress& addr) throw(IOError) +void UDPSocket::dropMembership(const InetAddress& addr) throw(IO::IOError) { InetAddress anyAddr(InetAddress::Any); @@ -158,7 +158,7 @@ } -TCPSocket::TCPSocket() throw(IOError) +TCPSocket::TCPSocket() throw(IO::IOError) : InetSocket(), StreamSocket() { InetSocket::open(Socket::Stream, IPPROTO_TCP); @@ -168,7 +168,7 @@ { } -void TCPSocket::open() throw(LogicError, IOError) +void TCPSocket::open() throw(LogicError, IO::IOError) { InetSocket::open(Socket::Stream, IPPROTO_TCP); } |
From: Christian P. <cp...@us...> - 2004-12-23 04:32:30
|
Update of /cvsroot/pclasses/pclasses2/src/Unicode In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14702/src/Unicode Modified Files: Makefile.am unicodedata.awk Added Files: Char.cpp String.cpp TextStream.cpp Log Message: Moved IODevice, IOError into P::IO namespace. Moved Char, String, TextStream into P::Unicode namespace. Index: unicodedata.awk =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/Unicode/unicodedata.awk,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- unicodedata.awk 22 Dec 2004 17:54:37 -0000 1.1.1.1 +++ unicodedata.awk 23 Dec 2004 04:32:18 -0000 1.2 @@ -2,12 +2,12 @@ FS=";" print "/* Automatically generated by P::Classes unicodedata.awk */" > "unicodedata_extra.h" - print "namespace P { namespace unicode {" >> "unicodedata_extra.h" + print "namespace P { namespace Unicode {" >> "unicodedata_extra.h" print "struct letterExtraData { uint32_t upper, lower, title; };" >> "unicodedata_extra.h" print "struct decimalDigitExtraData { int num; };" >> "unicodedata_extra.h" print "/* Automatically generated by P::Classes unicodedata.awk */" - print "namespace P { namespace unicode {" + print "namespace P { namespace Unicode {" print "struct codePointData {" print " uint32_t codePoint;" print " char category;" --- NEW FILE: String.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/Unicode/String.h" #include "pclasses/ScopedPtr.h" #include "pclasses/ScopedArrayPtr.h" #include "pclasses/Algorithm.h" #include <cstring> namespace P { namespace Unicode { String::String(size_t reserve) throw(OutOfMemory) : _offset(0), _length(0) { ScopedPtr<Data> d(new Data); d->str = (Char*)new char[sizeof(Char) * reserve]; d->size = reserve; _data = d.release(); } String::String(const String& str) throw(OutOfMemory) : _offset(str._offset), _length(str._length), _data(str._data) { } String::String(const char* str, size_t count) throw(OutOfMemory) { *this = fromLatin1(str, count); } String::String(const wchar_t* str, size_t count) throw(OutOfMemory) { *this = fromUcs2(str, count); } String::String(const String& str, size_t offset, size_t length) throw(OutOfMemory) : _offset(str._offset + offset), _length(length), _data(str._data) { } String::~String() throw() { } void String::swap(String& b) { SharedPtr<Data> tmp = _data; _data = b._data; b._data = tmp; } size_t String::size() const throw() { return _data->size; } void String::resize(size_t sz) throw(OutOfMemory) { resize(sz, 0, 0); } void String::resize(size_t sz, size_t holeOffset, size_t holeLen) throw(OutOfMemory) { SharedPtr<Data> newData(new Data); char* newStr = 0; size_t newLength = 0; size_t length = sz >= _length ? _length : sz; if(holeLen == 0 || holeOffset >= length) { size_t reserve = sz - length; newStr = new char[sizeof(Char) * sz]; copy_construct((Char*)newStr, data(), length); construct((Char*)newStr + length, reserve); newLength = length; } else { size_t len1; } newData->str = (Char*)newStr; newData->size = sz; _data = newData; _offset = 0; _length = newLength; } size_t String::length() const throw() { return _length; } String String::part(size_t offset, size_t length) const throw(OutOfMemory, OutOfBounds) { if(offset + length > _length) throw OutOfBounds("Offset and/or length is out of bounds", P_SOURCEINFO); return String(*this, offset, length); } String String::left(size_t length) const throw(OutOfMemory, OutOfBounds) { return part(0, length); } String String::right(size_t length) const throw(OutOfMemory, OutOfBounds) { return part(_length - length, length); } void String::makeUnique() const throw(OutOfMemory) { if(_data.useCount() > 1) { // allocate new data structure SharedPtr<Data> newData(new Data); // allocate and copy-construct string data char* newStr = new char[sizeof(Char) * (_length + 8)]; copy_construct((Char*)newStr, data(), _length); // set the copied string data newData->str = (Char*)newStr; newData->size = _length + 8; _data = newData; _offset = 0; _length = _length; } } const Char& String::at(size_t pos) const throw(OutOfBounds) { if(_offset + pos >= _length) throw OutOfBounds("Index is out of bounds", P_SOURCEINFO); return *(data() + pos); } Char& String::at(size_t pos) throw(OutOfMemory, OutOfBounds) { return operator[](pos); } Char& String::operator[](ptrdiff_t pos) throw(OutOfMemory, OutOfBounds) { if(pos >= _length) throw OutOfBounds("Index is out of bounds", P_SOURCEINFO); makeUnique(); // construct Char's that were not yet constructed, but allocated /*if(pos >= _length) size_t ccount = pos - _length; construct(_data->str + _length, ccount); _length += pos + 1; }*/ return *(_data->str + _offset + pos); } String& String::operator=(const String& str) { if(this != &str) { if(_data != str._data) _data = str._data; _offset = str._offset; _length = str._length; } return *this; } String& String::operator=(const char* str) { *this = fromLatin1(str); return *this; } String& String::operator=(const wchar_t* str) { *this = fromUcs2(str); return *this; } bool String::operator==(const String& str) const throw() { if(&str == this || (str.data() == data() && str._length == _length)) return true; if(str._length == _length) { Char* lhsBegin = data(); Char* lhsEnd = data() + _length; Char* rhsBegin = str.data(); while(lhsBegin != lhsEnd) { if(*lhsBegin != *rhsBegin) return false; ++lhsBegin, ++rhsBegin; } return true; } return false; } bool String::operator!=(const String& str) const throw() { return !operator==(str); } bool String::operator<(const String& str) const throw() { //@todo String::operator< } bool String::operator>(const String& str) const throw() { //@todo String::operator> } bool String::operator<=(const String& str) const throw() { return (operator<(str) || operator==(str)); } bool String::operator>=(const String& str) const throw() { return (operator>(str) || operator==(str)); } Char* String::data() const throw() { return _data->str + _offset; } String String::fromLatin1(const char* str, size_t count) throw(OutOfMemory) { if(count == npos) count = strlen(str); Char ch; String str2(count + 8); const char* end = str + count; Char* mystr = str2.data(); while(str != end) { ch = *(str++); copy_construct(mystr++, &ch, 1); } str2._length = count; return str2; } String String::fromUcs2(const wchar_t* str, size_t count) throw(OutOfMemory) { if(count == npos) count = wcslen(str); Char ch; String str2(count + 8); const wchar_t* end = str + count; Char* mystr = str2.data(); while(str != end) { ch = *(str++); copy_construct(mystr++, &ch, 1); } str2._length = count; return str2; } String::Iterator String::begin() { makeUnique(); return Iterator(data()); } String::Iterator String::end() { makeUnique(); return Iterator(data() + _length); } void String::insert(const Iterator& pos, const Char& ch) { /* if(_data.useCount() > 1 || _length + 1 > _data->size) resize(_data->size + 8);*/ } void String::insert(const Iterator& pos, const String& str) { } void String::insert(size_t pos, const Char& ch) { insert(Iterator(data() + pos), ch); } void String::insert(size_t pos, const String& str) { insert(Iterator(data() + pos), str); } void String::append(const Char& ch) { insert(end(), ch); } void String::append(const String& str) { insert(end(), str); } void String::prepend(const Char& ch) { insert(begin(), ch); } void String::prepend(const String& str) { insert(begin(), str); } void String::erase(const Iterator& pos) { } void String::erase(size_t pos) { erase(Iterator(data() + pos)); } String::Iterator::Iterator(const String::Iterator& iter) : _current(iter._current) { } String::Iterator::Iterator(Char* current) : _current(current) { } String::Iterator::~Iterator() { } Char& String::Iterator::operator*() const { return *_current; } String::Iterator& String::Iterator::operator++() { ++_current; return *this; } String::Iterator String::Iterator::operator++(int) { Iterator tmp = *this; ++_current; return tmp; } String::Iterator& String::Iterator::operator--() { --_current; return *this; } String::Iterator String::Iterator::operator--(int) { Iterator tmp = *this; --_current; return tmp; } String::Iterator& String::Iterator::operator=(const String::Iterator& iter) { _current = iter._current; return *this; } bool String::Iterator::operator==(const String::Iterator& iter) const { return (_current == iter._current); } bool String::Iterator::operator!=(const String::Iterator& iter) const { return (_current != iter._current); } } // !namespace Unicode } // !namespace P Index: Makefile.am =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/Unicode/Makefile.am,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- Makefile.am 22 Dec 2004 17:54:37 -0000 1.1.1.1 +++ Makefile.am 23 Dec 2004 04:32:18 -0000 1.2 @@ -8,5 +8,13 @@ unicodedata.h unicodedata_extra.h: wget --passive-ftp http://www.unicode.org/Public/UNIDATA/UnicodeData.txt - awk -f $(top_srcdir)/src/unicode/unicodedata.awk UnicodeData.txt >unicodedata.h + awk -f $(top_srcdir)/src/Unicode/unicodedata.awk UnicodeData.txt >unicodedata.h rm -f UnicodeData.txt + +INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include -I$(top_builddir)/src/Unicode $(all_includes) +METASOURCES = AUTO + +lib_LTLIBRARIES = libpclasses_unicode.la +libpclasses_unicode_la_SOURCES = Char.cpp String.cpp TextStream.cpp +libpclasses_unicode_la_LIBADD = $(top_builddir)/src/libpclasses.la +libpclasses_unicode_la_DEPENDENCIES = $(top_builddir)/src/libpclasses.la $(noinst_HEADERS) --- NEW FILE: TextStream.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/Unicode/TextStream.h" namespace P { namespace Unicode { TextStream::TextStream() : _fmt(Dec), _width(0), _prec(0), _fillCh(' ') { } TextStream::~TextStream() { } void TextStream::setFormat(Format fmt) throw() { _fmt = fmt; } void TextStream::setWidth(unsigned int width) throw() { _width = width; } void TextStream::setPrecision(unsigned int prec) throw() { _prec = prec; } void TextStream::setFill(Char ch) throw() { _fillCh = ch; } TextStream& TextStream::operator<<(const Char& ch) { write(ch); return *this; } TextStream& TextStream::operator<<(const String& str) { write(str); return *this; } TextStream& TextStream::operator<<(Int8 val) { } TextStream& TextStream::operator<<(UInt8 val) { } TextStream& TextStream::operator<<(Int16 val) { } TextStream& TextStream::operator<<(UInt16 val) { } TextStream& TextStream::operator<<(Int32 val) { } TextStream& TextStream::operator<<(UInt32 val) { } #ifdef PCLASSES_HAVE_64BIT_INT TextStream& TextStream::operator<<(Int64 val) { } TextStream& TextStream::operator<<(UInt64 val) { } #endif TextStream& TextStream::operator<<(float val) { } TextStream& TextStream::operator<<(double val) { } #ifdef PCLASSES_HAVE_LONG_DOUBLE TextStream& TextStream::operator<<(long double val) { } #endif TextStream& TextStream::operator<<(TextStream& (*__pfn)(TextStream& strm)) { (*__pfn)(*this); return *this; } void TextStream::write(const Char& ch) { } void TextStream::write(const String& str) { } void TextStream::flush() { } TextStream& endl(TextStream& strm) { #ifdef PCLASSES_WITH_CR_LINEFEED strm.write(Char::cr()); #endif strm.write(Char::nl()); return strm; } TextStream& dec(TextStream& strm) { strm.setFormat(TextStream::Dec); return strm; } TextStream& hex(TextStream& strm) { strm.setFormat(TextStream::Hex); return strm; } TextStream& oct(TextStream& strm) { strm.setFormat(TextStream::Oct); return strm; } } // !namespace Unicode } // !namespace P --- NEW FILE: Char.cpp --- /* * P::Classes - Portable C++ Application Framework * Copyright (C) 2000-2004 Christian Prochnow <cp...@se...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "pclasses/Unicode/Char.h" #include "unicodedata_extra.h" // UNICODE extra character data #include "unicodedata.h" // UNICODE character data namespace P { namespace Unicode { const codePointData* lookupCodePoint(uint32_t codePoint) { unsigned int i = 0; while(codePoints[i].codePoint != (uint32_t)-1) { if(codePoints[i].codePoint == codePoint) return &codePoints[i]; ++i; } return 0; } Char::Char(uint32_t ch) : _char(ch) { } Char::Char(char ch) : _char(ch) { } Char::Char(wchar_t ch) : _char(ch) { } Char::Char(const Char& ch) : _char(ch._char) { } char Char::latin1() const { if(_char < 0x7f) return _char; return '?'; } wchar_t Char::ucs2() const { //@todo return '?'; } bool Char::isNumber() const { bool ret = false; switch(category()) { case Number_DecimalDigit: case Number_Letter: case Number_Other: ret = true; break; default: break; } return ret; } bool Char::isSymbol() const { bool ret = false; switch(category()) { case Symbol_Math: case Symbol_Currency: case Symbol_Modifier: case Symbol_Other: ret = true; default: break; } return ret; } bool Char::isMark() const { bool ret = false; switch(category()) { case Mark_NonSpacing: case Mark_SpacingCombining: case Mark_Enclosing: ret = true; default: break; } return ret; } bool Char::isPunct() const { bool ret = false; switch(category()) { case Punctuation_Connector: case Punctuation_Dash: case Punctuation_Open: case Punctuation_Close: case Punctuation_InitialQuote: case Punctuation_FinalQuote: case Punctuation_Other: ret = true; default: break; } return ret; } bool Char::isLetter() const { bool ret = false; switch(category()) { case Letter_Uppercase: case Letter_Lowercase: case Letter_Titlecase: case Letter_Modifier: case Letter_Other: ret = true; default: break; } return ret; } int Char::toNumber() const { int ret = 0; const codePointData* data = lookupCodePoint(_char); if(data) { switch(category()) { case Number_DecimalDigit: case Number_Letter: { const decimalDigitExtraData* extraData = (const decimalDigitExtraData*)data->extra; ret = extraData->num; } break; case Number_Other: break; default: break; } } return ret; } bool Char::isLower() const { return category() == Letter_Lowercase; } Char Char::toLower() const { const codePointData* data = lookupCodePoint(_char); if(data && data->extra) { const letterExtraData* extraData = (const letterExtraData*)data->extra; return Char(extraData->lower); } return *this; } bool Char::isUpper() const { return category() == Letter_Uppercase; } Char Char::toUpper() const { const codePointData* data = lookupCodePoint(_char); if(data && data->extra) { const letterExtraData* extraData = (const letterExtraData*)data->extra; return Char(extraData->upper); } return *this; } bool Char::isMirrored() const { const codePointData* data = lookupCodePoint(_char); return data->mirrored == 1 ? true : false; } Char::Category Char::category() const { const codePointData* data = lookupCodePoint(_char); return (Char::Category)data->category; } Char::BidiClass Char::bidiClass() const { const codePointData* data = lookupCodePoint(_char); return (Char::BidiClass)data->bidi; } Char::Decomposition Char::decompTag() const { const codePointData* data = lookupCodePoint(_char); return (Char::Decomposition)data->decomp; } Char::CombiningClass Char::combiningClass() const { const codePointData* data = lookupCodePoint(_char); return (Char::CombiningClass)data->combining; } Char& Char::operator=(uint32_t ch) { _char = ch; return *this; } Char& Char::operator=(char ch) { _char = ch; return *this; } Char& Char::operator=(wchar_t ch) { _char = ch; return *this; } Char& Char::operator=(const Char& ch) { _char = ch._char; return *this; } bool Char::operator==(const Char& ch) const { return _char == ch._char; } bool Char::operator!=(const Char& ch) const { return _char != ch._char; } bool Char::operator<(const Char& ch) const { //@todo Char::operator< } bool Char::operator>(const Char& ch) const { //@todo Char::operator> } bool Char::operator<=(const Char& ch) const { return (operator<(ch) || operator==(ch)); } bool Char::operator>=(const Char& ch) const { return (operator>(ch) || operator==(ch)); } const Char& Char::eof() { static Char _eof((char)0); return _eof; } const Char& Char::nl() { static Char _nl('\n'); return _nl; } const Char& Char::cr() { static Char _cr('\r'); return _cr; } } // !namespace Unicode } // !namespace P |
From: Christian P. <cp...@us...> - 2004-12-23 04:32:28
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/Net In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14702/include/pclasses/Net Modified Files: InetAddress.h InetSocket.h NetworkAddress.h Socket.h Log Message: Moved IODevice, IOError into P::IO namespace. Moved Char, String, TextStream into P::Unicode namespace. Index: NetworkAddress.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/Net/NetworkAddress.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- NetworkAddress.h 22 Dec 2004 17:54:41 -0000 1.1.1.1 +++ NetworkAddress.h 23 Dec 2004 04:32:16 -0000 1.2 @@ -18,11 +18,11 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef _P_NetworkAddress_h_ -#define _P_NetworkAddress_h_ +#ifndef P_Net_NetworkAddress_h +#define P_Net_NetworkAddress_h #include <pclasses/BasicTypes.h> -#include <pclasses/String.h> +#include <pclasses/Unicode/String.h> namespace P { @@ -41,7 +41,7 @@ size_t addrLen() const throw(); - virtual String str() const = 0; + virtual Unicode::String str() const = 0; virtual NetworkAddress* clone() const = 0; Index: InetAddress.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/Net/InetAddress.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- InetAddress.h 22 Dec 2004 17:54:40 -0000 1.1.1.1 +++ InetAddress.h 23 Dec 2004 04:32:16 -0000 1.2 @@ -18,8 +18,8 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef _P_InetAddress_h_ -#define _P_InetAddress_h_ +#ifndef P_Net_InetAddress_h +#define P_Net_InetAddress_h #include <pclasses/Net/NetworkAddress.h> @@ -47,7 +47,7 @@ bool isBroadcast() const throw(); bool isLoopback() const throw(); - String str() const; + Unicode::String str() const; InetAddress* clone() const; InetAddress& operator=(uint32_t addr); Index: Socket.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/Net/Socket.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- Socket.h 22 Dec 2004 17:54:40 -0000 1.1.1.1 +++ Socket.h 23 Dec 2004 04:32:16 -0000 1.2 @@ -18,8 +18,11 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ +#ifndef P_Net_Socket_h +#define P_Net_Socket_h + #include <pclasses/BasicTypes.h> -#include <pclasses/IODevice.h> +#include <pclasses/IO/IODevice.h> #include <pclasses/Net/NetworkAddress.h> namespace P { @@ -29,7 +32,7 @@ typedef uint16_t port_t; //! Socket -class Socket: public IODevice { +class Socket: public IO::IODevice { public: enum Domain { Inet, @@ -50,7 +53,7 @@ }; Socket() throw(); - Socket(Domain domain, Type type, int proto) throw(IOError); + Socket(Domain domain, Type type, int proto) throw(IO::IOError); ~Socket() throw(); Domain domain() const throw(); @@ -59,44 +62,44 @@ int protocol() const throw(); - void close() throw(LogicError, IOError); + void close() throw(LogicError, IO::IOError); - size_t read(char* buffer, size_t count) throw(IOError); + size_t read(char* buffer, size_t count) throw(IO::IOError); - size_t peek(char* buffer, size_t count) throw(IOError); + size_t peek(char* buffer, size_t count) throw(IO::IOError); - size_t write(const char* buffer, size_t count) throw(IOError); + size_t write(const char* buffer, size_t count) throw(IO::IOError); - int wait(int wait, unsigned int timeout) throw(IOError); + int wait(int wait, unsigned int timeout) throw(IO::IOError); //! Bind socket to given address and port - void bind(const NetworkAddress& addr, port_t port) throw(IOError); + void bind(const NetworkAddress& addr, port_t port) throw(IO::IOError); - void setSendTimeout(unsigned int timeout) throw(IOError); - unsigned int sendTimeout() const throw(IOError); + void setSendTimeout(unsigned int timeout) throw(IO::IOError); + unsigned int sendTimeout() const throw(IO::IOError); - void setReceiveTimeout(unsigned int timeout) throw(IOError); - unsigned int receiveTimeout() const throw(IOError); + void setReceiveTimeout(unsigned int timeout) throw(IO::IOError); + unsigned int receiveTimeout() const throw(IO::IOError); - void setSendBufferSize(size_t sz) throw(IOError); - size_t sendBufferSize() const throw(IOError); + void setSendBufferSize(size_t sz) throw(IO::IOError); + size_t sendBufferSize() const throw(IO::IOError); - void setReceiveBufferSize(size_t sz) throw(IOError); - size_t receiveBufferSize() const throw(IOError); + void setReceiveBufferSize(size_t sz) throw(IO::IOError); + size_t receiveBufferSize() const throw(IO::IOError); - void setLinger(bool enable, unsigned int timeout = 10) throw(IOError); + void setLinger(bool enable, unsigned int timeout = 10) throw(IO::IOError); - void setRouting(bool enable) throw(IOError); + void setRouting(bool enable) throw(IO::IOError); protected: void open(Domain domain, Type type, int proto) - throw(LogicError, IOError); + throw(LogicError, IO::IOError); int handle() const throw(); - void addListener(IOListener& l); - void updateListener(IOListener& l); - void removeListener(IOListener& l); + void addListener(IO::IOListener& l); + void updateListener(IO::IOListener& l); + void removeListener(IO::IOListener& l); private: Domain _domain; @@ -111,8 +114,8 @@ DatagramSocket() throw(); ~DatagramSocket() throw(); - void setBroadcast(bool enable) throw(IOError); - bool broadcast() const throw(IOError); + void setBroadcast(bool enable) throw(IO::IOError); + bool broadcast() const throw(IO::IOError); }; @@ -127,3 +130,5 @@ } // !namespace Net } // !namespace P + +#endif Index: InetSocket.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/Net/InetSocket.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- InetSocket.h 22 Dec 2004 17:54:40 -0000 1.1.1.1 +++ InetSocket.h 23 Dec 2004 04:32:16 -0000 1.2 @@ -18,8 +18,8 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef _P_InetSocket_h_ -#define _P_InetSocket_h_ +#ifndef P_Net_InetSocket_h +#define P_Net_InetSocket_h #include <pclasses/Net/Socket.h> #include <pclasses/Net/InetAddress.h> @@ -32,45 +32,45 @@ class InetSocket: public virtual Socket { public: InetSocket() throw(); - InetSocket(Type t, int proto) throw(IOError); + InetSocket(Type t, int proto) throw(IO::IOError); ~InetSocket() throw(); - void setTypeOfSerice(uint8_t type) throw(IOError); - uint8_t typeOfService() const throw(IOError); + void setTypeOfSerice(uint8_t type) throw(IO::IOError); + uint8_t typeOfService() const throw(IO::IOError); - void setTimeToLive(int ttl) throw(IOError); - int timeToLive() const throw(IOError); + void setTimeToLive(int ttl) throw(IO::IOError); + int timeToLive() const throw(IO::IOError); protected: - void open(Type type, int proto) throw(LogicError, IOError); + void open(Type type, int proto) throw(LogicError, IO::IOError); }; //! UDP Datagram Socket class UDPSocket: public InetSocket, public DatagramSocket { public: - UDPSocket() throw(IOError); + UDPSocket() throw(IO::IOError); ~UDPSocket() throw(); - void open() throw(LogicError, IOError); + void open() throw(LogicError, IO::IOError); - void setMulticastTTL(int ttl) throw(IOError); - int multicastTTL() const throw(IOError); + void setMulticastTTL(int ttl) throw(IO::IOError); + int multicastTTL() const throw(IO::IOError); - void setMulticastLoop(bool enable) throw(IOError); - bool multicastLoop() const throw(IOError); + void setMulticastLoop(bool enable) throw(IO::IOError); + bool multicastLoop() const throw(IO::IOError); - void addMembership(const InetAddress& addr) throw(IOError); - void dropMembership(const InetAddress& addr) throw(IOError); + void addMembership(const InetAddress& addr) throw(IO::IOError); + void dropMembership(const InetAddress& addr) throw(IO::IOError); }; //! TCP Streaming Socket class TCPSocket: public InetSocket, public StreamSocket { public: - TCPSocket() throw(IOError); + TCPSocket() throw(IO::IOError); ~TCPSocket() throw(); - void open() throw(LogicError, IOError); + void open() throw(LogicError, IO::IOError); }; |
From: Christian P. <cp...@us...> - 2004-12-23 04:32:28
|
Update of /cvsroot/pclasses/pclasses2/src/IO In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14702/src/IO Added Files: IODevice.cpp IOError.cpp Makefile.am Log Message: Moved IODevice, IOError into P::IO namespace. Moved Char, String, TextStream into P::Unicode namespace. --- NEW FILE: Makefile.am --- INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include $(all_includes) METASOURCES = AUTO lib_LTLIBRARIES = libpclasses_io.la libpclasses_io_la_SOURCES = IOError.cpp IODevice.cpp libpclasses_io_la_LIBADD = $(top_builddir)/src/libpclasses.la $(top_builddir)/src/Unicode/libpclasses_unicode.la --- NEW FILE: IOError.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/IOError.h" namespace P { namespace IO { IOError::IOError(long errorNo, const char* what, const SourceInfo& si) throw() : RuntimeError(what, si), _errorNo(errorNo) { } IOError::IOError(const IOError& err) throw() : RuntimeError(err), _errorNo(err._errorNo) { } IOError::~IOError() throw() { } long IOError::errorNo() const throw() { return _errorNo; } Unicode::String IOError::text() const throw() { //@todo return the real system error text return Unicode::String(); } } // !namespace IO } // !namespace P --- NEW FILE: IODevice.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/IODevice.h" namespace P { namespace IO { IODevice::IODevice() throw() : _valid(false), _access(None), _eof(true) { } IODevice::IODevice(const IODevice& dev) throw() : _valid(dev._valid), _access(dev._access), _eof(dev._eof) { } IODevice::~IODevice() throw() { } IODevice::AccessMode IODevice::access() const throw() { return _access; } size_t IODevice::peek(char* buffer, size_t count) throw(IOError) { return 0; } bool IODevice::isSeekable() const throw() { return false; } offset_t IODevice::seek(offset_t offset, SeekMode mode) throw(IOError) { throw IOError(0, "Could not seek on device", P_SOURCEINFO); } offset_t IODevice::getPos() throw(IOError) { return seek(0, SeekCurrent); } void IODevice::commit() const throw(IOError) { } offset_t IODevice::size() const throw(IOError) { return 0; } bool IODevice::valid() const throw() { return _valid; } bool IODevice::eof() const throw() { return _eof; } void IODevice::setValid(bool v) throw() { _valid = v; } void IODevice::setAccess(AccessMode mode) throw() { _access = mode; } void IODevice::setEof(bool eof) throw() { _eof = eof; } void IODevice::addListener(IOListener& l) { } void IODevice::updateListener(IOListener& l) { } void IODevice::removeListener(IOListener& l) { } IODevice& IODevice::operator=(const IODevice& dev) throw() { _valid = dev._valid; _access = dev._access; _eof = dev._eof; } IOListener::IOListener(IODevice& dev, int eventMask) throw() : _dev(&dev), _eventMask(eventMask) { dev.addListener(*this); } IOListener::~IOListener() throw() { if(_dev) _dev->removeListener(*this); } IODevice& IOListener::device() const throw() { return *_dev; } void IOListener::setDevice(IODevice& dev) throw() { if(_dev) _dev->removeListener(*this); _dev = &dev; _dev->addListener(*this); } int IOListener::eventMask() const throw() { return _eventMask; } void IOListener::setEventMask(int eventMask) throw() { _eventMask = eventMask; } } // !namespace IO } // !namespace P |
From: Christian P. <cp...@us...> - 2004-12-23 04:32:27
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14702/include/pclasses/System Modified Files: File.h Pipe.h SharedLib.h SystemError.h Log Message: Moved IODevice, IOError into P::IO namespace. Moved Char, String, TextStream into P::Unicode namespace. Index: Pipe.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/System/Pipe.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- Pipe.h 22 Dec 2004 17:54:41 -0000 1.1.1.1 +++ Pipe.h 23 Dec 2004 04:32:17 -0000 1.2 @@ -22,32 +22,32 @@ #define P_System_Pipe_h #include <pclasses/Pair.h> -#include <pclasses/IODevice.h> +#include <pclasses/IO/IODevice.h> namespace P { namespace System { //! Anonymous pipe device -class Pipe: public IODevice { +class Pipe: public IO::IODevice { public: typedef P::Pair<Pipe> Pair; - Pipe(const Pipe& f) throw(IOError); + Pipe(const Pipe& f) throw(IO::IOError); ~Pipe() throw(); - static Pair create() throw(IOError); + static Pair create() throw(IO::IOError); - void close() throw(LogicError, IOError); + void close() throw(LogicError, IO::IOError); - size_t read(char* buffer, size_t count) throw(IOError); + size_t read(char* buffer, size_t count) throw(IO::IOError); - size_t write(const char* buffer, size_t count) throw(IOError); + size_t write(const char* buffer, size_t count) throw(IO::IOError); - void commit() const throw(IOError); + void commit() const throw(IO::IOError); - Pipe& operator=(const Pipe& f) throw(IOError); + Pipe& operator=(const Pipe& f) throw(IO::IOError); private: struct Handle; Index: SystemError.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/System/SystemError.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- SystemError.h 22 Dec 2004 17:54:42 -0000 1.1.1.1 +++ SystemError.h 23 Dec 2004 04:32:17 -0000 1.2 @@ -23,7 +23,7 @@ #include <pclasses/SourceInfo.h> #include <pclasses/Exception.h> -#include <pclasses/String.h> +#include <pclasses/Unicode/String.h> namespace P { @@ -50,7 +50,7 @@ long errorNo() const throw(); //! Returns the system error text - String text() const throw(); + Unicode::String text() const throw(); private: long _errorNo; Index: SharedLib.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/System/SharedLib.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- SharedLib.h 22 Dec 2004 17:54:41 -0000 1.1.1.1 +++ SharedLib.h 23 Dec 2004 04:32:17 -0000 1.2 @@ -22,7 +22,7 @@ #define P_System_SharedLib_h #include <pclasses/NonCopyable.h> -#include <pclasses/String.h> +#include <pclasses/Unicode/String.h> #include <pclasses/System/SystemError.h> namespace P { @@ -58,7 +58,7 @@ \param mode binding mode when loading the library \throw SystemError */ - SharedLib(const String& name, BindMode mode = BindLazy) + SharedLib(const Unicode::String& name, BindMode mode = BindLazy) throw(SystemError); //! Destructor Index: File.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/System/File.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- File.h 22 Dec 2004 17:54:41 -0000 1.1.1.1 +++ File.h 23 Dec 2004 04:32:16 -0000 1.2 @@ -21,43 +21,43 @@ #ifndef P_System_File_h #define P_System_File_h -#include <pclasses/IODevice.h> +#include <pclasses/IO/IODevice.h> namespace P { namespace System { -class File: public IODevice { +class File: public IO::IODevice { public: File() throw(); - File(const File& f) throw(IOError); + File(const File& f) throw(IO::IOError); File(const char* name, OpenMode omode, AccessMode amode, - ShareMode smode) throw(IOError); + ShareMode smode) throw(IO::IOError); ~File() throw(); void open(const char* name, OpenMode omode, AccessMode amode, - ShareMode smode) throw(LogicError, IOError); + ShareMode smode) throw(LogicError, IO::IOError); - void close() throw(LogicError, IOError); + void close() throw(LogicError, IO::IOError); - size_t read(char* buffer, size_t count) throw(IOError); + size_t read(char* buffer, size_t count) throw(IO::IOError); - size_t peek(char* buffer, size_t count) throw(IOError); + size_t peek(char* buffer, size_t count) throw(IO::IOError); - size_t write(const char* buffer, size_t count) throw(IOError); + size_t write(const char* buffer, size_t count) throw(IO::IOError); - offset_t seek(offset_t offset, SeekMode mode) throw(IOError); + offset_t seek(offset_t offset, SeekMode mode) throw(IO::IOError); bool isSeekable() const throw(); - void commit() const throw(IOError); + void commit() const throw(IO::IOError); - offset_t size() const throw(IOError); + offset_t size() const throw(IO::IOError); - File& operator=(const File& f) throw(IOError); + File& operator=(const File& f) throw(IO::IOError); private: struct Handle; |
From: Christian P. <cp...@us...> - 2004-12-23 04:32:27
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/Unicode In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14702/include/pclasses/Unicode Added Files: Char.h Makefile.am String.h TextStream.h Log Message: Moved IODevice, IOError into P::IO namespace. Moved Char, String, TextStream into P::Unicode namespace. --- NEW FILE: Char.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_Unicode_Char_h #define P_Unicode_Char_h #include <pclasses/BasicTypes.h> #include <cwchar> namespace P { namespace Unicode { //! UNICODE 4.0 Compliant character class class Char { public: //! General category enum Category { Mark_NonSpacing, // Mn Mark_SpacingCombining, // Mc Mark_Enclosing, // Me Number_DecimalDigit, // Nd Number_Letter, // Nl Number_Other, // No Separator_Space, // Zs Separator_Line, // Zl Separator_Paragraph, // Zp Other_Control, // Cc Other_Format, // Cf Other_Surrogate, // Cs Other_PrivateUse, // Co Other_NotAssigned, // Cn Letter_Uppercase, // Lu Letter_Lowercase, // Ll Letter_Titlecase, // Lt Letter_Modifier, // Lm Letter_Other, // Lo Punctuation_Connector, // Pc Punctuation_Dash, // Pd Punctuation_Open, // Ps Punctuation_Close, // Pe Punctuation_InitialQuote, // Pi Punctuation_FinalQuote, // Pf Punctuation_Other, // Po Symbol_Math, // Sm Symbol_Currency, // Sc Symbol_Modifier, // Sk Symbol_Other // So }; //! Bidirectional Class enum BidiClass { LeftToRight, // L LeftToRightEmbedding, // LRE LeftToRightOverride, // LRO RightToLeft, // R RightToLeftArabic, // AL RightToLeftEmbedding, // RLE RightToLeftOverride, // RLO PopDirectionalFormat, // PDF EuropeanNumber, // EN EuropeanNumberSeparator, // ES EuropeanNumberTerminator, // ET ArabicNumber, // AN CommonNumberSeparator, // CS NonSpacingMark, // NSM BoundaryNeutral, // BN ParagraphSeparator, // B SegmentSeparator, // S Whitespace, // WS OtherNeutrals // ON }; //! Character Decomposition Tag enum Decomposition { NoDecomposition, Font, // <font> NoBreak, // <noBreak> Initial, // <initial> Medial, // <medial> Final, // <final> Isolated, // <isolated> Encircled, // <circle> Superscript, // <super> Subscript, // <sub> Vertical, // <vertical> Wide, // <wide> Narrow, // <narrow> Small, // <small> Square, // <square> Fraction, // <fraction> Compat // <compat> }; //! Canonical Combining Class enum CombiningClass { Combining_Spacing = 0, Combining_Overlays = 1, Combining_Nuktas = 7, Combining_VoicingMarks = 8, Combining_Viramas = 9, Combining_FixedStart = 10, Combining_FixedEnd = 199, Combining_BelowLeftAttached = 200, Combining_BelowAttached = 202, Combining_BelowRightAttached = 204, Combining_LeftAttached = 208, Combining_RightAttached = 210, Combining_AboveLeftAttached = 212, Combining_AboveAttached = 214, Combining_AboveRightAttached = 216, Combining_BelowLeft = 218, Combining_Below = 220, Combining_BelowRight = 222, Combining_Left = 224, Combining_Right = 226, Combining_AboveLeft = 228, Combining_Above = 230, Combining_AboveRight = 232, Combining_DoubleBelow = 233, Combining_DoubleAbove = 234, Combining_IotaSubscript = 240 }; Char(uint32_t ch = 0); Char(char ch); Char(wchar_t ch); Char(const Char& ch); char latin1() const; wchar_t ucs2() const; bool isLetter() const; bool isSymbol() const; bool isPunct() const; bool isMark() const; bool isNumber() const; int toNumber() const; bool isLower() const; Char toLower() const; bool isUpper() const; Char toUpper() const; bool isMirrored() const; Category category() const; BidiClass bidiClass() const; Decomposition decompTag() const; CombiningClass combiningClass() const; Char& operator=(uint32_t ch); Char& operator=(char ch); Char& operator=(wchar_t ch); Char& operator=(const Char& ch); bool operator==(const Char& ch) const; bool operator!=(const Char& ch) const; bool operator<(const Char& ch) const; bool operator>(const Char& ch) const; bool operator<=(const Char& ch) const; bool operator>=(const Char& ch) const; static const Char& eof(); static const Char& nl(); static const Char& cr(); private: uint32_t _char; }; } // !namespace Unicode } // !namespace P #endif --- NEW FILE: Makefile.am --- INCLUDES = METASOURCES = AUTO pkginclude_HEADERS = Char.h String.h TextStream.h --- NEW FILE: String.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_Unicode_String_h #define P_Unicode_String_h #include <pclasses/BasicTypes.h> #include <pclasses/Alloc.h> #include <pclasses/SharedPtr.h> #include <pclasses/ScopedArrayPtr.h> #include <pclasses/Unicode/Char.h> namespace P { namespace Unicode { class String { public: enum { npos = (size_t)-1 }; String(size_t reserve = 8) throw(OutOfMemory); String(const String& str) throw(OutOfMemory); String(const char* str, size_t count = npos) throw(OutOfMemory); String(const wchar_t* str, size_t count = npos) throw(OutOfMemory); ~String() throw(); void swap(String& b); size_t size() const throw(); void resize(size_t sz) throw(OutOfMemory); size_t length() const throw(); const Char& at(size_t index) const throw(OutOfBounds); Char& at(size_t index) throw(OutOfMemory, OutOfBounds); String part(size_t offset, size_t length) const throw(OutOfMemory, OutOfBounds); String left(size_t length) const throw(OutOfMemory, OutOfBounds); String right(size_t length) const throw(OutOfMemory, OutOfBounds); class Iterator { public: Iterator(Char* current); Iterator(const Iterator& iter); ~Iterator(); Char& operator*() const; Iterator& operator++(); Iterator operator++(int); Iterator& operator--(); Iterator operator--(int); Iterator& operator=(const Iterator& iter); bool operator==(const Iterator& iter) const; bool operator!=(const Iterator& iter) const; private: Char* _current; }; Iterator begin(); Iterator end(); void insert(const Iterator& pos, const Char& ch); void insert(size_t pos, const Char& ch); void insert(const Iterator& pos, const String& str); void insert(size_t pos, const String& str); void erase(const Iterator& pos); void erase(size_t pos); void append(const Char& ch); void append(const String& str); void prepend(const Char& ch); void prepend(const String& str); String& operator=(const String& str); String& operator=(const char* str); String& operator=(const wchar_t* str); Char& operator[](ptrdiff_t pos) throw(OutOfMemory, OutOfBounds); bool operator==(const String& str) const throw(); bool operator!=(const String& str) const throw(); bool operator<(const String& str) const throw(); bool operator>(const String& str) const throw(); bool operator<=(const String& str) const throw(); bool operator>=(const String& str) const throw(); static String fromLatin1(const char* str, size_t count = npos) throw(OutOfMemory); static String fromUcs2(const wchar_t* str, size_t count = npos) throw(OutOfMemory); private: //! Private string-data structure struct Data { Char* str; size_t size; }; String(const String& str, size_t offset, size_t length) throw(OutOfMemory); //! Make string unique (not shared) void makeUnique() const throw(OutOfMemory); Char* data() const throw(); void resize(size_t sz, size_t holeOffset, size_t holeLen) throw(OutOfMemory); mutable size_t _offset; mutable size_t _length; mutable SharedPtr<Data> _data; }; } // !namespace Unicode } // !namespace P #endif --- NEW FILE: TextStream.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_Unicode_TextStream_h #define P_Unicode_TextStream_h #include <pclasses/IntTypes.h> #include <pclasses/CircularQueue.h> #include <pclasses/Unicode/String.h> namespace P { namespace Unicode { class TextStreamBuffer { public: TextStreamBuffer(); ~TextStreamBuffer(); }; class TextStream { public: //! Number format enum Format { Hex, /*!< Print numbers in hexadecimal format */ Dec, /*!< Print numbers in decimal format */ Oct /*!< Print numbers in octal fomat */ }; TextStream(); ~TextStream(); //! Set number-format void setFormat(Format fmt) throw(); //! Set width of numbers void setWidth(unsigned int width) throw(); //! Set floating-point precision void setPrecision(unsigned int prec) throw(); //! Set fill-character void setFill(Char ch) throw(); TextStream& operator<<(const Char& ch); TextStream& operator<<(const String& str); TextStream& operator<<(Int8 val); TextStream& operator<<(UInt8 val); TextStream& operator<<(Int16 val); TextStream& operator<<(UInt16 val); TextStream& operator<<(Int32 val); TextStream& operator<<(UInt32 val); #ifdef PCLASSES_HAVE_64BIT_INT TextStream& operator<<(Int64 val); TextStream& operator<<(UInt64 val); #endif TextStream& operator<<(float val); TextStream& operator<<(double val); #ifdef PCLASSES_HAVE_LONG_DOUBLE TextStream& operator<<(long double val); #endif TextStream& operator<<(TextStream& (*pfn)(TextStream& strm)); //! Write character into stream-buffer void write(const Char& ch); //! Write string into stream-buffer void write(const String& str); //! Flush streams output-buffer void flush(); private: Format _fmt; unsigned int _width, _prec; Char _fillCh; }; TextStream& endl(TextStream& strm); TextStream& dec(TextStream& strm); TextStream& hex(TextStream& strm); TextStream& oct(TextStream& strm); } // !namespace Unicode } // !namespace P #endif |
From: Christian P. <cp...@us...> - 2004-12-23 04:32:25
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/IO In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14702/include/pclasses/IO Added Files: IODevice.h IOError.h Makefile.am Log Message: Moved IODevice, IOError into P::IO namespace. Moved Char, String, TextStream into P::Unicode namespace. --- NEW FILE: IODevice.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_IODevice_h #define P_IO_IODevice_h #include <pclasses/BasicTypes.h> #include <pclasses/IO/IOError.h> namespace P { namespace IO { class IOListener; //! I/O Device base class class IODevice { public: friend class IOListener; enum OpenMode { OpenCreate, CreateFail, OpenFail }; enum AccessMode { None = 0x00, Read = 0x01, Write = 0x02, ReadWrite = 0x03 }; enum ShareMode { AllowNone = 0x00, AllowRead = 0x01, AllowWrite = 0x02, AllowReadWrite = 0x03 }; enum SeekMode { SeekSet, SeekCurrent, SeekEnd }; IODevice() throw(); virtual ~IODevice() throw(); virtual void close() throw(LogicError, IOError) = 0; virtual size_t read(char* buffer, size_t count) throw(IOError) = 0; virtual size_t peek(char* buffer, size_t count) throw(IOError); virtual size_t write(const char* buffer, size_t count) throw(IOError) = 0; virtual bool isSeekable() const throw(); virtual offset_t seek(offset_t offset, SeekMode mode) throw(IOError); virtual offset_t getPos() throw(IOError); virtual void commit() const throw(IOError); virtual offset_t size() const throw(IOError); bool valid() const throw(); AccessMode access() const throw(); bool eof() const throw(); protected: IODevice(const IODevice& dev) throw(); IODevice& operator=(const IODevice& dev) throw(); void setValid(bool v) throw(); void setAccess(AccessMode mode) throw(); void setEof(bool eof) throw(); virtual void addListener(IOListener& l); virtual void updateListener(IOListener& l); virtual void removeListener(IOListener& l); private: bool _valid; AccessMode _access; bool _eof; }; class IOListener { public: enum EventFlags { None = 0x0, Read = 0x1, Write = 0x2, ReadWrite = 0x03 }; IOListener(IODevice& dev, int eventMask) throw(); virtual ~IOListener() throw(); IODevice& device() const throw(); void setDevice(IODevice& dev) throw(); int eventMask() const throw(); void setEventMask(int eventMask) throw(); virtual void onRead() = 0; virtual void onWrite() = 0; private: IODevice* _dev; int _eventMask; }; } // !namespace IO } // !namespace P #endif --- NEW FILE: Makefile.am --- INCLUDES = METASOURCES = AUTO pkginclude_HEADERS = IOError.h IODevice.h --- NEW FILE: IOError.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_IOError_h #define P_IO_IOError_h #include <pclasses/Exception.h> #include <pclasses/Unicode/String.h> namespace P { namespace IO { //! I/O Error class class IOError: public RuntimeError { public: IOError(long errorNo, const char* what, const SourceInfo& si) throw(); IOError(const IOError& err) throw(); ~IOError() throw(); long errorNo() const throw(); virtual Unicode::String text() const throw(); private: long _errorNo; }; } // !namespace IO } // !namespace P #endif |
From: stephan b. <sg...@us...> - 2004-12-23 03:23:01
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv444 Modified Files: PathFinder.h Log Message: changed include block so it will not collide with the one from s11n.net Index: PathFinder.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/System/PathFinder.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- PathFinder.h 23 Dec 2004 02:41:16 -0000 1.1 +++ PathFinder.h 23 Dec 2004 03:22:50 -0000 1.2 @@ -1,5 +1,5 @@ -#ifndef cl_PATHFINDER_H -#define cl_PATHFINDER_H +#ifndef p_system_PATHFINDER_H +#define p_system_PATHFINDER_H // Author: stephan beal <st...@s1...> // License: Public Domain @@ -179,4 +179,4 @@ } } // namespaces -#endif // cl_PATHFINDER_H +#endif // p_system_PATHFINDER_H |
From: stephan b. <sg...@us...> - 2004-12-23 02:41:31
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23520/src/System Added Files: PathFinder.cpp Log Message: egg --- NEW FILE: PathFinder.cpp --- // Author: stephan beal <st...@s1...> // License: Public Domain #include <iostream> #include <stdlib.h> // getenv() #if WIN32 # include <io.h> # include <stdio.h> #else # include <unistd.h> #endif #include "PathFinder.hpp" // CERR is a drop-in replacement for std::cerr, but slightly more // decorative. #ifndef CERR #define CERR std::cerr << __FILE__ << ":" << std::dec << __LINE__ << " : " #endif using std::string; using std::ostream; namespace P { namespace System { PathFinder::~PathFinder() { DTOROUT(PathFinder) << this->pathString() << std::endl; } PathFinder::PathFinder( const string & p, const string & e, const string & pathsep ) { this->pathSeparator( pathsep ); this->path( p ); this->extensions( e ); } const string & PathFinder::pathSeparator() const { return ( ( PathFinder * ) this )->pathseparator; } void PathFinder::pathSeparator( const string & sep ) { this->pathseparator = sep; } std::string PathFinder::joinList( const string_list & list, const std::string & separator ) const { std::string ret; unsigned long count = list.size(); unsigned long at = 0; string_list::const_iterator it = list.begin(); string_list::const_iterator et = list.end(); for(; it != et; ++it ) { ret += (*it); if( ++at != count ) ret += separator; } return ret; } string PathFinder::pathString() const { return this->joinList( this->paths, this->pathseparator ); } const PathFinder::string_list & PathFinder::path() const { return this->paths; } string PathFinder::extensionsString() const { return this->joinList( this->exts, this->pathseparator ); } const PathFinder::string_list & PathFinder::extensions() const { return this->exts; } size_t tokenize_to_list( const std::string & str, std::list<std::string> & li, const std::string & sep ) { // internal helper function if( str.empty() ) return 0; size_t c = 0; std::string token; std::string::size_type sz = str.size(); for( std::string::size_type i = 0; i < sz; i++ ) { if( sz-1 == i ) token += str[i]; if( str.find( sep, i ) == i || (sz-1 == i) ) { //CERR << "token="<<token<<std::endl; li.push_back( token ); token = ""; i += sep.size() - 1; continue; } token += str[i]; } return c; } size_t PathFinder::path( const string & p ) { this->paths.erase( this->paths.begin(), this->paths.end() ); return tokenize_to_list( p, this->paths, this->pathseparator ); } size_t PathFinder::path( const PathFinder::string_list & p ) { this->paths = p; return this->paths.size(); } void PathFinder::addPath( const string & p ) { tokenize_to_list( p, this->paths, this->pathseparator ); } size_t PathFinder::extensions( const string & p ) { this->exts.erase( this->exts.begin(), this->exts.end() ); return tokenize_to_list( p, this->exts, this->pathseparator ); } size_t PathFinder::extensions( const PathFinder::string_list & e ) { this->exts = e; return this->exts.size(); } void PathFinder::addExtension( const string & p ) { tokenize_to_list( p, this->exts, this->pathseparator ); } // static bool PathFinder::isAccessible( const string & path ) { #if WIN32 # define CHECKACCESS _access # define CHECKRIGHTS 0 #else # define CHECKACCESS access # define CHECKRIGHTS F_OK #endif return 0 == CHECKACCESS( path.c_str(), CHECKRIGHTS ); #undef CHECKACCESS #undef CHECKRIGHTS } string PathFinder::basename( const std::string & name ) { string::size_type slashat = name.find_last_of( PathFinder::dirSeparator() ); if ( slashat == string::npos ) return name; return name.substr( slashat + 1 ); } std::string PathFinder::dirSeparator() { #if WIN32 return std::string( "\\" ); #else return std::string( "/" ); #endif } string PathFinder::find( const string & resource, bool check_cache ) const { //static const std::string NOT_FOUND = "PathFinder::find() : no findie"; if( resource.empty() ) return resource; #define CHECKPATH(CHECKAT) \ if( ! CHECKAT.empty() && PathFinder::isAccessible( CHECKAT ) ) \ { this->hitcache[resource] = CHECKAT; return CHECKAT; } //CERR << "find( " << resource << " )" << std::endl; if( check_cache ) { std::map <std::string,std::string>::iterator mapiter; mapiter = this->hitcache.find( resource ); if( this->hitcache.end() != mapiter ) return (*mapiter).second; } CHECKPATH( resource ); string_list::const_iterator piter = this->paths.begin(); string_list::const_iterator eiter = this->exts.begin(); string path; string ext; if ( PathFinder::isAccessible( resource ) ) return resource; piter = this->paths.begin(); string checkhere; while ( piter != this->paths.end() ) { path = ( *piter ); if ( !path.empty() ) { path += PathFinder::dirSeparator(); } ++piter; checkhere = path + resource; //CERR << "find( " << resource << " ) checking " << checkhere << std::endl; CHECKPATH( checkhere ); eiter = this->exts.begin(); while ( eiter != this->exts.end() ) { ext = ( *eiter ); ++eiter; checkhere = path + resource + ext; //CERR << "find( " << resource << " ) checking " << checkhere << std::endl; CHECKPATH( checkhere ); } } //CERR << "find( "<<resource<<" ): not found :(" << std::endl; // so arguable: // this->hitcache[resource] = ""; return string(); } void PathFinder::clearCache() { this->hitcache.clear(); } // /** // bin_PathFinder is a PathFinder which uses the environment's PATH by default. // */ // class bin_PathFinder:public PathFinder // { // public: // bin_PathFinder(); // virtual ~ bin_PathFinder(); // }; // bin_PathFinder::bin_PathFinder() : PathFinder( ::getenv( "PATH" ) ) // { // this->extensions( ".sh" ); // #if CONFIG_HAVE_CYGWIN // this->extensions(".exe:.bat"); // #endif // } // bin_PathFinder::~bin_PathFinder() // { // } }} // namespaces |
From: stephan b. <sg...@us...> - 2004-12-23 02:41:29
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23520/include/pclasses/System Added Files: PathFinder.h Log Message: egg --- NEW FILE: PathFinder.h --- #ifndef cl_PATHFINDER_H #define cl_PATHFINDER_H // Author: stephan beal <st...@s1...> // License: Public Domain #include <string> #include <list> #include <map> #include <iostream> // #include <cl/StringList.h> // todo: get rid of this in the public interface. namespace P { namespace System { /** PathFinder searches for keys using a set of prefixes (paths) and suffixes (file extensions). Example: <pre> PathFinder p; p.path( "/lib/lib:/usr/lib/lib" ); p.extensions( ".a:.so" ); cout << p.find( "z" ); </pre> That would print an empty string if it finds nothing, or a string if it finds any of the following: - z - /lib/libz - /lib/libz.a - /lib/libz.so - /usr/lib/libz - /usr/lib/libz.a - /usr/lib/libz.so */ class PathFinder { public: /** A list type returned by some functions. */ typedef std::list<std::string> string_list; /** Creates object with the given path/extension list. */ PathFinder( const std::string & path = std::string(), const std::string & ext = std::string(), const std::string & pathsep = ":" ); virtual ~PathFinder(); /** Returns a ":"-separated string of all paths added via add/path(). */ std::string pathString() const; /** Sets the string used as a separator for the string-based variants of path(), extentions(), etc. */ void pathSeparator( const std::string & sep ); /** Returns the path separator string. Default is ":"; */ const std::string & pathSeparator() const; /** Sets the path to p, which should be a path_separtor()-delimited string. Returns the number of path elements parsed from p. */ virtual size_t path( const std::string & p ); /** Sets the path to the given list of directories. Returns the number of elements in the list. */ virtual size_t path( const string_list & p ); /** Adds p to the path. May be path_separtor()-delimited. */ virtual void addPath( const std::string & p ); /** Adds a "search extension." Sample: finder.extension( ".txt:.TXT" ); Will now try all path combinations with the rightmost characters matching ".txt" or ".TXT" (in that order). Be sure to include a period if you want that searched - that is so this class can be used to find non-files and those with non-traditional extensions, like "foo_EXT". */ virtual void addExtension( const std::string & ext = std::string() ); /** like addExtension(), but overwrites extension list. Returns the number of entries parsed from the string. */ virtual size_t extensions( const std::string & ext ); /** Sets the extensions list to the given list. Returns the number of entries in p. */ virtual size_t extensions( const string_list & p ); /** Returns the pathSeparator()-delimited listed of file suffixes to use when searching for a path. */ std::string extensionsString() const; /** Returns this object's extensions list. */ const string_list & extensions() const; /** Helper function to collapse a list into a string. */ std::string joinList( const string_list & list, const std::string & separator ) const; /** Returns true if path is readable. */ static bool isAccessible( const std::string & path ); /** Returns the "base name" of the given string: any part following the final directory separator character. */ static std::string basename( const std::string & ); /** Returns a platform-dependent path separator. This is set when the class is compiled. */ static std::string dirSeparator(); /** Returns the full path of the given resource, provided it could be found in all paths or with all extensions added and provided it is readable. Note that this might return a relative path, especially if the resourcename passed to it immediately resolves to an existing resource. It returns an empty string if the resourcename cannot be found in the filesystem tree (or is otherwise unaccessible). If check_cache is false then this function ignores it's lookup cache and searches again, otherwise it uses a cache. When caching it will always return the same result for any given resourcename. */ std::string find( const std::string & resourcename, bool check_cache = true ) const; /** Empties the hit-cache used by find(). */ void clearCache(); /** Returns a list of all items added via addPath() and path(). */ const string_list & path() const; private: string_list paths; string_list exts; std::string pathseparator; typedef std::map < std::string, std::string > StringStringMap; typedef StringStringMap::iterator StringStringIterator; mutable StringStringMap hitcache; }; } } // namespaces #endif // cl_PATHFINDER_H |
From: stephan b. <sg...@us...> - 2004-12-23 02:31:17
|
Update of /cvsroot/pclasses/pclasses2/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21503 Modified Files: Alloc.cpp Log Message: removed a shadowed var. changed an implicite default pointer to 0. Index: Alloc.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/Alloc.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- Alloc.cpp 22 Dec 2004 17:54:34 -0000 1.1.1.1 +++ Alloc.cpp 23 Dec 2004 02:31:07 -0000 1.2 @@ -62,10 +62,10 @@ void* operator new(size_t sz) throw(OutOfMemory) { - void* ret; + void * ret = 0; try { - void* ret = ::operator new(sz); + ret = ::operator new(sz); } catch(std::bad_alloc& e) { |