ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/Represent/Hexadecimal.hpp
Revision: 379
Committed: 2004-12-22T20:42:52-08:00 (20 years, 6 months ago) by douglas
File size: 801 byte(s)
Log Message:
Moving right along!

File Contents

# User Rev Content
1 douglas 371 // Represent
2     //
3     // Douglas Thrift
4     //
5     // $Id$
6    
7     #ifndef _Hexadecimal_hpp_
8     #define _Hexadecimal_hpp_
9    
10     #include "Binary.hpp"
11    
12     #ifdef MENES_PRAGMA_ONCE
13     #pragma once
14     #endif
15    
16     class Hexadecimal : public Binary
17     {
18     private:
19 douglas 373 byte_t hex(const ext::CodePoint& atom);
20 douglas 371 public:
21     Hexadecimal() : Binary() {}
22     Hexadecimal(const Binary& binary) : Binary(binary) {}
23     Hexadecimal(const ext::String& string, bool signed_);
24     template <typename Type> Hexadecimal(const Type& type) : Binary(type) {}
25     virtual operator ext::String() const;
26     };
27    
28 douglas 379 inline byte_t Hexadecimal::hex(const ext::CodePoint& atom)
29     {
30     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;
31     }
32    
33 douglas 371 #endif // _Hexadecimal_hpp_

Properties

Name Value
svn:eol-style native
svn:keywords Id