emit prototype method (to eliminate horrible copy/paste mess someone thought was good programming style)
parent
82d6bae4b9
commit
80b7d91264
|
@ -16,13 +16,14 @@
|
|||
* @author Richard Roberts
|
||||
**/
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include "Argument.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
#include "Argument.h"
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
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 << ")";
|
||||
}
|
||||
/* ************************************************************************* */
|
||||
|
||||
|
|
|
@ -68,6 +68,13 @@ struct ArgumentList: public std::vector<Argument> {
|
|||
*/
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue