aboutsummaryrefslogtreecommitdiff
path: root/src/storage.cc
diff options
context:
space:
mode:
authorschnetter <schnetter@83718e91-0e4f-0410-abf4-91180603181f>2005-05-27 10:49:27 +0000
committerschnetter <schnetter@83718e91-0e4f-0410-abf4-91180603181f>2005-05-27 10:49:27 +0000
commitf7e4d7ae9de31669bcb700e02bba9e71c4c959e5 (patch)
tree6f9c455fca76e17a7750cb13b4b46616e0288f50 /src/storage.cc
parent3c42753983e5094afabe023e956ca30417e5d7df (diff)
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
Diffstat (limited to 'src/storage.cc')
-rw-r--r--src/storage.cc77
1 files changed, 77 insertions, 0 deletions
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 <sstream>
+
+#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 << "<key>" << clean (keybuf.str()) << "</key> "
+ << "<value>" << clean (valuebuf.str()) << "</value>\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 << "<key>" << clean (keybuf.str()) << "</key> "
+ << "<value>" << clean (valuebuf.str()) << "</value>\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 << "<langle>"; break;
+ case '>': buf << "<rangle>"; break;
+// case '"': buf << "<quote>"; break;
+// case '\\': buf << "<backslash>"; break;
+ default: buf << * p;
+ }
+ }
+
+ return buf.str();
+}