ROSE 0.11.145.192
DataConversion.h
1#ifndef ROSE_DATA_CONVERSION_H
2#define ROSE_DATA_CONVERSION_H
3
4#include <featureTests.h>
5#ifdef ROSE_ENABLE_BINARY_ANALYSIS
6
7#include <string>
8
13public:
14 virtual ~DataConverter() {}
15
17 virtual std::string name() const = 0;
18
22 virtual uint8_t* encode(uint8_t* buffer, size_t* nbytes) = 0;
23
27 virtual uint8_t* decode(uint8_t* buffer, size_t* nbytes) = 0;
28};
29
31class Rot13: public DataConverter {
32 virtual ~Rot13() {}
33 virtual std::string name() const {return "ROT-13";}
34 virtual uint8_t* encode(uint8_t* buffer, size_t* nbytes);
35 virtual uint8_t* decode(uint8_t* buffer, size_t* nbytes);
36};
37
38#endif
39#endif
Encodes and decodes a buffer using an algorithm defined in subclasses.
virtual uint8_t * encode(uint8_t *buffer, size_t *nbytes)=0
Encodes a buffer.
virtual uint8_t * decode(uint8_t *buffer, size_t *nbytes)=0
Decodes a buffer.
virtual std::string name() const =0
Name of the converter, mostly for debugging purposes.
The ROT-13 algorithm, extended to operate over the entire 8-bit domain/range.