Code

moving trunk for module inkscape
[inkscape.git] / src / streams-gzip.h
1 /*
2  * IO layer : gzip streambuf and streams
3  *
4  * Authors:
5  *   Johan Ceuppens <jceuppen at easynet dot be>
6  *
7  * Copyright (C) 2004 Johan Ceuppens
8  *
9  * Released under GNU LGPL, read the file 'COPYING.LIB' for more information
10  */
12 #ifndef __STREAMS_GZIP_H_
13 #define __STREAMS_GZIP_H_
15 #include "streams-zlib.h"
17 namespace Inkscape {
19 class GZipHeaderException : public ZlibBufferException
20 {
21 public:
22     const char *what() const throw() { return "Invalid gzip file"; }
23 };
25 /**
26  * GZipBuffer
27  */
29 class GZipBuffer : public ZlibBuffer
30 {
31 public:
32     
33     GZipBuffer(URIHandle& urih) //throws GZipHeaderException
34         : ZlibBuffer(urih)
35     { consume_header(); } 
36     ~GZipBuffer() {}
37     
38 private:
39     
40     void consume_header() throw(GZipHeaderException);
41     void check_signature(guint8 *data) throw(GZipHeaderException);
42     void check_flags(guint8 *data) throw(GZipHeaderException);
43     gchar *get_filename();
44     gchar *get_comment();
45     guint16 get_crc();
46     void get_extrafield();
47     gchar *read_string() throw(GZipHeaderException);
48     
49     GZipBuffer& operator=(GZipBuffer const& rhs);
50     GZipBuffer(GZipBuffer const& rhs);
52 };
54 } // namespace Inkscape
55 #endif // header guard
57 /*
58   Local Variables:
59   mode:c++
60   c-file-style:"stroustrup"
61   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
62   indent-tabs-mode:nil
63   fill-column:99
64   End:
65 */
66 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :