本文整理汇总了C++中ProjectPtr::GetPreProcessors方法的典型用法代码示例。如果您正苦于以下问题:C++ ProjectPtr::GetPreProcessors方法的具体用法?C++ ProjectPtr::GetPreProcessors怎么用?C++ ProjectPtr::GetPreProcessors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProjectPtr
的用法示例。
在下文中一共展示了ProjectPtr::GetPreProcessors方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoGetCommand
wxString CppCheckPlugin::DoGetCommand(ProjectPtr proj)
{
// Linux / Mac way: spawn the process and execute the command
wxString cmd, path;
path = clStandardPaths::Get().GetBinaryFullPath("codelite_cppcheck");
::WrapWithQuotes(path);
wxString fileList = DoGenerateFileList();
if(fileList.IsEmpty()) return wxT("");
// build the command
cmd << path << " ";
cmd << m_settings.GetOptions();
// Append here project specifc search paths
if(proj) {
wxArrayString projectSearchPaths = proj->GetIncludePaths();
for(size_t i = 0; i < projectSearchPaths.GetCount(); ++i) {
wxFileName fnIncPath(projectSearchPaths.Item(i), "");
wxString includePath = fnIncPath.GetPath(true);
::WrapWithQuotes(includePath);
cmd << " -I" << includePath;
}
wxArrayString projMacros = proj->GetPreProcessors();
for(size_t i = 0; i < projMacros.GetCount(); ++i) {
cmd << " -D" << projMacros.Item(i);
}
}
cmd << wxT(" --file-list=");
cmd << wxT("\"") << fileList << wxT("\"");
CL_DEBUG("cppcheck command: %s", cmd);
return cmd;
}
示例2: GetDefinitionsAndSearchPaths
bool CodeCompletionManager::GetDefinitionsAndSearchPaths(LEditor* editor,
wxArrayString& searchPaths,
wxArrayString& definitions)
{
// Sanity
CHECK_PTR_RET_FALSE(editor);
if(editor->GetProjectName().IsEmpty())
return false;
if(!WorkspaceST::Get()->IsOpen())
return false;
// Support only C/C++ files
if(!FileExtManager::IsCxxFile(editor->GetFileName().GetFullName()))
return false;
// Get the file's project and get the build configuration settings
// for it
ProjectPtr proj = WorkspaceST::Get()->GetProject(editor->GetProjectName());
CHECK_PTR_RET_FALSE(proj);
BuildConfigPtr buildConf = proj->GetBuildConfiguration();
CHECK_PTR_RET_FALSE(buildConf);
CompilerPtr compiler = buildConf->GetCompiler();
CHECK_PTR_RET_FALSE(compiler);
if(buildConf->IsCustomBuild()) {
// Custom builds are handled differently
CompilationDatabase compileDb;
compileDb.Open();
if(compileDb.IsOpened()) {
// we have compilation database for this workspace
wxString compileLine, cwd;
compileDb.CompilationLine(editor->GetFileName().GetFullPath(), compileLine, cwd);
CL_DEBUG("Pre Processor dimming: %s\n", compileLine);
CompilerCommandLineParser cclp(compileLine, cwd);
searchPaths = cclp.GetIncludes();
// get the mcros
definitions = cclp.GetMacros();
} else {
// we will probably will fail...
return false;
}
} else {
// get the include paths based on the project settings (this is per build configuration)
searchPaths = proj->GetIncludePaths();
CL_DEBUG("CxxPreProcessor will use the following include paths:");
CL_DEBUG_ARR(searchPaths);
// get the compiler include paths
// wxArrayString compileIncludePaths = compiler->GetDefaultIncludePaths();
// includePaths.insert(includePaths.end(), compileIncludePaths.begin(), compileIncludePaths.end());
definitions = proj->GetPreProcessors();
CL_DEBUG("CxxPreProcessor will use the following macros:");
CL_DEBUG_ARR(definitions);
}
// Append the compiler builtin macros
wxArrayString builtinMacros = compiler->GetBuiltinMacros();
definitions.insert(definitions.end(), builtinMacros.begin(), builtinMacros.end());
return true;
}
示例3: GetDefinitionsAndSearchPaths
bool CodeCompletionManager::GetDefinitionsAndSearchPaths(clEditor* editor, wxArrayString& searchPaths,
wxArrayString& definitions)
{
// Sanity
CHECK_PTR_RET_FALSE(editor);
if(editor->GetProjectName().IsEmpty()) return false;
if(!clCxxWorkspaceST::Get()->IsOpen()) return false;
// Support only C/C++ files
if(!FileExtManager::IsCxxFile(editor->GetFileName().GetFullName())) return false;
// Get the file's project and get the build configuration settings
// for it
ProjectPtr proj = clCxxWorkspaceST::Get()->GetProject(editor->GetProjectName());
CHECK_PTR_RET_FALSE(proj);
BuildConfigPtr buildConf = proj->GetBuildConfiguration();
CHECK_PTR_RET_FALSE(buildConf);
CompilerPtr compiler = buildConf->GetCompiler();
CHECK_PTR_RET_FALSE(compiler);
#if 0
if(buildConf->IsCustomBuild()) {
definitions = proj->GetPreProcessors();
CL_DEBUG("CxxPreProcessor will use the following macros:");
CL_DEBUG_ARR(definitions);
// Custom builds are handled differently
CompilationDatabase compileDb;
compileDb.Open();
if(compileDb.IsOpened()) {
// we have compilation database for this workspace
wxString compileLine, cwd;
compileDb.CompilationLine(editor->GetFileName().GetFullPath(), compileLine, cwd);
CL_DEBUG("Pre Processor dimming: %s\n", compileLine);
CompilerCommandLineParser cclp(compileLine, cwd);
searchPaths = cclp.GetIncludes();
// get the mcros
definitions << cclp.GetMacros();
}
}
#endif
// get the include paths based on the project settings (this is per build configuration)
searchPaths = proj->GetIncludePaths();
CL_DEBUG("CxxPreProcessor will use the following include paths:");
CL_DEBUG_ARR(searchPaths);
// get the compiler include paths
// wxArrayString compileIncludePaths = compiler->GetDefaultIncludePaths();
// includePaths.insert(includePaths.end(), compileIncludePaths.begin(), compileIncludePaths.end());
definitions = proj->GetPreProcessors();
// get macros out of workspace
wxString strWorkspaceMacros = clCxxWorkspaceST::Get()->GetParserMacros();
wxArrayString workspaceMacros = wxStringTokenize(strWorkspaceMacros, wxT("\n\r"), wxTOKEN_STRTOK);
for(size_t i = 0; i < workspaceMacros.GetCount(); i++)
definitions.Add(workspaceMacros.Item(i).Trim().Trim(false).c_str());
CL_DEBUG("CxxPreProcessor will use the following macros:");
CL_DEBUG_ARR(definitions);
// Append the compiler builtin macros
wxArrayString builtinMacros = compiler->GetBuiltinMacros();
definitions.insert(definitions.end(), builtinMacros.begin(), builtinMacros.end());
return true;
}