My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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(fileDef != 0 && showLineNumbers);
44  if (fileDef != 0 && 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