From bfeeac6e4889d1e9a1083b3c7efc59652981b168 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Mon, 1 Aug 2016 08:20:23 +0200 Subject: o Moving the generation logic to Python, embedding a Python interpreter with the help of pybind11. o Adding install configuration to CMake to make it easier to reuse the project later on. o Splitting out the examples into its own project to make it easier to test the whole installation setup and python/template loading. o Trying to reorganize the code a bit, not very much better yet. --- python/GenerateHeaderPy.cpp | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 python/GenerateHeaderPy.cpp (limited to 'python/GenerateHeaderPy.cpp') diff --git a/python/GenerateHeaderPy.cpp b/python/GenerateHeaderPy.cpp new file mode 100644 index 0000000..1a039a3 --- /dev/null +++ b/python/GenerateHeaderPy.cpp @@ -0,0 +1,40 @@ +#include "trygvis/kicad/GenerateHeaderPy.h" + +namespace trygvis { +namespace kicad { +namespace python { + +using namespace std; + +GenerateHeaderPy::GenerateHeaderPy(const string &ref, nl *netlist) : ref_(ref), netlist_(netlist) { +} + +GenerateHeaderPy::~GenerateHeaderPy() {} + +string GenerateHeaderPy::ref() { + return ref_; +} + +nl *GenerateHeaderPy::netlist() { + if (!netlist_) { + throw domain_error("No current netlist"); + } + + return netlist_; +} + +string GenerateHeaderPy::str() { + return buf_.str(); +} + +void GenerateHeaderPy::print(const string &str) { + buf_ << str; +} + +void GenerateHeaderPy::println(const string &str) { + buf_ << str << endl; +} + +} // namespace python +} // namespace kicad +} // namespace trygvis -- cgit v1.2.3