36 StringMap::const_iterator p = m_map.find( key ) ;
37 if( p == m_map.end() )
38 throw std::out_of_range(std::string()+
"key ["+key+
"] not found in ["+
G::Str::join(
",",keys(14U,
"..."))+
"]" ) ;
44 StringMap::const_iterator p = m_map.find( key ) ;
45 return p == m_map.end() ? default_ : (*p).second ;
51 result.reserve( limit < m_map.size() ? limit : m_map.size() ) ;
53 StringMap::const_iterator p = m_map.begin() ;
54 for( ; p != m_map.end() && limit > 0U && i < limit ; ++p , i++ )
55 result.push_back( (*p).first ) ;
56 if( p != m_map.end() && elipsis != nullptr )
57 result.push_back( elipsis ) ;
StringMapReader(const StringMap &map_)
Implicit constructor.
std::vector< std::string > StringArray
A std::vector of std::strings.
const std::string & at(const std::string &key) const
Returns the value from the map, or throws.
StringArray keys(unsigned int limit=0U, const char *elipsis=nullptr) const
Returns a list of the keys in the map (optionally up to some limit).
std::map< std::string, std::string > StringMap
A std::map of std::strings.
static std::string join(const std::string &sep, const StringArray &strings)
Concatenates an array of strings.