aboutsummaryrefslogtreecommitdiff
path: root/python/include
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2016-08-01 08:20:23 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2016-08-01 08:20:23 +0200
commitbfeeac6e4889d1e9a1083b3c7efc59652981b168 (patch)
treea937d844a59da7c509685dcd1ddd9933772e526f /python/include
parentc307e9f234e544386fa3ae53083c7510668e1716 (diff)
downloadkicad-utils-bfeeac6e4889d1e9a1083b3c7efc59652981b168.tar.gz
kicad-utils-bfeeac6e4889d1e9a1083b3c7efc59652981b168.tar.bz2
kicad-utils-bfeeac6e4889d1e9a1083b3c7efc59652981b168.tar.xz
kicad-utils-bfeeac6e4889d1e9a1083b3c7efc59652981b168.zip
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.
Diffstat (limited to 'python/include')
-rw-r--r--python/include/trygvis/kicad/GenerateHeaderPy.h45
-rw-r--r--python/include/trygvis/kicad/python.h3
2 files changed, 48 insertions, 0 deletions
diff --git a/python/include/trygvis/kicad/GenerateHeaderPy.h b/python/include/trygvis/kicad/GenerateHeaderPy.h
new file mode 100644
index 0000000..893b7ed
--- /dev/null
+++ b/python/include/trygvis/kicad/GenerateHeaderPy.h
@@ -0,0 +1,45 @@
+#ifndef KICAD_UTILS_GENERATEHEADEPY_H
+#define KICAD_UTILS_GENERATEHEADEPY_H
+
+#include "trygvis/kicad.h"
+#include "pybind11/pybind11.h"
+#include <memory>
+#include <sstream>
+
+namespace trygvis {
+namespace kicad {
+namespace python {
+
+namespace py = pybind11;
+
+using nl = trygvis::kicad::netlist::netlist;
+
+class GenerateHeaderPy {
+public:
+ GenerateHeaderPy(const std::string &ref, nl *netlist);
+
+ virtual ~GenerateHeaderPy();
+
+ std::string ref();
+
+ nl *netlist();
+
+ std::string str();
+
+ void print(const std::string &str);
+
+ void println(const std::string &str);
+
+private:
+ std::string ref_;
+
+ nl *netlist_;
+
+ std::stringstream buf_;
+};
+
+} // namespace python
+} // namespace kicad
+} // namespace trygvis
+
+#endif
diff --git a/python/include/trygvis/kicad/python.h b/python/include/trygvis/kicad/python.h
new file mode 100644
index 0000000..f2ae816
--- /dev/null
+++ b/python/include/trygvis/kicad/python.h
@@ -0,0 +1,3 @@
+#pragma once
+
+#include "trygvis/kicad/GenerateHeaderPy.h"