diff --git a/wrap/Argument.cpp b/wrap/Argument.cpp index 1d7c43809..fb3d962ed 100644 --- a/wrap/Argument.cpp +++ b/wrap/Argument.cpp @@ -151,6 +151,15 @@ void ArgumentList::emit_prototype(FileWriter& file, const string& name) const { file.oss << ")"; } /* ************************************************************************* */ +void ArgumentList::emit_call(FileWriter& file, const ReturnValue& returnVal, + const string& wrapperName, int id, bool staticMethod) const { + returnVal.emit_matlab(file); + file.oss << wrapperName << "(" << id; + if (!staticMethod) + file.oss << ", this"; + file.oss << ", varargin{:});\n"; +} +/* ************************************************************************* */ void ArgumentList::emit_conditional_call(FileWriter& file, const ReturnValue& returnVal, const string& wrapperName, int id, bool staticMethod) const { @@ -171,11 +180,7 @@ void ArgumentList::emit_conditional_call(FileWriter& file, // output call to C++ wrapper file.oss << " "; - returnVal.emit_matlab(file); - file.oss << wrapperName << "(" << id; - if (!staticMethod) - file.oss << ", this"; - file.oss << ", varargin{:});\n"; + emit_call(file, returnVal, wrapperName, id, staticMethod); } /* ************************************************************************* */ diff --git a/wrap/Argument.h b/wrap/Argument.h index da6a733bb..9d57f2853 100644 --- a/wrap/Argument.h +++ b/wrap/Argument.h @@ -77,13 +77,24 @@ struct ArgumentList: public std::vector { void emit_prototype(FileWriter& file, const std::string& name) const; /** - * emit conditional MATLAB call (checking arguments first) + * emit emit MATLAB call to wrapper * @param file output stream * @param returnVal the return value * @param wrapperName of method or function + * @param staticMethod flag to emit "this" in call + */ + void emit_call(FileWriter& file, const ReturnValue& returnVal, + const std::string& wrapperName, int id, bool staticMethod = false) const; + + /** + * emit conditional MATLAB call to wrapper (checking arguments first) + * @param file output stream + * @param returnVal the return value + * @param wrapperName of method or function + * @param staticMethod flag to emit "this" in call */ void emit_conditional_call(FileWriter& file, const ReturnValue& returnVal, - const std::string& wrapperName, int id, bool staticMethod=false) const; + const std::string& wrapperName, int id, bool staticMethod = false) const; }; } // \namespace wrap