blob: e1b0d0ee2f6e76cc2a94b5964810490158c1ce85 [file] [log] [blame]
// Copyright 2017 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef GARNET_LIB_CMX_RUNTIME_H_
#define GARNET_LIB_CMX_RUNTIME_H_
#include <string>
#include "lib/json/json_parser.h"
#include "rapidjson/document.h"
namespace component {
class RuntimeMetadata {
public:
// Returns true if parsing succeeded. If a config is missing the runtime but
// otherwise there are no errors, parsing succeeds and IsNull() is true.
// |json_parser| is used to report any errors.
bool ParseFromFileAt(int dirfd, const std::string& file,
json::JSONParser* json_parser);
bool ParseFromDocument(const rapidjson::Document& document,
json::JSONParser* json_parser);
bool IsNull() const { return null_; }
const std::string& runner() const { return runner_; }
private:
bool null_ = true;
std::string runner_;
};
} // namespace component
#endif // GARNET_LIB_CMX_RUNTIME_H_