Fixed some more DOT generation stuff.

This commit is contained in:
Nathan Braswell
2013-08-11 01:15:26 -04:00
parent ea42cb5bc7
commit af0c1f0a81
4 changed files with 22 additions and 11 deletions

View File

@@ -225,10 +225,10 @@ template<class T>
std::string NodeTree<T>::getDOTName() {
std::string DOTName = "";
if (data != NULL)
DOTName = "\"" + name + "-" + data->toString() + "_" + intToString(id) + "\""; //Note that terminals already have a quote in the front of their name, so we don't need to add one
DOTName = "\"" + replaceExEscape(name + "-" + data->toString(), "\"", "\\\"") + "_" + intToString(id) + "\""; //Note that terminals already have a quote in the front of their name, so we don't need to add one
else
DOTName = "\"" + name + "_" + intToString(id) + "\"";
return(replace(DOTName, "\n", "\\n"));
DOTName = "\"" + replaceExEscape(name, "\"", " \\\"") + "_" + intToString(id) + "\"";
return(replaceExEscape(DOTName, "\n", "\\n"));
}
#endif

View File

@@ -5,13 +5,13 @@
#define NULL 0
#endif
//#include <iostream>
#include <iostream>
#include <string>
#include <sstream>
std::string intToString(int theInt);
std::string truncateEnd(std::string to_truncate);
std::string removeBeginning(std::string to_remove);
std::string replace(std::string first, std::string search, std::string replace);
std::string replaceExEscape(std::string first, std::string search, std::string replace);
#endif