pax_global_header00006660000000000000000000000064135122412610014507gustar00rootroot0000000000000052 comment=d52817d5a3e82ba678680600535912c28c0190f2 zipios++-0.1.7/000077500000000000000000000000001351224126100131575ustar00rootroot00000000000000zipios++-0.1.7/.cvsignore000066400000000000000000000003051351224126100151550ustar00rootroot00000000000000Makefile Makefile.in config.status config.log doc config.cache aclocal.m4 config.guess config.sub configure libtool ltmain.sh autom4te*.cache zipios++.spec depcomp install-sh missing mkinstalldirs zipios++-0.1.7/AUTHORS000066400000000000000000000031261351224126100142310ustar00rootroot00000000000000Main author: Thomas Sondergaard (thomass@deltadata.dk) FreeBSD port maintainer: Ying-Chieh Liao (ijliao@csie.nctu.edu.tw) The files zipios++/directory.h and zipios++/directory.cpp originate from the dir_it library written by Dietmar Kuehl (it's available for download at http://www.boost.org) zipios++.spec contributed by Rui Miguel Silva Seabra libtool/shared library patch contributed by Arkadiusz Miskiewicz (arekm) Russel Winder (r.winder@180sw.com) did the work of amending the code to so as to work with GCC 3.2.1. Ross Burton (r.burton@180sw.com) transformed zipios++.spec into zipios++.spec.in and made it more RedHat tradition conformant. Mark Donszelmann (Mark.Donszelmann@slac.stanford.edu) added gzipoutputstream and made several fixes for Visual C++ 6.0 and 7.0. Mike Salvatore (mike.salvatore@canonical.com) found a bug in zipheadio.h and offered a fix. The code would not check for EOF while reading a Uint32 or Uint16 value. See the infinite_loop.patch for details about the fix. See this blog post for details about the discovery of the bug: https://salvatoresecurity.com/fun-with-fuzzers-how-i-discovered-three-vulnerabilities-part-2-of-3/ Any version before 0.1.7 is considered affected by this bug. There is a corresponding CVE entry you can find here: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-13453 You may also want to consider upgrading your software to use version 2.x, since it has a full coverage set of tests which better insure that the number of potential bugs is very limited. It is also written for C++11. https://github.com/Zipios/Zipios/ zipios++-0.1.7/COPYING000077500000000000000000000575061351224126100142320ustar00rootroot00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS zipios++-0.1.7/INSTALL000077500000000000000000000224321351224126100142160ustar00rootroot00000000000000Installation Instructions ************************* Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. (Caching is disabled by default to prevent problems with accidental use of stale cache files.) If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You only need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not support the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Here is a another example: /bin/bash ./configure CONFIG_SHELL=/bin/bash Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent configuration-related scripts to be executed by `/bin/bash'. `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of the options to `configure', and exit. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. zipios++-0.1.7/Makefile.am000066400000000000000000000026451351224126100152220ustar00rootroot00000000000000 EXTRA_DIST = doxyfile doc/images win32 zipios++.spec.in SUBDIRS = zipios++ src tests DOCTOOL = doxygen DOCCONF = doxyfile .PHONY : ChangeLog ChangeLog : cvs2cl --prune --separate-header --global-opts -z3 .PHONY : doc doc : convert doc/images/zipios++.jpg doc/images/zipios++.eps $(DOCTOOL) $(DOCCONF) .PHONY : devdoc devdoc : $(DOCTOOL) $(DOCCONF) # The first perl one-liner changes the robots meta tag so search # engines will index the first page. The second provides a list of # keywords that are relevant, so the search engine will list this # page if someone types in these keywords. .PHONY : webdoc webdoc : doc $(MAKE) -C doc/latex pdf # $(MAKE) -C doc/latex ps mv doc/latex/refman.pdf doc/html/ # mv doc/latex/refman.ps doc/html/ cp doc/images/webgfx.gif doc/html/ perl -p -i -e 's/content\=\"noindex\"/content\=\"index\,nofollow\"/gi' doc/html/index.html perl -p -i -e 's/\ \ #include #ifdef HAVE_NAMESPACES using namespace std; #endif ], [ list x; x.push_back(5); list::iterator iter(x.begin()); if (iter != x.end()) ++iter; return 0; ] ) ], [ac_cv_cxx_have_stl=yes], [ac_cv_cxx_have_stl=no] ) AC_LANG_POP([C++]) ] ) if test "$ac_cv_cxx_have_stl" = yes ; then AC_DEFINE([HAVE_STL],, [define if the Standard Template Library is available]) fi ]) dnl @synopsis AC_CXX_HAVE_STD dnl dnl If the compiler supports ISO C++ standard library (i.e., can include the dnl files iostream, map, iomanip and cmath}), define HAVE_STD. dnl dnl @version $Id: acinclude.m4,v 1.4 2007/01/29 01:37:18 heikoh Exp $ dnl @author Luc Maisonobe dnl AC_DEFUN([AC_CXX_HAVE_STD], [ AC_CACHE_CHECK( [whether the compiler supports ISO C++ standard library], [ac_cv_cxx_have_std], [ AC_REQUIRE([AC_CXX_NAMESPACES]) AC_LANG_PUSH([C++]) AC_COMPILE_IFELSE( [ AC_LANG_PROGRAM( [ #include #include #include #include #ifdef HAVE_NAMESPACES using namespace std; #endif ], [ return 0; ] ) ], [ac_cv_cxx_have_std=yes], [ac_cv_cxx_have_std=no] ) AC_LANG_POP([C++]) ] ) if test "$ac_cv_cxx_have_std" = yes; then AC_DEFINE([HAVE_STD],, [define if the compiler supports ISO C++ standard library]) fi ]) dnl @synopsis AC_CXX_NAMESPACES dnl dnl If the compiler can prevent names clashes using namespaces, define dnl HAVE_NAMESPACES. dnl dnl @version $Id: acinclude.m4,v 1.4 2007/01/29 01:37:18 heikoh Exp $ dnl @author Luc Maisonobe dnl AC_DEFUN([AC_CXX_NAMESPACES], [ AC_CACHE_CHECK( [whether the compiler implements namespaces], [ac_cv_cxx_namespaces], [ AC_LANG_PUSH([C++]) AC_COMPILE_IFELSE( [ namespace Outer { namespace Inner { int i = 0; } } using namespace Outer::Inner; int main() { return i; } ], [ac_cv_cxx_namespaces=yes], [ac_cv_cxx_namespaces=no] ) AC_LANG_POP([C++]) ] ) if test "$ac_cv_cxx_namespaces" = "yes" ; then AC_DEFINE([HAVE_NAMESPACES],, [define if the compiler implements namespaces]) fi ]) dnl @synopsis AC_CXX_HAVE_SSTREAM dnl dnl If sstream (part of Standard C++ Library) exists dnl define HAVE_SSTREAM. dnl dnl @version ac_cxx_have_std.m4 Tue Mar 28 18:20:26 CEST 2000 dnl @author Thomas Sondergaard thomass@deltadata.dk dnl AC_DEFUN([AC_CXX_HAVE_SSTREAM], [ AC_CACHE_CHECK( [for sstream], [ac_cv_cxx_have_sstream], [ AC_REQUIRE([AC_CXX_NAMESPACES]) AC_LANG_PUSH([C++]) AC_COMPILE_IFELSE( [ AC_LANG_PROGRAM( [ #include #ifdef HAVE_NAMESPACES using namespace std; #endif ], [ return 0; ] ) ], [ac_cv_cxx_have_sstream=yes], [ac_cv_cxx_have_sstream=no] ) AC_LANG_POP([C++]) ] ) if test "$ac_cv_cxx_have_sstream" = yes ; then AC_DEFINE([HAVE_SSTREAM], [1], [define if the compiler supports sstream]) fi ]) dnl @synopsis AC_CXX_HAVE_STD_IOSTREAM dnl dnl If std iostream (part of Standard C++ Library) exists dnl define HAVE_STD_IOSTREAM. dnl dnl @version ac_cxx_have_std.m4 Tue Mar 28 18:20:26 CEST 2000 dnl @author Thomas Sondergaard thomass@deltadata.dk dnl AC_DEFUN([AC_CXX_HAVE_STD_IOSTREAM], [ AC_CACHE_CHECK( [for std iostream], [ac_cv_cxx_have_std_iostream], [ AC_REQUIRE([AC_CXX_NAMESPACES]) AC_LANG_PUSH([C++]) AC_COMPILE_IFELSE( [ AC_LANG_PROGRAM( [ #include #include #include #ifdef HAVE_NAMESPACES using namespace std; #endif ], [ return 0; ] ) ], [ac_cv_cxx_have_std_iostream=yes], [ac_cv_cxx_have_std_iostream=no] ) AC_LANG_POP([C++]) ] ) if test "$ac_cv_cxx_have_std_iostream" = yes ; then AC_DEFINE([HAVE_STD_IOSTREAM],, [define if the compiler has std compliant iostream library]) fi ]) zipios++-0.1.7/autogen.sh000077500000000000000000000000341351224126100151550ustar00rootroot00000000000000#!/bin/sh autoreconf -i $@ zipios++-0.1.7/configure.ac000066400000000000000000000042201351224126100154430ustar00rootroot00000000000000AC_PREREQ(2.59) AC_INIT([zipios++], [0.1.7], [zipios-devel@lists.sourceforge.net], [zipios++]) AC_CONFIG_SRCDIR([src/appendzip.cpp]) AC_CONFIG_HEADER([zipios++/zipios-config.h]) # Use std compliant iostream library if present? AC_ARG_WITH( [std-compliant-iostream], AS_HELP_STRING([--with-std-compliant-iostream], [Include instead of [[yes]]]), [ if test -n "$withval" -a "$withval" != "no" -a "$withval" != "yes" ; then AC_MSG_ERROR([illegal argument specified for --with-std-compliant-iostream. Only 'yes' and 'no' are accepted.]) fi ] ) if test -z "$with_std_compliant_iostream" -o "$with_std_compliant_iostream" = "yes" ; then AC_DEFINE([USE_STD_IOSTREAM], [1], [Define if the std compliant iostream library should be used (if present)]) fi AM_INIT_AUTOMAKE([gnu]) # Checks for programs. AC_PROG_CXX AC_PROG_CC AC_PROG_INSTALL AC_PROG_LIBTOOL # Checks for libraries. # Allow alternate location for zlib AC_ARG_WITH( [zlib], [AS_HELP_STRING([--with-zlib=DIR], [specify location of zlib])], [ AC_MSG_NOTICE([using `$withval' as alternative zlib location]) AC_SUBST([ZLIB_CFLAGS], [-I$withval]) AC_SUBST([ZLIB_LDFLAGS], [-L$withval]) ] ) AC_CHECK_LIB([z], [inflate], , AC_MSG_ERROR([zlib is required to compile $PACKAGE.]), [$ZLIB_LDFLAGS]) AC_CHECK_LIB([z], [zError], AC_DEFINE([HAVE_ZERROR], [1], [Define if zlib has zError]), , [$ZLIB_LDFLAGS]) # This doesn't work on newer version # https://stackoverflow.com/questions/8533879/macro-am-path-cppunit-not-found-in-library #AM_PATH_CPPUNIT(1.6.0) # Checks for header files. AC_HEADER_DIRENT AC_HEADER_STDC AC_CHECK_HEADERS([unistd.h]) AC_CXX_HAVE_STL AC_CXX_HAVE_STD AC_CXX_HAVE_STD_IOSTREAM # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL AC_C_CONST AC_TYPE_UID_T AC_C_INLINE AC_TYPE_MODE_T AC_TYPE_SIZE_T AC_CHECK_MEMBERS([struct stat.st_blksize]) AC_STRUCT_ST_BLOCKS AC_STRUCT_TM AC_CHECK_TYPES([ptrdiff_t]) # Checks for library functions. AC_FUNC_CHOWN AC_FUNC_CLOSEDIR_VOID AC_FUNC_STAT AC_CHECK_FUNCS([uname]) AC_CONFIG_FILES([ Makefile src/Makefile tests/Makefile zipios++/Makefile zipios++.spec ]) AC_OUTPUT zipios++-0.1.7/doc/000077500000000000000000000000001351224126100137245ustar00rootroot00000000000000zipios++-0.1.7/doc/.cvsignore000066400000000000000000000000171351224126100157220ustar00rootroot00000000000000html latex man zipios++-0.1.7/doc/README000066400000000000000000000004411351224126100146030ustar00rootroot00000000000000The documentation for Zipios++ is generated from the source code using Doxygen. You can either use the online documentation at http://zipios.sourceforge.net, or download the pdf version from the same URL, or if you have Doxygen installed you can run 'make doc' in the top-level directory. zipios++-0.1.7/doc/images/000077500000000000000000000000001351224126100151715ustar00rootroot00000000000000zipios++-0.1.7/doc/images/.cvsignore000066400000000000000000000000151351224126100171650ustar00rootroot00000000000000zipios++.eps zipios++-0.1.7/doc/images/webgfx.gif000066400000000000000000000363141351224126100171510ustar00rootroot00000000000000GIF89aXM ) -&))(2/#63&::9P oR-m-H;1y85nDJF6rN0h`?HGFQNDVSK\\\c^XjdKrkMgdWrlSyr[rqn 22;20.#.-,+EDO0N2b?E+PILJlVdLuptlONUUqkpluwƍz˔ꏎˤ즜ȸĺ! NETSCAPE2.0!O,XA>87766% 1A> (%%#4>:  4ʽٿ 6(̿Y{oCx[ =q 3  "a#cv C>Uat֮` -d@N$CƝTE1g@ JI2yp -X.+sgd[ ݐkQ"xO̞ɓoR % [iCѰbcT0(|a1 |eRUuy@ZBQ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ohꙜƸ5u!s)U1vg3)*#:Ap [ tUv6 ;&346rgקZZzi"DuB ӳul?>F wt_v'W [WF6Fhlc;wi2 /8sr?"8%iV ;O(_.uR=Yl-G7Ym/I=r']qko" 갾>b6n~͇X 貎f}ŝ̕ 'Nt-Ûgǚ-,KԴ8xukC4tIh8p7KG=YN ;Ş6qy.6yr\H;-H IsC%3rF$ reuljf}}H|Ls#)Gڢmhhx8;{U.#:v.&[事􈈀D@\ݪn!$2KO_AUW:Q} ̨TFrw{Ɂ\G+튖:НodOspHW in2ao3 p,jFg#'w];-8VBAk?[ktp%MGhd@{!uk:,rX֛ 7}k%qSH(Y6ɮ2})QI;m 3_uVJzcxs˧*oMCXz5I" 9Ӵ“W5,ėAס |"Nk?eOLLUq.Wa`:M]V58\?Wgp_=] ;z;CSWgrv Ao ,~6[ܾMAg F>, U܂: c4mv; }6 8F~ZXw B`w ñͨh>JzXEndoc|flTՙA{lMoDkZ6Y;&/hE5oKsHA.,]v Zn X٪z?·GS|-A>?Fѱt-A5DD@DD# \-vsNKAZzmSR/B6" """ """ "" *a3H!Fkxy*fFWOD* `x:T͠,&@DDD@DDD@DDD@DDD@DDD@DDD@DDD@DDD@DDD@DDD@DD"d>9Ǵ# /7;+cҸAZb~d|q~;\zS)ovܭ҄FYtr<*'XK@vz.$fzd'ⷭoeS"V{_UO5M1ˮW}y7-^l=-{CV" CF7j/{m4DDD@DDD@DDD@DDD@DDD@DDD@DDD@DDD@DDD@DDD@DDD@DDD@DDD@DDD@DDD@DDD@DDD@DDD@DDD@DDD@DDD@DDD@DDD@DDD@DDD@DDD@DDD@X=,GE,&~!=TY/_'h;䯩 57:B9XhO ZM@z&Ԧ2WR6h r?zipios++-0.1.7/doxyfile000066400000000000000000000520001351224126100147220ustar00rootroot00000000000000# Doxyfile 1.1.1 # This file describes the settings to be used by doxygen for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # General configuration options #--------------------------------------------------------------------------- # The PROJECT_NAME tag is a single word (or a sequence of word surrounded # by quotes) that should identify the project. PROJECT_NAME = Zipios++ # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = doc # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Dutch, French, Italian, Czech, Swedish, German and Japanese OUTPUT_LANGUAGE = English # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO # If the EXTRACT_ALL tag is set to YES all classes and functions will be # included in the documentation, even if no documentation was available. EXTRACT_ALL = NO # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members inside documented classes or files. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSESS tag is set to YES, Doxygen will hide all # undocumented classes. HIDE_UNDOC_CLASSES = NO # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = YES # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = NO # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. STRIP_FROM_PATH = # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a class diagram (in Html and LaTeX) for classes with base or # super classes. Setting the tag to NO turns the diagrams off. CLASS_DIAGRAMS = YES # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. SOURCE_BROWSER = YES # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the CASE_SENSE_NAMES tag is set to NO (the default) then Doxygen # will only generate file names in lower case letters. If set to # YES upper case letters are also allowed. This is useful if you have # classes or files whose names only differ in case and if your file system # supports case sensitive file names. CASE_SENSE_NAMES = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the JAVADOC_AUTOBRIEF tag is set to YES (the default) then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the Javadoc-style will # behave just like the Qt-style comments. JAVADOC_AUTOBRIEF = YES # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # reimplements. INHERIT_DOCS = YES # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 8 #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = zipios++/ tests/ src/ # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. FILE_PATTERNS = *.h *.cpp # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = NO # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. EXCLUDE = src/directory.h src/directory.cpp # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. EXCLUDE_PATTERNS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = doc/images # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. INPUT_FILTER = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet HTML_STYLESHEET = # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compressed HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = NO # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = YES # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4wide # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # For now this is experimental and is disabled by default. The RTF output # is optimised for Word 97 and may not look too pretty with other readers # or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using a WORD or other. # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = YES # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. MACRO_EXPANSION = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. PREDEFINED = DOXYGEN # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED tag. EXPAND_ONLY_PREDEF = NO #--------------------------------------------------------------------------- # Configuration options related to external references #--------------------------------------------------------------------------- # The TAGFILES tag can be used to specify one or more tagfiles. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = NO # If the ENABLE_PREPROCESSING, INCLUDE_GRAPH, and HAVE_DOT tags are set to # YES then doxygen will generate a graph for each documented file showing # the direct and indirect include dependencies of the file with other # documented files. INCLUDE_GRAPH = YES # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES #--------------------------------------------------------------------------- # Configuration options related to the search engine #--------------------------------------------------------------------------- # The SEARCHENGINE tag specifies whether or not a search engine should be # used. If set to NO the values of all tags below this one will be ignored. SEARCHENGINE = NO # The CGI_NAME tag should be the name of the CGI script that # starts the search engine (doxysearch) with the correct parameters. # A script with this name will be generated by doxygen. CGI_NAME = search.cgi # The CGI_URL tag should be the absolute URL to the directory where the # cgi binaries are located. See the documentation of your http daemon for # details. CGI_URL = # The DOC_URL tag should be the absolute URL to the directory where the # documentation is located. If left blank the absolute path to the # documentation, with file:// prepended to it, will be used. DOC_URL = # The DOC_ABSPATH tag should be the absolute path to the directory where the # documentation is located. If left blank the directory on the local machine # will be used. DOC_ABSPATH = # The BIN_ABSPATH tag must point to the directory where the doxysearch binary # is installed. BIN_ABSPATH = /usr/local/bin/ # The EXT_DOC_PATHS tag can be used to specify one or more paths to # documentation generated for other projects. This allows doxysearch to search # the documentation for these projects as well. EXT_DOC_PATHS = zipios++-0.1.7/infinite_loop.patch000066400000000000000000000031041351224126100170340ustar00rootroot00000000000000--- a/zipios++/zipheadio.h 2000-09-20 10:46:59.000000000 -0700 +++ b/zipios++/zipheadio.h 2019-07-09 08:23:45.122804315 -0700 @@ -9,6 +9,7 @@ #include "zipios++/ziphead.h" #include "zipios++/zipios_defs.h" +#include "zipios++/fcollexceptions.h" namespace zipios { @@ -79,10 +80,16 @@ inline uint32 readUint32 ( istream &is ) { static const int buf_len = sizeof ( uint32 ) ; unsigned char buf [ buf_len ] ; int rsf = 0 ; - while ( rsf < buf_len ) { + std::streampos original_pos = is.tellg() ; + while ( rsf < buf_len && !is.eof() ) { is.read ( reinterpret_cast< char * >( buf ) + rsf, buf_len - rsf ) ; rsf += static_cast< int >( is.gcount () ) ; } + if ( rsf != buf_len ) { + is.seekg( original_pos ) ; + throw InvalidStateException( "Reached end-of-file while trying to read a" + "Uint32; the zip archive may be corrupt." ) ; + } return ztohl ( buf ) ; } @@ -95,10 +102,16 @@ inline uint16 readUint16 ( istream &is ) { static const int buf_len = sizeof ( uint16 ) ; unsigned char buf [ buf_len ] ; int rsf = 0 ; - while ( rsf < buf_len ) { + std::streampos original_pos = is.tellg() ; + while ( rsf < buf_len && !is.eof() ) { is.read ( reinterpret_cast< char * >( buf ) + rsf, buf_len - rsf ) ; rsf += static_cast< int >( is.gcount () ) ; } + if ( rsf != buf_len ) { + is.seekg( original_pos ) ; + throw InvalidStateException( "Reached end-of-file while trying to read a" + "Uint16; the zip archive may be corrupt." ) ; + } return ztohs ( buf ) ; } zipios++-0.1.7/src/000077500000000000000000000000001351224126100137465ustar00rootroot00000000000000zipios++-0.1.7/src/.cvsignore000066400000000000000000000001521351224126100157440ustar00rootroot00000000000000Makefile Makefile.in stamp-h* appendzip zipios.plg zipios.ncb Debug Release *.lo libzipios.la .deps .libs zipios++-0.1.7/src/Makefile.am000066400000000000000000000013161351224126100160030ustar00rootroot00000000000000 AM_CXXFLAGS = -I$(srcdir)/.. @ZLIB_CFLAGS@ lib_LTLIBRARIES = libzipios.la libzipios_la_LDFLAGS = @ZLIB_LDFLAGS@ libzipios_la_SOURCES = \ backbuffer.h \ basicentry.cpp \ collcoll.cpp \ dircoll.cpp \ directory.cpp \ directory.h \ fcoll.cpp \ fcollexceptions.cpp \ fileentry.cpp \ filepath.cpp \ filterinputstreambuf.cpp \ inflateinputstreambuf.cpp \ outputstringstream.h \ gzipoutputstream.cpp \ gzipoutputstreambuf.cpp \ zipfile.cpp \ ziphead.cpp \ zipheadio.cpp \ zipinputstream.cpp \ zipinputstreambuf.cpp \ zipios_common.h \ filteroutputstreambuf.cpp \ deflateoutputstreambuf.cpp \ zipoutputstreambuf.cpp \ zipoutputstream.cpp noinst_PROGRAMS = appendzip appendzip_SOURCES = appendzip.cppzipios++-0.1.7/src/Makefile.vc000066400000000000000000000061441351224126100160220ustar00rootroot00000000000000# # Will build static and dynamic versions of zipios.lib with Visual C++ 5 & 6 & 7 # ################## DO NOT EDIT BELOW THIS LINE ############################### !message !message ****************** !message Building libraries !message ****************** !message all: static dynamic !include ..\win32\Makefile.com ########################################################################### # # Static library # OBJECTS = basicentry.obj \ collcoll.obj \ dircoll.obj \ directory.obj \ fcoll.obj \ fcollexceptions.obj \ fileentry.obj \ filepath.obj \ filterinputstreambuf.obj \ inflateinputstreambuf.obj \ gzipoutputstream.obj \ gzipoutputstreambuf.obj \ zipfile.obj \ ziphead.obj \ zipheadio.obj \ zipinputstream.obj \ zipinputstreambuf.obj \ filteroutputstreambuf.obj \ deflateoutputstreambuf.obj \ zipoutputstreambuf.obj \ zipoutputstream.obj CPPFLAGS = /nologo /O2 /GX /I.. /D"_WINDOWS" /D"WIN32" /D"NDEBUG" \ /I"$(ZLIB_INC)" ########################################################################### # # DLL # OBJECTS_DLL = basicentry.obl collcoll.obl dircoll.obl directory.obl \ fcoll.obl fcollexceptions.obl fileentry.obl filepath.obl \ filterinputstreambuf.obl inflateinputstreambuf.obl zipfile.obl \ ziphead.obl zipheadio.obl zipinputstream.obl zipinputstreambuf.obl \ filteroutputstreambuf.obl deflateoutputstreambif.obl \ zipoutputstreambuf.obl zipoutputstream.obl ########################################################################### # # Building rules # static: $(ZIPIOS_LIB) $(ZIPIOS_LIB): $(OBJECTS) lib /nologo /out:$(ZIPIOS_LIB) $(OBJECTS) dynamic: $(ZIPIOS_DLL) $(ZIPIOS_DLL): @echo DLL not implemented yet $(OBJECTS): configure clean: tidy @echo *********** @echo Cleaned src @echo *********** @if exist *.obj del *.obj @if exist *.obl del *.obl @if exist $(ZIPIOS_LIB) del $(ZIPIOS_LIB) @if exist $(ZIPIOS_DLL) del $(ZIPIOS_DLL) @if exist $(CONFIG_HDR) del $(CONFIG_HDR) ########################################################################### # Zipios++ - a small C++ library that provides easy access to .zip files. # Copyright (C) 2000 1. Thomas Sndergaard 2. Kevin Shea # Written by Kevin Shea # 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 ############################################################################ zipios++-0.1.7/src/appendzip.cpp000066400000000000000000000043671351224126100164560ustar00rootroot00000000000000#include "zipios++/zipios-config.h" #include "zipios++/meta-iostreams.h" #include "zipios++/ziphead.h" #include "zipios++/zipheadio.h" #include using namespace std ; using namespace zipios ; char *_progname ; void printUsage() ; void exitUsage( int exit_code ) ; int main( int argc, char *argv[] ) { _progname = argv[ 0 ] ; if ( argc != 3 ) exitUsage( 1 ) ; ofstream exef( argv[ 1 ], ios::app | ios::binary ) ; if( ! exef ) { cout << "Error: Unable to open " << argv[ 1 ] << " for writing" << endl ; exitUsage( 1 ) ; } ifstream zipf( argv[ 2 ], ios::in | ios::binary ) ; if( ! zipf ) { cout << "Error: Unable to open " << argv[ 2 ] << " for reading." << endl ; exitUsage( 1 ) ; } // get eof pos (to become zip file starting position). uint32 zip_start = exef.tellp() ; cout << "zip start will be at " << zip_start << endl ; // Append zip file to exe file exef << zipf.rdbuf() ; // write zipfile start offset to file writeUint32( zip_start, exef ) ; exef.close() ; zipf.close() ; return 0; } void printUsage() { cout << "Usage: " << _progname << " exe-file zipfile" << endl ; } void exitUsage( int exit_code ) { printUsage() ; exit( exit_code ) ; } /** \file \anchor appendzip_anchor Source code to a small program appendzip that appends a zip archive to another file. Run appendzip without arguments to get a helpful usage message. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/src/backbuffer.h000066400000000000000000000100221351224126100162040ustar00rootroot00000000000000#ifndef BACKBUFFER_H #define BACKBUFFER_H #include "zipios++/zipios-config.h" #include #include "zipios++/meta-iostreams.h" #include #include "zipios++/fcollexceptions.h" #include "zipios++/ziphead.h" #include "zipios++/zipheadio.h" #include "zipios++/virtualseeker.h" #include "zipios_common.h" namespace zipios { using std::ios ; using std::cerr ; using std::endl ; /** A BackBuffer instance is useful for reading the last part of a file in an efficient manner, when it is not known exactly how far back (towards the front!) to go, to find the start of the desired data block. BackBuffer is a vector< unsigned char > that fills itself with data from a file by reading chunks from the end of the file progressing towards the start. Upon construction the BackBuffer instance is associated with a file and a chunksize can be specified. To read a chunk of the file into the BackBuffer call readChunk(). */ class BackBuffer : public vector< unsigned char > { public: /** BackBuffer constructor. @param is The istream to read the data from. The stream must be seekable, as BackBuffer will reposition the file position to read chunks from the back of the file. @param chunk_size specifies the size of the chunks to read the file into the BackBuffer in. @throw FCollException Thrown if the VirtualSeeker vs that has been specified is invalid for the istream is. */ inline explicit BackBuffer( istream &is, VirtualSeeker vs = VirtualSeeker(), int chunk_size = 1024 ) ; /** Reads another chunk and returns the size of the chunk that has been read. Returns 0 on I/O failure. @param read_pointer When a new chunk is read in the already stored bytes change position in the BackBuffer. read_pointer is assumed by readChunk() to be a pointer into a position in the BackBuffer, and is updated to point to the same position in the file as it pointed to before the new chunk was read. */ inline int readChunk( int &read_pointer ) ; private: VirtualSeeker _vs ; int _chunk_size ; istream &_is ; streampos _file_pos ; }; BackBuffer::BackBuffer( istream &is, VirtualSeeker vs, int chunk_size ) : _vs ( vs ), _chunk_size( chunk_size ), _is ( is ) { _vs.vseekg( is, 0, ios::end ) ; _file_pos = _vs.vtellg( is ) ; // Only happens if _vs.startOffset() is a position // in the file that lies after _vs.endOffset(), which // is clearly not a valid situation. if ( _file_pos < 0 ) throw FCollException( "Invalid virtual file endings" ) ; } int BackBuffer::readChunk( int &read_pointer ) { // Update chunk_size and file position _chunk_size = min ( static_cast< int >( _file_pos ), _chunk_size ) ; _file_pos -= _chunk_size ; _vs.vseekg( _is, _file_pos, ios::beg ) ; // Make space for _chunk_size new bytes first in buffer insert ( begin(), _chunk_size, static_cast< char > ( 0 ) ) ; // Read in the next _chunk_size of bytes readByteSeq ( _is, &( (*this)[ 0 ] ), _chunk_size ) ; read_pointer += _chunk_size ; if ( _is.good() ) return _chunk_size ; else return 0 ; } } #endif /** \file The header file for BackBuffer */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/src/basicentry.cpp000066400000000000000000000067061351224126100166260ustar00rootroot00000000000000 #include "zipios++/zipios-config.h" #include #include "zipios++/meta-iostreams.h" #include #include "zipios_common.h" #include "zipios++/basicentry.h" #include "zipios++/zipios_defs.h" #include "outputstringstream.h" namespace zipios { using std::ifstream ; using std::ios ; // // Public definitions // BasicEntry::BasicEntry( const string &filename, const string &comment, const FilePath &basepath ) : _filename ( filename ), _comment ( comment ), _basepath ( basepath ) { string full_path = _basepath + _filename ; ifstream is( full_path.c_str(), ios::in | ios::binary ) ; if ( ! is ) { _valid = false ; } else { is.seekg( 0, ios::end ) ; _size = is.tellg() ; is.close() ; _valid = true ; } } string BasicEntry::getComment() const { return _comment ; } uint32 BasicEntry::getCompressedSize() const { return getSize() ; } uint32 BasicEntry::getCrc() const { return 0 ; } vector< unsigned char > BasicEntry::getExtra() const { return vector< unsigned char > () ; } StorageMethod BasicEntry::getMethod() const { return STORED ; } string BasicEntry::getName() const { return _filename ; } string BasicEntry::getFileName() const { if ( isDirectory() ) return string() ; string::size_type pos ; pos = _filename.find_last_of( separator ) ; if ( pos != string::npos ) { // separator found! // isDirectory() check means pos should not be last, so pos+1 is ok return _filename.substr(pos + 1) ; } else { return _filename ; } } uint32 BasicEntry::getSize() const { return _size ; } int BasicEntry::getTime() const { return 0 ; // FIXME later } bool BasicEntry::isValid() const { return _valid ; } // virtual int hashCode() const {} bool BasicEntry::isDirectory() const { assert( _filename.size() != 0 ) ; return _filename[ _filename.size() - 1 ] == separator ; } void BasicEntry::setComment( const string &comment ) { _comment = comment ; } void BasicEntry::setCompressedSize( uint32 ) { } void BasicEntry::setCrc( uint32 ) { } void BasicEntry::setExtra( const vector< unsigned char > & ) { } void BasicEntry::setMethod( StorageMethod ) { } void BasicEntry::setName( const string &name ) { _filename = name ; } void BasicEntry::setSize( uint32 size ) { _size = size ; } void BasicEntry::setTime( int ) { } string BasicEntry::toString() const { OutputStringStream sout ; sout << _filename << " (" << _size << " bytes)" ; return sout.str() ; } FileEntry *BasicEntry::clone() const { return new BasicEntry( *this ) ; } BasicEntry::~BasicEntry() { } } // namespace /** \file Implementation of BasicEntry. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/src/collcoll.cpp000066400000000000000000000110141351224126100162520ustar00rootroot00000000000000 #include "zipios++/zipios-config.h" #include "zipios++/meta-iostreams.h" #include "zipios++/collcoll.h" #include "zipios_common.h" namespace zipios { using std::ifstream ; CollectionCollection *CollectionCollection::_inst = 0 ; CollectionCollection::CollectionCollection() { _valid = true ; // we're valid even though we are empty! } bool CollectionCollection::addCollection( const FileCollection &collection ) { if ( ! _valid ) throw InvalidStateException( "Attempt to add a FileCollection to an invalid CollectionCollection" ) ; if ( this == &collection || ! collection.isValid() ) return false ; _collections.push_back( collection.clone() ) ; return true ; } bool CollectionCollection::addCollection( FileCollection *collection ) { if ( ! _valid ) throw InvalidStateException( "Attempt to add a FileCollection to an invalid CollectionCollection" ) ; if ( collection == 0 || this == collection || ! collection->isValid() ) return false ; _collections.push_back( collection ) ; return true ; } void CollectionCollection::close() { _valid = false ; } ConstEntries CollectionCollection::entries() const { if ( ! _valid ) throw InvalidStateException( "Attempt to get entries from an invalid CollectionCollection" ) ; ConstEntries all_entries ; std::vector< FileCollection * >::const_iterator it ; for ( it = _collections.begin() ; it != _collections.end() ; it++ ) all_entries += (*it)->entries() ; return all_entries ; } ConstEntryPointer CollectionCollection::getEntry( const string &name, MatchPath matchpath ) const { if ( ! _valid ) throw InvalidStateException( "Attempt to get an entry from an invalid CollectionCollection" ) ; // Returns the first matching entry. std::vector< FileCollection * >::const_iterator it ; ConstEntryPointer cep ; getEntry( name, cep, it, matchpath ) ; return cep ; } istream *CollectionCollection::getInputStream( const ConstEntryPointer &entry ) { if ( ! _valid ) throw InvalidStateException( "Attempt to get an input stream from an invalid CollectionCollection" ) ; return getInputStream( entry->getName() ) ; } istream *CollectionCollection::getInputStream( const string &entry_name, MatchPath matchpath ) { if ( ! _valid ) throw InvalidStateException( "Attempt to get an input stream from an invalid CollectionCollection" ) ; std::vector< FileCollection * >::const_iterator it ; ConstEntryPointer cep ; getEntry( entry_name, cep, it, matchpath ) ; if ( cep == 0 ) return 0 ; else return (*it)->getInputStream( entry_name ) ; } int CollectionCollection::size() const { if ( ! _valid ) throw InvalidStateException( "Attempt to get the size of an invalid CollectionCollection" ) ; int sz = 0 ; std::vector< FileCollection * >::const_iterator it ; for ( it = _collections.begin() ; it != _collections.end() ; it++ ) sz += (*it)->size() ; return sz ; } FileCollection *CollectionCollection::clone() const { return new CollectionCollection( *this ) ; } CollectionCollection::~CollectionCollection() { std::vector< FileCollection * >::iterator it ; for ( it = _collections.begin() ; it != _collections.end() ; ++it ) delete *it ; } // // Protected member functions // void CollectionCollection::getEntry( const string &name, ConstEntryPointer &cep, std::vector< FileCollection * >::const_iterator &it, MatchPath matchpath ) const { // Returns the first matching entry. cep = 0 ; for ( it = _collections.begin() ; it != _collections.end() ; it++ ) { cep = (*it)->getEntry( name, matchpath ) ; if ( cep ) break ; } } } // namespace /** \file Implementation of CollectionCollection. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/src/deflateoutputstreambuf.cpp000066400000000000000000000134161351224126100212550ustar00rootroot00000000000000 #include "zipios++/zipios-config.h" #include "zipios++/meta-iostreams.h" #include #include "zipios++/fcollexceptions.h" #include "zipios++/deflateoutputstreambuf.h" #include "outputstringstream.h" namespace zipios { using std::cerr ; using std::endl ; DeflateOutputStreambuf::DeflateOutputStreambuf( streambuf *outbuf, bool user_init, bool del_outbuf ) : FilterOutputStreambuf( outbuf, del_outbuf ), _zs_initialized ( false ), _invecsize ( 1000 ), _invec ( _invecsize ), _outvecsize ( 1000 ), _outvec ( _outvecsize ) { // NOTICE: It is important that this constructor and the methods it // calls doesn't do anything with the output streambuf _outbuf The // reason is that this class can be subclassed, and the subclass // should get a chance to write to the buffer first // zlib init: _zs.zalloc = Z_NULL ; _zs.zfree = Z_NULL ; _zs.opaque = Z_NULL ; if ( user_init && ! init() ) cerr << "DeflateOutputStreambuf::reset() failed!\n" ; // FIXME: throw something } DeflateOutputStreambuf::~DeflateOutputStreambuf() { closeStream() ; } // This method is called in the constructor, so it must not write // anything to the output streambuf _outbuf (see notice in // constructor) bool DeflateOutputStreambuf::init( int comp_level ) { static const int default_mem_level = 8 ; // _zs.next_in and avail_in must be set according to // zlib.h (inline doc). _zs.next_in = reinterpret_cast< unsigned char * >( &( _invec[ 0 ] ) ) ; _zs.avail_in = 0 ; _zs.next_out = reinterpret_cast< unsigned char * >( &( _outvec[ 0 ] ) ) ; _zs.avail_out = _outvecsize ; int err ; if( _zs_initialized ) { // just reset it endDeflation() ; err = deflateReset( &_zs ) ; // FIXME: bug, for deflateReset we do not update the compression level } else { // init it err = deflateInit2( &_zs, comp_level, Z_DEFLATED, -MAX_WBITS, default_mem_level, Z_DEFAULT_STRATEGY ) ; /* windowBits is passed < 0 to tell that no zlib header should be written. */ _zs_initialized = true ; } // streambuf init: setp( &( _invec[ 0 ] ), &( _invec[ 0 ] ) + _invecsize ) ; _crc32 = crc32( 0, Z_NULL, 0 ) ; _overflown_bytes = 0 ; if ( err == Z_OK ) return true ; else return false ; } bool DeflateOutputStreambuf::closeStream() { int err = Z_OK ; if( _zs_initialized ) { endDeflation() ; err = deflateEnd( &_zs ) ; _zs_initialized = false ; } if ( err == Z_OK ) return true ; else { cerr << "DeflateOutputStreambuf::closeStream(): deflateEnd failed" ; #ifdef HAVE_ZERROR cerr << ": " << zError( err ) ; #endif cerr << endl ; return false ; } } int DeflateOutputStreambuf::overflow( int c ) { _zs.avail_in = pptr() - pbase() ; _zs.next_in = reinterpret_cast< unsigned char * >( &( _invec[ 0 ] ) ) ; _crc32 = crc32( _crc32, _zs.next_in, _zs.avail_in ) ; // update crc32 _overflown_bytes += _zs.avail_in ; _zs.next_out = reinterpret_cast< unsigned char * >( &( _outvec[ 0 ] ) ) ; _zs.avail_out = _outvecsize ; // Deflate until _invec is empty. int err = Z_OK ; while ( ( _zs.avail_in > 0 || _zs.avail_out == 0 ) && err == Z_OK ) { if ( _zs.avail_out == 0 ) flushOutvec() ; err = deflate( &_zs, Z_NO_FLUSH ) ; } flushOutvec() ; // Update 'put' pointers setp( &( _invec[ 0 ] ), &( _invec[ 0 ] ) + _invecsize ) ; if( err != Z_OK && err != Z_STREAM_END ) { #if defined (HAVE_STD_IOSTREAM) && defined (USE_STD_IOSTREAM) // Throw an exception to make istream set badbit OutputStringStream msgs ; msgs << "Deflation failed" ; #ifdef HAVE_ZERROR msgs << ": " << zError( err ) ; #endif throw IOException( msgs.str() ) ; #endif cerr << "Deflation failed\n" ; return EOF ; } if ( c != EOF ) { *pptr() = c ; pbump( 1 ) ; } return 0 ; } int DeflateOutputStreambuf::sync() { // FIXME: Do something // return overflow() ; return 0 ; } bool DeflateOutputStreambuf::flushOutvec() { int deflated_bytes = _outvecsize - _zs.avail_out ; int bc = _outbuf->sputn( &( _outvec[ 0 ] ), deflated_bytes ) ; _zs.next_out = reinterpret_cast< unsigned char * >( &( _outvec[ 0 ] ) ) ; _zs.avail_out = _outvecsize ; return deflated_bytes == bc ; } void DeflateOutputStreambuf::endDeflation() { overflow() ; _zs.next_out = reinterpret_cast< unsigned char * >( &( _outvec[ 0 ] ) ) ; _zs.avail_out = _outvecsize ; // Deflate until _invec is empty. int err = Z_OK ; while ( err == Z_OK ) { if ( _zs.avail_out == 0 ) flushOutvec() ; err = deflate( &_zs, Z_FINISH ) ; } flushOutvec() ; if ( err != Z_STREAM_END ) { cerr << "DeflateOutputStreambuf::endDeflation(): deflation failed:\n" ; #ifdef HAVE_ZERROR cerr << ": " << zError( err ) ; #endif cerr << endl ; } } } // namespace /** \file Implementation of DeflateOutputStreambuf. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/src/dircoll.cpp000066400000000000000000000105341351224126100161050ustar00rootroot00000000000000 #include "zipios++/zipios-config.h" #include "zipios++/meta-iostreams.h" #include #include #include #include "zipios++/dircoll.h" #include "directory.h" namespace zipios { using std::cerr ; using std::endl ; using std::vector ; using std::ifstream ; DirectoryCollection::DirectoryCollection( const string &path, bool recursive, bool load_now ) : _entries_loaded( false ), _recursive ( recursive ), _filepath ( path ) { _filename = _filepath ; _valid = _filepath.isDirectory() ; if( _valid && load_now ) loadEntries() ; } void DirectoryCollection::close() { _valid = false ; } ConstEntries DirectoryCollection::entries() const { if ( ! _valid ) throw InvalidStateException( "Attempt to use an invalid DirectoryCollection" ) ; loadEntries() ; return FileCollection::entries() ; } ConstEntryPointer DirectoryCollection::getEntry( const string &name, MatchPath matchpath ) const { if ( ! _valid ) throw InvalidStateException( "Attempt to use an invalid DirectoryCollection" ) ; if ( matchpath != MATCH || _entries_loaded ) { loadEntries() ; return FileCollection::getEntry( name, matchpath ) ; } else { // avoid loading entries if possible. ConstEntryPointer ent ( new DirEntry( name, "", _filepath ) ) ; if ( ent->isValid() ) return ent ; else return 0 ; } } istream *DirectoryCollection::getInputStream( const ConstEntryPointer &entry ) { if ( ! _valid ) throw InvalidStateException( "Attempt to use an invalid DirectoryCollection" ) ; return getInputStream( entry->getName() ) ; } istream *DirectoryCollection::getInputStream( const string &entry_name, MatchPath matchpath ) { if ( ! _valid ) throw InvalidStateException( "Attempt to use an invalid DirectoryCollection" ) ; if ( matchpath != MATCH || _entries_loaded ) { loadEntries() ; ConstEntryPointer ent = getEntry( entry_name, matchpath ) ; if ( ent == 0 ) return 0 ; else { string real_path( _filepath + entry_name ) ; return new ifstream( real_path.c_str(), ios::in | ios::binary ) ; } } else { // avoid loading entries if possible. string real_path( _filepath + entry_name ) ; ifstream *ifs = new ifstream( real_path.c_str(), ios::in | ios::binary ) ; if( ! *ifs ) { delete ifs ; return 0 ; } else return ifs ; } } int DirectoryCollection::size() const { if ( ! _valid ) throw InvalidStateException( "Attempt to use an invalid DirectoryCollection" ) ; loadEntries() ; return _entries.size() ; } FileCollection *DirectoryCollection::clone() const { return new DirectoryCollection( *this ) ; } DirectoryCollection::~DirectoryCollection() {} void DirectoryCollection::loadEntries() const { if( _entries_loaded ) return ; const_cast< DirectoryCollection * >( this )->load( _recursive ) ; _entries_loaded = true ; } void DirectoryCollection::load( bool recursive, const FilePath &subdir ) { using namespace boost::filesystem ; BasicEntry *ent ; for ( dir_it it( _filepath + subdir ) ; it != dir_it() ; ++it ) { if ( *it == "." || *it == ".." || *it == "..." ) continue ; if ( get< is_directory >( it ) && recursive ) { load( recursive, subdir + *it ) ; } else { _entries.push_back( ent = new BasicEntry( subdir + *it, "", _filepath ) ) ; ent->setSize( get< boost::filesystem::size >( it ) ) ; } } } } // namespace /** \file Implementation of DirectoryCollection. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/src/directory.cpp000066400000000000000000000301721351224126100164610ustar00rootroot00000000000000/** \file This file and directory.h are borrowed from the dir_it library available at http://www.boost.org. dir_it is a directory iterator. */ // -*-C++-*- directory.cc // // // // // // // // // // // // Author: Dietmar Kuehl dietmar.kuehl@claas-solutions.de // Title: Implementation of the directory iterator // Version: $Name: $ $Id: directory.cpp,v 1.3 2003/11/08 18:20:51 thomas Exp $ // -------------------------------------------------------------------------- #include "directory.h" #if defined(unix) || defined(__unix) || defined(__unix__) # define BOOST_UNIX 1 #elif defined(_WINDOWS) # define BOOST_WINNT 1 #endif // -------------------------------------------------------------------------- // The POSIX version uses the functions opendir(), readdir(), and closdir() // to find directory entries. In addition, stat() is used to find out // about specific file attributes. #if defined(BOOST_UNIX) #ifndef __USE_BSD #define __USE_BSD #endif #include #include #include #include #include struct boost::filesystem::dir_it::representation { representation(): m_handle(0), m_refcount(1), m_stat_p(false) { } representation(std::string const &dirname): m_handle(opendir(dirname.c_str())), m_refcount(1), m_directory(dirname), m_stat_p(false) { if( m_directory.size() == 0 ) m_directory = "./" ; if (m_directory[m_directory.size() - 1] != '/') m_directory += '/'; operator++ (); } ~representation() { if ( m_handle ) closedir(m_handle); } representation *reference() { ++m_refcount; return this; } representation *release() { return --m_refcount? 0: this; } representation &operator++() { if (m_handle) { m_stat_p = false; dirent *rc = readdir(m_handle); if (rc != 0) m_current = rc->d_name; else { m_current = ""; closedir(m_handle); m_handle = 0; } } return *this; } bool operator== (representation const &rep) const { return (m_handle == 0) == (rep.m_handle == 0); } std::string const &operator* () { return m_current; } struct stat &get_stat() { if (!m_stat_p) stat( (m_directory + m_current).c_str(), &m_stat); return m_stat; } void set_mode(mode_t m, bool nv) { if (((get_stat().st_mode & m) == 0) == nv) chmod((m_directory + m_current).c_str(), get_stat().st_mode ^ m); } void change_owner(uid_t uid) { chown((m_directory + m_current).c_str(), uid, get_stat().st_gid); } void change_group(gid_t gid) { chown((m_directory + m_current).c_str(), get_stat().st_uid, gid); } private: DIR *m_handle; int m_refcount; std::string m_directory; std::string m_current; struct stat m_stat; bool m_stat_p; }; namespace boost { namespace filesystem { template <> bool get(dir_it const &it) { return S_ISLNK(it.rep->get_stat().st_mode); } template <> bool get(dir_it const &it) { return S_ISREG(it.rep->get_stat().st_mode); } template <> bool get(dir_it const &it) { return S_ISDIR(it.rep->get_stat().st_mode); } template <> bool get(dir_it const &it) { return S_ISCHR(it.rep->get_stat().st_mode); } template <> bool get(dir_it const &it) { return S_ISBLK(it.rep->get_stat().st_mode); } template <> bool get(dir_it const &it) { return S_ISFIFO(it.rep->get_stat().st_mode); } template <> bool get(dir_it const &it) { return S_ISSOCK(it.rep->get_stat().st_mode); } template <> bool get(dir_it const &it) { return it.rep->get_stat().st_mode & S_IRUSR; } template <> void set(dir_it const &it, bool nv) { it.rep->set_mode(S_IRUSR, nv); } template <> bool get(dir_it const &it) { return it.rep->get_stat().st_mode & S_IWUSR; } template <> void set(dir_it const &it, bool nv) { it.rep->set_mode(S_IWUSR, nv); } template <> bool get(dir_it const &it) { return it.rep->get_stat().st_mode & S_IXUSR; } template <> void set(dir_it const &it, bool nv) { it.rep->set_mode(S_IXUSR, nv); } template <> bool get(dir_it const &it) { return it.rep->get_stat().st_mode & S_ISUID; } template <> void set(dir_it const &it, bool nv) { it.rep->set_mode(S_ISUID, nv); } template <> bool get(dir_it const &it) { return it.rep->get_stat().st_mode & S_IRGRP; } template <> void set(dir_it const &it, bool nv) { it.rep->set_mode(S_IRGRP, nv); } template <> bool get(dir_it const &it) { return it.rep->get_stat().st_mode & S_IWGRP; } template <> void set(dir_it const &it, bool nv) { it.rep->set_mode(S_IWGRP, nv); } template <> bool get(dir_it const &it) { return it.rep->get_stat().st_mode & S_IXGRP; } template <> void set(dir_it const &it, bool nv) { it.rep->set_mode(S_IXGRP, nv); } template <> bool get(dir_it const &it) { return it.rep->get_stat().st_mode & S_ISGID; } template <> void set(dir_it const &it, bool nv) { it.rep->set_mode(S_ISGID, nv); } template <> bool get(dir_it const &it) { return it.rep->get_stat().st_mode & S_IROTH; } template <> void set(dir_it const &it, bool nv) { it.rep->set_mode(S_IROTH, nv); } template <> bool get(dir_it const &it) { return it.rep->get_stat().st_mode & S_IWOTH; } template <> void set(dir_it const &it, bool nv) { it.rep->set_mode(S_IWOTH, nv); } template <> bool get(dir_it const &it) { return it.rep->get_stat().st_mode & S_IXOTH; } template <> void set(dir_it const &it, bool nv) { it.rep->set_mode(S_IXOTH, nv); } template <> bool get(dir_it const &it) { return it.rep->get_stat().st_mode & S_ISVTX; } template <> void set(dir_it const &it, bool nv) { it.rep->set_mode(S_ISVTX, nv); } template <> nlink_t get(dir_it const &it) { return it.rep->get_stat().st_nlink; } template <> size_t get(dir_it const &it) { return it.rep->get_stat().st_size; } template <> unsigned long get(dir_it const &it) { return it.rep->get_stat().st_blocks; } template <> unsigned long get(dir_it const &it) { return it.rep->get_stat().st_blksize; } template <> mtime::value_type get(dir_it const &it) { return &it.rep->get_stat().st_mtime; } template <> atime::value_type get(dir_it const &it) { return &it.rep->get_stat().st_atime; } template <> ctime::value_type get(dir_it const &it) { return &it.rep->get_stat().st_ctime; } template <> uid_t get(dir_it const &it) { return it.rep->get_stat().st_uid; } template <> void set(dir_it const &it, uid_t uid) { it.rep->change_owner(uid); } template <> std::string get(dir_it const &it) { struct passwd *pw = getpwuid(it.rep->get_stat().st_uid); if (pw == 0) throw unknown_uid(it.rep->get_stat().st_uid); return pw->pw_name; } template <> void set(dir_it const &it, std::string name) { struct passwd *pw = getpwnam(name.c_str()); if (pw != 0) it.rep->change_owner(pw->pw_uid); else throw unknown_uname(name); } template <> gid_t get(dir_it const &it) { return it.rep->get_stat().st_gid; } template <> void set(dir_it const &it, gid_t gid) { it.rep->change_group(gid); } template <> std::string get(dir_it const &it) { struct group *grp = getgrgid(it.rep->get_stat().st_gid); if (grp == 0) throw unknown_gid(it.rep->get_stat().st_gid); return grp->gr_name; } template <> void set(dir_it const &it, std::string name) { struct group *grp = getgrnam(name.c_str()); if (grp != 0) it.rep->change_group(grp->gr_gid); else throw unknown_gname(name); } template <> bool get(dir_it const &it) { return (*it)[0] == '.'; } } } #elif defined(BOOST_WINNT) #include "io.h" #include "direct.h" struct boost::filesystem::dir_it::representation { representation(): m_handle(-1), m_refcount(1) { } representation(std::string const &dirname): m_handle(_findfirst((dirname + "\\*").c_str(), &m_data)), m_refcount(1) { } ~representation() { if (m_handle != -1) _findclose(m_handle); } representation *reference() { ++m_refcount; return this; } representation *release() { return --m_refcount? 0: this; } representation &operator++() { if (m_handle != -1) { if (_findnext(m_handle, &m_data) == -1) { _findclose(m_handle); m_handle = -1; } } return *this; } bool operator== (representation const &rep) const { return (m_handle == -1) == (rep.m_handle == -1); } std::string operator* () { return m_data.name; } struct _finddata_t const &get_data() const { return m_data; } #if 0 void set_mode(mode_t m, bool nv) { if (((get_stat().st_mode & m) == 0) == nv) chmod((m_directory + m_current).c_str(), get_stat().st_mode ^ m); } void change_owner(uid_t uid) { chown((m_directory + m_current).c_str(), uid, get_stat().st_gid); } void change_group(gid_t gid) { chown((m_directory + m_current).c_str(), get_stat().st_uid, gid); } #endif private: struct _finddata_t m_data; long m_handle; int m_refcount; std::string m_directory; }; namespace boost { namespace filesystem { get::operator size::value_type() const { return m_it.rep->get_data().size; } get::operator mtime::value_type() const { return &m_it.rep->get_data().time_write; } get::operator is_directory::value_type() const { return (m_it.rep->get_data().attrib & _A_SUBDIR) != 0; } get::operator is_regular::value_type() const { return (m_it.rep->get_data().attrib & _A_SUBDIR) == 0; } get::operator is_hidden::value_type() const { return (m_it.rep->get_data().attrib & _A_HIDDEN) != 0; } get::operator user_read::value_type() const { return true; } get::operator user_write::value_type() const { return (m_it.rep->get_data().attrib & _A_RDONLY) == 0; } get::operator user_execute::value_type() const { std::string name(*m_it); std::string ext(name.substr(name.find_last_of('.'))); return ext == ".exe" || ext == ".bat"; } } } #endif // -------------------------------------------------------------------------- boost::filesystem::dir_it::dir_it(): rep(new representation()) { } boost::filesystem::dir_it::dir_it(std::string const &dirname): rep(new representation(dirname)) { } boost::filesystem::dir_it::dir_it(boost::filesystem::dir_it const &it): rep(it.rep->reference()) { } boost::filesystem::dir_it::~dir_it() { delete rep->release(); } boost::filesystem::dir_it &boost::filesystem::dir_it::operator= (boost::filesystem::dir_it const &it) { it.rep->reference(); delete rep->release(); rep = it.rep; return *this; } // -------------------------------------------------------------------------- std::string boost::filesystem::dir_it::operator* () const { return *(*rep); } boost::filesystem::dir_it &boost::filesystem::dir_it::operator++ () { ++(*rep); return *this; } boost::filesystem::dir_it::proxy boost::filesystem::dir_it::operator++ (int) { std::string rc(*(*rep)); ++(*rep); return rc; } // -------------------------------------------------------------------------- bool boost::filesystem::dir_it::operator== (boost::filesystem::dir_it const &it) const { return *rep == *(it.rep); } bool boost::filesystem::dir_it::operator!= (boost::filesystem::dir_it const &it) const { return !(*rep == *(it.rep)); } zipios++-0.1.7/src/directory.h000066400000000000000000000263331351224126100161320ustar00rootroot00000000000000/** \file This file and directory.cpp are borrowed from the dir_it library available at http://www.boost.org. dir_it is a directory iterator. */ // -*-C++-*- directory.h // // // // // // // // // // // // Author: Dietmar Kuehl dietmar.kuehl@claas-solutions.de // Title: An input iterator used to list the entries in a directory // Version: $Name: $ $Id: directory.h,v 1.4 2003/01/03 22:45:34 russel_winder Exp $ // -------------------------------------------------------------------------- #if !defined(BOOST_DIRECTORY_H) #define BOOST_DIRECTORY_H 1 // -------------------------------------------------------------------------- #include #include #include #include #include // #include Contents of boost.h // Allow control over DLL version being built #if defined(unix) || defined(__unix) || defined(__unix__) # define BOOST_DECL #elif defined(ZIPIOS_DLL) # ifdef ZIPIOS_EXPORTS # define BOOST_DECL __declspec(dllexport) # else # define BOOST_DECL __declspec(dllimport) # endif #else # define BOOST_DECL #endif // end of contents of boost.h #if defined(unix) || defined(__unix) || defined(__unix__) #include #endif // -------------------------------------------------------------------------- namespace boost { namespace filesystem { class dir_it; #if defined(__GNUG__) template typename Property::value_type get(dir_it const &); template void set(dir_it const &, typename Property::value_type); #else template class get; template class set; #endif class BOOST_DECL dir_it //: public std::iterator { #if defined(__GNUG__) template friend typename Property::value_type get(dir_it const &); template friend void set(dir_it const &, typename Property::value_type); #endif struct representation; public: typedef ptrdiff_t difference_type; typedef std::string value_type; typedef std::string *pointer; typedef std::string &reference; class proxy { friend class dir_it; proxy(std::string const &ent): entry(ent) {} public: std::string operator*() const { return entry; } private: std::string entry; }; dir_it(); dir_it(std::string const &); dir_it(dir_it const &); ~dir_it(); dir_it &operator= (dir_it const &); std::string operator* () const; dir_it &operator++ (); proxy operator++ (int); bool operator== (dir_it const &) const; bool operator!= (dir_it const &) const; #if defined(__GNUG__) private: #endif representation *rep; }; struct size { typedef size_t value_type; }; struct mtime { typedef time_t const *value_type; }; struct is_directory { typedef bool value_type; }; struct is_regular { typedef bool value_type; }; struct is_hidden { typedef bool value_type; }; struct user_read { typedef bool value_type; }; struct user_write { typedef bool value_type; }; struct user_execute { typedef bool value_type; }; #if defined(__GNUG__) template <> size::value_type get(dir_it const &); template <> mtime::value_type get(dir_it const &); template <> bool get(dir_it const &); template <> bool get(dir_it const &); template <> bool get(dir_it const &); template <> bool get(dir_it const &); template <> void set(dir_it const &, bool); template <> bool get(dir_it const &); template <> void set(dir_it const &, bool); template <> bool get(dir_it const &); template <> void set(dir_it const &, bool); #else template <> class BOOST_DECL get { typedef size::value_type value_type; public: get(dir_it const &it): m_it(it) {} operator value_type() const; private: dir_it const &m_it; }; template <> class BOOST_DECL get { typedef mtime::value_type value_type; public: get(dir_it const &it): m_it(it) {} operator value_type() const; private: dir_it const &m_it; }; template <> class BOOST_DECL get { typedef is_directory::value_type value_type; public: get(dir_it const &it): m_it(it) {} operator value_type() const; private: dir_it const &m_it; }; template <> class BOOST_DECL get { typedef is_regular::value_type value_type; public: get(dir_it const &it): m_it(it) {} operator value_type() const; private: dir_it const &m_it; }; template <> class BOOST_DECL get { typedef is_hidden::value_type value_type; public: get(dir_it const &it): m_it(it) {} operator value_type() const; private: dir_it const &m_it; }; template <> class BOOST_DECL set { public: set(dir_it const &, is_hidden::value_type); }; template <> class BOOST_DECL get { typedef user_read::value_type value_type; public: get(dir_it const &it): m_it(it) {} operator value_type() const; private: dir_it const &m_it; }; template <> class BOOST_DECL get { typedef user_write::value_type value_type; public: get(dir_it const &it): m_it(it) {} operator value_type() const; private: dir_it const &m_it; }; template <> class BOOST_DECL set { public: set(dir_it const &, user_write::value_type); }; template <> class BOOST_DECL get { typedef user_execute::value_type value_type; public: get(dir_it const &it): m_it(it) {} operator value_type() const; private: dir_it const &m_it; }; #endif #if defined(unix) || defined(__unix) || defined(__unix__) struct is_link { typedef bool value_type; }; template <> bool get(dir_it const &); struct is_char_device { typedef bool value_type; }; template <> bool get(dir_it const &); struct is_block_device { typedef bool value_type; }; template <> bool get(dir_it const &); struct is_fifo { typedef bool value_type; }; template <> bool get(dir_it const &); struct is_socket { typedef bool value_type; }; template <> bool get(dir_it const &); struct atime { typedef time_t *value_type; }; template <> atime::value_type get(dir_it const &); struct ctime { typedef time_t *value_type; }; template <> ctime::value_type get(dir_it const &); struct group_read { typedef bool value_type; }; template <> bool get(dir_it const &); template <> void set(dir_it const &, bool); struct group_write { typedef bool value_type; }; template <> bool get(dir_it const &); template <> void set(dir_it const &, bool); struct group_execute { typedef bool value_type; }; template <> bool get(dir_it const &); template <> void set(dir_it const &, bool); struct other_read { typedef bool value_type; }; template <> bool get(dir_it const &); template <> void set(dir_it const &, bool); struct other_write { typedef bool value_type; }; template <> bool get(dir_it const &); template <> void set(dir_it const &, bool); struct other_execute { typedef bool value_type; }; template <> bool get(dir_it const &); template <> void set(dir_it const &, bool); struct set_uid { typedef bool value_type; }; template <> bool get(dir_it const &); template <> void set(dir_it const &, bool); struct set_gid { typedef bool value_type; }; template <> bool get(dir_it const &); template <> void set(dir_it const &, bool); struct sticky { typedef bool value_type; }; template <> bool get(dir_it const &); template <> void set(dir_it const &, bool); struct mode { typedef mode_t value_type; }; template <> mode_t get(dir_it const &); template <> void set(dir_it const &, mode_t); struct links { typedef nlink_t value_type; }; template<> nlink_t get(dir_it const &); struct blocks { typedef unsigned long value_type; }; template<> unsigned long get(dir_it const &); struct blksize { typedef unsigned long value_type; }; template<> unsigned long get(dir_it const &); class unknown_uid: public std::invalid_argument { public: unknown_uid(uid_t u): std::invalid_argument("unknown user ID"), m_uid(u) {} uid_t uid() const { return m_uid; } private: uid_t m_uid; }; struct uid { typedef uid_t value_type; }; template<> uid_t get(dir_it const &); template<> void set(dir_it const &, uid_t); class unknown_uname: public std::invalid_argument { public: unknown_uname(std::string u): std::invalid_argument("unknown user name"), m_uname(u) {} // TODO: Why does this destructor have to be redefined so as to avoid the "looser throw specifier" error. ~unknown_uname() throw() { } std::string uname() const { return m_uname; } private: std::string m_uname; }; struct uname { typedef std::string value_type; }; template<> std::string get(dir_it const &); template<> void set(dir_it const &, std::string ); class unknown_gid: public std::invalid_argument { public: unknown_gid(gid_t g): std::invalid_argument("unknown group ID"), m_gid(g) {} gid_t gid() const { return m_gid; } private: gid_t m_gid; }; struct gid { typedef gid_t value_type; }; template<> gid_t get(dir_it const &); template<> void set(dir_it const &, gid_t); class unknown_gname: public std::invalid_argument { public: unknown_gname(std::string g): std::invalid_argument("unknown group name"), m_gname(g) {} // TODO: Why does this destructor have to be redefined so as to avoid the "looser throw specifier" error. ~unknown_gname() throw() { } std::string gname() const { return m_gname; } private: std::string m_gname; }; struct gname { typedef std::string value_type; }; template<> std::string get(dir_it const &); template<> void set(dir_it const &, std::string ); #endif } // namespace filesystem } // namespace boost namespace std { template<> struct iterator_traits { public: typedef ptrdiff_t difference_type; typedef std::string value_type; typedef std::string *pointer; typedef std::string &reference; typedef input_iterator_tag iterator_category; }; } // namespace std // -------------------------------------------------------------------------- #endif /* BOOST_DIRECTORY_H */ zipios++-0.1.7/src/fcoll.cpp000066400000000000000000000052321351224126100155530ustar00rootroot00000000000000 #include "zipios++/zipios-config.h" #include #include #include #include "zipios++/fcoll.h" namespace zipios { using std::find_if ; // FIXME: make InvalidStateException message customized for // subclasses. maybe make an InvalidStateException factory ;-) ConstEntries FileCollection::entries() const { if ( ! _valid ) throw InvalidStateException( "Attempt to get entries from an invalid FileCollection" ) ; // The constructor below is not in all vector impl. (not those // without member templates) // ConstEntries ( _entries.begin(), _entries.end() ) ; // Instead of using that we copy the vector manually ConstEntries cep_vec ; cep_vec.reserve( _entries.size() ) ; Entries::const_iterator cit ; for ( cit = _entries.begin() ; cit != _entries.end() ; ++cit ) cep_vec.push_back( *cit ) ; return cep_vec ; } ConstEntryPointer FileCollection::getEntry( const string &name, MatchPath matchpath ) const { if ( ! _valid ) throw InvalidStateException( "Attempt to get an entry from an invalid FileCollection" ) ; Entries::const_iterator iter ; if ( matchpath == MATCH ) iter = find_if( _entries.begin(), _entries.end(), FileEntry::MatchName( name ) ) ; else iter = find_if( _entries.begin(), _entries.end(), FileEntry::MatchFileName( name ) ) ; if ( iter == _entries.end() ) return 0 ; else return *iter ; } string FileCollection::getName() const { if ( ! _valid ) throw InvalidStateException( "Attempt to get the name of an invalid FileCollection" ) ; return _filename ; } int FileCollection::size() const { if ( ! _valid ) throw InvalidStateException( "Attempt to get size of an invalid FileCollection" ) ; return _entries.size() ; } FileCollection::~FileCollection() { } } // namespace /** \file Implementation of FileCollection. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/src/fcollexceptions.cpp000066400000000000000000000063221351224126100176560ustar00rootroot00000000000000 #include "zipios++/zipios-config.h" #include "zipios++/meta-iostreams.h" #include "zipios++/fcollexceptions.h" namespace zipios { using std::cerr ; using std::endl ; IOException::IOException() throw () : _what( "I/O exception" ) {} IOException::IOException( const string &msg ) throw () : _what( msg ) {} IOException::IOException( const IOException &src ) throw () : std::exception(), _what( src._what ) {} IOException &IOException::operator= ( const IOException &src ) throw () { _what = src._what ; return *this ; } const char *IOException::what() const throw () { return _what.c_str() ; } IOException::~IOException() throw () {} FCollException::FCollException() throw () : _what( "FileCollection exception" ) {} FCollException::FCollException( const string &msg ) throw () : _what( msg ) {} FCollException::FCollException( const FCollException &src ) throw () : std::exception(),_what( src._what ) {} FCollException &FCollException::operator= ( const FCollException &src ) throw () { _what = src._what ; return *this ; } const char *FCollException::what() const throw () { return _what.c_str() ; } FCollException::~FCollException() throw () {} InvalidStateException::InvalidStateException() throw () : _what( "InvalidState exception" ) {} InvalidStateException::InvalidStateException( const string &msg ) throw () : _what( msg ) {} InvalidStateException:: InvalidStateException( const InvalidStateException &src ) throw () : std::exception(), _what( src._what ) {} InvalidStateException &InvalidStateException:: operator= ( const InvalidStateException &src ) throw () { _what = src._what ; return *this ; } const char *InvalidStateException::what() const throw () { return _what.c_str() ; } InvalidStateException::~InvalidStateException() throw () {} Exception::Exception() throw () : _what( "Exception" ) {} Exception::Exception( const string &msg ) throw () : _what( msg ) {} Exception:: Exception( const Exception &src ) throw () : std::exception(),_what( src._what ) {} Exception &Exception:: operator= ( const Exception &src ) throw () { _what = src._what ; return *this ; } const char *Exception::what() const throw () { return _what.c_str() ; } Exception::~Exception() throw () {} } // namespace /** \file Implementation of a number of Exceptions used by FileCollection and its subclasses. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/src/fileentry.cpp000066400000000000000000000022121351224126100164500ustar00rootroot00000000000000 #include "zipios++/zipios-config.h" #include "zipios++/meta-iostreams.h" #include #include "zipios++/fileentry.h" namespace zipios { ostream &operator<< ( ostream &os, const FileEntry &entry ) { os << entry.toString() ; return os ; } } // namespace /** \file Implementation of FileEntry. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/src/filepath.cpp000066400000000000000000000040521351224126100162470ustar00rootroot00000000000000 #include "zipios++/zipios-config.h" #include #include #include #include #include "zipios++/filepath.h" namespace zipios { using namespace std ; const char FilePath::_separator = '/' ; FilePath::FilePath( const string &path, bool check_exists ) : _checked( false ), _path( path ) { pruneTrailingSeparator() ; if ( check_exists ) exists() ; } void FilePath::check() const { _checked = true ; _exists = false ; _is_reg = false ; _is_dir = false ; _is_char = false ; _is_block = false ; _is_socket = false ; _is_fifo = false ; struct stat buf ; if ( stat( _path.c_str(), &buf ) != -1 ) { _exists = true ; #if defined(BOOST_WINNT) _is_reg = _S_IFREG & buf.st_mode ; _is_dir = _S_IFDIR & buf.st_mode ; _is_char = _S_IFCHR & buf.st_mode ; #else _is_reg = S_ISREG ( buf.st_mode ) ; _is_dir = S_ISDIR ( buf.st_mode ) ; _is_char = S_ISCHR ( buf.st_mode ) ; _is_block = S_ISBLK ( buf.st_mode ) ; _is_socket = S_ISSOCK( buf.st_mode ) ; _is_fifo = S_ISFIFO( buf.st_mode ) ; #endif } } } // namespace /** \file Implementation of FilePath. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/src/filterinputstreambuf.cpp000066400000000000000000000024301351224126100207270ustar00rootroot00000000000000 #include "zipios++/zipios-config.h" #include "zipios++/filterinputstreambuf.h" namespace zipios { FilterInputStreambuf::FilterInputStreambuf( streambuf *inbuf, bool del_inbuf ) : _inbuf( inbuf), _del_inbuf( del_inbuf ) { if ( _inbuf == NULL ) { // throw an exception } } FilterInputStreambuf::~FilterInputStreambuf() { if ( _del_inbuf ) delete _inbuf ; } } // namespace /** \file Implementation of FilterInputStreambuf. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/src/filteroutputstreambuf.cpp000066400000000000000000000024471351224126100211400ustar00rootroot00000000000000 #include "zipios++/zipios-config.h" #include "zipios++/filteroutputstreambuf.h" namespace zipios { FilterOutputStreambuf::FilterOutputStreambuf( streambuf *outbuf, bool del_outbuf ) : _outbuf( outbuf), _del_outbuf( del_outbuf ) { if ( _outbuf == NULL ) { // throw an exception } } FilterOutputStreambuf::~FilterOutputStreambuf() { if ( _del_outbuf ) delete _outbuf ; } } // namespace /** \file Implementation of FilterOutputStreambuf. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/src/gzipoutputstream.cpp000066400000000000000000000036571351224126100201330ustar00rootroot00000000000000 #include "zipios++/zipios-config.h" #include "zipios++/meta-iostreams.h" #include "zipios++/gzipoutputstreambuf.h" #include "zipios++/gzipoutputstream.h" using std::ostream; namespace zipios { GZIPOutputStream::GZIPOutputStream( std::ostream &os ) : ostream( 0 ), ofs( 0 ) { ozf = new GZIPOutputStreambuf( os.rdbuf() ) ; init( ozf ) ; } GZIPOutputStream::GZIPOutputStream( const std::string &filename ) : ostream( 0 ), ofs( 0 ) { ofs = new std::ofstream( filename.c_str(), std::ios::out | std::ios::binary ) ; ozf = new GZIPOutputStreambuf( ofs->rdbuf() ) ; init( ozf ) ; } void GZIPOutputStream::setFilename( const string &filename ) { ozf->setFilename(filename); } void GZIPOutputStream::setComment( const string &comment ) { ozf->setComment(comment); } void GZIPOutputStream::close() { ozf->close() ; if ( ofs ) ofs->close() ; } void GZIPOutputStream::finish() { ozf->finish() ; } GZIPOutputStream::~GZIPOutputStream() { // It's ok to call delete with a Null pointer. delete ozf ; delete ofs ; } } // namespace /** \file Implementation of GZIPOutputStream. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/src/gzipoutputstreambuf.cpp000066400000000000000000000062461351224126100206250ustar00rootroot00000000000000 #include #include "zipios++/zipios-config.h" #include #include "zipios++/meta-iostreams.h" #include #include "zipios++/gzipoutputstreambuf.h" namespace zipios { using std::ios ; using std::cerr ; using std::endl ; GZIPOutputStreambuf::GZIPOutputStreambuf( streambuf *outbuf, bool del_outbuf ) : DeflateOutputStreambuf( outbuf, true, del_outbuf ), _open ( false ) { } void GZIPOutputStreambuf::setFilename( const string &filename ) { _filename = filename ; } void GZIPOutputStreambuf::setComment( const string &comment ) { _comment = comment ; } void GZIPOutputStreambuf::close() { finish() ; } void GZIPOutputStreambuf::finish() { if( ! _open ) return ; closeStream(); writeTrailer(); _open = false ; } GZIPOutputStreambuf::~GZIPOutputStreambuf() { finish() ; } int GZIPOutputStreambuf::overflow( int c ) { if (!_open) { writeHeader(); _open = true; } return DeflateOutputStreambuf::overflow( c ) ; } int GZIPOutputStreambuf::sync() { return DeflateOutputStreambuf::sync() ; } void GZIPOutputStreambuf::writeHeader() { unsigned char flg = 0x00; flg |= (_filename == "") ? 0x00 : 0x08; flg |= (_comment == "") ? 0x00 : 0x10; ostream os( _outbuf ) ; os << (unsigned char)0x1f; // Magic # os << (unsigned char)0x8b; // Magic # os << (unsigned char)0x08; // Deflater.DEFLATED os << flg; // FLG os << (unsigned char)0x00; // MTIME os << (unsigned char)0x00; // MTIME os << (unsigned char)0x00; // MTIME os << (unsigned char)0x00; // MTIME os << (unsigned char)0x00; // XFLG os << (unsigned char)0x00; // OS if (_filename != "") { os << _filename.c_str();// Filename os << (unsigned char)0x00; } if (_comment != "") { os << _comment.c_str(); // Comment os << (unsigned char)0x00; } } void GZIPOutputStreambuf::writeTrailer() { writeInt(getCrc32()); writeInt(getCount()); } void GZIPOutputStreambuf::writeInt(uint32 i) { ostream os( _outbuf ) ; os << (unsigned char)( i & 0xFF); os << (unsigned char)((i >> 8) & 0xFF); os << (unsigned char)((i >> 16) & 0xFF); os << (unsigned char)((i >> 24) & 0xFF); } } // namespace /** \file Implementation of GZIPOutputStreambuf. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/src/inflateinputstreambuf.cpp000066400000000000000000000137631351224126100210770ustar00rootroot00000000000000 #include "zipios++/zipios-config.h" #include "zipios++/meta-iostreams.h" #include #include "zipios++/fcollexceptions.h" #include "zipios++/inflateinputstreambuf.h" #include "outputstringstream.h" namespace zipios { using std::cerr ; using std::endl ; InflateInputStreambuf::InflateInputStreambuf( streambuf *inbuf, int s_pos, bool del_inbuf ) : FilterInputStreambuf( inbuf, del_inbuf ), _zs_initialized ( false ), _invecsize ( 1000 ), _invec ( _invecsize ), _outvecsize ( 1000 ), _outvec ( _outvecsize ) { // NOTICE: It is important that this constructor and the methods it // calls doesn't do anything with the input streambuf _inbuf, other // than repositioning it to the specified position. The reason is // that this class can be subclassed, and the subclass should get a // chance to read from the buffer first) // zlib init: _zs.zalloc = Z_NULL ; _zs.zfree = Z_NULL ; _zs.opaque = Z_NULL ; reset( s_pos ) ; // We're not checking the return value of reset() and throwing // an exception in case of an error, because we cannot catch the exception // in the constructors of subclasses with all compilers. } InflateInputStreambuf::~InflateInputStreambuf() { // Dealloc z_stream stuff int err = inflateEnd( &_zs ) ; if( err != Z_OK ) { cerr << "~inflatebuf: inflateEnd failed" ; #ifdef HAVE_ZERROR cerr << ": " << zError( err ) ; #endif cerr << endl ; } } int InflateInputStreambuf::underflow() { // If not underflow don't fill buffer if ( gptr() < egptr() ) return static_cast< unsigned char >( *gptr() ) ; // Prepare _outvec and get array pointers _zs.avail_out = _outvecsize ; _zs.next_out = reinterpret_cast< unsigned char * >( &( _outvec[ 0 ] ) ) ; // Inflate until _outvec is full // eof (or I/O prob) on _inbuf will break out of loop too. int err = Z_OK ; while ( _zs.avail_out > 0 && err == Z_OK ) { if ( _zs.avail_in == 0 ) { // fill _invec int bc = _inbuf->sgetn( &(_invec[ 0 ] ) , _invecsize ) ; // FIXME: handle i/o problems. _zs.next_in = reinterpret_cast< unsigned char * >( &( _invec[0] ) ) ; _zs.avail_in = bc ; // If we could not read any new data (bc == 0) and inflate isn't // done it will return Z_BUF_ERROR and thus breaks out of the // loop. This means we don't have to respond to the situation // where we can't read more bytes here. } err = inflate( &_zs, Z_NO_FLUSH ) ; } // Normally the number of inflated bytes will be the // full length of the output buffer, but if we can't read // more input from the _inbuf streambuf, we end up with // less. int inflated_bytes = _outvecsize - _zs.avail_out ; setg( &( _outvec[ 0 ] ), &( _outvec[ 0 ] ), &( _outvec[ 0 ] ) + inflated_bytes ) ; // FIXME: look at the error returned from inflate here, if there is // some way to report it to the InflateInputStreambuf user. // Until I find out I'll just print a warning to stdout. if( err != Z_OK && err != Z_STREAM_END ) { #if defined (HAVE_STD_IOSTREAM) && defined (USE_STD_IOSTREAM) // Throw an exception to make istream set badbit OutputStringStream msgs ; msgs << "InflateInputStreambuf: inflate failed" ; #ifdef HAVE_ZERROR msgs << ": " << zError( err ) ; #endif throw IOException( msgs.str() ) ; #endif // If HAVE_STD_IOSTREAM not defined we just return eof // if no output is produced, and that happens anyway } if (inflated_bytes > 0 ) return static_cast< unsigned char >( *gptr() ) ; else return EOF ; // traits_type::eof() ; } // This method is called in the constructor, so it must not // read anything from the input streambuf _inbuf (see notice in constructor) bool InflateInputStreambuf::reset( int stream_position ) { if ( stream_position >= 0 ) { // reposition _inbuf _inbuf->pubseekpos( stream_position ) ; } // _zs.next_in and avail_in must be set according to // zlib.h (inline doc). _zs.next_in = reinterpret_cast< unsigned char * >( &( _invec[0] ) ) ; _zs.avail_in = 0 ; int err ; if( _zs_initialized ) { // just reset it err = inflateReset( &_zs ) ; } else { // init it err = inflateInit2( &_zs, -MAX_WBITS ) ; /* windowBits is passed < 0 to tell that there is no zlib header. Note that in this case inflate *requires* an extra "dummy" byte after the compressed stream in order to complete decompression and return Z_STREAM_END. We always have an extra "dummy" byte, because there is always some trailing data after the compressed data (either the next entry or the central directory. */ _zs_initialized = true ; } // streambuf init: // The important thing here, is that // - the pointers are not NULL (which would mean unbuffered) // - and that gptr() is not less than egptr() (so we trigger underflow // the first time data is read). setg( &( _outvec[ 0 ] ), &( _outvec[ 0 ] ) + _outvecsize, &( _outvec[ 0 ] ) + _outvecsize ) ; if ( err == Z_OK ) return true ; else return false ; } } // namespace /** \file Implementation of InflateInputStreambuf. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/src/outputstringstream.h000066400000000000000000000041531351224126100201250ustar00rootroot00000000000000#ifndef OUTPUTSTRINGSTREAM_H #define OUTPUTSTRINGSTREAM_H #include "zipios++/zipios-config.h" #include "zipios++/meta-iostreams.h" #include namespace zipios { #if defined (HAVE_STD_IOSTREAM) && defined (USE_STD_IOSTREAM) typedef std::ostringstream OutputStringStream ; #else /** OutputStringStream is typedefed to ostringstream if sstream is part of the standard library (unless Zipios++ has been explicitly configured not to use it). If sstream is not present OutputStringStream is a subclass of ostrstream from strstream.h. In this case OutputStringStream specializes the str() method, such that the caller does not have to concern himself with null-terminating the string and unfreezing the ostrstream. */ class OutputStringStream : public ostrstream { public: /** Specialization of ostrstream::str() that takes care of null-terminating the string and unfreezing the ostrstream. */ inline string str() { *this << ends ; // null terminate ostrstream string o_str( ostrstream::str() ) ; freeze( 0 ) ; return o_str ; } private: // To avoid invoking such a member function in the base // class if there is one! string str() const ; }; #endif } // namespace #endif /** \file Header file that defines OutputStringStream. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/src/zipfile.cpp000066400000000000000000000131371351224126100161210ustar00rootroot00000000000000 #include "zipios++/zipios-config.h" #include "zipios++/meta-iostreams.h" #include "zipios++/fcoll.h" #include "zipios++/zipfile.h" #include "zipios++/zipinputstream.h" #include "zipios++/zipios_defs.h" #include "backbuffer.h" namespace zipios { // // Public // ZipFile ZipFile::openEmbeddedZipFile( const string &name ) { // open zipfile, read 4 last bytes close file // create ZipFile object. ifstream ifs( name.c_str(), ios::in | ios::binary ) ; ifs.seekg( -4, ios::end ) ; uint32 start_offset = readUint32( ifs ) ; ifs.close() ; return ZipFile( name, start_offset, 4 ) ; } ZipFile::ZipFile( const string &name , int s_off, int e_off /* , ios::open_mode mode */ ) : _vs( s_off, e_off ) { _filename = name ; ifstream _zipfile( name.c_str(), ios::in | ios::binary ) ; init( _zipfile ) ; } FileCollection *ZipFile::clone() const { return new ZipFile( *this ) ; } ZipFile::~ZipFile() { close() ; } void ZipFile::close() { _valid = false ; } istream *ZipFile::getInputStream( const ConstEntryPointer &entry ) { if ( ! _valid ) throw InvalidStateException( "Attempt to use an invalid FileCollection" ) ; return getInputStream( entry->getName() ) ; } istream *ZipFile::getInputStream( const string &entry_name, MatchPath matchpath ) { if ( ! _valid ) throw InvalidStateException( "Attempt to use an invalid ZipFile" ) ; ConstEntryPointer ent = getEntry( entry_name, matchpath ) ; if ( ent == 0 ) return 0 ; else { ZipInputStream *zis( new ZipInputStream( _filename, static_cast< const ZipCDirEntry * >( ent.get() )-> getLocalHeaderOffset() + _vs.startOffset() ) ) ; zis->getNextEntry(); return zis; } } // // Private // bool ZipFile::init( istream &_zipfile ) { // Check stream error state if ( ! _zipfile ) { setError ( "Error reading from file" ) ; return false ; } _valid = readCentralDirectory( _zipfile ) ; return _valid ; } bool ZipFile::readCentralDirectory ( istream &_zipfile ) { // Find and read eocd. if ( ! readEndOfCentralDirectory( _zipfile ) ) throw FCollException( "Unable to find zip structure: End-of-central-directory" ) ; // Position read pointer to start of first entry in central dir. _vs.vseekg( _zipfile, _eocd.offset(), ios::beg ) ; int entry_num = 0 ; // Giving the default argument in the next line to keep Visual C++ quiet _entries.resize ( _eocd.totalCount(), 0 ) ; while ( ( entry_num < _eocd.totalCount() ) ) { ZipCDirEntry *ent = new ZipCDirEntry ; _entries[ entry_num ] = ent ; _zipfile >> *ent ; if ( ! _zipfile ) { if ( _zipfile.bad() ) throw IOException( "Error reading zip file while reading zip file central directory" ) ; else if ( _zipfile.fail() ) throw FCollException( "Zip file consistency problem. Failure while reading zip file central directory" ) ; else if ( _zipfile.eof() ) throw IOException( "Premature end of file while reading zip file central directory" ) ; } ++entry_num ; } // Consistency check. eocd should start here int pos = _vs.vtellg( _zipfile ) ; _vs.vseekg( _zipfile, 0, ios::end ) ; int remaining = static_cast< int >( _vs.vtellg( _zipfile ) ) - pos ; if ( remaining != _eocd.eocdOffSetFromEnd() ) throw FCollException( "Zip file consistency problem. Zip file data fields are inconsistent with zip file layout" ) ; // Consistency check 2, are local headers consistent with // cd headers if ( ! confirmLocalHeaders( _zipfile ) ) throw FCollException( "Zip file consistency problem. Zip file data fields are inconsistent with zip file layout" ) ; return true ; } bool ZipFile::readEndOfCentralDirectory ( istream &_zipfile ) { BackBuffer bb( _zipfile, _vs ) ; int read_p = -1 ; bool found = false ; while ( ! found ) { if ( read_p < 0 ) if ( ! bb.readChunk ( read_p ) ) { found = false ; break ; } if ( _eocd.read( bb, read_p ) ) { found = true ; break ; } --read_p ; } return found ; } bool ZipFile::confirmLocalHeaders( istream &_zipfile ) { Entries::const_iterator it ; ZipCDirEntry *ent ; int inconsistencies = 0 ; ZipLocalEntry zlh ; for ( it = _entries.begin() ; it != _entries.end() ; it++ ) { ent = static_cast< ZipCDirEntry * >( (*it).get() ) ; _vs.vseekg( _zipfile, ent->getLocalHeaderOffset(), ios::beg ) ; _zipfile >> zlh ; if ( ! _zipfile || zlh != *ent ) { inconsistencies++ ; _zipfile.clear() ; } } return ! inconsistencies ; } void ZipFile::setError ( string error_str ) { _valid = false ; #ifdef _USE_EXCEPTIONS throw error_str ; // define exception class instead. #else cerr << error_str << endl ; // define operator<< for exception class if such a class replaces string #endif } } /** \file The implementation of ZipFile. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Søndergaard 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 */ zipios++-0.1.7/src/ziphead.cpp000066400000000000000000000201131351224126100160730ustar00rootroot00000000000000 #include "zipios++/zipios-config.h" #include "zipios++/meta-iostreams.h" #include #include #include #include "zipios_common.h" #include "zipios++/ziphead.h" #include "zipios++/zipheadio.h" #include "zipios++/zipios_defs.h" #include "outputstringstream.h" namespace zipios { using std::ios ; bool operator== ( const ZipLocalEntry &zlh, const ZipCDirEntry &ze ) { // Not all fields need to be identical. Some of the information // may be put in a data descriptor that trails the compressed // data, according to the specs (The trailing data descriptor // can contain crc_32, compress_size and uncompress_size.) // Experience has shown that extra_field and extra_field_len // can differ too. // cerr << "----- BEGIN -----" << endl ; // cerr << ( zlh.extract_version == ze.extract_version ) << endl ; // cerr << ( zlh.gp_bitfield == ze.gp_bitfield ) << endl ; // cerr << ( zlh.compress_method == ze.compress_method ) << endl ; // cerr << ( zlh.last_mod_ftime == ze.last_mod_ftime ) << endl ; // cerr << ( zlh.last_mod_fdate == ze.last_mod_fdate ) << endl ; // cerr << ( zlh.filename_len == ze.filename_len ) << endl ; // cerr << ( zlh.filename == ze.filename ) << endl ; // cerr << "----- END -----" << endl ; return ( zlh.extract_version == ze.extract_version && zlh.gp_bitfield == ze.gp_bitfield && zlh.compress_method == ze.compress_method && zlh.last_mod_ftime == ze.last_mod_ftime && zlh.last_mod_fdate == ze.last_mod_fdate && zlh.filename_len == ze.filename_len && zlh.filename == ze.filename ) ; } // // ZipLocalEntry methods // const uint32 ZipLocalEntry::signature = 0x04034b50 ; void ZipLocalEntry::setDefaultExtract() { extract_version = 20 ; // version number } string ZipLocalEntry::getComment() const { return "" ; // No comment in a local entry } uint32 ZipLocalEntry::getCompressedSize() const { return compress_size ; } uint32 ZipLocalEntry::getCrc() const { return crc_32 ; } vector< unsigned char > ZipLocalEntry::getExtra() const { return extra_field ; } StorageMethod ZipLocalEntry::getMethod() const { return static_cast< StorageMethod >( compress_method ) ; } string ZipLocalEntry::getName() const { return filename ; } string ZipLocalEntry::getFileName() const { if ( isDirectory() ) return string() ; string::size_type pos ; pos = filename.find_last_of( separator ) ; if ( pos != string::npos ) { // separator found! // isDirectory() check means pos should not be last, so pos+1 is ok return filename.substr( pos + 1 ) ; } else { return filename ; } } uint32 ZipLocalEntry::getSize() const { return uncompress_size ; } int ZipLocalEntry::getTime() const { return ( last_mod_fdate << 16 ) + last_mod_ftime ; // FIXME: what to do with this time date thing? (not only here?) } bool ZipLocalEntry::isValid() const { return _valid ; } bool ZipLocalEntry::isDirectory() const { assert( filename.size() != 0 ) ; return filename[ filename.size() - 1 ] == separator ; } void ZipLocalEntry::setComment( const string & ) { // A local entry cannot hold a comment } void ZipLocalEntry::setCompressedSize( uint32 size ) { compress_size = size ; } void ZipLocalEntry::setCrc( uint32 crc ) { crc_32 = crc ; } void ZipLocalEntry::setExtra( const vector< unsigned char > &extra ) { extra_field = extra ; extra_field_len = extra_field.size() ; } void ZipLocalEntry::setMethod( StorageMethod method ) { compress_method = static_cast< uint16 >( method ) ; } void ZipLocalEntry::setName( const string &name ) { filename = name ; filename_len = filename.size() ; } void ZipLocalEntry::setSize( uint32 size ) { uncompress_size = size ; } void ZipLocalEntry::setTime( int time ) { // FIXME: fix time setting here, and ind flist and elsewhere. Define the // date time semantics before mucking about - how surprising // Mark Donszelmann: added these lines to make zip work for winzip last_mod_fdate = (time >> 16) & 0x0000FFFF; last_mod_ftime = time & 0x0000FFFF; } string ZipLocalEntry::toString() const { OutputStringStream sout ; sout << filename << " (" << uncompress_size << " bytes, " ; sout << compress_size << " bytes compressed)" ; return sout.str() ; } int ZipLocalEntry::getLocalHeaderSize() const { return 30 + filename.size() + extra_field.size() ; } bool ZipLocalEntry::trailingDataDescriptor() const { // gp_bitfield bit 3 is one, if this entry uses a trailing data // descriptor to keep size, compressed size and crc-32 // fields. if ( ( gp_bitfield & 4 ) == 1 ) return true ; else return false ; } FileEntry *ZipLocalEntry::clone() const { return new ZipLocalEntry( *this ) ; } // // ZipCDirEntry methods // const uint32 ZipCDirEntry::signature = 0x02014b50 ; void ZipCDirEntry::setDefaultWriter() { writer_version = 0 ; #ifdef WIN32 writer_version |= static_cast< uint16 >( 0 ) << 8 ; // Windows, DOS #else writer_version |= static_cast< uint16 >( 3 ) << 8 ; // Unix #endif writer_version |= 20 ; // version number } string ZipCDirEntry::getComment() const { return file_comment ; } uint32 ZipCDirEntry::getLocalHeaderOffset() const { return rel_offset_loc_head ; } void ZipCDirEntry::setLocalHeaderOffset( uint32 offset ) { rel_offset_loc_head = offset ; } void ZipCDirEntry::setComment( const string &comment ) { file_comment = comment ; file_comment_len = file_comment.size() ; } string ZipCDirEntry::toString() const { OutputStringStream sout ; sout << filename << " (" << uncompress_size << " bytes, " ; sout << compress_size << " bytes compressed)" ; return sout.str() ; } int ZipCDirEntry::getCDirHeaderSize() const { return 46 + filename.size() + extra_field.size() + file_comment.size() ; } FileEntry *ZipCDirEntry::clone() const { return new ZipCDirEntry( *this ) ; } // // EndOfCentralDirectory methods // const uint32 EndOfCentralDirectory::signature = 0x06054b50 ; bool EndOfCentralDirectory::read( vector &buf, int pos ) { if ( ( buf.size() - pos < sizeof( uint32 ) ) || ( ! checkSignature( &( buf[ pos ] ) ) ) ) return false ; eocd_offset_from_end = buf.size() - pos ; pos += sizeof( uint32 ) ; disk_num = ztohs( &( buf[ pos ] ) ) ; pos += sizeof( uint16 ) ; cdir_disk_num = ztohs( &( buf[ pos ] ) ) ; pos += sizeof( uint16 ) ; cdir_entries = ztohs( &( buf[ pos ] ) ) ; pos += sizeof( uint16 ) ; cdir_tot_entries = ztohs( &( buf[ pos ] ) ) ; pos += sizeof( uint16 ) ; cdir_size = ztohl( &( buf[ pos ] ) ) ; pos += sizeof( uint32 ) ; cdir_offset = ztohl( &( buf[ pos ] ) ) ; pos += sizeof( uint32 ) ; zip_comment_len = ztohs( &( buf[ pos ] ) ) ; pos += sizeof( uint16 ) ; // cerr << "Zip comment length = " << zip_comment_len << endl ; // cerr << "Length of remaining file = " << buf.size() - pos << endl ; return true ; // Dummy } bool EndOfCentralDirectory::checkSignature ( unsigned char *buf ) const { // cerr << "potential header: " << ztohl( buf ) << endl ; return checkSignature( ztohl( buf ) ) ; } } // namespace /** \file Implementation of routines for reading the central directory and local headers of a zip archive. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/src/zipheadio.cpp000066400000000000000000000141141351224126100164270ustar00rootroot00000000000000 #include "zipios++/zipios-config.h" #include "zipios++/meta-iostreams.h" #include #include #include "zipios_common.h" #include "zipios++/zipheadio.h" #include "outputstringstream.h" namespace zipios { std::istream& operator>> ( std::istream &is, ZipLocalEntry &zlh ) { zlh._valid = false ; // set to true upon successful completion. if ( ! is ) return is ; // // Before reading anything we record the position in the stream // // This is a field in the central directory entry, but not // // in the local entry. After all, we know where we are, anyway. // zlh.rel_offset_loc_head = is.tellg() ; if ( zlh.signature != readUint32( is ) ) { // put stream in error state and return is.setstate ( std::ios::failbit ) ; return is ; } zlh.extract_version = readUint16( is ) ; zlh.gp_bitfield = readUint16( is ) ; zlh.compress_method = readUint16( is ) ; zlh.last_mod_ftime = readUint16( is ) ; zlh.last_mod_fdate = readUint16( is ) ; zlh.crc_32 = readUint32( is ) ; zlh.compress_size = readUint32( is ) ; zlh.uncompress_size = readUint32( is ) ; zlh.filename_len = readUint16( is ) ; zlh.extra_field_len = readUint16( is ) ; // Read filename and extra_field readByteSeq( is, zlh.filename, zlh.filename_len ) ; readByteSeq( is, zlh.extra_field, zlh.extra_field_len ) ; if ( is ) zlh._valid = true ; return is ; } std::istream& operator>> ( std::istream &is, DataDescriptor & ) { return is ; } std::istream& operator>> ( std::istream &is, ZipCDirEntry &zcdh ) { zcdh._valid = false ; // set to true upon successful completion. if ( ! is ) return is ; if ( zcdh.signature != readUint32( is ) ) { // put stream in error state and return is.setstate ( std::ios::failbit ) ; return is ; } zcdh.writer_version = readUint16( is ) ; zcdh.extract_version = readUint16( is ) ; zcdh.gp_bitfield = readUint16( is ) ; zcdh.compress_method = readUint16( is ) ; zcdh.last_mod_ftime = readUint16( is ) ; zcdh.last_mod_fdate = readUint16( is ) ; zcdh.crc_32 = readUint32( is ) ; zcdh.compress_size = readUint32( is ) ; zcdh.uncompress_size = readUint32( is ) ; zcdh.filename_len = readUint16( is ) ; zcdh.extra_field_len = readUint16( is ) ; zcdh.file_comment_len = readUint16( is ) ; zcdh.disk_num_start = readUint16( is ) ; zcdh.intern_file_attr = readUint16( is ) ; zcdh.extern_file_attr = readUint32( is ) ; zcdh.rel_offset_loc_head = readUint32( is ) ; // Read filename and extra_field readByteSeq( is, zcdh.filename, zcdh.filename_len ) ; readByteSeq( is, zcdh.extra_field, zcdh.extra_field_len ) ; readByteSeq( is, zcdh.file_comment, zcdh.file_comment_len ) ; if ( is ) zcdh._valid = true ; return is ; } std::ostream &operator<< ( std::ostream &os, const ZipLocalEntry &zlh ) { if ( ! os ) return os ; writeUint32( zlh.signature , os ) ; writeUint16( zlh.extract_version, os ) ; writeUint16( zlh.gp_bitfield , os ) ; writeUint16( zlh.compress_method, os ) ; writeUint16( zlh.last_mod_ftime , os ) ; writeUint16( zlh.last_mod_fdate , os ) ; writeUint32( zlh.crc_32 , os ) ; writeUint32( zlh.compress_size , os ) ; writeUint32( zlh.uncompress_size, os ) ; writeUint16( zlh.filename_len , os ) ; writeUint16( zlh.extra_field_len, os ) ; // Write filename and extra_field writeByteSeq( os, zlh.filename ) ; writeByteSeq( os, zlh.extra_field ) ; return os ; } std::ostream &operator<< ( std::ostream &os, const ZipCDirEntry &zcdh ) { if ( ! os ) return os ; writeUint32( zcdh.signature , os ) ; writeUint16( zcdh.writer_version , os ) ; writeUint16( zcdh.extract_version , os ) ; writeUint16( zcdh.gp_bitfield , os ) ; writeUint16( zcdh.compress_method , os ) ; writeUint16( zcdh.last_mod_ftime , os ) ; writeUint16( zcdh.last_mod_fdate , os ) ; writeUint32( zcdh.crc_32 , os ) ; writeUint32( zcdh.compress_size , os ) ; writeUint32( zcdh.uncompress_size , os ) ; writeUint16( zcdh.filename_len , os ) ; writeUint16( zcdh.extra_field_len , os ) ; writeUint16( zcdh.file_comment_len , os ) ; writeUint16( zcdh.disk_num_start , os ) ; writeUint16( zcdh.intern_file_attr , os ) ; writeUint32( zcdh.extern_file_attr , os ) ; writeUint32( zcdh.rel_offset_loc_head, os ) ; // Write filename and extra_field writeByteSeq( os, zcdh.filename ) ; writeByteSeq( os, zcdh.extra_field ) ; writeByteSeq( os, zcdh.file_comment ) ; return os ; } std::ostream &operator<< ( std::ostream &os, const EndOfCentralDirectory &eocd ) { if ( ! os ) return os ; writeUint32( eocd.signature , os ) ; writeUint16( eocd.disk_num , os ) ; writeUint16( eocd.cdir_disk_num , os ) ; writeUint16( eocd.cdir_entries , os ) ; writeUint16( eocd.cdir_tot_entries, os ) ; writeUint32( eocd.cdir_size , os ) ; writeUint32( eocd.cdir_offset , os ) ; writeUint16( eocd.zip_comment_len , os ) ; writeByteSeq( os, eocd.zip_comment ) ; return os ; } } // namespace /** \file Implementation of I/O functions for the header structures defined in ziphead.h. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/src/zipinputstream.cpp000066400000000000000000000043241351224126100175530ustar00rootroot00000000000000 #include "zipios++/zipios-config.h" #include "zipios++/meta-iostreams.h" #include "zipios++/zipinputstreambuf.h" #include "zipios++/zipinputstream.h" using std::istream; namespace zipios { ZipInputStream::ZipInputStream( std::istream &is, std::streampos pos ) : istream( 0 ), // SGIs basic_ifstream calls istream with 0, but calls basic_ios constructor first?? ifs( 0 ) { izf = new ZipInputStreambuf( is.rdbuf(), pos ) ; // this->rdbuf( izf ) ; is replaced by: this->init( izf ) ; } ZipInputStream::ZipInputStream( const std::string &filename, std::streampos pos ) : istream( 0 ), ifs( 0 ) { ifs = new std::ifstream( filename.c_str(), std::ios::in |std:: ios::binary ) ; izf = new ZipInputStreambuf( ifs->rdbuf(), pos ) ; // this->rdbuf( izf ) ; is replaced by: this->init( izf ) ; } int ZipInputStream::available() { return 1 ; // FIXME: Dummy implementation } void ZipInputStream::closeEntry() { izf->closeEntry() ; } void ZipInputStream::close() { izf->close() ; } // ZipLocalEntry *ZipInputStream::createZipCDirEntry( const string // &name ) {} ConstEntryPointer ZipInputStream::getNextEntry() { clear() ; // clear eof and other flags. return izf->getNextEntry() ; } ZipInputStream::~ZipInputStream() { // It's ok to call delete with a Null pointer. delete izf ; delete ifs ; } } // namespace /** \file Implementation of ZipInputStream. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/src/zipinputstreambuf.cpp000066400000000000000000000076621351224126100202600ustar00rootroot00000000000000 #include "zipios++/zipios-config.h" #include #include "zipios++/meta-iostreams.h" #include #include "zipios++/zipinputstreambuf.h" #include "zipios_common.h" namespace zipios { using std::ios ; using std::cerr ; using std::endl ; ZipInputStreambuf::ZipInputStreambuf( streambuf *inbuf, int s_pos, bool del_inbuf ) : InflateInputStreambuf( inbuf, s_pos, del_inbuf ), _open_entry( false ) {} void ZipInputStreambuf::closeEntry() { if ( ! _open_entry ) return ; // check if we're positioned correctly, otherwise position us correctly int position = _inbuf->pubseekoff(0, ios::cur, ios::in); if ( position != _data_start + static_cast< int >( _curr_entry.getCompressedSize() ) ) _inbuf->pubseekoff(_data_start + _curr_entry.getCompressedSize(), ios::beg, ios::in) ; } void ZipInputStreambuf::close() { } ConstEntryPointer ZipInputStreambuf::getNextEntry() { if ( _open_entry ) closeEntry() ; // read the zip local header istream is( _inbuf ) ; // istream does not destroy the streambuf. is.exceptions( ios::eofbit | ios::failbit | ios::badbit ); try { is >> _curr_entry ; if ( _curr_entry.isValid() ) { _data_start = _inbuf->pubseekoff(0, ios::cur, ios::in); if ( _curr_entry.getMethod() == DEFLATED ) { _open_entry = true ; reset() ; // reset inflatestream data structures // cerr << "deflated" << endl ; } else if ( _curr_entry.getMethod() == STORED ) { _open_entry = true ; _remain = _curr_entry.getSize() ; // Force underflow on first read: setg( &( _outvec[ 0 ] ), &( _outvec[ 0 ] ) + _outvecsize, &( _outvec[ 0 ] ) + _outvecsize ); // cerr << "stored" << endl ; } else { _open_entry = false ; // Unsupported compression format. throw FCollException( "Unsupported compression format" ) ; } } } catch (...) { _open_entry = false ; } if ( _curr_entry.isValid() && _curr_entry.trailingDataDescriptor() ) throw FCollException( "Trailing data descriptor in zip file not supported" ) ; return new ZipLocalEntry( _curr_entry ) ; } ZipInputStreambuf::~ZipInputStreambuf() { } int ZipInputStreambuf::underflow() { if ( ! _open_entry ) return EOF ; // traits_type::eof() if ( _curr_entry.getMethod() == DEFLATED ) return InflateInputStreambuf::underflow() ; // Ok, we're are stored, so we handle it ourselves. int num_b = min( _remain, _outvecsize ) ; int g = _inbuf->sgetn( &(_outvec[ 0 ] ) , num_b ) ; setg( &( _outvec[ 0 ] ), &( _outvec[ 0 ] ), &( _outvec[ 0 ] ) + g ) ; _remain -= g ; if ( g > 0 ) return static_cast< unsigned char >( *gptr() ) ; else return EOF ; // traits_type::eof() } // FIXME: We need to check somew // // // gp_bitfield bit 3 is one, if the length of the zip entry // // is stored in a trailer. // if ( is->good && ( _curr_entry.gp_bitfield & 4 ) != 1 ) // return true ; // else { // is->clear() ; // return false ; // } } // namespace /** \file Implementation of ZipInputStreambuf. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Søndergaard 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 */ zipios++-0.1.7/src/zipios.dsp000066400000000000000000000136741351224126100160060ustar00rootroot00000000000000# Microsoft Developer Studio Project File - Name="zipios" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Static Library" 0x0104 CFG=zipios - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "zipios.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "zipios.mak" CFG="zipios - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "zipios - Win32 Release" (based on "Win32 (x86) Static Library") !MESSAGE "zipios - Win32 Debug" (based on "Win32 (x86) Static Library") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe RSC=rc.exe !IF "$(CFG)" == "zipios - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release" # PROP BASE Intermediate_Dir "Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "Release" # PROP Intermediate_Dir "Release" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c # ADD CPP /nologo /W3 /GX /O2 /I "..\zlib" /I "..\..\zlib" /I ".." /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "_WINDOWS" /YX /FD /c # ADD BASE RSC /l 0x406 /d "NDEBUG" # ADD RSC /l 0x406 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo # ADD LIB32 /nologo !ELSEIF "$(CFG)" == "zipios - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug" # PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "Debug" # PROP Intermediate_Dir "Debug" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c # ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\zlib" /I ".." /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "_WINDOWS" /YX /FD /GZ /c # ADD BASE RSC /l 0x406 /d "_DEBUG" # ADD RSC /l 0x406 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo # ADD LIB32 /nologo !ENDIF # Begin Target # Name "zipios - Win32 Release" # Name "zipios - Win32 Debug" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=.\appendzip.cpp # End Source File # Begin Source File SOURCE=.\backbuffer.h # End Source File # Begin Source File SOURCE=.\basicentry.cpp # End Source File # Begin Source File SOURCE=.\collcoll.cpp # End Source File # Begin Source File SOURCE=.\deflateoutputstreambuf.cpp # End Source File # Begin Source File SOURCE=.\dircoll.cpp # End Source File # Begin Source File SOURCE=.\directory.cpp # End Source File # Begin Source File SOURCE=.\directory.h # End Source File # Begin Source File SOURCE=.\fcoll.cpp # End Source File # Begin Source File SOURCE=.\fcollexceptions.cpp # End Source File # Begin Source File SOURCE=.\fileentry.cpp # End Source File # Begin Source File SOURCE=.\filepath.cpp # End Source File # Begin Source File SOURCE=.\filterinputstreambuf.cpp # End Source File # Begin Source File SOURCE=.\filteroutputstreambuf.cpp # End Source File # Begin Source File SOURCE=.\inflateinputstreambuf.cpp # End Source File # Begin Source File SOURCE=.\outputstringstream.h # End Source File # Begin Source File SOURCE=.\zipfile.cpp # End Source File # Begin Source File SOURCE=.\ziphead.cpp # End Source File # Begin Source File SOURCE=.\zipheadio.cpp # End Source File # Begin Source File SOURCE=.\zipinputstream.cpp # End Source File # Begin Source File SOURCE=.\zipinputstreambuf.cpp # End Source File # Begin Source File SOURCE=.\zipios_common.h # End Source File # Begin Source File SOURCE=.\zipoutputstream.cpp # End Source File # Begin Source File SOURCE=.\zipoutputstreambuf.cpp # End Source File # End Group # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File SOURCE="..\zipios++\basicentry.h" # End Source File # Begin Source File SOURCE="..\zipios++\collcoll.h" # End Source File # Begin Source File SOURCE="..\zipios++\deflateoutputstreambuf.h" # End Source File # Begin Source File SOURCE="..\zipios++\dircoll.h" # End Source File # Begin Source File SOURCE="..\zipios++\fcoll.h" # End Source File # Begin Source File SOURCE="..\zipios++\fcollexceptions.h" # End Source File # Begin Source File SOURCE="..\zipios++\fileentry.h" # End Source File # Begin Source File SOURCE="..\zipios++\filepath.h" # End Source File # Begin Source File SOURCE="..\zipios++\filterinputstreambuf.h" # End Source File # Begin Source File SOURCE="..\zipios++\filteroutputstreambuf.h" # End Source File # Begin Source File SOURCE="..\zipios++\inflateinputstreambuf.h" # End Source File # Begin Source File SOURCE="..\zipios++\meta-iostreams.h" # End Source File # Begin Source File SOURCE="..\zipios++\simplesmartptr.h" # End Source File # Begin Source File SOURCE="..\zipios++\virtualseeker.h" # End Source File # Begin Source File SOURCE="..\zipios++\zipfile.h" # End Source File # Begin Source File SOURCE="..\zipios++\ziphead.h" # End Source File # Begin Source File SOURCE="..\zipios++\zipheadio.h" # End Source File # Begin Source File SOURCE="..\zipios++\zipinputstream.h" # End Source File # Begin Source File SOURCE="..\zipios++\zipinputstreambuf.h" # End Source File # Begin Source File SOURCE="..\zipios++\zipios-config.h" # End Source File # Begin Source File SOURCE="..\zipios++\zipios_defs.h" # End Source File # Begin Source File SOURCE="..\zipios++\zipoutputstream.h" # End Source File # Begin Source File SOURCE="..\zipios++\zipoutputstreambuf.h" # End Source File # End Group # End Target # End Project zipios++-0.1.7/src/zipios.dsw000066400000000000000000000012561351224126100160060ustar00rootroot00000000000000Microsoft Developer Studio Workspace File, Format Version 6.00 # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! ############################################################################### Project: "tests"=..\tests\tests.dsp - Package Owner=<4> Package=<5> {{{ }}} Package=<4> {{{ }}} ############################################################################### Project: "zipios"=.\zipios.dsp - Package Owner=<4> Package=<5> {{{ }}} Package=<4> {{{ }}} ############################################################################### Global: Package=<5> {{{ }}} Package=<3> {{{ }}} ############################################################################### zipios++-0.1.7/src/zipios_common.h000066400000000000000000000026461351224126100170140ustar00rootroot00000000000000#ifndef ZIPIOS_COMMON_H #define ZIPIOS_COMMON_H #include "zipios++/zipios-config.h" #include namespace zipios { using std::vector; static const char separator = '/' ; template< class Type > void operator += ( vector< Type > &v1, const vector< Type > &v2 ) { typename std::vector::const_iterator cit ; for ( cit = v2.begin() ; cit != v2.end() ; ++cit ) v1.push_back( *cit ) ; } template< class T > inline const T& min( const T& a, const T& b ) { return b < a ? b : a ; } } // namespace #endif /** \file Header file containing miscellaneous small functions. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/src/zipoutputstream.cpp000066400000000000000000000045561351224126100177630ustar00rootroot00000000000000 #include "zipios++/zipios-config.h" #include "zipios++/meta-iostreams.h" #include "zipios++/zipoutputstreambuf.h" #include "zipios++/zipoutputstream.h" using std::ostream; namespace zipios { ZipOutputStream::ZipOutputStream( std::ostream &os ) : ostream( 0 ), // SGIs basic_ifstream calls istream with 0, but calls basic_ios constructor first?? ofs( 0 ) { ozf = new ZipOutputStreambuf( os.rdbuf() ) ; init( ozf ) ; } ZipOutputStream::ZipOutputStream( const std::string &filename ) : ostream( 0 ), ofs( 0 ) { ofs = new std::ofstream( filename.c_str(), std::ios::out | std::ios::binary ) ; ozf = new ZipOutputStreambuf( ofs->rdbuf() ) ; this->init( ozf ) ; } void ZipOutputStream::closeEntry() { ozf->closeEntry() ; } void ZipOutputStream::close() { ozf->close() ; if ( ofs ) ofs->close() ; } void ZipOutputStream::finish() { ozf->finish() ; } void ZipOutputStream::putNextEntry( const ZipCDirEntry &entry ) { ozf->putNextEntry( entry ) ; } void ZipOutputStream::putNextEntry(const std::string& entryName) { putNextEntry( ZipCDirEntry(entryName)); } void ZipOutputStream::setComment( const std::string &comment ) { ozf->setComment( comment ) ; } void ZipOutputStream::setLevel( int level ) { ozf->setLevel( level ) ; } void ZipOutputStream::setMethod( StorageMethod method ) { ozf->setMethod( method ) ; } ZipOutputStream::~ZipOutputStream() { // It's ok to call delete with a Null pointer. delete ozf ; delete ofs ; } } // namespace /** \file Implementation of ZipOutputStream. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/src/zipoutputstreambuf.cpp000066400000000000000000000115421351224126100204510ustar00rootroot00000000000000 #include #include "zipios++/zipios-config.h" #include #include "zipios++/meta-iostreams.h" #include #include "zipios++/zipoutputstreambuf.h" namespace zipios { using std::ios ; using std::cerr ; using std::endl ; //using std::min ; ZipOutputStreambuf::ZipOutputStreambuf( streambuf *outbuf, bool del_outbuf ) : DeflateOutputStreambuf( outbuf, false, del_outbuf ), _open_entry( false ), _open ( true ), _method ( DEFLATED ), _level ( 6 ) { } void ZipOutputStreambuf::closeEntry() { if ( ! _open_entry ) return ; closeStream() ; updateEntryHeaderInfo() ; setEntryClosedState( ) ; } void ZipOutputStreambuf::close() { finish() ; } void ZipOutputStreambuf::finish() { if( ! _open ) return ; closeEntry() ; ostream os( _outbuf ) ; writeCentralDirectory( _entries, EndOfCentralDirectory( _zip_comment), os ) ; _open = false ; } ZipOutputStreambuf::~ZipOutputStreambuf() { finish() ; } void ZipOutputStreambuf::putNextEntry( const ZipCDirEntry &entry ) { if ( _open_entry ) closeEntry() ; if ( ! init( _level ) ) cerr << "ZipOutputStreambuf::putNextEntry(): init() failed!\n" ; _entries.push_back( entry ) ; ZipCDirEntry &ent = _entries.back() ; ostream os( _outbuf ) ; // Update entry header info ent.setLocalHeaderOffset( os.tellp() ) ; ent.setMethod( _method ) ; os << static_cast< ZipLocalEntry >( ent ) ; _open_entry = true ; } void ZipOutputStreambuf::setComment( const string &comment ) { _zip_comment = comment ; } void ZipOutputStreambuf::setLevel( int level ) { _level = level ; } void ZipOutputStreambuf::setMethod( StorageMethod method ) { _method = method ; if( method == STORED ) setLevel( NO_COMPRESSION ) ; else if ( method == DEFLATED ) { if( _level == NO_COMPRESSION ) setLevel( DEFAULT_COMPRESSION ) ; } else throw FCollException( "Specified compression method not supported" ) ; } // // Protected and private methods // int ZipOutputStreambuf::overflow( int c ) { return DeflateOutputStreambuf::overflow( c ) ; // // FIXME: implement // cout << "ZipOutputStreambuf::overflow() not implemented yet!\n" ; // return EOF ; } int ZipOutputStreambuf::sync() { return DeflateOutputStreambuf::sync() ; // // FIXME: implement // cout << "ZipOutputStreambuf::sync() not implemented yet!\n" ; // return EOF ; } void ZipOutputStreambuf::setEntryClosedState() { _open_entry = false ; // FIXME: update put pointers to trigger overflow on write. overflow // should then return EOF while _open_entry is false. } void ZipOutputStreambuf::updateEntryHeaderInfo() { if ( ! _open_entry ) return ; ostream os( _outbuf ) ; int curr_pos = os.tellp() ; // update fields in _entries.back() ZipCDirEntry &entry = _entries.back() ; entry.setSize( getCount() ) ; entry.setCrc( getCrc32() ) ; entry.setCompressedSize( curr_pos - entry.getLocalHeaderOffset() - entry.getLocalHeaderSize() ) ; // Mark Donszelmann: added current date and time time_t ltime; time( <ime ); struct tm *now; now = localtime( <ime ); int dosTime = (now->tm_year - 80) << 25 | (now->tm_mon + 1) << 21 | now->tm_mday << 16 | now->tm_hour << 11 | now->tm_min << 5 | now->tm_sec >> 1; entry.setTime(dosTime); // write ZipLocalEntry header to header position os.seekp( entry.getLocalHeaderOffset() ) ; os << static_cast< ZipLocalEntry >( entry ) ; os.seekp( curr_pos ) ; } void ZipOutputStreambuf::writeCentralDirectory( const vector< ZipCDirEntry > &entries, EndOfCentralDirectory eocd, ostream &os ) { int cdir_start = os.tellp() ; std::vector< ZipCDirEntry >::const_iterator it ; int cdir_size = 0 ; for ( it = entries.begin() ; it != entries.end() ; ++it ) { os << *it ; cdir_size += it->getCDirHeaderSize() ; } eocd.setOffset( cdir_start ) ; eocd.setCDirSize( cdir_size ) ; eocd.setTotalCount( entries.size() ) ; os << eocd ; } } // namespace /** \file Implementation of ZipOutputStreambuf. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/tests/000077500000000000000000000000001351224126100143215ustar00rootroot00000000000000zipios++-0.1.7/tests/.cvsignore000066400000000000000000000004341351224126100163220ustar00rootroot00000000000000Makefile Makefile.in stamp-h* example_zip test_flist test_zip test_zipinputstreambuf test_zipinputstream test_dircoll test_collcoll test_appzip test_simplesmartptr test_zipoutputstreambuf test_zipoutputstream zosb.zip zos.zip gentest.zip all_tests tests.plg Debug Release .deps .libs zipios++-0.1.7/tests/Makefile.am000066400000000000000000000025651351224126100163650ustar00rootroot00000000000000 EXTRA_DIST = test.zip file1.txt file2.txt file3.txt testfile.bin AM_CPPFLAGS = -I$(srcdir)/.. LDADD = ../src/libzipios.la noinst_PROGRAMS = \ test_zipinputstreambuf \ test_zipinputstream \ test_zip \ example_zip \ test_dircoll \ test_collcoll \ test_appzip \ test_zipoutputstreambuf \ test_simplesmartptr \ test_zipoutputstream \ test_gzipoutputstream \ all_tests test_zipinputstreambuf_SOURCES = test_zipinputstreambuf.cpp test_zipinputstream_SOURCES = test_zipinputstream.cpp test_zip_SOURCES = test_zip.cpp example_zip_SOURCES = example_zip.cpp test_dircoll_SOURCES = test_dircoll.cpp test_collcoll_SOURCES = test_collcoll.cpp test_appzip_SOURCES = test_appzip.cpp test_zipoutputstreambuf_SOURCES = test_zipoutputstreambuf.cpp test_simplesmartptr_SOURCES = test_simplesmartptr.cpp test_zipoutputstream_SOURCES = test_zipoutputstream.cpp test_gzipoutputstream_SOURCES = test_gzipoutputstream.cpp # Newer versions do not set those flags # You may need to tweak this info on your system #all_tests_CXXFLAGS = @CPPUNIT_CFLAGS@ #all_tests_LDFLAGS = @CPPUNIT_LIBS@ all_tests_CXXFLAGS = all_tests_LDFLAGS = -lcppunit all_tests_SOURCES = \ all_tests.cpp \ zipfiletest.cpp \ zipfiletest.h \ zipinputstreamtest.h \ zipinputstreamtest.cpp \ zipoutputstreamtest.h \ zipoutputstreamtest.cpp \ commontest.h \ commontest.cpp check: ./all_tests ./test_zip ./test_simplesmartptr zipios++-0.1.7/tests/Makefile.vc000066400000000000000000000051731351224126100163760ustar00rootroot00000000000000# # Will build and run test executables with Visual C++ 5 & 6 & 7 # ################## DO NOT EDIT BELOW THIS LINE ############################### !message !message ************** !message Running tests !message ************** !message all: test !include ../win32/Makefile.com CURRENT = $(TST_DIR) ########################################################################### # # Test programs # OBJECTS = all_tests.obj commontest.obj \ example_zip.obj test_appzip.obj test_collcoll.obj \ test_dircoll.obj test_simplesmartptr.obj \ test_zip.obj test_gzipoutputstream.obj \ test_zipinputstream.obj test_zipinputstreambuf.obj \ test_zipoutputstream.obj test_zipoutputstreambuf.obj TESTS = all_test.exe \ example_zip.exe test_appzip.exe test_collcoll.exe \ test_dircoll.exe test_simplesmartptr.exe \ test_zip.exe test_gzipoutputstream.exe \ test_zipinputstream.exe test_zipinputstreambuf.exe \ test_zipoutputstream.exe test_zipoutputstreambuf.exe CPPFLAGS = /nologo /O2 /GX /I.. /D"_WINDOWS" /D"WIN32" /D"NDEBUG" \ /I"$(ZLIB_INC)" /I"$(CPPUNIT_INC)" LINKFLAGS = /LIBPATH:$(ZLIB_LIB) /LIBPATH:$(CPPUNIT_LIB) ########################################################################## # # Building rules # test: $(ZIPIOS_LIB) $(TESTS) @echo Run the tests here $(TESTS): $(OBJECTS) $(ZIPIOS_LIB) $(ZIPIOS_LIB): @cd $(SRC_DIR) @nmake /nologo -f Makefile.vis static @cd $(TST_DIR) .SUFFIXES: .obj .exe .cpp .obj.exe: link /nologo $(LINKFLAGS) $*.obj $(ZIPIOS_LIB) zlib.lib clean: tidy @echo ************* @echo Cleaned tests @echo ************* @if exist *.obj del *.obj @if exist *.exe del *.exe ########################################################################### # Zipios++ - a small C++ library that provides easy access to .zip files. # Copyright (C) 2000 1. Thomas Sndergaard 2. Kevin Shea # Written by Kevin Shea # 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 ############################################################################ zipios++-0.1.7/tests/all_tests.cpp000066400000000000000000000027511351224126100170240ustar00rootroot00000000000000#include #include #include #include #include "zipinputstreamtest.h" #include "zipoutputstreamtest.h" #include "zipfiletest.h" using namespace CppUnit; int main(int argc, char* argv[]) { TextTestResult result; { TestSuite suite; suite.addTest(zipios::ZipOutputStreamTest::suite()); suite.addTest(zipios::ZipInputStreamTest::suite()); suite.addTest(zipios::ZipFileTest::suite()); suite.run(&result); std::cout << result << std::endl; } return result.failures().size(); } /** \file \anchor all_tests_anchor Zipios++ unit test suite. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/tests/commontest.cpp000066400000000000000000000001231351224126100172110ustar00rootroot00000000000000 #include "commontest.h" const std::string zipios::TestFiles::TEST_ZIPFILE_NAME; zipios++-0.1.7/tests/commontest.h000066400000000000000000000006201351224126100166600ustar00rootroot00000000000000#ifndef ZIPIOS_COMMONTEST_H #define ZIPIOS_COMMONTEST_H #include #include namespace zipios { class TestFiles : public std::vector { public: TestFiles() { push_back("all_tests"); push_back("file1.txt"); push_back("file2.txt"); push_back("file3.txt"); } static const std::string TEST_ZIPFILE_NAME; }; } // namespace #endif zipios++-0.1.7/tests/example_zip.cpp000066400000000000000000000040011351224126100173350ustar00rootroot00000000000000 #include "zipios++/zipios-config.h" #include "zipios++/meta-iostreams.h" #include #include "zipios++/zipfile.h" using namespace zipios ; using std::cerr ; using std::cout ; using std::endl ; using std::auto_ptr ; int main() { try { cout << "Instantiating a ZipFile" << endl ; ZipFile zf( "test.zip" ) ; cout << "list length : " << zf.size() << endl ; ConstEntries entries ; entries = zf.entries() ; ConstEntries::iterator it ; for( it = entries.begin() ; it != entries.end() ; it++) cout << *(*it) << endl ; ConstEntryPointer ent = zf.getEntry( "file2.txt", FileCollection::IGNORE ) ; if ( ent != 0 ) { auto_ptr< istream > is( zf.getInputStream( ent ) ) ; cout << "Contents of entry, " << ent->getName() << " :" << endl ; cout << is->rdbuf() ; } cout << "end of main()" << endl ; return 0 ; } catch( exception &excp ) { cerr << "Exception caught in main() :" << endl ; cerr << excp.what() << endl ; } return -1; } /** \file \anchor example_zip_anchor source code to a small program that demonstrates the central elements of Zipios++. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/tests/file1.txt000066400000000000000000000024571351224126100160720ustar00rootroot00000000000000 AUTOMAKE_OPTIONS = gnu EXTRA_DIST = test.zip CXXFLAGS= -g noinst_LIBRARIES = libzipios.a bin_PROGRAMS = test_zip test_izipfilt test_izipstream # test_flist libzipios_a_SOURCES = backbuffer.h fcol.cpp fcol.h \ fcol_common.h fcolexceptions.cpp fcolexceptions.h \ fileentry.cpp fileentry.h flist.cpp \ flist.h flistentry.cpp flistentry.h \ flistscanner.h ifiltstreambuf.cpp ifiltstreambuf.h \ inflatefilt.cpp inflatefilt.h izipfilt.cpp \ izipfilt.h izipstream.cpp izipstream.h \ zipfile.cpp zipfile.h ziphead.cpp \ ziphead.h flistscanner.ll # test_flist_SOURCES = test_flist.cpp test_izipfilt_SOURCES = test_izipfilt.cpp test_izipstream_SOURCES = test_izipstream.cpp test_zip_SOURCES = test_zip.cpp # Notice that libzipios.a is not specified as -L. -lzipios # If it was, automake would not include it as a dependency. # test_flist_LDADD = libzipios.a test_izipfilt_LDADD = libzipios.a -lz test_zip_LDADD = libzipios.a -lz test_izipstream_LDADD = libzipios.a -lz flistscanner.cc : flistscanner.ll $(LEX) -+ -PFListScanner -o$@ $^ zipios++-0.1.7/tests/file2.txt000066400000000000000000000431101351224126100160620ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 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 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 Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. zipios++-0.1.7/tests/file3.txt000066400000000000000000000000101351224126100160530ustar00rootroot00000000000000ABCDEFG zipios++-0.1.7/tests/test.zip000066400000000000000000001041141351224126100160250ustar00rootroot00000000000000PKq(큧/ file1.txtUT &9q9Ux--Tn0}+56IƚBMi1Xulu =6@]?F?VzOlVm8Z0m?!@*.ɓ{ DtH\tF&ۧ 3T9CJA1'y~N }7eɎavT5* xqĜAɎ7eJuU^\0&Ptzuj\#DJow; 4?# t'S:=롗zQ*F!+^'nw/}Oy~J {<$s[lʳ#2241\Tuͨ=tV $!Q4.|# ƨyeQtJ.h R`j& &{8I&YF0ě:Ël0:@J?Ga1Y>a}b73Z|/PKÆ(B~HF file2.txtUT 9q9Ux--\[s6~_Ʈ(%q*U-kˎ$oKI=nuljdwiI~|^iw0 wT6+ !h \)}UnU?%HTI蛲)iM=,=4򓞚&71O&ѓ&}YoO҃WSmK"zcuVfRω l]eѻ3ZzJK]<(u}=_KVuYXt= @OWSzYVzMkwf/pX_oVo˦RKӢ\]<@{Z_nRKմ)Lm͊ YI~6Rx<+kiz x7Jb!n,FȬ겦=kf8ˇtDZF,x7i%}SMUTZJPnUYYҚT#N'ڸώidgsԅ7*/lVVYVڤޙeijaE8teك|^B`7&iT=' ,MUa;$w tRm*Zv@sft/>ӴVU*'iGd;b2{S; b{"5xuiYM "M5L{1dkҏѧxijGsR>M<΅K)taބ_/ Q"OKQ4-(-δħb:,Ja"YVC'a̲"e{0MJ`*mȣRp+ޠSS ӚMUazcCYgu(D%#'uȖP_ =0_SxĿqm+zVf:KCxK##R ~f=2vG-XT-R/z"#:}R]J;k U( WV)4asHKH땮Lk?3K&R'TH~dNMH凹y!3g9'L40\sKY' XhCl^)Qښ>(ĝ%}_! myI]'A {1J0ؤ#7Ȉ7@>cŒ$+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2cgn-+30Dz1B8Ώ^[O(ҹ!+ NC\52Z5l \{Β鲰s}.PG9yˆ Zvy8Q 8""NHk8-@ͦ@HW>hjp_B6MrJa42R5DԸ!#2 X6.@^Nmf61a3i3/:Wo0UHzbCI4i5ɕ*7W]"RJŕ*OWT\RpJk.Uld6+LiUcS[ό ( ( ,p h?æO3燍u8D8XpPKq(큧/ file1.txtUT&9UxPKÆ(B~HF file2.txtUT9UxPK ]( file3.txtUT"9UxPKϼ+@\Zi* ?testfile.binUTe, #include "zipios++/fcollexceptions.h" #include "zipios++/zipfile.h" using namespace zipios ; using std::cerr ; using std::cout ; using std::endl ; using std::auto_ptr ; int main( int , char *argv[] ) { try { cout << "Instantiating a ZipFile" << endl ; ZipFile zf = ZipFile::openEmbeddedZipFile( argv[ 0 ] ) ; cout << "list length : " << zf.size() << endl ; ConstEntries entries ; entries = zf.entries() ; ConstEntries::iterator it ; for( it = entries.begin() ; it != entries.end() ; it++) cout << *(*it) << endl ; ConstEntryPointer ent = zf.getEntry( "file2.txt", FileCollection::IGNORE ) ; if ( ent != 0 ) { auto_ptr< istream > is( zf.getInputStream( ent ) ) ; cout << "Contents of entry, " << ent->getName() << " :" << endl ; cout << is->rdbuf() ; } cout << "end of main()" << endl ; return 0 ; } catch( FCollException &excp ) { cerr << "Exception caught in main() :" << endl ; cerr << excp.what() << endl ; cerr << "\nThe invalid virtual endings exception very probably means that\n" << "this program hasn't had a zip file appended to it with 'appendzip'\n" << "\nTry the following command and re-run " << argv[ 0 ] << " :\n" << " ./appendzip " << argv[ 0 ] << " test.zip\n" << endl ; } catch( exception &excp ) { cerr << "Exception caught in main() :" << endl ; cerr << excp.what() << endl ; } return -1; } /** \file \anchor example_zip_anchor source code to a small program that demonstrates the central elements of Zipios++. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/tests/test_collcoll.cpp000066400000000000000000000066221351224126100176750ustar00rootroot00000000000000 #include "zipios++/zipios-config.h" #include "zipios++/meta-iostreams.h" #include #include "zipios++/dircoll.h" #include "zipios++/zipfile.h" #include "zipios++/collcoll.h" using namespace zipios ; using std::cerr ; using std::cout ; using std::endl ; using std::auto_ptr ; int main() { try { cout << "Instantiating a DirectoryCollection" << endl ; DirectoryCollection dircoll( "." ) ; cout << "Instantiating a ZipFile" << endl ; ZipFile zipfile( "test.zip" ) ; cout << "Instantiating a CollectionCollection" << endl ; CollectionCollection collcoll_orig ; cout << "Adding the zip file and directory collection to the collection collection" << endl ; if ( ! collcoll_orig.addCollection( zipfile ) ) { cerr << "Failed to add the zip file" << endl ; return 1 ; } if ( ! collcoll_orig.addCollection( dircoll ) ) { cerr << "Failed to add the zip file" << endl ; return 1 ; } CollectionCollection collcoll( collcoll_orig ) ; // Test copy constructor CColl::inst() = collcoll ; // test copy-assignment and Singleton instance inst(). // if ( ! collcoll.addCollection( new ZipFile( "test.zip" ) ) ) { // cerr << "Failed to add the zip file" << endl ; // return 1 ; // } // if ( ! collcoll.addCollection( new DirectoryCollection( "." ) ) ) { // cerr << "Failed to add the zip file" << endl ; // return 1 ; // } // cout << "list length : " << collcoll.size() << endl ; // ConstEntries entries ; // entries = collcoll.entries() ; // ConstEntries::iterator it ; // for( it = entries.begin() ; it != entries.end() ; it++) // cout << *(*it) << endl ; ConstEntryPointer ent = CColl::inst().getEntry( "file2.txt" ) ; if ( ent != 0 ) { auto_ptr< istream > is( CColl::inst().getInputStream( ent ) ) ; cout << "Contents of entry, " << ent->getName() << " :" << endl ; cout << is->rdbuf() ; } ent = CColl::inst().getEntry( "flistentry.cpp" ) ; if ( ent != 0 ) { auto_ptr< istream > is( CColl::inst().getInputStream( ent ) ) ; cout << "Contents of entry, " << ent->getName() << " :" << endl ; cout << is->rdbuf() ; } cout << "end of main()" << endl ; return 0 ; } catch( exception &excp ) { cerr << "Exception caught in main() :" << endl ; cerr << excp.what() << endl ; } return -1; } /** \file \anchor example_zip_anchor source code to a small program that demonstrates the central elements of Zipios++. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/tests/test_dircoll.cpp000066400000000000000000000044731351224126100175240ustar00rootroot00000000000000 #include "zipios++/zipios-config.h" #include "zipios++/meta-iostreams.h" #include #include "zipios++/dircoll.h" using namespace zipios ; using std::cerr ; using std::cout ; using std::endl ; using std::auto_ptr ; int main() { try { cout << "Instantiating a DirectoryCollection" << endl ; DirectoryCollection collection( "../zipios++" ) ; ConstEntryPointer ent = collection.getEntry( "zipios-config.h" ) ; if ( ent != 0 ) { auto_ptr< istream > is( collection.getInputStream( ent ) ) ; cout << "Contents of entry, " << ent->getName() << " :" << endl ; cout << is->rdbuf() ; } cout << "list length : " << collection.size() << endl ; ConstEntries entries ; entries = collection.entries() ; ConstEntries::iterator it ; for( it = entries.begin() ; it != entries.end() ; it++) cout << *(*it) << endl ; ent = collection.getEntry( "zipios-config.h" ) ; if ( ent != 0 ) { auto_ptr< istream > is( collection.getInputStream( ent ) ) ; cout << "Contents of entry, " << ent->getName() << " :" << endl ; cout << is->rdbuf() ; } cout << "end of main()" << endl ; return 0 ; } catch( exception &excp ) { cerr << "Exception caught in main() :" << endl ; cerr << excp.what() << endl ; } return -1; } /** \file \anchor example_zip_anchor source code to a small program that demonstrates the central elements of Zipios++. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/tests/test_gzipoutputstream.cpp000066400000000000000000000044421351224126100215360ustar00rootroot00000000000000#include "zipios++/zipios-config.h" #include "zipios++/meta-iostreams.h" #include #include #include "zipios++/gzipoutputstream.h" using namespace zipios ; using std::cerr ; using std::cout ; using std::endl ; using std::ifstream ; using std::ofstream ; using std::ios ; using std::string ; using std::exception ; void writeFileToGZIPOutputStream( GZIPOutputStream &zos, const string &filename ) ; int main() { try { GZIPOutputStream ozs("zos.gz") ; writeFileToGZIPOutputStream( ozs, "test.xml" ) ; cerr << "End of main" << endl ; return 0; } catch( exception &excp ) { cerr << "Exception caught in main() :" << endl ; cerr << excp.what() << endl ; } return -1; } void writeFileToGZIPOutputStream( GZIPOutputStream &zos, const string &filename ) { ifstream ifs( filename.c_str(), ios::in | ios::binary ) ; zos.setFilename(filename); zos.setComment("ZIPIOS++ TestFile"); zos << ifs.rdbuf() ; cerr << "ostream Stream state: " ; cerr << "good() = " << zos.good() << ",\t" ; cerr << "fail() = " << zos.fail() << ",\t" ; cerr << "bad() = " << zos.bad() << ",\t" ; cerr << "eof() = " << zos.eof() << endl ; cerr << "istream Stream state: " ; cerr << "good() = " << ifs.good() << ",\t" ; cerr << "fail() = " << ifs.fail() << ",\t" ; cerr << "bad() = " << ifs.bad() << ",\t" ; cerr << "eof() = " << ifs.eof() << endl ; } /** \file Source for a test program for testing GZIPOutputStream. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/tests/test_simplesmartptr.cpp000077500000000000000000000047051351224126100211630ustar00rootroot00000000000000 #include "zipios++/zipios-config.h" #include "zipios++/meta-iostreams.h" #include #include #include "zipios++/simplesmartptr.h" #include using namespace zipios ; using std::cerr ; using std::cout ; using std::endl ; using std::auto_ptr ; using std::ofstream ; using std::vector ; /* We don't want Bogus in the doxygen generated class index :-) */ #ifndef DOXYGEN namespace zipios { class Bogus { public: Bogus(bool &isAlive) : _isAlive(isAlive) {} ~Bogus() { _isAlive = false; } protected: // http://support.microsoft.com/default.aspx?scid=kb;EN-US;168384 friend class SimpleSmartPointer< Bogus > ; friend class SimpleSmartPointer< const Bogus > ; void ref() const { _refcount.ref() ; } unsigned int unref() const { return _refcount.unref() ; } unsigned int getReferenceCount() const { return _refcount.getReferenceCount() ; } ReferenceCount< Bogus > _refcount ; bool &_isAlive; }; } // namespace typedef SimpleSmartPointer< Bogus > SPBogus ; #endif int main() { bool isAlive = true; { Bogus *p = new Bogus(isAlive); SPBogus sp1( p ) ; assert( sp1.getReferenceCount() == 1 ); { SPBogus sp2 ; sp2 = sp1 ; assert( sp1.getReferenceCount() == 2 ); { SPBogus sp3 ; sp3 = p ; assert( sp1.getReferenceCount() == 3 ); } assert( sp1.getReferenceCount() == 2 ); assert( isAlive ); } assert( sp1.getReferenceCount() == 1 ); assert( isAlive ); } assert( ! isAlive ); return 0; } /** \file \anchor test_zip_anchor Source code to a small program that tests the functionality of Zipios++. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/tests/test_zip.cpp000066400000000000000000000102651351224126100166720ustar00rootroot00000000000000 #include "zipios++/zipios-config.h" #include "zipios++/meta-iostreams.h" #include #include #include "zipios++/zipfile.h" #include "zipios++/zipinputstream.h" using namespace zipios ; using std::cerr ; using std::cout ; using std::endl ; using std::auto_ptr ; using std::ofstream ; void entryToFile( const string &ent_name, istream &is, const string &outfile, bool cerr_report = false ) ; int main() { try { const string name_zipfile( "test.zip" ) ; const string name_entry1 ( "file1.txt" ) ; const string name_entry2 ( "file2.txt" ) ; const string name_entry3 ( "file3.txt" ) ; const string unzip_ext ( "unzipped" ) ; const string name_uz1 ( name_entry1 + unzip_ext ) ; const string name_uz2 ( name_entry2 + unzip_ext ) ; const string name_uz3 ( name_entry3 + unzip_ext ) ; const string diffcmd ( "diff -q " ) ; const string unzipcmd ( "unzip -oq " ) ; ZipFile rzf( name_zipfile ) ; ZipFile zf( rzf ) ; // Test copy constructor // ZipFile zf( name_zipfile ) ; ConstEntries entries = zf.entries() ; // cout << "\nEntries (" << zf.size() << "):\n" ; // ConstEntries::iterator it ; // for( it = entries.begin() ; it != entries.end() ; it++) // cout << *(*it) << endl ; // cout << "\n" ; // Unzip second entry ConstEntryPointer ent = zf.getEntry( name_entry2, FileCollection::IGNORE ) ; if ( ent != 0 ) { auto_ptr< istream > is( zf.getInputStream( ent ) ) ; entryToFile( name_entry2, *is, name_uz2 ) ; } // Unzip first entry ent = zf.getEntry( name_entry1, FileCollection::IGNORE ) ; if ( ent != 0 ) { auto_ptr< istream > is( zf.getInputStream( ent ) ) ; entryToFile( name_entry1, *is, name_uz1 ) ; } // Unzip third entry, by use of ZipInputStream alone ZipInputStream zf2( name_zipfile ) ; zf2.getNextEntry() ; zf2.getNextEntry() ; entryToFile( name_entry3, zf2, name_uz3 ) ; // cerr << "Unzipping entries using 'unzip' to get references to 'diff' against :\n" ; system( string( unzipcmd + name_zipfile + " " + name_entry1 + " " + name_entry2 + " " + name_entry3 ).c_str() ) ; // cerr << "\nOutput from " << diffcmd << " :\n" ; // Fail if any one of the fails return system( string( diffcmd + name_uz1 + " " + name_entry1 ).c_str() ) + system( string( diffcmd + name_uz2 + " " + name_entry2 ).c_str() ) + system( string( diffcmd + name_uz3 + " " + name_entry3 ).c_str() ) ; } catch( exception &excp ) { cerr << "Exception caught in main() :" << endl ; cerr << excp.what() << endl ; } return -1; } void entryToFile( const string &, istream &is, const string &outfile, bool cerr_report ) { ofstream ofs( outfile.c_str(), ios::out | ios::binary ) ; // cout << "writing " << ent_name << " to " << outfile << endl ; ofs << is.rdbuf() ; if ( cerr_report ) { cerr << "Stream state: " ; cerr << "good() = " << is.good() << ",\t" ; cerr << "fail() = " << is.fail() << ",\t" ; cerr << "bad() = " << is.bad() << ",\t" ; cerr << "eof() = " << is.eof() << endl << endl; } ofs.close() ; } /** \file \anchor test_zip_anchor Source code to a small program that tests the functionality of Zipios++. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/tests/test_zipinputstream.cpp000066400000000000000000000036731351224126100211730ustar00rootroot00000000000000 #include "zipios++/zipios-config.h" #include "zipios++/meta-iostreams.h" #include "zipios++/fcollexceptions.h" #include "zipios++/zipinputstream.h" using namespace zipios ; using std::cerr ; using std::cout ; using std::endl ; int main() { try { ZipInputStream is( "test.zip" ) ; // string str ; // while ( is ) { // getline( is, str ) ; // cout << str ; // } cout << is.rdbuf() ; is.getNextEntry() ; cout << is.rdbuf() ; is.getNextEntry() ; cout << is.rdbuf() ; cerr << "Stream.state:" << endl ; cerr << "is.good() = " << is.good() << endl ; cerr << "is.fail() = " << is.fail() << endl ; cerr << "is.bad() = " << is.bad() << endl ; cerr << "is.eof() = " << is.eof() << endl << endl; cerr << "End of main" << endl ; } catch( IOException &e ) { cerr << "IOException caught in main:" << endl ; cerr << e.what() << endl ; } catch( ... ) { cerr << "Unspecified exception caught in main:" << endl ; } return 0; } /** \file Source for a test program for testing ZipInputStream. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/tests/test_zipinputstreambuf.cpp000066400000000000000000000030031351224126100216530ustar00rootroot00000000000000 #include "zipios++/zipios-config.h" #include "zipios++/meta-iostreams.h" #include "zipios++/zipinputstreambuf.h" using namespace zipios ; using std::cerr ; using std::cout ; using std::endl ; using std::ifstream ; using std::ios ; int main() { ifstream f( "test.zip", ios::in | ios::binary ) ; ZipInputStreambuf izf( f.rdbuf() ) ; istream is( &izf ) ; // string str ; // while ( is ) { // getline( is, str ) ; // cout << str ; // } cout << is.rdbuf() ; izf.getNextEntry() ; istream is2( &izf ) ; cout << is2.rdbuf() ; cerr << "End of main" << endl ; return 0; } /** \file Source for a test program for testing ZipInputStreambuf. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/tests/test_zipoutputstream.cpp000066400000000000000000000046751351224126100213770ustar00rootroot00000000000000#include "zipios++/zipios-config.h" #include "zipios++/meta-iostreams.h" #include #include "zipios++/zipoutputstream.h" using namespace zipios ; using std::cerr ; using std::cout ; using std::endl ; using std::ifstream ; using std::ios ; using std::string ; void writeFileToZipOutputStream( ZipOutputStream &zos, const string &filename ) ; int main() { try { ZipOutputStream ozs( "zos.zip" ) ; writeFileToZipOutputStream( ozs, "test_zip" ) ; writeFileToZipOutputStream( ozs, "test_dircoll" ) ; writeFileToZipOutputStream( ozs, "test.zip" ) ; writeFileToZipOutputStream( ozs, "test_simplesmartptr" ) ; writeFileToZipOutputStream( ozs, "test_appzip" ) ; cerr << "End of main" << endl ; return 0; } catch( exception &excp ) { cerr << "Exception caught in main() :" << endl ; cerr << excp.what() << endl ; } return -1; } void writeFileToZipOutputStream( ZipOutputStream &zos, const string &filename ) { zos.putNextEntry( ZipCDirEntry( filename ) ) ; ifstream ifs( filename.c_str(), ios::in | ios::binary ) ; zos << ifs.rdbuf() ; cerr << "ostream Stream state: " ; cerr << "good() = " << zos.good() << ",\t" ; cerr << "fail() = " << zos.fail() << ",\t" ; cerr << "bad() = " << zos.bad() << ",\t" ; cerr << "eof() = " << zos.eof() << endl ; cerr << "istream Stream state: " ; cerr << "good() = " << ifs.good() << ",\t" ; cerr << "fail() = " << ifs.fail() << ",\t" ; cerr << "bad() = " << ifs.bad() << ",\t" ; cerr << "eof() = " << ifs.eof() << endl ; } /** \file Source for a test program for testing ZipOutputStream. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/tests/test_zipoutputstreambuf.cpp000066400000000000000000000051061351224126100220620ustar00rootroot00000000000000#include "zipios++/zipios-config.h" #include "zipios++/meta-iostreams.h" #include #include "zipios++/zipoutputstreambuf.h" using namespace zipios ; using std::cerr ; using std::cout ; using std::endl ; using std::ifstream ; using std::ios ; using std::ofstream ; using std::string ; void writeFileToZipOutputStreambuf( ZipOutputStreambuf &zosb, const string &filename ) ; int main() { try { ofstream of( "zosb.zip", ios::out | ios::binary ) ; ZipOutputStreambuf ozf( of.rdbuf() ) ; writeFileToZipOutputStreambuf( ozf, "test_zip" ) ; writeFileToZipOutputStreambuf( ozf, "test_dircoll" ) ; cerr << "End of main" << endl ; return 0; } catch( exception &excp ) { cerr << "Exception caught in main() :" << endl ; cerr << excp.what() << endl ; } return -1; } void writeFileToZipOutputStreambuf( ZipOutputStreambuf &zosb, const string &filename ) { zosb.putNextEntry( ZipCDirEntry( filename ) ) ; ifstream ifs( filename.c_str(), ios::in | ios::binary ) ; ostream ozs( &zosb ) ; ozs << ifs.rdbuf() ; cerr << ifs.rdbuf() ; // char buf[ 100 ] ; // int rds ; // while ( ( rds = ifs.rdbuf()->sgetn( buf, 100 ) ) > 0 ) // ozs.write( buf, rds ) ; cerr << "ostream Stream state: " ; cerr << "good() = " << ozs.good() << ",\t" ; cerr << "fail() = " << ozs.fail() << ",\t" ; cerr << "bad() = " << ozs.bad() << ",\t" ; cerr << "eof() = " << ozs.eof() << endl << endl; cerr << "istream Stream state: " ; cerr << "good() = " << ifs.good() << ",\t" ; cerr << "fail() = " << ifs.fail() << ",\t" ; cerr << "bad() = " << ifs.bad() << ",\t" ; cerr << "eof() = " << ifs.eof() << endl << endl; } /** \file Source for a test program for testing ZipOutputStreambuf. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/tests/testfile.bin000066400000000000000000002252641351224126100166450ustar00rootroot00000000000000! / 909021130 0 1190 ` D )Z)Z)Z)ZMRMRMRMRMRMRkkkkkkkk~~~~~bbbbbbb>>>>>>>>>&00000000000000000##&_inflate_fast_inflate_flush_inflate_mask_inflate_codes_inflate_codes_free_inflate_codes_new_inflate_copyright_inflate_trees_bits_inflate_trees_dynamic_inflate_trees_fixed_inflate_blocks_inflate_blocks_free_inflate_blocks_new_inflate_blocks_reset_inflate_blocks_sync_point_inflate_set_dictionary_inflate_inflateEnd_inflateInit2__inflateInit__inflateReset_inflateSetDictionary_inflateSync_inflateSyncPoint_zError_z_errmsg_zcalloc_zcfree_zlibVersion__dist_code__length_code__tr_align__tr_flush_block__tr_init__tr_stored_block__tr_tally_deflate_deflateCopy_deflateEnd_deflateInit2__deflateInit__deflateParams_deflateReset_deflateSetDictionary_deflate_copyright_uncompress_gzclose_gzdopen_gzeof_gzerror_gzflush_gzgetc_gzgets_gzopen_gzprintf_gzputc_gzputs_gzread_gzrewind_gzseek_gzsetparams_gztell_gzwrite_crc32_get_crc_table_compress_compress2_adler32/ 909021130 0 1114 `  Z)RMk~b>&0#&D  __dist_code__length_code__tr_align__tr_flush_block__tr_init__tr_stored_block__tr_tally_adler32_compress_compress2_crc32_deflate_deflateCopy_deflateEnd_deflateInit2__deflateInit__deflateParams_deflateReset_deflateSetDictionary_deflate_copyright_get_crc_table_gzclose_gzdopen_gzeof_gzerror_gzflush_gzgetc_gzgets_gzopen_gzprintf_gzputc_gzputs_gzread_gzrewind_gzseek_gzsetparams_gztell_gzwrite_inflate_inflateEnd_inflateInit2__inflateInit__inflateReset_inflateSetDictionary_inflateSync_inflateSyncPoint_inflate_blocks_inflate_blocks_free_inflate_blocks_new_inflate_blocks_reset_inflate_blocks_sync_point_inflate_codes_inflate_codes_free_inflate_codes_new_inflate_copyright_inflate_fast_inflate_flush_inflate_mask_inflate_set_dictionary_inflate_trees_bits_inflate_trees_dynamic_inflate_trees_fixed_uncompress_zError_z_errmsg_zcalloc_zcfree_zlibVersioninffast.obj/ 909021130 100666 2321 ` Lɏ.6 .drectve& .text P`.data4@0-defaultlib:LIBC -defaultlib:OLDNAMES UHEMUBE̋MQ UEHM؋UB4EMU;Q0sEH0+MM UB,+EEȋMȉMԋUE܋M UЃ}s1ẼE̋M3ҊME ‰EMMU؃UɋE#E܋MUE3ɊM}uDU3BȋUUE3ɊHU+щU؋EMQEEMԃM&U3BȋUUE3ɊHU+щU؋EMMUE#MQЉUEMEM+MM؃}s3ŨŰE3ɊыME ‰EMMU؃UNjE#EЋMUE3ɊMU3BȋUUE3ɊHU+щU؋ElMMU;Us1ẼE̋M3ҊME ‰EMMU؃UNjEM# UBEUMUE+EE؋M+MMԋUE+B(;ErUM+MMUE UUEEMMUE UUEEMMbUE+B(M+ȉMUB,+EEM;Mv=U+UUEMEEMMUU}uՋEH(MUE UUEEMM}uU@u4EHUʉEMU#E ЉMU3EMAUB+ẺEM;Ms UUEEċMĉMUUŰE+EEMU+щU؋EMH UE؉BMỦQEM+UBMAUEMUQ4uM@u|UBMUEM# UʉEM3ҊU}uBE3ɊHUUE3ɊHU+щU؋EMQEEMԃM^LU EH+M̉MU;Us EEMMUUEEE̋M+MMUE+‰E؋MUQ EM؉HUẺBMU+EHʋUJEMUEB4VMAUB+ẺEM;Ms UUEEMMUUŰE+EEMU+щU؋EMH UE؉BMỦQEM+UBMAUEMUQ4}r } -MQ+ỦUE;Es MMUUEEMMM̋U+UUEM+ȉM؋UEB MU؉QEM̉HUE+MQЋEPMUEMH43]f s V F   }  invalid distance codeinvalid literal/length code.fileginffast.c.drectve&.text .data4$SG510$SG504 _inflate_fast_inflate_mask infutil.obj/ 909021130 100666 964 ` Lɏ.6 .drectve& .dataD@@.text P`-defaultlib:LIBC -defaultlib:OLDNAMES ??UE H MUB0EMU;Q4w EH4M UB,EM+MMU E;Bv M QU}t }uEE H+MU JE HMU JEx8t*MQUREH Rn. N `QURq1 P a! A PY S;y9 Qi)  I PUPS+u5 Q e% E P] TS}= Rm-  M PSUS#s3 Q c# C P[ TC{; Rk+  K PWS3w7 Qg' G P _ Tc? Ro/ O `PTsRp0 P ` @ PX S;x8 Qh( H PTUS+t4 Q d$ D P\ TS|< Rl,  L PRUS#r2 Q b" B PZ TCz: Rj*  J PVS3v6 Qf& F P ^ Tc~> Rn. N `QURq1 P a! A PY S;y9 Qi)  I PUPS+u5 Q e% E P] TS}= Rm-  M PSUS#s3 Q c# C P[ TC{; Rk+  K PWS3w7 Qg' G P _ Tc? Ro/ O PWS[QYUA]@PXT!\ R ZV`PWS[QYUa]`PXT1\0R Z V`oversubscribed dynamic bit lengths treeincomplete dynamic bit lengths treeoversubscribed literal/length treeincomplete literal/length treeoversubscribed distance treeincomplete distance treeempty distance tree with lengths inflate 1.1.3 Copyright 1995-1998 Mark Adler  #+3;CScspp !1Aa  0@` U EjjEH(QUR E}usEPMQURE PMQjjjjUR(E}u E@}tM 9uUBEEPMQ(REP$E]UEEMUUEMMUEEMUUEMMUEEMUUEMMUEEMUUEMMUEEMUUEMMUEEMUUEEM ULULMMuʋE;E uMU 35E Dž   w |t׋ ; s Džt|t׋`;v E  ≕  ቍ ;s+ +L} 몋+D} TTDž $UU(ht9U  h hhMM믋UUDžE EEt6 E,  ;E r` U Dž M,MDžډdDžpEDž;`DEMUUd9#dd`+d;v +d  lM9lUl+‰lTh ;sb  ;sEllhhhl;whl+l랸 M(v E(U$ʉEUpE(U( t} U튅 E싍d+ꉕ M+l+ Ml UȋUTEM+dUE M,9UrE^E;Ms&U:$`EMUEE.M+UE PMU+EMUEE+d≕ld艅  l ;s MUUTȋ  鉍 # t3 ΋3 d#; t9d+ddt`t Dž Dž]U Ejh E(H(QU(R E}u JEPMQU$REPMQhhhUREP(E}uM9uE}u U(B}tE(@EMQU(B(PM(Q$EUREPM$QURE PhhjM QUE Q(E}uU:ud}v[}u E(@0}uM(AE}tU(BEEPM(Q(RE(P$EMQU(B(PM(Q$3]UE U MU3]Rh     K P e       ! .fileginftrees.c.drectve&.data"1.rdata @M0Zg0t.text)  $SG5170$SG513 v  $SG548$SG545$SG542$SG538x$SG535T  _fixed_td$S553_fixed_tl$S552_fixed_bd$S551_fixed_bl$S550_cpdext$S414_cpdist$S413_cplext$S412_cplens$S411_inflate_copyright_inflate_trees_bits_huft_build_inflate_trees_dynamic_inflate_trees_fixed infblock.obj/ 909021128 100666 7704 ` LǏ.6..drectve& .rdataL@@@.text&< P`.datarD@0-defaultlib:LIBC -defaultlib:OLDNAMES      U}t EMQ<E8tM9uUB PM Q(RE P$M9uU REHQUE@MA UEH(J4UEH4J0Uz8t!jjjEP8 MA1.drectve& .rdata@0@.texto M & P`.datau @0-defaultlib:LIBC -defaultlib:OLDNAMES U}t ExuPMAUBE@MQB MQjEPMQBP 3]U}tExt My$uEUBxtMQUBHQUBPMQ(REP$MA3]U}tE;u}8t :}u *E@My uUB E@(My$u UB$jjEH(QUR MAUzu EHAUB@ } }M ىM UB@ } |} ~MQoUBM HM REHQ ҁREP MQBEHyuUREP3]UEPM QjUR]U }tExtM9u n3҃} JU EJMQE} )M$UzuEE EMQEPMQEPMEH3AMQBMMt(UB MAUB@MQBMQ;Bv(EH UBEHAWUBMyuE?U UEHUJEHUJE3ҊUEU EHAE3ҹt(UB MAUB@M uUBMQExuEM MUBMAUBMAU3ɊUBHMEMQExuE#M MUBMAUBMAUBM3Ɋ PыEHQUMUBMyuEU UEHUJEHUJEHU3ҊA‹MQBEU EHUzuEGE EMQEPMQEPMQE3JȋUBHMEMQEJH0UBMQ E@MQBEPMQUBHQ E}uUB MQBa}uE E}tELM MUBPMQUBHQ UBx tMQ EHUzuEE EMQEPMQEPM3MQBEU EH UzuEE EMQEPMQEPMQE3JȋUBHMEMQ ExuEM MUBMAUBMAUBM3Ɋ PыEHQUMUB MyuEU UEHUJEHUJEHU3ҊA‹MQBEU EHUBI;Ht%UB MAUB@!MQ  ]UQEE}tMyt UB8t MQU Rj M;A0tkUB0EHI9Ur$EHIUE+EM ȉM URE PMQBP MQ3]U}t Exu /MQ: tEH UB@MQU}u EMUBHM}tZ}sTU3M3Ҋ;u EEM3Ҋt E +EEMMUU렋EM+UBMAUEMUQEHUQ}t>EHMUBEMQUEBMUQEH3]U}tExt MQzuEHQR]`  'D  / L +6*x)(('V& %$#"!         " _  -n  f 01.1.3unknown compression methodinvalid window sizeincorrect header checkneed dictionaryincorrect data check.fileginflate.c.drectve&.rdata.texto &% 3 Ik U j y _adler32 _zcfree _zcalloc .datau$SG451: _inflateU $L515$L514$L510,$L508$L506P$L504$L499C$L497$L495$L493$$L491$L489S$L484$L478$SG513` $SG498P$SG4878$SG483$$SG481$L553&     6   _?mark@?3??inflateSync@@9@9$S541_inflateReset_inflate_blocks_reset_inflateEnd_inflate_blocks_free_inflateInit2__inflate_blocks_new_inflateInit__inflate_blocks_inflateSetDictionary_inflate_set_dictionary_inflateSync_inflateSyncPoint_inflate_blocks_sync_point zutil.obj/ 909021128 100666 1151 ` LƏ.6l.drectve& .data @@.bss0.textXD P`-defaultlib:LIBC -defaultlib:OLDNAMES need dictionarystream endfile errorstream errordata errorinsufficient memorybuffer errorincompatible version1.1.3     $ U]U+E]U}tE+EM ȉM URE P]UE P]>O.filegzutil.c.drectve&.data .bss$SG410$SG409$SG408$SG407l$SG406`$SG405P$SG404D$SG403$SG4028$SG401(.textX $SG412_zError  _zcalloc _calloc _zcfreeG _free _z_errmsg_zlibVersion trees.obj/ 909021128 100666 18080 ` LƏ.6A,.drectve& .dataD@@.rdata@ P@@@.text3 ?4 P`-defaultlib:LIBC -defaultlib:OLDNAMES 4       L,l\<|B"bR2r J*jZ:zF&fV6vN.n^>~A!aQ1q I)iY9yE%eU5u M-m]=}   S S  3 3  s s    K K  + +  k k     [ [  ; ;  { {     G G  ' '  g g     W W  7 7  w w     O O  / /  o o     _ _  ? ?     @ `P0pH(hX8xD$dT4tC#c         (08@P`p  0@`  0@`UEM Uǂ E M Uǂ$ Et M( Uǂ0 EfǀMǁUǂEP]U]UQE EE}}MUfDŽE EE}}MUfDŽ E EE}}MUfDŽt ߋEfǀMǁUǂEǀMǁ]UE+EM9UUEUEff ʋUfE3fUBUR EHUJE3fUBUR EHUJE%M+MfUMTE:MUEff ʋUfEMUjEPM QUR]U E+EM9EUEMff ЋEfM3fEHE@MQEPM3fEHE@MQEPUE+MfUMTE}uEE*MQ$EU9JdEPMQ0UREH0Q UBh+EMAhUBd+EMAdUBT+EMATUBDEMQ H Vbp  _configuration_table$S471_deflate_copyright_deflateInit__deflateInit2__z_errmsg_?my_version@?1??deflateInit2_@@9@9$S489_deflateSetDictionary_deflateReset__tr_init_deflateParams__tr_stored_block__tr_align_putShortMSB_flush_pending_deflateEnd_deflateCopy_deflate_stored__tr_flush_block_fill_window_read_buf_deflate_fast__dist_code__length_code_longest_match_deflate_slowuncompr.obj/ 909021126 100666 718 ` Lŏ.6 .drectve& .text P`.data@0-defaultlib:LIBC -defaultlib:OLDNAMES U@EEċMMȋU;Ut EEЋM UԋE M;t EEj8hUR E}tEWjEPE}t&MQ}u EUUEE M؉UREE]W ` |1.1.3.fileguncompr.c.drectve&.text  _inflate  .data$SG192*_uncompress_inflateEnd_inflateInit_gzio.obj/ 909021126 100666 8223 ` Lď.6.J.drectve& .data;@@.texts P`.bss0-defaultlib:LIBC -defaultlib:OLDNAMES 1.1.31.1.3%c%c%c%c%c%c%c%c%c%c: UjE PMQ ]UlEEE EMM}t} u3{jdE}u3aUB E@$MA(UBDEMAHUB E@MAUB@E@8MA<jjj UBLE@PMAXURPMATUzTuEP3MQUBTPMA\UruMA\rUwt MauE@\wM0|E9U0E;Mfu E'Ehu EUE UUEUUt E9ESMQ\uEP3MQ\wugj8hEPjjjMQUR Eh@MAHUEHHJ }u UzHuEP32Xh@MADUEHD j8hjURE}u ExDuMQ3UB@}}EPMQEUREPEMUQ@Ex@uMQ3tUB\wu>j jjjjjjj QRhEH@Q0UB` 'EPMQ@RM+AUB`E]U}}3)EPhMQ URE PMQ ]UQEE}t MQ\wtaExuDMUBHA MQ@Rh@jEHHQ=@t UB8E@@MQU REP ]UE EE}MQEUE;te}tMQEPME}t&MQEPMEMAXU3zMA8OeUREEPE}u MtUB8 E EE}sMQUtIEPEMQUЉUEMMtURt݋EtMQE}t}tUtEPE}t}tMt&E UU}sEPMQ<҃EP8]UEx<tMyujUB@Ph@jMQDRMAUzu)E@<MQ@B t MA83UEHD UBMAU%MM]UQE}u ExPtMQPRExt8MQ\wuEPEMQ\ruEPEMy@t#UB@Pt=tEMy8} UB8EMyDtUBDPMyHtUBHPMyTtUBTP}t MQE]UEEM M}t UB\rt My8t Uz8uEx8u3M MUE B MUQExbMyXUBEMU;Qv EHM}vVUREQUB P MMMUEB MUEMQ+UEPMQ+UEPMyv*UB@PMQRjEPMQ+ЋEPMU+QUEHMUJEHMUJ}u E@<EMyusUz<ujEH@Qh@jUBDPMAUzu)E@<MQ@B tMA8UEHD jURMA8Uz8EH +MQUREHLQ UBLEH MURM;ALt UB8eEPMQUz8uDEHMUBEMQUEBMUQjjj MALUz8u Ex<tMQ +UREPMQLR MALUE+B]UjEPMQ uUUEE]UE E} t}3bMM}~-jU REP uM E E tċM U;U u}~ EEEE]UQEE}t MQ\wt EM UEBMytpUzuFEMQHP EH@Qh@jUBHP=@t MA8+UB@jEPMA8Uz8t뇋EPM QUBLP MALUE+B]UEEMQU RP EQ3RPMQ ]UE EjMQUR u E%EEE]UE PPM QUR ]U EEM QURE}tE-EH@QUz8u E EH8ME]UEEE}t MQ\wt E@M@+QU}tIEH@QURjEHHQ;EtUB8EMQHP E@@}tpM QURMA8}uUz8u E@8MyuUz8t EEEEMy8t Uz8t+Ex8u E MQ8UE]U EE}t}tMy8t Uz8uEH\w}u UE +BE } }MyDu)h@UBDh@jEHDQ } ~IE@} @}U UEPMQDREP E}u1M +MM 뱋UB}u EM HM } }UzXtPE@MUBDjM QUB@P }MU QEM HE UE ;BrMU +QU EP}t} tMyHuh@UBH} ~FE@} @}E EMQUBHPMQ E}U +UU 봋E@]UQEE}t MQ\rt}E@8MA<UBEMQDjjj MALUz`uEH@Q3$URjEH`QUB@P ]UjjEP ]UEE}tMQ\ru EH >  ( ? j ' '  .  1 0' T -v -  - 6 5|.9 -8:-';(87P _ v  6"@+@7"mAIHGI&+9FbjDvCC.fileggzio.c.drectve&.data;.texts_gzopen _gz_open _ftell _fprintf $SG572__fdopen _fopen _errno $SG567" $SG563_strcpy _strlen _crc32 _malloc _gzdopen _sprintf $SG58201 > _fwrite M [ _fread _destroy7 _fclose e q _free _gzreadJ } _inflate _memcpy _gzgetcY  _gzgets  _gzwrite  _deflate    __chkstk _gzputc_  _gzputs  _gzflush  _fflush  _gzseekJ _fseek _memset W _rewind _gztell _gzeof _getLongE _gzclose _putLongB _fputc _gzerror _strcat $SG8158.bss$SG811$SG810_gz_magic$S512_inflateInit2__deflateInit2__gzsetparams_deflateParams_check_header_get_byte_inflateEnd_deflateEnd_inflateReset_gzprintf_vsprintf_do_flush_gzrewind_z_errmsg crc32.obj/ 909021126 100666 2020 ` Lď.6 .drectve& .rdata@@@.text P`-defaultlib:LIBC -defaultlib:OLDNAMES 0w,aQ mjp5c飕d2yҗ+L |~-d jHqA}mQDžӃVlkdzbeO\lcc=  n;^iLA`rqgjm Zjz  ' }Dңhi]Wbgeq6lknv+ӉZzJgo߹ホCՎ`~ѡ8ROggW?K6H+ L J6`zA`Ugn1yiFafo%6hRw G "/&U;( Z+j\1е,[d&c윣ju m ?6grWJz+{8 Ғ |! ӆBhn[&wowGZpj;f\ eibkaElx TN³9a&g`MGiIwn>JjѮZf @;7SŞϲG0򽽊º0S$6к)WTg#.zfJah]+o*7 Z-U]U} u3EE}nM 3ҊE3%M3щUE E M 3ҊE3%M3щUE E M 3ҊE3%M3щUE E M 3ҊE3%M3щUE E M 3ҊE3%M3щUE E M 3ҊE3%M3щUE E M 3ҊE3%M3щUE E M 3ҊE3%M3щUE E MM}t # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Console Application" 0x0103 CFG=tests - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "tests.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "tests.mak" CFG="tests - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "tests - Win32 Release" (based on "Win32 (x86) Console Application") !MESSAGE "tests - Win32 Debug" (based on "Win32 (x86) Console Application") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe RSC=rc.exe !IF "$(CFG)" == "tests - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release" # PROP BASE Intermediate_Dir "Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "Release" # PROP Intermediate_Dir "Release" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD CPP /nologo /W3 /GX /O2 /I ".." /I "..\..\zlib" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /YX /FD /c # ADD BASE RSC /l 0x406 /d "NDEBUG" # ADD RSC /l 0x406 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 # ADD LINK32 zipios.lib zlibstat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\src\Release" /libpath:"..\..\zlib" !ELSEIF "$(CFG)" == "tests - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug" # PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "Debug" # PROP Intermediate_Dir "Debug" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c # ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I ".." /I "..\..\zlib" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /YX /FD /GZ /c # ADD BASE RSC /l 0x406 /d "_DEBUG" # ADD RSC /l 0x406 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept # ADD LINK32 zipios.lib zlibstat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\src\Debug" /libpath:"..\..\zlib" # Begin Custom Build TargetDir=.\Debug TargetName=tests InputPath=.\Debug\tests.exe SOURCE="$(InputPath)" "$(TargetDir)\$(TargetName).tst" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" $(TargetDir)\$(TargetName) && echo done > $(TargetDir)\$(TargetName).tst # End Custom Build !ENDIF # Begin Target # Name "tests - Win32 Release" # Name "tests - Win32 Debug" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=.\all_tests.cpp # End Source File # Begin Source File SOURCE=.\zipfiletest.cpp # End Source File # End Group # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File SOURCE=.\testcase.h # End Source File # Begin Source File SOURCE=.\zipfiletest.h # End Source File # End Group # Begin Group "Resource Files" # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" # End Group # End Target # End Project zipios++-0.1.7/tests/zipfiletest.cpp000066400000000000000000000104471351224126100173750ustar00rootroot00000000000000 #include "zipios++/zipios-config.h" #include "zipios++/meta-iostreams.h" #include #include #include #include #include #include "zipios++/zipfile.h" #include "zipios++/zipinputstream.h" #include "src/outputstringstream.h" #include "zipfiletest.h" using namespace zipios ; using std::cerr; using std::cout; using std::endl; using std::auto_ptr; using std::ifstream; using std::string; using std::vector; void zipios::ZipFileTest::testUnzip() { vector entries; entries.push_back("file1.txt"); entries.push_back("file2.txt"); entries.push_back("file3.txt"); entries.push_back("testfile.bin"); ZipFile zipFile("test.zip"); CPPUNIT_ASSERT_EQUAL(4, zipFile.size()); compareZipFile("test.zip", entries); } void zipios::ZipFileTest::testZipUnzip() { const string zipFileName = "gentest.zip"; vector entries; entries.push_back("testfile.bin"); entries.push_back("Makefile.in"); entries.push_back("zipfiletest.cpp"); entries.push_back("zipfiletest.h"); entries.push_back("all_tests"); writeZipFile(zipFileName, entries); compareZipFile(zipFileName, entries); } void zipios::ZipFileTest::testComment(){ // ZipFile zipFile("test.zip"); //CPPUNIT_ASSERT_EQUAL("something", zipFile.getComment()); } void zipios::ZipFileTest::writeZipFile(const string &zipFileName, vector entryFileNames) { ZipOutputStream zos(zipFileName); std::vector::const_iterator it = entryFileNames.begin(); for ( ; it != entryFileNames.end() ; ++it ) { writeFileToZipOutputStream(zos, *it); } zos.close(); } void zipios::ZipFileTest::compareZipFile(const string &zipFileName, vector entryFileNames) { using namespace std; ZipFile zipFile(zipFileName); vector::const_iterator it = entryFileNames.begin(); for ( ; it != entryFileNames.end() ; ++it ) { auto_ptr zis(zipFile.getInputStream(*it)); if (zis.get() == 0) CPPUNIT_FAIL("Entry '"+*it+"' not found in zip file"); ifstream fis((*it).c_str(), ios::in | ios::binary); compareStreams(*it, *zis, fis); } } void zipios::ZipFileTest::writeFileToZipOutputStream( ZipOutputStream &zos, const string &filename ) { zos.putNextEntry( ZipCDirEntry( filename ) ) ; ifstream ifs( filename.c_str(), ios::in | ios::binary ) ; if (! ifs) CPPUNIT_FAIL("Could not open file '"+filename+"'"); zos << ifs.rdbuf() ; // cerr << "ostream Stream state: " ; // cerr << "good() = " << zos.good() << ",\t" ; // cerr << "fail() = " << zos.fail() << ",\t" ; // cerr << "bad() = " << zos.bad() << ",\t" ; // cerr << "eof() = " << zos.eof() << endl ; // cerr << "istream Stream state: " ; // cerr << "good() = " << ifs.good() << ",\t" ; // cerr << "fail() = " << ifs.fail() << ",\t" ; // cerr << "bad() = " << ifs.bad() << ",\t" ; // cerr << "eof() = " << ifs.eof() << endl ; } void zipios::ZipFileTest::compareStreams(const std::string& entryName, istream &is1, istream &is2) { OutputStringStream buf1, buf2; buf1 << is1.rdbuf(); buf2 << is2.rdbuf(); CPPUNIT_ASSERT_MESSAGE("Streams differ for entry '"+entryName+"'", buf1.str() == buf2.str()); } void zipios::ZipFileTest::testClone(){ ZipFile zipFile("test.zip"); std::cout<<"Testing cloning..need some help here"< #include #include #include #include #include #include "zipios++/zipoutputstream.h" namespace zipios { using std::string; using std::vector; using std::istream; class ZipFileTest : public CppUnit::TestCase { public: CPPUNIT_TEST_SUITE(ZipFileTest); CPPUNIT_TEST(testUnzip); CPPUNIT_TEST(testZipUnzip); CPPUNIT_TEST(testComment); CPPUNIT_TEST(testClone); CPPUNIT_TEST_SUITE_END(); void testUnzip(); void testZipUnzip(); void testComment(); void testClone(); private: static void writeZipFile(const string &zipFileName, vector entryFileNames); static void compareZipFile(const string &zipFileName, vector entryFileNames); static void writeFileToZipOutputStream(ZipOutputStream &zos, const string &filename ); static void compareStreams(const std::string& entryName, istream &is1, istream &is2); }; } // zipios #endif zipios++-0.1.7/tests/zipinputstreamtest.cpp000066400000000000000000000032651351224126100210310ustar00rootroot00000000000000#include #include "zipios++/zipios-config.h" #include "zipios++/meta-iostreams.h" #include "zipios++/zipinputstream.h" #include "zipinputstreamtest.h" namespace zipios { const TestFiles ZipInputStreamTest::TEST_FILES; void ZipInputStreamTest::testFirstMethod() { CPPUNIT_FAIL( "Implement this" ); } void ZipInputStreamTest::testZipContents() { ZipInputStream zis("test.zip"); int count(0); while (zis.getNextEntry()->isValid()) count++; CPPUNIT_ASSERT_EQUAL(4, count); } void ZipInputStreamTest::testZipContentNames() { vector entries; entries.push_back("file1.txt"); // got these from unzip -l test.zip entries.push_back("file2.txt"); entries.push_back("file3.txt"); entries.push_back("testfile.bin"); ZipInputStream zis("test.zip"); ConstEntryPointer poi(zis.getNextEntry()); int count(0); while( poi->isValid() ) { CPPUNIT_ASSERT_EQUAL( entries[count], poi->getName() ); poi = zis.getNextEntry(); count++; } } void ZipInputStreamTest::testZipFileSizes() { vector entries; entries.push_back(1327); // got these from unzip -l test.zip entries.push_back(17992); entries.push_back(8); entries.push_back(76468); ZipInputStream zis("test.zip"); ConstEntryPointer poi(zis.getNextEntry()); int count(0); while( poi->isValid() ) { CPPUNIT_ASSERT_EQUAL( entries[count], poi->getSize() ); poi = zis.getNextEntry(); count++; } } void ZipInputStreamTest::testDirectory() { ZipInputStream zis("test.zip"); //only files in this ConstEntryPointer poi(zis.getNextEntry()); while( poi->isValid() ) { CPPUNIT_ASSERT_EQUAL( false, poi->isDirectory() ); poi = zis.getNextEntry(); } } } zipios++-0.1.7/tests/zipinputstreamtest.h000066400000000000000000000015661351224126100205000ustar00rootroot00000000000000 #include #include #include #include #include #include #include "commontest.h" #include "zipios++/zipinputstream.h" namespace zipios { using std::string; using std::vector; using std::istream; class ZipInputStreamTest : public CppUnit::TestCase { public: CPPUNIT_TEST_SUITE(ZipInputStreamTest); CPPUNIT_TEST(testFirstMethod); CPPUNIT_TEST(testZipContents); CPPUNIT_TEST(testZipContentNames); CPPUNIT_TEST(testZipFileSizes); CPPUNIT_TEST(testDirectory); CPPUNIT_TEST_SUITE_END(); void testFirstMethod(); void testZipContents(); void testZipContentNames(); void testZipFileSizes(); void testDirectory(); static const TestFiles TEST_FILES; private: int dummy; }; } // zipios zipios++-0.1.7/tests/zipoutputstreamtest.cpp000066400000000000000000000055111351224126100212260ustar00rootroot00000000000000 #include #include "zipios++/zipios-config.h" #include "zipios++/meta-iostreams.h" #include "zipios++/zipoutputstream.h" #include "zipoutputstreamtest.h" using namespace zipios ; using std::cout ; using std::cerr ; using std::endl ; using std::istream ; using std::ios ; using std::ofstream ; using std::string ; const string zipios::ZipOutputStreamTest::TEST_ZIPFILE_NAME = "testout.zip"; const TestFiles zipios::ZipOutputStreamTest::TEST_FILES; void zipios::ZipOutputStreamTest::testNativeUnzip() { if (! hasUnzip()) { cout << "'unzip' not present, skipping ZipFileTest::testNativeUnzip" << endl; return; } ZipOutputStream zos(TEST_ZIPFILE_NAME); std::vector::const_iterator it; for(it=TEST_FILES.begin(); it!=TEST_FILES.end(); ++it) writeFileToZipOutputStream(zos, *it); zos.close(); for(it=TEST_FILES.begin(); it!=TEST_FILES.end(); ++it) assertEntry(TEST_ZIPFILE_NAME, *it); } void zipios::ZipOutputStreamTest::writeFileToZipOutputStream(ZipOutputStream& zos, const string& entryName) { CPPUNIT_FAIL("Implement this"); } void zipios::ZipOutputStreamTest::assertEntry(const string& zipFileName, const string& entryName) { CPPUNIT_FAIL("Implement this"); } bool zipios::ZipOutputStreamTest::hasUnzip() { return system("unzip >/dev/null") == 0; } void zipios::ZipOutputStreamTest::entryToFile(const string &ent_name, istream &is, const string &outfile, bool cerr_report) { ofstream ofs( outfile.c_str(), ios::out | ios::binary ) ; ofs << is.rdbuf() ; if ( cerr_report ) { cerr << "writing " << ent_name << " to " << outfile << endl ; cerr << "Stream state: " ; cerr << "good() = " << is.good() << ",\t" ; cerr << "fail() = " << is.fail() << ",\t" ; cerr << "bad() = " << is.bad() << ",\t" ; cerr << "eof() = " << is.eof() << endl << endl; } ofs.close() ; } /** \file \anchor zipoutputstreamtest_anchor ZipOutputStream test suite. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/tests/zipoutputstreamtest.h000066400000000000000000000021141351224126100206670ustar00rootroot00000000000000#ifndef ZIPIOS_ZIPOUTPUTSTREAMTEST_H #define ZIPIOS_ZIPOUTPUTSTREAMTEST_H #include #include #include #include #include #include #include "commontest.h" #include "zipios++/zipoutputstream.h" namespace zipios { using std::string; using std::vector; using std::istream; class ZipOutputStreamTest : public CppUnit::TestCase { public: CPPUNIT_TEST_SUITE(ZipOutputStreamTest); CPPUNIT_TEST(testNativeUnzip); CPPUNIT_TEST_SUITE_END(); void testNativeUnzip(); private: static bool hasUnzip(); static void entryToFile(const string &ent_name, istream &is, const string &outfile, bool cerr_report); static void writeFileToZipOutputStream(zipios::ZipOutputStream& zos, const std::string& entryName); static void assertEntry(const std::string& zipFileName, const std::string& entryName); static const std::string TEST_ZIPFILE_NAME; static const TestFiles TEST_FILES; }; } // zipios #endif zipios++-0.1.7/win32/000077500000000000000000000000001351224126100141215ustar00rootroot00000000000000zipios++-0.1.7/win32/Makefile.com000077500000000000000000000043511351224126100163440ustar00rootroot00000000000000# # Common configuration settings for Zipios # # # If zlib is not in standard compiler paths, define it here # #ZLIB_INC = .. #ZLIB_LIB = .. ZLIB_INC=d:\zlib-1.1.4 ZLIB_LIB=d:\zlib-1.1.4\WIN32-VC # # If cppunit is not in standard compiler paths, define it here # #CPPUNIT_INC = .. #CPPUNIT_LIB = .. CPPUNIT_INC=d:\cppunit-1.9.11\include CPPUNIT_LIB=d:\cppunit-1.9.11\WIN32-VC ################## DO NOT EDIT BELOW THIS LINE ############################# # # Locations # TOP_DIR = .. INC_DIR = $(TOP_DIR)\zipios++ SRC_DIR = $(TOP_DIR)\src LIB_DIR = $(TOP_DIR)\lib TST_DIR = $(TOP_DIR)\tests BLD_DIR = $(TOP_DIR)\win32 ########################################################################### # # Zipios targets # ZIPIOS_LIB = $(LIB_DIR)\zipios_s.lib ZIPIOS_DLL = $(LIB_DIR)\zipios_d.dll ########################################################################### # # Configuration # CONFIG_HDR = $(INC_DIR)\zipios-config.h W32_FILES = $(CONFIG_HDR) configure: $(W32_FILES) .SUFFIXES: .w32 .h .w32.h: @type $*.w32 > $@ @echo ***************** @echo Zipios configured @echo ***************** ########################################################################### # # Misc # tidy: @if exist *~ del *~ ########################################################################### # Zipios++ - a small C++ library that provides easy access to .zip files. # Copyright (C) 2000 1. Thomas Sndergaard 2. Kevin Shea # Written by Kevin Shea # 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 ############################################################################ zipios++-0.1.7/win32/Makefile.vc000066400000000000000000000032351351224126100161730ustar00rootroot00000000000000# # Will build static and dynamic versions of zipios.lib with Visual C++ 5 & 6 & 7 # ################## DO NOT EDIT BELOW THIS LINE ############################ !message !message *************************** !message Building and Testing Zipios !message *************************** !message all: build test !include ..\win32\Makefile.com ########################################################################### # # Building rules # build: @cd $(SRC_DIR) @nmake -f Makefile.vc test: build @cd $(TST_DIR) @nmake -f Makefile.vc clean: tidy @cd $(SRC_DIR) @nmake -f Makefile.vc clean @cd $(TST_DIR) @nmake -f Makefile.vc clean ############################################################################ # Zipios++ - a small C++ library that provides easy access to .zip files. # Copyright (C) 2000 1. Thomas Sndergaard 2. Kevin Shea # Written by Kevin Shea # 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 ############################################################################ zipios++-0.1.7/win32/configure.bat000077500000000000000000000000621351224126100165730ustar00rootroot00000000000000@echo off nmake -f Makefile.vc configure @echo on zipios++-0.1.7/win32/zipios.dsp000066400000000000000000000126711351224126100161550ustar00rootroot00000000000000# Microsoft Developer Studio Project File - Name="zipios" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Static Library" 0x0104 CFG=zipios - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "zipios.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "zipios.mak" CFG="zipios - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "zipios - Win32 Release" (based on "Win32 (x86) Static Library") !MESSAGE "zipios - Win32 Debug" (based on "Win32 (x86) Static Library") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe RSC=rc.exe !IF "$(CFG)" == "zipios - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release" # PROP BASE Intermediate_Dir "Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "Release" # PROP Intermediate_Dir "Release" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c # ADD CPP /nologo /W3 /GX /O2 /I ".." /I "d:\home\kev\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x406 # ADD RSC /l 0x406 BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo # ADD LIB32 /nologo /out:"zipios.lib" !ELSEIF "$(CFG)" == "zipios - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug" # PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "Debug" # PROP Intermediate_Dir "Debug" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c # ADD CPP /nologo /W3 /GX /Z7 /Od /I ".." /I "..\..\zlib" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /FD /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x406 # ADD RSC /l 0x406 BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo # ADD LIB32 /nologo /out:"zipiosd.lib" !ENDIF # Begin Target # Name "zipios - Win32 Release" # Name "zipios - Win32 Debug" # Begin Group "src" # PROP Default_Filter "" # Begin Source File SOURCE=..\src\backbuffer.h # End Source File # Begin Source File SOURCE=..\src\basicentry.cpp # End Source File # Begin Source File SOURCE=..\src\collcoll.cpp # End Source File # Begin Source File SOURCE=..\src\deflateoutputstreambuf.cpp # End Source File # Begin Source File SOURCE=..\src\dircoll.cpp # End Source File # Begin Source File SOURCE=..\src\directory.cpp # End Source File # Begin Source File SOURCE=..\src\directory.h # End Source File # Begin Source File SOURCE=..\src\fcoll.cpp # End Source File # Begin Source File SOURCE=..\src\fcollexceptions.cpp # End Source File # Begin Source File SOURCE=..\src\fileentry.cpp # End Source File # Begin Source File SOURCE=..\src\filepath.cpp # End Source File # Begin Source File SOURCE=..\src\filterinputstreambuf.cpp # End Source File # Begin Source File SOURCE=..\src\inflateinputstreambuf.cpp # End Source File # Begin Source File SOURCE=..\src\outputstringstream.h # End Source File # Begin Source File SOURCE=..\src\zipfile.cpp # End Source File # Begin Source File SOURCE=..\src\ziphead.cpp # End Source File # Begin Source File SOURCE=..\src\zipinputstream.cpp # End Source File # Begin Source File SOURCE=..\src\zipinputstreambuf.cpp # End Source File # Begin Source File SOURCE="..\src\zipios_common.h" # End Source File # Begin Source File SOURCE=..\src\zipoutputstream.cpp # End Source File # Begin Source File SOURCE=..\src\zipoutputstreambuf.cpp # End Source File # End Group # Begin Group "zipios++" # PROP Default_Filter "" # Begin Source File SOURCE="..\zipios++\basicentry.h" # End Source File # Begin Source File SOURCE="..\zipios++\collcoll.h" # End Source File # Begin Source File SOURCE="..\zipios++\deflateoutputstreambuf.h" # End Source File # Begin Source File SOURCE="..\zipios++\dircoll.h" # End Source File # Begin Source File SOURCE="..\zipios++\fcoll.h" # End Source File # Begin Source File SOURCE="..\zipios++\fcollexceptions.h" # End Source File # Begin Source File SOURCE="..\zipios++\fileentry.h" # End Source File # Begin Source File SOURCE="..\zipios++\filepath.h" # End Source File # Begin Source File SOURCE="..\zipios++\filterinputstreambuf.h" # End Source File # Begin Source File SOURCE="..\zipios++\inflateinputstreambuf.h" # End Source File # Begin Source File SOURCE="..\zipios++\meta-iostreams.h" # End Source File # Begin Source File SOURCE="..\zipios++\simplesmartptr.h" # End Source File # Begin Source File SOURCE="..\zipios++\virtualseeker.h" # End Source File # Begin Source File SOURCE="..\zipios++\zipfile.h" # End Source File # Begin Source File SOURCE="..\zipios++\ziphead.h" # End Source File # Begin Source File SOURCE="..\zipios++\zipinputstream.h" # End Source File # Begin Source File SOURCE="..\zipios++\zipinputstreambuf.h" # End Source File # Begin Source File SOURCE="..\zipios++\zipoutputstream.h" # End Source File # Begin Source File SOURCE="..\zipios++\zipoutputstreambuf.h" # End Source File # End Group # End Target # End Project zipios++-0.1.7/win32/zipios.dsw000066400000000000000000000007721351224126100161630ustar00rootroot00000000000000Microsoft Developer Studio Workspace File, Format Version 6.00 # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! ############################################################################### Project: "zipios"=.\zipios.dsp - Package Owner=<4> Package=<5> {{{ }}} Package=<4> {{{ }}} ############################################################################### Global: Package=<5> {{{ }}} Package=<3> {{{ }}} ############################################################################### zipios++-0.1.7/zipios++.spec.in000066400000000000000000000036721351224126100161130ustar00rootroot00000000000000%define release 2 Name: @PACKAGE@ Version: @VERSION@ Summary: Zipios++ is a small C++ library for reading zip files Release: %{release} Source: %{name}-%{version}.tar.gz Group: Development/Libraries URL: http://zipios.sourceforge.net./ BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot License: GNU LGPL Prefix: %{_prefix} Packager: "Thomas Sondergaard" Distribution: RedHat 9 Contrib %description Zipios++ is a small C++ library for reading zip files. The structure and public interface are based (somewhat loosely) on the java.util.zip package. The streams created to access the individual entries in a zip file are based on the standard iostream library. Zipios++ also provides a way for an application to support files from multiple sources (e.g. from zip files or from ordinary directories) transparently. %package devel Summary: zipios++ header files Group: Development/Libraries Requires: %name = %version %description devel Header files and documentation for zipios++ development. %prep %__rm -rf $RPM_BUILD_ROOT %setup -q -n %{name}-%{version} %build %configure %__make all doc %install %makeinstall %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %clean [ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && %__rm -rf $RPM_BUILD_ROOT $RPM_BUILD_DIR/%{name}-%{version} %files %defattr(-,root,root,644) %doc AUTHORS README %attr(755,root,root) %{_libdir}/libzipios.so.* %files devel %defattr(-,root,root,644) %{_includedir}/zipios++/*.h %doc NEWS ChangeLog %doc %dir doc/html/ %defattr(-,root,root,755) %{_libdir}/libzipios.a %{_libdir}/libzipios.so %{_libdir}/libzipios.la %changelog * Tue Feb 3 2004 Russel Winder - Updated spec file to tidy up properly after a run. Removed use of /usr/local/bin/g++ for compilation in favour of using default. * Tue Jan 7 2003 Ross Burton - Updated spec file to use the RPM macros * Sat Mar 17 2002 Rui M. Silva Seabra - Creation zipios++-0.1.7/zipios++/000077500000000000000000000000001351224126100146225ustar00rootroot00000000000000zipios++-0.1.7/zipios++/.cvsignore000066400000000000000000000000651351224126100166230ustar00rootroot00000000000000Makefile Makefile.in zipios-config.h* stamp-h* .deps zipios++-0.1.7/zipios++/Makefile.am000066400000000000000000000007711351224126100166630ustar00rootroot00000000000000 pkginclude_HEADERS = \ basicentry.h \ collcoll.h \ deflateoutputstreambuf.h \ dircoll.h \ fcollexceptions.h \ fcoll.h \ fileentry.h \ filepath.h \ filterinputstreambuf.h \ filteroutputstreambuf.h \ gzipoutputstreambuf.h \ gzipoutputstream.h \ inflateinputstreambuf.h \ meta-iostreams.h \ simplesmartptr.h \ virtualseeker.h \ zipfile.h \ ziphead.h \ zipheadio.h \ zipinputstreambuf.h \ zipinputstream.h \ zipios_defs.h \ zipoutputstreambuf.h \ zipoutputstream.h \ zipios-config.h zipios++-0.1.7/zipios++/basicentry.h000066400000000000000000000052111351224126100171350ustar00rootroot00000000000000#ifndef BASICENTRY_H #define BASICENTRY_H #include "zipios++/zipios-config.h" #include "zipios++/meta-iostreams.h" #include #include "zipios++/fcollexceptions.h" #include "zipios++/fileentry.h" #include "zipios++/filepath.h" #include "zipios++/zipios_defs.h" namespace zipios { /** BasicEntry is a FileEntry that is suitable as a base class for basic entries, that e.g. do not support any form of compression */ class BasicEntry : public FileEntry { public: /** Constructor. @param filename the filename of the entry. @param comment a comment for the entry. */ explicit BasicEntry( const string &filename, const string &comment, const FilePath &basepath = FilePath() ) ; virtual string getComment() const ; virtual uint32 getCompressedSize() const ; virtual uint32 getCrc() const ; virtual vector< unsigned char > getExtra() const ; virtual StorageMethod getMethod() const ; virtual string getName() const ; virtual string getFileName() const ; virtual uint32 getSize() const ; virtual int getTime() const ; virtual bool isValid() const ; // virtual int hashCode() const ; virtual bool isDirectory() const ; virtual void setComment( const string &comment ) ; virtual void setCompressedSize( uint32 size ) ; virtual void setCrc( uint32 crc ) ; virtual void setExtra( const vector< unsigned char > &extra ) ; virtual void setMethod( StorageMethod method ) ; virtual void setName( const string &name ) ; virtual void setSize( uint32 size ) ; virtual void setTime( int time ) ; virtual string toString() const ; virtual FileEntry *clone() const ; virtual ~BasicEntry() ; protected: string _filename ; string _comment ; int _size ; bool _valid ; FilePath _basepath ; }; } #endif /** \file Header file that defines BasicEntry. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/zipios++/collcoll.h000066400000000000000000000131741351224126100166040ustar00rootroot00000000000000#ifndef COLLCOLL_H #define COLLCOLL_H #include "zipios++/zipios-config.h" #include #include #include "zipios++/fcoll.h" namespace zipios { using std::string ; /** \anchor collcoll_anchor CollectionCollection is a FileCollection that consists of an arbitrary number of FileCollections. With a CollectionCollection the user can use multiple FileCollections transparently, making it easy for a program to keep some of its files in a zip archive and others stored in ordinary files. CollectionCollection can be used to create a simple virtual filesystem, where all collections are mounted in /. If more than one collection contain a file with the same path only the one in the first added collection will be accessible. */ class CollectionCollection : public FileCollection { public: /** \anchor collcoll_inst_anchor This static method provides a singleton instance of a CollectionCollection. The instance is instantiated the first time the method is called. @return A pointer to a singleton CollectionCollection instance. */ static inline CollectionCollection &inst() ; /** Constructor. */ explicit CollectionCollection() ; /** Copy constructor. */ inline CollectionCollection( const CollectionCollection &src ) ; /** Copy assignment operator. */ inline const CollectionCollection &operator= ( const CollectionCollection &src ) ; /** \anchor collcoll_addcoll_anchor Adds a collection. @param collection The collection to add. @return true if the collection was added succesfully and the added collection is valid. */ bool addCollection( const FileCollection &collection ) ; /** Adds the collection pointed to by collection. The CollectionCollection will call delete on the pointer when it is destructed, so the caller should make absolutely sure to only pass in a collection created with new and be sure to leave it alone after adding it. If the collection is not added false is returned and the caller remains responsible for the collection pointed to by collection. @param collection A pointer to the collection to add. @return true if the collection was added succesfully and the added collection is valid. */ bool addCollection( FileCollection *collection ) ; virtual void close() ; virtual ConstEntries entries() const ; virtual ConstEntryPointer getEntry( const string &name, MatchPath matchpath = MATCH ) const ; virtual istream *getInputStream( const ConstEntryPointer &entry ) ; virtual istream *getInputStream( const string &entry_name, MatchPath matchpath = MATCH ) ; /** Returns the number in entries in all collections kept by the CollectionCollection object */ virtual int size() const ; virtual FileCollection *clone() const ; virtual ~CollectionCollection() ; protected: /** A protected getEntry member function, that not only finds an entry that match the name, if such an entry exists in the collection, it also returns, which collection it was found in. */ void getEntry( const string &name, ConstEntryPointer &cep, std::vector< FileCollection * >::const_iterator &it, MatchPath matchpath = MATCH ) const ; vector< FileCollection * > _collections ; private: static CollectionCollection *_inst ; }; /** Shortcut name for a CollectionCollection. If the static method inst is used, it is often used a lot, so it's handy with a short name for CollectionCollection */ typedef CollectionCollection CColl ; // // Inline (member) functions // CollectionCollection &CollectionCollection::inst() { if( _inst != 0 ) return *_inst ; else return *( _inst = new CollectionCollection ) ; } CollectionCollection::CollectionCollection( const CollectionCollection &src ) : FileCollection( src ) { _collections.reserve( src._collections.size() ) ; std::vector< FileCollection * >::const_iterator it ; for ( it = src._collections.begin() ; it != src._collections.end() ; ++it ) _collections.push_back( (*it)->clone() ) ; } const CollectionCollection & CollectionCollection::operator= ( const CollectionCollection &src ) { this->FileCollection::operator=( src ) ; // FileCollection::=( static_cast< FileCollection >( src ) ) ; if ( this != &src ) { // Destroy current contents. std::vector< FileCollection * >::const_iterator it ; for ( it = _collections.begin() ; it != _collections.end() ; ++it ) delete *it ; // Then copy src's content. _collections.clear() ; _collections.reserve( src._collections.size() ) ; for ( it = src._collections.begin() ; it != src._collections.end() ; ++it ) _collections.push_back( (*it)->clone() ) ; } return *this ; } } // namespace #endif /** \file Header file that defines CollectionCollection. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/zipios++/deflateoutputstreambuf.h000066400000000000000000000070701351224126100215750ustar00rootroot00000000000000#ifndef DEFLATEOUTPUTSTREAMBUF_H #define DEFLATEOUTPUTSTREAMBUF_H #include "zipios++/zipios-config.h" #include "zipios++/meta-iostreams.h" #include #include #include "zipios++/filteroutputstreambuf.h" #include "zipios++/ziphead.h" #include "zipios++/zipios_defs.h" namespace zipios { using std::vector ; /** DeflateOutputStreambuf is an output stream filter, that deflates the data that is written to it before it passes it on to the output stream it is attached to. Deflation/Inflation is a compression/decompression method used in gzip and zip. The zlib library is used to perform the actual deflation, this class only wraps the functionality in an output stream filter. */ class DeflateOutputStreambuf : public FilterOutputStreambuf { public: /** DeflateOutputStreambuf constructor. @param outbuf the streambuf to use for output. @param user_init If false user must invoke init() before writing any data. (ZipOutputStreambuf needs to do this) @param del_outbuf if true is specified outbuf will be deleted, when the DeflateOutputStreambuf is destructed. */ explicit DeflateOutputStreambuf( streambuf *outbuf, bool user_init = false, bool del_outbuf = false ) ; /** Destructor. */ virtual ~DeflateOutputStreambuf() ; bool init( int comp_level = 6 ) ; bool closeStream() ; /** Returns the CRC32 for the current stream. The returned value is the CRC for the data that has been compressed already (due to a call to overflow()). As DeflateOutputStreambuf may buffer an arbitrary amount of bytes until closeStream() has been invoked, the returned value is not very useful before closeStream() has been called. */ uint32 getCrc32() const { return _crc32 ; } /** Returns the number of bytes written to the streambuf, that has been processed from the input buffer by the compressor. After closeStream() has been called this number is the total number of bytes written to the stream. */ uint32 getCount() const { return _overflown_bytes ; } protected: virtual int overflow( int c = EOF ) ; virtual int sync() ; /** Flushes _outvec and updates _zs.next_out and _zs.avail_out. */ bool flushOutvec() ; /** Flushes the remaining data in the zlib buffers, after which the only possible operations are deflateEnd() or deflateReset(). */ void endDeflation() ; private: z_stream _zs ; bool _zs_initialized ; protected: // FIXME: reconsider design? const int _invecsize ; vector< char > _invec ; const int _outvecsize ; vector< char > _outvec ; uint32 _crc32 ; uint32 _overflown_bytes ; }; } // namespace #endif /** \file Header file that defines DeflateOutputStreambuf. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/zipios++/dircoll.h000066400000000000000000000051231351224126100164240ustar00rootroot00000000000000#ifndef DIRCOLL_H #define DIRCOLL_H #include "zipios++/zipios-config.h" #include "zipios++/fcoll.h" #include "zipios++/basicentry.h" #include "zipios++/filepath.h" namespace zipios { /** DirEntry is a BasicEntry. */ typedef BasicEntry DirEntry ; /** \anchor dircol_anchor DirectoryCollection is a FileCollection that obtains its entries from a directory. */ class DirectoryCollection : public FileCollection { public: /** Default Constructor. */ explicit DirectoryCollection() : _entries_loaded( false ), _recursive( true ) {} /** Constructor. @param path A directory path name. If the name is not a valid directory the created DirectoryCollection will be invalid. @param load_now Load directory into memory now. Otherwise it will be done when it is first needed. */ explicit DirectoryCollection( const string &path, bool recursive = true, bool load_now = false ) ; /* Default Copy constructor and copy assignment operator are sufficient. */ virtual void close() ; virtual ConstEntries entries() const ; virtual ConstEntryPointer getEntry( const string &name, MatchPath matchpath = MATCH ) const ; virtual istream *getInputStream( const ConstEntryPointer &entry ) ; virtual istream *getInputStream( const string &entry_name, MatchPath matchpath = MATCH ) ; virtual int size() const ; virtual FileCollection *clone() const ; /** Destructor. */ virtual ~DirectoryCollection() ; protected: mutable bool _entries_loaded ; bool _recursive ; // recurse into subdirs. FilePath _filepath ; void loadEntries() const ; void load( bool recursive, const FilePath &subdir = FilePath() ) ; }; } // namespace #endif /** \file Header file that defines DirectoryCollection. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/zipios++/fcoll.h000066400000000000000000000271011351224126100160730ustar00rootroot00000000000000#ifndef fcoll_H #define fcoll_H #include "zipios++/zipios-config.h" #include #include #include "zipios++/fcollexceptions.h" #include "zipios++/fileentry.h" namespace zipios { using std::vector; /** \anchor fcoll_anchor FileCollection is an abstract baseclass that represents a collection of files. The specializations of FileCollection represents different origins of file collections, such as directories, simple filename lists and compressed archives. */ class FileCollection { public: /** FileCollection constructor. */ explicit FileCollection() : _filename( "-" ), _entries ( 0 ), _valid ( false ) {} /** Copy constructor. */ inline FileCollection( const FileCollection &src ) ; /** Copy assignment operator. */ inline const FileCollection &operator= ( const FileCollection &src ) ; /** Closes the FileCollection. */ virtual void close() = 0 ; /** \anchor fcoll_entries_anchor Returns a vector of const pointers to the entries in the FileCollection. @return a ConstEntries containing the entries of the FileCollection. @throw InvalidStateException Thrown if the collection is invalid. */ virtual ConstEntries entries() const ; enum MatchPath { IGNORE, MATCH } ; /** \anchor fcoll_getentry_anchor Returns a ConstEntryPointer to a FileEntry object for the entry with the specified name. To ignore the path part of the filename in search of a match, specify FileCollection::IGNORE as the second argument. @param name A string containing the name of the entry to get. @param matchpath Speficy MATCH, if the path should match as well, specify IGNORE, if the path should be ignored. @return A ConstEntryPointer to the found entry. The returned pointer equals zero if no entry is found. @throw InvalidStateException Thrown if the collection is invalid. */ virtual ConstEntryPointer getEntry( const string &name, MatchPath matchpath = MATCH ) const ; /** \anchor fcoll_getinputstream Returns a pointer to an opened istream for the specified FileEntry. It is the callers responsibility to delete the stream when he is done with it. Returns 0, if there is no such FileEntry in the FileCollection. @param entry A ConstEntryPointer to the FileEntry to get an istream to. @return an open istream for the specified entry. The istream is allocated on heap and it is the users responsibility to delete it when he is done with it. @throw InvalidStateException Thrown if the collection is invalid. */ virtual istream *getInputStream( const ConstEntryPointer &entry ) = 0 ; /** Returns a pointer to an opened istream for the specified entry name. It is the callers responsibility to delete the stream when he is done with it. Returns 0, if there is no entry with the specified name in the FileCollection. @param matchpath Speficy MATCH, if the path should match as well, specify IGNORE, if the path should be ignored. @return an open istream for the specified entry. The istream is allocated on heap and it is the users responsibility to delete it when he is done with it. @throw InvalidStateException Thrown if the collection is invalid. */ virtual istream *getInputStream( const string &entry_name, MatchPath matchpath = MATCH ) = 0 ; /** Returns the name of the FileCollection. @return the name of the FileCollection. @throw InvalidStateException Thrown if the collection is invalid. */ virtual string getName() const ; /** Returns the number of entries in the FileCollection. @return the number of entries in the FileCollection. @throw InvalidStateException Thrown if the collection is invalid. */ virtual int size() const ; /** The member function returns true if the collection is valid. @return true if the collection is valid. */ bool isValid() const { return _valid ; } /** Create a heap allocated clone of the object this method is called for. The caller is responsible for deallocating the clone when he is done with it. @return A heap allocated copy of the object this method is called for. */ virtual FileCollection *clone() const = 0 ; /** FileCollection destructor. */ virtual ~FileCollection () ; protected: string _filename ; Entries _entries ; bool _valid ; }; // // Inline methods // FileCollection::FileCollection( const FileCollection &src ) : _filename( src._filename ), _valid ( src._valid ) { _entries.reserve( src._entries.size() ) ; Entries::const_iterator it ; for ( it = src._entries.begin() ; it != src._entries.end() ; ++it ) _entries.push_back( (*it)->clone() ) ; } const FileCollection &FileCollection::operator= ( const FileCollection &src ) { if ( this != &src ) { _filename = src._filename ; _valid = src._valid ; _entries.clear() ; _entries.reserve( src._entries.size() ) ; Entries::const_iterator it ; for ( it = src._entries.begin() ; it != src._entries.end() ; ++it ) _entries.push_back( (*it)->clone() ) ; } return *this ; } inline ostream & operator<< (ostream &os, const FileCollection& collection) { os << "collection '" << collection.getName() << "' {" ; ConstEntries entries = collection.entries(); ConstEntries::const_iterator it; bool isFirst=true; for (it=entries.begin(); it != entries.end(); ++it) { if(! isFirst) os << ", "; isFirst = false; os << (*it)->getName(); } os << "}"; return os; } } // namespace #endif /** \mainpage Zipios++ \image html zipios++.jpg \image latex zipios++.eps width=10cm \section intro Introduction Zipios++ is a java.util.zip-like C++ library for reading and writing Zip files. Access to individual entries is provided through standard C++ iostreams. A simple read-only virtual file system that mounts regular directories and zip files is also provided. The source code is released under the GNU Lesser General Public License. \section status Status Spanned archives are not supported, and support is not planned. The library has been tested and appears to be working with
  • FreeBSD stable and current / gcc 2.95.3
  • Red Hat Linux release 7.0 / gcc 2.96
  • Red Hat Linux release 6.2 (Zoot) / egcs-2.91.66
  • Linux Mandrake release 7.0 (Air) / gcc 2.95.2
  • SGI IRIX64 6.5 / gcc 2.95.2
  • SGI IRIX64 6.5 / MIPSpro Compilers: Version 7.30
If you are aware of any other platforms that Zipios++ works on, please let me know (thomass@deltadata.dk). \section documentation Documentation This web page is the front page to the library documentation which is generated from the source files using Doxygen. Use the links at the top of the page to browse the API documentation. The documentation is also available in a printer-friendly format [pdf]. \subsection zipfiles Zip file access The two most important classes are \ref zipfile_anchor "ZipFile" and \ref ZipInputStream_anchor "ZipInputStream". ZipInputStream is an istream for reading zipfiles. It can be instantiated directly, without the use of ZipFile. \ref ZipInputStream_getnextentry_anchor "ZipInputStream::getNextEntry()" positions the new ZipInputStream at the first entry. The following entry can be accessed by calling \ref ZipInputStream_getnextentry_anchor "ZipInputStream::getNextEntry()" again. ZipFile scans the central directory of a zipfile and provides an interface to access that directory. The user may search for entries with a particular filename using \ref fcoll_getentry_anchor "ZipFile::getEntry()", or simply get the complete list of entries with \ref fcoll_entries_anchor "ZipFile::entries()". To get an istream (ZipInputStream) to a particular entry simply use \ref fcoll_getinputstream "ZipFile::getInputStream()". \ref example_zip_anchor "example_zip.cpp" demonstrates the central elements of Zipios++. A Zip file appended to another file, e.g. a binary program, with the program \ref appendzip_anchor "appendzip", can be read with \ref zipfile_openembeddedzipfile "ZipFile::openEmbeddedZipFile()". \subsection filecollections FileCollections A ZipFile is actually just a special kind of \ref fcoll_anchor "FileCollection" that obtains its entries from a .zip Zip archive. Zipios++ also implements a \ref dircol_anchor "DirectoryCollection" that obtains its entries from a specified directory, and a \ref collcoll_anchor "CollectionCollection" that obtains its entries from other collections. Using a single CollectionCollection any number of other FileCollections can be placed under its control and accessed through the same single interface that is used to access a ZipFile or a DirectoryCollection. A singleton (a unique global instance) CollectionCollection can be obtained through \ref collcoll_inst_anchor "CollectionCollection::inst()" ; To save typing CollectionCollection has been typedef'ed to CColl. In the initialization part of an application FileCollections can be created, and placed under CColll::inst()'s control using \ref collcoll_addcoll_anchor "CColl::inst().addCollection()" and later an istream can be obtained using \ref fcoll_getinputstream "CColl::inst().getInputStream()". \section download Download Go to Zipios++ project page on SourceForge for tar balls and ChangeLog. http://sourceforge.net/project/?group_id=5418 \section links Links zlib. The compression library that Zipios++ uses to perform the actual decompression. Java 2 Platform, Standard Edition, v 1.3 API Specification . Zipios++ is heavily inspired by the java.util.zip package. PKWARE zip format . A description of the zip file format. \section bugs Bugs Submit bug reports and patches to thomass@deltadata.dk \htmlonly Project hosted by

Logo created with \endhtmlonly */ /** \file Header file that defines FileCollection. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/zipios++/fcollexceptions.h000066400000000000000000000057431351224126100202050ustar00rootroot00000000000000#ifndef FCOLLEXCEPTIONS_H #define FCOLLEXCEPTIONS_H #include "zipios++/zipios-config.h" #include #include namespace zipios { using std::string ; using std::exception ; /** An IOException is used to signal an I/O error. */ class IOException : public exception { public: IOException() throw () ; explicit IOException( const string &msg ) throw () ; IOException( const IOException &src ) throw () ; IOException &operator= ( const IOException &src ) throw () ; virtual const char *what() const throw () ; virtual ~IOException() throw () ; private: string _what ; }; /** An FCollException is used to signal a problem with a FileCollection. */ class FCollException : public exception { public: FCollException() throw () ; explicit FCollException( const string &msg ) throw () ; FCollException( const FCollException &src ) throw () ; FCollException &operator= ( const FCollException &src ) throw () ; virtual const char *what() const throw () ; virtual ~FCollException() throw () ; private: string _what ; }; /** An object member function may throw this exception, if the operation it normally performs is inappropriate or impossible to perform because of the current state of the object. */ class InvalidStateException : public exception { public: InvalidStateException() throw () ; explicit InvalidStateException( const string &msg ) throw () ; InvalidStateException( const InvalidStateException &src ) throw () ; InvalidStateException &operator= ( const InvalidStateException &src ) throw () ; virtual const char *what() const throw () ; virtual ~InvalidStateException() throw () ; private: string _what ; }; /** Basic exception */ class Exception : public exception { public: Exception() throw () ; explicit Exception( const string &msg ) throw () ; Exception( const Exception &src ) throw () ; Exception &operator= ( const Exception &src ) throw () ; virtual const char *what() const throw () ; virtual ~Exception() throw () ; private: string _what ; }; } // namespace #endif /** \file Header file that defines a number of exceptions used by FileCollection and its subclasses. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/zipios++/fileentry.h000066400000000000000000000203671351224126100170040ustar00rootroot00000000000000#ifndef FILEENTRY_H #define FILEENTRY_H #include "zipios++/zipios-config.h" #include #include #include "zipios++/meta-iostreams.h" #include "zipios++/simplesmartptr.h" #include "zipios++/zipios_defs.h" namespace zipios { using std::vector ; using std::ostream ; using std::istream ; using std::string ; /** The types used with FileEntry::setMethod and FileEntry::getMethod. The current entries are the types supported by the zip format. The numbering also matches the numbering used in the zip file format, ie STORED is indicated by a 0 in the method field in a zip file and so on. */ enum StorageMethod { STORED = 0, SHRUNK, REDUCED1, REDUCED2, REDUCED3, REDUCED4, IMPLODED, RESERVED, DEFLATED } ; class FileEntry ; /** \typedef typedef SimpleSmartPointer< FileEntry > EntryPointer EntryPointer is a SimpleSmartPointer for FileEntry's. */ typedef SimpleSmartPointer< FileEntry > EntryPointer ; /** ConstEntryPointer is a SimpleSmartPointer for const FileEntry's. */ typedef SimpleSmartPointer< const FileEntry > ConstEntryPointer ; /** Entries is a vector of EntryPointer's */ typedef vector< EntryPointer > Entries ; /** ConstEntries is a vector of ConstEntryPointer's */ typedef vector< EntryPointer > ConstEntries ; /** A FileEntry represents an entry in a FileCollection. The interface is a copy of the ZipEntry interface from the java.util.zip package. The name has been changed to FileEntry, as FileCollection is a more general abstraction, that covers other types of file collections than just zip files. */ class FileEntry { public: /* Default construcotr, copy constructor and copy assignment operator are sufficient. */ /** Returns the comment of the entry, if it has one. Otherwise it returns an empty string. @return the comment associated with the entry, if there is one. */ virtual string getComment() const = 0 ; /** Returns the compressed size of the entry. If the entry is not stored in a compressed format, the uncompressed size is returned. @return the compressed size of the entry. If the entry is stored without compression the uncompressed size is returned. */ virtual uint32 getCompressedSize() const = 0 ; /** Returns the Crc for the entry, if it has one. FIXME: what is returned if it doesn't have one? @return the Crc for the entry, if it has one. */ virtual uint32 getCrc() const = 0 ; /** Returns a vector of bytes of extra data that may be stored with the entry. @return A vector< unsigned char > of extra bytes that may potentially be associated with an entry. */ virtual vector< unsigned char > getExtra() const = 0 ; /** Returns the method used to store the entry in the FileCollection. @return the storage method used to store the entry in the collection. @see StorageMethod. */ virtual StorageMethod getMethod() const = 0 ; /** Returns the full filename of the entry, including a path if the entry is stored in a subfolder. @return the filename of the entry, including path if the entry is stored in a sub-folder. */ virtual string getName() const = 0 ; /** Returns the filename of the entry. @return Returns the filename of the entry. */ virtual string getFileName() const = 0 ; /** Returns the (uncompressed) size of the entry data. @return Returns the (uncompressed) size of the entry. */ virtual uint32 getSize() const = 0 ; /** Returns the date and time of FIXME: what? @return the date and time of the entry. */ virtual int getTime() const = 0 ; /** Any method or operator that initializes a FileEntry may set a flag, that specifies whether the read entry is valid or not. If it isn't this method returns false. @return true if the FileEntry has been parsed succesfully. */ virtual bool isValid() const = 0 ; // virtual int hashCode() const = 0 ; /** Returns true if the entry is a directory. A directory entry is an entry which name ends with a separator ('/' for Unix systems, '\' for Windows and DOS systems. @return true if the entry is a directory. */ virtual bool isDirectory() const = 0 ; /** Sets the comment field for the FileEntry. @param comment string with the new comment. */ virtual void setComment( const string &comment ) = 0 ; /** Set the compressed size field of the entry. @param size value to set the compressed size field of the entry to. */ virtual void setCompressedSize( uint32 size ) = 0 ; /** Sets the crc field. @param crc value to set the crc field to. */ virtual void setCrc( uint32 crc ) = 0 ; /** Sets the extra field. @param extra the extra field is set to this value. */ virtual void setExtra( const vector< unsigned char > &extra ) = 0 ; /** Sets the storage method field for the entry. @param method the method field is set to the specified value. */ virtual void setMethod( StorageMethod method ) = 0 ; /** Sets the name field for the entry. @param name the name field is set to the specified value. */ virtual void setName( const string &name ) = 0 ; /** Sets the size field for the entry. @param size the size field is set to this value. */ virtual void setSize( uint32 size ) = 0 ; /** Sets the time field for the entry. @param time the time field is set to the specified value. */ virtual void setTime( int time ) = 0 ; /** Returns a human-readable string representation of the entry. @return a human-readable string representation of the entry. */ virtual string toString() const = 0 ; /** Create a heap allocated clone of the object this method is called for. The caller is responsible for deallocating the clone when he is done with it. @return A heap allocated copy of the object this method is called for. */ virtual FileEntry *clone() const = 0 ; /** FileEntry destructor. */ virtual ~FileEntry() {} // protected: class MatchName ; class MatchFileName ; protected: friend class SimpleSmartPointer< FileEntry > ; friend class SimpleSmartPointer< const FileEntry > ; void ref() const { _refcount.ref() ; } unsigned int unref() const { return _refcount.unref() ; } ReferenceCount< FileEntry > _refcount ; }; /** Function object to be used with the STL find_if algorithm to find a FileEntry in a container, which name (as obtained with FileEntry::getName()) is identical to the name specified in the MatchName constructor. */ class FileEntry::MatchName { public: explicit MatchName( const string &name ) : _name( name ) {} bool operator() ( const ConstEntryPointer &entry ) { return entry->getName() == _name ; } private: string _name ; }; /** Function object to be used with the STL find_if algorithm to find a FileEntry in a container, which name (as obtained with FileEntry::getFileName()) is identical to the name specified in the MatchName constructor. */ class FileEntry::MatchFileName { public: explicit MatchFileName( const string &name ) : _name( name ) {} bool operator() ( const ConstEntryPointer &entry ) { return entry->getFileName() == _name ; } private: string _name ; }; ostream &operator<< ( ostream &os, const FileEntry &entry ) ; inline ostream &operator<< ( ostream &os, const ConstEntryPointer &entry ) { os << *entry ; return os ; } } // namespace #endif /** \file Header file that defines FileEntry. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/zipios++/filepath.h000066400000000000000000000115061351224126100165720ustar00rootroot00000000000000#ifndef FILEPATH_H #define FILEPATH_H #include "zipios++/zipios-config.h" #include #include namespace zipios { using namespace std ; /** FilePath represents a path to a file or directory name. FilePath has member functions to check if the file path is a valid file system entity, and to check what kind of file system entity it is, e.g. is it a file, a directory, a pipe etc. */ class FilePath { public: /** Constructor. @param path A string representation of the path. @param check_exists If true is specified the constructor will check the existence and type of the path immidiately, instead of deferring that task until it is needed. */ FilePath( const string &path = "", bool check_exists = false ) ; inline FilePath &operator= ( const string &rhs ) ; inline operator string() const ; /** Concatenates FilePath objects. A file separator is inserted if appropriate. */ inline FilePath operator+ ( const FilePath &name ) const ; /** Returns filename of the FilePath object by pruning the path off. */ inline FilePath filename() const ; /** @return true If the path is a valid file system entity. */ inline bool exists() const ; /** @return true if the path is a regular file. */ inline bool isRegular() const ; /** @return true if the path is a directory. */ inline bool isDirectory() const ; /** @return true if the path is character special (a character device file). */ inline bool isCharSpecial() const ; /** @return true if the path is block special (a block device file). */ inline bool isBlockSpecial() const ; /** @return true if the path is a socket. */ inline bool isSocket() const ; /** @return true if the path is a Fifo (a pipe). */ inline bool isFifo() const ; protected: /** Prunes the trailing separator of a specified path. */ inline void pruneTrailingSeparator() ; /** This function sets _checked to true, stats the path, to see if it exists and to determine what type of file it is. All the query functions check if _checked is true, and if it isn't they call check(). This means stat'ing is deferred until it becomes necessary. */ void check() const ; static const char _separator; // FIXME: Should be bitfield mutable bool _checked ; mutable bool _exists ; mutable bool _is_reg ; mutable bool _is_dir ; mutable bool _is_char ; mutable bool _is_block ; mutable bool _is_socket ; mutable bool _is_fifo ; string _path ; }; // // Inline member functions // FilePath &FilePath::operator= ( const string &rhs ) { _path = rhs ; pruneTrailingSeparator() ; return *this ; } void FilePath::pruneTrailingSeparator() { if ( _path.size() > 0 ) if ( _path[ _path.size() -1 ] == _separator ) _path.erase( _path.size() - 1 ) ; } FilePath::operator string() const { return _path ; } FilePath FilePath::operator+ ( const FilePath &name ) const { if ( _path.size() > 0 ) return _path + _separator + name._path ; else return name._path ; } FilePath FilePath::filename() const { string::size_type pos ; pos = _path.find_last_of( _separator ) ; if ( pos != string::npos ) return _path.substr( pos + 1); else return _path ; } bool FilePath::exists() const { if ( ! _checked ) check() ; return _exists ; } bool FilePath::isRegular() const { if ( ! _checked ) check() ; return _is_reg ; } bool FilePath::isDirectory() const { if ( ! _checked ) check() ; return _is_dir ; } bool FilePath::isCharSpecial() const { if ( ! _checked ) check() ; return _is_char ; } bool FilePath::isBlockSpecial() const { if ( ! _checked ) check() ; return _is_block ; } bool FilePath::isSocket() const { if ( ! _checked ) check() ; return _is_socket ; } bool FilePath::isFifo() const { if ( ! _checked ) check() ; return _is_fifo ; } } // namespace #endif /** \file Header file that defines FilePath. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/zipios++/filterinputstreambuf.h000066400000000000000000000040631351224126100212540ustar00rootroot00000000000000#ifndef FILTERINPUTSTREAMBUF_H #define FILTERINPUTSTREAMBUF_H #include "zipios++/zipios-config.h" #include "zipios++/meta-iostreams.h" namespace zipios { using std::streambuf ; /** An input streambuf filter is a streambuf that filters the input it gets from the streambuf it is attached to. FilterInputStreambuf is a base class to derive input streambuf filters from. */ class FilterInputStreambuf : public streambuf { public: /** Constructor. @param inbuf the streambuf to use for input. @param del_inbuf if true is specified inbuf will be deleted, when the FilterInputStreambuf is destructed. */ explicit FilterInputStreambuf( streambuf *inbuf, bool del_inbuf = false ) ; /** Destructor. */ virtual ~FilterInputStreambuf() ; protected: int _s_pos ; // Position in this streambuf - FIXME: is this used? streambuf *_inbuf ; bool _del_inbuf ; private: /** Copy-constructor is private to prevent copying. */ FilterInputStreambuf( const FilterInputStreambuf &src ) ; /** Copy-assignment operator is private to prevent copying. */ const FilterInputStreambuf &operator= ( const FilterInputStreambuf &src ) ; }; } // namespace #endif /** \file Header file that defines FilterInputStreambuf. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/zipios++/filteroutputstreambuf.h000066400000000000000000000033321351224126100214530ustar00rootroot00000000000000#ifndef FILTEROUTPUTSTREAMBUF_H #define FILTEROUTPUTSTREAMBUF_H #include "zipios++/zipios-config.h" #include "zipios++/meta-iostreams.h" namespace zipios { using std::streambuf ; /** A FilterOutputStreambuf is a streambuf that filters the data that is written to it before it passes it on to the output streambuf it is connected to. */ class FilterOutputStreambuf : public streambuf { public: /** Constructor. @param outbuf the streambuf to pass the filtered data on to. @param del_outbuf if true is specified outbuf will be deleted, when the FilterOutputStreambuf is destructed. */ explicit FilterOutputStreambuf( streambuf *outbuf, bool del_outbuf = false ) ; /** Destructor. */ virtual ~FilterOutputStreambuf() ; protected: streambuf *_outbuf ; bool _del_outbuf ; }; } // namespace #endif /** \file Header file that defines FilterOutputStreambuf. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/zipios++/gzipoutputstream.h000066400000000000000000000037621351224126100204510ustar00rootroot00000000000000#ifndef GZIPOUTPUTSTREAM_H #define GZIPOUTPUTSTREAM_H #include "zipios++/zipios-config.h" #include "zipios++/meta-iostreams.h" #include #include "zipios++/gzipoutputstreambuf.h" namespace zipios { /** \anchor GZIPOutputStream_anchor GZIPOutputStream is an ostream that writes the output to a gz file. The interface approximates the interface of the Java GZIPOutputStream. */ class GZIPOutputStream : public std::ostream { public: /** GZIPOutputStream constructor. @param os ostream to which the compressed zip archive is written. */ explicit GZIPOutputStream( std::ostream &os ) ; /** GZIPOutputStream constructor. @filename filename to write the gzip archive to. */ explicit GZIPOutputStream( const std::string &filename ) ; void setFilename( const string &filename ); void setComment( const string &comment ); /** Calls finish and closes the stream. */ void close() ; /** Finishes the stream. */ void finish() ; /** Destructor. */ virtual ~GZIPOutputStream() ; private: std::ofstream *ofs ; GZIPOutputStreambuf *ozf ; }; } // namespace. #endif /** \file Header file that defines GZIPOutputStream. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/zipios++/gzipoutputstreambuf.h000066400000000000000000000040721351224126100211410ustar00rootroot00000000000000#ifndef GZIPOUTPUTSTREAMBUF_H #define GZIPOUTPUTSTREAMBUF_H #include "zipios++/zipios-config.h" #include #include #include "zipios++/deflateoutputstreambuf.h" namespace zipios { /** GZIPOutputStreambuf is a zip output streambuf filter. */ class GZIPOutputStreambuf : public DeflateOutputStreambuf { public: /** GZIPOutputStreambuf constructor. A newly constructed GZIPOutputStreambuf is ready to accept data. @param outbuf the streambuf to use for output. @param del_outbuf if true is specified outbuf will be deleted, when the GZIPOutputStreambuf is destructed. */ explicit GZIPOutputStreambuf( streambuf *outbuf, bool del_outbuf = false ) ; void setFilename( const string &filename ); void setComment( const string &comment ); /** Calls finish. */ void close() ; /** Finishes the compression. */ void finish() ; /** Destructor. */ virtual ~GZIPOutputStreambuf() ; protected: virtual int overflow( int c = EOF ) ; virtual int sync() ; private: void writeHeader(); void writeTrailer(); void writeInt(uint32 i); std::string _filename; std::string _comment; bool _open ; }; } // namespace #endif /** \file Header file that defines ZipOutputStreambuf. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/zipios++/inflateinputstreambuf.h000066400000000000000000000055121351224126100214110ustar00rootroot00000000000000#ifndef INFLATEINPUTSTREAMBUF_H #define INFLATEINPUTSTREAMBUF_H #include "zipios++/zipios-config.h" #include "zipios++/meta-iostreams.h" #include #include #include "zipios++/filterinputstreambuf.h" namespace zipios { using std::vector ; /** InflateInputStreambuf is an input stream filter, that inflates the input from the attached input stream. Deflation/Inflation is a compression/decompression method used in gzip and zip. The zlib library is used to perform the actual inflation, this class only wraps the functionality in an input stream filter. */ class InflateInputStreambuf : public FilterInputStreambuf { public: /** InflateInputStreambuf constructor. @param inbuf the streambuf to use for input. @param s_pos a position to reset the inbuf to before reading. Specify -1 to read from the current position. @param del_inbuf if true is specified inbuf will be deleted, when the InflateInputStreambuf is destructed. */ explicit InflateInputStreambuf( streambuf *inbuf, int s_pos = -1, bool del_inbuf = false ) ; virtual ~InflateInputStreambuf() ; /** Resets the zlib stream and purges input and output buffers. repositions the input streambuf at stream_position. @param stream_position a position to reset the inbuf to before reading. Specify -1 to read from the current position. */ bool reset( int stream_position = -1 ) ; protected: virtual int underflow() ; private: z_stream _zs ; bool _zs_initialized ; const int _invecsize ; vector< char > _invec ; protected: // FIXME: reconsider design? const int _outvecsize ; vector< char > _outvec ; private: /** Copy-constructor is private to prevent copying. */ InflateInputStreambuf( const InflateInputStreambuf &src ) ; /** Copy-assignment operator is private to prevent copying. */ const InflateInputStreambuf &operator= ( const InflateInputStreambuf &src ) ; }; } // namespace #endif /** \file Header file that defines InflateInputStreambuf. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/zipios++/meta-iostreams.h000066400000000000000000000004511351224126100177250ustar00rootroot00000000000000#ifndef META_IOSTREAMS_H #define META_IOSTREAMS_H // Includes the different iostream libraries #include "zipios++/zipios-config.h" #include #include #if defined (HAVE_STD_IOSTREAM) && defined (USE_STD_IOSTREAM) #include #else #include #endif #endif zipios++-0.1.7/zipios++/simplesmartptr.h000066400000000000000000000131321351224126100200610ustar00rootroot00000000000000#ifndef SIMPLESMARTPTR_H #define SIMPLESMARTPTR_H #include "zipios++/zipios-config.h" namespace zipios { /** SimpleSmartPointer is a simple reference counting smart pointer template. The type pointed to must keep a reference count that is accessible through the two methods void ref() const and unsigned int unref() const. The type must also handle the reference count properly. The easiest way to do that is to use the ReferenceCount template class. */ template< class Type > class SimpleSmartPointer { public: Type *operator-> () const { return _p ; } Type &operator* () const { return *_p ; } SimpleSmartPointer( Type *p = 0 ) : _p( p ) { ref() ; } template< class T2 > SimpleSmartPointer( const SimpleSmartPointer< T2 > &src ) : _p( src.get() ) { ref() ; } SimpleSmartPointer( const SimpleSmartPointer &src ) : _p( src.get() ) { ref() ; } ~SimpleSmartPointer () { if ( unref() == 0 ) deleteIt() ; } template< class T2 > SimpleSmartPointer &operator= ( const SimpleSmartPointer< T2 > &src ) { ref( src.get() ) ; if ( unref() == 0 ) deleteIt() ; _p = src.get() ; return *this ; } SimpleSmartPointer &operator= ( const SimpleSmartPointer &src ) { ref( src.get() ) ; if ( unref() == 0 ) deleteIt() ; _p = src.get() ; return *this ; } SimpleSmartPointer &operator=( Type *src ) { _p = src ; ref() ; return *this ; } bool operator== ( const Type *p ) const { return _p == p ; } bool operator!= ( const Type *p ) const { return _p != p ; } bool operator== ( const SimpleSmartPointer &sp ) const { return _p == sp.get() ; } bool operator!= ( const SimpleSmartPointer &sp ) const { return _p != sp.get() ; } bool operator! () const { return ! _p ; } // This next method is inspired by iostream, and is for use with // if ( some_smart_pointer ). operator void*() const { return _p ? (void *)(-1) : (void *)(0) ; } Type *get() const { return _p ; } /** Returns the reference count - For debugging purposes. */ unsigned int getReferenceCount() const { return _p->getReferenceCount(); } private: template< class T2 > void ref( const T2 *ptr ) { if ( ptr ) ptr->ref() ; } void ref() const { if ( _p ) _p->ref() ; } unsigned int unref() const { if ( _p ) return _p->unref(); else return 0 ; } void deleteIt() { // if( _p ) // cerr << "SimpleSmartPointer: Deleting object!" << endl ; delete _p ; } Type *_p ; }; /** ReferenceCount is useful to ensure proper handling of the reference count for (objects of) classes handled through a SimpleSmartPointer. Subclassing ReferenceCount is all a class needs to become ready for being handled by SimpleSmartPointer. Another way is to add a ReferenceCount member variable to a class and write two methods 'void ref() const' and 'unsigned int unref() const' that invoke the same methods in the ReferenceCount variable. */ template< class Type > class ReferenceCount { /** SimpleSmartPointer needs to be a friend to invoke the private ref() and unref() methods. */ friend class SimpleSmartPointer< Type > ; friend class SimpleSmartPointer< const Type > ; /** Type also needs to be a friend to invoke the private ref() and unref() methods, in case Type doesn't want to inherit ReferenceCount and thus needs to invoke ref() and unref() through forwarding member functions. */ // // Originally the following template parameter was made a friend. // This is not allowed by the standard so comment it out: // // friend Type ; // // Initially hack things by making the necessary classes friends // even though we don't know really which they are. This is an // Hideous Hack. friend class FileEntry ; friend class Bogus ; public: /** Constructor intializes count to zero. */ ReferenceCount() : _ref_count( 0 ) {} /** Copy-constructor intializes count to zero. It doesn't copy it from src. */ ReferenceCount( const ReferenceCount &src ) : _ref_count( 0 ) {} /** The assignment operator doesn't copy the reference count, it leaves it unchanged. */ const ReferenceCount &operator= ( const ReferenceCount &src ) { return *this; } private: /** Increases the reference count. */ void ref() const { ++_ref_count ; } /** Decreases the reference count. */ unsigned int unref() const { return --_ref_count ; } /** Returns the reference count - For debugging purposes. */ unsigned int getReferenceCount() const { return _ref_count; } /** Holds the actual reference count */ mutable unsigned short _ref_count ; }; } // namespace #endif /** \file Header file that defines SimpleSmartPointer and ReferenceCount. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/zipios++/virtualseeker.h000066400000000000000000000054721351224126100176700ustar00rootroot00000000000000#ifndef VIRTUALSEEKER_H #define VIRTUALSEEKER_H #include "zipios++/zipios-config.h" #include "zipios++/meta-iostreams.h" namespace zipios { using std::ios ; using std::cerr ; using std::endl ; /** VirtualSeeker is a simple class that keeps track of a set of specified 'virtual' file endings that mark a subset of a real file. An example of its use (and its reason for existence) is to keep track of the file endings of a Zip file embedded in another file. */ class VirtualSeeker { public: inline VirtualSeeker( int start_offset = 0, int end_offset = 0) ; inline void setOffsets( int start_offset, int end_offset ) ; inline void getOffsets( int &start_offset, int &end_offset ) const ; inline int startOffset() const ; inline int endOffset() const ; inline void vseekg( istream &is, int offset, ios::seekdir sd ) const ; inline int vtellg( istream &is ) const ; private: // start and end offsets int _s_off, _e_off ; }; VirtualSeeker::VirtualSeeker( int start_offset, int end_offset ) : _s_off( start_offset ), _e_off( end_offset ) {} void VirtualSeeker::setOffsets( int start_offset, int end_offset ) { _s_off = start_offset ; _e_off = end_offset ; } void VirtualSeeker::getOffsets( int &start_offset, int &end_offset ) const { start_offset = _s_off ; end_offset = _e_off ; } int VirtualSeeker::startOffset() const { return _s_off ; } int VirtualSeeker::endOffset() const { return _e_off ; } void VirtualSeeker::vseekg( istream &is, int offset, ios::seekdir sd ) const { if ( sd == ios::cur ) is.seekg( offset, sd ) ; else if ( sd == ios::beg ) is.seekg( offset + _s_off, sd ) ; else if ( sd == ios::end ) is.seekg( offset - _e_off, sd ) ; else cerr << "VirtualSeekManager::seekg: error - not supposed to happen!" << endl ; } int VirtualSeeker::vtellg( istream &is ) const { return static_cast< int >( is.tellg() ) - _s_off ; } } // namespace #endif /** \file Header file that defines VirtualSeeker. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/zipios++/zipfile.h000066400000000000000000000072141351224126100164410ustar00rootroot00000000000000#ifndef ZIPFILE_H #define ZIPFILE_H #include "zipios++/zipios-config.h" #include #include "zipios++/meta-iostreams.h" #include "zipios++/fcoll.h" #include "zipios++/ziphead.h" #include "zipios++/virtualseeker.h" namespace zipios { using std::ifstream ; /** \anchor zipfile_anchor ZipFile is a FileCollection, where the files are stored in a .zip file. */ class ZipFile : public FileCollection { public: /** \anchor zipfile_openembeddedzipfile Opens a Zip archive embedded in another file, by writing the zip archive to the end of the file followed by the start offset of the zip file. The offset must be written in zip-file byte-order (little endian). The program appendzip, which is part of the Zipios++ distribution can be used to append a Zip archive to a file, e.g. a binary program. @throw FColException Thrown if the specified file name is not a valid zip archive. @throw IOException Thrown if an I/O problem is encountered, while the directory of the specified zip archive is being read. */ static ZipFile openEmbeddedZipFile( const string &name ) ; /** Default constructor. */ ZipFile() {} /* Default Copy constructor and copy assignment operator are sufficient. */ /** Constructor. Opens the zip file name. If the zip "file" is embedded in a file that contains other data, e.g. a binary program, the offset of the zip file start and end must be specified. @param name The filename of the zip file to open. @param s_off Offset relative to the start of the file, that indicates the beginning of the zip file. @param e_off Offset relative to the end of the file, that indicates the end of the zip file. The offset is a positive number, even though the offset is towards the beginning of the file. @throw FColException Thrown if the specified file name is not a valid zip archive. @throw IOException Thrown if an I/O problem is encountered, while the directory of the specified zip archive is being read. */ explicit ZipFile( const string &name, int s_off = 0, int e_off = 0 /* , ios::open_mode mode = ios::in | ios::binary */ ) ; virtual FileCollection *clone() const ; /** Destructor. */ virtual ~ZipFile() ; virtual void close() ; virtual istream *getInputStream( const ConstEntryPointer &entry ) ; virtual istream *getInputStream( const string &entry_name, MatchPath matchpath = MATCH ) ; private: VirtualSeeker _vs ; EndOfCentralDirectory _eocd ; bool init( istream &_zipfile ) ; bool readCentralDirectory( istream &_zipfile ) ; bool readEndOfCentralDirectory( istream &_zipfile ) ; bool confirmLocalHeaders( istream &_zipfile ) ; void setError( string error_str ) ; }; } #endif /** \file Header file that defines ZipFile. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/zipios++/ziphead.h000066400000000000000000000214371351224126100164260ustar00rootroot00000000000000#ifndef ZIPHEAD_H #define ZIPHEAD_H #include "zipios++/zipios-config.h" #include "zipios++/meta-iostreams.h" #include #include #include "zipios++/fileentry.h" #include "zipios++/zipios_defs.h" namespace zipios { using std::streampos ; class ZipCDirEntry ; /** A concrete implementation of the abstract FileEntry base class for ZipFile entries, specifically for representing the information present in the local headers of file entries in a zip file. */ class ZipLocalEntry : public FileEntry { friend istream &operator>> ( istream &is, ZipLocalEntry &zcdh ) ; friend ostream &operator<< ( ostream &os, const ZipLocalEntry &zlh ) ; friend bool operator== ( const ZipLocalEntry &zlh, const ZipCDirEntry &ze ) ; public: inline ZipLocalEntry( const string &_filename = "", const vector< unsigned char > &_extra_field = vector< unsigned char >() ) : gp_bitfield( 0 ), _valid( false ) { setDefaultExtract() ; setName( _filename ) ; setExtra( _extra_field ) ; } void setDefaultExtract() ; inline ZipLocalEntry &operator=( const class ZipLocalEntry &src ) ; virtual string getComment() const ; virtual uint32 getCompressedSize() const ; virtual uint32 getCrc() const ; virtual vector< unsigned char > getExtra() const ; virtual StorageMethod getMethod() const ; virtual string getName() const ; virtual string getFileName() const ; virtual uint32 getSize() const ; virtual int getTime() const ; virtual bool isValid() const ; virtual bool isDirectory() const ; virtual void setComment( const string &comment ) ; virtual void setCompressedSize( uint32 size ) ; virtual void setCrc( uint32 crc ) ; virtual void setExtra( const vector< unsigned char > &extra ) ; virtual void setMethod( StorageMethod method ) ; virtual void setName( const string &name ) ; virtual void setSize( uint32 size ) ; virtual void setTime( int time ) ; virtual string toString() const ; int getLocalHeaderSize() const ; bool trailingDataDescriptor() const ; virtual FileEntry *clone() const ; virtual ~ZipLocalEntry() {} protected: static const uint32 signature ; uint16 extract_version ; uint16 gp_bitfield ; uint16 compress_method ; uint16 last_mod_ftime ; uint16 last_mod_fdate ; uint32 crc_32 ; uint32 compress_size ; uint32 uncompress_size ; uint16 filename_len ; uint16 extra_field_len ; string filename ; vector< unsigned char > extra_field ; bool _valid ; }; /** A struct containing fields for the entries in a zip file data descriptor, that trails the compressed data in files that were created by streaming, ie where the zip compressor cannot seek back to the local header and store the data. */ struct DataDescriptor { uint32 crc_32 ; uint32 compress_size ; uint32 uncompress_size ; }; /** Specialization of ZipLocalEntry, that add fields for storing the extra information, that is only present in the entries in the zip central directory and not in the local entry headers. */ class ZipCDirEntry : public ZipLocalEntry { friend istream &operator>> ( istream &is, ZipCDirEntry &zcdh ) ; friend ostream &operator<< ( ostream &os, const ZipCDirEntry &zcdh ) ; friend bool operator== ( const ZipLocalEntry &zlh, const ZipCDirEntry &ze ) ; public: inline ZipCDirEntry( const string &_filename = "", const string &_file_comment = "", const vector< unsigned char > &_extra_field = vector< unsigned char >() ) : ZipLocalEntry ( _filename, _extra_field ), disk_num_start ( 0x0 ), intern_file_attr( 0x0 ), extern_file_attr( 0x81B40000 ) // FIXME: I don't understand the external mapping, simply // copied value for a file with -rw-rw-r-- permissions // compressed with info-zip { setComment( _file_comment ) ; setDefaultWriter() ; } void setDefaultWriter() ; inline ZipCDirEntry &operator=( const class ZipCDirEntry &src ) ; virtual string toString() const ; virtual string getComment() const ; virtual void setComment( const string &comment ) ; virtual uint32 getLocalHeaderOffset() const ; virtual void setLocalHeaderOffset( uint32 offset ) ; int getCDirHeaderSize() const ; virtual FileEntry *clone() const ; virtual ~ZipCDirEntry() {} private: static const uint32 signature ; uint16 writer_version ; uint16 file_comment_len ; uint16 disk_num_start ; uint16 intern_file_attr ; uint32 extern_file_attr ; uint32 rel_offset_loc_head ; string file_comment ; }; /** The end of the Central directory structure. This structure is stored in the end of the zipfile, and contains information about the zipfile, including the position of the start of the central directory. */ class EndOfCentralDirectory { friend ostream &operator<< ( ostream &os, const EndOfCentralDirectory &eocd ) ; public: explicit EndOfCentralDirectory( const string &_zip_comment = "", uint16 _disk_num = 0, uint16 _cdir_disk_num = 0, uint16 _cdir_entries = 0, uint16 _cdir_tot_entries = 0, uint32 _cdir_size = 0, uint32 _cdir_offset = 0 ) : disk_num ( _disk_num ), cdir_disk_num ( _cdir_disk_num ), cdir_entries ( _cdir_entries ), cdir_tot_entries ( _cdir_tot_entries ), cdir_size ( _cdir_size ), cdir_offset ( _cdir_offset ), zip_comment_len ( _zip_comment.size() ), zip_comment ( _zip_comment ) {} uint32 offset() const { return cdir_offset ; } uint16 totalCount() const { return cdir_tot_entries ; } void setCDirSize( uint32 size ) { cdir_size = size ; } void setOffset( uint32 offset ) { cdir_offset = offset ; } void setTotalCount( uint16 c ) { cdir_entries = c ; cdir_tot_entries = c ; } int eocdOffSetFromEnd() const { return eocd_offset_from_end ; } bool read( vector &buf, int pos ) ; private: static const uint32 signature; uint16 disk_num ; uint16 cdir_disk_num ; uint16 cdir_entries ; uint16 cdir_tot_entries ; uint32 cdir_size ; uint32 cdir_offset ; uint16 zip_comment_len ; streampos eocd_offset_from_end ; // Not a Zip defined field string zip_comment; bool checkSignature( unsigned char *buf ) const ; inline bool checkSignature( uint32 sig ) const ; }; bool operator== ( const ZipLocalEntry &zlh, const ZipCDirEntry &ze ) ; inline bool operator== ( const ZipCDirEntry &ze, const ZipLocalEntry &zlh ) { return zlh == ze ; } inline bool operator!= ( const ZipLocalEntry &zlh, const ZipCDirEntry &ze ) { return ! ( zlh == ze ) ; } inline bool operator!= ( const ZipCDirEntry &ze, const ZipLocalEntry &zlh ) { return ! ( zlh == ze ) ; } // Inline member functions ZipCDirEntry &ZipCDirEntry::operator=( const class ZipCDirEntry &src ) { writer_version = src.writer_version ; extract_version = src.extract_version ; gp_bitfield = src.gp_bitfield ; compress_method = src.compress_method ; last_mod_ftime = src.last_mod_ftime ; last_mod_fdate = src.last_mod_fdate ; crc_32 = src.crc_32 ; compress_size = src.compress_size ; uncompress_size = src.uncompress_size ; filename_len = src.filename_len ; extra_field_len = src.extra_field_len ; file_comment_len = src.file_comment_len ; disk_num_start = src.disk_num_start ; intern_file_attr = src.intern_file_attr ; extern_file_attr = src.extern_file_attr ; rel_offset_loc_head = src.rel_offset_loc_head ; filename = src.filename ; extra_field = src.extra_field ; file_comment = src.file_comment ; return *this ; } bool EndOfCentralDirectory::checkSignature ( uint32 sig ) const { return signature == sig ; } } // namespace #endif /** \file Header file containing classes and functions for reading the central directory and local header fields in a zip archive. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/zipios++/zipheadio.h000066400000000000000000000143021351224126100167470ustar00rootroot00000000000000#ifndef ZIPHEADIO_H #define ZIPHEADIO_H #include "zipios++/zipios-config.h" #include "zipios++/meta-iostreams.h" #include #include #include "zipios++/ziphead.h" #include "zipios++/zipios_defs.h" #include "zipios++/fcollexceptions.h" namespace zipios { // byte order conversion functions. // ztohs (zip-to-host-short) #ifdef MY_BIG_ENDIAN inline uint16 ztohs ( unsigned char *buf ) { uint16 out ; // *( reinterpret_cast( &out ) ) = *( buf + 1 ); // *( reinterpret_cast( &out ) + 1 ) = *( buf ); out = ( static_cast< uint16 >( buf[ 0 ] ) << 8 ) + ( static_cast< uint16 >( buf[ 1 ] ) ) ; return out; } // ztohl (zip-to-host-long) inline uint32 ztohl ( unsigned char *buf ) { uint32 out; out = ( static_cast< uint32 >( buf[ 0 ] ) << 24 ) + ( static_cast< uint32 >( buf[ 1 ] ) << 16 ) + ( static_cast< uint32 >( buf[ 2 ] ) << 8 ) + ( static_cast< uint32 >( buf[ 3 ] ) ) ; return out; } #else inline uint16 ztohs ( unsigned char *buf ) { uint16 out ; out = ( static_cast< uint16 >( buf[ 1 ] ) << 8 ) + ( static_cast< uint16 >( buf[ 0 ] ) ) ; return out; } // ztohl (zip-to-host-long) inline uint32 ztohl ( unsigned char *buf ) { uint32 out; out = ( static_cast< uint32 >( buf[ 3 ] ) << 24 ) + ( static_cast< uint32 >( buf[ 2 ] ) << 16 ) + ( static_cast< uint32 >( buf[ 1 ] ) << 8 ) + ( static_cast< uint32 >( buf[ 0 ] ) ) ; // cerr << "buf : " << static_cast< int >( buf[ 0 ] ) ; // cerr << " " << static_cast< int >( buf[ 1 ] ) ; // cerr << " " << static_cast< int >( buf[ 2 ] ) ; // cerr << " " << static_cast< int >( buf[ 3 ] ) << endl ; // cerr << "uint32 " << out << endl ; return out; } #endif // htozl (host-to-zip-long) inline uint32 htozl ( unsigned char *buf ) { return ztohl( buf ) ; } // htozs (host-to-zip-short) inline uint16 htozs ( unsigned char *buf ) { return ztohs( buf ) ; } inline uint32 readUint32 ( istream &is ) { static const int buf_len = sizeof ( uint32 ) ; unsigned char buf [ buf_len ] ; int rsf = 0 ; std::streampos original_pos = is.tellg() ; while ( rsf < buf_len && !is.eof() ) { is.read ( reinterpret_cast< char * >( buf ) + rsf, buf_len - rsf ) ; rsf += is.gcount () ; } if ( rsf != buf_len ) { is.seekg( original_pos ) ; throw InvalidStateException( "Reached end-of-file while trying to read a" "Uint32; the zip archive may be corrupt." ) ; } return ztohl ( buf ) ; } inline void writeUint32 ( uint32 host_val, ostream &os ) { uint32 val = htozl( reinterpret_cast< unsigned char * >( &host_val ) ) ; os.write( reinterpret_cast< char * >( &val ), sizeof( uint32 ) ) ; } inline uint16 readUint16 ( istream &is ) { static const int buf_len = sizeof ( uint16 ) ; unsigned char buf [ buf_len ] ; int rsf = 0 ; std::streampos original_pos = is.tellg() ; while ( rsf < buf_len && !is.eof() ) { is.read ( reinterpret_cast< char * >( buf ) + rsf, buf_len - rsf ) ; rsf += is.gcount () ; } if ( rsf != buf_len ) { is.seekg( original_pos ) ; throw InvalidStateException( "Reached end-of-file while trying to read a" "Uint16; the zip archive may be corrupt." ) ; } return ztohs ( buf ) ; } inline void writeUint16 ( uint16 host_val, ostream &os ) { uint16 val = htozl( reinterpret_cast< unsigned char * >( &host_val ) ) ; os.write( reinterpret_cast< char * >( &val ), sizeof( uint16 ) ) ; } inline void readByteSeq ( istream &is, string &con, int count ) { char *buf = new char [ count + 1 ] ; int rsf = 0 ; while ( rsf < count && is ) { is.read ( buf + rsf, count - rsf ) ; rsf += is.gcount() ; } buf [ count ] = '\0' ; con = buf ; delete [] buf ; } inline void writeByteSeq( ostream &os, const string &con ) { os << con ; } inline void readByteSeq ( istream &is, unsigned char *buf, int count ) { int rsf = 0 ; while ( rsf < count && is ) { is.read ( reinterpret_cast< char * >( buf ) + rsf, count - rsf ) ; rsf += is.gcount() ; } } inline void writeByteSeq ( ostream &os, const unsigned char *buf, int count ) { os.rdbuf()->sputn( reinterpret_cast< const char * >( buf ), count ) ; } inline void readByteSeq ( istream &is, vector < unsigned char > &vec, int count ) { unsigned char *buf = new unsigned char [ count ] ; int rsf = 0 ; while ( rsf < count && is ) { is.read ( reinterpret_cast< char * >( buf ) + rsf, count - rsf ) ; rsf += is.gcount() ; } vec.insert ( vec.end (), buf, buf + count ) ; delete [] buf ; } inline void writeByteSeq ( ostream &os, const vector < unsigned char > &vec ) { os.rdbuf()->sputn( reinterpret_cast< const char * >( &( vec[ 0 ] ) ), vec.size() ) ; } istream& operator>> ( istream &is, ZipLocalEntry &zlh ) ; istream& operator>> ( istream &is, DataDescriptor &dd ) ; istream& operator>> ( istream &is, ZipCDirEntry &zcdh ) ; // istream& operator>> ( istream &is, EndOfCentralDirectory &eocd ) ; ostream &operator<< ( ostream &os, const ZipLocalEntry &zlh ) ; ostream &operator<< ( ostream &os, const ZipCDirEntry &zcdh ) ; ostream &operator<< ( ostream &os, const EndOfCentralDirectory &eocd ) ; } // namespace #endif /** \file Header file that defines I/O functions for the header structures defined in ziphead.h. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/zipios++/zipheadio.h.orig000066400000000000000000000131641351224126100177130ustar00rootroot00000000000000#ifndef ZIPHEADIO_H #define ZIPHEADIO_H #include "zipios++/zipios-config.h" #include "zipios++/meta-iostreams.h" #include #include #include "zipios++/ziphead.h" #include "zipios++/zipios_defs.h" namespace zipios { // byte order conversion functions. // ztohs (zip-to-host-short) #ifdef MY_BIG_ENDIAN inline uint16 ztohs ( unsigned char *buf ) { uint16 out ; // *( reinterpret_cast( &out ) ) = *( buf + 1 ); // *( reinterpret_cast( &out ) + 1 ) = *( buf ); out = ( static_cast< uint16 >( buf[ 0 ] ) << 8 ) + ( static_cast< uint16 >( buf[ 1 ] ) ) ; return out; } // ztohl (zip-to-host-long) inline uint32 ztohl ( unsigned char *buf ) { uint32 out; out = ( static_cast< uint32 >( buf[ 0 ] ) << 24 ) + ( static_cast< uint32 >( buf[ 1 ] ) << 16 ) + ( static_cast< uint32 >( buf[ 2 ] ) << 8 ) + ( static_cast< uint32 >( buf[ 3 ] ) ) ; return out; } #else inline uint16 ztohs ( unsigned char *buf ) { uint16 out ; out = ( static_cast< uint16 >( buf[ 1 ] ) << 8 ) + ( static_cast< uint16 >( buf[ 0 ] ) ) ; return out; } // ztohl (zip-to-host-long) inline uint32 ztohl ( unsigned char *buf ) { uint32 out; out = ( static_cast< uint32 >( buf[ 3 ] ) << 24 ) + ( static_cast< uint32 >( buf[ 2 ] ) << 16 ) + ( static_cast< uint32 >( buf[ 1 ] ) << 8 ) + ( static_cast< uint32 >( buf[ 0 ] ) ) ; // cerr << "buf : " << static_cast< int >( buf[ 0 ] ) ; // cerr << " " << static_cast< int >( buf[ 1 ] ) ; // cerr << " " << static_cast< int >( buf[ 2 ] ) ; // cerr << " " << static_cast< int >( buf[ 3 ] ) << endl ; // cerr << "uint32 " << out << endl ; return out; } #endif // htozl (host-to-zip-long) inline uint32 htozl ( unsigned char *buf ) { return ztohl( buf ) ; } // htozs (host-to-zip-short) inline uint16 htozs ( unsigned char *buf ) { return ztohs( buf ) ; } inline uint32 readUint32 ( istream &is ) { static const int buf_len = sizeof ( uint32 ) ; unsigned char buf [ buf_len ] ; int rsf = 0 ; while ( rsf < buf_len ) { is.read ( reinterpret_cast< char * >( buf ) + rsf, buf_len - rsf ) ; rsf += is.gcount () ; } return ztohl ( buf ) ; } inline void writeUint32 ( uint32 host_val, ostream &os ) { uint32 val = htozl( reinterpret_cast< unsigned char * >( &host_val ) ) ; os.write( reinterpret_cast< char * >( &val ), sizeof( uint32 ) ) ; } inline uint16 readUint16 ( istream &is ) { static const int buf_len = sizeof ( uint16 ) ; unsigned char buf [ buf_len ] ; int rsf = 0 ; while ( rsf < buf_len ) { is.read ( reinterpret_cast< char * >( buf ) + rsf, buf_len - rsf ) ; rsf += is.gcount () ; } return ztohs ( buf ) ; } inline void writeUint16 ( uint16 host_val, ostream &os ) { uint16 val = htozl( reinterpret_cast< unsigned char * >( &host_val ) ) ; os.write( reinterpret_cast< char * >( &val ), sizeof( uint16 ) ) ; } inline void readByteSeq ( istream &is, string &con, int count ) { char *buf = new char [ count + 1 ] ; int rsf = 0 ; while ( rsf < count && is ) { is.read ( buf + rsf, count - rsf ) ; rsf += is.gcount() ; } buf [ count ] = '\0' ; con = buf ; delete [] buf ; } inline void writeByteSeq( ostream &os, const string &con ) { os << con ; } inline void readByteSeq ( istream &is, unsigned char *buf, int count ) { int rsf = 0 ; while ( rsf < count && is ) { is.read ( reinterpret_cast< char * >( buf ) + rsf, count - rsf ) ; rsf += is.gcount() ; } } inline void writeByteSeq ( ostream &os, const unsigned char *buf, int count ) { os.rdbuf()->sputn( reinterpret_cast< const char * >( buf ), count ) ; } inline void readByteSeq ( istream &is, vector < unsigned char > &vec, int count ) { unsigned char *buf = new unsigned char [ count ] ; int rsf = 0 ; while ( rsf < count && is ) { is.read ( reinterpret_cast< char * >( buf ) + rsf, count - rsf ) ; rsf += is.gcount() ; } vec.insert ( vec.end (), buf, buf + count ) ; delete [] buf ; } inline void writeByteSeq ( ostream &os, const vector < unsigned char > &vec ) { os.rdbuf()->sputn( reinterpret_cast< const char * >( &( vec[ 0 ] ) ), vec.size() ) ; } istream& operator>> ( istream &is, ZipLocalEntry &zlh ) ; istream& operator>> ( istream &is, DataDescriptor &dd ) ; istream& operator>> ( istream &is, ZipCDirEntry &zcdh ) ; // istream& operator>> ( istream &is, EndOfCentralDirectory &eocd ) ; ostream &operator<< ( ostream &os, const ZipLocalEntry &zlh ) ; ostream &operator<< ( ostream &os, const ZipCDirEntry &zcdh ) ; ostream &operator<< ( ostream &os, const EndOfCentralDirectory &eocd ) ; } // namespace #endif /** \file Header file that defines I/O functions for the header structures defined in ziphead.h. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/zipios++/zipheadio.h.rej000066400000000000000000000012751351224126100175330ustar00rootroot00000000000000--- zipheadio.h +++ zipheadio.h @@ -80,10 +81,18 @@ inline uint32 readUint32 ( istream &is ) { static const int buf_len = sizeof ( uint32 ) ; unsigned char buf [ buf_len ] ; int rsf = 0 ; - while ( rsf < buf_len ) { + std::streampos original_pos = is.tellg() ; + while ( rsf < buf_len && !is.eof() ) { is.read ( reinterpret_cast< char * >( buf ) + rsf, buf_len - rsf ) ; rsf += static_cast< int >( is.gcount () ) ; } + + if ( rsf != buf_len ) { + is.seekg( original_pos ) ; + throw InvalidStateException( "Reached end-of-file while trying to read a" + "Uint32; the zip archive may be corrupt." ) ; + } + return ztohl ( buf ) ; } zipios++-0.1.7/zipios++/zipinputstream.h000066400000000000000000000056031351224126100200750ustar00rootroot00000000000000#ifndef ZIPINPUTSTREAM_H #define ZIPINPUTSTREAM_H #include "zipios++/zipios-config.h" #include "zipios++/meta-iostreams.h" #include #include "zipios++/ziphead.h" #include "zipios++/zipinputstreambuf.h" namespace zipios { using std::ifstream ; /** \anchor ZipInputStream_anchor ZipInputStream is an istream that gets it's input from a zip file. The interface approximates the interface of the Java ZipInputStream. */ class ZipInputStream : public istream { public: /** ZipInputStream constructor. @param is istream from which the compressed zip archive can be read. @param pos position to reposition the istream to before reading. */ explicit ZipInputStream( istream &is, streampos pos = 0 ) ; /** ZipInputStream constructor. @filename filename of a valid zip file. @param pos position to reposition the istream to before reading. */ explicit ZipInputStream( const string &filename, streampos pos = 0 ) ; int available() ; /** Closes the current entry, and positions the stream read pointer at the beginning of the next entry (if there is one). */ void closeEntry() ; /** Closes the istream. */ void close() ; // ZipLocalEntry *createZipCDirEntry( const string &name ) ; /** \anchor ZipInputStream_getnextentry_anchor Opens the next entry in the zip archive and returns a const pointer to a FileEntry object for the entry. For new instances this method has to be called once before you can read from the first entry. @return a const FileEntry * containing information about the (now) current entry. */ ConstEntryPointer getNextEntry() ; /** Destructor. */ virtual ~ZipInputStream() ; private: ifstream *ifs ; ZipInputStreambuf *izf ; /** Copy-constructor is private to prevent copying. */ ZipInputStream( const ZipInputStream &src ) ; /** Copy-assignment operator is private to prevent copying. */ const ZipInputStream &operator= ( const ZipInputStream &src ) ; }; } // namespace. #endif /** \file Header file that defines ZipInputStream. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/zipios++/zipinputstreambuf.h000066400000000000000000000053341351224126100205730ustar00rootroot00000000000000#ifndef ZIPINPUTSTREAMBUF_H #define ZIPINPUTSTREAMBUF_H #include "zipios++/zipios-config.h" #include #include #include "zipios++/fcoll.h" #include "zipios++/inflateinputstreambuf.h" #include "zipios++/ziphead.h" namespace zipios { /** ZipInputStreambuf is a zip input streambuf filter. */ class ZipInputStreambuf : public InflateInputStreambuf { public: /** ZipInputStreambuf constructor. @param inbuf the streambuf to use for input. @param s_pos a position to reset the inbuf to before reading. Specify -1 to read from the current position. @param del_inbuf if true is specified inbuf will be deleted, when the ZipInputStreambuf is destructed. */ explicit ZipInputStreambuf( streambuf *inbuf, int s_pos = -1, bool del_inbuf = false ) ; /** Closes the current entry, and positions the stream read pointer at the beginning of the next entry (if there is one). */ void closeEntry() ; /** Closes the streambuf. */ void close() ; /** Opens the next entry in the zip archive and returns a const pointer to a FileEntry object for the entry. @return a const FileEntry * containing information about the (now) current entry. */ ConstEntryPointer getNextEntry() ; /** Destructor. */ virtual ~ZipInputStreambuf() ; protected: virtual int underflow() ; private: bool _open_entry ; ZipLocalEntry _curr_entry ; int _data_start ; // Don't forget entry header has a length too. int _remain ; // For STORED entry only. the number of bytes that // hasn't been put in the _outvec yet. /** Copy-constructor is private to prevent copying. */ ZipInputStreambuf( const ZipInputStreambuf &src ) ; /** Copy-assignment operator is private to prevent copying. */ const ZipInputStreambuf &operator= ( const ZipInputStreambuf &src ) ; }; } // namespace #endif /** \file Header file that defines ZipInputStreambuf. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/zipios++/zipios-config.w32000066400000000000000000000031771351224126100177470ustar00rootroot00000000000000#ifndef ZIPIOS_CONFIG_H #define ZIPIOS_CONFIG_H // This is fine for VC++ 5.0 sp 3 #define HAVE_STD_IOSTREAM #define USE_STD_IOSTREAM // Visual C++ #ifdef _MSC_VER // Disable class-browser warning about truncated template-names #pragma warning( disable : 4786 ) #endif //_MSC_VER // Needed for FilePath #define S_ISREG(mode) (((mode) & _S_IFREG) == _S_IFREG) #define S_ISDIR(mode) (((mode) & _S_IFDIR) == _S_IFDIR) #define S_ISCHR(mode) (((mode) & _S_IFCHR) == _S_IFCHR) #define S_ISBLK(mode) 0 #define S_ISSOCK(mode) 0 #define S_ISFIFO(mode) (((mode) & _S_IFIFO) == _S_IFIFO) // Convenient place to include any debugging-headers #include #endif // ZIPIOS_CONFIG_H /** \file Configuration header file that allows compatibility with win32 compilers */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 1. Thomas Sndergaard 2. Kevin Shea Written by Kevin Shea 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 */ zipios++-0.1.7/zipios++/zipios_defs.h000066400000000000000000000020531351224126100173110ustar00rootroot00000000000000#ifndef ZIPIOS_DEFS_H #define ZIPIOS_DEFS_H namespace zipios { typedef unsigned short uint16 ; typedef unsigned long uint32 ; } // namespace #endif /** \file Header file that defines some simple data types. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/zipios++/zipoutputstream.h000066400000000000000000000064171351224126100203020ustar00rootroot00000000000000#ifndef ZIPOUTPUTSTREAM_H #define ZIPOUTPUTSTREAM_H #include "zipios++/zipios-config.h" #include "zipios++/meta-iostreams.h" #include #include "zipios++/ziphead.h" #include "zipios++/zipoutputstreambuf.h" namespace zipios { /** \anchor ZipOutputStream_anchor ZipOutputStream is an ostream that writes the output to a zip file. The interface approximates the interface of the Java ZipOutputStream. */ class ZipOutputStream : public std::ostream { public: /** ZipOutputStream constructor. @param os ostream to which the compressed zip archive is written. @param pos position to reposition the ostream to before reading. */ explicit ZipOutputStream( std::ostream &os ) ; /** ZipOutputStream constructor. @filename filename to write the zip archive to. */ explicit ZipOutputStream( const std::string &filename ) ; /** Closes the current entry updates its header with the relevant size information and positions the stream write pointer for the next entry header. Puts the stream in EOF state. Call putNextEntry() to clear the EOF stream state flag. */ void closeEntry() ; /** Calls finish and if the ZipOutputStream was created with a filename as a parameter that file is closed as well. If the ZipOutputStream was created with an ostream as its first parameter nothing but the call to finish happens. */ void close() ; /** Closes the current entry (if one is open), then writes the Zip Central Directory Structure closing the ZipOutputStream. The output stream that the zip archive is being written to is not closed. */ void finish() ; /** \anchor ZipOutputStream_putnextentry_anchor Begins writing the next entry. */ void putNextEntry( const ZipCDirEntry &entry ) ; /** \anchor ZipOutputStream_putnextentry2_anchor Begins writing the next entry. */ void putNextEntry(const std::string& entryName); /** Sets the global comment for the Zip archive. */ void setComment( const std::string& comment ) ; /** Sets the compression level to be used for subsequent entries. */ void setLevel( int level ) ; /** Sets the compression method to be used. only STORED and DEFLATED are supported. */ void setMethod( StorageMethod method ) ; /** Destructor. */ virtual ~ZipOutputStream() ; private: std::ofstream *ofs ; ZipOutputStreambuf *ozf ; }; } // namespace. #endif /** \file Header file that defines ZipOutputStream. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */ zipios++-0.1.7/zipios++/zipoutputstreambuf.h000066400000000000000000000067741351224126100210050ustar00rootroot00000000000000#ifndef ZIPOUTPUTSTREAMBUF_H #define ZIPOUTPUTSTREAMBUF_H #include "zipios++/zipios-config.h" #include #include #include "zipios++/fcoll.h" #include "zipios++/deflateoutputstreambuf.h" #include "zipios++/ziphead.h" namespace zipios { /** ZipOutputStreambuf is a zip output streambuf filter. */ class ZipOutputStreambuf : public DeflateOutputStreambuf { public: enum CompressionLevels { NO_COMPRESSION = Z_NO_COMPRESSION, BEST_SPEED = Z_BEST_SPEED, BEST_COMPRESSION = Z_BEST_COMPRESSION, DEFAULT_COMPRESSION = Z_DEFAULT_COMPRESSION } ; /** ZipOutputStreambuf constructor. A newly constructed ZipOutputStreambuf is not ready to accept data, putNextEntry() must be invoked first. @param outbuf the streambuf to use for input. @param del_outbuf if true is specified outbuf will be deleted, when the ZipOutputStreambuf is destructed. */ explicit ZipOutputStreambuf( streambuf *outbuf, bool del_outbuf = false ) ; /** Closes the current entry, and positions the stream read pointer at the beginning of the next entry (if there is one). */ void closeEntry() ; /** Calls finish. */ void close() ; /** Closes the current entry (if one is open), then writes the Zip Central Directory Structure closing the ZipOutputStream. The output stream that the zip archive is being written to is not closed. */ void finish() ; /** Begins writing the next entry. Opens the next entry in the zip archive and returns a const pointer to a FileEntry object for the entry. @return a const FileEntry * containing information about the (now) current entry. */ void putNextEntry( const ZipCDirEntry &entry ) ; /** Sets the global comment for the Zip archive. */ void setComment( const string &comment ) ; /** Sets the compression level to be used for subsequent entries. */ void setLevel( int level ) ; /** Sets the compression method to be used. only STORED and DEFLATED are supported. */ void setMethod( StorageMethod method ) ; /** Destructor. */ virtual ~ZipOutputStreambuf() ; protected: virtual int overflow( int c = EOF ) ; virtual int sync() ; void setEntryClosedState() ; void updateEntryHeaderInfo() ; // Should/could be moved to zipheadio.h ?! static void writeCentralDirectory( const vector< ZipCDirEntry > &entries, EndOfCentralDirectory eocd, ostream &os ) ; private: string _zip_comment ; vector< ZipCDirEntry > _entries ; bool _open_entry ; bool _open ; StorageMethod _method ; int _level ; }; } // namespace #endif /** \file Header file that defines ZipOutputStreambuf. */ /* Zipios++ - a small C++ library that provides easy access to .zip files. Copyright (C) 2000 Thomas Sndergaard 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 */