From 688813fbf58a22bee997a09c2a9146a045803ec1 Mon Sep 17 00:00:00 2001 From: csoler Date: Fri, 28 Apr 2017 18:51:35 +0200 Subject: [PATCH] moved photo items to rsitems/ --- libretroshare/src/libretroshare.pro | 4 +-- libretroshare/src/retroshare/rsphoto.h | 2 +- .../{serialiser => rsitems}/rsphotoitems.cc | 8 +++--- .../{serialiser => rsitems}/rsphotoitems.h | 0 libretroshare/src/serialiser/rstlvbinary.cc | 28 +++++++++++++++++++ libretroshare/src/serialiser/rstlvbinary.h | 2 ++ libretroshare/src/services/p3photoservice.cc | 2 +- 7 files changed, 38 insertions(+), 8 deletions(-) rename libretroshare/src/{serialiser => rsitems}/rsphotoitems.cc (99%) rename libretroshare/src/{serialiser => rsitems}/rsphotoitems.h (100%) diff --git a/libretroshare/src/libretroshare.pro b/libretroshare/src/libretroshare.pro index a72b2d246..60fad8f7b 100644 --- a/libretroshare/src/libretroshare.pro +++ b/libretroshare/src/libretroshare.pro @@ -851,10 +851,10 @@ gxsphotoshare { #Photo Service HEADERS += services/p3photoservice.h \ retroshare/rsphoto.h \ - serialiser/rsphotoitems.h \ + rsitems/rsphotoitems.h \ SOURCES += services/p3photoservice.cc \ - serialiser/rsphotoitems.cc \ + rsitems/rsphotoitems.cc \ } diff --git a/libretroshare/src/retroshare/rsphoto.h b/libretroshare/src/retroshare/rsphoto.h index 7d3c1ae09..5a27a491b 100644 --- a/libretroshare/src/retroshare/rsphoto.h +++ b/libretroshare/src/retroshare/rsphoto.h @@ -52,7 +52,7 @@ class RsPhotoThumbnail // Holds Thumbnail image. uint8_t *data; - int size; + uint32_t size; std::string type; }; diff --git a/libretroshare/src/serialiser/rsphotoitems.cc b/libretroshare/src/rsitems/rsphotoitems.cc similarity index 99% rename from libretroshare/src/serialiser/rsphotoitems.cc rename to libretroshare/src/rsitems/rsphotoitems.cc index 6971793d1..e2f3c279a 100644 --- a/libretroshare/src/serialiser/rsphotoitems.cc +++ b/libretroshare/src/rsitems/rsphotoitems.cc @@ -25,15 +25,15 @@ #include -#include "serialiser/rsphotoitems.h" -#include "serialiser/rstlvbase.h" +#include "rsitems/rsphotoitems.h" + #include "serialiser/rstlvbinary.h" -#include "serialiser/rsbaseserial.h" +#include "serialization/rstypeserializer.h" #define GXS_PHOTO_SERIAL_DEBUG -virtual RsItem *create_item(uint16_t service, uint8_t item_sub_id) const +RsItem *RsGxsPhotoSerialiser::create_item(uint16_t service, uint8_t item_sub_id) const { if(service != RS_SERVICE_GXS_TYPE_PHOTO) return NULL ; diff --git a/libretroshare/src/serialiser/rsphotoitems.h b/libretroshare/src/rsitems/rsphotoitems.h similarity index 100% rename from libretroshare/src/serialiser/rsphotoitems.h rename to libretroshare/src/rsitems/rsphotoitems.h diff --git a/libretroshare/src/serialiser/rstlvbinary.cc b/libretroshare/src/serialiser/rstlvbinary.cc index 258da0d9a..7eaa58ae2 100644 --- a/libretroshare/src/serialiser/rstlvbinary.cc +++ b/libretroshare/src/serialiser/rstlvbinary.cc @@ -188,6 +188,34 @@ bool RsTlvBinaryData::GetTlv(void *data, uint32_t size, uint32_t *offset) return ok; } +std::ostream &RsTlvBinaryDataRef::print(std::ostream &out, uint16_t indent) const +{ + uint16_t int_Indent = indent + 2; + + uint32_t i; + std::ostringstream sout; + printIndent(sout, indent); + sout << "RsTlvBinaryData: Type: " << tlvtype << " Size: " << mSizeRef; + sout << std::hex; + + for(i = 0; i < mSizeRef; i++) + { + if (i % 16 == 0) + { + sout << std::endl; + printIndent(sout, int_Indent); + } + sout << std::setw(2) << std::setfill('0') + << (int) (((unsigned char *) mDataRef)[i]) << ":"; + } + + sout << std::endl; + out << sout.str(); + + printEnd(out, "RsTlvBinaryData", indent); + return out; + +} std::ostream &RsTlvBinaryData::print(std::ostream &out, uint16_t indent) const { diff --git a/libretroshare/src/serialiser/rstlvbinary.h b/libretroshare/src/serialiser/rstlvbinary.h index 49a5d00f3..a22269e0f 100644 --- a/libretroshare/src/serialiser/rstlvbinary.h +++ b/libretroshare/src/serialiser/rstlvbinary.h @@ -72,6 +72,8 @@ public: RsTlvBinaryDataRef(uint16_t type,uint8_t *& data_ref,uint32_t& size_ref) : mDataRef(data_ref),mSizeRef(size_ref),tlvtype(type) {} virtual ~RsTlvBinaryDataRef() {} + virtual std::ostream &print(std::ostream &out, uint16_t indent) const; + virtual uint32_t TlvSize() const; virtual void TlvClear(){} virtual bool SetTlv(void *data, uint32_t size, uint32_t *offset) const; diff --git a/libretroshare/src/services/p3photoservice.cc b/libretroshare/src/services/p3photoservice.cc index 759f5ad18..519f10c68 100644 --- a/libretroshare/src/services/p3photoservice.cc +++ b/libretroshare/src/services/p3photoservice.cc @@ -1,5 +1,5 @@ #include "p3photoservice.h" -#include "serialiser/rsphotoitems.h" +#include "rsitems/rsphotoitems.h" #include "retroshare/rsgxsflags.h" RsPhoto *rsPhoto = NULL;