Added support for const qualifier and references in link-objects in JavaDoc link translator
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13663 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
faf72f01bf
commit
99bc7e9eb0
1 changed files with 17 additions and 4 deletions
|
|
@ -339,21 +339,34 @@ string JavaDocConverter::convertLink(string linkObject) {
|
||||||
// also converting arrays to pointers
|
// also converting arrays to pointers
|
||||||
string paramStr = params[i];
|
string paramStr = params[i];
|
||||||
String *swigType = NewString("");
|
String *swigType = NewString("");
|
||||||
|
|
||||||
|
// handle const qualifier
|
||||||
|
if (paramStr.find("const") != string::npos)
|
||||||
|
SwigType_add_qualifier(swigType, "const");
|
||||||
|
|
||||||
|
// handle pointers, references and arrays
|
||||||
for (int j=(int)params[i].size() - 1; j>=0; j--) {
|
for (int j=(int)params[i].size() - 1; j>=0; j--) {
|
||||||
// skip all the [...] blocks, write 'p.' for every of it
|
// skip all the [...] blocks, write 'p.' for every of it
|
||||||
if (paramStr[j] == ']') {
|
if (paramStr[j] == ']') {
|
||||||
while (j>=0 && paramStr[j] != '[')
|
while (j>=0 && paramStr[j] != '[')
|
||||||
j--;
|
j--;
|
||||||
// no closing brace
|
// no closing brace
|
||||||
if (!j)
|
if (j < 0)
|
||||||
return "";
|
return "";
|
||||||
Append(swigType, "p.");
|
SwigType_add_pointer(swigType);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (paramStr[j] == '*')
|
else if (paramStr[j] == '*')
|
||||||
Append(swigType, "p.");
|
SwigType_add_pointer(swigType);
|
||||||
|
else if (paramStr[j] == '&')
|
||||||
|
SwigType_add_reference(swigType);
|
||||||
else if (isalnum(paramStr[j])) {
|
else if (isalnum(paramStr[j])) {
|
||||||
Append(swigType, paramStr.substr(0, j + 1).c_str());
|
size_t typeNameStart = paramStr.find_last_of(' ', j + 1);
|
||||||
|
if (typeNameStart == string::npos)
|
||||||
|
typeNameStart = 0;
|
||||||
|
else
|
||||||
|
typeNameStart++;
|
||||||
|
Append(swigType, paramStr.substr(typeNameStart, j - typeNameStart + 1).c_str());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue