00001 /* 00002 Copyright (C) 2000,2001 Stefan Duffner 00003 00004 This program is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU General Public License 00006 as published by the Free Software Foundation; either version 2 00007 of the License, or any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program; if not, write to the Free Software 00016 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 */ 00018 00019 #ifndef IOINFOASCII_H 00020 #define IOINFOASCII_H 00021 00022 #include "IOInfo.h" 00023 00024 class IOInfoBin; 00025 00031 class IOInfoASCII : public IOInfo 00032 { 00033 public: 00034 IOInfoASCII(); 00035 IOInfoASCII(char ); 00036 IOInfoASCII(QString ); 00037 ~IOInfoASCII(); 00038 00039 QString convertToString(); 00040 QString convertToBinStr(); 00041 QString convertToHexStr(); 00042 bool convertToASCII(char* ascii, int maxlen, int& length, bool singlechar=FALSE) const; 00043 IOInfoBin convertToBin(int numbits) const; 00044 int convertToInt(); 00045 void convertToBinList(IOInfoList& list); 00046 00047 int getLength() const { return info.length()*8; } ; 00048 // bool matches(IOInfo* ); 00049 bool matchesOld(IOInfo* ); 00050 bool isSingle(); 00051 00053 QString getInfo() { return info; }; 00055 void setInfo(QString i) { info = i.stripWhiteSpace(); }; 00056 void setBin(QString bin, int numbits); 00057 void setASCII(const char* ascii, int asciilen, int numbits); 00058 void setString(QString string, int numbits); 00059 00060 static char escapeToChar(char ); 00061 static bool isReadable(char ); 00062 static int findChar(const char* ascii, int len, char c); 00063 00064 QList<IOInfo> getSingles(); 00065 00066 IOInfo* clone(); 00067 void split(IOInfoList& ); 00068 00069 private: 00071 QString info; 00072 }; 00073 00074 #endif 00075