X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2Fstlplus%2Fstrings%2Fstring_address.cpp;fp=src%2Fstlplus%2Fstrings%2Fstring_address.cpp;h=74315e0460cef15f86fba575feb5ccde44efdf20;hp=0000000000000000000000000000000000000000;hb=6b0a0d0efafe34d48ab344fca3b479553bd4e62c;hpb=85783316365181491a3e3c0c63659972477cebba diff --git a/src/stlplus/strings/string_address.cpp b/src/stlplus/strings/string_address.cpp new file mode 100644 index 0000000..74315e0 --- /dev/null +++ b/src/stlplus/strings/string_address.cpp @@ -0,0 +1,36 @@ +//////////////////////////////////////////////////////////////////////////////// + +// Author: Andy Rushton +// Copyright: (c) Southampton University 1999-2004 +// (c) Andy Rushton 2004-2009 +// License: BSD License, see ../docs/license.html + +// use the unsigned long representation for pointers + +//////////////////////////////////////////////////////////////////////////////// +#include "string_address.hpp" +#include "string_int.hpp" +//////////////////////////////////////////////////////////////////////////////// + +namespace stlplus +{ + + //////////////////////////////////////////////////////////////////////////////// + + std::string address_to_string(const void* i, unsigned radix, radix_display_t display, unsigned width) + throw(std::invalid_argument) + { + return unsigned_long_to_string((unsigned long)i, radix, display, width); + } + + //////////////////////////////////////////////////////////////////////////////// + + void* string_to_address(const std::string& str, unsigned radix) + throw(std::invalid_argument) + { + return (void*)string_to_unsigned_long(str, radix); + } + + //////////////////////////////////////////////////////////////////////////////// + +} // end namespace stlplus