diff options
author | albert-github <albert.tests@gmail.com> | 2020-06-28 12:08:24 (GMT) |
---|---|---|
committer | albert-github <albert.tests@gmail.com> | 2020-06-28 12:08:24 (GMT) |
commit | 4f28f621b67d96c3f9eb78f01009867377695558 (patch) | |
tree | 661dd47ef62852e822c7e0609bd46a71d2b2cca1 /src/util.cpp | |
parent | d5916c06fba9667911a19cf658e7c5ab54daf72c (diff) | |
download | Doxygen-4f28f621b67d96c3f9eb78f01009867377695558.zip Doxygen-4f28f621b67d96c3f9eb78f01009867377695558.tar.gz Doxygen-4f28f621b67d96c3f9eb78f01009867377695558.tar.bz2 |
More flexible and correct detection of direction of an argument
In the current version a line like:
```
uint8_t innInstances, ///< [inn]Number of CIP node instances.
```
was seen as an input parameter.
Also not all combinations were checked (`[inout]` was OK but `[outin]` wasn't although `[in,out]` and `[out,in]` were working in the tokenizer.
Line up the detection of the direction between the tokenizer and the method `extractDirection`
Note: this problem was found when working on #7879.
Diffstat (limited to 'src/util.cpp')
-rw-r--r-- | src/util.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/util.cpp b/src/util.cpp index 8b3f618..7b90982 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -8138,10 +8138,25 @@ QCString extractDirection(QCString &docs) int l=0; if (re.match(docs,0,&l)==0) { - int inPos = docs.find("in", 1,FALSE); - int outPos = docs.find("out",1,FALSE); - bool input = inPos!=-1 && inPos<l; - bool output = outPos!=-1 && outPos<l; + QRegExp re_in("\\[ *in *\\]"); // [in] + QRegExp re_out("\\[ *out *\\]"); // [out] + QRegExp re_inout("\\[ *in *[,]? *out *\\]"); // [in,out] + QRegExp re_outin("\\[ *out *[,]? *in *\\]"); // [out,in] + int l_in = 0; + int l_out = 0; + int l_inout = 0; + int l_outin = 0; + int inPos = re_in.match(docs,0,&l_in); + int outPos = re_out.match(docs,0,&l_out); + int inoutPos = re_inout.match(docs,0,&l_inout); + int outinPos = re_outin.match(docs,0,&l_outin); + // we only take the first occurrence into account + bool input = (inPos!=-1 && l==l_in) || + (inoutPos!=-1 && l==l_inout) || + (outinPos!=-1 && l==l_outin); + bool output = (outPos!=-1 && l==l_out) || + (inoutPos!=-1 && l==l_inout) || + (outinPos!=-1 && l==l_outin); if (input || output) // in,out attributes { docs = docs.mid(l); // strip attributes |