ProjectConfig.h 783 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * Copyright (c) 2022, the SerenityOS developers.
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/Error.h>
  8. #include <AK/JsonObject.h>
  9. #include <AK/Optional.h>
  10. #include <AK/OwnPtr.h>
  11. #include <LibCore/EventReceiver.h>
  12. namespace HackStudio {
  13. class ProjectConfig {
  14. public:
  15. static ErrorOr<NonnullOwnPtr<ProjectConfig>> try_load_project_config(DeprecatedString path);
  16. static NonnullOwnPtr<ProjectConfig> create_empty();
  17. ProjectConfig(JsonObject);
  18. Optional<DeprecatedString> build_command() const { return read_key("build_command"); }
  19. Optional<DeprecatedString> run_command() const { return read_key("run_command"); }
  20. private:
  21. Optional<DeprecatedString> read_key(DeprecatedString key_name) const;
  22. JsonObject m_config;
  23. };
  24. }