Added overload constructor comments to matlab files
parent
f9c3af7e3d
commit
ea70673b36
|
@ -56,6 +56,7 @@ void Class::matlab_proxy(const string& toolboxPath, const string& wrapperName,
|
||||||
// emit class proxy code
|
// emit class proxy code
|
||||||
// we want our class to inherit the handle class for memory purposes
|
// we want our class to inherit the handle class for memory purposes
|
||||||
const string parent = qualifiedParent.empty() ? "handle" : matlabBaseName;
|
const string parent = qualifiedParent.empty() ? "handle" : matlabBaseName;
|
||||||
|
comment_fragment(proxyFile);
|
||||||
proxyFile.oss << "classdef " << name << " < " << parent << endl;
|
proxyFile.oss << "classdef " << name << " < " << parent << endl;
|
||||||
proxyFile.oss << " properties" << endl;
|
proxyFile.oss << " properties" << endl;
|
||||||
proxyFile.oss << " ptr_" << matlabUniqueName << " = 0" << 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* ************************************************************************* */
|
||||||
|
|
|
@ -62,8 +62,10 @@ struct Class {
|
||||||
// The typedef line for this class, if this class is a typedef, otherwise returns an empty string.
|
// The typedef line for this class, if this class is a typedef, otherwise returns an empty string.
|
||||||
std::string getTypedef() const;
|
std::string getTypedef() const;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void pointer_constructor_fragments(FileWriter& proxyFile, FileWriter& wrapperFile, const std::string& wrapperName, std::vector<std::string>& functionNames) const;
|
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
|
} // \namespace wrap
|
||||||
|
|
|
@ -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
|
ofstream ofs(filename_.c_str(), ios::binary); // Binary to use LF line endings instead of CRLF
|
||||||
if (!ofs) throw CantOpenFile(filename_);
|
if (!ofs) throw CantOpenFile(filename_);
|
||||||
|
|
||||||
// header
|
|
||||||
if (add_header)
|
|
||||||
ofs << comment_str_ << " automatically generated by wrap" << endl;
|
|
||||||
|
|
||||||
// dump in stringstream
|
// dump in stringstream
|
||||||
ofs << new_contents;
|
ofs << new_contents;
|
||||||
ofs.close();
|
ofs.close();
|
||||||
|
|
Loading…
Reference in New Issue