Project.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #include <Atomic/Core/Object.h>
  2. #include <Atomic/IO/FileSystem.h>
  3. using namespace Atomic;
  4. #include "../Platform/Platform.h"
  5. namespace ToolCore
  6. {
  7. class ProjectUserPrefs;
  8. class ProjectBuildSettings;
  9. class Project : public Object
  10. {
  11. friend class ProjectFile;
  12. OBJECT(Project);
  13. public:
  14. /// Construct.
  15. Project(Context* context);
  16. /// Destruct.
  17. virtual ~Project();
  18. bool Load(const String& fullpath);
  19. void Save(const String& fullpath = "");
  20. /// Paths
  21. const String GetResourcePath() { return resourcePath_; }
  22. void SetResourcePath(const String& resourcePath)
  23. {
  24. resourcePath_ = AddTrailingSlash(resourcePath);
  25. componentsPath_ = resourcePath_ + "Components";
  26. scriptsPath_ = resourcePath_ + "Scripts";
  27. modulesPath_ = resourcePath_ + "Modules";
  28. }
  29. const String& GetComponentsPath() { return componentsPath_; }
  30. const String& GetScriptsPath() { return scriptsPath_; }
  31. const String& GetModulesPath() { return modulesPath_; }
  32. bool IsComponentsDirOrFile(const String& fullPath);
  33. bool IsScriptsDirOrFile(const String& fullPath);
  34. bool IsModulesDirOrFile(const String& fullPath);
  35. void AddPlatform(PlatformID platformID);
  36. bool ContainsPlatform(PlatformID platformID);
  37. void RemovePlatform(PlatformID platformID);
  38. bool IsDirty() { return dirty_; }
  39. void SetDirty() { if (!loading_) dirty_ = true; }
  40. ProjectBuildSettings* GetBuildSettings() { return buildSettings_; }
  41. ProjectUserPrefs* GetUserPrefs() { return userPrefs_; }
  42. const String& GetProjectFilePath() { return projectFilePath_; }
  43. String GetUserPrefsFullPath();
  44. String GetBuildSettingsFullPath();
  45. const String& GetVersion() { return version_; }
  46. void SetVersion(const String& version) { version_ = version; }
  47. void SaveBuildSettings();
  48. bool LoadBuildSettings();
  49. void SaveUserPrefs();
  50. bool LoadUserPrefs();
  51. private:
  52. String version_;
  53. String projectFilePath_;
  54. String resourcePath_;
  55. String componentsPath_;
  56. String scriptsPath_;
  57. String modulesPath_;
  58. bool loading_;
  59. bool dirty_;
  60. SharedPtr<ProjectUserPrefs> userPrefs_;
  61. SharedPtr<ProjectBuildSettings> buildSettings_;
  62. List<PlatformID> platforms_;
  63. };
  64. }