本文整理汇总了C++中CompilerPtr::GetErrLineNumberIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ CompilerPtr::GetErrLineNumberIndex方法的具体用法?C++ CompilerPtr::GetErrLineNumberIndex怎么用?C++ CompilerPtr::GetErrLineNumberIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CompilerPtr
的用法示例。
在下文中一共展示了CompilerPtr::GetErrLineNumberIndex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnBuildWindowDClick
void OutputPane::OnBuildWindowDClick(const wxString &line, int lineno)
{
wxString fileName, strLineNumber;
bool match = false;
//get the selected compiler for the current line that was DClicked
if(lineno >= (int)m_buildLineInfo.GetCount()){
return;
}
//find the project selected build configuration for the workspace selected
//configuration
wxString projectName = m_buildLineInfo.Item(lineno);
if(projectName.IsEmpty())
return;
BuildMatrixPtr matrix = ManagerST::Get()->GetWorkspaceBuildMatrix();
wxString projecBuildConf = matrix->GetProjectSelectedConf(matrix->GetSelectedConfigurationName(),
projectName );
ProjectSettingsPtr settings = ManagerST::Get()->GetProject(projectName)->GetSettings();
if(!settings)
{
return;
}
BuildConfigPtr bldConf = settings->GetBuildConfiguration(projecBuildConf);
if( !bldConf )
{
return;
}
wxString cmpType = bldConf->GetCompilerType();
CompilerPtr cmp = BuildSettingsConfigST::Get()->GetCompiler(cmpType);
if( !cmp )
{
return;
}
long idx;
//try to match an error pattern to the line
RegexProcessor re(cmp->GetErrPattern());
cmp->GetErrFileNameIndex().ToLong(&idx);
if(re.GetGroup(line, idx, fileName))
{
//we found the file name, get the line number
cmp->GetErrLineNumberIndex().ToLong(&idx);
re.GetGroup(line, idx, strLineNumber);
match = true;
}
//try to match warning pattern
if(!match)
{
RegexProcessor re(cmp->GetWarnPattern());
cmp->GetWarnFileNameIndex().ToLong(&idx);
if(re.GetGroup(line, idx, fileName))
{
//we found the file name, get the line number
cmp->GetWarnLineNumberIndex().ToLong(&idx);
re.GetGroup(line, idx, strLineNumber);
match = true;
}
}
if(match)
{
long lineNumber = -1;
strLineNumber.ToLong(&lineNumber);
// open the file in the editor
// get the project name that is currently being built
wxString projName(wxEmptyString);
if(lineno < (int)m_buildLineInfo.GetCount())
{
projName = m_buildLineInfo.Item(lineno);
}
// if no project found, dont do anything
if(projName.IsEmpty())
{
return;
}
DirSaver ds;
ProjectPtr pro = ManagerST::Get()->GetProject(projName);
::wxSetWorkingDirectory(pro->GetFileName().GetPath());
wxFileName fn(fileName);
fn.MakeAbsolute(pro->GetFileName().GetPath());
ManagerST::Get()->OpenFile(fn.GetFullPath(), projName, lineNumber - 1 );
}
}