~ubuntu-branches/ubuntu/utopic/inkscape/utopic-proposed

« back to all changes in this revision

Viewing changes to inkscape-0.47pre1/src/io/xsltstream.h

  • Committer: Bazaar Package Importer
  • Author(s): Bryce Harrington
  • Date: 2009-07-02 17:09:45 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20090702170945-nn6d6zswovbwju1t
Tags: 0.47~pre1-0ubuntu1
* New upstream release.
  - Don't constrain maximization on small resolution devices (pre0)
    (LP: #348842)
  - Fixes segfault on startup (pre0)
    (LP: #391149)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef __INKSCAPE_IO_XSLTSTREAM_H__
 
2
#define __INKSCAPE_IO_XSLTSTREAM_H__
 
3
/**
 
4
 * Xslt-enabled input and output streams
 
5
 *
 
6
 *
 
7
 * Authors:
 
8
 *   Bob Jamison <ishmalius@gmail.com>
 
9
 *
 
10
 * Copyright (C) 2004-2008 Inkscape.org
 
11
 *
 
12
 * Released under GNU GPL, read the file 'COPYING' for more information
 
13
 */
 
14
 
 
15
 
 
16
#include "inkscapestream.h"
 
17
 
 
18
#include <libxslt/xslt.h>
 
19
#include <libxslt/xsltInternals.h>
 
20
 
 
21
 
 
22
namespace Inkscape
 
23
{
 
24
namespace IO
 
25
{
 
26
 
 
27
//#########################################################################
 
28
//# X S L T    S T Y L E S H E E T
 
29
//#########################################################################
 
30
/**
 
31
 * This is a container for reusing a loaded stylesheet
 
32
 */
 
33
class XsltStyleSheet
 
34
{
 
35
 
 
36
public:
 
37
 
 
38
    /**
 
39
     * Constructor with loading
 
40
     */
 
41
    XsltStyleSheet(InputStream &source)  throw (StreamException);
 
42
 
 
43
    /**
 
44
     * Simple constructor, no loading
 
45
     */
 
46
    XsltStyleSheet();
 
47
 
 
48
    /**
 
49
     * Loader
 
50
     */
 
51
    bool read(InputStream &source);
 
52
 
 
53
    /**
 
54
     * Destructor
 
55
     */
 
56
    virtual ~XsltStyleSheet();
 
57
    
 
58
    xsltStylesheetPtr stylesheet;
 
59
 
 
60
 
 
61
}; // class XsltStyleSheet
 
62
 
 
63
 
 
64
//#########################################################################
 
65
//# X S L T    I N P U T    S T R E A M
 
66
//#########################################################################
 
67
 
 
68
/**
 
69
 * This class is for transforming stream input by a given stylesheet
 
70
 */
 
71
class XsltInputStream : public BasicInputStream
 
72
{
 
73
 
 
74
public:
 
75
 
 
76
    XsltInputStream(InputStream &xmlSource, XsltStyleSheet &stylesheet)
 
77
                        throw (StreamException);
 
78
    
 
79
    virtual ~XsltInputStream() throw (StreamException);
 
80
    
 
81
    virtual int available() throw (StreamException);
 
82
    
 
83
    virtual void close() throw (StreamException);
 
84
    
 
85
    virtual int get() throw (StreamException);
 
86
    
 
87
 
 
88
private:
 
89
 
 
90
    XsltStyleSheet &stylesheet;
 
91
 
 
92
    xmlChar *outbuf;
 
93
    int outsize;
 
94
    int outpos;
 
95
 
 
96
}; // class UriInputStream
 
97
 
 
98
 
 
99
 
 
100
 
 
101
//#########################################################################
 
102
//# X S L T    O U T P U T    S T R E A M
 
103
//#########################################################################
 
104
 
 
105
/**
 
106
 * This class is for transforming stream output by a given stylesheet
 
107
 */
 
108
class XsltOutputStream : public BasicOutputStream
 
109
{
 
110
 
 
111
public:
 
112
 
 
113
    XsltOutputStream(OutputStream &destination, XsltStyleSheet &stylesheet)
 
114
                             throw (StreamException);
 
115
    
 
116
    virtual ~XsltOutputStream() throw (StreamException);
 
117
    
 
118
    virtual void close() throw (StreamException);
 
119
    
 
120
    virtual void flush() throw (StreamException);
 
121
    
 
122
    virtual void put(int ch) throw (StreamException);
 
123
 
 
124
private:
 
125
 
 
126
    XsltStyleSheet &stylesheet;
 
127
 
 
128
    Glib::ustring outbuf;
 
129
    
 
130
    bool flushed;
 
131
 
 
132
}; // class UriOutputStream
 
133
 
 
134
 
 
135
 
 
136
} // namespace IO
 
137
} // namespace Inkscape
 
138
 
 
139
 
 
140
#endif /* __INKSCAPE_IO_XSLTSTREAM_H__ */