#include <boost/lexical_cast.hpp>
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
+#include <boost/functional/hash.hpp>
#include <vector>
#include <set>
#include <iostream>
return result;
}
+inline std::string sanitize_short_string(const std::string& s)
+{
+ unsigned id = boost::hash<std::string>()(s);
+ return sanitize_string("id" + boost::lexical_cast<std::string>(id));
+}
+
std::string format_precision(double val, int digits)
{
std::stringstream ss;
//
// Add a section for this table as well:
//
- std::string section_id = "section_" + sanitize_string(table_name);
+ std::string section_id = "section_" + sanitize_short_string(table_name);
if(content.find(section_id + "[]") == std::string::npos)
{
std::string new_section = "\n[template " + section_id + "[]\n[section:" + section_id + " " + table_name + "]\n[" + table_id + "]\n[endsect]\n]\n";