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