00001 /* 00002 * $Id: Byte.h 562 2007-12-02 08:04:16Z mindstorm2600 $ 00003 * 00004 * X-VR2 00005 * 00006 * Copyright (C) Juan V. Guerrero 2007 00007 * 00008 * Juan V. Guerrero <mindstorm2600@users.sourceforge.net> 00009 * 00010 * This program is free software, distributed under the terms of 00011 * the GNU General Public License Version 2. See the LICENSE file 00012 * at the top of the source tree. 00013 */ 00014 #ifndef __XVR2_Byte_H__ 00015 #define __XVR2_Byte_H__ 00016 00017 #include<xvr2/System.h> 00018 #include<xvr2/String.h> 00019 #include<xvr2/CoreExceptions.h> 00020 00021 namespace xvr2{ 00037 class Byte:public System{ 00038 private: 00039 protected: 00041 UInt8 value; 00042 //String str_value; 00043 std::string *string_representation; 00044 public: 00046 Byte(); 00048 Byte(UInt8 v); 00054 Byte(const char *binary); 00058 Byte(const String &binary); 00059 ~Byte(); 00061 void setValue(UInt8 v = 0); 00063 void setValue(const char *binary); 00065 void setValue(const String &binary); 00067 UInt8 theByte(); 00069 UInt8 reversedByte(); 00071 void reverse(); 00073 bool bit0(); 00075 bool bit1(); 00077 bool bit2(); 00079 bool bit3(); 00081 bool bit4(); 00083 bool bit5(); 00085 bool bit6(); 00087 bool bit7(); 00090 //const String &toString(); 00091 std::string toString(); 00092 }; 00093 } 00094 00095 #endif