@@ -1001,22 +1001,32 @@ namespace attributes {
1001
1001
return os;
1002
1002
}
1003
1003
1004
- // Argument operator <<
1005
- std::ostream& operator <<(std::ostream& os, const Argument& argument) {
1004
+ // Print argument
1005
+ void printArgument (std::ostream& os,
1006
+ const Argument& argument,
1007
+ bool printDefault = true ) {
1006
1008
if (!argument.empty ()) {
1007
1009
os << argument.type ();
1008
1010
if (!argument.name ().empty ()) {
1009
1011
os << " " ;
1010
1012
os << argument.name ();
1011
- if (!argument.defaultValue ().empty ())
1013
+ if (printDefault && !argument.defaultValue ().empty ())
1012
1014
os << " = " << argument.defaultValue ();
1013
1015
}
1014
1016
}
1017
+ }
1018
+
1019
+ // Argument operator <<
1020
+ std::ostream& operator <<(std::ostream& os, const Argument& argument) {
1021
+ printArgument (os, argument);
1015
1022
return os;
1016
1023
}
1017
1024
1018
- // Function operator <<
1019
- std::ostream& operator <<(std::ostream& os, const Function& function) {
1025
+ // Print function
1026
+ void printFunction (std::ostream& os,
1027
+ const Function& function,
1028
+ bool printArgDefaults = true ) {
1029
+
1020
1030
if (!function.empty ()) {
1021
1031
if (!function.type ().empty ()) {
1022
1032
os << function.type ();
@@ -1026,12 +1036,17 @@ namespace attributes {
1026
1036
os << " (" ;
1027
1037
const std::vector<Argument>& arguments = function.arguments ();
1028
1038
for (std::size_t i = 0 ; i<arguments.size (); i++) {
1029
- os << arguments[i];
1039
+ printArgument (os, arguments[i], printArgDefaults) ;
1030
1040
if (i != (arguments.size ()-1 ))
1031
1041
os << " , " ;
1032
1042
}
1033
1043
os << " )" ;
1034
1044
}
1045
+ }
1046
+
1047
+ // Function operator <<
1048
+ std::ostream& operator <<(std::ostream& os, const Function& function) {
1049
+ printFunction (os, function);
1035
1050
return os;
1036
1051
}
1037
1052
@@ -2484,7 +2499,8 @@ namespace attributes {
2484
2499
// include prototype if requested
2485
2500
if (includePrototype) {
2486
2501
ostr << " // " << function.name () << std::endl;
2487
- ostr << function << " ;" ;
2502
+ printFunction (ostr, function, false );
2503
+ ostr << " ;" ;
2488
2504
}
2489
2505
2490
2506
// write the C++ callable SEXP-based function (this version
0 commit comments