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


C++ wxRegEx::Matches方法代码示例

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


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

示例1: GetDebugeePID

void DbgGdb::GetDebugeePID(const wxString& line)
{
    if(m_debuggeePid == wxNOT_FOUND) {
        if(GetIsRemoteDebugging()) {
            m_debuggeePid = m_gdbProcess->GetPid();

        } else {

            static wxRegEx reDebuggerPidWin(wxT("New Thread ([0-9]+)\\.(0[xX][0-9a-fA-F]+)"));
            static wxRegEx reGroupStarted(wxT("id=\"([0-9]+)\""));
            static wxRegEx reSwitchToThread(wxT("Switching to process ([0-9]+)"));

            // test for the debuggee PID
            // in the line with the following pattern:
            // =thread-group-started,id="i1",pid="15599"
            if(m_debuggeePid < 0 && !line.IsEmpty()) {
                wxString debuggeePidStr;

                if(line.Contains(wxT("=thread-group-started")) && reGroupStarted.Matches(line)) {
                    debuggeePidStr = reGroupStarted.GetMatch(line, 1);

                } else if(line.Contains(wxT("=thread-group-created")) && reGroupStarted.Matches(line)) {
                    debuggeePidStr = reGroupStarted.GetMatch(line, 1);

                } else if(reDebuggerPidWin.Matches(line)) {
                    debuggeePidStr = reDebuggerPidWin.GetMatch(line, 1);

                } else if(reSwitchToThread.Matches(line)) {
                    debuggeePidStr = reSwitchToThread.GetMatch(line, 1);
                }

                if(!debuggeePidStr.IsEmpty()) {
                    long iPid(0);
                    if(debuggeePidStr.ToLong(&iPid)) {
                        m_debuggeePid = iPid;
                        wxString msg;
                        msg << wxT(">> Debuggee process ID: ") << m_debuggeePid;
                        m_observer->UpdateAddLine(msg);

                        // Now there's a known pid, the debugger can be interrupted to let any to-be-disabled bps be
                        // disabled. So...
                        m_observer->DebuggerPidValid();
                    }
                }
            }
        }
    }
}
开发者ID:huan5765,项目名称:codelite-translate2chinese,代码行数:48,代码来源:debuggergdb.cpp

示例2: OnReadProcessOutput

void SvnConsole::OnReadProcessOutput(wxCommandEvent& event)
{
    ProcessEventData *ped = (ProcessEventData *)event.GetClientData();
    if (ped) {
        m_output.Append(ped->GetData().c_str());
    }

    wxString s (ped->GetData());
    s.MakeLower();

    if (m_currCmd.printProcessOutput)
        AppendText( ped->GetData() );
    
    static wxRegEx reUsername("username[ \t]*:", wxRE_DEFAULT|wxRE_ICASE);
    wxArrayString lines = wxStringTokenize(s, wxT("\n"), wxTOKEN_STRTOK);
    if( !lines.IsEmpty() && lines.Last().StartsWith(wxT("password for '")) ) {
        m_output.Clear();
        wxString pass = wxGetPasswordFromUser(ped->GetData(), wxT("Subversion"));
        if(!pass.IsEmpty() && m_process) {
            m_process->WriteToConsole(pass);
        }
    } else if ( !lines.IsEmpty() && reUsername.IsValid() && reUsername.Matches( lines.Last() ) ) {
        // Prompt the user for "Username:"
        wxString username = ::wxGetTextFromUser(ped->GetData(), "Subversion");
        if ( !username.IsEmpty() && m_process ) {
            m_process->Write(username + "\n");
        }
    }
    delete ped;
}
开发者ID:HTshandou,项目名称:codelite,代码行数:30,代码来源:svn_console.cpp

示例3: AdjustPathForCygwinIfNeeded

void CodeLiteApp::AdjustPathForCygwinIfNeeded()
{
#ifdef __WXMSW__
    CL_DEBUG("AdjustPathForCygwinIfNeeded called");
    if(!::clIsCygwinEnvironment()) {
        CL_DEBUG("Not running under Cygwin - nothing be done");
        return;
    }
    
    CL_SYSTEM("Cygwin environment detected");
    
    wxString cygwinRootDir;
    CompilerLocatorCygwin cygwin;
    if(cygwin.Locate()) {
        // this will return the base folder for cygwin (e.g. D:\cygwin)
        cygwinRootDir = (*cygwin.GetCompilers().begin())->GetInstallationPath();
    }

    // Running under Cygwin
    // Adjust the PATH environment variable
    wxString pathEnv;
    ::wxGetEnv("PATH", &pathEnv);

    // Always add the default paths
    wxArrayString paths;
    if(!cygwinRootDir.IsEmpty()) {
        CL_SYSTEM("Cygwin root folder is: %s", cygwinRootDir);
        wxFileName cygwinBinFolder(cygwinRootDir, "");
        cygwinBinFolder.AppendDir("bin");
        paths.Add(cygwinBinFolder.GetPath());
    }

    paths.Add("/usr/local/bin");
    paths.Add("/usr/bin");
    paths.Add("/usr/sbin");
    paths.Add("/bin");
    paths.Add("/sbin");

    // Append the paths from the environment variables
    wxArrayString userPaths = ::wxStringTokenize(pathEnv, ";", wxTOKEN_STRTOK);
    paths.insert(paths.end(), userPaths.begin(), userPaths.end());

    wxString fixedPath;
    for(size_t i = 0; i < paths.GetCount(); ++i) {
        wxString& curpath = paths.Item(i);
        static wxRegEx reCygdrive("/cygdrive/([A-Za-z])");
        if(reCygdrive.Matches(curpath)) {
            // Get the drive letter
            wxString volume = reCygdrive.GetMatch(curpath, 1);
            volume << ":";
            reCygdrive.Replace(&curpath, volume);
        }

        fixedPath << curpath << ";";
    }

    CL_DEBUG("Setting PATH environment variable to:\n%s", fixedPath);
    ::wxSetEnv("PATH", fixedPath);
#endif
}
开发者ID:LoviPanda,项目名称:codelite,代码行数:60,代码来源:app.cpp

示例4: OnUpdate

void MemoryView::OnUpdate(wxCommandEvent& e)
{
    static wxRegEx reHex(wxT("[0][x][0-9a-fA-F][0-9a-fA-F]"));

    // extract the text memory from the text control and pass it to the debugger
    wxString memory;
    wxArrayString lines = wxStringTokenize(m_textCtrlMemory->GetValue(), wxT("\n"), wxTOKEN_STRTOK);
    for (size_t i=0; i<lines.GetCount(); i++) {
        wxString line = lines.Item(i).AfterFirst(wxT(':')).BeforeFirst(wxT(':')).Trim().Trim(false);
        wxArrayString hexValues = wxStringTokenize(line, wxT(" "), wxTOKEN_STRTOK);
        for (size_t y=0; y<hexValues.GetCount(); y++) {
            wxString hex = hexValues.Item(y);
            if (reHex.Matches( hex ) && hex.Len() == 4) {
                // OK
                continue;
            } else {
                wxMessageBox(wxString::Format(_("Invalid memory value: %s"), hex), _("CodeLite"), wxICON_WARNING|wxOK);
                // update the pane to old value
                ManagerST::Get()->UpdateDebuggerPane();
                return;
            }
        }

        if (line.IsEmpty() == false) {
            memory << line << wxT(" ");
        }
    }

    // set the new memory
    memory = memory.Trim().Trim(false);
    ManagerST::Get()->SetMemory(m_textCtrlExpression->GetValue(), GetSize(), memory);

    // update the view
    ManagerST::Get()->UpdateDebuggerPane();
}
开发者ID:05storm26,项目名称:codelite,代码行数:35,代码来源:memoryview.cpp

示例5: GetVersion

double clClangFormatLocator::GetVersion(const wxString& clangFormat) const
{
    double double_version = 3.3;
#ifdef __WXGTK__
    //    Ubuntu clang-format version 3.5.0-4ubuntu2~trusty2 (tags/RELEASE_350/final) (based on LLVM 3.5.0) // Linux
    //    LLVM version 3.3 // Linux, old format
    //    clang-format version 3.6.0 (217570) // Windows
    double_version = 3.3;
    
    static wxRegEx reClangFormatVersion("version ([0-9]+\\.[0-9]+)");
    wxString command;
    command << clangFormat;
    ::WrapWithQuotes(command);
    command << " --version";
    wxString output = ProcUtils::SafeExecuteCommand(command);

    wxArrayString lines = ::wxStringTokenize(output, "\n", wxTOKEN_STRTOK);
    for(size_t i = 0; i < lines.GetCount(); ++i) {
        if(reClangFormatVersion.Matches(lines.Item(i))) {
            wxString version = reClangFormatVersion.GetMatch(lines.Item(i), 1);
            //wxLogMessage("clang-format version is %s", version);
            version.ToCDouble(&double_version);
            return double_version;
        }
    }
#elif defined(__WXMSW__)
    double_version = 3.6;
#else
    double_version = 3.5;
#endif
    return double_version; // Default
}
开发者ID:Alexpux,项目名称:codelite,代码行数:32,代码来源:clClangFormatLocator.cpp

示例6: Compact

wxString SvnLogHandler::Compact(const wxString& message)
{
    wxString compactMsg (message);
    compactMsg.Replace(wxT("\r\n"), wxT("\n"));
    compactMsg.Replace(wxT("\r"),   wxT("\n"));
    compactMsg.Replace(wxT("\v"),   wxT("\n"));
    wxArrayString lines = wxStringTokenize(compactMsg, wxT("\n"), wxTOKEN_STRTOK);
    compactMsg.Clear();
    for(size_t i=0; i<lines.GetCount(); i++) {
        wxString line = lines.Item(i);
        line.Trim().Trim(false);

        if(line.IsEmpty())
            continue;

        if(line.StartsWith(wxT("----------"))) {
            continue;
        }

        if(line == wxT("\"")) {
            continue;
        }
        static wxRegEx reRevisionPrefix(wxT("^(r[0-9]+)"));
        if(reRevisionPrefix.Matches(line)) {
            continue;
        }
        compactMsg << line << wxT("\n");
    }
    if(compactMsg.IsEmpty() == false) {
        compactMsg.RemoveLast();
    }
    return compactMsg;
}
开发者ID:05storm26,项目名称:codelite,代码行数:33,代码来源:svn_command_handlers.cpp

示例7: IsBusLabel

bool IsBusLabel( const wxString& aLabel )
{
    wxCHECK_MSG( busLabelRe.IsValid(), false,
                 wxT( "Invalid regular expression in IsBusLabel()." ) );

    return busLabelRe.Matches( aLabel );
}
开发者ID:cpavlina,项目名称:kicad,代码行数:7,代码来源:class_netlist_object.cpp

示例8: SortReferences

/**
 * Compare two references (e.g. "R100", "R19") and perform a 'natural' sort
 * This sorting must preserve numerical order rather than alphabetical
 * e.g. "R100" is lower (alphabetically) than "R19"
 * BUT should be placed after R19
 */
int BOM_TABLE_GROUP::SortReferences( const wxString& aFirst, const wxString& aSecond )
{
    // Default sorting
    int defaultSort = aFirst.Cmp( aSecond );

    static const wxString REGEX_STRING = "^([a-zA-Z]+)(\\d+)$";

    // Compile regex statically
    static wxRegEx regexFirst( REGEX_STRING, wxRE_ICASE | wxRE_ADVANCED );
    static wxRegEx regexSecond( REGEX_STRING, wxRE_ICASE | wxRE_ADVANCED );

    if( !regexFirst.Matches( aFirst ) || !regexSecond.Matches( aSecond ) )
    {
        return defaultSort;
    }

    // First priority is to order by prefix
    wxString prefixFirst  = regexFirst.GetMatch( aFirst, 1 );
    wxString prefixSecond = regexSecond.GetMatch( aSecond, 1 );

    if( prefixFirst.CmpNoCase( prefixSecond ) != 0 ) // Different prefixes!
    {
        return defaultSort;
    }

    wxString numStrFirst   = regexFirst.GetMatch( aFirst, 2 );
    wxString numStrSecond  = regexSecond.GetMatch( aSecond, 2 );

    // If either match failed, just return normal string comparison
    if( numStrFirst.IsEmpty() || numStrSecond.IsEmpty() )
    {
        return defaultSort;
    }

    // Convert each number string to an integer
    long numFirst    = 0;
    long numSecond   = 0;

    // If either conversion fails, return normal string comparison
    if( !numStrFirst.ToLong( &numFirst ) || !numStrSecond.ToLong( &numSecond ) )
    {
        return defaultSort;
    }

    return (int) (numFirst - numSecond);
}
开发者ID:cpavlina,项目名称:kicad,代码行数:52,代码来源:bom_table_model.cpp

示例9: OnTernOutput

void clTernServer::OnTernOutput(clProcessEvent& event)
{
    static wxRegEx rePort("Listening on port ([0-9]+)");
    if(rePort.IsValid() && rePort.Matches(event.GetOutput())) {
        wxString strPort = rePort.GetMatch(event.GetOutput(), 1);
        strPort.ToCLong(&m_port);
    }
    PrintMessage(event.GetOutput());
}
开发者ID:anatooly,项目名称:codelite,代码行数:9,代码来源:clTernServer.cpp

示例10: GetGCCVersion

wxString CompilerLocatorCygwin::GetGCCVersion(const wxString& gccBinary)
{
    static wxRegEx reVersion("([0-9]+\\.[0-9]+\\.[0-9]+)");
    wxString command;
    command << gccBinary << " --version";
    wxString versionString = ProcUtils::SafeExecuteCommand(command);
    if ( !versionString.IsEmpty() && reVersion.Matches( versionString ) ) {
        return reVersion.GetMatch( versionString );
    }
    return wxEmptyString;
}
开发者ID:292388900,项目名称:codelite,代码行数:11,代码来源:CompilerLocatorCygwin.cpp

示例11: AppendLine

void CppCheckReportPage::AppendLine(const wxString& line)
{
    wxString tmpLine(line);

    // Locate status messages:
    // 6/7 files checked 85% done
    static wxRegEx reProgress(wxT("([0-9]+)/([0-9]+)( files checked )([0-9]+%)( done)"));
    static wxRegEx reFileName(wxT("(Checking )([a-zA-Z:]{0,2}[ a-zA-Z\\.0-9_/\\+\\-]+ *)"));

    // Locate the progress messages and update our progress bar
    wxArrayString arrLines = wxStringTokenize(tmpLine, wxT("\n\r"), wxTOKEN_STRTOK);
    for(size_t i = 0; i < arrLines.GetCount(); i++) {

        if(reProgress.Matches(arrLines.Item(i))) {

            // Get the current progress
            wxString currentLine = reProgress.GetMatch(arrLines.Item(i), 1);

            long fileNo(0);
            currentLine.ToLong(&fileNo);
        }

        if(reFileName.Matches(arrLines.Item(i))) {

            // Get the file name
            wxString filename = reFileName.GetMatch(arrLines.Item(i), 2);
            m_mgr->SetStatusMessage("CppCheck: checking file " + filename);
        }
    }

    // Remove progress messages from the printed output
    reProgress.ReplaceAll(&tmpLine, wxEmptyString);
    tmpLine.Replace(wxT("\r"), wxT(""));
    tmpLine.Replace(wxT("\n\n"), wxT("\n"));

    m_stc->SetReadOnly(false);
    m_stc->AppendText(tmpLine);
    m_stc->SetReadOnly(true);

    m_stc->ScrollToLine(m_stc->GetLineCount() - 1);
}
开发者ID:GaganJotSingh,项目名称:codelite,代码行数:41,代码来源:cppcheckreportpage.cpp

示例12: GetLineNumberFromFilter

void OpenResourceDialog::GetLineNumberFromFilter(const wxString& filter, wxString& modFilter, long& lineNumber)
{
    modFilter = filter;
    lineNumber = -1;
    static wxRegEx reNumber(":([0-9]+)", wxRE_ADVANCED);
    if(reNumber.IsValid() && reNumber.Matches(modFilter)) {
        wxString strLineNumber;
        strLineNumber = reNumber.GetMatch(modFilter, 1);
        strLineNumber.ToCLong(&lineNumber);
        reNumber.Replace(&modFilter, "");
    }
}
开发者ID:stahta01,项目名称:codelite,代码行数:12,代码来源:open_resource_dialog.cpp

示例13: OnDclick

void DisassemblyTextCtrl::OnDclick(wxMouseEvent& event)
{

        if(GetStatus())
        {
            SetStatus(0);
           PluginsArray plugins = Manager::Get()->GetPluginManager()->GetDebuggerOffers();
            if (plugins.GetCount())
            {
                cbDebuggerPlugin* dbg = (cbDebuggerPlugin*)plugins[0];
                if (dbg)
                {
                    // is the debugger running?
                    if (dbg->IsRunning())
                    {
                        dbg->StepByStep();
                    }
                }
            }
        }
        int LineNum = GetCurrentLine();
        int L2 = GetCurrentLine();
        wxString LineText,SourceFile;
       unsigned long SourceLine=0;

        while(LineNum > 0)
        {
            LineText = GetLine(LineNum--);
            if(reRelativePath.Matches(LineText))
            break;
        }

        if(LineText.IsEmpty())
        return ;

        LineText.AfterLast(_T(':')).ToULong(&SourceLine,10);
        SourceFile = Manager::Get()->GetProjectManager()->GetActiveProject()->GetBasePath();
        SourceFile  <<  LineText.Before(_T(':'));



        SyncEditor(LineText.Before(_T(':')),SourceLine,true);

        SetReadOnly(false);
        MarkerDeleteAll(DEBUG_MARKER);
        MarkerAdd(SourceLine,DEBUG_MARKER);


        SetReadOnly(true);
    //wxMessageBox(wxString::Format(_T("%s:%d"),SourceFile.c_str(),SourceLine));
     event.Skip();

}
开发者ID:yjdwbj,项目名称:cb10-05-ide,代码行数:53,代码来源:disassemblytextctrl.cpp

示例14: SearchEntryNames

void CMP_LIBRARY::SearchEntryNames( wxArrayString& aNames, const wxRegEx& aRe, bool aSort )
{
    if( !aRe.IsValid() )
        return;

    LIB_ALIAS_MAP::iterator it;

    for( it=aliases.begin();  it!=aliases.end();  it++ )
    {
        if( aRe.Matches( (*it).second->GetKeyWords() ) )
            aNames.Add( (*it).first );
    }

    if( aSort )
        aNames.Sort();
}
开发者ID:peabody124,项目名称:kicad,代码行数:16,代码来源:class_library.cpp

示例15: IsIncludeOrRequireStatement

bool PHPEditorContextMenu::IsIncludeOrRequireStatement(wxString& includeWhat)
{
    // Do a basic check to see whether this line is include statement or not.
    // Don't bother in full parsing the file since it can be a quite an expensive operation
    // (include|require_once|require|include_once)[ \t\\(]*(.*?)[\\) \t)]*;
    static wxRegEx reInclude(wxT("(include|require_once|require|include_once)[ \t\\(]*(.*?)[\\) \t]*;"), wxRE_ADVANCED);

    IEditor* editor = m_manager->GetActiveEditor();
    if(!editor) return false;

    wxString line = editor->GetCtrl()->GetLine(editor->GetCurrentLine());
    if(reInclude.IsValid() && reInclude.Matches(line)) {
        includeWhat = reInclude.GetMatch(line, 2);
        return true;
    }
    return false;
}
开发者ID:MaartenBent,项目名称:codelite,代码行数:17,代码来源:php_editor_context_menu.cpp


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