Added overload constructor comments to matlab files

release/4.3a0
Andrew Melim 2012-08-26 15:46:19 +00:00
parent f9c3af7e3d
commit ea70673b36
3 changed files with 347 additions and 328 deletions

View File

@ -56,6 +56,7 @@ void Class::matlab_proxy(const string& toolboxPath, const string& wrapperName,
// emit class proxy code
// we want our class to inherit the handle class for memory purposes
const string parent = qualifiedParent.empty() ? "handle" : matlabBaseName;
comment_fragment(proxyFile);
proxyFile.oss << "classdef " << name << " < " << parent << endl;
proxyFile.oss << " properties" << endl;
proxyFile.oss << " ptr_" << matlabUniqueName << " = 0" << endl;
@ -323,3 +324,23 @@ std::string Class::getTypedef() const {
}
/* ************************************************************************* */
void Class::comment_fragment(FileWriter& proxyFile) const
{
proxyFile.oss << "%%" << " --Overloads--" << endl;
BOOST_FOREACH(ArgumentList argList, constructor.args_list)
{
proxyFile.oss << "%" << name << "(";
int i = 0;
BOOST_FOREACH(const Argument& arg, argList)
{
if(i != argList.size()-1)
proxyFile.oss << arg.type << " " << arg.name << ", ";
else
proxyFile.oss << arg.type << " " << arg.name;
i++;
}
proxyFile.oss << ")" << endl;
}
}
/* ************************************************************************* */

View File

@ -62,8 +62,10 @@ struct Class {
// The typedef line for this class, if this class is a typedef, otherwise returns an empty string.
std::string getTypedef() const;
private:
void pointer_constructor_fragments(FileWriter& proxyFile, FileWriter& wrapperFile, const std::string& wrapperName, std::vector<std::string>& functionNames) const;
void comment_fragment(FileWriter& proxyFile) const;
};
} // \namespace wrap

View File

@ -38,10 +38,6 @@ void FileWriter::emit(bool add_header, bool force_overwrite) const {
ofstream ofs(filename_.c_str(), ios::binary); // Binary to use LF line endings instead of CRLF
if (!ofs) throw CantOpenFile(filename_);
// header
if (add_header)
ofs << comment_str_ << " automatically generated by wrap" << endl;
// dump in stringstream
ofs << new_contents;
ofs.close();