// Represent // // Douglas Thrift // // $Id$ #ifndef _Hexadecimal_hpp_ #define _Hexadecimal_hpp_ #include "Binary.hpp" #ifdef MENES_PRAGMA_ONCE #pragma once #endif class Hexadecimal : public Binary { private: byte_t hex(const ext::CodePoint& atom); public: Hexadecimal() : Binary() {} Hexadecimal(const Binary& binary) : Binary(binary) {} Hexadecimal(const ext::String& string, bool signed_); template Hexadecimal(const Type& type) : Binary(type) {} virtual operator ext::String() const; }; inline byte_t Hexadecimal::hex(const ext::CodePoint& atom) { if (atom >= '0' && atom <= '9') return atom - '0'; else if (atom >= 'a' && atom <= 'f') return atom - 'a' + 0xA; else if (atom >= 'A' && atom <= 'F') return atom - 'A' + 0xA; else return 0; } #endif // _Hexadecimal_hpp_