40 lines
No EOL
800 B
C++
40 lines
No EOL
800 B
C++
#pragma once
|
|
|
|
#include <filesystem>
|
|
#include "String.h"
|
|
|
|
using Path = std::filesystem::path;
|
|
|
|
class QuantumCircuit;
|
|
class QuantumCircuitElement;
|
|
|
|
class QuantumCircuitReader
|
|
{
|
|
public:
|
|
Ptr<QuantumCircuit> read(const Path& path);
|
|
|
|
Ptr<QuantumCircuit> read(const String& content);
|
|
|
|
private:
|
|
using Location = std::pair<size_t, size_t>;
|
|
|
|
void onLine(const String& line, size_t jdx);
|
|
|
|
String checkForKet(const String& segment);
|
|
|
|
String checkForGate(const String& segment);
|
|
|
|
size_t getWireEnd(const String& segment);
|
|
|
|
void onGate(Location loc, const String value);
|
|
|
|
void onKet(Location loc, const String value);
|
|
|
|
void onLineEnd();
|
|
|
|
void onVertialQuantumWire(Location loc);
|
|
|
|
String mWorkingString;
|
|
QuantumCircuitElement* mWorkingElement{ nullptr };
|
|
QuantumCircuit* mWorkingCircuit{ nullptr };
|
|
}; |