Esempio n. 1
0
	const string_list& track_info::get_language_codes()
	{
		static string_list languageCodes;
		if ( languageCodes.size() == 0 ) {
			languageCodes.resize( language_count );
			transform( language_code_map, language_code_map + language_count, languageCodes.begin(),
					   bind( &alpha_pair::second, _1 ) );
			languageCodes.erase( unique( languageCodes.begin(), languageCodes.end() ), languageCodes.end() );
		}
		return languageCodes;
	}
Esempio n. 2
0
 //------------------------------------------------------------------
 void code_colorer::replace_strlist_keysym(string_list& strlist)
 {
     unsigned i;
     for(i = 0; i < strlist.size(); ++i)
     {
         string_type& s = strlist[i];
         unsigned j;
         for(j = 0; j < s.length(); ++j)
         {
             s[j] = replace_keysym(s[j]);
         }
     }
 }
Esempio n. 3
0
bool string_list::compare(const string_list& list, bool cs) const {
    if(size() != list.size()) {
        return false;
    }

    const_iterator i1 = begin();
    const_iterator i2 = list.begin();
    while(i1 != end() || i2 != list.end()) {
        if( i1->compare(*i2, 0, string::npos, cs) != 0 ) {
            return false;
        }
        i1++;
        i2++;
    }
    return true;
}
Esempio n. 4
0
const std::string decode_mnemonic(const string_list& words)
{
    std::ostringstream ss;
    ss << std::hex;
    auto words_end = words.end() - words.size() % 3;
    std::cout << std::endl;
    for (auto it = words.begin(); it != words_end; it += 3)
    {
        const int n = (int)common_words.size();
        int index_1 = (int)index_of(*it);
        int index_2 = (int)index_of(*(it + 1)) % n;
        int index_3 = (int)index_of(*(it + 2)) % n;
        uint32_t val = index_1 +
            n * special_modulo(index_2 - index_1, n) +
            n * n * special_modulo(index_3 - index_2, n);
        ss << val;
    }
    return ss.str();
}