35 #include <unordered_map> 77 char const c =
static_cast<char>( std::tolower( static_cast<unsigned char>( r )));
78 if( rank_abbreviations.count( c ) > 0 ) {
79 return rank_abbreviations.at( c );
95 for(
auto const& p : rank_abbreviations ) {
97 return std::string( 1, p.first );
123 std::string rank =
"";
124 std::string name = entry;
128 if( entry.size() >= 2 && entry[1] ==
'_' ) {
135 size_t pos = entry.find_first_not_of(
"_", 1 );
136 name = entry.substr( pos );
139 return { rank, name };
static const std::unordered_map< char, std::string > rank_abbreviations
Local helper data that stores the abbreviations and names of common taxonomic ranks.
Container namespace for all symbols of genesis in order to keep them separate when used as a library...
std::string rank_to_abbreviation(std::string const &rank)
Get the abbreviation of a taxonomic rank name.
Provides some commonly used string utility functions.
constexpr char to_lower(char c) noexcept
Return the lower case version of a letter, ASCII-only.
std::pair< std::string, std::string > resolve_rank_abbreviation(std::string const &entry)
Resolve a combined rank and name entry of the form "k_Bacteria" into the full rank and the name...
std::string rank_from_abbreviation(char r)
Get the taxonomic rank name given its abbreviation.