Example #1
0
// Returns a string encoding of the key information of a context attribute:
// moduleClass - the class that inherits from module that produced this attribute
// ctxtGrouping - the name of the grouping of context attributes within the attributes generated by the 
//    module class. This may be a given input (e.g. input0) or the configuration options of a compModule.
// attrName - the name of the context attribute itself.
std::string module::encodeCtxtName(const std::string& moduleClass, const std::string& ctxtGrouping, 
                                   const std::string& ctxtSubGrouping, const std::string& attrName) {
  return txt()<<escapedStr(moduleClass,  ":", escapedStr::unescaped).escape()<<":"<<
                escapedStr(ctxtGrouping, ":", escapedStr::unescaped).escape()<<":"<<
                escapedStr(ctxtSubGrouping, ":", escapedStr::unescaped).escape()<<":"<<
                escapedStr(attrName,     ":", escapedStr::unescaped).escape();
}
Example #2
0
std::string escapeString(const std::string & str, const char * escapeChars) {
	std::string escapedStr(str);
	boost::find_format_all(escapedStr,
	                       boost::token_finder(boost::is_any_of(escapeChars)),
	                                           character_escaper());
	return escapedStr;
}