当前位置: 首页>>代码示例>>C++>>正文


C++ SharedPtr::GetAllColumns方法代码示例

本文整理汇总了C++中poco::SharedPtr::GetAllColumns方法的典型用法代码示例。如果您正苦于以下问题:C++ SharedPtr::GetAllColumns方法的具体用法?C++ SharedPtr::GetAllColumns怎么用?C++ SharedPtr::GetAllColumns使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在poco::SharedPtr的用法示例。


在下文中一共展示了SharedPtr::GetAllColumns方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ShowTraces

void CLogAnalyzerView::ShowTraces(const CString& strComponent, BOOL bShowAll)
{
    tstring strItemText = strComponent;
    const std::map<tstring, Poco::SharedPtr<CComponent>>& components = m_logger->GetComponents();
    std::map<tstring, Poco::SharedPtr<CComponent>>::const_iterator ite = components.find(strItemText);
    if (ite != components.end())
    {
        const std::vector<Poco::SharedPtr<CTraceLog>>& traceLogs = ite->second->GetTraceLogs();
        if (bShowAll)
        {
            //Only show the traces you want in list control
            m_traceList.DeleteAllTraceLog();
            for (int i = 0; i < traceLogs.size(); ++i)
                m_traceList.InsertTraceLog(traceLogs.at(i));
        }
        //Show all traces and go to the first trace log that fits to you want
        else
        {
            Poco::SharedPtr<CUISetting> uiSetting = m_logger->GetActiveUISetting();
            int nColumn = 0;
            int nCurSel = m_comboColumns.GetCurSel();
            if (nCurSel == 0)
                nColumn = -1; //All
            else
            {
                CString strItem;
                m_comboColumns.GetLBText(nCurSel, strItem);
                tstring strItemValue = strItem.GetBuffer(strItem.GetLength());
                if (!uiSetting.isNull())
                {
                    for (int i = 0; i < uiSetting->GetAllColumns().size(); ++i)
                    {
                        if (strItemValue == uiSetting->GetAllColumns().at(i)->m_strRealColumnName)
                        {
                            nColumn = i;
                            break;
                        }
                    }
                }
            }

            m_traceList.SearchText(nColumn, m_strFindContent.GetBuffer(m_strFindContent.GetLength()), m_bMatchCase);
        }
        m_strCurrentPage.Format("%d", m_traceList.GetCurrentPage());
        m_strTraceCount.Format("Total : %d", m_traceList.GetCount());
        UpdateData(FALSE);
    }
}
开发者ID:yanjunnf,项目名称:LogAnalyzer,代码行数:48,代码来源:LogAnalyzerView.cpp

示例2: OnBnClickedButtonOpen

void CLogAnalyzerView::OnBnClickedButtonOpen()
{
    //Open File
    if (!m_logger.isNull() && !(m_logger->GetActiveUISetting().isNull()))
    {
        if (!m_logger->GetActiveUISetting()->IsAvailable())
            if (AfxMessageBox("The UI setting is not available, Do you want to configurate it?", MB_OKCANCEL) == IDOK)
            {
                //OnAnalyseSetting();
                return;
            }
    }

    CString strFile = _T("");
    CFileDialog dlgFile(TRUE, NULL, NULL, OFN_HIDEREADONLY, _T("Describe Files (*.log)|*.log|All Files (*.*)|*.*||"), NULL);

    if (dlgFile.DoModal() == IDOK)
    {
        strFile = dlgFile.GetPathName();

        CString strItem;
        m_comboSettings.GetLBText(m_comboSettings.GetCurSel(), strItem);
        CLogAnalyzerApp* app = (CLogAnalyzerApp*)AfxGetApp();
        if (app != NULL)
        {
            Poco::SharedPtr<CUISetting> currentSelSetting = app->GetUISetting(strItem.GetBuffer(strItem.GetLength()));
            if (!currentSelSetting.isNull())
            {
                if (!m_logger.isNull() && !m_logger->GetFileName().empty())
                {
                    m_logger->ClearAllComponents();
                    //Open another log file, remove the previous one
                    RemoveItem();
                }
                m_logger->SetActiveUISetting(currentSelSetting);
            }

            //Update list control
            while(m_comboColumns.DeleteString(0));
            while(m_traceList.DeleteColumn(0));
            m_comboColumns.AddString("All");
            //Init list control
            LV_COLUMN lv;
            lv.mask = LVCF_TEXT | LVCF_WIDTH;
            if (!currentSelSetting.isNull())
            {
                int nIndex = 0;
                //Insert the first column of Line number
                lv.pszText = "Line";
                lv.cx = 50;
                m_traceList.InsertColumn(nIndex++, &lv);

                const std::vector<Poco::SharedPtr<CColumnSetting>>& columns = currentSelSetting->GetAllColumns();
                for (int i = 0; i < columns.size(); ++i)
                {
                    if (columns.at(i)->m_bEnable)
                    {
                        lv.pszText = (LPSTR)columns.at(i)->m_strRealColumnName.c_str();
                        lv.cx = 100;
                        m_traceList.InsertNewColumn(nIndex++, &lv, i);
                        m_comboColumns.AddString(columns.at(i)->m_strRealColumnName.c_str());
                    }
                }
                m_traceList.SetColumnSetting(currentSelSetting->GetAllColumns());
            }
        }
        m_comboColumns.SetCurSel(0);

        m_traceList.DeleteAllTraceLog();

        m_logger->StartParse(tstring(strFile.GetBuffer(strFile.GetLength())));
        CAnalyseProgressDlg dlg(m_logger);
        dlg.DoModal();

        //Update tree view
        CClassView* pClassView = NULL;
        GET_CLASS_VIEW(pClassView);
        if (pClassView != NULL)
        {
            HTREEITEM hFile = pClassView->InsertLogFile(strFile);
            const std::map<tstring, Poco::SharedPtr<CComponent>>& components = m_logger->GetComponents();
            std::map<tstring, Poco::SharedPtr<CComponent>>::const_iterator ite = components.begin();
            while (ite != components.end())
            {
                pClassView->InsertComponent(hFile, ite->second->GetComponentName().c_str());
                ++ite;
            }
            pClassView->SetFocus();
        }

        //Update log file information/UI Setting in property panel
        CMainFrame* pMainFrame = (CMainFrame*)AfxGetMainWnd();
        if (pMainFrame != NULL)
        {
            Poco::SharedPtr<SLogFileProperty> logFilePro = new SLogFileProperty;
            logFilePro->m_strFileName = m_logger->GetFileName();
            logFilePro->m_nFileSize = m_logger->GetFileSize();

            pMainFrame->SetLogFileProperty(logFilePro);
            pMainFrame->SetCurrentUISettingProperty(m_logger->GetActiveUISetting());
//.........这里部分代码省略.........
开发者ID:yanjunnf,项目名称:LogAnalyzer,代码行数:101,代码来源:LogAnalyzerView.cpp


注:本文中的poco::SharedPtr::GetAllColumns方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。