示例#1
0
文件: filter.cpp 项目: 3rdexp/fxfile
void Filter::save(fxfile::base::ConfFileEx &aConfFile) const
{
    xpr_sint_t         i;
    xpr_tchar_t        sKey[0xff];
    ConfFile::Section *sSection;
    FilterItem        *sFilterItem;
    FilterDeque::const_iterator sIterator;

    sSection = aConfFile.addSection(kFilterSection);
    XPR_ASSERT(sSection != XPR_NULL);

    sIterator = mFilterDeque.begin();
    for (i = 0; sIterator != mFilterDeque.end(); ++i, ++sIterator)
    {
        sFilterItem = *sIterator;
        XPR_ASSERT(sFilterItem);

        _stprintf(sKey, kNameKey, i + 1);
        aConfFile.setValueS(sSection, sKey, sFilterItem->mName);

        _stprintf(sKey, kExtensionKey, i + 1);
        aConfFile.setValueS(sSection, sKey, sFilterItem->mExts);

        _stprintf(sKey, kColorKey, i + 1);
        aConfFile.setValueC(sSection, sKey, sFilterItem->mColor);

        _stprintf(sKey, kIconIndexKey, i + 1);
        aConfFile.setValueI(sSection, sKey, sFilterItem->mIconIndex);
    }
}
示例#2
0
void RecentFileList::save(fxfile::base::ConfFileEx &aConfFile) const
{
    xpr_sint_t         i;
    xpr_tchar_t        sKey[XPR_MAX_PATH + 1];
    ConfFile::Section *sSection;
    FileDeque::const_iterator sIterator;

    sSection = aConfFile.addSection(kRecentFileListSection);
    XPR_ASSERT(sSection != XPR_NULL);

    sIterator = mFileDeque.begin();
    for (i = 0; sIterator != mFileDeque.end(); ++sIterator, ++i)
    {
        const xpr::string &sPath = *sIterator;

        _stprintf(sKey, kFileKey, i + 1);

        aConfFile.setValueS(sSection, sKey, sPath);
    }
}
示例#3
0
文件: filter.cpp 项目: 3rdexp/fxfile
xpr_bool_t Filter::load(fxfile::base::ConfFileEx &aConfFile)
{
    xpr_size_t         i;
    xpr_tchar_t        sKey[0xff];
    const xpr_tchar_t *sValue;
    FilterItem        *sFilterItem;
    ConfFile::Section *sSection;

    sSection = aConfFile.findSection(kFilterSection);
    if (XPR_IS_NULL(sSection))
        return XPR_FALSE;

    for (i = 0; i < MAX_FILTER; ++i)
    {
        _stprintf(sKey, kNameKey, i + 1);

        sValue = aConfFile.getValueS(sSection, sKey, XPR_NULL);
        if (XPR_IS_NULL(sValue))
            break;

        sFilterItem = new FilterItem;
        XPR_ASSERT(sFilterItem != XPR_NULL);

        sFilterItem->mName = sValue;

        _stprintf(sKey, kExtensionKey, i + 1);
        sFilterItem->mExts = aConfFile.getValueS(sSection, sKey, XPR_STRING_LITERAL(""));

        _stprintf(sKey, kColorKey, i + 1);
        sFilterItem->mColor = aConfFile.getValueC(sSection, sKey, RGB(0,0,0));

        _stprintf(sKey, kIconIndexKey, i + 1);
        sFilterItem->mIconIndex = aConfFile.getValueI(sSection, sKey, -1);

        addFilter(sFilterItem);
    }

    return XPR_TRUE;
}
示例#4
0
void RecentFileList::load(fxfile::base::ConfFileEx &aConfFile)
{
    clear();

    xpr_sint_t         i;
    xpr_tchar_t        sKey[XPR_MAX_PATH + 1];
    const xpr_tchar_t *sValue;
    ConfFile::Section *sSection;

    sSection = aConfFile.findSection(kRecentFileListSection);
    if (XPR_IS_NOT_NULL(sSection))
    {
        for (i = 0; ; ++i)
        {
            _stprintf(sKey, kFileKey, i + 1);

            sValue = aConfFile.getValueS(sSection, sKey, XPR_NULL);
            if (XPR_IS_NULL(sValue))
                break;

            mFileDeque.push_back(sValue);
        }
    }
}
示例#5
0
xpr_bool_t ProgramAss::load(fxfile::base::ConfFileEx &aConfFile)
{
    xpr_size_t         i;
    xpr_tchar_t        sKey[0xff];
    const xpr_tchar_t *sValue;
    ConfFile::Section *sSection;
    ProgramAssItem    *sProgramAssItem;

    sSection = aConfFile.findSection(kProgramAssSection);
    if (XPR_IS_NULL(sSection))
        return XPR_FALSE;

    for (i = 0; i < MAX_PROGRAM_ASS; ++i)
    {
        _stprintf(sKey, kNameKey, i + 1);

        sValue = aConfFile.getValueS(sSection, sKey, XPR_NULL);
        if (XPR_IS_NULL(sValue))
            break;

        sProgramAssItem = new ProgramAssItem;
        XPR_ASSERT(sProgramAssItem != XPR_NULL);

        sProgramAssItem->mName = sValue;

        _stprintf(sKey, kTypeKey, i + 1);
        sProgramAssItem->mType = aConfFile.getValueI(sSection, sKey, ProgramAssTypeNone);

        _stprintf(sKey, kMethodKey, i + 1);
        sProgramAssItem->mMethod = aConfFile.getValueI(sSection, sKey, ProgramAssMethodExt);

        if (sProgramAssItem->mMethod == ProgramAssMethodExt)
        {
            _stprintf(sKey, kExtensionKey, i + 1);
            sProgramAssItem->mExts = aConfFile.getValueS(sSection, sKey, XPR_STRING_LITERAL(""));
        }
        else
        {
            _stprintf(sKey, kFilterKey, i + 1);
            sProgramAssItem->mExts = aConfFile.getValueS(sSection, sKey, XPR_STRING_LITERAL(""));
        }

        _stprintf(sKey, kProgramKey, i + 1);
        sProgramAssItem->mPath = aConfFile.getValueS(sSection, sKey, XPR_STRING_LITERAL(""));

        addItem(sProgramAssItem);
    }

    return XPR_TRUE;
}
示例#6
0
void ProgramAss::save(fxfile::base::ConfFileEx &aConfFile) const
{
    xpr_sint_t         i;
    xpr_tchar_t        sKey[0xff];
    ConfFile::Section *sSection;
    ProgramAssItem    *sProgramAssItem;
    ProgramAssDeque::const_iterator sIterator;

    sSection = aConfFile.addSection(kProgramAssSection);
    XPR_ASSERT(sSection != XPR_NULL);

    sIterator = mProgramAssDeque.begin();
    for (i = 0; sIterator != mProgramAssDeque.end(); ++sIterator, ++i)
    {
        sProgramAssItem = *sIterator;
        XPR_ASSERT(sProgramAssItem != XPR_NULL);

        _stprintf(sKey, kNameKey, i + 1);
        aConfFile.setValueS(sSection, sKey, sProgramAssItem->mName);

        _stprintf(sKey, kTypeKey, i + 1);
        aConfFile.setValueI(sSection, sKey, sProgramAssItem->mType);

        _stprintf(sKey, kMethodKey, i + 1);
        aConfFile.setValueI(sSection, sKey, sProgramAssItem->mMethod);

        if (sProgramAssItem->mMethod == ProgramAssMethodExt)
        {
            _stprintf(sKey, kExtensionKey, i + 1);
            aConfFile.setValueS(sSection, sKey, sProgramAssItem->mExts);
        }
        else
        {
            _stprintf(sKey, kFilterKey, i + 1);
            aConfFile.setValueS(sSection, sKey, sProgramAssItem->mFilterName);
        }

        _stprintf(sKey, kProgramKey, i + 1);
        aConfFile.setValueS(sSection, sKey, sProgramAssItem->mPath);
    }
}