Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
doxygen-1.8.11
src
outputgen.cpp
Go to the documentation of this file.
1
/******************************************************************************
2
*
3
*
4
*
5
* Copyright (C) 1997-2015 by Dimitri van Heesch.
6
*
7
* Permission to use, copy, modify, and distribute this software and its
8
* documentation under the terms of the GNU General Public License is hereby
9
* granted. No representations are made about the suitability of this software
10
* for any purpose. It is provided "as is" without express or implied warranty.
11
* See the GNU General Public License for more details.
12
*
13
* Documents produced by Doxygen are derivative works derived from the
14
* input used in their production; they are not affected by this license.
15
*
16
*/
17
18
#include <stdlib.h>
19
20
#include <
qfile.h
>
21
22
#include "
outputgen.h
"
23
#include "
message.h
"
24
#include "
portable.h
"
25
26
OutputGenerator::OutputGenerator
()
27
{
28
//printf("OutputGenerator::OutputGenerator()\n");
29
file
=0;
30
active
=
TRUE
;
31
genStack
=
new
QStack<bool>
;
32
genStack
->
setAutoDelete
(
TRUE
);
33
}
34
35
OutputGenerator::~OutputGenerator
()
36
{
37
//printf("OutputGenerator::~OutputGenerator()\n");
38
delete
file
;
39
delete
genStack
;
40
}
41
42
void
OutputGenerator::startPlainFile
(
const
char
*
name
)
43
{
44
//printf("startPlainFile(%s)\n",name);
45
fileName
=
dir
+
"/"
+
name
;
46
file
=
new
QFile
(
fileName
);
47
if
(!
file
->
open
(
IO_WriteOnly
))
48
{
49
err
(
"Could not open file %s for writing\n"
,
fileName
.
data
());
50
exit(1);
51
}
52
t
.
setDevice
(
file
);
53
}
54
55
void
OutputGenerator::endPlainFile
()
56
{
57
t
.
unsetDevice
();
58
delete
file
;
59
file
=0;
60
fileName
.
resize
(0);
61
}
62
63
void
OutputGenerator::pushGeneratorState
()
64
{
65
genStack
->
push
(
new
bool
(
isEnabled
()));
66
//printf("%p:pushGeneratorState(%d) enabled=%d\n",this,genStack->count(),isEnabled());
67
}
68
69
void
OutputGenerator::popGeneratorState
()
70
{
71
//printf("%p:popGeneratorState(%d) enabled=%d\n",this,genStack->count(),isEnabled());
72
bool
*lb =
genStack
->
pop
();
73
ASSERT
(lb!=0);
74
if
(lb==0)
return
;
// for some robustness against superfluous \endhtmlonly commands.
75
if
(*lb)
enable
();
else
disable
();
76
delete
lb;
77
}
78
name
static QCString name
Definition:
declinfo.cpp:673
QStack::setAutoDelete
void setAutoDelete(bool del)
Definition:
qstack.h:55
QCString::resize
bool resize(uint newlen)
Definition:
qcstring.h:225
OutputGenerator::endPlainFile
void endPlainFile()
Definition:
outputgen.cpp:55
OutputGenerator::~OutputGenerator
virtual ~OutputGenerator()
Definition:
outputgen.cpp:35
OutputGenerator::enable
virtual void enable()=0
OutputGenerator::pushGeneratorState
void pushGeneratorState()
Definition:
outputgen.cpp:63
IO_WriteOnly
#define IO_WriteOnly
Definition:
qiodevice.h:62
FTextStream::setDevice
void setDevice(QIODevice *)
Definition:
ftextstream.cpp:182
QStack< bool >
FTextStream::unsetDevice
void unsetDevice()
Definition:
ftextstream.cpp:192
message.h
QStack::push
void push(const type *d)
Definition:
qstack.h:58
OutputGenerator::startPlainFile
void startPlainFile(const char *name)
Definition:
outputgen.cpp:42
OutputGenerator::active
bool active
Definition:
outputgen.h:490
OutputGenerator::genStack
QStack< bool > * genStack
Definition:
outputgen.h:491
QFile::open
bool open(int)
Definition:
qfile_unix.cpp:134
outputgen.h
QCString::data
const char * data() const
Definition:
qcstring.h:207
OutputGenerator::file
QFile * file
Definition:
outputgen.h:487
err
void err(const char *fmt,...)
Definition:
message.cpp:226
QStack::pop
type * pop()
Definition:
qstack.h:59
QFile
The QFile class is an I/O device that operates on files.
Definition:
qfile.h:50
OutputGenerator::fileName
QCString fileName
Definition:
outputgen.h:488
OutputGenerator::dir
QCString dir
Definition:
outputgen.h:489
OutputGenerator::t
FTextStream t
Definition:
outputgen.h:486
OutputGenerator::isEnabled
bool isEnabled() const
Definition:
outputgen.h:341
OutputGenerator::popGeneratorState
void popGeneratorState()
Definition:
outputgen.cpp:69
qfile.h
OutputGenerator::OutputGenerator
OutputGenerator()
Definition:
outputgen.cpp:26
OutputGenerator::disable
virtual void disable()=0
TRUE
const bool TRUE
Definition:
qglobal.h:371
portable.h
Portable versions of functions that are platform dependent.
ASSERT
#define ASSERT(x)
Definition:
qglobal.h:590
Generated by
1.8.11