24 #include "mimehdrline.h"
25 #include "rfcdecoder.h"
29 const char *wdays[] = {
30 "Sun",
"Mon",
"Tue",
"Wed",
"Thu",
"Fri",
"Sat"
33 const char *months[] = {
34 "Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
35 "Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
38 mimeHdrLine::mimeHdrLine ():
39 mimeValue ((const char *) NULL), mimeLabel ((const char *) NULL)
43 mimeHdrLine::mimeHdrLine (
const TQCString & aLabel,
const TQCString & aValue):
50 mimeValue (aHdrLine->mimeValue), mimeLabel (aHdrLine->mimeLabel)
54 mimeHdrLine::~mimeHdrLine ()
59 mimeHdrLine::appendStr (
const char *inCStr)
63 char *aCStr = (
char *) inCStr;
97 char *aCStr = (
char *) inCStr;
99 mimeLabel = TQCString ((
const char *) NULL);
100 mimeValue = TQCString ((
const char *) NULL);
107 int label = 0, advance;
108 while ((advance =
parseWord (&aCStr[label])))
112 if (label && aCStr[label - 1] !=
':')
137 while (*aCStr && *aCStr !=
'\r' && *aCStr !=
'\n')
166 char *aCStr = (
char *) inCStr;
186 char *aCStr = (
char *) inCStr;
191 if (*aCStr == startQuote)
198 while (*aCStr && *aCStr != endQuote)
210 if (*aCStr == endQuote)
228 char *aCStr = (
char *) inCStr;
232 while (*aCStr && isalnum (*aCStr))
256 char *aCStr = (
char *) inCStr;
260 if (isalnum (*aCStr))
268 else if (!isspace (*aCStr))
287 char *aCStr = (
char *) inCStr;
291 while (*aCStr && *aCStr !=
'\n')
321 char *aCStr = (
char *) inCStr;
325 while (*aCStr ==
' ' || *aCStr ==
'\t')
336 if (*aCStr++ ==
'\n')
337 if (*aCStr ==
'\t' || *aCStr ==
' ')
346 retVal = -retVal - 1;
361 char *aCStr = (
char *) inCStr;
382 else if ((advance =
skipWS (aCStr)))
410 char *aCStr = (
char *) inCStr;
427 if (*aCStr != separator)
484 mimeHdrLine::truncateLine(TQCString aLine,
unsigned int truncate)
488 uint len = aLine.length();
492 int validStart = aLine.find(
": ");
493 if (validStart > -1) {
496 while (len > truncate) {
497 cutHere = aLine.findRev(
' ', truncate);
498 if (cutHere < 1 || cutHere < validStart) {
499 cutHere = aLine.findRev(
'\t', truncate);
501 cutHere = aLine.find(
' ', 1);
503 cutHere = aLine.find(
'\t', 1);
506 return aLine.left(truncate);
512 retVal += aLine.left(cutHere) +
'\n';
513 int chop = len - cutHere;
514 aLine = aLine.right(chop);
static int parseHalfWord(const char *)
slurp one word respecting backticks
static int parseWord(const char *)
slurp one word
TQCString mimeValue
contains the Value
static int parseSeparator(char, const char *)
parses continuated lines
TQCString mimeLabel
contains the Label of the line
static int skipWS(const char *)
skip all white space characters
const TQCString & getLabel()
return the label
int setStr(const char *)
parse a Line into the class and report characters slurped
int parseHalfLine(const char *)
slurp one line without continuation
static int parseAlphaNum(const char *)
slurp one alphanumerical word without continuation
int parseFullLine(const char *)
parses a continuated line
static int parseQuoted(char, char, const char *)
slurp one word
const TQCString & getValue()
return the value