Skip to main content

The ManCodeGenerator Class Reference

Generator for Man page code fragments. More...

Declaration

class ManCodeGenerator { ... }

Included Headers

#include <src/mangen.h>

Base class

classOutputCodeIntf

Base class for code generators. More...

Public Constructors Index

ManCodeGenerator (TextStream *t)

Public Member Functions Index

voidsetTextStream (TextStream *t)
OutputTypetype () const override
std::unique_ptr< OutputCodeIntf >clone () override
voidcodify (const QCString &text) override
voidstripCodeComments (bool b) override
voidstartSpecialComment () override
voidendSpecialComment () override
voidsetStripIndentAmount (size_t amount) override
voidwriteCodeLink (CodeSymbolType type, const QCString &ref, const QCString &file, const QCString &anchor, const QCString &name, const QCString &tooltip) override
voidwriteTooltip (const QCString &, const DocLinkInfo &, const QCString &, const QCString &, const SourceLinkInfo &, const SourceLinkInfo &) override
voidwriteLineNumber (const QCString &, const QCString &, const QCString &, int l, bool) override
voidstartCodeLine (int) override
voidendCodeLine () override
voidstartFontClass (const QCString &) override
voidendFontClass () override
voidwriteCodeAnchor (const QCString &) override
voidstartCodeFragment (const QCString &style) override
voidendCodeFragment (const QCString &) override
voidstartFold (int, const QCString &, const QCString &) override
voidendFold () override

Private Member Attributes Index

size_tm_col = 0
TextStream *m_t
boolm_stripCodeComments = false
boolm_hide = false
size_tm_stripIndentAmount = 0

Description

Generator for Man page code fragments.

Definition at line 24 of file mangen.h.

Public Constructors

ManCodeGenerator()

ManCodeGenerator::ManCodeGenerator (TextStream * t)

Declaration at line 27 of file mangen.h, definition at line 111 of file mangen.cpp.

Reference m_t.

Public Member Functions

clone()

std::unique_ptr< OutputCodeIntf > ManCodeGenerator::clone ()
inline virtual

Definition at line 31 of file mangen.h.

31 std::unique_ptr<OutputCodeIntf> clone() override { return std::make_unique<ManCodeGenerator>(*this); }

codify()

void ManCodeGenerator::codify (const QCString & text)
virtual

Declaration at line 32 of file mangen.h, definition at line 162 of file mangen.cpp.

163{
164 const int tabSize = Config_getInt(TAB_SIZE);
165 const size_t stripAmount = m_stripIndentAmount;
166 if (!str.isEmpty())
167 {
168 char c;
169 const char *p=str.data();
170 if (m_hide)
171 {
173 }
174 else
175 {
176 while ((c=*p++))
177 {
178 switch(c)
179 {
180 case '-': *m_t << "\\-"; break; // see bug747780
181 case '.': *m_t << "\\&."; break; // see bug652277
182 case '\t': {
183 int spacesToNextTabStop = tabSize - (m_col%tabSize);
184 while (spacesToNextTabStop--)
185 {
186 if (m_col>=stripAmount) *m_t << " ";
187 m_col++;
188 }
189 }
190 break;
191 case ' ': if (m_col>=stripAmount) *m_t << " ";
192 m_col++;
193 break;
194 case '\n': *m_t << "\n"; m_col=0; break;
195 case '\\': *m_t << "\\\\"; m_col++; break;
196 case '\"': // no break!
197 default: p=writeUTF8Char(*m_t,p-1); m_col++; break;
198 }
199 }
200 //printf("%s",str);fflush(stdout);
201 }
202 }
203}

References Config_getInt, QCString::data, QCString::isEmpty, m_col, m_hide, m_stripIndentAmount, m_t, updateColumnCount and writeUTF8Char.

Referenced by endCodeLine.

endCodeFragment()

void ManCodeGenerator::endCodeFragment (const QCString &)
virtual

Declaration at line 55 of file mangen.h, definition at line 121 of file mangen.cpp.

122{
123 if (m_col>0) *m_t << "\n";
124 *m_t << ".PP\n";
125 *m_t << ".fi\n";
126 m_col=0;
127}

References m_col and m_t.

endCodeLine()

void ManCodeGenerator::endCodeLine ()
inline virtual

Definition at line 50 of file mangen.h.

50 void endCodeLine() override { codify("\n"); m_col=0; }

References codify and m_col.

endFold()

void ManCodeGenerator::endFold ()
inline virtual

Definition at line 57 of file mangen.h.

57 void endFold() override {}

endFontClass()

void ManCodeGenerator::endFontClass ()
inline virtual

Definition at line 52 of file mangen.h.

52 void endFontClass() override {}

endSpecialComment()

void ManCodeGenerator::endSpecialComment ()
virtual

Declaration at line 35 of file mangen.h, definition at line 215 of file mangen.cpp.

216{
217 m_hide = false;
218}

Reference m_hide.

setStripIndentAmount()

void ManCodeGenerator::setStripIndentAmount (size_t amount)
virtual

Declaration at line 36 of file mangen.h, definition at line 220 of file mangen.cpp.

