#pragma once #include #include #include #include namespace trygvis { namespace kicad { template using opt = std::experimental::optional; class component { public: std::string ref; std::string value; component(const std::string &ref, const std::string &value) : ref(ref), value(value) { } }; struct pin { int num; std::string name; std::string type; }; struct part { std::vector pins; }; class node { public: std::string ref; int pin; node(const std::string &ref, int pin) : ref(ref), pin(pin) { } }; class net { public: int code; std::string name; std::vector nodes; net(int code, const std::string &name, const std::vector &nodes) : code(code), name(name), nodes(nodes) { } }; struct netlist { std::vector components; std::vector parts; std::vector nets; opt find_component(std::string ref) const; }; class kicad_parse_exception : public std::runtime_error { public: explicit kicad_parse_exception(const std::vector &messages) : runtime_error("Parse error"), messages(messages) { } const std::vector messages; }; class kicad_net_loader { public: kicad_net_loader(); virtual ~kicad_net_loader(); netlist load(std::string path); void setDebug(bool debug); private: bool debug_; }; } // namespace kicad } // namespace trygvis