Code::Blocks
SVN r11506
|
Code::Blocks project file loader. More...
#include <projectloader.h>
Public Member Functions | |
ProjectLoader (cbProject *project) | |
Constructor. More... | |
~ProjectLoader () override | |
Destructor. More... | |
bool | Open (const wxString &filename) override |
Open a file. More... | |
bool | Save (const wxString &filename) override |
Save a file. More... | |
bool | Open (const wxString &filename, TiXmlElement **ppExtensions) |
Open a file. More... | |
bool | Save (const wxString &filename, TiXmlElement *pExtensions) |
Save a file. More... | |
bool | ExportTargetAsProject (const wxString &filename, const wxString &onlyTarget, TiXmlElement *pExtensions) |
Export a target as a new project. More... | |
bool | FileUpgraded () |
bool | FileModified () |
Public Member Functions inherited from IBaseLoader | |
IBaseLoader () | |
Constructor. More... | |
virtual | ~IBaseLoader () |
Destructor. More... | |
Protected Member Functions | |
void | DoProjectOptions (TiXmlElement *parentNode) |
void | DoCompilerOptions (TiXmlElement *parentNode, ProjectBuildTarget *target=nullptr) |
void | DoResourceCompilerOptions (TiXmlElement *parentNode, ProjectBuildTarget *target=nullptr) |
void | DoLinkerOptions (TiXmlElement *parentNode, ProjectBuildTarget *target=nullptr) |
void | DoIncludesOptions (TiXmlElement *parentNode, ProjectBuildTarget *target=nullptr) |
void | DoLibsOptions (TiXmlElement *parentNode, ProjectBuildTarget *target=nullptr) |
void | DoExtraCommands (TiXmlElement *parentNode, ProjectBuildTarget *target=nullptr) |
void | DoMakeCommands (TiXmlElement *parentNode, CompileTargetBase *target) |
void | DoVirtualTargets (TiXmlElement *parentNode) |
void | DoBuild (TiXmlElement *parentNode) |
void | DoBuildTarget (TiXmlElement *parentNode) |
void | DoBuildTargetOptions (TiXmlElement *parentNode, ProjectBuildTarget *target) |
void | DoEnvironment (TiXmlElement *parentNode, CompileOptionsBase *base) |
void | DoUnits (const TiXmlElement *parentNode) |
void | DoUnitOptions (const TiXmlElement *parentNode, ProjectFile *file) |
Private Member Functions | |
void | ConvertVersion_Pre_1_1 () |
void | ConvertLibraries (CompileTargetBase *object) |
TiXmlElement * | AddElement (TiXmlElement *parent, const char *name, const char *attr=nullptr, const wxString &attribute=wxEmptyString) |
TiXmlElement * | AddElement (TiXmlElement *parent, const char *name, const char *attr, int attribute) |
void | AddArrayOfElements (TiXmlElement *parent, const char *name, const char *attr, const wxArrayString &array, bool isPath=false) |
void | SaveEnvironment (TiXmlElement *parent, CompileOptionsBase *base) |
wxString | GetValidCompilerID (const wxString &proposal, const wxString &scope) |
ProjectLoader () | |
Private Attributes | |
cbProject * | m_pProject |
bool | m_Upgraded |
bool | m_OpenDirty |
bool | m_IsPre_1_2 |
int | m_1_4_to_1_5_deftarget |
bool | m_IsPre_1_6 |
CompilerSubstitutes | m_CompilerSubstitutes |
Code::Blocks project file loader.
Definition at line 22 of file projectloader.h.
ProjectLoader::ProjectLoader | ( | cbProject * | project | ) |
Constructor.
project | The project to handle (load/save). |
Definition at line 41 of file projectloader.cpp.
|
override |
Destructor.
Definition at line 51 of file projectloader.cpp.
|
inlineprivate |
Definition at line 104 of file projectloader.h.
|
private |
Definition at line 1168 of file projectloader.cpp.
References AddElement(), wxArrayString::GetCount(), UnixFilename(), and wxPATH_UNIX.
Referenced by ExportTargetAsProject().
|
private |
Definition at line 1146 of file projectloader.cpp.
References cbU2C().
Referenced by AddArrayOfElements(), ExportTargetAsProject(), and SaveEnvironment().
|
private |
Definition at line 1157 of file projectloader.cpp.
|
private |
Definition at line 288 of file projectloader.cpp.
References _T, wxArrayString::Add(), CompilerFactory::GetCompiler(), wxArrayString::GetCount(), Compiler::GetSwitches(), wxString::IsEmpty(), wxString::Length(), CompilerSwitches::libExtension, CompilerSwitches::libPrefix, CompilerSwitches::linkLibs, wxString::Remove(), wxArrayString::RemoveAt(), wxString::Right(), and wxString::StartsWith().
Referenced by ConvertVersion_Pre_1_1().
|
private |
Definition at line 265 of file projectloader.cpp.
References _(), wxString::c_str(), cbMessageBox(), ConvertLibraries(), cbProject::GetBuildTarget(), cbProject::GetBuildTargetsCount(), CompileTargetBase::GetTitle(), m_pProject, m_Upgraded, wxString::Printf(), wxICON_QUESTION, wxID_YES, and wxYES_NO.
Referenced by Open().
|
protected |
Definition at line 478 of file projectloader.cpp.
References CompileOptionsBase::AddBuildScript(), cbC2U(), DoBuildTarget(), DoEnvironment(), and m_pProject.
Referenced by Open().
|
protected |
Definition at line 498 of file projectloader.cpp.
References _T, cbProject::AddBuildTarget(), cbC2U(), LogManager::DebugLog(), DoBuildTargetOptions(), DoCompilerOptions(), DoEnvironment(), DoExtraCommands(), DoIncludesOptions(), DoLibsOptions(), DoLinkerOptions(), DoResourceCompilerOptions(), Manager::Get(), Manager::GetLogManager(), wxString::IsEmpty(), and m_pProject.
Referenced by DoBuild().
|
protected |
Definition at line 528 of file projectloader.cpp.
References CompileOptionsBase::AddBuildScript(), cbC2U(), DoMakeCommands(), CompileTargetBase::GetCompilerID(), GetPlatformsFromString(), CompileTargetBase::GetTitle(), GetValidCompilerID(), wxString::IsEmpty(), m_IsPre_1_2, m_pProject, ortCompilerOptions, ortIncludeDirs, ortLast, ortLibDirs, ortLinkerOptions, ortResDirs, ProjectBuildTarget::SetAdditionalOutputFiles(), CompileTargetBase::SetCompilerID(), ProjectBuildTarget::SetCreateDefFile(), ProjectBuildTarget::SetCreateStaticLib(), CompileTargetBase::SetDefinitionFileFilename(), CompileTargetBase::SetDepsOutput(), CompileTargetBase::SetExecutionParameters(), ProjectBuildTarget::SetExternalDeps(), CompileTargetBase::SetHostApplication(), CompileTargetBase::SetImportLibraryFilename(), ProjectBuildTarget::SetIncludeInTargetAll(), CompileTargetBase::SetObjectOutput(), CompileTargetBase::SetOptionRelation(), CompileTargetBase::SetOutputFilename(), CompileOptionsBase::SetPlatforms(), CompileTargetBase::SetRunHostApplicationInTerminal(), CompileTargetBase::SetTargetFilenameGenerationPolicy(), ProjectBuildTarget::SetTargetType(), ProjectBuildTarget::SetUseConsoleRunner(), CompileTargetBase::SetWorkingDir(), spAll, tgfpNone, tgfpPlatformDefault, UnixFilename(), and wxT.
Referenced by DoBuildTarget().
|
protected |
Definition at line 693 of file projectloader.cpp.
References CompileOptionsBase::AddCompilerOption(), CompileOptionsBase::AddIncludeDir(), cbC2U(), wxString::IsEmpty(), m_pProject, and UnixFilename().
Referenced by DoBuildTarget(), and Open().
|
protected |
Definition at line 873 of file projectloader.cpp.
References _T, cbC2U(), wxDir::GetAllFiles(), GetArrayFromString(), wxArrayString::GetCount(), FilesGroupsAndMasks::GetFileMasks(), wxFileName::GetFullPath(), FilesGroupsAndMasks::GetGroupsCount(), wxFileName::IsAbsolute(), wxString::IsEmpty(), wxFileName::MakeAbsolute(), wxFileName::MakeRelativeTo(), wxString::Matches(), CompileOptionsBase::SetVar(), UnixFilename(), wxDIR_DIRS, wxDIR_FILES, and wxEmptyString.
Referenced by DoBuild(), and DoBuildTarget().
|
protected |
Definition at line 835 of file projectloader.cpp.
References _T, CompileOptionsBase::AddCommandsAfterBuild(), CompileOptionsBase::AddCommandsBeforeBuild(), cbC2U(), wxString::IsEmpty(), m_pProject, and CompileOptionsBase::SetAlwaysRunPostBuildSteps().
Referenced by DoBuildTarget(), and Open().
|
protected |
Definition at line 791 of file projectloader.cpp.
References CompileOptionsBase::AddIncludeDir(), cbC2U(), wxString::IsEmpty(), m_pProject, and UnixFilename().
Referenced by DoBuildTarget(), and Open().
|
protected |
Definition at line 813 of file projectloader.cpp.
References CompileOptionsBase::AddLibDir(), cbC2U(), wxString::IsEmpty(), m_pProject, and UnixFilename().
Referenced by DoBuildTarget(), and Open().
|
protected |
Definition at line 753 of file projectloader.cpp.
References CompileOptionsBase::AddLibDir(), CompileOptionsBase::AddLinkerOption(), CompileOptionsBase::AddLinkLib(), cbC2U(), wxString::IsEmpty(), m_pProject, and UnixFilename().
Referenced by DoBuildTarget(), and Open().
|
protected |
Definition at line 327 of file projectloader.cpp.
References cbC2U(), mcAskRebuildNeeded, mcBuild, mcClean, mcCompileFile, mcDistClean, mcSilentBuild, and CompileTargetBase::SetMakeCommandFor().
Referenced by DoBuildTargetOptions(), and DoProjectOptions().
|
protected |
Definition at line 383 of file projectloader.cpp.
References _T, cbC2U(), DoMakeCommands(), DoVirtualTargets(), GetArrayFromString(), GetPlatformsFromString(), GetValidCompilerID(), wxString::IsEmpty(), m_1_4_to_1_5_deftarget, m_IsPre_1_2, m_pProject, pchObjectDir, pchSourceDir, cbProject::SetCheckForExternallyModifiedFiles(), cbProject::SetCompilerID(), cbProject::SetDefaultExecuteTarget(), cbProject::SetExtendedObjectNamesGeneration(), cbProject::SetMakefile(), cbProject::SetMakefileCustom(), cbProject::SetMakefileExecutionDir(), cbProject::SetModeForPCH(), cbProject::SetNotes(), CompileOptionsBase::SetPlatforms(), cbProject::SetShowNotesOnLoad(), cbProject::SetTitle(), cbProject::SetVirtualFolders(), spAll, wxString::Trim(), and UnixFilename().
Referenced by Open().
|
protected |
Definition at line 723 of file projectloader.cpp.
References CompileOptionsBase::AddResourceCompilerOption(), CompileOptionsBase::AddResourceIncludeDir(), cbC2U(), wxString::IsEmpty(), m_pProject, and UnixFilename().
Referenced by DoBuildTarget(), and Open().
|
protected |
Definition at line 1048 of file projectloader.cpp.
References _T, ProjectFile::AddBuildTarget(), cbC2U(), ProjectFile::compile, ProjectFile::compilerVar, ProjectFile::generatedFiles, cbProject::GetBuildTarget(), cbProject::GetBuildTargetsCount(), CompileTargetBase::GetTitle(), wxString::IsEmpty(), wxString::IsSameAs(), ProjectFile::link, m_IsPre_1_6, m_pProject, wxString::Replace(), ProjectFile::SetCustomBuildCommand(), ProjectFile::SetUseCustomBuildCommand(), UnixFilename(), ProjectFile::virtual_path, and ProjectFile::weight.
Referenced by DoUnits().
|
protected |
Definition at line 983 of file projectloader.cpp.
References _T, cbProject::AddFile(), cbProject::BeginAddFiles(), cbC2U(), LogManager::DebugLog(), DoUnitOptions(), cbProject::EndAddFiles(), F(), Manager::Get(), CompileTargetBase::GetBasePath(), Manager::GetLogManager(), wxString::IsEmpty(), m_pProject, cbProject::SetGlobs(), and UnixFilename().
Referenced by Open().
|
protected |
Definition at line 359 of file projectloader.cpp.
References _T, cbC2U(), cbProject::DefineVirtualBuildTarget(), GetArrayFromString(), and m_pProject.
Referenced by DoProjectOptions().
bool ProjectLoader::ExportTargetAsProject | ( | const wxString & | filename, |
const wxString & | onlyTarget, | ||
TiXmlElement * | pExtensions | ||
) |
Export a target as a new project.
In other words, save a copy of the project containing only the specified target.
filename | The new project filename. |
pExtensions | A pointer of type TiXmlElement. This will be added as the <Extensions> element. |
onlyTarget | The target name. If empty, it's like saving the project under a different name (i.e. all targets are exported to the new project). |
Definition at line 1219 of file projectloader.cpp.
References _T, AddArrayOfElements(), AddElement(), wxString::AfterLast(), ProjectFile::AutoGeneratedBy(), pfCustomBuild::buildCommand, ProjectFile::buildTargets, FileFilters::C_EXT, ProjectLoaderHooks::CallHooks(), cbSaveTinyXMLDocument(), cbU2C(), wxFileName::ClearExt(), ProjectFile::CompareProjectFiles(), ProjectFile::compile, ProjectFile::compilerVar, ProjectFile::customBuild, FileTypeOf(), ftObject, ftResource, ftResourceBin, ftSource, ftStaticLib, ProjectBuildTarget::GetAdditionalOutputFiles(), CompileOptionsBase::GetAlwaysRunPostBuildSteps(), CompileTargetBase::GetBasePath(), CompileOptionsBase::GetBuildScripts(), cbProject::GetBuildTarget(), cbProject::GetBuildTargetsCount(), cbProject::GetCheckForExternallyModifiedFiles(), CompileOptionsBase::GetCommandsAfterBuild(), CompileOptionsBase::GetCommandsBeforeBuild(), CompilerFactory::GetCompiler(), CompileTargetBase::GetCompilerID(), CompileOptionsBase::GetCompilerOptions(), wxArrayString::GetCount(), ProjectBuildTarget::GetCreateDefFile(), ProjectBuildTarget::GetCreateStaticLib(), cbProject::GetDefaultExecuteTarget(), CompileTargetBase::GetDepsOutput(), CompileTargetBase::GetDynamicLibDefFilename(), CompileTargetBase::GetDynamicLibImportFilename(), CompileTargetBase::GetExecutionParameters(), cbProject::GetExtendedObjectNamesGeneration(), ProjectBuildTarget::GetExternalDeps(), ProjectBuildTarget::GetFilesList(), cbProject::GetFilesList(), cbProject::GetFirstValidBuildTargetName(), wxFileName::GetFullName(), wxFileName::GetFullPath(), cbProject::GetGlobs(), CompileTargetBase::GetHostApplication(), CompileOptionsBase::GetIncludeDirs(), CompileOptionsBase::GetLibDirs(), CompileOptionsBase::GetLinkerOptions(), CompileOptionsBase::GetLinkLibs(), CompileTargetBase::GetMakeCommandFor(), cbProject::GetMakefile(), cbProject::GetMakefileExecutionDir(), cbProject::GetModeForPCH(), cbProject::GetNotes(), CompileTargetBase::GetObjectOutput(), CompileTargetBase::GetOptionRelation(), CompileTargetBase::GetOutputFilename(), CompileOptionsBase::GetPlatforms(), CompileOptionsBase::GetResourceCompilerOptions(), CompileOptionsBase::GetResourceIncludeDirs(), CompileTargetBase::GetRunHostApplicationInTerminal(), cbProject::GetShowNotesOnLoad(), GetStringFromArray(), GetStringFromPlatforms(), Compiler::GetSwitches(), CompileTargetBase::GetTargetFilenameGenerationPolicy(), CompileTargetBase::GetTargetType(), CompileTargetBase::GetTitle(), ProjectBuildTarget::GetUseConsoleRunner(), cbProject::GetVirtualBuildTargetGroup(), cbProject::GetVirtualBuildTargets(), cbProject::GetVirtualFolders(), CompileTargetBase::GetWorkingDir(), ProjectLoaderHooks::HasRegisteredHooks(), wxString::IsEmpty(), cbProject::IsMakefileCustom(), wxString::IsSameAs(), wxArrayString::Item(), CompilerSwitches::libPrefix, ProjectFile::link, wxString::Lower(), cbProject::Glob::m_Path, m_pProject, cbProject::Glob::m_Recursive, cbProject::Glob::m_WildCard, CompileTargetBase::MakeCommandsModified(), wxString::mb_str(), mcAskRebuildNeeded, mcBuild, mcClean, mcCompileFile, mcDistClean, mcSilentBuild, wxString::Mid(), ortCompilerOptions, ortIncludeDirs, ortLibDirs, ortLinkerOptions, ortResDirs, pchObjectDir, PROJECT_FILE_VERSION_MAJOR, PROJECT_FILE_VERSION_MINOR, ProjectFile::relativeFilename, wxString::Replace(), FileFilters::RESOURCE_EXT, SaveEnvironment(), wxFileName::SetFullName(), spAll, tgfpPlatformDefault, ttCommandsOnly, ttConsoleOnly, ttDynamicLib, ttStaticLib, UnixFilename(), pfCustomBuild::useCustomBuildCommand, ProjectFile::virtual_path, ProjectFile::weight, wxPATH_UNIX, and wxT.
Referenced by cbProject::ExportTargetAsProject(), and Save().
|
inline |
Definition at line 70 of file projectloader.h.
References wxEmptyString.
Referenced by cbProject::Open().
|
inline |
Definition at line 67 of file projectloader.h.
Referenced by cbProject::Open().
|
private |
Definition at line 1619 of file projectloader.cpp.
References _(), _T, wxString::c_str(), Manager::Get(), CompilerFactory::GetCompiler(), wxString::IsEmpty(), m_CompilerSubstitutes, m_OpenDirty, wxString::Printf(), CompilerFactory::SelectCompilerUI(), and wxString::ToLong().
Referenced by DoBuildTargetOptions(), and DoProjectOptions().
|
overridevirtual |
Open a file.
filename | The file to open. |
Implements IBaseLoader.
Definition at line 56 of file projectloader.cpp.
Referenced by cbProject::Open().
bool ProjectLoader::Open | ( | const wxString & | filename, |
TiXmlElement ** | ppExtensions | ||
) |
Open a file.
This version of Open, will return a copy of the <Extensions> element (if found).
filename | The file to open. |
ppExtensions | A pointer to a pointer of type TiXmlElement. This is where the copy of the <Extensions> element will be placed. |
Definition at line 61 of file projectloader.cpp.
References _(), _T, wxArrayString::Add(), ProjectLoaderHooks::CallHooks(), ConvertVersion_Pre_1_1(), LogManager::DebugLog(), cbProject::DefineVirtualBuildTarget(), DoBuild(), DoCompilerOptions(), DoExtraCommands(), DoIncludesOptions(), DoLibsOptions(), DoLinkerOptions(), DoProjectOptions(), DoResourceCompilerOptions(), DoUnits(), F(), wxString::Format(), Manager::Get(), cbProject::GetBuildTarget(), cbProject::GetBuildTargetsCount(), wxArrayString::GetCount(), ProjectBuildTarget::GetIncludeInTargetAll(), Manager::GetLogManager(), CompileTargetBase::GetTitle(), cbProject::HasVirtualBuildTarget(), Manager::IsBatchBuild(), wxString::IsEmpty(), TinyXML::LoadDocument(), m_1_4_to_1_5_deftarget, m_IsPre_1_2, m_IsPre_1_6, m_pProject, m_Upgraded, AnnoyingDialog::OK, wxString::Prepend(), PROJECT_FILE_VERSION_MAJOR, PROJECT_FILE_VERSION_MINOR, cbProject::SetDefaultExecuteTarget(), AnnoyingDialog::ShowModal(), wxStopWatch::Time(), CfgMgrConsts::version, wxART_INFORMATION, and wxART_WARNING.
|
overridevirtual |
Save a file.
filename | The file to save. |
Implements IBaseLoader.
Definition at line 1204 of file projectloader.cpp.
Referenced by cbProject::Save(), and cbProject::SaveAs().
bool ProjectLoader::Save | ( | const wxString & | filename, |
TiXmlElement * | pExtensions | ||
) |
Save a file.
This version of Save, can override the <Extensions> element.
filename | The file to save. |
pExtensions | A pointer of type TiXmlElement. This will be added as the <Extensions> element. |
Definition at line 1209 of file projectloader.cpp.
References ExportTargetAsProject(), m_pProject, cbProject::SetModified(), and wxEmptyString.
|
private |
Definition at line 1182 of file projectloader.cpp.
References AddElement(), cbU2C(), and CompileOptionsBase::GetAllVars().
Referenced by ExportTargetAsProject().
|
private |
Definition at line 110 of file projectloader.h.
Referenced by DoProjectOptions(), and Open().
|
private |
Definition at line 112 of file projectloader.h.
Referenced by GetValidCompilerID().
|
private |
Definition at line 109 of file projectloader.h.
Referenced by DoBuildTargetOptions(), DoProjectOptions(), and Open().
|
private |
Definition at line 111 of file projectloader.h.
Referenced by DoUnitOptions(), and Open().
|
private |
Definition at line 108 of file projectloader.h.
Referenced by GetValidCompilerID().
|
private |
Definition at line 106 of file projectloader.h.
Referenced by ConvertVersion_Pre_1_1(), DoBuild(), DoBuildTarget(), DoBuildTargetOptions(), DoCompilerOptions(), DoExtraCommands(), DoIncludesOptions(), DoLibsOptions(), DoLinkerOptions(), DoProjectOptions(), DoResourceCompilerOptions(), DoUnitOptions(), DoUnits(), DoVirtualTargets(), ExportTargetAsProject(), Open(), and Save().
|
private |
Definition at line 107 of file projectloader.h.
Referenced by ConvertVersion_Pre_1_1(), and Open().