summaryrefslogtreecommitdiffstats
path: root/src/Forge.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2015-08-03 01:47:24 +0000
committerDavid Robillard <d@drobilla.net>2015-08-03 01:47:24 +0000
commit44af7b7b66e2083819103c760ab3bf4980469f86 (patch)
tree1c298f171bf564ae9dc9d763e8f1e057f495c1c1 /src/Forge.cpp
parenta9533c805ffe52017bf4382f436aafcde0c38911 (diff)
downloadingen-44af7b7b66e2083819103c760ab3bf4980469f86.tar.gz
ingen-44af7b7b66e2083819103c760ab3bf4980469f86.tar.bz2
ingen-44af7b7b66e2083819103c760ab3bf4980469f86.zip
Optional quoting for atom to string.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5702 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/Forge.cpp')
-rw-r--r--src/Forge.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/Forge.cpp b/src/Forge.cpp
index de6fcf00..89c194f9 100644
--- a/src/Forge.cpp
+++ b/src/Forge.cpp
@@ -29,7 +29,7 @@ Forge::Forge(URIMap& map)
}
std::string
-Forge::str(const Atom& atom)
+Forge::str(const Atom& atom, bool quoted)
{
std::ostringstream ss;
if (atom.type() == Int) {
@@ -39,11 +39,17 @@ Forge::str(const Atom& atom)
} else if (atom.type() == Bool) {
ss << (atom.get<int32_t>() ? "true" : "false");
} else if (atom.type() == URI) {
- ss << "<" << atom.ptr<const char*>() << ">";
+ ss << (quoted ? "<" : "")
+ << atom.ptr<const char>()
+ << (quoted ? ">" : "");
} else if (atom.type() == URID) {
- ss << "<" << _map.unmap_uri(atom.get<int32_t>()) << ">";
+ ss << (quoted ? "<" : "")
+ << _map.unmap_uri(atom.get<int32_t>())
+ << (quoted ? ">" : "");
} else if (atom.type() == String) {
- ss << "\"" << atom.ptr<const char*>() << "\"";
+ ss << (quoted ? "\"" : "")
+ << atom.ptr<const char>()
+ << (quoted ? "\"" : "");
}
return ss.str();
}