Orb/Doxygen/src/xmlwriter.cpp
author Jonathan Harrington <jonathan.harrington@nokia.com>
Wed, 11 Aug 2010 14:49:30 +0100
changeset 4 468f4c8d3d5b
parent 3 d8fccb2cd802
permissions -rw-r--r--
Orb version 0.2.0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
     1
/******************************************************************************
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
     2
 *
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
     3
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
     4
 *
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
     5
 * Permission to use, copy, modify, and distribute this software and its
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
     6
 * documentation under the terms of the GNU General Public License is hereby 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
     7
 * granted. No representations are made about the suitability of this software 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
     8
 * for any purpose. It is provided "as is" without express or implied warranty.
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
     9
 * See the GNU General Public License for more details.
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    10
 *
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    11
 */
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    12
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    13
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    14
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    15
#include "xmlwriter.h"
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    16
#include "message.h"
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    17
#include "xmldita.h"
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    18
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    19
char ILLEGAL_UNICODE_REPLACEMENT = ' ';
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    20
/******************** XmlStream ********************/
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    21
XmlStream::XmlStream(const QString &fileName, const QString &aEncoding, const QString &aStandalone, const QString &doctypeStr) : mFile(fileName), \
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    22
											mStreamP(0), \
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    23
											mElemStack(), \
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    24
											mInElement(false)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    25
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    26
	mCanIndentList.setAutoDelete(true);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    27
	mIsOpen = mFile.open(IO_WriteOnly);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    28
	if (mIsOpen) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    29
		mStreamP = new QTextStream(&mFile);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    30
		if (aEncoding == "UTF-8") {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    31
			mStreamP->setEncoding(QTextStream::UnicodeUTF8);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    32
		} else if(aEncoding == "Latin1") {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    33
			mStreamP->setEncoding(QTextStream::Latin1);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    34
		} else if(aEncoding == "ISO-8859-1") {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    35
			mStreamP->setEncoding(QTextStream::Latin1);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    36
		} else {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    37
			// No specific encoding set
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    38
		}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    39
		*mStreamP << "<?xml version='1.0' encoding='" << aEncoding << "' standalone='" << aStandalone << "'?>";
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    40
		if (doctypeStr.length() > 0) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    41
			*mStreamP << "\n<!DOCTYPE " << doctypeStr << ">";
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    42
		}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    43
	} else {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    44
		mStreamP = 0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    45
		err("Cannot open file %s for writing!\n", fileName.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    46
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    47
	// Allow output
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    48
	outputResume();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    49
	/// Build text -> unicode map
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    50
	unicodeCharTable.insert("copy", "A9");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    51
	unicodeCharTable.insert("trade", "2122");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    52
	unicodeCharTable.insert("reg", "AE");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    53
	unicodeCharTable.insert("lsquo", "60");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    54
	unicodeCharTable.insert("rsquo", "B4");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    55
	unicodeCharTable.insert("ldquo", "201C");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    56
	unicodeCharTable.insert("rdquo", "201D");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    57
	unicodeCharTable.insert("ndash", "2013");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    58
	unicodeCharTable.insert("mdash", "2014");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    59
	unicodeCharTable.insert("Auml", "C4");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    60
	unicodeCharTable.insert("Euml", "CB");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    61
	unicodeCharTable.insert("Iuml", "CF");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    62
	unicodeCharTable.insert("Ouml", "F6");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    63
	unicodeCharTable.insert("Uuml", "FC");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    64
	unicodeCharTable.insert("Yuml", "178");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    65
	unicodeCharTable.insert("auml", "E4");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    66
	unicodeCharTable.insert("euml", "EB");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    67
	unicodeCharTable.insert("iuml", "EF");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    68
	unicodeCharTable.insert("ouml", "F6");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    69
	unicodeCharTable.insert("uuml", "FC");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    70
	unicodeCharTable.insert("yuml", "FF");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    71
	unicodeCharTable.insert("Aacute", "C1");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    72
	unicodeCharTable.insert("Eacute", "C9");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    73
	unicodeCharTable.insert("Iacute", "CD");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    74
	unicodeCharTable.insert("Oacute", "D3");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    75
	unicodeCharTable.insert("Uacute", "DA");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    76
	unicodeCharTable.insert("Yacute", "DD");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    77
	unicodeCharTable.insert("aacute", "E1");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    78
	unicodeCharTable.insert("eacute", "E9");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    79
	unicodeCharTable.insert("iacute", "ED");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    80
	unicodeCharTable.insert("oacute", "F3");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    81
	unicodeCharTable.insert("uacute", "FA");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    82
	unicodeCharTable.insert("yacute", "FD");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    83
	unicodeCharTable.insert("Agrave", "C0");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    84
	unicodeCharTable.insert("Egrave", "C8");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    85
	unicodeCharTable.insert("Igrave", "CC");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    86
	unicodeCharTable.insert("Ograve", "D2");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    87
	unicodeCharTable.insert("Ugrave", "F9");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    88
	unicodeCharTable.insert("agrave", "E0");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    89
	unicodeCharTable.insert("egrave", "E8");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    90
	unicodeCharTable.insert("igrave", "EC");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    91
	unicodeCharTable.insert("ograve", "F2");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    92
	unicodeCharTable.insert("ugrave", "F9");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    93
	//unicodeCharTable.insert("ygrave", ""); In doxygen documentation but code unknown or doesn't exist
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    94
	unicodeCharTable.insert("Acirc", "C2");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    95
	unicodeCharTable.insert("Ecirc", "CA");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    96
	unicodeCharTable.insert("Icirc", "CE");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    97
	unicodeCharTable.insert("Ocirc", "D4");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    98
	unicodeCharTable.insert("Ucirc", "DB");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
    99
	unicodeCharTable.insert("acirc", "E2");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   100
	unicodeCharTable.insert("ecirc", "EA");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   101
	unicodeCharTable.insert("icirc", "EE");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   102
	unicodeCharTable.insert("ocirc", "F4");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   103
	unicodeCharTable.insert("ucirc", "FB");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   104
	//unicodeCharTable.insert("ycirc", ""); In doxygen documentation but code unknown or doesn't exist
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   105
	unicodeCharTable.insert("Atilde", "C3");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   106
	unicodeCharTable.insert("Ntilde", "D1");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   107
	unicodeCharTable.insert("Otilde", "D5");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   108
	unicodeCharTable.insert("atilde", "E3");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   109
	unicodeCharTable.insert("ntilde", "F1");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   110
	unicodeCharTable.insert("otilde", "F5");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   111
	unicodeCharTable.insert("szlig", "DF");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   112
	unicodeCharTable.insert("Ccedil", "C7");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   113
	unicodeCharTable.insert("ccedil", "E7");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   114
	unicodeCharTable.insert("Aring", "C5");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   115
	unicodeCharTable.insert("aring", "E5");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   116
	unicodeCharTable.insert("Oslash", "D8");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   117
	unicodeCharTable.insert("oslash", "F8");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   118
	unicodeCharTable.insert("nbsp", "A0");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   119
	unicodeCharTable.insert("AElig", "C6");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   120
	unicodeCharTable.insert("aelig", "E6");
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   121
	
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   122
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   123
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   124
void XmlStream::startElement(const QString& aElemName, const AttributeMap& aAttrs)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   125
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   126
	if (mStreamP && mIsOpen && mCanWrite) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   127
		if (mInElement) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   128
			// Close existing element
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   129
			*mStreamP << ">";
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   130
		} else {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   131
			mInElement = true;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   132
		}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   133
		indent();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   134
		// Write element name
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   135
		*mStreamP << "<" << aElemName;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   136
		// Attributes in sorted order
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   137
		AttributeMapIter it = aAttrs.begin();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   138
		while (it != aAttrs.end()){
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   139
			QString attrVal = encodeText(it.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   140
			*mStreamP << " " << it.key() << "=\"" << attrVal << "\"";
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   141
			++it;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   142
		}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   143
		// Update internals
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   144
		mInElement = true;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   145
		//mCanIndent = true;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   146
		mElemStack.push(&aElemName);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   147
		mCanIndentList.append(new bool(true));
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   148
	}
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   149
	flushStream();
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   150
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   151
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   152
void XmlStream::characters(const QString& aText)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   153
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   154
	// If this test was not here then if passed an empty string the stream
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   155
	// will end up writing <Element></Element> rather than <Element/>
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   156
	if (aText.length() > 0) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   157
		if (mStreamP && mIsOpen && mCanWrite) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   158
			closeElementDeclIfOpen();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   159
			*mStreamP << encodeText(aText);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   160
		}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   161
		// Don't indent mixed content
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   162
		//mCanIndent = false;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   163
		setLastIndent(false);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   164
	}
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   165
	flushStream();
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   166
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   167
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   168
void XmlStream::characters(char c)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   169
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   170
	if (mStreamP && mIsOpen && mCanWrite) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   171
		closeElementDeclIfOpen();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   172
		if (isLegalXmlChar(c)) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   173
			if (mustEncodeChar(c)) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   174
				*mStreamP << encodeChar(c);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   175
			} else {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   176
				*mStreamP << c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   177
			}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   178
		} else {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   179
			*mStreamP << ILLEGAL_UNICODE_REPLACEMENT;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   180
		}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   181
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   182
	// Don't indent mixed content
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   183
	//mCanIndent = false;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   184
	setLastIndent(false);
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   185
	flushStream();
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   186
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   187
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   188
XmlStream& XmlStream::operator<<(const QCString& s)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   189
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   190
    characters(s);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   191
	return *this;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   192
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   193
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   194
XmlStream& XmlStream::operator<<(const char* s)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   195
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   196
    characters(s);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   197
	return *this;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   198
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   199
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   200
XmlStream& XmlStream::operator<<(char c)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   201
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   202
    characters(c);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   203
	return *this;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   204
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   205
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   206
XmlStream& XmlStream::writeUnicode(const QCString& s)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   207
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   208
	if (mStreamP && mIsOpen && mCanWrite) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   209
		closeElementDeclIfOpen();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   210
		if (unicodeCharTable.find(s)) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   211
			*mStreamP << "&#x";
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   212
			*mStreamP << unicodeCharTable[s];
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   213
			*mStreamP << ";";
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   214
		} else {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   215
			// Write a warning as a comment
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   216
			QString cmtTxt = "Can not write Unicode for Doxygen interpreted symbol: \"";
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   217
			cmtTxt += s;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   218
			cmtTxt += "\"";
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   219
			comment(cmtTxt);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   220
		}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   221
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   222
	// Don't indent mixed content
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   223
	//mCanIndent = false;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   224
	setLastIndent(false);
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   225
	flushStream();
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   226
	return *this;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   227
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   228
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   229
void XmlStream::processingInstruction(const QString& aText)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   230
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   231
	if (mStreamP && mIsOpen && mCanWrite) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   232
		closeElementDeclIfOpen();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   233
		*mStreamP << "<?" << aText << "?>";
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   234
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   235
	//mCanIndent = true;
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   236
	flushStream();
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   237
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   238
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   239
void XmlStream::comment(const QString& aText)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   240
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   241
	if (mStreamP && mIsOpen && mCanWrite) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   242
		closeElementDeclIfOpen();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   243
		*mStreamP << "<!-- " << aText << " -->";
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   244
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   245
	//mCanIndent = true;
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   246
	flushStream();
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   247
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   248
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   249
void XmlStream::endElement(const QString& aElemName)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   250
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   251
	if (mStreamP && mIsOpen && mCanWrite) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   252
		if (mInElement) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   253
			// Use minimal form
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   254
			*mStreamP << "/>";
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   255
			mInElement = false;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   256
			mElemStack.pop();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   257
		} else {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   258
			indent(1);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   259
			*mStreamP << "</" << *(mElemStack.pop()) << ">";
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   260
		}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   261
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   262
	mCanIndentList.removeLast();
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   263
	flushStream();
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   264
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   265
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   266
void XmlStream::closeElementDeclIfOpen()
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   267
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   268
	if (mStreamP && mIsOpen && mCanWrite) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   269
		if (mInElement) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   270
			*mStreamP << ">";
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   271
			mInElement = false;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   272
		}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   273
	}
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   274
	flushStream();
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   275
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   276
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   277
void XmlStream::indent(unsigned int aInitVal)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   278
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   279
	if (mStreamP && mIsOpen && canIndent() && mCanWrite) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   280
		*mStreamP << XML_OUTPUT_ENDL;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   281
		for (unsigned int i = aInitVal; i < mElemStack.count(); i++) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   282
			*mStreamP << XML_INDENT;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   283
		}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   284
	}
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   285
	flushStream();
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   286
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   287
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   288
/** Returns 1 if the character is in the legal unicode range
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   289
See: http://www.w3.org/TR/REC-xml/#charsets
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   290
*/
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   291
inline bool XmlStream::isLegalXmlChar(QChar c) const
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   292
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   293
	ushort u = c.unicode();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   294
	//printf("XmlStream::isLegalXmlChar() testing 0x%X\n", u);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   295
	// This is what the code should be:
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   296
	/*
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   297
	bool result = (u == 0x09 || u == 0x0A || u == 0x0D || \
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   298
				((u >= 0x20) && (u <= 0xD7FF)) || \
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   299
				((u >= 0xE000) && (u <= 0xFFFD)) \
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   300
			);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   301
	*/
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   302
	// An this is the kludge that prevents weird characters (e.g. 0xA0)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   303
	// that appear in the source code from getting into the XML.
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   304
	bool result = (u == 0x09 || u == 0x0A || u == 0x0D || \
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   305
				((u >= 0x20) && (u <= 0x7F)) \
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   306
			);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   307
	if (!result) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   308
		msg("XmlStream::isLegalXmlChar() rejecting 0x%X\n", u);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   309
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   310
	return result;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   311
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   312
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   313
QString XmlStream::encodeText(const QString& aStr) const
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   314
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   315
	QCString result;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   316
	//printf("XmlStream::encodeText() encoding \"%s\"\n", aStr.data());
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   317
	for (unsigned int i=0; i < aStr.length(); ++i) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   318
		if (isLegalXmlChar(aStr[i])) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   319
			char c = aStr[i];
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   320
			if (mustEncodeChar(c)) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   321
				result += encodeChar(c);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   322
			} else {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   323
				result += c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   324
			}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   325
		} else {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   326
			result += ILLEGAL_UNICODE_REPLACEMENT;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   327
		}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   328
  }
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   329
  return result;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   330
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   331
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   332
/** Converts a char to a QString using XML entity transformaiton */
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   333
QString XmlStream::encodeChar(char c) const
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   334
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   335
	switch (c) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   336
		case '<': return QString("&lt;");	break;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   337
		case '>': return QString("&gt;"); break;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   338
		case '&': return QString("&amp;");  break;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   339
		case '\'': return QString("&apos;"); break; 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   340
		case '"': return QString("&quot;"); break;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   341
		default:
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   342
			QString s;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   343
			s += c;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   344
			return s;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   345
			break;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   346
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   347
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   348
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   349
/** Returns true if a char needs to be converted using XML entity transformaiton */
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   350
bool XmlStream::mustEncodeChar(char c) const
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   351
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   352
	switch (c) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   353
		// Note fall through
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   354
		case '<':
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   355
		case '>':
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   356
		case '&':
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   357
		case '\'':
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   358
		case '"':
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   359
			return true;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   360
			break;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   361
		default:
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   362
			break;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   363
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   364
	return false;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   365
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   366
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   367
bool XmlStream::canIndent()
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   368
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   369
	bool *bP;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   370
	for (bP = mCanIndentList.first(); bP != 0; bP = mCanIndentList.next()) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   371
		if (!*bP) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   372
			return false;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   373
		}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   374
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   375
	return true;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   376
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   377
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   378
void XmlStream::setLastIndent(bool theB)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   379
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   380
	mCanIndentList.removeLast();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   381
	mCanIndentList.append(new bool(theB));
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   382
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   383
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   384
/// Flush the stream for debugg/trace
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   385
void XmlStream::flushStream()
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   386
{
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   387
#ifdef DITA_TRACE
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   388
#ifdef DITA_TRACE_TO_XML
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   389
	// Useful for assertion crashes where otherwise the buffer would be lost
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   390
	if (mStreamP) {
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   391
		// Call QT's global function (!)
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   392
		flush(*mStreamP);
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   393
	}
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   394
#endif
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   395
#endif
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   396
}
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   397
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   398
/// Suspend output
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   399
void XmlStream::outputSuspend()
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   400
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   401
	mCanWrite = false;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   402
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   403
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   404
/// Resume output
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   405
void XmlStream::outputResume()
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   406
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   407
	mCanWrite = true;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   408
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   409
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   410
void XmlStream::close()
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   411
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   412
	if (mStreamP) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   413
		// Ignore mCanWrite
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   414
		outputResume();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   415
		closeElementDeclIfOpen();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   416
		while(mElemStack.count()){
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   417
			endElement(mElemStack[mElemStack.count()-1]);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   418
		}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   419
		// Delete the stream and close the file
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   420
		delete mStreamP;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   421
		mStreamP = 0;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   422
		mFile.close();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   423
		mIsOpen = false;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   424
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   425
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   426
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   427
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   428
XmlStream::~XmlStream()
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   429
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   430
	try {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   431
		close();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   432
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   433
	catch(...) {}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   434
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   435
/******************** END: XmlStream ********************/
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   436
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   437
/******************** XmlElement ********************/
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   438
XmlElement::XmlElement(XmlStream& aStream, const QString& aElemName) : mStream(aStream), mElemName(aElemName)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   439
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   440
	AttributeMap attrs;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   441
	mStream.startElement(mElemName, attrs);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   442
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   443
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   444
XmlElement::XmlElement(XmlStream& aStream, const QString& aElemName, const QString& aAttr, const QString& aAttrValue) : mStream(aStream), mElemName(aElemName)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   445
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   446
	AttributeMap attrs;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   447
	attrs[aAttr] = aAttrValue;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   448
	mStream.startElement(mElemName, attrs);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   449
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   450
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   451
XmlElement::XmlElement(XmlStream& aStream, const QString& aElemName, const QString& aAttr, char aAttrValue) : mStream(aStream), mElemName(aElemName)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   452
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   453
	AttributeMap attrs;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   454
	attrs[aAttr] = QChar(aAttrValue);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   455
	mStream.startElement(mElemName, attrs);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   456
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   457
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   458
XmlElement::XmlElement(XmlStream& aStream, const QString& aElemName, AttributeMap& aAttrs) : mStream(aStream), mElemName(aElemName)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   459
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   460
	mStream.startElement(mElemName, aAttrs);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   461
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   462
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   463
/*
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   464
// Parse an attribute string of the form "attr_0=value_0 attr_1=value_1"
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   465
XmlElement::XmlElement(XmlStream& aStream, const QString& aElemName, const QString& aAttrString) : mStream(aStream), mElemName(aElemName)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   466
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   467
	AttributeMap attrMap;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   468
	QString myStr = aAttrString.simplifyWhiteSpace();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   469
	int s = 0; // Index of start of attr
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   470
	int e = 0; // Index of '='
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   471
	int v = 0; // Index of end of value
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   472
	while (s < (int) myStr.length()) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   473
		e = s;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   474
		v = s;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   475
		e = myStr.find('=', s);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   476
		if (e == -1) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   477
			break;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   478
		}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   479
		v = myStr.find(' ', s);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   480
		if (v == -1) {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   481
			v = myStr.length();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   482
		}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   483
		attrMap[myStr.mid(s, e-s)] = myStr.mid(e+1, v-(e+1));
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   484
		s = v+1;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   485
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   486
	mStream.startElement(mElemName, attrMap);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   487
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   488
*/
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   489
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   490
XmlElement::~XmlElement()
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   491
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   492
	try {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   493
		mStream.endElement(mElemName);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   494
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   495
	catch(...) {}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   496
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   497
/******************** END: XmlElement ********************/
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   498
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   499
/******************** XmlElementStack ********************/
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   500
XmlElementStack::XmlElementStack(XmlStream& aStream) : mStream(aStream)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   501
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   502
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   503
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   504
void XmlElementStack::push(const QString& aElementName)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   505
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   506
	mElemStack.push(new XmlElement(mStream, aElementName));
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   507
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   508
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   509
void XmlElementStack::push(const QString& aElementName, const QString& aAttr, const QString& aAttrValue)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   510
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   511
	mElemStack.push(new XmlElement(mStream, aElementName, aAttr, aAttrValue));
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   512
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   513
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   514
void XmlElementStack::push(const QString& aElementName, AttributeMap& aAttrs)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   515
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   516
	mElemStack.push(new XmlElement(mStream, aElementName, aAttrs));
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   517
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   518
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   519
void XmlElementStack::pop(const QString &aElementName)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   520
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   521
	XmlElement *pElem = mElemStack.pop();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   522
	if (pElem->getElemName() != aElementName) {
4
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   523
		QString errStr("XmlElementStack::pop(\"" + aElementName + "\") is not equal to \"" + pElem->getElemName() +"\"\n");
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   524
		mStream.comment(errStr);
468f4c8d3d5b Orb version 0.2.0
Jonathan Harrington <jonathan.harrington@nokia.com>
parents: 3
diff changeset
   525
		err(errStr);
3
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   526
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   527
	ASSERT(pElem->getElemName() == aElementName);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   528
	delete pElem;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   529
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   530
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   531
void XmlElementStack::pop()
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   532
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   533
	XmlElement *pElem = mElemStack.pop();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   534
	delete pElem;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   535
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   536
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   537
void XmlElementStack::pushpop(const QString &aElementName)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   538
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   539
	mElemStack.push(new XmlElement(mStream, aElementName));
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   540
	pop(aElementName);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   541
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   542
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   543
void XmlElementStack::pushpop(const QString &aElementName, const QString& aText)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   544
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   545
	mElemStack.push(new XmlElement(mStream, aElementName));
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   546
	mStream.characters(aText);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   547
	pop(aElementName);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   548
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   549
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   550
bool XmlElementStack::isEmpty() const
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   551
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   552
	return mElemStack.isEmpty();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   553
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   554
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   555
const XmlElement& XmlElementStack::peek() const 
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   556
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   557
	return *mElemStack.top();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   558
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   559
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   560
void XmlElementStack::addAttribute(const QString &name, const QString &value)
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   561
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   562
	XmlElement *pElem = mElemStack.pop();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   563
	QString elemenName = pElem->getElemName();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   564
	delete pElem;
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   565
	XmlElement *elem = new XmlElement(mStream, elemenName, name, value);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   566
	mElemStack.push(elem);
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   567
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   568
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   569
void XmlElementStack::close()
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   570
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   571
	while(mElemStack.count()){
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   572
		pop();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   573
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   574
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   575
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   576
XmlElementStack::~XmlElementStack()
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   577
{
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   578
	try {
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   579
		close();
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   580
	}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   581
	catch(...) {}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   582
}
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   583
/******************** END: XmlElementStack ********************/
d8fccb2cd802 Orb version 0.1.9. Fixes Bug 1965, Bug 2401
Michel Szarindar <Michel.Szarindar@Nokia.com>
parents:
diff changeset
   584