ROSE  0.9.9.139
DataConversion.h
1 #ifndef ROSE_DATA_CONVERSION_H
2 #define ROSE_DATA_CONVERSION_H
3 
4 #include <string>
5 
9 class DataConverter {
10 public:
11  virtual ~DataConverter() {}
12 
14  virtual std::string name() const = 0;
15 
19  virtual uint8_t* encode(uint8_t* buffer, size_t* nbytes) = 0;
20 
24  virtual uint8_t* decode(uint8_t* buffer, size_t* nbytes) = 0;
25 };
26 
28 class Rot13: public DataConverter {
29  virtual ~Rot13() {}
30  virtual std::string name() const {return "ROT-13";}
31  virtual uint8_t* encode(uint8_t* buffer, size_t* nbytes);
32  virtual uint8_t* decode(uint8_t* buffer, size_t* nbytes);
33 };
34 
35 #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.
Definition: DataConversion.h:9