d8ae572b | /* Copyright (C) CJ Affiliate * * You may use, distribute and modify this code under the * terms of the GNU General Public License version 2 or * later. * * You should have received a copy of the license with this * file. If not, you will find a copy in the "LICENSE" file * at https://github.com/cjdev/dual-control. */ #ifndef BASE32_H #define BASE32_H #include <memory> #include <vector> #include <string> |
f04cd01b | class invalid_data_exception : public std::exception { }; |
d8ae572b | class base32_ifc { public: |
83a56114 | virtual std::string encode (std::vector<uint8_t> input) const = 0; virtual std::vector<uint8_t> decode (std::string input) const = 0; |
d8ae572b | }; class base32 { public: using delegate = std::shared_ptr<base32_ifc>; private: delegate delegate_; public: base32 (); |
83a56114 | std::string encode (std::vector<uint8_t> input) const |
c28f345d | { return delegate_->encode (input); |
d8ae572b | }; |
83a56114 | std::vector<uint8_t> decode (std::string input) const |
c28f345d | { return delegate_->decode (input); |
d8ae572b | }; }; #endif |
0d8b9a17 |