示例#1
0
bool SceneFileHandlerBase::subSceneFileType(SceneFileType &fileType)
{
    bool retCode = false;

    std::list<std::string>::iterator sI;
         FileTypeMap      ::iterator smI;

    std::string suffix;

    for(  sI  = fileType.suffixList().begin();
          sI != fileType.suffixList().end();
        ++sI)
    {
        suffix.assign(sI->c_str());
        //suffix.toLower();
        std::transform(suffix.begin(), suffix.end(), suffix.begin(), ::tolower);
        smI = _suffixTypeMap.find(suffix);

        if (smI != _suffixTypeMap.end())
        {
            _suffixTypeMap.erase(smI);
            retCode = true;
        }
    }
    return retCode;
}
示例#2
0
bool SceneFileHandler::subSceneFileType(SceneFileType &fileType)
{
    bool retCode = false;

    std::list<IDString>::iterator sI;
    FileTypeMap   ::iterator smI;

    IDString suffix;

    for(  sI  = fileType.suffixList().begin();
            sI != fileType.suffixList().end();
            ++sI)
    {
        suffix.set(sI->str());
        suffix.toLower();

        smI = the()._suffixTypeMap.find(suffix);
        if (smI != the()._suffixTypeMap.end())
        {
            the()._suffixTypeMap.erase(smI);
            retCode = true;
        }
    }
    return retCode;
}
示例#3
0
bool SceneFileHandlerBase::addSceneFileType(SceneFileType &fileType)
{
    bool retCode = false;

    std::list<std::string>::iterator sI;
         FileTypeMap      ::iterator smI;

    std::string suffix;

    for(  sI  = fileType.suffixList().begin();
          sI != fileType.suffixList().end();
        ++sI)
    {
        suffix.assign (sI->c_str());
//        suffix.toLower();
        std::transform(suffix.begin(), suffix.end(), suffix.begin(), ::tolower);

        smI = _suffixTypeMap.find(suffix);

        if (smI != _suffixTypeMap.end())
        {
            if(fileType.doOverride() == true)
            {
                FindOverride           overrideFinder;
                FileTypeList::iterator lIt;

                overrideFinder.uiRefPriority = fileType.getOverridePriority();

                lIt = std::find_if(_suffixTypeMap[suffix]->begin(),
                                   _suffixTypeMap[suffix]->end  (),
                                   overrideFinder);

                _suffixTypeMap[suffix]->insert(lIt, &fileType);

                SWARNING << "Added an file type with suffix "
                         << suffix
                         << " overriding "
                         << std::endl;
            }
            else
            {
                _suffixTypeMap[suffix]->push_back(&fileType);

                SWARNING << "Added an file type with suffix "
                         << suffix
                         << " non overriding at the end of the list"
                         << std::endl;
            }
        }
        else
        {
            FileTypeList *pTmpList = new FileTypeList;

            pTmpList->push_back(&fileType);

            _suffixTypeMap[suffix] = pTmpList;

            retCode = true;
        }
    }

    return retCode;
}