//---------------------------------------------------------------------------- // some quasi intelligent brief description abbreviator :^) QCString abbreviate(const char *s,const char *name) { QCString scopelessName=name; int i=scopelessName.findRev("::"); if (i!=-1) scopelessName=scopelessName.mid(i+2); QCString result=s; result=result.stripWhiteSpace(); // strip trailing . if (!result.isEmpty() && result.at(result.length()-1)=='.') result=result.left(result.length()-1); // strip any predefined prefix QStrList &briefDescAbbrev = Config_getList("ABBREVIATE_BRIEF"); const char *p = briefDescAbbrev.first(); while (p) { QCString s = p; s.replace(QRegExp("\\$name"), scopelessName); // replace $name with entity name s += " "; stripWord(result,s); p = briefDescAbbrev.next(); } // capitalize first word if (!result.isEmpty()) { int c=result[0]; if (c>='a' && c<='z') c+='A'-'a'; result[0]=c; } return result; }
std::vector<std::string> Talkbot::split(const std::string& str) const { std::istringstream stream(str); std::vector<std::string> res; std::string word; while(stream >> word) { stripWord(word); if(not word.empty()) res.push_back(word); } return res; }