blob: 96192f4b167e007b1c4f7afa06a90a2d600c0643 [file] [log] [blame]
#pragma once
#include "bej_decoder_core.h"
#include "rde_common.h"
#include <span>
#include <string>
#include <vector>
namespace libbej
{
/**
* @brief Class for decoding RDE BEJ to a JSON output.
*/
class BejDecoderJson
{
public:
/**
* @brief Decode the encoded PLDM block.
*
* @param[in] dictionaries - dictionaries needed for decoding.
* @param[in] encodedPldmBlock - encoded PLDM block.
* @return 0 if successful.
*/
int decode(const BejDictionaries& dictionaries,
const std::span<const uint8_t> encodedPldmBlock);
/**
* @brief Get the JSON output related to the latest call to decode.
*
* @return std::string containing a JSON. If the decoding was
* unsuccessful, this might contain partial data (invalid JSON).
*/
std::string getOutput();
private:
bool isPrevAnnotated;
std::string output;
std::vector<BejStackProperty> stack;
};
} // namespace libbej