moved rsposteditems to rsitems/

This commit is contained in:
csoler 2017-04-27 14:44:41 +02:00
parent 35ecc19677
commit 349d14b354
4 changed files with 4 additions and 4 deletions

View file

@ -0,0 +1,63 @@
/*
* libretroshare/src/gxs: rsopsteditems.cc
*
* RetroShare Serialiser.
*
* Copyright 2012-2013 by Robert Fernie, Christopher Evi-Parker
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License Version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems to "retroshare@lunamutt.com".
*
*/
#include "rsitems/rsposteditems.h"
#include "serialization/rstypeserializer.h"
void RsGxsPostedPostItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
{
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_LINK,mPost.mLink,"mPost.mLink") ;
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_MSG ,mPost.mNotes,"mPost.mNotes") ;
}
void RsGxsPostedGroupItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
{
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_DESCR ,mGroup.mDescription,"mGroup.mDescription") ;
}
RsItem *RsGxsPostedSerialiser::create_item(uint16_t service_id,uint8_t item_subtype) const
{
if(service_id != RS_SERVICE_GXS_TYPE_POSTED)
return NULL ;
switch(item_subtype)
{
case RS_PKT_SUBTYPE_POSTED_GRP_ITEM: return new RsGxsPostedGroupItem() ;
case RS_PKT_SUBTYPE_POSTED_POST_ITEM: return new RsGxsPostedPostItem() ;
default:
return RsGxsCommentSerialiser::create_item(service_id,item_subtype) ;
}
}
void RsGxsPostedPostItem::clear()
{
mPost.mLink.clear();
mPost.mNotes.clear();
}
void RsGxsPostedGroupItem::clear()
{
mGroup.mDescription.clear();
}

View file

@ -0,0 +1,49 @@
#ifndef RSPOSTEDITEMS_H
#define RSPOSTEDITEMS_H
#include "rsitems/rsserviceids.h"
#include "rsitems/rsgxscommentitems.h"
#include "rsitems/rsgxsitems.h"
#include "retroshare/rsposted.h"
const uint8_t RS_PKT_SUBTYPE_POSTED_GRP_ITEM = 0x02;
const uint8_t RS_PKT_SUBTYPE_POSTED_POST_ITEM = 0x03;
class RsGxsPostedGroupItem : public RsGxsGrpItem
{
public:
RsGxsPostedGroupItem() : RsGxsGrpItem(RS_SERVICE_GXS_TYPE_POSTED, RS_PKT_SUBTYPE_POSTED_GRP_ITEM) {}
virtual ~RsGxsPostedGroupItem() {}
void clear();
virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx);
RsPostedGroup mGroup;
};
class RsGxsPostedPostItem : public RsGxsMsgItem
{
public:
RsGxsPostedPostItem() : RsGxsMsgItem(RS_SERVICE_GXS_TYPE_POSTED, RS_PKT_SUBTYPE_POSTED_POST_ITEM) {}
virtual ~RsGxsPostedPostItem() {}
void clear();
virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx);
RsPostedPost mPost;
};
class RsGxsPostedSerialiser : public RsGxsCommentSerialiser
{
public:
RsGxsPostedSerialiser() :RsGxsCommentSerialiser(RS_SERVICE_GXS_TYPE_POSTED) {}
virtual ~RsGxsPostedSerialiser() {}
virtual RsItem *create_item(uint16_t service_id,uint8_t item_subtype) const ;
};
#endif // RSPOSTEDITEMS_H