ROSE  0.11.2.0
DataConversion.h
1 #ifndef ROSE_DATA_CONVERSION_H
2 #define ROSE_DATA_CONVERSION_H
3 
4 #include <rosePublicConfig.h>
5 #ifdef ROSE_BUILD_BINARY_ANALYSIS_SUPPORT
6 
7 #include <string>
8 
13 public:
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 
31 class 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
The ROT-13 algorithm, extended to operate over the entire 8-bit domain/range.
virtual uint8_t * encode(uint8_t *buffer, size_t *nbytes)=0
Encodes a buffer.
virtual std::string name() const =0
Name of the converter, mostly for debugging purposes.
virtual uint8_t * decode(uint8_t *buffer, size_t *nbytes)=0
Decodes a buffer.
Encodes and decodes a buffer using an algorithm defined in subclasses.