Exemple #1
0
 void InitConfigPath(const std::_tstring & cfgName, const std::_tstring & ext)
 {
     clib::recursive_mutex::scoped_lock proc(m_mutex);
     m_CfgName = cfgName;
     ATLASSERT((cfgName.find('.') == std::_tstring::npos));
     ATLASSERT((ext.find('.') == std::_tstring::npos));
     std::_tstring cfgNameExt = cfgName;
     cfgNameExt += _T(".");
     cfgNameExt += ext;
     boost::filesystem::path appFolder;
     m_CfgPath = GetApplicationFolder(appFolder) / stringToPath(cfgNameExt);
     m_Cfg.SetFilename(pathToWString(m_CfgPath).c_str());
 }
Exemple #2
0
std::_tstring CBookmarksView::FindTag(std::_tstring str, std::_tstring tag, int &index) {
    std::_tstring tagEnd = _T("</") + tag + _T(">");
    std::_tstring foundStr = _T("");
    tag = _T("<") + tag + _T(">");

    int n = static_cast<int>(str.find(tag, index));
    if (n >= 0)
    {
        int tagLen = tag.length();
        int indexEnd = static_cast<int>(str.find(tagEnd, index));
        foundStr = str.substr(n + tagLen, indexEnd - n - tagLen);
        index = indexEnd + tagEnd.length() + 1;
    }
    else
    {
        index = -1;
        foundStr = _T("");
    }
    return foundStr;
}
Exemple #3
0
void CBookmarksView::ParseBookmarksEcl(std::_tstring ecl, std::_tstring user, std::_tstring inModule, std::_tstring inAttributeName, IAttributeType *attrType)
{
    int i = 0;
    int col = 0;
    int row = 0;

    std::_tstring bookmark = _T("");

    SetMarks(inModule, inAttributeName, false);

    for (int b = 0; b < (int)m_listMaster.m_bookmarks.size(); b++)
    {
        bookmark = m_listMaster.m_bookmarks[b];
        if (bookmark.length() == 0) {
            continue;
        }

        int n = static_cast<int>(ecl.find(bookmark, i));

        if (n > 0) {
            std::_tstring line;
            int index = 0;
            bool found = false;

            typedef std::vector<std::_tstring> split_vector_type;
            split_vector_type lines;
            boost::algorithm::split(lines, ecl, boost::algorithm::is_any_of(_T("\n")), boost::algorithm::token_compress_on);

            for (split_vector_type::const_iterator itr = lines.begin(); itr != lines.end(); ++itr)
            {
                line = itr[0];
                ++index;

                n = static_cast<int>(line.find(_T("//"), 0));
                if (n < 0)
                {
                    continue;
                }

                n = static_cast<int>(line.find(bookmark, 0));

                if (n >= 0) {
                    col = 0;

                    std::wostringstream ss;
                    ss << (index);
                    std::_tstring nStr = ss.str();
                    found = false;

                    for (int i = 0; i < m_listMaster.GetItemCount(); ++i)
                    {
                        std::_tstring liner = m_listMaster.GetItemText(i, 0);
                        std::_tstring module = m_listMaster.GetItemText(i, 3);
                        std::_tstring attributeName = m_listMaster.GetItemText(i, 4);

                        if (liner == nStr && module == inModule && attributeName == inAttributeName)
                        {
                            found = true;
                            BookmarkItemData *data = reinterpret_cast<BookmarkItemData *>(m_listMaster.GetItemData(i));
                            data->marked = true;
                            break;
                        }
                    }

                    if (!found) {
                        row = m_listMaster.InsertItem(col++, nStr.c_str());
                        m_listMaster.SetItemText(row, col++, bookmark.c_str());
                        m_listMaster.SetItemText(row, col++, user.c_str());
                        m_listMaster.SetItemText(row, col++, inModule.c_str());
                        m_listMaster.SetItemText(row, col++, inAttributeName.c_str());
                        m_listMaster.SetItemText(row, col++, attrType->GetRepositoryCode());
                        m_listMaster.SetItemText(row, col++, trim(line.substr(n + m_listMaster.m_bookmarks[b].length())).c_str());
                        BookmarkItemData *data = new BookmarkItemData;
                        data->marked = true;
                        data->bookmarkType = (BM_TYPE)b;
                        data->column = n;
                        m_listMaster.SetItemData(row, (DWORD_PTR)data);
                    }
                }
            }
        }
    }

    DeleteMarkedBookmarks(inModule, inAttributeName,false);

    for (int i = 0; i < col; ++i)
    {
        m_listMaster.SetColumnWidth(i, LVSCW_AUTOSIZE_USEHEADER);
    }

    DoRefresh(NULL, 0);
}