diff options
Diffstat (limited to 'crawl-ref/source/libutil.cc')
-rw-r--r-- | crawl-ref/source/libutil.cc | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/crawl-ref/source/libutil.cc b/crawl-ref/source/libutil.cc index ed0b640680..f87496fd6c 100644 --- a/crawl-ref/source/libutil.cc +++ b/crawl-ref/source/libutil.cc @@ -561,77 +561,6 @@ int snprintf( char *str, size_t size, const char *format, ... ) #endif -////////////////////////////////////////////////////////////////////////// -// named_thing_collection - -named_thing_collection::named_thing_collection() - : names(), nnames(0u) -{ -} - -void named_thing_collection::add_thing(const std::string &name) -{ - names[name]++; - nnames++; -} - -size_t named_thing_collection::size() const -{ - return (nnames); -} - -bool named_thing_collection::empty() const -{ - return (!nnames); -} - -std::string named_thing_collection::describe( - description_level_type desc, - const char **plural_qualifiers, - const char **no_qualifier_suffixes) const -{ - if (empty()) - return (""); - - std::ostringstream out; - for (name_count_map::const_iterator i = names.begin(); - i != names.end(); ) - { - const std::pair<std::string, int> &curr(*i); - if (i != names.begin()) - { - ++i; - out << (i == names.end()? " and " : ", "); - } - else - ++i; - - const std::string name = - curr.second > 1? pluralise(curr.first, plural_qualifiers, - no_qualifier_suffixes) - : curr.first; - out << apply_description(desc, name, curr.second); - - switch (desc) - { - case DESC_CAP_A: - desc = DESC_NOCAP_A; - break; - case DESC_CAP_THE: - desc = DESC_NOCAP_THE; - break; - case DESC_CAP_YOUR: case DESC_NOCAP_YOUR: - desc = DESC_PLAIN; - break; - default: - break; - } - } - return (out.str()); -} - -///////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// // Pattern matching |