From 06ffeb996c8911852ac79ec58c9e01b421061f21 Mon Sep 17 00:00:00 2001 From: forgie Date: Mon, 9 Feb 2015 13:35:51 +0100 Subject: [PATCH] #BAB-14 #comment started writing api #time 2h --- juci/api.cc | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++ juci/api.h | 53 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+) create mode 100644 juci/api.cc create mode 100644 juci/api.h diff --git a/juci/api.cc b/juci/api.cc new file mode 100644 index 0000000..d413767 --- /dev/null +++ b/juci/api.cc @@ -0,0 +1,62 @@ +#include "api.h" + +// +// Plugin API +// +namespace juci_plugin{ + // + // calls from python to C++ + // + namespace cpp{ + // + // ReplaceWord: + // replaces a word in the editor with a string + // + std::string ReplaceWord(const std::string word_){ + //TODO implement api::ReplaceWord / change string to iter? + //some_namespace::controller::replaceWord(word_*); + std::cout << "unimplemented function: 'api::ReplaceWord()' called" + << std::endl; + return "string from unimplemented method 'api::ReplaceWord'"; + } + // + // ReplaceLine: + // Replaces a line in the editor with a string + // + std::string ReplaceLine(const std::string line_){ + //TODO implement api::ReplaceLine / change string to iter? + //some_namespace::controller::replaceLine(line_); + std::cout << "unimplemented function: 'api::ReplaceLine()' called" + << std::endl; + return "string from unimplemented method 'api::ReplaceLine'"; + } + // + // The module + // + namespace bp = boost::python; + BOOST_PYTHON_MODULE(juci) { + // text editing + bp::def("replaceLine", &juci_plugin::cpp::ReplaceLine) + .bp::def("replaceWord", &juci_plugin::cpp::ReplaceWord); + //.bp::def(""); + } + + }//namespace #include "api.h" + + // + // calls from C++ to Python + // + namespace py{ + + + }// py + +}//juci_plugin + + +int main(int argc, char *argv[]) +{ + + return 0; +} + diff --git a/juci/api.h b/juci/api.h new file mode 100644 index 0000000..545f9ad --- /dev/null +++ b/juci/api.h @@ -0,0 +1,53 @@ +#include +#include +#include +// +// Plugin API +// +namespace juci_plugin{ + // + // calls from python to C++ + // + namespace cpp{ + + // + // ReplaceWord: + // replaces a word in the editor with a string + // + std::string ReplaceWord(const std::string word_); + + // + // ReplaceLine: + // Replaces a line in the editor with a string + // + std::string ReplaceLine(const std::string line_); + + // + // The module + // + namespace bp = boost::python; + BOOST_PYTHON_MODULE(juci) { + // text editing + bp::def("replaceLine", &juci_plugin::cpp::ReplaceLine); + bp::def("replaceWord", &juci_plugin::cpp::ReplaceWord); + }// module::juci + + }//namespace #include "api.h" + + // + // calls from C++ to Python + // + namespace py{ + + + }// py + +}//juci_plugin + + +int main(int argc, char *argv[]) +{ + + return 0; +} +