Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
bufferstream.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-2.1-or-later
/*
12 * Authors:
13 * see git history
14 * Bob Jamison
15 *
16 * Copyright (C) 2018 Authors
17 * Released under GNU LGPL v2.1+, read the file 'COPYING' for more information.
18 */
19#ifndef SEEN_BUFFERSTREAM_H
20#define SEEN_BUFFERSTREAM_H
21
22
23#include <vector>
24#include "inkscapestream.h"
25
26
27namespace Inkscape
28{
29namespace IO
30{
31
32//#########################################################################
33//# S T R I N G I N P U T S T R E A M
34//#########################################################################
35
41{
42
43public:
44
45 BufferInputStream(const std::vector<unsigned char> &sourceBuffer);
47 int available() override;
48 void close() override;
49 int get() override;
50
51private:
52 const std::vector<unsigned char> &buffer;
54 bool closed;
55
56}; // class BufferInputStream
57
58
59
60
61//#########################################################################
62//# B U F F E R O U T P U T S T R E A M
63//#########################################################################
64
70{
71
72public:
73
76 void close() override;
77 void flush() override;
78 int put(char ch) override;
79 virtual std::vector<unsigned char> &getBuffer()
80 { return buffer; }
81
82 virtual void clear()
83 { buffer.clear(); }
84
85private:
86 std::vector<unsigned char> buffer;
87 bool closed;
88
89}; // class BufferOutputStream
90
91
92
93} //namespace IO
94} //namespace Inkscape
95
96
97
98#endif // SEEN_BUFFERSTREAM_H
This class is for reading character from a DOMString.
void close() override
Closes this input stream and releases any system resources associated with the stream.
int get() override
Reads the next byte of data from the input stream.
const std::vector< unsigned char > & buffer
int available() override
Returns the number of bytes that can be read (or skipped over) from this input stream without blockin...
This class is for sending a stream to a character buffer.
void flush() override
Flushes this output stream and forces any buffered output bytes to be written out.
void close() override
Closes this output stream and releases any system resources associated with this stream.
int put(char ch) override
Writes the specified byte to this output stream.
virtual std::vector< unsigned char > & getBuffer()
std::vector< unsigned char > buffer
This interface is the base of all input stream classes.
This interface is the base of all input stream classes.
Helper class to stream background task notifications as a series of messages.