void ossimKeywordlist::upcaseKeywords() { KeywordMap tempMap; KeywordMap::iterator iter = m_map.begin(); while(iter != m_map.end()) { tempMap.insert(make_pair(ossimString::upcase(iter->first), iter->second)); ++iter; } m_map = tempMap; }
ossimKeywordlist& ossimKeywordlist::upcaseKeywords() { KeywordMap tempMap; KeywordMap::iterator iter = m_map.begin(); while(iter != m_map.end()) { ossimString k(iter->first); tempMap.insert(std::make_pair(k.upcase().string(), iter->second)); ++iter; } m_map = tempMap; return *this; }
/////////////////// // Read bit flags specified by keywords from a file bool ReadKeywordList(const std::string& filename, const std::string& section, const std::string& key, int *value, int defaultv) { std::string string; *value = defaultv; if(!GetString(filename,section,key,string)) return false; std::vector<std::string> split = explode(string, ","); for (std::vector<std::string>::iterator it = split.begin(); it != split.end(); it++) { TrimSpaces(*it); KeywordMap::iterator key = Keywords.find(*it); if (key != Keywords.end()) *value |= key->second; } return true; }
/////////////////// // Read a keyword from a file bool ReadKeyword(const std::string& filename, const std::string& section, const std::string& key, int *value, int defaultv) { std::string string; *value = defaultv; if(!GetString(filename,section,key,string)) return false; // Try and find a keyword with matching keys KeywordMap::iterator f = Keywords.find(string); if(f != Keywords.end()) { //notes << filename << ":" << section << "." << key << ": " << f->first << "(" << string << ") = " << f->second << endl; *value = f->second; return true; } warnings << filename << ":" << section << "." << key << ": '" << string << "' is an unknown keyword" << endl; return false; }