~mc.../inkscape/inkscape

« back to all changes in this revision

Viewing changes to src/streams-gzip.h

  • Committer: mental
  • Date: 2006-01-16 02:36:01 UTC
  • Revision ID: mental@users.sourceforge.net-20060116023601-wkr0h7edl5veyudq
moving trunk for module inkscape

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 */
 
11
 
 
12
#ifndef __STREAMS_GZIP_H_
 
13
#define __STREAMS_GZIP_H_
 
14
 
 
15
#include "streams-zlib.h"
 
16
 
 
17
namespace Inkscape {
 
18
 
 
19
class GZipHeaderException : public ZlibBufferException
 
20
{
 
21
public:
 
22
    const char *what() const throw() { return "Invalid gzip file"; }
 
23
};
 
24
 
 
25
/**
 
26
 * GZipBuffer
 
27
 */
 
28
 
 
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);
 
51
 
 
52
};
 
53
 
 
54
} // namespace Inkscape
 
55
#endif // header guard
 
56
 
 
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 :