367 lines
6.8 KiB
C++
367 lines
6.8 KiB
C++
#ifndef _POP_HEADER_HPP_
|
|
#define _POP_HEADER_HPP_
|
|
#ifndef _COMMON_STRING_HPP_
|
|
#include <common/string.hpp>
|
|
#endif
|
|
#ifndef _COMMON_SYSTEMTIME_HPP_
|
|
#include <common/systime.hpp>
|
|
#endif
|
|
|
|
template <class T>
|
|
class Block;
|
|
|
|
class Header
|
|
{
|
|
public:
|
|
Header(void);
|
|
Header(Block<String> &headerLines);
|
|
Header(const Header &someHeader);
|
|
Header(const String &pathFileName);
|
|
virtual ~Header();
|
|
Header &operator=(const Header &someHeader);
|
|
Header &operator=(Block<String> &headerLines);
|
|
Header &operator=(const String &pathFileName);
|
|
const String &path(void)const;
|
|
const String &from(void)const;
|
|
const String &newsGroups(void)const;
|
|
const String &subject(void)const;
|
|
const String &date(void)const;
|
|
SystemTime systemTime(void);
|
|
const String &organization(void)const;
|
|
const String &lines(void)const;
|
|
const String &messageID(void)const;
|
|
const String &replyTo(void)const;
|
|
const String &postingHost(void)const;
|
|
const String &newsReader(void)const;
|
|
const String &crossReference(void)const;
|
|
const String &contentType(void)const;
|
|
const String &xMailer(void)const;
|
|
private:
|
|
void path(const String &path);
|
|
void from(const String &from);
|
|
void newsGroups(const String &newsGroups);
|
|
void subject(const String &subject);
|
|
void date(const String &date);
|
|
void organization(const String &organization);
|
|
void lines(const String &lines);
|
|
void messageID(const String &messageID);
|
|
void replyTo(const String &replyTo);
|
|
void postingHost(const String &postingHost);
|
|
void newsReader(const String &newsReader);
|
|
void crossReference(const String &crossReference);
|
|
void contentType(const String &contentType);
|
|
void xMailer(const String &xMailer);
|
|
WORD isPath(const String &stringLine)const;
|
|
WORD isFrom(const String &stringLine)const;
|
|
WORD isNewsGroups(const String &stringLine)const;
|
|
WORD isSubject(const String &stringLine)const;
|
|
WORD isDate(const String &stringLine)const;
|
|
WORD isOrganization(const String &stringLine)const;
|
|
WORD isLines(const String &stringLine)const;
|
|
WORD isMessageID(const String &stringLine)const;
|
|
WORD isReplyTo(const String &stringLine)const;
|
|
WORD isNNTPPostingHost(const String &stringLine)const;
|
|
WORD isNewsReader(const String &stringLine)const;
|
|
WORD isCrossReference(const String &stringLine)const;
|
|
WORD isContentType(const String &stringLine)const;
|
|
WORD isMailer(const String &stringLine)const;
|
|
|
|
String mPath;
|
|
String mFrom;
|
|
String mNewsGroups;
|
|
String mSubject;
|
|
String mDate;
|
|
String mOrganization;
|
|
String mLines;
|
|
String mMessageID;
|
|
String mReplyTo;
|
|
String mPostingHost;
|
|
String mContentType;
|
|
String mXMailer;
|
|
String mNewsReader;
|
|
String mCrossReference;
|
|
};
|
|
|
|
inline
|
|
Header::Header(void)
|
|
{
|
|
}
|
|
|
|
inline
|
|
Header::Header(Block<String> &headerLines)
|
|
{
|
|
*this=headerLines;
|
|
}
|
|
|
|
inline
|
|
Header::Header(const Header &someHeader)
|
|
{
|
|
*this=someHeader;
|
|
}
|
|
|
|
inline
|
|
Header::Header(const String &pathFileName)
|
|
{
|
|
*this=pathFileName;
|
|
}
|
|
|
|
inline
|
|
Header::~Header()
|
|
{
|
|
}
|
|
|
|
inline
|
|
const String &Header::path(void)const
|
|
{
|
|
return mPath;
|
|
}
|
|
|
|
inline
|
|
void Header::path(const String &path)
|
|
{
|
|
mPath=path;
|
|
}
|
|
|
|
inline
|
|
const String &Header::from(void)const
|
|
{
|
|
return mFrom;
|
|
}
|
|
|
|
inline
|
|
void Header::from(const String &from)
|
|
{
|
|
mFrom=from;
|
|
}
|
|
|
|
inline
|
|
const String &Header::newsGroups(void)const
|
|
{
|
|
return mNewsGroups;
|
|
}
|
|
|
|
inline
|
|
void Header::newsGroups(const String &newsGroups)
|
|
{
|
|
mNewsGroups=newsGroups;
|
|
}
|
|
|
|
inline
|
|
const String &Header::subject(void)const
|
|
{
|
|
return mSubject;
|
|
}
|
|
|
|
inline
|
|
void Header::subject(const String &subject)
|
|
{
|
|
mSubject=subject;
|
|
}
|
|
|
|
inline
|
|
const String &Header::date(void)const
|
|
{
|
|
return mDate;
|
|
}
|
|
|
|
inline
|
|
void Header::date(const String &date)
|
|
{
|
|
mDate=date;
|
|
}
|
|
|
|
inline
|
|
const String &Header::organization(void)const
|
|
{
|
|
return mOrganization;
|
|
}
|
|
|
|
inline
|
|
void Header::organization(const String &organization)
|
|
{
|
|
mOrganization=organization;
|
|
}
|
|
|
|
inline
|
|
const String &Header::lines(void)const
|
|
{
|
|
return mLines;
|
|
}
|
|
|
|
inline
|
|
void Header::lines(const String &lines)
|
|
{
|
|
mLines=lines;
|
|
}
|
|
|
|
inline
|
|
const String &Header::messageID(void)const
|
|
{
|
|
return mMessageID;
|
|
}
|
|
|
|
inline
|
|
void Header::messageID(const String &messageID)
|
|
{
|
|
mMessageID=messageID;
|
|
}
|
|
|
|
inline
|
|
const String &Header::replyTo(void)const
|
|
{
|
|
return mReplyTo;
|
|
}
|
|
|
|
inline
|
|
void Header::replyTo(const String &replyTo)
|
|
{
|
|
mReplyTo=replyTo;
|
|
}
|
|
|
|
inline
|
|
const String &Header::postingHost(void)const
|
|
{
|
|
return mPostingHost;
|
|
}
|
|
|
|
inline
|
|
void Header::postingHost(const String &postingHost)
|
|
{
|
|
mPostingHost=postingHost;
|
|
}
|
|
|
|
inline
|
|
const String &Header::newsReader(void)const
|
|
{
|
|
return mNewsReader;
|
|
}
|
|
|
|
inline
|
|
void Header::newsReader(const String &newsReader)
|
|
{
|
|
mNewsReader=newsReader;
|
|
}
|
|
|
|
inline
|
|
const String &Header::crossReference(void)const
|
|
{
|
|
return mCrossReference;
|
|
}
|
|
|
|
inline
|
|
void Header::crossReference(const String &crossReference)
|
|
{
|
|
mCrossReference=crossReference;
|
|
}
|
|
|
|
inline
|
|
const String &Header::contentType(void)const
|
|
{
|
|
return mContentType;
|
|
}
|
|
|
|
inline
|
|
void Header::contentType(const String &contentType)
|
|
{
|
|
mContentType=contentType;
|
|
}
|
|
|
|
inline
|
|
const String &Header::xMailer(void)const
|
|
{
|
|
return mXMailer;
|
|
}
|
|
|
|
inline
|
|
void Header::xMailer(const String &xMailer)
|
|
{
|
|
mXMailer=xMailer;
|
|
}
|
|
|
|
inline
|
|
WORD Header::isPath(const String &stringLine)const
|
|
{
|
|
return (!::strncmp(stringLine,"Path: ",6)?TRUE:FALSE);
|
|
}
|
|
|
|
inline
|
|
WORD Header::isFrom(const String &stringLine)const
|
|
{
|
|
return (!::strncmp(stringLine,"From: ",6)?TRUE:FALSE);
|
|
}
|
|
|
|
inline
|
|
WORD Header::isNewsGroups(const String &stringLine)const
|
|
{
|
|
return (!::strncmp(stringLine,"Newsgroups: ",12)?TRUE:FALSE);
|
|
}
|
|
|
|
inline
|
|
WORD Header::isSubject(const String &stringLine)const
|
|
{
|
|
return (!::strncmp(stringLine,"Subject: ",9)?TRUE:FALSE);
|
|
}
|
|
|
|
inline
|
|
WORD Header::isDate(const String &stringLine)const
|
|
{
|
|
return (!::strncmp(stringLine,"Date: ",6)?TRUE:FALSE);
|
|
}
|
|
|
|
inline
|
|
WORD Header::isOrganization(const String &stringLine)const
|
|
{
|
|
return (!::strncmp(stringLine,"Organization: ",14)?TRUE:FALSE);
|
|
}
|
|
|
|
inline
|
|
WORD Header::isLines(const String &stringLine)const
|
|
{
|
|
return (!::strncmp(stringLine,"Lines: ",7)?TRUE:FALSE);
|
|
}
|
|
|
|
inline
|
|
WORD Header::isMessageID(const String &stringLine)const
|
|
{
|
|
return (!::strncmp(stringLine,"Message-ID: ",12)?TRUE:FALSE);
|
|
}
|
|
|
|
inline
|
|
WORD Header::isReplyTo(const String &stringLine)const
|
|
{
|
|
return (!::strncmp(stringLine,"Reply-To: ",10)?TRUE:FALSE);
|
|
}
|
|
|
|
inline
|
|
WORD Header::isNNTPPostingHost(const String &stringLine)const
|
|
{
|
|
return (!::strncmp(stringLine,"NNTP-Posting-Host",17)?TRUE:FALSE);
|
|
}
|
|
|
|
inline
|
|
WORD Header::isNewsReader(const String &stringLine)const
|
|
{
|
|
return (!::strncmp(stringLine,"X-Newsreader: ",14)?TRUE:FALSE);
|
|
}
|
|
|
|
inline
|
|
WORD Header::isCrossReference(const String &stringLine)const
|
|
{
|
|
return (!::strncmp(stringLine,"Xref: ",6)?TRUE:FALSE);
|
|
}
|
|
|
|
inline
|
|
WORD Header::isContentType(const String &stringLine)const
|
|
{
|
|
return (!::strncmp(stringLine,"Content-Type: ",14)?TRUE:FALSE);
|
|
}
|
|
|
|
inline
|
|
WORD Header::isMailer(const String &stringLine)const
|
|
{
|
|
return (!::strncmp(stringLine,"X-Mailer: ",10)?TRUE:FALSE);
|
|
}
|
|
#endif
|
|
|
|
|