221{
222 m_stripIndentAmount = amount;
223}

Reference m_stripIndentAmount.

setTextStream()

void ManCodeGenerator::setTextStream (TextStream * t)
inline

Definition at line 28 of file mangen.h.

28 void setTextStream(TextStream *t) { m_t = t; }

Reference m_t.

startCodeFragment()

void ManCodeGenerator::startCodeFragment (const QCString & style)
virtual

Declaration at line 54 of file mangen.h, definition at line 115 of file mangen.cpp.

116{
117 *m_t << "\n";
118 *m_t << ".nf\n";
119}

Reference m_t.

startCodeLine()

void ManCodeGenerator::startCodeLine (int)
inline virtual

Definition at line 49 of file mangen.h.

49 void startCodeLine(int) override {}

startFold()

void ManCodeGenerator::startFold (int, const QCString &, const QCString &)
inline virtual

Definition at line 56 of file mangen.h.

56 void startFold(int,const QCString &,const QCString &) override {}

startFontClass()

void ManCodeGenerator::startFontClass (const QCString &)
inline virtual

Definition at line 51 of file mangen.h.

51 void startFontClass(const QCString &) override {}

startSpecialComment()

void ManCodeGenerator::startSpecialComment ()
virtual

Declaration at line 34 of file mangen.h, definition at line 210 of file mangen.cpp.

References m_hide and m_stripCodeComments.

stripCodeComments()

void ManCodeGenerator::stripCodeComments (bool b)
virtual

Declaration at line 33 of file mangen.h, definition at line 205 of file mangen.cpp.

Reference m_stripCodeComments.

type()

OutputType ManCodeGenerator::type ()
inline virtual

Definition at line 30 of file mangen.h.

30 OutputType type() const override { return OutputType::Man; }

Reference Man.

writeCodeAnchor()

void ManCodeGenerator::writeCodeAnchor (const QCString &)
inline virtual

Definition at line 53 of file mangen.h.

53 void writeCodeAnchor(const QCString &) override {}

writeCodeLink()

void ManCodeGenerator::writeCodeLink (CodeSymbolType type, const QCString & ref, const QCString & file, const QCString & anchor, const QCString & name, const QCString & tooltip)
virtual

Declaration at line 37 of file mangen.h, definition at line 136 of file mangen.cpp.

137 const QCString &,const QCString &,
138 const QCString &, const QCString &name,
139 const QCString &)
140{
141 if (m_hide) return;
142 if (!name.isEmpty())
143 {
144 const char *p=name.data();
145 char c=0;
146 while ((c=*p++))
147 {
148 switch(c)
149 {
150 case '-': *m_t << "\\-"; break; // see bug747780
151 case '.': *m_t << "\\&."; break; // see bug652277
152 case '\\': *m_t << "\\\\"; m_col++; break;
153 case '\n': *m_t << "\n"; m_col=0; break;
154 case '\"': c = '\''; // no break!
155 default: *m_t << c; m_col++; break;
156 }
157 }
158 //printf("%s",str);fflush(stdout);
159 }
160}

References QCString::data, QCString::isEmpty, m_col, m_hide and m_t.

writeLineNumber()

void ManCodeGenerator::writeLineNumber (const QCString &, const QCString &, const QCString &, int l, bool)
virtual

Declaration at line 48 of file mangen.h, definition at line 129 of file mangen.cpp.

129void ManCodeGenerator::writeLineNumber(const QCString &,const QCString &,const QCString &,int l, bool)
130{
131 if (m_hide) return;
132 *m_t << l << " ";
133 m_col=0;
134}

References m_col, m_hide and m_t.

writeTooltip()

void ManCodeGenerator::writeTooltip (const QCString &, const DocLinkInfo &, const QCString &, const QCString &, const SourceLinkInfo &, const SourceLinkInfo &)
inline virtual

Definition at line 41 of file mangen.h.

41 void writeTooltip(const QCString &,
42 const DocLinkInfo &,
43 const QCString &,
44 const QCString &,
45 const SourceLinkInfo &,
46 const SourceLinkInfo &
47 ) override {}

Private Member Attributes

m_col

size_t ManCodeGenerator::m_col = 0

Definition at line 60 of file mangen.h.

60 size_t m_col = 0;

Referenced by codify, endCodeFragment, endCodeLine, writeCodeLink and writeLineNumber.

m_hide

bool ManCodeGenerator::m_hide = false

Definition at line 63 of file mangen.h.

63 bool m_hide = false;

Referenced by codify, endSpecialComment, startSpecialComment, writeCodeLink and writeLineNumber.

m_stripCodeComments

bool ManCodeGenerator::m_stripCodeComments = false

Definition at line 62 of file mangen.h.

62 bool m_stripCodeComments = false;

Referenced by startSpecialComment and stripCodeComments.

m_stripIndentAmount

size_t ManCodeGenerator::m_stripIndentAmount = 0

Definition at line 64 of file mangen.h.

Referenced by codify and setStripIndentAmount.

m_t

TextStream* ManCodeGenerator::m_t

The documentation for this class was generated from the following files:


Generated via doxygen2docusaurus by Doxygen 1.14.0.