Doxygen
Loading...
Searching...
No Matches
ManCodeGenerator Class Reference

Generator for Man page code fragments. More...

#include <src/mangen.h>

+ Inheritance diagram for ManCodeGenerator:
+ Collaboration diagram for ManCodeGenerator:

Public Member Functions

 ManCodeGenerator (TextStream *t)
 
void setTextStream (TextStream *t)
 
OutputType type () const override
 
std::unique_ptr< OutputCodeIntfclone () override
 
void codify (const QCString &text) override
 
void stripCodeComments (bool b) override
 
void startSpecialComment () override
 
void endSpecialComment () override
 
void setStripIndentAmount (size_t amount) override
 
void writeCodeLink (CodeSymbolType type, const QCString &ref, const QCString &file, const QCString &anchor, const QCString &name, const QCString &tooltip) override
 
void writeTooltip (const QCString &, const DocLinkInfo &, const QCString &, const QCString &, const SourceLinkInfo &, const SourceLinkInfo &) override
 
void writeLineNumber (const QCString &, const QCString &, const QCString &, int l, bool) override
 
void startCodeLine (int) override
 
void endCodeLine () override
 
void startFontClass (const QCString &) override
 
void endFontClass () override
 
void writeCodeAnchor (const QCString &) override
 
void startCodeFragment (const QCString &style) override
 
void endCodeFragment (const QCString &) override
 
void startFold (int, const QCString &, const QCString &) override
 
void endFold () override
 
- Public Member Functions inherited from OutputCodeIntf
 OutputCodeIntf ()=default
 

Private Attributes

size_t m_col = 0
 
TextStreamm_t
 
bool m_stripCodeComments = false
 
bool m_hide = false
 
size_t m_stripIndentAmount = 0
 

Detailed Description

Generator for Man page code fragments.

Definition at line 24 of file mangen.h.

Constructor & Destructor Documentation

◆ ManCodeGenerator()

ManCodeGenerator::ManCodeGenerator ( TextStream * t)

Definition at line 111 of file mangen.cpp.

111 : m_t(t)
112{
113}
TextStream * m_t
Definition mangen.h:61

References m_t.

Member Function Documentation

◆ clone()

std::unique_ptr< OutputCodeIntf > ManCodeGenerator::clone ( )
inlineoverridevirtual

Implements OutputCodeIntf.

Definition at line 31 of file mangen.h.

31{ return std::make_unique<ManCodeGenerator>(*this); }

◆ codify()

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

Implements OutputCodeIntf.

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}
size_t m_stripIndentAmount
Definition mangen.h:64
size_t m_col
Definition mangen.h:60
#define Config_getInt(name)
Definition config.h:34
const char * writeUTF8Char(TextStream &t, const char *s)
Writes the UTF8 character pointed to by s to stream t and returns a pointer to the next character.
Definition utf8.cpp:197
size_t updateColumnCount(const char *s, size_t col)
Definition util.cpp:7207

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 & )
overridevirtual

Implements OutputCodeIntf.

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 ( )
inlineoverridevirtual

Implements OutputCodeIntf.

Definition at line 50 of file mangen.h.

50{ codify("\n"); m_col=0; }
void codify(const QCString &text) override
Definition mangen.cpp:162

References codify(), and m_col.

◆ endFold()

void ManCodeGenerator::endFold ( )
inlineoverridevirtual

Implements OutputCodeIntf.

Definition at line 57 of file mangen.h.

57{}

◆ endFontClass()

void ManCodeGenerator::endFontClass ( )
inlineoverridevirtual

Implements OutputCodeIntf.

Definition at line 52 of file mangen.h.

52{}

◆ endSpecialComment()

void ManCodeGenerator::endSpecialComment ( )
overridevirtual

Implements OutputCodeIntf.

Definition at line 215 of file mangen.cpp.

216{
217 m_hide = false;
218}

References m_hide.

◆ setStripIndentAmount()

void ManCodeGenerator::setStripIndentAmount ( size_t amount)
overridevirtual

Implements OutputCodeIntf.

Definition at line 220 of file mangen.cpp.

221{
222 m_stripIndentAmount = amount;
223}

References m_stripIndentAmount.

◆ setTextStream()

void ManCodeGenerator::setTextStream ( TextStream * t)
inline

Definition at line 28 of file mangen.h.

28{ m_t = t; }

References m_t.

◆ startCodeFragment()

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

Implements OutputCodeIntf.

Definition at line 115 of file mangen.cpp.

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

References m_t.

◆ startCodeLine()

void ManCodeGenerator::startCodeLine ( int )
inlineoverridevirtual

Implements OutputCodeIntf.

Definition at line 49 of file mangen.h.

49{}

◆ startFold()

void ManCodeGenerator::startFold ( int ,
const QCString & ,
const QCString &  )
inlineoverridevirtual

Implements OutputCodeIntf.

Definition at line 56 of file mangen.h.

56{}

◆ startFontClass()

void ManCodeGenerator::startFontClass ( const QCString & )
inlineoverridevirtual

Implements OutputCodeIntf.

Definition at line 51 of file mangen.h.

51{}

◆ startSpecialComment()

void ManCodeGenerator::startSpecialComment ( )
overridevirtual

Implements OutputCodeIntf.

Definition at line 210 of file mangen.cpp.

211{
213}
bool m_stripCodeComments
Definition mangen.h:62

References m_hide, and m_stripCodeComments.

◆ stripCodeComments()

void ManCodeGenerator::stripCodeComments ( bool b)
overridevirtual

Implements OutputCodeIntf.

Definition at line 205 of file mangen.cpp.

206{
208}

References m_stripCodeComments.

◆ type()

OutputType ManCodeGenerator::type ( ) const
inlineoverridevirtual

Implements OutputCodeIntf.

Definition at line 30 of file mangen.h.

30{ return OutputType::Man; }

References Man.

◆ writeCodeAnchor()

void ManCodeGenerator::writeCodeAnchor ( const QCString & )
inlineoverridevirtual

Implements OutputCodeIntf.

Definition at line 53 of file mangen.h.

53{}

◆ writeCodeLink()

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

Implements OutputCodeIntf.

Definition at line 136 of file mangen.cpp.

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}
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:150
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition qcstring.h:159

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  )
overridevirtual

Implements OutputCodeIntf.

Definition at line 129 of file mangen.cpp.

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 &  )
inlineoverridevirtual

Implements OutputCodeIntf.

Definition at line 41 of file mangen.h.

47 {}

Member Data Documentation

◆ m_col

size_t ManCodeGenerator::m_col = 0
private

Definition at line 60 of file mangen.h.

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

◆ m_hide

bool ManCodeGenerator::m_hide = false
private

◆ m_stripCodeComments

bool ManCodeGenerator::m_stripCodeComments = false
private

Definition at line 62 of file mangen.h.

Referenced by startSpecialComment(), and stripCodeComments().

◆ m_stripIndentAmount

size_t ManCodeGenerator::m_stripIndentAmount = 0
private

Definition at line 64 of file mangen.h.

Referenced by codify(), and setStripIndentAmount().

◆ m_t

TextStream* ManCodeGenerator::m_t
private

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