88std::string
plural(T n,
const std::string &plural_phrase,
const std::string &singular_phrase=
"") {
89 assert(!plural_phrase.empty());
90 std::string retval =
insertCommas(boost::lexical_cast<std::string>(n)) +
" ";
92 if (!singular_phrase.empty()) {
93 retval += singular_phrase;
94 }
else if (boost::ends_with(plural_phrase,
"vertices")) {
95 retval += boost::replace_tail_copy(plural_phrase, 8,
"vertex");
96 }
else if (boost::ends_with(plural_phrase,
"indices")) {
97 retval += boost::replace_tail_copy(plural_phrase, 7,
"index");
98 }
else if (boost::ends_with(plural_phrase,
"ies") && plural_phrase.size() > 3) {
100 retval += boost::replace_tail_copy(plural_phrase, 3,
"y");
101 }
else if (boost::ends_with(plural_phrase,
"sses") || boost::ends_with(plural_phrase,
"indexes")) {
103 retval += boost::erase_tail_copy(plural_phrase, 2);
104 }
else if (boost::ends_with(plural_phrase,
"s") && plural_phrase.size() > 1) {
106 retval += boost::erase_tail_copy(plural_phrase, 1);
109 retval += plural_phrase;
112 retval += plural_phrase;
ROSE_UTIL_API void add_to_reason_string(std::string &result, bool isset, bool do_pad, const std::string &abbr, const std::string &full)
Append an abbreviation or full name to a string.