src/corelib/xml/qxmlstream.cpp
branchRCL_3
changeset 4 3b1da2848fc7
parent 0 1918ee327afb
equal deleted inserted replaced
3:41300fa6a67c 4:3b1da2848fc7
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the QtCore module of the Qt Toolkit.
     7 ** This file is part of the QtCore module of the Qt Toolkit.
     8 **
     8 **
  2882   \reentrant
  2882   \reentrant
  2883 
  2883 
  2884   \brief The QXmlStreamWriter class provides an XML writer with a
  2884   \brief The QXmlStreamWriter class provides an XML writer with a
  2885   simple streaming API.
  2885   simple streaming API.
  2886 
  2886 
  2887 
       
  2888   \inmodule QtXml
       
  2889   \ingroup xml-tools
  2887   \ingroup xml-tools
  2890 
  2888 
  2891   QXmlStreamWriter is the counterpart to QXmlStreamReader for writing
  2889   QXmlStreamWriter is the counterpart to QXmlStreamReader for writing
  2892   XML. Like its related class, it operates on a QIODevice specified
  2890   XML. Like its related class, it operates on a QIODevice specified
  2893   with setDevice(). The API is simple and straightforward: for every
  2891   with setDevice(). The API is simple and straightforward: for every
  3004     stringDevice = 0;
  3002     stringDevice = 0;
  3005     deleteDevice = false;
  3003     deleteDevice = false;
  3006 #ifndef QT_NO_TEXTCODEC
  3004 #ifndef QT_NO_TEXTCODEC
  3007     codec = QTextCodec::codecForMib(106); // utf8
  3005     codec = QTextCodec::codecForMib(106); // utf8
  3008     encoder = codec->makeEncoder();
  3006     encoder = codec->makeEncoder();
  3009     encoder->fromUnicode(QLatin1String("")); // no byte order mark for utf8
  3007     encoder->state.flags |= QTextCodec::IgnoreHeader; // no byte order mark for utf8
  3010 #endif
  3008 #endif
  3011     inStartElement = inEmptyElement = false;
  3009     inStartElement = inEmptyElement = false;
  3012     wroteSomething = false;
  3010     wroteSomething = false;
  3013     lastWasStartElement = false;
  3011     lastWasStartElement = false;
  3014     lastNamespaceDeclaration = 1;
  3012     lastNamespaceDeclaration = 1;
  3280     if (codec) {
  3278     if (codec) {
  3281         d->codec = codec;
  3279         d->codec = codec;
  3282         delete d->encoder;
  3280         delete d->encoder;
  3283         d->encoder = codec->makeEncoder();
  3281         d->encoder = codec->makeEncoder();
  3284         if (codec->mibEnum() == 106)
  3282         if (codec->mibEnum() == 106)
  3285             d->encoder->fromUnicode(QLatin1String("")); // no byte order mark for utf8
  3283             d->encoder->state.flags |= QTextCodec::IgnoreHeader; // no byte order mark for utf8
  3286     }
  3284     }
  3287 }
  3285 }
  3288 
  3286 
  3289 /*!
  3287 /*!
  3290     Sets the codec for this stream to the QTextCodec for the encoding
  3288     Sets the codec for this stream to the QTextCodec for the encoding