Projet Bee-Honey't  1.0
BTS SN 2019
Fonctions membres publiques statiques | Liste de tous les membres
Référence de la classe SimpleMail::QuotedPrintable

#include <quotedprintable.h>

Graphe de collaboration de SimpleMail::QuotedPrintable:
Collaboration graph

Fonctions membres publiques statiques

static QByteArray encode (const QByteArray &input, bool rfc2047, int *printable=0, int *encoded=0)
 
static QByteArray decode (const QByteArray &input)
 

Documentation des fonctions membres

◆ decode()

QByteArray QuotedPrintable::decode ( const QByteArray &  input)
static

Référencé par SimpleMail::MimePart::data().

90 {
91  // 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F
92  static const int hexVal[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 10, 11, 12, 13, 14, 15};
93 
94  QByteArray output;
95 
96  int len = input.length();
97  for (int i = 0; i < len-2; ++i) {
98  if (input.at(i) == '=') {
99  int x = input.at(i+1) - '0';
100  int y = input.at(i+2) - '0';
101  if (x >= 0 && y >= 0 && x < 23 && y < 23) {
102  output.append(char((hexVal[x] << 4) + hexVal[y]));
103  }
104  else {
105  output.append('=').append(char(x + '0')).append(char(y + '0'));
106  }
107 
108  i += 2;
109  } else {
110  output.append(input.at(i));
111  }
112  }
113 
114  return output;
115 }

◆ encode()

QByteArray QuotedPrintable::encode ( const QByteArray &  input,
bool  rfc2047,
int *  printable = 0,
int *  encoded = 0 
)
static

Références requiresEscape().

Référencé par SimpleMail::MimeMessagePrivate::encodeData(), et SimpleMail::MimePartPrivate::writeQuotedPrintable().

62 {
63  QByteArray output;
64 
65  unsigned char byte;
66  static const char hex[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
67 
68  for (int i = 0; i < input.length() ; ++i) {
69  byte = input[i];
70 
71  if (requiresEscape(byte, rfc2047)) {
72  output.append('=');
73  output.append(hex[((byte >> 4) & 0x0F)]);
74  output.append(hex[(byte & 0x0F)]);
75  if (encoded) {
76  ++(*encoded);
77  }
78  } else {
79  output.append(byte);
80  if (printable) {
81  ++(*printable);
82  }
83  }
84  }
85 
86  return output;
87 }
static bool requiresEscape(unsigned char input, bool rfc2047)
Definition: quotedprintable.cpp:38

La documentation de cette classe a été générée à partir des fichiers suivants :