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 #include "fileparser.h"
17 #include "outputgen.h"
18 
20  const char *, // scopeName
21  const QCString & input,
22  SrcLangExt, // lang
23  bool, // isExampleBlock
24  const char *, // exampleName
25  FileDef *, // fileDef
26  int startLine,
27  int endLine,
28  bool, // inlineFragment
29  MemberDef *, // memberDef
30  bool showLineNumbers,
31  Definition *, // searchCtx,
32  bool // collectXRefs
33  )
34 {
35  int lineNr = startLine!=-1 ? startLine : 1;
36  int length = input.length();
37  int i=0;
38  while (i<length && (endLine==-1 || lineNr<=endLine))
39  {
40  int j=i;
41  while (j<length && input[j]!='\n') j++;
42  QCString lineStr = input.mid(i,j-i);
43  codeOutIntf.startCodeLine(showLineNumbers);
44  if (showLineNumbers) codeOutIntf.writeLineNumber(0,0,0,lineNr);
45  if (!lineStr.isEmpty()) codeOutIntf.codify(lineStr);
46  codeOutIntf.endCodeLine();
47  lineNr++;
48  i=j+1;
49  }
50 }
51 
bool isEmpty() const
Definition: qcstring.h:189
virtual void writeLineNumber(const char *ref, const char *file, const char *anchor, int lineNumber)=0
uint length() const
Definition: qcstring.h:195
SrcLangExt
Definition: types.h:41
void parseCode(CodeOutputInterface &codeOutIntf, const char *scopeName, const QCString &input, SrcLangExt lang, bool isExampleBlock, const char *exampleName=0, FileDef *fileDef=0, int startLine=-1, int endLine=-1, bool inlineFragment=FALSE, MemberDef *memberDef=0, bool showLineNumbers=TRUE, Definition *searchCtx=0, bool collectXRefs=TRUE)
Definition: fileparser.cpp:19
static int input(void)
Definition: code.cpp:15695
QCString mid(uint index, uint len=0xffffffff) const
Definition: qcstring.cpp:246
virtual void codify(const char *s)=0
virtual void startCodeLine(bool hasLineNumbers)=0
virtual void endCodeLine()=0