forked from pocoproject/poco
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuotedPrintableEncoder.h
More file actions
85 lines (66 loc) · 1.89 KB
/
QuotedPrintableEncoder.h
File metadata and controls
85 lines (66 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//
// QuotedPrintableEncoder.h
//
// Library: Net
// Package: Messages
// Module: QuotedPrintableEncoder
//
// Definition of the QuotedPrintableEncoder class.
//
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Net_QuotedPrintableEncoder_INCLUDED
#define Net_QuotedPrintableEncoder_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/UnbufferedStreamBuf.h"
#include <ostream>
namespace Poco {
namespace Net {
class Net_API QuotedPrintableEncoderBuf: public Poco::UnbufferedStreamBuf
/// This streambuf encodes all data written
/// to it in quoted-printable encoding (see RFC 2045)
/// and forwards it to a connected ostream.
{
public:
QuotedPrintableEncoderBuf(std::ostream& ostr);
~QuotedPrintableEncoderBuf();
int close();
private:
int writeToDevice(char c);
void writeEncoded(char c);
void writeRaw(char c);
int _pending;
int _lineLength;
std::ostream& _ostr;
};
class Net_API QuotedPrintableEncoderIOS: public virtual std::ios
/// The base class for QuotedPrintableEncoder.
///
/// This class is needed to ensure the correct initialization
/// order of the stream buffer and base classes.
{
public:
QuotedPrintableEncoderIOS(std::ostream& ostr);
~QuotedPrintableEncoderIOS();
int close();
QuotedPrintableEncoderBuf* rdbuf();
protected:
QuotedPrintableEncoderBuf _buf;
};
class Net_API QuotedPrintableEncoder: public QuotedPrintableEncoderIOS, public std::ostream
/// This ostream encodes all data
/// written to it in quoted-printable encoding
/// (see RFC 2045) and forwards it to a connected ostream.
/// Always call close() when done
/// writing data, to ensure proper
/// completion of the encoding operation.
{
public:
QuotedPrintableEncoder(std::ostream& ostr);
~QuotedPrintableEncoder();
};
} } // namespace Poco::Net
#endif // Net_QuotedPrintableEncoder_INCLUDED