00001 /*************************************************************************** 00002 $RCSfile: ctmisc.h,v $ 00003 ------------------- 00004 cvs : $Id: ctmisc.h,v 1.4 2003/04/24 01:43:28 aquamaniac Exp $ 00005 begin : Fri May 31 2002 00006 copyright : (C) 2001 by Martin Preuss 00007 email : martin@libchipcard.de 00008 00009 *************************************************************************** 00010 * * 00011 * This library is free software; you can redistribute it and/or * 00012 * modify it under the terms of the GNU Lesser General Public * 00013 * License as published by the Free Software Foundation; either * 00014 * version 2.1 of the License, or (at your option) any later version. * 00015 * * 00016 * This library is distributed in the hope that it will be useful, * 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00019 * Lesser General Public License for more details. * 00020 * * 00021 * You should have received a copy of the GNU Lesser General Public * 00022 * License along with this library; if not, write to the Free Software * 00023 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * 00024 * MA 02111-1307 USA * 00025 * * 00026 ***************************************************************************/ 00027 00028 /* 00029 Changes 00030 00031 */ 00032 00033 00034 #ifndef CTMISC_H 00035 #define CTMISC_H 00036 00037 class CTMisc; 00038 00039 #include <string> 00040 00041 using namespace std; 00042 00048 class CHIPCARD_API CTMisc { 00049 public: 00050 CHIPCARD_API static string num2string(int n, const string &format="%d"); 00051 CHIPCARD_API static int string2num(const string &n, const string &format="%d"); 00052 CHIPCARD_API static bool compare(const string &s1, const string &s2); 00053 CHIPCARD_API static unsigned int bsd2int(unsigned char c); 00054 CHIPCARD_API static string bsd2string(unsigned char c); 00055 CHIPCARD_API static string bsd2string(const string &s); 00056 CHIPCARD_API static string string2bsd(const string &s); 00057 CHIPCARD_API static void removeBlanks(string &s); 00058 CHIPCARD_API static string bin2hex(const string &s, int groups=0); 00059 CHIPCARD_API static string hex2bin(const string &s); 00060 00061 }; 00062 00063 00064 00065 00066 #endif 00067 00068 00069 00070 00071 00072 00073