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-28 16:43:21
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18260 Modified Files: FactoryReg.h Log Message: Added a missing undef. i have no idea how this has been compiling so far. :/ Index: FactoryReg.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/FactoryReg.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- FactoryReg.h 25 Dec 2004 20:55:04 -0000 1.4 +++ FactoryReg.h 28 Dec 2004 16:43:12 -0000 1.5 @@ -97,6 +97,7 @@ FACTORY_INSTANCE_.registerFactory( PFACREG_TYPE_NAME, FACTORY_FUNCTION_ ), true); # undef FACTORY_FUNCTION_ +# undef FACTORY_INSTANCE_ } // anon namespace #ifdef PFACREG_TYPE_IS_ABSTRACT |
From: stephan b. <sg...@us...> - 2004-12-28 16:12:01
|
Update of /cvsroot/pclasses/pclasses2/src/s11n In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10946/src/s11n Modified Files: Makefile.toc Log Message: Re-added S11nNode class to SOURCES. Index: Makefile.toc =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/s11n/Makefile.toc,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- Makefile.toc 28 Dec 2004 16:01:06 -0000 1.11 +++ Makefile.toc 28 Dec 2004 16:11:07 -0000 1.12 @@ -9,9 +9,9 @@ data_node.cpp \ s11n.cpp \ s11n_node.cpp \ + S11nNode.cpp \ SIO.cpp -# S11nNode.cpp # string_util.cpp |
From: stephan b. <sg...@us...> - 2004-12-28 16:09:52
|
Update of /cvsroot/pclasses/pclasses2/src/s11n/proxy In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10207/src/s11n/proxy Modified Files: Makefile.toc Log Message: Now actually does something. Index: Makefile.toc =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/s11n/proxy/Makefile.toc,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Makefile.toc 28 Dec 2004 00:54:04 -0000 1.1 +++ Makefile.toc 28 Dec 2004 16:09:38 -0000 1.2 @@ -2,6 +2,15 @@ include toc.make -DIST_FILES += createProxyStubHeader.sh +HEADERS = $(wildcard *.h) + +DIST_FILES += \ + $(HEADERS) \ + createProxyStubHeader.sh + +SYMLINK_HEADERS = $(HEADERS) +SYMLINK_HEADERS_DEST = $(top_srcdir)/include/pclasses/s11n/proxy +include $(TOC_MAKESDIR)/SYMLINK_HEADERS.make + +all: SYMLINK_HEADERS -all: |
From: stephan b. <sg...@us...> - 2004-12-28 16:09:32
|
Update of /cvsroot/pclasses/pclasses2/src/s11n/proxy In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10046/src/s11n/proxy Modified Files: SimplePropertyStore_s11n.h Log Message: Added missing namespaces and an #endif. Index: SimplePropertyStore_s11n.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/s11n/proxy/SimplePropertyStore_s11n.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- SimplePropertyStore_s11n.h 28 Dec 2004 15:51:05 -0000 1.1 +++ SimplePropertyStore_s11n.h 28 Dec 2004 16:08:59 -0000 1.2 @@ -6,9 +6,12 @@ #if !defined(p_UTIL_SIMPLEPRPOPERTYSTORE_REGISTERED_WITH_S11N) # define p_UTIL_SIMPLEPRPOPERTYSTORE_REGISTERED_WITH_S11N 1 -# define PS11N_TYPE SimplePropertyStore -# define PS11N_TYPE_NAME "SimplePropertyStore" +# define PS11N_TYPE ::P::Util::SimplePropertyStore +# define PS11N_TYPE_NAME "P::Util::SimplePropertyStore" # define PS11N_SERIALIZE_FUNCTOR ::P::s11n::map::streamable_map_serializable_proxy # include <pclasses/s11n/reg_serializable_traits.h> #endif // p_UTIL_SIMPLEPRPOPERTYSTORE_REGISTERED_WITH_S11N + +#endif // PCLASSES_S11N_INCLUDED +//////////////////////////////////////////////////////////////////////// |
From: stephan b. <sg...@us...> - 2004-12-28 16:05:24
|
Update of /cvsroot/pclasses/pclasses2/src/s11n In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7948/src/s11n Modified Files: S11nNode.h Log Message: Added some API docs. Index: S11nNode.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/s11n/S11nNode.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- S11nNode.h 28 Dec 2004 04:14:37 -0000 1.1 +++ S11nNode.h 28 Dec 2004 16:05:15 -0000 1.2 @@ -8,6 +8,24 @@ namespace P { namespace SIO { + /** + The concrete "data node" type used by serialization operations. + + Note that it is considered poor form to use an S11nNode's + API directly, as it's type and interface may change. The + only guaranty the SIO API gives regarding S11nNode's API is + that NodeTraits::funcname(S11nNode &...) operations will work + as expected/documented. More clearly: use NodeTraits to + manipulate and query nodes, not the node API directly. In + fact S11nNode's useful API is all private, so you CAN'T + touch it without going through NodeTraits. :) Gotcha! + + The API for this class is documented in + P::Util::SimplePropertyStore. The conventions for it's + use in s11n are defined in the s11n library manual + (http://s11n.net/download/). + + */ class S11nNode : public ::P::Util::SimplePropertyStore { public: |
From: stephan b. <sg...@us...> - 2004-12-28 16:04:52
|
Update of /cvsroot/pclasses/pclasses2/src/s11n In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7851/src/s11n Modified Files: SIO.h Log Message: - Added "public" macro PCLASSES_SIO_INCLUDED. - Un-typedef'd S11nNode, as it is now a concrete type. Index: SIO.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/s11n/SIO.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- SIO.h 28 Dec 2004 04:21:41 -0000 1.8 +++ SIO.h 28 Dec 2004 16:04:42 -0000 1.9 @@ -2,6 +2,11 @@ #define p_SIO_H_INCLUDED 1 //////////////////////////////////////////////////////////////////////// +// PCLASSES_SIO_INCLUDED is the "official" way for P code to know if +// SIO is included yet. +#define PCLASSES_SIO_INCLUDED 1 + +//////////////////////////////////////////////////////////////////////// // SIO.h: // Author: stephan beal <st...@s1...> // License: LGPL, copyright(c) 2004, 2005 stephan beal @@ -50,25 +55,12 @@ */ namespace SIO { - /** - The concrete "data node" type used by serialization operations. - - Note that it is considered poor form to use an S11nNode's - API directly, as it's type and interface may change. The - only guaranty the SIO API gives regarding S11nNode's API is - that NodeTraits::funcname(S11nNode &...) operations will work - as expected/documented. More clearly: use NodeTraits to - manipulate and query nodes, not the node API directly. In - fact S11nNode's useful API is all private, so you CAN'T - touch it without going through NodeTraits. :) Gotcha! - */ -// typedef ::P::s11n::s11n_node S11nNode; /** NodeTraits provide the interface for fetching and manipulating S11nNode data. */ - typedef ::P::s11n::node_traits<S11nNode> NodeTraits; + typedef ::P::s11n::node_traits<S11nNode> NodeTraits; /** The parent type of Serializers supported by this interface. |
From: stephan b. <sg...@us...> - 2004-12-28 16:01:42
|
Update of /cvsroot/pclasses/pclasses2/src/s11n In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5362/src/s11n Modified Files: Makefile.toc Log Message: Added proxy subdir. Index: Makefile.toc =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/s11n/Makefile.toc,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- Makefile.toc 28 Dec 2004 04:19:22 -0000 1.10 +++ Makefile.toc 28 Dec 2004 16:01:06 -0000 1.11 @@ -9,9 +9,10 @@ data_node.cpp \ s11n.cpp \ s11n_node.cpp \ - S11nNode.cpp \ SIO.cpp +# S11nNode.cpp + # string_util.cpp HEADERS = $(wildcard *.h) @@ -59,7 +60,7 @@ test_bin_LDADD = $(LIBP_TESTS_LDADD) $(LIBPSYSTEM_CLIENT_LDADD) $(LIBPUTIL_CLIENT_LDADD) include $(TOC_MAKESDIR)/BIN_PROGRAMS.make -all: symlink-headers subdirs SHARED_LIBS +all: symlink-headers subdir-io SHARED_LIBS subdir-proxy # BIN_PROGRAMS |
From: stephan b. <sg...@us...> - 2004-12-28 16:00:43
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/Util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5077/include/pclasses/Util Modified Files: SimplePropertyStore.h Log Message: Added note about how to use this class with SIO. Index: SimplePropertyStore.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/Util/SimplePropertyStore.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- SimplePropertyStore.h 27 Dec 2004 23:14:10 -0000 1.3 +++ SimplePropertyStore.h 28 Dec 2004 16:00:27 -0000 1.4 @@ -33,6 +33,12 @@ It follows STL container conventions, so it can be used in many container contexts and with many generic algorithms. + If you want this class to work with the SIO framework you + must include the following header: + + <pclasses/s11n/proxy/SimplePropertyStore_s11n.h> + + AFTER including SIO.h. */ class SimplePropertyStore |
From: stephan b. <sg...@us...> - 2004-12-28 15:56:37
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/Util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3385/include/pclasses/Util Modified Files: LexT.h Log Message: - Moved the s11n proxy support to another file. - "Fixed" the istream>> to not skip newlines (but the impl is still very arguable). Index: LexT.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/Util/LexT.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- LexT.h 26 Dec 2004 14:43:03 -0000 1.3 +++ LexT.h 28 Dec 2004 15:56:23 -0000 1.4 @@ -1,7 +1,9 @@ #ifndef p_UTIL_LEXT_HPP_INCLUDED #define p_UTIL_LEXT_HPP_INCLUDED 1 //////////////////////////////////////////////////////////////////////// -// LexT.h: the P::Util::LexT class +// LexT.h: the P::Util::LexT class, a simple class for lexically casting +// i/ostreamable types. +// // author: st...@s1... // License: Public Domain //////////////////////////////////////////////////////////////////////// @@ -15,6 +17,9 @@ /** The functions in the Private namespace should not be used by client code. + + TODO: get rid of this stuff and use P::Util::StringTool + instead. */ namespace Private { @@ -165,13 +170,22 @@ This software is released into the Public Domain by it's author, stephan beal (st...@s1...). + If you want this class to work with the SIO framework you + must include the following header: + + <pclasses/s11n/proxy/LexT_s11n.h> + + Change history: + 28 Dec 2004: + - Changed the impl of istream>>() to use getc() instead of getline(), + so newlines are preserved. + 25 Dec 2004: - Ported into the P::Classes tree. Renamed the class and some functions for P's naming conventions. - 25 Nov 2004: - Minor doc updates. - Changed multiple-include guard to allow inclusion of this file twice @@ -421,7 +435,12 @@ */ inline std::istream & operator>>( std::istream & is, LexT & a ) { - while( std::getline( is, a.str() ).good() ); + char c; + // while( std::getline( is, a.str() ).good() ); + // ^^^ eeek! strips newlines! + while( ! is.get(c).eof() ) { + a.str().append( &c ); + } return is; } @@ -467,22 +486,3 @@ #endif // p_UTIL_LEXT_HPP_INCLUDED - - -//////////////////////////////////////////////////////////////////////// -#ifdef PCLASSES_S11N_INCLUDED -# ifndef p_UTIL_LEXT_REGISTERED_WITH_S11N -# define p_UTIL_LEXT_REGISTERED_WITH_S11N 1 -// We have s11n! Let's use it! -// Plug in a proxy for LexT, to make it work like a Streamable... -# include <pclasses/s11n/data_node_functor.h> // <-- s11n::streamable_type_serialization_proxy class -# include <pclasses/s11n/pods_streamable.h> // <-- required for s11n 0.9.14+ -# define PS11N_TYPE ::P::Util::LexT // <-- type of object to be treated as a Serializable -# define PS11N_TYPE_NAME "LexT" // <-- class name (for the classloader) -# define PS11N_SERIALIZE_FUNCTOR ::P::s11n::streamable_type_serialization_proxy - // ^^^^ our de/s11n implementation (proxy functor) -# include <pclasses/s11n/reg_serializable_traits.h> // <-- register the above data with s11n -# endif // p_UTIL_LEXT_REGISTERED_WITH_S11N -#endif // PCLASSES_S11N_INCLUDED -//////////////////////////////////////////////////////////////////////// - |
From: stephan b. <sg...@us...> - 2004-12-28 15:55:36
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2912/src/System Modified Files: SharedLib.common.cpp Log Message: Added a cast (const char *) 0, to avoid a potential warning from some compilers about 0 being castable to lots of types. Index: SharedLib.common.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/SharedLib.common.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- SharedLib.common.cpp 28 Dec 2004 15:11:18 -0000 1.1 +++ SharedLib.common.cpp 28 Dec 2004 15:55:16 -0000 1.2 @@ -11,7 +11,7 @@ void* SharedLib::operator[](const std::string& symbol) throw(RuntimeError) { - return operator[](symbol.empty() ? 0 : symbol.c_str()); + return operator[](symbol.empty() ? (const char *)0 : symbol.c_str()); // ^^^ the 0 is to force operator[const char*] to throw a // runtime error. We don't throw it here because we want to // inherit the platform-specific op[char*]'s throw behaviour. |
From: stephan b. <sg...@us...> - 2004-12-28 15:51:28
|
Update of /cvsroot/pclasses/pclasses2/src/s11n/proxy In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1931 Modified Files: createRegSerTraits.sh Log Message: added -ios shortcut for iostreamables. Index: createRegSerTraits.sh =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/s11n/proxy/createRegSerTraits.sh,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- createRegSerTraits.sh 28 Dec 2004 01:10:47 -0000 1.2 +++ createRegSerTraits.sh 28 Dec 2004 15:51:17 -0000 1.3 @@ -62,6 +62,10 @@ Like -list-ios, but for maps. Both key and value types must be i/ostreamable. + -ios + Like -list, but installs a proxy which works using + the i/ostream operators of SerializableClass. + EOF } # show_help() @@ -71,7 +75,7 @@ i_proxy_list_s='${o_sns}::list::streamable_list_serializable_proxy' i_proxy_map='${o_sns}::map::map_serializable_proxy' i_proxy_map_s='${o_sns}::map::streamable_map_serializable_proxy' - +i_proxy_s='${o_sns}::streamable_type_serialization_proxy' ############################## args parsing... while test x != "x$1"; do @@ -111,6 +115,10 @@ shift continue ;; + -ios) + : ${o_proxy="$(eval echo ${i_proxy_s})"} + continue + ;; -list) : ${o_proxy="$(eval echo ${i_proxy_list})"} continue @@ -147,6 +155,7 @@ : ${o_base=${o_class}} : ${o_reg_h="<pclasses/s11n/reg_serializable_traits.h>"} : ${o_show_help=0} +: ${o_macro_prefix=P} # prefix for registration macros. Use 'P' for P::s11n @@ -163,13 +172,16 @@ do_proxy_reg=1 +DEFP=${o_macro_prefix} +test ${o_sns} = "s11n" && DEFP="" # the s11n.net tree + test x1 = "x${do_proxy_reg}" && { # Note the use of HARD TABS in the <<-EOF!!! cat <<-EOF - #define PS11N_TYPE ${o_class} - #define PS11N_TYPE_NAME "${o_clname}" - #define PS11N_SERIALIZE_FUNCTOR ${o_proxy} + #define ${DEFP}S11N_TYPE ${o_class} + #define ${DEFP}S11N_TYPE_NAME "${o_clname}" + #define ${DEFP}S11N_SERIALIZE_FUNCTOR ${o_proxy} EOF test "${o_class}" != "${o_base}" && \ |
From: stephan b. <sg...@us...> - 2004-12-28 15:51:14
|
Update of /cvsroot/pclasses/pclasses2/src/s11n/proxy In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1893 Added Files: LexT_s11n.h SimplePropertyStore_s11n.h Log Message: egg --- NEW FILE: LexT_s11n.h --- //////////////////////////////////////////////////////////////////////// // Defines an s11n proxy for the LexT type. // Should be included from any code which wants to de/serialize // a LexT using the standard s11n interface. // // Conventions: // - Clients must include SIO support before including this. //////////////////////////////////////////////////////////////////////// #if !defined(PCLASSES_S11N_INCLUDED) # error "s11n.h or SIO.h must be included before plugging in s11n proxies!" #else #if !defined(p_UTIL_LEXT_REGISTERED_WITH_S11N) # define p_UTIL_LEXT_REGISTERED_WITH_S11N 1 # include <pclasses/Util/LexT.h> // better safe than sorry. # define PS11N_TYPE P::Util::LexT # define PS11N_TYPE_NAME "LexT" # define PS11N_SERIALIZE_FUNCTOR ::P::s11n::streamable_type_serialization_proxy # include <pclasses/s11n/reg_serializable_traits.h> #endif // p_UTIL_LEXT_REGISTERED_WITH_S11N #endif // PCLASSES_S11N_INCLUDED //////////////////////////////////////////////////////////////////////// --- NEW FILE: SimplePropertyStore_s11n.h --- #if !defined(PCLASSES_S11N_INCLUDED) # error "s11n.h or SIO.h must be included before plugging in s11n proxies!" #else #include "LexT_s11n.h" #if !defined(p_UTIL_SIMPLEPRPOPERTYSTORE_REGISTERED_WITH_S11N) # define p_UTIL_SIMPLEPRPOPERTYSTORE_REGISTERED_WITH_S11N 1 # define PS11N_TYPE SimplePropertyStore # define PS11N_TYPE_NAME "SimplePropertyStore" # define PS11N_SERIALIZE_FUNCTOR ::P::s11n::map::streamable_map_serializable_proxy # include <pclasses/s11n/reg_serializable_traits.h> #endif // p_UTIL_SIMPLEPRPOPERTYSTORE_REGISTERED_WITH_S11N |
From: stephan b. <sg...@us...> - 2004-12-28 15:11:29
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25183 Added Files: SharedLib.common.cpp Log Message: egg --- NEW FILE: SharedLib.common.cpp --- #include "pclasses/Phoenix.h" #include "pclasses/System/SharedLib.h" #include <list> #ifndef CERR #define CERR std::cerr << __FILE__ << ":" << std::dec << __LINE__ << " : " #endif namespace P { namespace System { void* SharedLib::operator[](const std::string& symbol) throw(RuntimeError) { return operator[](symbol.empty() ? 0 : symbol.c_str()); // ^^^ the 0 is to force operator[const char*] to throw a // runtime error. We don't throw it here because we want to // inherit the platform-specific op[char*]'s throw behaviour. } /** An internal helper type to clean up a list of SharedLib objects. ContainterT must be compatible with list<SharedLib *>. */ template <typename ContainterT> struct SharedLibCleaner { typedef ContainterT list_t; SharedLibCleaner() { } /** Calls delete() on each entry in container(). */ ~SharedLibCleaner() { typename list_t::iterator it = m_list.begin(); while( m_list.end() != it ) { delete( (*it) ); ++it; } m_list.clear(); } /** Returns this object's container. */ list_t & container() { return this->m_list; } private: list_t m_list; }; /** Internal marker type. */ struct opened_libs_context {}; /** Internal SharedLib container type. */ typedef std::list<SharedLib *> OpenedLibsList; // internal list of libs opened via openSharedLib() OpenedLibsList & opened_shared_libs() { return ::P::Phoenix< SharedLibCleaner<OpenedLibsList>, opened_libs_context> ::instance().container(); } SharedLib * openSharedLib( const std::string & path ) throw(RuntimeError) { //CERR << "openSharedLib("<<path<<")\n"; SharedLib * sh = new SharedLib( path ); //CERR << "OPENED openSharedLib("<<path<<")\n"; // ^^^^ if this throws, the mem is deallocated, right? opened_shared_libs().push_back( sh ); return sh; } } // !namespace System } // !namespace P |
From: stephan b. <sg...@us...> - 2004-12-28 15:11:04
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25062 Modified Files: Makefile.toc Makefile.am Log Message: Renamed SharedLib.generic.cpp ==> SharedLib.common.cpp Index: Makefile.am =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/Makefile.am,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Makefile.am 27 Dec 2004 07:07:20 -0000 1.3 +++ Makefile.am 28 Dec 2004 15:10:52 -0000 1.4 @@ -73,7 +73,7 @@ libpclasses_system_la_SOURCES = timeout.cpp SystemError.cpp \ CriticalSection.cpp Mutex.cpp $(Thread_Sources) \ $(Semaphore_Sources) $(SharedMem_Sources) $(SharedLib_Sources) \ - SharedLib.generic.cpp FileInfo.common.cpp $(IO_Sources) + SharedLib.comon.cpp FileInfo.common.cpp $(IO_Sources) libpclasses_system_la_LDFLAGS = -no-undefined libpclasses_system_la_LIBADD = $(top_builddir)/src/libpclasses.la \ Index: Makefile.toc =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/Makefile.toc,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- Makefile.toc 27 Dec 2004 21:46:01 -0000 1.13 +++ Makefile.toc 28 Dec 2004 15:10:52 -0000 1.14 @@ -19,7 +19,7 @@ PathFinder.cpp \ SystemError.cpp \ timeout.cpp \ - SharedLib.generic.cpp + SharedLib.common.cpp SOURCES_SO_LIBDL = \ |
From: stephan b. <sg...@us...> - 2004-12-28 15:10:49
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25028 Removed Files: SharedLib.generic.cpp Log Message: renamed to SharedLib.common.cpp --- SharedLib.generic.cpp DELETED --- |
From: stephan b. <sg...@us...> - 2004-12-28 04:24:27
|
Update of /cvsroot/pclasses/pclasses2/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16737/test Modified Files: s11nTest.cpp Log Message: Switched back to expat serializers, because it's the only one working at the moment. Index: s11nTest.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/test/s11nTest.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- s11nTest.cpp 26 Dec 2004 14:44:46 -0000 1.5 +++ s11nTest.cpp 28 Dec 2004 04:24:17 -0000 1.6 @@ -1,10 +1,12 @@ #include <pclasses/s11n/s11n_debuggering_macros.h> #include <pclasses/s11n/SIO.h> +#include <pclasses/s11n/io/data_node_format.h> #include <pclasses/s11n/pods_streamable.h> #include <pclasses/s11n/list.h> #include <pclasses/s11n/map.h> #include <pclasses/Util/LexT.h> +#include <pclasses/Util/StringTool.h> #include <memory> // auto_ptr #include <cassert> #include <list> @@ -22,7 +24,7 @@ // me to do :: on the map here: typedef std::map<std::string,::P::Util::LexT> TestMapType; -#define USE_FAT_PROXIES 1 +#define USE_FAT_PROXIES 0 #if ! USE_FAT_PROXIES // install a custom proxy, which doesn't produce as fat // output as the default one for maps: @@ -35,14 +37,18 @@ # define PS11N_TYPE_NAME "TestListType" # define PS11N_SERIALIZE_FUNCTOR ::P::s11n::list::streamable_list_serializable_proxy # include <pclasses/s11n/reg_serializable_traits.h> +# define PS11N_TYPE TestListType2 +# define PS11N_TYPE_NAME "TestListType2" +# define PS11N_SERIALIZE_FUNCTOR ::P::s11n::list::streamable_list_serializable_proxy +# include <pclasses/s11n/reg_serializable_traits.h> #endif // ! USE_FAT_PROXIES #define SERIALIZE(Node,SType,SObj) serialize< SType >( Node, SObj ) #define DESERIALIZE(Node,SType) deserialize< SType >( Node ) +// #define SERIALIZER_CLASS_NAME "parens" #define SERIALIZER_CLASS_NAME "expat" -// #define SERIALIZER_CLASS_NAME "expat" bool test_load( const std::string & fn ) { @@ -61,6 +67,266 @@ return false; } + +struct rd_parse_error : public std::runtime_error +{ + rd_parse_error( const std::string & what ) : std::runtime_error(what) + {} +}; + +/** + rd_parser is an experimental recursive-depth parser intended + to aid in the parsing of s11n-related grammars. + + My first RD parsing code... +*/ +template <typename NodeType> +class rd_parser : public ::P::s11n::io::data_node_tree_builder<NodeType> +{ // ^^^ should probably use containment, instead of subclassing, + // but i'm way too tired to write the extra API wrappers right now... +public: + typedef NodeType node_type; + typedef rd_parser<NodeType> this_type; + + typedef int state_type; + /** + Handler func: + + istream = input source + + this_type = object to update as source is parsed + + state_type = the state number which triggered the call to this + function. This is to allow one function to handle multiple + states. + */ + typedef state_type (*rd_parse_function)( std::istream &, this_type &, state_type state ); + typedef std::map<state_type, rd_parse_function > handler_map; + + rd_parser() throw() : m_is(0) + { + } + + + explicit rd_parser( std::istream & is ) throw() : m_is(&is) + { + } + + virtual ~rd_parser() throw() + { + } + + /** + Maps the given state to the given handler function. + */ + void mapHandler( state_type state, rd_parse_function f ) throw() + { + this->handlers()[state] = f; + } + + /** + Returns the handler for the given state, or 0 if none has + been mapped. + */ + rd_parse_function handler( state_type state ) const throw() + { + typename handler_map::const_iterator it = this->handlers().find( st ), + et = this->handlers().end(); + return (et == it) ? 0 : (*it).second; + } + + /** + Sets this object's input stream and calls the protected + parse_impl() function. + */ + state_type parse( std::istream & is, state_type startState ) throw(rd_parse_error) + { + this->m_is = &is; + return this->parse_impl( this->m_is, startState ); + } + + /** + Sets this object's input stream and calls the protected + parse_impl() function. + */ + state_type parse( state_type startState ) throw(rd_parse_error) + { + return this->parse_impl( startState ); + } + + std::istream & istream() throw(rd_parse_error) + { + if( ! this->m_is ) + { + throw rd_parse_error( "istream(): No input string has been set!" ); + } + return *this->m_is; + } + + void istream( std::istream & is ) + { + this->m_is = &is; + } + +protected: + + /** + Subclasses may override this to kick off the parsing process. + The default implementation loops through mapped handlers until: + + a) not handler is found for a given state, in which case it throws + an rd_parse_error. + + b) a handler returns <= 0, in which case it returns that + number. + + Return values from handlers should be: + + >0 == next state to go to. + + 0 == parsing completed successfuly. + + <0 == error. + + Interpretation of the numbers is client-dependent. + + If this object has no associated input stream, an + rd_parse_error is thrown. + */ + virtual state_type parse_impl( state_type startState ) throw(rd_parse_error) + { + std::istream & is = this->istream(); + state_type st = startState; + state_type ret = 0; + typename handler_map::iterator it = this->handlers().find( st ), + et = this->handlers().end(); + do + { + if( et == it ) + { + P::Util::LexT lex((state_type)st); + throw rd_parse_error(std::string("Unmapped state: ")+lex.str()); + } + ret = ((*it).second)( is, *this, st ); + st = ret; + if( 0 >= ret ) break; + it = this->handlers().find( ret ); + } + while( 1 ); + return ret; + } + + + handler_map & handlers() throw() + { + return this->m_map; + } + const handler_map & handlers() const throw() + { + return this->m_map; + } + + +private: + std::istream & istr() { return *(this->m_is); } + std::istream * m_is; + handler_map m_map; +}; + +std::istream & read_property( std::istream & in, std::string & key, std::string & val ) +{ + unsigned char c; + bool escaped = false; + std::string bK; + std::string bV; + enum State { + InitialState = -1, ReadName = 0, ReadSep = 1, ReadVal = 2 + }; + State state = InitialState; // 0 == read name, 1 == find seperator, 2 == read property + while( in.good() ) + { + c = in.get(); + if( 0 == c ) break; + if( ! in.good() ) break; + if( !escaped && ('\n' == c) ) + { + continue; + } + switch( state ) + { + case InitialState: + if( std::isspace( c ) ) + { + continue; + } + state = ReadName; + bK += c; + continue; + case ReadName: + if( std::isspace( c ) ) + { + state = ReadSep; + continue; + } + bK += c; + continue; + case ReadSep: + if( std::isspace( c ) ) + { + continue; + } + bV += c; + state = ReadVal; + continue; + case ReadVal: + if( (!escaped) && ('\\' == c) ) + { // next char will be considered escaped + escaped = true; + bV += c; + continue; + } + if ( (!escaped) && (')' == c) ) + { + // found a non-escaped paren to close us. + break; + } + escaped = false; + bV += c; + continue; + default: + in.setstate(std::ios::failbit); + break; + } + break; + } + key = bK; + val = bV; + + return in; +} + +int parens_parser() +{ + typedef std::auto_ptr<SerializerInterface> SAP; + std::string serclass = "parens"; + SAP ser = SAP( ::P::Plugin::pluginManager<SerializerInterface>().create( serclass ) ); + assert( ser.get() && "Could not load serializer :(" ); + CERR << "Loaded serializer '"<<serclass<<"'. :)\n"; + + std::string prop = "key.subkey value (part of the property) value \\value\\ final_value\nline 2.\n... line 3."; + CERR << "Pre-translated = ["<<prop<<"]\n"; + ::P::StringTool::translateEntities( prop, ser->entity_translations() ); + CERR << "Translated = ["<<prop<<"]\n"; + std::istringstream pstream(prop); + std::string pkey = "", pval = ""; + read_property( pstream, pkey, pval ); + ::P::StringTool::translateEntities( pval, ser->entity_translations(), true ); + CERR << "Parsed out: key=["<<pkey<<"], val=["<<pval<<"]\n"; + + + return 0; +} + /// i wish i could make this a P::App... int main( int argc, char ** argv ) { @@ -68,6 +334,11 @@ CERR << "P::s11n tests...\n"; + if( 0 ) + { + return parens_parser(); + } + if( 2 == argc ) { return test_load( argv[1] ) ? 0 : 1; |
From: stephan b. <sg...@us...> - 2004-12-28 04:21:50
|
Update of /cvsroot/pclasses/pclasses2/src/s11n In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16177/src/s11n Modified Files: SIO.cpp SIO.h Log Message: Changed S11nNode typedef to a P-native S11nNode type. Index: SIO.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/s11n/SIO.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- SIO.h 27 Dec 2004 23:23:23 -0000 1.7 +++ SIO.h 28 Dec 2004 04:21:41 -0000 1.8 @@ -22,7 +22,7 @@ #include <pclasses/Plugin/Plugin.h> #include <pclasses/s11n/s11n.h> #include <pclasses/s11n/io/serializers.h> - +#include <pclasses/s11n/S11nNode.h> namespace P { @@ -62,7 +62,7 @@ fact S11nNode's useful API is all private, so you CAN'T touch it without going through NodeTraits. :) Gotcha! */ - typedef ::P::s11n::s11n_node S11nNode; +// typedef ::P::s11n::s11n_node S11nNode; /** NodeTraits provide the interface for fetching and Index: SIO.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/s11n/SIO.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- SIO.cpp 26 Dec 2004 09:44:27 -0000 1.4 +++ SIO.cpp 28 Dec 2004 04:21:41 -0000 1.5 @@ -7,6 +7,12 @@ #include <pclasses/s11n/s11n_debuggering_macros.h> #include <pclasses/pclasses-config.h> // PCLASSES_HAVE_LIBEXPAT + +#ifdef PCLASSES_HAVE_LIBEXPAT +// KLUDGE until i get S11nNode fully integrated... +# include "io/expat/expat_serializer.h" +#endif + #define SIO_KEY_DEFAULT_SERIALIZER "/P/SIO/DefaultSerializer" namespace P { @@ -23,6 +29,7 @@ #ifdef PCLASSES_HAVE_LIBEXPAT // @fixme: be more dynamic here, look poking around // libdir/pclasses/*_serializer.so. + ::P::s11n::io::register_serializer< ::P::s11n::io::expat_serializer< S11nNode > >( "s11n::io::expat_serializer", "expat" ); SerializerPluginManager::instance().alias( SIO_KEY_DEFAULT_SERIALIZER, "expat" ); #endif } |
From: stephan b. <sg...@us...> - 2004-12-28 04:21:13
|
Update of /cvsroot/pclasses/pclasses2/src/s11n In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16065/src/s11n Modified Files: s11n_node.cpp Log Message: Namespace-changed-related fixes. Index: s11n_node.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/s11n/s11n_node.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- s11n_node.cpp 26 Dec 2004 00:55:20 -0000 1.2 +++ s11n_node.cpp 28 Dec 2004 04:21:02 -0000 1.3 @@ -65,7 +65,7 @@ ); std::for_each( rhs.children().begin(), rhs.children().end(), - s11n::child_pointer_deep_copier<child_list_type>( this->children() ) + child_pointer_deep_copier<child_list_type>( this->children() ) ); } |
From: stephan b. <sg...@us...> - 2004-12-28 04:20:51
|
Update of /cvsroot/pclasses/pclasses2/src/s11n In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16010/src/s11n Modified Files: s11n_node.h Log Message: Changed child_list_type from vector to list. i don't trust vector's copy ctor - it segfaults sometimes. Index: s11n_node.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/s11n/s11n_node.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- s11n_node.h 26 Dec 2004 12:30:05 -0000 1.5 +++ s11n_node.h 28 Dec 2004 04:20:40 -0000 1.6 @@ -55,7 +55,7 @@ std::list/vector conventions: push_back(), erase(), etc. */ - typedef std::vector<s11n_node *> child_list_type; + typedef std::list<s11n_node *> child_list_type; /** For iterating over properties using STL |
From: stephan b. <sg...@us...> - 2004-12-28 04:19:33
|
Update of /cvsroot/pclasses/pclasses2/src/s11n In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15673/src/s11n Modified Files: Makefile.toc Log Message: Added S11nNode. Index: Makefile.toc =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/s11n/Makefile.toc,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- Makefile.toc 27 Dec 2004 18:04:35 -0000 1.9 +++ Makefile.toc 28 Dec 2004 04:19:22 -0000 1.10 @@ -9,6 +9,7 @@ data_node.cpp \ s11n.cpp \ s11n_node.cpp \ + S11nNode.cpp \ SIO.cpp # string_util.cpp @@ -20,6 +21,7 @@ data_node \ s11n \ s11n_node \ + S11nNode \ SIO \ ) |
From: stephan b. <sg...@us...> - 2004-12-28 04:19:07
|
Update of /cvsroot/pclasses/pclasses2/src/s11n In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15575/src/s11n Modified Files: data_node_algo.h Log Message: Added a reminder note about a bug-in-waiting. Index: data_node_algo.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/s11n/data_node_algo.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- data_node_algo.h 26 Dec 2004 07:53:19 -0000 1.3 +++ data_node_algo.h 28 Dec 2004 04:18:52 -0000 1.4 @@ -93,6 +93,12 @@ target.begin() ), s11n::same_name<NodeT>( name ) ); + // ^^^^ BUG: this only works when NodeT::name() is public, + // as it avoids node_traits<>! + // In 1.1 s11n_node::name() might be made private, and node_traits<> + // will be his only friend. Then this bug will show up. + // s11n::data_node is frozen: he won't change, but s11nlite + // might switch to using s11n_node in 1.1! // you gotta love the STL, man. return target.size() - c; } |
From: stephan b. <sg...@us...> - 2004-12-28 04:18:10
|
Update of /cvsroot/pclasses/pclasses2/src/s11n In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15336/src/s11n Modified Files: data_node_serialize.h Log Message: Moved s11n_api_marshaller from P:: anon namespace to s11n:: anon namespace. Index: data_node_serialize.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/s11n/data_node_serialize.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- data_node_serialize.h 27 Dec 2004 18:24:30 -0000 1.3 +++ data_node_serialize.h 28 Dec 2004 04:18:01 -0000 1.4 @@ -30,102 +30,12 @@ #define NODEERR if(0) CERR // ^^^ a debugging macro -namespace P { -namespace { // anon namespace important for linking reasons, to avoid ODR violations. - - /*** - s11n_api_marshaler is OBSOLETED (as of version 0.9.3) by - s11n_traits. It is implemented in terms of s11n_traits for - backwards compatibility, but it will be phased out at some - point. - - For the default implementation s11n_traits<SerializableT> - is used to marshal the de/serialize() calls. - */ - template <typename SerializableT> - struct s11n_api_marshaler - { - /** - Same as SerializableT. - */ - typedef SerializableT serializable_type; - - /** - Returns s11n_traits<serializable_type>::serialize_functor()( dest, src ). - - It also sets dest's class_name() to ::classname<serializable_type>(), - but this is only suitable for monomorphic serializable_types. - */ - template <typename NodeType> - static bool serialize( NodeType &dest, const serializable_type & src ) - { - typedef s11n::node_traits<NodeType> NTR; - typedef s11n::s11n_traits<serializable_type> STR; - NTR::class_name( dest, ::classname<serializable_type>() ); // only good for monomorphs - return STR::serialize_functor()( dest, src ); - } - - /** - Returns s11n_traits<SerializableT>::deserialize_functor()( src, dest ). - */ - template <typename NodeType> - static bool deserialize( const NodeType & src, serializable_type & dest ) - { - typedef s11n::s11n_traits<serializable_type> STR; - return STR::deserialize_functor()( src, dest ); - } - }; - - /** - A specialization to handle pointer types the same as - reference/value types. It simply translates the pointers - into references. - */ - template <typename SerializableT> - struct s11n_api_marshaler<SerializableT *> - { - /** - The SerializableT templatized type, minus any - pointer part. - */ - typedef SerializableT serializable_type; - - /** - Convenience typedef: this class' parent type. - */ - typedef s11n_api_marshaler<serializable_type> parent_type; - - /** - Returns parent_type::serialize( dest, *src ); - - src must be a valid pointer. - */ - template <typename NodeType> - static bool serialize( NodeType &dest, const serializable_type * src ) - { - if( ! src ) return false; - return parent_type::serialize( dest, *src ); - } - - /** - Returns parent_type::deserialize( src, *dest ); - - dest must be a valid pointer. - */ - template <typename NodeType> - static bool deserialize( const NodeType & src, serializable_type * dest ) - { - if( ! dest ) return false; - return parent_type::deserialize( src, *dest ); - } - }; - -} // anon namespace +namespace P { /********************************************************************** -General Conventions: +s11n general conventions: NodeType should conform to the conventions laid out by s11n::data_node. @@ -159,12 +69,99 @@ These signatures apply for all functors designed to work as de/serializers. +**********************************************************************/ +namespace s11n { -**********************************************************************/ + namespace { // anon namespace important for linking reasons, to avoid ODR violations. + /*** + s11n_api_marshaler is an internal API marshaller for s11n. + See the lib manual for full details. + + For the default implementation s11n_traits<SerializableT> + is used to marshal the de/serialize() calls. + */ + template <typename SerializableT> + struct s11n_api_marshaler + { + /** + Same as SerializableT. + */ + typedef SerializableT serializable_type; + + /** + Returns s11n_traits<serializable_type>::serialize_functor()( dest, src ). + + It also sets dest's class_name() to ::classname<serializable_type>(), + but this is only suitable for monomorphic serializable_types. + */ + template <typename NodeType> + static bool serialize( NodeType &dest, const serializable_type & src ) + { + typedef s11n::node_traits<NodeType> NTR; + typedef s11n::s11n_traits<serializable_type> STR; + NTR::class_name( dest, ::classname<serializable_type>() ); // only good for monomorphs + return STR::serialize_functor()( dest, src ); + } + + /** + Returns s11n_traits<SerializableT>::deserialize_functor()( src, dest ). + */ + template <typename NodeType> + static bool deserialize( const NodeType & src, serializable_type & dest ) + { + typedef s11n::s11n_traits<serializable_type> STR; + return STR::deserialize_functor()( src, dest ); + } + }; + + /** + A specialization to handle pointer types the same as + reference/value types. It simply translates the pointers + into references. + */ + template <typename SerializableT> + struct s11n_api_marshaler<SerializableT *> + { + /** + The SerializableT templatized type, minus any + pointer part. + */ + typedef SerializableT serializable_type; + + /** + Convenience typedef: this class' parent type. + */ + typedef s11n_api_marshaler<serializable_type> parent_type; + + /** + Returns parent_type::serialize( dest, *src ); + + src must be a valid pointer. + */ + template <typename NodeType> + static bool serialize( NodeType &dest, const serializable_type * src ) + { + if( ! src ) return false; + return parent_type::serialize( dest, *src ); + } + + /** + Returns parent_type::deserialize( src, *dest ); + + dest must be a valid pointer. + */ + template <typename NodeType> + static bool deserialize( const NodeType & src, serializable_type * dest ) + { + if( ! dest ) return false; + return parent_type::deserialize( src, *dest ); + } + }; + + } // anon namespace -namespace s11n { /** @@ -176,9 +173,6 @@ { try { -// typedef typename s11n_traits<SerializableT>::serialize_functor Proxy; -// return serialize<DataNodeType,SerializableT,Proxy>( target, src, Proxy() ); -// return Proxy()( target, src ); return s11n_api_marshaler<SerializableT>::serialize( target, src ); } catch(...) @@ -197,9 +191,6 @@ { try { -// typedef typename s11n_traits<DeserializableT>::deserialize_functor Proxy; -// return deserialize<DataNodeType,DeserializableT,Proxy>( src, target, Proxy() ); -// return Proxy()( src, target ); return s11n_api_marshaler<DeserializableT>::deserialize( src, target ); } catch(...) |
From: stephan b. <sg...@us...> - 2004-12-28 04:16:51
|
Update of /cvsroot/pclasses/pclasses2/src/s11n In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15033/src/s11n Modified Files: functor.h Log Message: API doc additions. Minor comparison fix in an operator<(). Index: functor.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/s11n/functor.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- functor.h 26 Dec 2004 00:55:20 -0000 1.2 +++ functor.h 28 Dec 2004 04:16:35 -0000 1.3 @@ -260,15 +260,23 @@ a list of pointers into another list. Designed for use with std::for_each and the like. - ListType must support: + Assuming T is the type contained in ListType, stripped + of any pointer part, then the following must hold: - <code>push_back( value_type * )</code>. + + - List must support <code>push_back( T * )</code>. + + - This must be a valid expression: + + <code>T * t = new T( *p );</code> + + Where p is a passed to this type's operator(). ACHTUNG: This is only useful for non-polymorphic copying. It might be interesting to note that copying - s11n::data_node objects this way is + monomorphic s11n::data_node objects this way is "pseudo-polymorphic" - the copy itself is monomorphic but the data needed to deserialize the proper type from the node is maintained. @@ -361,7 +369,7 @@ bool operator()( const nameable_type * x ) const { - if( ! x ) return false; + if( ! x ) return this->m_name.empty(); return x->name() == this->m_name; } private: |
From: stephan b. <sg...@us...> - 2004-12-28 04:15:43
|
Update of /cvsroot/pclasses/pclasses2/src/s11n/io/expat In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14825/src/s11n/io/expat Modified Files: expat_serializer.h Log Message: Added a kludge to get around some implicit conversion problems when NodeType::map_type::value_type is not a string but pretends to be one (LexT). Index: expat_serializer.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/s11n/io/expat/expat_serializer.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- expat_serializer.h 26 Dec 2004 14:36:29 -0000 1.3 +++ expat_serializer.h 28 Dec 2004 04:15:32 -0000 1.4 @@ -2,6 +2,7 @@ #define s11n_EXPAT_SERIALIZER_HPP_INCLUDED 1 #include <pclasses/Util/StringTool.h> // translateEntities() +#include <pclasses/Util/LexT.h> #include <pclasses/s11n/s11n_debuggering_macros.h> // COUT/CERR #include <pclasses/s11n/io/data_node_format.h> #include <pclasses/s11n/traits.h> // node_traits @@ -82,8 +83,14 @@ bool closed = false; typename NT::const_iterator cit = NT::begin(src), cet = NT::end(src); - std::string propval; - std::string key; + + std::string key; + using ::P::Util::LexT; + LexT propval; + // ^^^ required to get around an + // implicit cast problem when + // map_type::value_type.second is not + // string but tries to act like one. if( cet != cit ) { // got properties? |
From: stephan b. <sg...@us...> - 2004-12-28 04:14:47
|
Update of /cvsroot/pclasses/pclasses2/src/s11n In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14606/src/s11n Added Files: S11nNode.cpp S11nNode.h Log Message: egg. A proof-of-concept data node type which subclasses SimplePropertyStore. Acts as SIO's concrete data node impl. --- NEW FILE: S11nNode.h --- #ifndef s11n_S11NNODE_HPP_INCLUDED #define s11n_S11NNODE_HPP_INCLUDED 1 #include <list> #include <string> #include <pclasses/Util/SimplePropertyStore.h> #include <pclasses/s11n/traits.h> namespace P { namespace SIO { class S11nNode : public ::P::Util::SimplePropertyStore { public: typedef ::P::Util::SimplePropertyStore ParentType; typedef ParentType::map_type map_type; typedef map_type::key_type key; typedef map_type::value_type value; typedef map_type::mapped_type mapped; typedef map_type::iterator iterator; typedef map_type::const_iterator const_iterator; typedef std::list<S11nNode *> child_list_type; S11nNode(); explicit S11nNode( const std::string & name ); virtual ~S11nNode(); S11nNode( const S11nNode & ); S11nNode & operator=( const S11nNode & ); child_list_type & children(); const child_list_type & children() const; std::string name() const; void name( const std::string & n ); void class_name( const std::string & n ); std::string class_name() const; void clear(); // WTF doesn't gcc see the inherited clear() without this??? iterator S11nNode::begin(); const_iterator S11nNode::begin() const; iterator S11nNode::end(); const_iterator S11nNode::end() const; protected: void copy( const S11nNode & rhs ); void clear_properties(); void clear_children(); std::string m_name; // name of this node std::string m_iname; // class_name name of this node child_list_type m_children; // holds child pointers }; } } // namespace P::SIO #endif // s11n_S11NNODE_HPP_INCLUDED --- NEW FILE: S11nNode.cpp --- #include "S11nNode.h" #include "functor.h" // object_deleter, child_pointer_deep_copier namespace P { namespace SIO { #define NODE_CLASS_NAME "S11nNode" #define NODE_DEFAULT_NAME "S11nNode" S11nNode::S11nNode() : ::P::Util::SimplePropertyStore(), m_name(NODE_DEFAULT_NAME), m_iname(NODE_CLASS_NAME) { } S11nNode::S11nNode( const std::string & name ) : ::P::Util::SimplePropertyStore(), m_name(NODE_DEFAULT_NAME), m_iname(NODE_CLASS_NAME) { } S11nNode::S11nNode( const S11nNode &rhs ) { if( &rhs == this ) return; this->copy( rhs ); } S11nNode::~S11nNode() { this->clear(); } S11nNode & S11nNode::operator=( const S11nNode & rhs ) { if( &rhs == this ) return *this; this->copy( rhs ); return *this; } S11nNode::child_list_type & S11nNode::children() { return this->m_children; } const S11nNode::child_list_type & S11nNode::children() const { return this->m_children; } void S11nNode::copy( const S11nNode & rhs ) { if ( &rhs == this ) return; this->clear(); this->name( rhs.name() ); this->class_name( rhs.class_name() ); std::copy( rhs.begin(), rhs.end(), std::insert_iterator<map_type>( this->getMap(), this->getMap().begin() ) ); std::for_each( rhs.children().begin(), rhs.children().end(), ::P::s11n::child_pointer_deep_copier<child_list_type>( this->children() ) ); } void S11nNode::clear() { this->clear_children(); this->clear_properties(); } void S11nNode::class_name( const std::string & n ) { this->m_iname = n; } std::string S11nNode::class_name()const { return this->m_iname; } void S11nNode::name( const std::string & n ) { this->m_name = n; } std::string S11nNode::name() const { return this->m_name; } void S11nNode::clear_properties() { if ( getMap().empty() ) return; getMap().erase( getMap().begin(), getMap().end() ); } void S11nNode::clear_children() { std::for_each( this->children().begin(), this->children().end(), ::P::s11n::object_deleter() ); this->children().clear(); } S11nNode::iterator S11nNode::begin() { return this->getMap().begin(); } S11nNode::const_iterator S11nNode::begin() const { return this->getMap().begin(); } S11nNode::iterator S11nNode::end() { return this->getMap().end(); } S11nNode::const_iterator S11nNode::end() const { return this->getMap().end(); } }} // P::SIO |