mirnor refactor
This commit is contained in:
@@ -14,62 +14,6 @@
|
||||
//#include <algorithm>
|
||||
#include <array>
|
||||
|
||||
struct _GroupKey {
|
||||
std::array<uint8_t, TOX_GROUP_CHAT_ID_SIZE> data;
|
||||
|
||||
_GroupKey(void) = default;
|
||||
_GroupKey(const _GroupKey& other) : data(other.data) {}
|
||||
_GroupKey(_GroupKey&&) = delete;
|
||||
|
||||
bool operator<(const _GroupKey& rhs) const {
|
||||
for (size_t i = 0; i < data.size(); i++) {
|
||||
if (data[i] < rhs.data[i]) {
|
||||
return true;
|
||||
} else if (data[i] > rhs.data[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false; // equal
|
||||
}
|
||||
|
||||
bool operator==(const _GroupKey& rhs) const {
|
||||
for (size_t i = 0; i < data.size(); i++) {
|
||||
if (data[i] != rhs.data[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
struct _PeerKey {
|
||||
std::array<uint8_t, TOX_GROUP_PEER_PUBLIC_KEY_SIZE> data;
|
||||
|
||||
_PeerKey(void) = default;
|
||||
_PeerKey(const _PeerKey& other) : data(other.data) {}
|
||||
_PeerKey(_PeerKey&&) = delete;
|
||||
|
||||
bool operator<(const _PeerKey& rhs) const {
|
||||
for (size_t i = 0; i < data.size(); i++) {
|
||||
if (data[i] < rhs.data[i]) {
|
||||
return true;
|
||||
} else if (data[i] > rhs.data[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false; // equal
|
||||
}
|
||||
|
||||
bool operator==(const _PeerKey& rhs) const {
|
||||
for (size_t i = 0; i < data.size(); i++) {
|
||||
if (data[i] != rhs.data[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
enum _PacketType : uint8_t {
|
||||
// TODO: why?
|
||||
INVALID = 0u,
|
||||
@@ -151,6 +95,28 @@ static const char* _pkgid2str(_PacketType type) {
|
||||
#undef _EXT_CASE
|
||||
}
|
||||
|
||||
struct _GroupKey {
|
||||
std::array<uint8_t, TOX_GROUP_CHAT_ID_SIZE> data;
|
||||
|
||||
_GroupKey(void) = default;
|
||||
_GroupKey(const _GroupKey& other) : data(other.data) {}
|
||||
_GroupKey(_GroupKey&&) = delete;
|
||||
bool operator<(const _GroupKey& rhs) const;
|
||||
bool operator==(const _GroupKey& rhs) const;
|
||||
size_t size(void) const { return data.size(); }
|
||||
};
|
||||
|
||||
struct _PeerKey {
|
||||
std::array<uint8_t, TOX_GROUP_PEER_PUBLIC_KEY_SIZE> data;
|
||||
|
||||
_PeerKey(void) = default;
|
||||
_PeerKey(const _PeerKey& other) : data(other.data) {}
|
||||
_PeerKey(_PeerKey&&) = delete;
|
||||
bool operator<(const _PeerKey& rhs) const;
|
||||
bool operator==(const _PeerKey& rhs) const;
|
||||
size_t size(void) const { return data.size(); }
|
||||
};
|
||||
|
||||
using handle_group_custom_packet_cb = void(*)(
|
||||
Tox* tox,
|
||||
NGC_EXT_CTX* ngc_ext_ctx,
|
||||
|
||||
Reference in New Issue
Block a user