From f7e4d7ae9de31669bcb700e02bba9e71c4c959e5 Mon Sep 17 00:00:00 2001 From: schnetter Date: Fri, 27 May 2005 10:49:27 +0000 Subject: Store the source tarballs into a subdirectory to remove clutter. Restructure the announcing code so that there can be multiple announce targets. "Announce" to a file in the output directory by default. Also announce the list of active thorns and all parameter values. git-svn-id: http://svn.cactuscode.org/arrangements/CactusUtils/Formaline/trunk@14 83718e91-0e4f-0410-abf4-91180603181f --- src/storage.cc | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 src/storage.cc (limited to 'src/storage.cc') diff --git a/src/storage.cc b/src/storage.cc new file mode 100644 index 0000000..b4f6cd4 --- /dev/null +++ b/src/storage.cc @@ -0,0 +1,77 @@ +// $Header$ + +#include + +#include "storage.hh" + +using namespace std; + + + +storage:: +~ storage () +{ +} + + + +void storage:: +store (char const * const key, + int const value) +{ + assert (key); + + ostringstream keybuf; + keybuf << key; + ostringstream valuebuf; + valuebuf << value; + + ostringstream buf; + buf << "" << clean (keybuf.str()) << " " + << "" << clean (valuebuf.str()) << "\n"; + + write (buf.str()); +} + + + +void storage:: +store (char const * const key, + char const * const value) +{ + assert (key); + + ostringstream keybuf; + keybuf << key; + ostringstream valuebuf; + valuebuf << value; + + ostringstream buf; + buf << "" << clean (keybuf.str()) << " " + << "" << clean (valuebuf.str()) << "\n"; + + write (buf.str()); +} + + + +string storage:: +clean (string const & txt) + const +{ + ostringstream buf; + + for (string::const_iterator p = txt.begin(); p != txt.end(); ++ p) + { + switch (* p) + { + case '<': buf << ""; break; + case '>': buf << ""; break; +// case '"': buf << ""; break; +// case '\\': buf << ""; break; + default: buf << * p; + } + } + + return buf.str(); +} -- cgit v1.2.3