#include <TransferEncoding.h>
|
| static ByteString | encode (const ByteString &_str) |
Definition at line 24 of file TransferEncoding.h.
◆ encode()
| ByteString QuotedPrintableEncoder::encode |
( |
const ByteString & | _str | ) |
|
|
static |
Definition at line 33 of file TransferEncoding.cpp.
34{
36
37 static const char aHex[] = "0123456789ABCDEF";
39 size_t len = _str.length();
40
41 ByteBuffer* buf = ByteBuffer::create(
44 int lineCount = 0;
45 while(len--) {
47 if ((c ==
CR) && (*src ==
LF) && len) {
48
50 *dest++ = *src++;
51 len--;
52 lineCount = 0;
53 }
54 else {
55 if (
56
57 (c <= 0x1f)
58 || (c == 0x7f)
59 || (c & 0x80)
60 || (c == '=')
61 || ((c ==
' ') && (*src ==
CR))
62 ) {
63
65
66 *dest++ = '=';
69 lineCount = 0;
70 }
71
72 *dest++ = '=';
73 *dest++ = aHex[c >> 4];
74 *dest++ = aHex[c & 0x0f];
75 lineCount += 3;
76 }
77 else {
78
80
81 *dest++ = '=';
84 lineCount = 0;
85 }
86
87 *dest++ = c;
88 lineCount++;
89 }
90 }
91 }
94 buf->__dataLength = (char*) dest - buf->data();
96
98 buf->release();
100}
#define __DCL_ASSERT(expr)
The documentation for this class was generated from the following files: