std::string toString<stringmap>(const stringmap &v) { std::ostringstream oss; oss << "std::map( "; for (stringmap::const_iterator it = v.begin(); it != v.end(); ++it) { oss << it->first << " = " << it->second; stringmap::const_iterator jt(it); if (++jt != v.end()) oss << ", "; } oss << " )"; return oss.str(); }
std::vector<std::string> extract_keys_from_string_map (stringmap const& keyword_dictionary ) { std::vector<std::string> keywords; stringmap_iterator i_keyword_dictionary = keyword_dictionary.begin(); for ( ;i_keyword_dictionary != keyword_dictionary.end() ;++i_keyword_dictionary ) { keywords.push_back((*i_keyword_dictionary).first); } return keywords; }
void show ( const std::string & tag, const stringmap<VALUETYPE> & container ) { fprintf ( stdout, "- xpc::stringmap '%s':\n" "- Name: '%s'\n" "- Size: %d\n" , tag.c_str(), container.name().c_str(), int(container.size()) ); std::for_each(container.begin(), container.end(), show_pair<VALUETYPE>); }
stringmap merge(stringmap a, stringmap b) { stringmap tmp(a); tmp.insert(b.begin(),b.end()); return tmp; }