#pragma once #include #include using Path = std::filesystem::path; class QuantumCircuit; class QuantumCircuitElement; class QuantumCircuitReader { public: std::unique_ptr read(const Path& path); std::unique_ptr read(const std::string& content); private: using Location = std::pair; void onLine(const std::string& line, std::size_t jdx); std::string checkForKet(const std::string& segment); std::string checkForGate(const std::string& segment); std::size_t getWireEnd(const std::string& segment); void onGate(Location loc, const std::string value); void onKet(Location loc, const std::string value); void onLineEnd(); void onVertialQuantumWire(Location loc); std::string mWorkingString; QuantumCircuitElement* mWorkingElement{ nullptr }; QuantumCircuit* mWorkingCircuit{ nullptr }; };