summaryrefslogtreecommitdiffstats
path: root/src/util.cpp
diff options
context:
space:
mode:
authoralbert-github <albert.tests@gmail.com>2016-08-21 12:17:20 (GMT)
committeralbert-github <albert.tests@gmail.com>2016-08-21 12:17:20 (GMT)
commitba848363081c44c9aa9e91b193054983f562e90c (patch)
tree246ba9ad0b053e7f99815c906600d99deb690378 /src/util.cpp
parentb24d9db1ae409195c18e83f1d31c2a135964f141 (diff)
downloadDoxygen-ba848363081c44c9aa9e91b193054983f562e90c.zip
Doxygen-ba848363081c44c9aa9e91b193054983f562e90c.tar.gz
Doxygen-ba848363081c44c9aa9e91b193054983f562e90c.tar.bz2
Introducing commands includedoc and snippetdoc
Purpose to have the possibility to have repeating texts not repeated in the comments. The commands include and snippet introduce code blocks whilst the commands includedoc and snippetdoc inclode the text as is and it will be parsed by doxygen.
Diffstat (limited to 'src/util.cpp')
-rwxr-xr-xsrc/util.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/util.cpp b/src/util.cpp
index 543291c..efd3d3c 100755
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -8085,6 +8085,7 @@ bool copyFile(const QCString &src,const QCString &dest)
/** Returns the section of text, in between a pair of markers.
* Full lines are returned, excluding the lines on which the markers appear.
+ * \sa routine lineBlock
*/
QCString extractBlock(const QCString text,const QCString marker)
{
@@ -8128,6 +8129,29 @@ QCString extractBlock(const QCString text,const QCString marker)
return l2>l1 ? text.mid(l1,l2-l1) : QCString();
}
+/** Returns the line number of the line following the line with the marker.
+ * \sa routine extractBlock
+ */
+int lineBlock(const QCString text,const QCString marker)
+{
+ int result = 1;
+ int p=0,i;
+ bool found=FALSE;
+
+ // find the character positions of the first marker
+ int m1 = text.find(marker);
+ if (m1==-1) return result;
+
+ // find start line positions for the markers
+ while (!found && (i=text.find('\n',p))!=-1)
+ {
+ found = (p<=m1 && m1<i); // found the line with the start marker
+ p=i+1;
+ result++;
+ }
+ return result;
+}
+
/** Returns a string representation of \a lang. */
QCString langToString(SrcLangExt lang)
{