18 #include "mimehdrline.h"
26 mimeHdrLine::mimeHdrLine ():
27 mimeValue (), mimeLabel ()
38 mimeValue (aHdrLine->mimeValue), mimeLabel (aHdrLine->mimeLabel)
42 mimeHdrLine::~mimeHdrLine ()
46 int mimeHdrLine::appendStr (
const char *aCStr)
86 int label = 0, advance;
87 while ( ( advance =
parseWord( &aCStr[label] ) ) ) {
90 if ( label && aCStr[label - 1] !=
':' ) {
112 while ( *aCStr && *aCStr !=
'\r' && *aCStr !=
'\n' ) {
116 if ( *aCStr ==
'\r' ) {
120 if ( *aCStr ==
'\n' ) {
136 if ( aCStr && *aCStr ) {
137 if ( *aCStr ==
'"' ) {
153 if ( aCStr && *aCStr ) {
154 if ( *aCStr == startQuote ) {
160 while ( *aCStr && *aCStr != endQuote ) {
162 if ( *aCStr ==
'\\' ) {
170 if ( *aCStr == endQuote ) {
186 while ( *aCStr && isalnum( *aCStr ) ) {
188 if ( *aCStr ==
'\\' ) {
206 if ( aCStr && *aCStr ) {
207 if ( isalnum( *aCStr ) ) {
211 if ( *aCStr ==
'\\' ) {
214 }
else if ( !isspace( *aCStr ) ) {
231 while ( *aCStr && *aCStr !=
'\n' ) {
233 if ( *aCStr ==
'\\' ) {
241 if ( *aCStr ==
'\n' ) {
256 if ( aCStr && *aCStr ) {
257 while ( *aCStr ==
' ' || *aCStr ==
'\t' ) {
262 if ( *aCStr ==
'\r' ) {
266 if ( *aCStr++ ==
'\n' ) {
267 if ( *aCStr ==
'\t' || *aCStr ==
' ' ) {
274 retVal = -retVal - 1;
302 }
else if ( ( advance =
skipWS( aCStr ) ) ) {
336 if ( *aCStr != separator ) {
383 uint len = aLine.
length();
387 int validStart = aLine.
indexOf(
": ");
388 if ( validStart > -1 ) {
391 while ( len > truncate ) {
393 if ( cutHere < 1 || cutHere < validStart ) {
396 cutHere = aLine.
indexOf(
' ', 1 );
398 cutHere = aLine.
indexOf(
'\t', 1 );
401 return aLine.
left( truncate );
407 retVal += aLine.
left( cutHere ) +
'\n';
408 int chop = len - cutHere;
409 aLine = aLine.
right( chop );
static int parseSeparator(char, const char *)
parses continuated lines
const QByteArray & getValue()
return the value
int lastIndexOf(char ch, int from) const
int parseFullLine(const char *)
parses a continuated line
static int parseWord(const char *)
slurp one word
static int parseHalfWord(const char *)
slurp one word respecting backticks
int indexOf(char ch, int from) const
static int parseQuoted(char, char, const char *)
slurp one word
QByteArray mimeLabel
contains the Label of the line
QByteArray right(int len) const
const QByteArray & getLabel()
return the label
QByteArray mimeValue
contains the Value
static int parseAlphaNum(const char *)
slurp one alphanumerical word without continuation
int parseHalfLine(const char *)
slurp one line without continuation
QByteArray left(int len) const
int setStr(const char *)
parse a Line into the class and report characters slurped
static int skipWS(const char *)
skip all white space characters