Menu

[r7524]: / branches / wxsmith_addons / src / include / projectloader.h  Maximize  Restore  History

Download this file

117 lines (94 with data), 5.3 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/*
* This file is part of the Code::Blocks IDE and licensed under the GNU Lesser General Public License, version 3
* http://www.gnu.org/licenses/lgpl-3.0.html
*/
#ifndef PROJECTLOADER_H
#define PROJECTLOADER_H
#include <wx/hashmap.h>
#include "ibaseloader.h"
#define PROJECT_FILE_VERSION_MAJOR 1
#define PROJECT_FILE_VERSION_MINOR 6
class cbProject;
class ProjectBuildTarget;
class ProjectFile;
WX_DECLARE_STRING_HASH_MAP(wxString, CompilerSubstitutes);
/** Code::Blocks project file loader. */
class DLLIMPORT ProjectLoader : public IBaseLoader
{
public:
/** Constructor.
* @param project The project to handle (load/save). */
ProjectLoader(cbProject* project);
/// Destructor.
virtual ~ProjectLoader();
/** Open a file.
* @param filename The file to open.
* @return True on success, false on failure. */
bool Open(const wxString& filename);
/** Save a file.
* @param filename The file to save.
* @return True on success, false on failure. */
bool Save(const wxString& filename);
/** Open a file.
* This version of Open, will return a copy of the \<Extensions\> element (if found).
* @param filename The file to open.
* @param ppExtensions A pointer to a pointer of type TiXmlElement. This is where
* the copy of the \<Extensions\> element will be placed.
* @return True on success, false on failure. */
bool Open(const wxString& filename, TiXmlElement** ppExtensions);
/** Save a file.
* This version of Save, can override the \<Extensions\> element.
* @param filename The file to save.
* @param pExtensions A pointer of type TiXmlElement. This will be added as
* the \<Extensions\> element.
* @return True on success, false on failure. */
bool Save(const wxString& filename, TiXmlElement* pExtensions);
/** Export a target as a new project.
* In other words, save a copy of the project containing only the specified target.
* @param filename The new project filename.
* @param pExtensions A pointer of type TiXmlElement. This will be added as
* the \<Extensions\> element.
* @param 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). */
bool ExportTargetAsProject(const wxString& filename, const wxString& onlyTarget, TiXmlElement* pExtensions);
/** @return True if the file was upgraded after load, false if not. */
bool FileUpgraded(){ return m_Upgraded; }
/** @return True if the file was modified while loading, false if not. This is usually true if FileUpgraded() returned true. */
bool FileModified(){ return m_OpenDirty; }
protected:
void DoProjectOptions(TiXmlElement* parentNode);
void DoCompilerOptions(TiXmlElement* parentNode, ProjectBuildTarget* target = 0L);
void DoResourceCompilerOptions(TiXmlElement* parentNode, ProjectBuildTarget* target = 0L);
void DoLinkerOptions(TiXmlElement* parentNode, ProjectBuildTarget* target = 0L);
void DoIncludesOptions(TiXmlElement* parentNode, ProjectBuildTarget* target = 0L);
void DoLibsOptions(TiXmlElement* parentNode, ProjectBuildTarget* target = 0L);
void DoExtraCommands(TiXmlElement* parentNode, ProjectBuildTarget* target = 0L);
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(TiXmlElement* parentNode);
void DoUnitOptions(TiXmlElement* parentNode, ProjectFile* file);
private:
void ConvertVersion_Pre_1_1();
void ConvertLibraries(CompileTargetBase* object);
// convenience functions, used in Save()
TiXmlElement* AddElement(TiXmlElement* parent, const char* name, const char* attr = 0, 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);
void SaveEnvironment(TiXmlElement* parent, CompileOptionsBase* base);
// accepts a questionable compiler index and returns a valid compiler index
// (popping up a selection dialog if needed)
wxString GetValidCompilerID(const wxString& proposal, const wxString& scope);
ProjectLoader(){} // no default ctor
cbProject* m_pProject;
bool m_Upgraded;
bool m_OpenDirty; // set this to true if the project is loaded but modified (like the case when setting another compiler, if invalid)
bool m_IsPre_1_2;
int m_1_4_to_1_5_deftarget;
bool m_IsPre_1_6;
CompilerSubstitutes m_CompilerSubstitutes;
};
#endif // PROJECTLOADER_H
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.