Esempio n. 1
0
std::wstring Loader::get_difference( const HashSet& os, const HashStringMap& om, const HashSet& ns, const HashStringMap& nm )
{
    std::set<size_t> removed;
    std::set_difference( os.begin(), os.end(), ns.begin(), ns.end(), std::inserter(removed, removed.begin()) );

    std::set<size_t> added;
    std::set_difference( ns.begin(), ns.end(), os.begin(), os.end(), std::inserter(added, added.begin()) );

    std::wstringstream strm;

    for ( std::set<size_t>::iterator it = removed.begin(); it != removed.end(); ++it )
    {
        std::map<size_t, std::wstring>::const_iterator find_it = om.find( *it );

        if ( find_it != om.end() )
        {
            strm << std::endl << L"remove: " << find_it->second;
        }
    }

    for ( std::set<size_t>::iterator it = added.begin(); it != added.end(); ++it )
    {
        std::map<size_t, std::wstring>::const_iterator find_it = nm.find( *it );

        if ( find_it != nm.end() )
        {
            strm << std::endl << L"add: " << find_it->second;
        }
    }

    return strm.str();
}
Esempio n. 2
0
const char *plainconf::getRealName(char *name)
{
    assert(bKeywordsInited == true);
    tolowerstr(name);
    HashStringMap<plainconfKeywords *>::iterator it = allKeyword.find(name);

    if (it == allKeyword.end())
        return NULL;
    else
        return it.second()->name;
}
Esempio n. 3
0
void plainconf::initKeywords()
{
    if (bKeywordsInited)
        return ;

    int count = sizeof(sKeywords) / sizeof(plainconfKeywords);

    for (int i = 0; i < count; ++i)
    {
        allKeyword.insert(sKeywords[i].name, &sKeywords[i]);

        if (sKeywords[i].alias && strlen(sKeywords[i].alias) > 0)
            allKeyword.insert(sKeywords[i].alias, &sKeywords[i]);
    }

    bKeywordsInited = true;
}