Doxygen
Toggle main menu visibility
Loading...
Searching...
No Matches
fileparser.cpp
Go to the documentation of this file.
1
/******************************************************************************
2
*
3
* Copyright (C) 1997-2015 by Dimitri van Heesch.
4
*
5
* Permission to use, copy, modify, and distribute this software and its
6
* documentation under the terms of the GNU General Public License is hereby
7
* granted. No representations are made about the suitability of this software
8
* for any purpose. It is provided "as is" without express or implied warranty.
9
* See the GNU General Public License for more details.
10
*
11
* Documents produced by Doxygen are derivative works derived from the
12
* input used in their production; they are not affected by this license.
13
*
14
*/
15
16
// own header
17
#include "
fileparser.h
"
18
19
// other includes
20
#include "
outputlist.h
"
21
22
void
FileCodeParser::parseCode
(
OutputCodeList
&codeOutIntf,
23
const
DString
&,
// scopeName
24
const
DString
& input,
25
SrcLangExt
,
// lang
26
bool
,
// stripCodeComments
27
const
CodeParserOptions
&options
28
)
29
{
30
int
lineNr = options.
startLine
()!=-1 ? options.
startLine
() : 1;
31
size_t
length = input.
length
();
32
size_t
i=0;
33
while
(i<length && (options.
endLine
()==-1 || lineNr<=options.
endLine
()))
34
{
35
size_t
j=i;
36
while
(j<length && input[j]!=
'\n'
) j++;
37
DString
lineStr = input.
mid
(i,j-i);
38
codeOutIntf.
startCodeLine
(lineNr);
39
if
(options.
fileDef
() && options.
showLineNumbers
())
40
{
41
codeOutIntf.
writeLineNumber
(
DString
(),
DString
(),
DString
(),lineNr,!options.
inlineFragment
());
42
}
43
if
(!lineStr.
empty
()) codeOutIntf.
codify
(lineStr.
data
());
44
codeOutIntf.
endCodeLine
();
45
lineNr++;
46
i=j+1;
47
}
48
}
49
DString
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
Definition
dstring.h:84
DString::mid
DString mid(size_t index, size_t len=npos) const
Definition
dstring.h:318
DString::empty
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
Definition
dstring.h:148
DString::data
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition
dstring.h:157
DString::length
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition
dstring.h:151
FileCodeParser::parseCode
void parseCode(OutputCodeList &codeOutIntf, const DString &scopeName, const DString &input, SrcLangExt lang, bool stripCodeComments, const CodeParserOptions &options) override
Parses a source file or fragment with the goal to produce highlighted and cross-referenced output.
Definition
fileparser.cpp:22
OutputCodeList
Class representing a list of different code generators.
Definition
outputlist.h:162
OutputCodeList::writeLineNumber
void writeLineNumber(const DString &ref, const DString &file, const DString &anchor, int lineNumber, bool writeLineAnchor)
Definition
outputlist.h:253
OutputCodeList::endCodeLine
void endCodeLine()
Definition
outputlist.h:264
OutputCodeList::startCodeLine
void startCodeLine(int lineNr)
Definition
outputlist.h:261
OutputCodeList::codify
void codify(const DString &s)
Definition
outputlist.h:232
fileparser.h
outputlist.h
CodeParserOptions
Options to configure the code parser.
Definition
parserintf.h:77
CodeParserOptions::fileDef
const FileDef * fileDef() const
Definition
parserintf.h:82
CodeParserOptions::endLine
int endLine() const
Definition
parserintf.h:84
CodeParserOptions::showLineNumbers
bool showLineNumbers() const
Definition
parserintf.h:87
CodeParserOptions::inlineFragment
bool inlineFragment() const
Definition
parserintf.h:85
CodeParserOptions::startLine
int startLine() const
Definition
parserintf.h:83
SrcLangExt
SrcLangExt
Definition
types.h:207
src
fileparser.cpp
Generated by
1.19.0