diff --git a/wrap/Argument.cpp b/wrap/Argument.cpp index c3798e5ce..0f5961a48 100644 --- a/wrap/Argument.cpp +++ b/wrap/Argument.cpp @@ -16,13 +16,14 @@ * @author Richard Roberts **/ -#include -#include -#include +#include "Argument.h" + #include #include -#include "Argument.h" +#include +#include +#include using namespace std; using namespace wrap; @@ -128,4 +129,17 @@ void ArgumentList::matlab_unwrap(FileWriter& file, int start) const { } /* ************************************************************************* */ +void ArgumentList::emit_prototype(FileWriter& file, const string& name) const { + file.oss << name << "("; + unsigned int i = 0; + BOOST_FOREACH(Argument arg, *this) { + if (i != size() - 1) + file.oss << arg.type << " " << arg.name << ", "; + else + file.oss << arg.type << " " << arg.name; + i++; + } + file.oss << ")"; +} +/* ************************************************************************* */ diff --git a/wrap/Argument.h b/wrap/Argument.h index f46eaa427..da15cda36 100644 --- a/wrap/Argument.h +++ b/wrap/Argument.h @@ -68,6 +68,13 @@ struct ArgumentList: public std::vector { */ void matlab_unwrap(FileWriter& file, int start = 0) const; // MATLAB to C++ + /** + * emit MATLAB prototype + * @param file output stream + * @param name of method or function + */ + void emit_prototype(FileWriter& file, const std::string& name) const; + }; } // \namespace wrap