summaryrefslogtreecommitdiffstats
path: root/src/outputgen.cpp
diff options
context:
space:
mode:
authordimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7>2007-02-19 18:51:10 (GMT)
committerdimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7>2007-02-19 18:51:10 (GMT)
commitf7f03d9491454ddc9b855b8637d482df6bd622c2 (patch)
treec87efff649bf31ee31966a867e71ba7f159fca43 /src/outputgen.cpp
parent1c80138e2c47e9c608b56c32b5677fa6a46b4d6f (diff)
downloadDoxygen-f7f03d9491454ddc9b855b8637d482df6bd622c2.zip
Doxygen-f7f03d9491454ddc9b855b8637d482df6bd622c2.tar.gz
Doxygen-f7f03d9491454ddc9b855b8637d482df6bd622c2.tar.bz2
Release-1.5.1-20070219
Diffstat (limited to 'src/outputgen.cpp')
-rw-r--r--src/outputgen.cpp35
1 files changed, 31 insertions, 4 deletions
diff --git a/src/outputgen.cpp b/src/outputgen.cpp
index 4a5c54a..d085312 100644
--- a/src/outputgen.cpp
+++ b/src/outputgen.cpp
@@ -2,7 +2,7 @@
*
*
*
- * Copyright (C) 1997-2006 by Dimitri van Heesch.
+ * Copyright (C) 1997-2007 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
@@ -20,6 +20,7 @@
#include "qtbc.h"
#include "outputgen.h"
#include "message.h"
+#include "portable.h"
OutputGenerator::OutputGenerator()
{
@@ -63,11 +64,37 @@ void OutputGenerator::startPlainFile(const char *name)
void OutputGenerator::endPlainFile()
{
- //printf("endPlainFile(%s)\n",file->name());
- fs.writeRawBytes(a.data(),a.size()) ; // write string buffer to file
+ bool converted=false;
+ if (!encoding.isEmpty())
+ {
+ QByteArray enc(a.size()*4);
+ void *cd = portable_iconv_open(encoding,"UTF-8");
+ if (cd!=(void *)(-1))
+ {
+ size_t iLeft=a.size();
+ size_t oLeft=enc.size();
+ const char *inputPtr = a.data();
+ char *outputPtr = enc.data();
+ if (!portable_iconv(cd, &inputPtr, &iLeft, &outputPtr, &oLeft))
+ {
+ enc.resize(enc.size()-oLeft);
+ postProcess(enc);
+ //printf("a.size()=%d enc.size()=%d iLeft=%d oLeft=%d enc2.size()=%d\n",
+ // a.size(),enc.size(),iLeft,oLeft,enc2.size());
+ fs.writeRawBytes(enc.data(),enc.size()) ; // write string buffer to file
+ converted=TRUE;
+ }
+ portable_iconv_close(cd);
+ }
+ }
+ if (!converted)
+ {
+ //printf("endPlainFile(%s)\n",file->name());
+ fs.writeRawBytes(a.data(),a.size()) ; // write string buffer to file
+ }
+ b.close();
delete file;
file=0;
- b.close();
a.resize(0);
b.setBuffer(a);
b.open(IO_WriteOnly);