00001 /* ********* 00002 * 00003 * This file is part of: 00004 * NePSing, Network Protocol Simulator next generation 00005 * 00006 * Copyright (C) 2004 Tommaso Pecorella <tpecorella@mac.com> 00007 * 00008 * This library is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Lesser General Public 00010 * License as published by the Free Software Foundation; either 00011 * version 2.1 of the License, or (at your option) any later version. 00012 * 00013 * This library is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public 00019 * License along with this library; if not, write to the Free Software 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00021 * 00022 ********* */ 00023 00030 #ifndef __MISC_H__ 00031 #define __MISC_H__ 00032 00033 #include <iomanip> 00034 #include <iostream> 00035 #include <typeinfo> 00036 #include <string> 00037 #include <sstream> 00038 00039 using namespace std; //introduces namespace std 00040 00042 template<class T> string toString(T x) 00043 { 00044 ostringstream os(""); 00045 os << x; 00046 return string(os.str()); 00047 } 00048 00050 string replaceAll(string s, string f, string r); 00051 00053 template<class T> string className(T *p) 00054 { 00055 string name(typeid(*p).name()); 00056 00057 return name.substr(name.find_first_not_of("0123456789")); 00058 } 00059 00061 00066 unsigned long long int stringToULL( string A, 00067 int theRes 00068 ); 00069 00070 00071 #endif 00072