Files
BloomPatched/src/DebugServer/Gdb/Packet.hpp

47 lines
1.1 KiB
C++
Raw Normal View History

2021-04-04 21:04:12 +01:00
#pragma once
#include <vector>
#include <memory>
#include <numeric>
#include <QString>
#include <sstream>
#include <iomanip>
namespace DebugServer::Gdb
2021-04-04 21:04:12 +01:00
{
2022-10-01 21:01:37 +01:00
using RawPacket = std::vector<unsigned char>;
2021-04-04 21:04:12 +01:00
/**
* The Packet class implements the data structure for GDB RSP packets.
*
* Fore more information on the packet data structure, see https://sourceware.org/gdb/onlinedocs/gdb/Overview.html#Overview
*/
class Packet
{
public:
2022-10-01 21:01:37 +01:00
explicit Packet(const RawPacket& rawPacket) {
2021-04-04 21:04:12 +01:00
this->init(rawPacket);
}
2022-01-11 21:12:25 +00:00
Packet() = default;
virtual ~Packet() = default;
2021-04-04 21:04:12 +01:00
2022-01-11 21:12:25 +00:00
Packet(const Packet& other) = default;
Packet(Packet&& other) = default;
Packet& operator = (const Packet& other) = default;
Packet& operator = (Packet&& other) = default;
protected:
std::vector<unsigned char> data;
2022-10-01 21:01:37 +01:00
void init(const RawPacket& rawPacket) {
this->data.insert(
this->data.begin(),
rawPacket.begin() + 1,
rawPacket.end() - 3
);
}
2021-04-04 21:04:12 +01:00
};
}