150 lines
2.9 KiB
C++
150 lines
2.9 KiB
C++
#ifndef _NNTP_GROUPITEM_HPP_
|
|
#define _NNTP_GROUPITEM_HPP_
|
|
#ifndef _COMMON_WINDOWS_HPP_
|
|
#include <common/windows.hpp>
|
|
#endif
|
|
#ifndef _COMMON_STRING_HPP_
|
|
#include <common/string.hpp>
|
|
#endif
|
|
|
|
class GroupItem
|
|
{
|
|
public:
|
|
GroupItem(void);
|
|
GroupItem(const GroupItem &someGroupItem);
|
|
GroupItem(const String &newsGroup);
|
|
virtual ~GroupItem();
|
|
GroupItem &operator=(const GroupItem &someGroupItem);
|
|
GroupItem &operator<<(String lineString);
|
|
DWORD articlesInGroup(void)const;
|
|
void articlesInGroup(DWORD articlesInGroup);
|
|
DWORD firstArticle(void)const;
|
|
void firstArticle(DWORD firstArticle);
|
|
DWORD lastArticle(void)const;
|
|
void lastArticle(DWORD lastArticle);
|
|
const String &groupName(void)const;
|
|
void groupName(const String &groupName);
|
|
String toString(void)const;
|
|
private:
|
|
DWORD mArticlesInGroup;
|
|
DWORD mFirstArticle;
|
|
DWORD mLastArticle;
|
|
String mGroupName;
|
|
};
|
|
|
|
inline
|
|
GroupItem::GroupItem(void)
|
|
: mArticlesInGroup(0), mFirstArticle(0), mLastArticle(0)
|
|
{
|
|
}
|
|
|
|
inline
|
|
GroupItem::GroupItem(const String &newsGroup)
|
|
: mGroupName(newsGroup), mArticlesInGroup(0), mFirstArticle(0), mLastArticle(0)
|
|
{
|
|
}
|
|
|
|
inline
|
|
GroupItem::GroupItem(const GroupItem &someGroupItem)
|
|
{
|
|
*this=someGroupItem;
|
|
}
|
|
|
|
inline
|
|
GroupItem::~GroupItem()
|
|
{
|
|
}
|
|
|
|
inline
|
|
GroupItem &GroupItem::operator=(const GroupItem &someGroupItem)
|
|
{
|
|
articlesInGroup(someGroupItem.articlesInGroup());
|
|
firstArticle(someGroupItem.firstArticle());
|
|
lastArticle(someGroupItem.lastArticle());
|
|
groupName(someGroupItem.groupName());
|
|
return *this;
|
|
}
|
|
|
|
inline
|
|
GroupItem &GroupItem::operator<<(String lineString)
|
|
{
|
|
char *strPtr=(LPSTR)lineString;
|
|
|
|
strPtr=::strtok(strPtr," ");
|
|
if(!strPtr)return *this;
|
|
strPtr=::strtok(0," ");
|
|
if(!strPtr)return *this;
|
|
articlesInGroup(::atoi(strPtr));
|
|
strPtr=::strtok(0," ");
|
|
if(!strPtr)return *this;
|
|
firstArticle(::atoi(strPtr));
|
|
strPtr=::strtok(0," ");
|
|
if(!strPtr)return *this;
|
|
lastArticle(::atoi(strPtr));
|
|
strPtr=::strtok(0,"\0");
|
|
if(!strPtr)return *this;
|
|
groupName(strPtr);
|
|
return *this;
|
|
}
|
|
|
|
inline
|
|
DWORD GroupItem::articlesInGroup(void)const
|
|
{
|
|
return mArticlesInGroup;
|
|
}
|
|
|
|
inline
|
|
void GroupItem::articlesInGroup(DWORD articlesInGroup)
|
|
{
|
|
mArticlesInGroup=articlesInGroup;
|
|
}
|
|
|
|
inline
|
|
DWORD GroupItem::firstArticle(void)const
|
|
{
|
|
return mFirstArticle;
|
|
}
|
|
|
|
inline
|
|
void GroupItem::firstArticle(DWORD firstArticle)
|
|
{
|
|
mFirstArticle=firstArticle;
|
|
}
|
|
|
|
inline
|
|
DWORD GroupItem::lastArticle(void)const
|
|
{
|
|
return mLastArticle;
|
|
}
|
|
|
|
inline
|
|
void GroupItem::lastArticle(DWORD lastArticle)
|
|
{
|
|
mLastArticle=lastArticle;
|
|
}
|
|
|
|
inline
|
|
const String &GroupItem::groupName(void)const
|
|
{
|
|
return mGroupName;
|
|
}
|
|
|
|
inline
|
|
void GroupItem::groupName(const String &groupName)
|
|
{
|
|
mGroupName=groupName;
|
|
}
|
|
|
|
inline
|
|
String GroupItem::toString(void)const
|
|
{
|
|
String strItem;
|
|
String space(" ");
|
|
|
|
strItem=String().fromInt(mArticlesInGroup)+space;
|
|
strItem+=String().fromInt(mFirstArticle)+space;
|
|
strItem+=String().fromInt(mLastArticle)+space;
|
|
strItem+=mGroupName;
|
|
return strItem;
|
|
}
|
|
#endif |