Project.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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& GetProjectPath() { return projectPath_; }
  43. const String& GetProjectFilePath() { return projectFilePath_; }
  44. String GetUserPrefsFullPath();
  45. String GetBuildSettingsFullPath();
  46. const String& GetVersion() { return version_; }
  47. void SetVersion(const String& version) { version_ = version; }
  48. void SaveBuildSettings();
  49. bool LoadBuildSettings();
  50. void SaveUserPrefs();
  51. bool LoadUserPrefs();
  52. private:
  53. String version_;
  54. String projectPath_;
  55. String projectFilePath_;
  56. String resourcePath_;
  57. String componentsPath_;
  58. String scriptsPath_;
  59. String modulesPath_;
  60. bool loading_;
  61. bool dirty_;
  62. SharedPtr<ProjectUserPrefs> userPrefs_;
  63. SharedPtr<ProjectBuildSettings> buildSettings_;
  64. List<PlatformID> platforms_;
  65. };
  66. }