basic charlist

This commit is contained in:
Eduardo Bart
2011-08-26 15:00:22 -03:00
parent b58a1aa7d4
commit c60b677baa
13 changed files with 120 additions and 24 deletions

View File

@@ -7,6 +7,7 @@
#include <sstream>
#include <exception>
#include <cxxabi.h>
#include "types.h"
namespace fw {
@@ -227,6 +228,12 @@ inline unsigned int hex2dec(const std::string& str) {
return num;
}
inline std::string ip2str(uint32 ip) {
char host[16];
sprintf(host, "%d.%d.%d.%d", (uint8)ip, (uint8)(ip >> 8), (uint8)(ip >> 16), (uint8)(ip >> 24));
return std::string(host);
}
// an empty string to use anywhere needed
const static std::string empty_string;