From: Fridrich S. <str...@us...> - 2006-06-18 14:44:12
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv8436/src/lib Modified Files: Makefile.am WPGStream.h Added Files: WPGStreamImplementation.cpp WPGStreamImplementation.h libwpg-stream.rc.in Removed Files: WPGStream.cpp Log Message: Separate stream implementation from the rest of the library Index: WPGStream.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGStream.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- WPGStream.h 17 Jun 2006 08:11:53 -0000 1.1 +++ WPGStream.h 18 Jun 2006 14:43:57 -0000 1.2 @@ -29,8 +29,6 @@ namespace libwpg { -class WPGFileStreamPrivate; - class WPGInputStream { public: @@ -39,24 +37,9 @@ virtual long tell() = 0; virtual void seek(long offset) = 0; virtual bool atEnd() = 0; -}; -class WPGFileStream: public WPGInputStream -{ -public: - WPGFileStream(const char* filename); - ~WPGFileStream(); - - virtual unsigned char getc(); - virtual long read(long n, char* buffer); - virtual long tell(); - virtual void seek(long offset); - virtual bool atEnd(); - -private: - WPGFileStreamPrivate* d; - WPGFileStream(const WPGFileStream&); // copy is not allowed - WPGFileStream& operator=(const WPGFileStream&); // assignment is not allowed + virtual bool isOle() = 0; + virtual WPGInputStream *getWPGOleStream() = 0; }; } // namespace wpg --- WPGStream.cpp DELETED --- --- NEW FILE: libwpg-stream.rc.in --- #include <winver.h> VS_VERSION_INFO VERSIONINFO FILEVERSION @WPG_MAJOR_VERSION@,@WPG_MINOR_VERSION@,@WPG_MICRO_VERSION@,BUILDNUMBER PRODUCTVERSION @WPG_MAJOR_VERSION@,@WPG_MINOR_VERSION@,@WPG_MICRO_VERSION@,0 FILEFLAGSMASK 0 FILEFLAGS 0 FILEOS VOS__WINDOWS32 FILETYPE VFT_DLL FILESUBTYPE VFT2_UNKNOWN BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904B0" BEGIN VALUE "CompanyName", "The libwpg developer community" VALUE "FileDescription", "libwpg-stream" VALUE "FileVersion", "@WPG_MAJOR_VERSION@.@WPG_MINOR_VERSION@.@WPG_MICRO_VERSION@.BUILDNUMBER" VALUE "InternalName", "libwpg-stream-1" VALUE "LegalCopyright", "Copyright (C) 2004 Marc Oude Kotte, other contributers" VALUE "OriginalFilename", "libwpg-stream-1.dll" VALUE "ProductName", "libwpg" VALUE "ProductVersion", "@WPG_MAJOR_VERSION@.@WPG_MINOR_VERSION@.@WPG_MICRO_VERSION@" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 1200 END END Index: Makefile.am =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/Makefile.am,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Makefile.am 17 Jun 2006 08:11:53 -0000 1.5 +++ Makefile.am 18 Jun 2006 14:43:57 -0000 1.6 @@ -1,9 +1,11 @@ -EXTRA_DIST = \ - libwpg.rc.in +EXTRA_DIST = \ + libwpg.rc.in \ + libwpg-stream.rc.in # These may be in the builddir too -BUILD_EXTRA_DIST = \ - libwpg.rc +BUILD_EXTRA_DIST = \ + libwpg.rc \ + libwpg-stream.rc if PLATFORM_WIN32 no_undefined = -no-undefined @@ -16,16 +18,18 @@ if OS_WIN32 install-libtool-import-lib: $(INSTALL) .libs/libwpg-1.dll.a $(DESTDIR)$(libdir) + $(INSTALL) .libs/libwpg-stream-1.dll.a $(DESTDIR)$(libdir) uninstall-libtool-import-lib: -rm $(DESTDIR)$(libdir)/libwpg-1.dll.a + -rm $(DESTDIR)$(libdir)/libwpg-stream-1.dll.a else install-libtool-import-lib: uninstall-libtool-import-lib: endif -lib_LTLIBRARIES = libwpg-1.la +lib_LTLIBRARIES = libwpg-1.la libwpg-stream-1.la libwpg_1_includedir = $(includedir)/libwpg-1/libwpg libwpg_1_include_HEADERS = \ libwpg.h \ @@ -45,7 +49,6 @@ libwpg_1_la_LDFLAGS = $(version_info) -export-dynamic $(no_undefined) libwpg_1_la_SOURCES = \ WPGraphics.cpp \ - WPGStream.cpp \ WPGPen.cpp \ WPGPoint.cpp \ WPGHeader.cpp \ @@ -62,11 +65,24 @@ WPG1Parser.h \ WPG2Parser.h \ WPGPaintInterface.h - + +libwpg_stream_1_includedir = $(includedir)/libwpg-1/libwpg +libwpg_stream_1_include_HEADERS = WPGStreamImplementation.h + +libwpg_stream_1_la_LIBADD = $(LIBWPG_LIBS) @LIBWPG_STREAM_WIN32_RESOURCE@ +libwpg_stream_1_la_DEPENDENCIES = @LIBWPG_STREAM_WIN32_RESOURCE@ +libwpg_stream_1_la_LDFLAGS = $(version_info) -export-dynamic $(no_undefined) +libwpg_stream_1_la_SOURCES = WPGStreamImplementation.cpp + + if OS_WIN32 @LIBWPG_WIN32_RESOURCE@ : libwpg.rc $(top_srcdir)/build/win32/lt-compile-resource libwpg.rc @LIBWPG_WIN32_RESOURCE@ + +@LIBWPG_STREAM_WIN32_RESOURCE@ : libwpg.rc + $(top_srcdir)/build/win32/lt-compile-resource libwpg-stream.rc @LIBWPG_STREAM_WIN32_RESOURCE@ + endif --- NEW FILE: WPGStreamImplementation.cpp --- /* libwpg * Copyright (C) 2006 Ariya Hidayat (ar...@kd...) * * This library 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 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02111-1301 USA * * For further information visit http://libwpg.sourceforge.net */ /* "This product is not manufactured, approved, or supported by * Corel Corporation or Corel Corporation Limited." */ #include "WPGStreamImplementation.h" #include <fstream> namespace libwpg { class WPGFileStreamPrivate { public: std::fstream file; }; } // namespace libwpg using namespace libwpg; WPGFileStream::WPGFileStream(const char* filename) { d = new WPGFileStreamPrivate; d->file.open( filename, std::ios::binary | std::ios::in ); } WPGFileStream::~WPGFileStream() { delete d; } unsigned char WPGFileStream::getc() { return d->file.get(); } long WPGFileStream::read(long nbytes, char* buffer) { long nread = 0; if(d->file.good()) { long curpos = d->file.tellg(); d->file.read(buffer, nbytes); nread = (long)d->file.tellg() - curpos; } return nread; } long WPGFileStream::tell() { return d->file.good() ? (long)d->file.tellg() : -1L; } void WPGFileStream::seek(long offset) { if(d->file.good()) d->file.seekg(offset); } bool WPGFileStream::atEnd() { return d->file.eof(); } --- NEW FILE: WPGStreamImplementation.h --- /* libwpg * Copyright (C) 2006 Ariya Hidayat (ar...@kd...) * * This library 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 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02111-1301 USA * * For further information visit http://libwpg.sourceforge.net */ /* "This product is not manufactured, approved, or supported by * Corel Corporation or Corel Corporation Limited." */ #ifndef __WPGSTREAMIMPLEMENTATION_H__ #define __WPGSTREAMIMPLEMENTATION_H__ #include "WPGStream.h" namespace libwpg { class WPGFileStreamPrivate; class WPGFileStream: public WPGInputStream { public: WPGFileStream(const char* filename); ~WPGFileStream(); virtual unsigned char getc(); virtual long read(long n, char* buffer); virtual long tell(); virtual void seek(long offset); virtual bool atEnd(); virtual bool isOle() { return false; }; virtual WPGInputStream *getWPGOleStream() { return 0; }; private: WPGFileStreamPrivate* d; WPGFileStream(const WPGFileStream&); // copy is not allowed WPGFileStream& operator=(const WPGFileStream&); // assignment is not allowed }; } // namespace wpg #endif // __WPGSTREAMIMPLEMENTATION_H__ |