mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-14 09:05:48 -04:00
added explicit converter between ID types of same size
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.6-IdCleaning@7170 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
97ac7f85f7
commit
918dc150f4
1 changed files with 12 additions and 0 deletions
|
@ -53,6 +53,18 @@ template<uint32_t ID_SIZE_IN_BYTES,bool UPPER_CASE,uint32_t UNIQUE_IDENTIFIER> c
|
||||||
//
|
//
|
||||||
explicit t_RsGenericIdType(const unsigned char bytes[]) ;
|
explicit t_RsGenericIdType(const unsigned char bytes[]) ;
|
||||||
|
|
||||||
|
// Explicit constructor from a different type, checking that the sizes are compatible.
|
||||||
|
// This is used for conversions such as
|
||||||
|
//
|
||||||
|
// GroupId -> CircleId
|
||||||
|
// GroupId -> GxsId
|
||||||
|
//
|
||||||
|
template<bool UPPER_CASE2,uint32_t UNIQUE_IDENTIFIER2>
|
||||||
|
explicit t_RsGenericIdType(const t_RsGenericIdType<ID_SIZE_IN_BYTES,UPPER_CASE2,UNIQUE_IDENTIFIER2>& id)
|
||||||
|
{
|
||||||
|
memcpy(bytes,id.toByteArray(),ID_SIZE_IN_BYTES) ;
|
||||||
|
}
|
||||||
|
|
||||||
// Random initialization. Can be useful for testing.
|
// Random initialization. Can be useful for testing.
|
||||||
//
|
//
|
||||||
static t_RsGenericIdType<ID_SIZE_IN_BYTES,UPPER_CASE,UNIQUE_IDENTIFIER> random()
|
static t_RsGenericIdType<ID_SIZE_IN_BYTES,UPPER_CASE,UNIQUE_IDENTIFIER> random()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue