本文整理汇总了C++中wxRegEx::IsValid方法的典型用法代码示例。如果您正苦于以下问题:C++ wxRegEx::IsValid方法的具体用法?C++ wxRegEx::IsValid怎么用?C++ wxRegEx::IsValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxRegEx
的用法示例。
在下文中一共展示了wxRegEx::IsValid方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: IsBusLabel
bool IsBusLabel( const wxString& aLabel )
{
wxCHECK_MSG( busLabelRe.IsValid(), false,
wxT( "Invalid regular expression in IsBusLabel()." ) );
return busLabelRe.Matches( aLabel );
}
示例3: 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());
}
示例4: 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, "");
}
}
示例5: 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();
}
示例6: 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;
}
示例7: BreakpointHit
// When a a breakpoint is hit, see if it's got a command-list that needs faking
void BreakptMgr::BreakpointHit(int id)
{
int index = FindBreakpointById(id, m_bps);
if ((index == wxNOT_FOUND) || (index >= FIRST_INTERNAL_ID)) {
return;
}
BreakpointInfo bp = m_bps.at(index);
if (! bp.commandlist.IsEmpty()) {
IDebugger *dbgr = DebuggerMgr::Get().GetActiveDebugger();
if (dbgr && dbgr->IsRunning()) {
// A likely command, presumably at the end of the command-list, is 'continue' or 'cont'
// Filter this out and do it separately, otherwise Manager::UpdateLostControl isn't called to blank the indicator
static wxRegEx reContinue(wxT("(([[:space:]]|(^))((cont$)|(continue)))"));
bool needsCont = false;
wxString commands = bp.commandlist;
if (reContinue.IsValid() && reContinue.Matches(commands)) {
size_t start, len;
if (reContinue.GetMatch(&start,&len)) {
commands = commands.Left(start);
needsCont = true;
}
}
if (! commands.IsEmpty()) { // Just in case someone's _only_ command is 'continue' !
dbgr->ExecuteCmd(commands);
}
if (needsCont) {
dbgr->Continue();
}
}
}
if (bp.bp_type == BP_type_tempbreak) {
// If this is a temporary bp, remove it from m_bps now it's been hit
// Otherwise it will be treated as a 'Pending' bp, the button will be displayed
// and, if clicked, the bp will be resurrected.
int index = FindBreakpointById(id, m_bps);
if (index != wxNOT_FOUND) {
m_bps.erase(m_bps.begin()+index);
}
}
}
示例8: FormatComment
//.........这里部分代码省略.........
}
matchPattern.Replace(wxT("\t"), wxT(" "));
while(matchPattern.Replace(wxT(" "), wxT(" "))) {
}
matchPattern.Trim().Trim(false);
// BUG#3082954: limit the size of the 'match pattern' to a reasonable size (200 chars)
matchPattern = TagsManagerST::Get()->WrapLines(matchPattern);
matchPattern.Replace(GetName(), wxT("<b>") + GetName() + wxT("</b>"));
m_formattedComment << wxT("<code>") << matchPattern << wxT("</code>\n");
}
// Add comment section
wxString tagComment;
if(!GetFile().IsEmpty()) {
CommentParseResult comments;
::ParseComments(GetFile().mb_str(wxConvUTF8).data(), comments);
// search for comment in the current line, the line above it and 2 above it
// use the first match we got
for(size_t i = 0; i < 3; i++) {
wxString comment = comments.getCommentForLine(GetLine()-i);
if(!comment.IsEmpty()) {
SetComment(comment);
break;
}
}
}
if(!GetComment().IsEmpty()) {
wxString theComment;
theComment = GetComment();
theComment = TagsManagerST::Get()->WrapLines(theComment);
theComment.Trim(false);
wxString tagComment = wxString::Format(wxT("%s\n"), theComment.c_str());
if(m_formattedComment.IsEmpty() == false) {
m_formattedComment.Trim().Trim(false);
m_formattedComment << wxT("\n<hr>");
}
m_formattedComment << tagComment;
}
// Update all "doxy" comments and surround them with <green> tags
static wxRegEx reDoxyParam("([@\\\\]{1}param)[ \t]+([_a-z][a-z0-9_]*)?", wxRE_DEFAULT | wxRE_ICASE);
static wxRegEx reDoxyBrief("([@\\\\]{1}(brief|details))[ \t]*", wxRE_DEFAULT | wxRE_ICASE);
static wxRegEx reDoxyThrow("([@\\\\]{1}(throw|throws))[ \t]*", wxRE_DEFAULT | wxRE_ICASE);
static wxRegEx reDoxyReturn("([@\\\\]{1}(return|retval|returns))[ \t]*", wxRE_DEFAULT | wxRE_ICASE);
static wxRegEx reDoxyToDo("([@\\\\]{1}todo)[ \t]*", wxRE_DEFAULT | wxRE_ICASE);
static wxRegEx reDoxyRemark("([@\\\\]{1}(remarks|remark))[ \t]*", wxRE_DEFAULT | wxRE_ICASE);
static wxRegEx reDate("([@\\\\]{1}date)[ \t]*", wxRE_DEFAULT | wxRE_ICASE);
static wxRegEx reFN("([@\\\\]{1}fn)[ \t]*", wxRE_DEFAULT | wxRE_ICASE);
if(reDoxyParam.IsValid() && reDoxyParam.Matches(m_formattedComment)) {
reDoxyParam.ReplaceAll(&m_formattedComment, "\n<b>Parameter</b>\n<i>\\2</i>");
}
if(reDoxyBrief.IsValid() && reDoxyBrief.Matches(m_formattedComment)) {
reDoxyBrief.ReplaceAll(&m_formattedComment, "");
}
if(reDoxyThrow.IsValid() && reDoxyThrow.Matches(m_formattedComment)) {
reDoxyThrow.ReplaceAll(&m_formattedComment, "\n<b>Throws</b>\n");
}
if(reDoxyReturn.IsValid() && reDoxyReturn.Matches(m_formattedComment)) {
reDoxyReturn.ReplaceAll(&m_formattedComment, "\n<b>Returns</b>\n");
}
if(reDoxyToDo.IsValid() && reDoxyToDo.Matches(m_formattedComment)) {
reDoxyToDo.ReplaceAll(&m_formattedComment, "\n<b>TODO</b>\n");
}
if(reDoxyRemark.IsValid() && reDoxyRemark.Matches(m_formattedComment)) {
reDoxyRemark.ReplaceAll(&m_formattedComment, "\n ");
}
if(reDate.IsValid() && reDate.Matches(m_formattedComment)) {
reDate.ReplaceAll(&m_formattedComment, "<b>Date</b> ");
}
if(reFN.IsValid() && reFN.Matches(m_formattedComment)) {
size_t fnStart, fnLen, fnEnd;
if(reFN.GetMatch(&fnStart, &fnLen)) {
fnEnd = m_formattedComment.find('\n', fnStart);
if(fnEnd != wxString::npos) {
// remove the string from fnStart -> fnEnd (including ther terminating \n)
m_formattedComment.Remove(fnStart, (fnEnd - fnStart) + 1);
}
}
}
// if nothing to display skip this
m_formattedComment.Trim().Trim(false);
return m_formattedComment;
}
示例9: ParseCDBWatchValue
bool ParseCDBWatchValue(cb::shared_ptr<GDBWatch> watch, wxString const &value)
{
wxArrayString lines = GetArrayFromString(value, wxT('\n'));
watch->SetDebugValue(value);
watch->MarkChildsAsRemoved();
if (lines.GetCount() == 0)
return false;
static wxRegEx unexpected_error(wxT("^Unexpected token '.+'$"));
static wxRegEx resolve_error(wxT("^Couldn't resolve error at '.+'$"));
// search for errors
for (unsigned ii = 0; ii < lines.GetCount(); ++ii)
{
if (unexpected_error.Matches(lines[ii])
|| resolve_error.Matches(lines[ii])
|| lines[ii] == wxT("No pointer for operator* '<EOL>'"))
{
watch->SetValue(lines[ii]);
return true;
}
}
if (lines.GetCount() == 1)
{
wxArrayString tokens = GetArrayFromString(lines[0], wxT(' '));
if (tokens.GetCount() < 2)
return false;
int type_token = 0;
if (tokens[0] == wxT("class") || tokens[0] == wxT("struct"))
type_token = 1;
if (static_cast<int>(tokens.GetCount()) < type_token + 2)
return false;
int value_start = type_token + 1;
if (tokens[type_token + 1] == wxT('*'))
{
watch->SetType(tokens[type_token] + tokens[type_token + 1]);
value_start++;
}
else
watch->SetType(tokens[type_token]);
if(value_start >= static_cast<int>(tokens.GetCount()))
return false;
watch->SetValue(tokens[value_start]);
watch->RemoveMarkedChildren();
return true;
}
else
{
wxArrayString tokens = GetArrayFromString(lines[0], wxT(' '));
if (tokens.GetCount() < 2)
return false;
bool set_type = true;
if (tokens.GetCount() > 2)
{
if (tokens[0] == wxT("struct") || tokens[0] == wxT("class"))
{
if (tokens[2] == wxT('*') || tokens[2].StartsWith(wxT("[")))
{
watch->SetType(tokens[1] + tokens[2]);
set_type = false;
}
}
else
{
if (tokens[1] == wxT('*') || tokens[1].StartsWith(wxT("[")))
{
watch->SetType(tokens[0] + tokens[1]);
watch->SetValue(lines[1]);
return true;
}
}
}
if (set_type)
watch->SetType(tokens[1]);
static wxRegEx class_line(wxT("[ \\t]*\\+(0x[0-9a-f]+)[ \\t]([a-zA-Z0-9_]+)[ \\t]+:[ \\t]+(.+)"));
if (!class_line.IsValid())
{
int *p = NULL;
*p = 0;
}
else
{
if (!class_line.Matches(wxT(" +0x000 a : 10")))
{
int *p = NULL;
*p = 0;
}
}
//.........这里部分代码省略.........