| | 1999 | bool stilInParam(char[] comments) |
|---|
| | 2000 | { |
|---|
| | 2001 | return !(find(comments, ":") == comments.length-1 || |
|---|
| | 2002 | find(comments, "Returns:") == 0 || |
|---|
| | 2003 | find(comments, "Since 2.") == 0 || |
|---|
| | 2004 | find(comments, "See Also") == 0 || |
|---|
| | 2005 | find(comments, "Property Details") == 0); |
|---|
| | 2006 | } |
|---|
| | 2007 | |
|---|
| | 2008 | char[][] phraseParams(char[][] comments) |
|---|
| | 2009 | { |
|---|
| | 2010 | char[][] description; |
|---|
| | 2011 | char[][] params; |
|---|
| | 2012 | char[] ret; |
|---|
| | 2013 | |
|---|
| | 2014 | for(int i; i < comments.length; i++) |
|---|
| | 2015 | { |
|---|
| | 2016 | if(find(comments[i], ":") == comments[i].length-1 && find(comments[i], "Returns:") == -1) |
|---|
| | 2017 | { |
|---|
| | 2018 | //Get the GtkD name of the param |
|---|
| | 2019 | char[] param = idsToGtkD(comments[i][0 .. $-1], convParms, wrapper.getAliases()); |
|---|
| | 2020 | |
|---|
| | 2021 | //If this param is not in the Gtkd Function Skip it. |
|---|
| | 2022 | if(find(fun.declaration(convParms,wrapper.getAliases()), param) == -1) |
|---|
| | 2023 | { |
|---|
| | 2024 | //Loop for multi line descriptons for this param. |
|---|
| | 2025 | while(i+1 < comments.length && stilInParam(comments[i+1])) |
|---|
| | 2026 | i++; |
|---|
| | 2027 | continue; |
|---|
| | 2028 | } |
|---|
| | 2029 | |
|---|
| | 2030 | if(params.length == 0) |
|---|
| | 2031 | params ~= "Params:"; |
|---|
| | 2032 | |
|---|
| | 2033 | //Loop for multi line descriptons for this param. |
|---|
| | 2034 | bool firstRun = true; |
|---|
| | 2035 | while(i+1 < comments.length && stilInParam(comments[i+1])) |
|---|
| | 2036 | { |
|---|
| | 2037 | i++; |
|---|
| | 2038 | if(firstRun) |
|---|
| | 2039 | { |
|---|
| | 2040 | params ~= param ~" = "~ comments[i]; |
|---|
| | 2041 | firstRun = false; |
|---|
| | 2042 | } |
|---|
| | 2043 | else |
|---|
| | 2044 | params ~= comments[i]; |
|---|
| | 2045 | } |
|---|
| | 2046 | } |
|---|
| | 2047 | else if(find(comments[i], "Returns:") > -1) |
|---|
| | 2048 | { |
|---|
| | 2049 | //Skip return for Constructors. |
|---|
| | 2050 | if(find(fun.declaration(convParms,wrapper.getAliases()), "this (") > -1) |
|---|
| | 2051 | { |
|---|
| | 2052 | //Loop for multi line descriptons for this return. |
|---|
| | 2053 | while(i+1 < comments.length && stilInParam(comments[i+1])) |
|---|
| | 2054 | i++; |
|---|
| | 2055 | continue; |
|---|
| | 2056 | } |
|---|
| | 2057 | |
|---|
| | 2058 | ret ~= comments[i]; |
|---|
| | 2059 | |
|---|
| | 2060 | //Loop for multi line descriptons for this return. |
|---|
| | 2061 | bool firstRun = true; |
|---|
| | 2062 | while(i+1 < comments.length && stilInParam(comments[i+1])) |
|---|
| | 2063 | { |
|---|
| | 2064 | i++; |
|---|
| | 2065 | ret ~= comments[i]; |
|---|
| | 2066 | } |
|---|
| | 2067 | } |
|---|
| | 2068 | else if(find(comments[i], "See Also") == 0 || find(comments[i], "Property Details") == 0) |
|---|
| | 2069 | { |
|---|
| | 2070 | //These sections get included with the last function. |
|---|
| | 2071 | break; |
|---|
| | 2072 | } |
|---|
| | 2073 | else |
|---|
| | 2074 | { |
|---|
| | 2075 | //Add the rest to the description. |
|---|
| | 2076 | description ~= comments[i]; |
|---|
| | 2077 | } |
|---|
| | 2078 | } |
|---|
| | 2079 | |
|---|
| | 2080 | if(params.length > 0) |
|---|
| | 2081 | { |
|---|
| | 2082 | foreach(char[] line; params) |
|---|
| | 2083 | description ~= line; |
|---|
| | 2084 | } |
|---|
| | 2085 | |
|---|
| | 2086 | if(ret.length > 0) |
|---|
| | 2087 | description ~= ret; |
|---|
| | 2088 | |
|---|
| | 2089 | return description; |
|---|
| | 2090 | } |
|---|
| | 2091 | |
|---|