aboutsummaryrefslogtreecommitdiff
path: root/src/PubsubKey.cpp
blob: dd807cedba82523e3cef34f543e291b4e6445f56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "../include/sibs/PubsubKey.hpp"

namespace sibs
{
    PubsubKey::PubsubKey() : 
        data({})
    {
        
    }
    
    PubsubKey::PubsubKey(const void *data, const usize size)
    {
        std::copy((char*)data, (char*)data + std::min(size, PUBSUB_KEY_LENGTH), this->data.begin());
        if(size < PUBSUB_KEY_LENGTH)
            std::fill_n((char*)data + size, PUBSUB_KEY_LENGTH - size, 0);
    }
    
    bool PubsubKey::operator == (const PubsubKey &other) const
    {
        return data == other.data;
    }
    
    bool PubsubKey::operator != (const PubsubKey &other) const
    {
        return data != other.data;
    }
}