mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-08 17:15:16 -04:00
Implementation of GxsId Opinion, and start of Reputation system.
- Removed old reputation system from p3idservice - Removed old Msg types as well (no longer needed) - Added real submitOpinion() - Modified serviceString to support Reputation System. - Added reputation information to both Cached Data, and Standard ID Data. - Added basics of new reputation system as alternative service. (not gxs). - Added Generic TLV types for maps. - Moved configuration files to their own directory .rs/config/ - Finally, fixed up bits missed from the change to updateGroup! git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7131 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
9a4c696688
commit
1b2ed66814
33 changed files with 2046 additions and 916 deletions
100
libretroshare/src/serialiser/rstlvgenericmap.h
Normal file
100
libretroshare/src/serialiser/rstlvgenericmap.h
Normal file
|
@ -0,0 +1,100 @@
|
|||
#ifndef RS_TLV_GENERIC_MAP_H
|
||||
#define RS_TLV_GENERIC_MAP_H
|
||||
|
||||
/*
|
||||
* libretroshare/src/serialiser: rstlvgenericmap.h
|
||||
*
|
||||
* RetroShare Serialiser.
|
||||
*
|
||||
* Copyright 2014 by Robert Fernie
|
||||
*
|
||||
* 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 "serialiser/rstlvtypes.h"
|
||||
#include <map>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
/**** TLV *****
|
||||
* Generic Parameters / Maps.
|
||||
*/
|
||||
|
||||
|
||||
template<class T>
|
||||
class RsTlvParamRef: public RsTlvItem
|
||||
{
|
||||
public:
|
||||
RsTlvParamRef(T &p): mParam(p) {}
|
||||
virtual ~RsTlvParamRef() { return; }
|
||||
virtual uint32_t TlvSize();
|
||||
virtual void TlvClear();
|
||||
virtual bool SetTlv(void *data, uint32_t size, uint32_t *offset); /* serialise */
|
||||
virtual bool GetTlv(void *data, uint32_t size, uint32_t *offset); /* deserialise */
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent);
|
||||
|
||||
T &mParam;
|
||||
};
|
||||
|
||||
|
||||
/*********************************** RsTlvGenericPairRef ***********************************/
|
||||
|
||||
template<class K, class V>
|
||||
class RsTlvGenericPairRef: public RsTlvItem
|
||||
{
|
||||
public:
|
||||
RsTlvGenericPairRef(uint16_t pair_type, K &k, V &v)
|
||||
:mPairType(pair_type), mKey(k), mValue(v) { return; }
|
||||
virtual ~RsTlvGenericPairRef() { return; }
|
||||
virtual uint32_t TlvSize();
|
||||
virtual void TlvClear();
|
||||
virtual bool SetTlv(void *data, uint32_t size, uint32_t *offset); /* serialise */
|
||||
virtual bool GetTlv(void *data, uint32_t size, uint32_t *offset); /* deserialise */
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent);
|
||||
|
||||
uint16_t mPairType;
|
||||
K &mKey;
|
||||
V &mValue;
|
||||
};
|
||||
|
||||
|
||||
/************************************ RsTlvGenericMapRef ***********************************/
|
||||
|
||||
template<class K, class V>
|
||||
class RsTlvGenericMapRef: public RsTlvItem
|
||||
{
|
||||
public:
|
||||
RsTlvGenericMapRef(uint16_t map_type, uint16_t pair_type, std::map<K, V> &refmap)
|
||||
:mMapType(map_type), mPairType(pair_type), mRefMap(refmap) { return; }
|
||||
virtual ~RsTlvGenericMapRef() { return; }
|
||||
virtual uint32_t TlvSize();
|
||||
virtual void TlvClear();
|
||||
virtual bool SetTlv(void *data, uint32_t size, uint32_t *offset); /* serialise */
|
||||
virtual bool GetTlv(void *data, uint32_t size, uint32_t *offset); /* deserialise */
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent);
|
||||
|
||||
uint16_t mMapType;
|
||||
uint16_t mPairType;
|
||||
std::map<K, V> &mRefMap;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue