blob: 3496aadd04c6d66640456f67bdee58ca2a1829bf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
/******************************************************************************
*
* $Id$
*
* Copyright (C) 1997-1999 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation under the terms of the GNU General Public License is hereby
* granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
* All output generated with Doxygen is not covered by this license.
*
*/
#include <stdlib.h>
#include "qtbc.h"
#include "outputgen.h"
#include "message.h"
OutputGenerator::OutputGenerator()
{
//printf("OutputGenerator::OutputGenerator()\n");
file=0;
b.setBuffer(a);
b.open( IO_WriteOnly );
t.setDevice(&b);
active=TRUE;
}
OutputGenerator::~OutputGenerator()
{
//printf("OutputGenerator::~OutputGenerator()\n");
delete file;
}
void OutputGenerator::startPlainFile(const char *name)
{
//printf("startPlainFile(%s)\n",name);
QCString fileName=dir+"/"+name;
file = new QFile(fileName);
if (!file)
{
err("Could not create file object for %s\n",fileName.data());
exit(1);
}
if (!file->open(IO_WriteOnly))
{
err("Could not open file %s for writing\n",fileName.data());
exit(1);
}
fs.setDevice(file);
}
void OutputGenerator::endPlainFile()
{
//printf("endPlainFile(%s)\n",file->name());
fs.writeRawBytes(a.data(),a.size()) ; // write string buffer to file
delete file;
file=0;
b.close();
a.resize(0);
b.setBuffer(a);
b.open(IO_WriteOnly);
t.setDevice(&b);
}
QCString OutputGenerator::getContents() const
{
QCString s;
s.resize(a.size()+1);
memcpy(s.data(),a.data(),a.size());
s.at(a.size())='\0';
return s;
}
|