// // Created by erki on 28.02.21. // #ifndef C_ANALYZER_OPERATIONLOG_HPP #define C_ANALYZER_OPERATIONLOG_HPP struct OperationLog { std::string operation; unsigned int line; std::string operand_lhs; std::string operand_rhs; std::string operand_result; }; class IOperationOutput { public: virtual ~IOperationOutput() = default; virtual void pushOperation(const std::string& filename, const OperationLog& op) = 0; }; #include inline void to_json(nlohmann::json& j, const OperationLog& l) { j = nlohmann::json{ {"operation", l.operation}, {"line", l.line}, {"operand_lhs", l.operand_lhs}, {"operand_rhs", l.operand_rhs}, {"operand_result", l.operand_result} }; } inline void from_json(const nlohmann::json& j, OperationLog& l) { j.at("operation").get_to(l.operation); j.at("line").get_to(l.line); j.at("operand_lhs").get_to(l.operand_lhs); j.at("operand_rhs").get_to(l.operand_rhs); j.at("operand_result").get_to(l.operand_result); } #endif //C_ANALYZER_OPERATIONLOG_HPP