// PcbFactory - builds a Pcb from a board JSON document (see CartPcb/Readme.md ยง5). #pragma once #include #include "Pcb.h" #include "CartImage.h" #include "../Common/JsonLib/Json.h" namespace CartPcb { class PcbFactory { public: /// /// Parse a board JSON document (either a bare board definition or a /// JSONES-style game -> cartridge -> board nesting) and build a Pcb. /// Returns nullptr and fills `error` on failure. /// static Pcb* Create(const std::string& jsonText, const CartImage& image, std::string& error); /// /// Build a Pcb from an already-located `board` JSON value. /// static Pcb* CreateFromBoardValue(Json::Value* board, const CartImage& image, std::string& error); /// /// Parse a single-bit logic expression (signals, bus bits, chip pins, /// ! & | ^ ( )). /// static LogicExprPtr ParseLogicExpr(const std::string& text, std::string& error); /// /// Parse an address expression (bit ranges concatenated with `|`, MSB first). /// static AddrExprPtr ParseAddrExpr(const std::string& text, std::string& error); }; }