Doxygen
Loading...
Searching...
No Matches
mangen.cpp File Reference
#include <stdlib.h>
#include <string.h>
#include "message.h"
#include "mangen.h"
#include "config.h"
#include "util.h"
#include "doxygen.h"
#include "docparser.h"
#include "mandocvisitor.h"
#include "language.h"
#include "dir.h"
#include "utf8.h"
#include "datetime.h"
#include "portable.h"
#include "outputlist.h"
+ Include dependency graph for mangen.cpp:

Go to the source code of this file.

Functions

static QCString getExtension ()
 
static QCString getSubdir ()
 
static QCString docifyToString (const QCString &str)
 
static QCString objectLinkToString (const QCString &text)
 
static QCString buildFileName (const QCString &name)
 

Function Documentation

◆ buildFileName()

static QCString buildFileName ( const QCString & name)
static

Definition at line 296 of file mangen.cpp.

297{
298 QCString fileName;
299 if (name.isEmpty()) return "noname";
300
301 const char *p=name.data();
302 char c = 0;
303 while ((c=*p++))
304 {
305 switch (c)
306 {
307 case ':':
308 fileName+="_";
309 if (*p==':') p++;
310 break;
311 case '<':
312 case '>':
313 case '&':
314 case '*':
315 case '!':
316 case '^':
317 case '~':
318 case '%':
319 case '+':
320 case '/':
321 fileName+="_";
322 break;
323 default:
324 fileName+=c;
325 }
326 }
327
328 QCString manExtension = "." + getExtension();
329 if (fileName.right(manExtension.length())!=manExtension)
330 {
331 fileName+=manExtension;
332 }
333
334 return fileName;
335}
This is an alternative implementation of QCString.
Definition qcstring.h:101
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition qcstring.h:153
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:150
QCString right(size_t len) const
Definition qcstring.h:219
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
static QCString getExtension()
Definition mangen.cpp:36

References QCString::data(), getExtension(), QCString::isEmpty(), QCString::length(), and QCString::right().

Referenced by ManGenerator::startDoxyAnchor(), and ManGenerator::startFile().

◆ docifyToString()

static QCString docifyToString ( const QCString & str)
static

Definition at line 79 of file mangen.cpp.

80{
81 QCString result;
82 result.reserve(str.length());
83 if (!str.isEmpty())
84 {
85 const char *p=str.data();
86 char c=0;
87 while ((c=*p++))
88 {
89 switch(c)
90 {
91 case '-': result += "\\-"; break; // see bug747780
92 case '.': result += "\\&."; break; // see bug652277
93 case '\\': result += "\\\\"; break;
94 case '\n': result += "\n"; break;
95 case '\"': c = '\''; // no break!
96 default: result += c; break;
97 }
98 }
99 //printf("%s",str);fflush(stdout);
100 }
101 return result;
102}
void reserve(size_t size)
Reserve space for size bytes without changing the string contents.
Definition qcstring.h:172

References QCString::data(), QCString::isEmpty(), QCString::length(), and QCString::reserve().

Referenced by RTFGenerator::docify(), objectLinkToString(), ManGenerator::writeInheritedSectionTitle(), and RTFGenerator::writeInheritedSectionTitle().

◆ getExtension()

static QCString getExtension ( )
static

Definition at line 36 of file mangen.cpp.

37{
38 /*
39 * [.][number][rest]
40 * in case of . missing, just ignore it
41 * in case number missing, just place a 3 in front of it
42 */
43 QCString ext = Config_getString(MAN_EXTENSION);
44 if (ext.isEmpty())
45 {
46 ext = "3";
47 }
48 else
49 {
50 if (ext.at(0)=='.')
51 {
52 if (ext.length()==1)
53 {
54 ext = "3";
55 }
56 else // strip .
57 {
58 ext = ext.mid(1);
59 }
60 }
61 if (ext.at(0)<'0' || ext.at(0)>'9')
62 {
63 ext.prepend("3");
64 }
65 }
66 return ext;
67}
QCString & prepend(const char *s)
Definition qcstring.h:407
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
Definition qcstring.h:226
char & at(size_t i)
Returns a reference to the character at index i.
Definition qcstring.h:567
#define Config_getString(name)
Definition config.h:32

References QCString::at(), Config_getString, QCString::isEmpty(), QCString::length(), QCString::mid(), and QCString::prepend().

Referenced by buildFileName(), ManGenerator::endTitleHead(), and getSubdir().

◆ getSubdir()

static QCString getSubdir ( )
static

Definition at line 69 of file mangen.cpp.

70{
71 QCString dir = Config_getString(MAN_SUBDIR);
72 if (dir.isEmpty())
73 {
74 dir = "man" + getExtension();
75 }
76 return dir;
77}

References Config_getString, getExtension(), and QCString::isEmpty().

Referenced by ManGenerator::init(), ManGenerator::ManGenerator(), and ManGenerator::startDoxyAnchor().

◆ objectLinkToString()

static QCString objectLinkToString ( const QCString & text)
static

Definition at line 104 of file mangen.cpp.

105{
106 return "\\fB" + docifyToString(text) + "\\fP";
107}
static QCString docifyToString(const QCString &str)
Definition mangen.cpp:79

References docifyToString().