Source-highlight Library
linenumgenerator.h
1 //
2 // Author: Lorenzo Bettini <http://www.lorenzobettini.it>, (C) 2004-2008
3 //
4 // Copyright: See COPYING file that comes with this distribution
5 //
6 
7 #ifndef LINENUMGENERATOR_H_
8 #define LINENUMGENERATOR_H_
9 
10 #include <string>
11 
12 #include "textstyle.h"
13 
14 namespace srchilite {
15 
21  unsigned int digitNum;
22 
24  char padding;
25 
28 
31 
33  std::string anchorLinePrefix;
34 
35 public:
36  LineNumGenerator(const TextStyle &lineStyle, unsigned int digitNum, char padding = '0');
38 
39  void setAnchorStyle(const TextStyle &_anchorStyle) {
40  anchorStyle = _anchorStyle;
41  }
42 
43  void setAnchorPrefix(const std::string &_anchorLinePrefix) {
44  anchorLinePrefix = _anchorLinePrefix;
45  }
46 
47  void setDigitNum(unsigned int _digitNum) {
48  digitNum = _digitNum;
49  }
50 
56  const std::string generateLine(unsigned int line);
57 };
58 
59 }
60 
61 #endif /*LINENUMGENERATOR_H_*/
TextStyle anchorStyle
for possible line anchor generation (can be null)
Definition: linenumgenerator.h:30
char padding
character to use for padding the line number
Definition: linenumgenerator.h:24
C++ class: doctemplate.h.
Definition: bufferedoutput.cpp:13
Generates line numbers in the output.
Definition: linenumgenerator.h:19
Represents a formatting template where there can be some variables (starting with $...
Definition: textstyle.h:36
const std::string generateLine(unsigned int line)
Generates a string representing the formatting of the passed line number.
Definition: linenumgenerator.cpp:31
std::string anchorLinePrefix
when generating an anchor for a line, use this prefix for the anchor name
Definition: linenumgenerator.h:33
unsigned int digitNum
number of digits to represent line number
Definition: linenumgenerator.h:21
TextStyle lineStyle
for actually formatting the line number
Definition: linenumgenerator.h:27