Exemplo n.º 1
0
void Geom::Box::write( XmlWriter& xw )
{
	xw.writeOpenTag("box");
	{
		xw.writeTaggedString("c", qStr(Center));
		xw.writeTaggedString("x", qStr(Axis[0]));
		xw.writeTaggedString("y", qStr(Axis[1]));
		xw.writeTaggedString("z", qStr(Axis[2]));
		xw.writeTaggedString("e", qStr(Extent));
	}
	xw.writeCloseTag("box");
}
xmlwriterblock::xmlwriterblock(QFile* file , Patient* blockpatient)
{

    XmlWriter xw (file);
    xw.setAutoNewLine( true );

    const QString index = blockpatient->index;
    const QString prenom = blockpatient->prenom;
    const QString nomjeunefille = blockpatient->nomdejeunefille;
    const QString nom = blockpatient->nom;
    const QString datedenaissance = blockpatient->datedenaissance;
    const QString datededeces= blockpatient->datededeces;

    const QString adresse = blockpatient->adresse;
    const QString ville = blockpatient->ville;
    const QString region = blockpatient->region;
    const QString codepostal = blockpatient->codepostal;
    const QString pays = blockpatient->pays;

    const QString telephone1 = blockpatient->telephone1;
    const QString telephone2 = blockpatient->telephone2;
    const QString telephone3 = blockpatient->telephone3;
    const QString courriel = blockpatient->courriel;
    const QString telecopie = blockpatient->telecopie;

    const QString textelibre = blockpatient->textelibre;
    const QString marque = blockpatient->marque;
    const QString codeinternat = blockpatient->codeinternat;
    const QString datededebut = blockpatient->datededebut;
    const QString datedefin = blockpatient->datedefin;
    const QString formatage = blockpatient->formatage;
    const QString indexdeconfiance = blockpatient->indexdeconfiance;


    xw.newLine();
    xw.writeRaw("<!-- Patient block -->");
    xw.newLine();
    AttrMap attrPatient;
    attrPatient.insert( "emrUid", index);
    attrPatient.insert( "firstname" , prenom);
    attrPatient.insert( "birthname" , nom);
    attrPatient.insert( "secondname", nomjeunefille);
    attrPatient.insert( "dob", datedenaissance);
    attrPatient.insert( "dod", datededeces);
    xw.writeOpenTag("Patient", attrPatient);
    xw.writeRaw("<!-- Contact -->");
    xw.newLine();
    AttrMap attrAdress;
    attrAdress.insert( "ad", adresse);
    attrAdress.insert( "city", ville);
    attrAdress.insert( "county", region);
    attrAdress.insert( "zip" , codepostal);
    attrAdress.insert( "state" , pays);
    xw.writeOpenTag( "Address", attrAdress);
    AttrMap attrContact;
    attrContact.insert( "tel1", telephone1);
    attrContact.insert( "tel2", telephone2);
    attrContact.insert( "tel3" , telephone3);
    attrContact.insert( "fax" , telecopie);
    attrContact.insert("mail" , courriel);
    xw.writeOpenTag( "Contact", attrContact);
    xw.writeRaw( "<!-- PMHx -->");
    xw.newLine();
    xw.writeOpenTag("PMHx");
    xw.writeOpenTag("PMH_Item");
    xw.writeRaw("<!-- use FreeText or Encoded not both -->");
    xw.newLine();
    xw.writeTaggedString( "FreeText", textelibre, AttrMap() );
    AttrMap attrEncoded;
    attrEncoded.insert("label", marque);
    attrEncoded.insert( "icd10" , codeinternat);
    xw.writeOpenTag( "Encoded" , attrEncoded);
    xw.writeTaggedString( "DateStart", datededebut, AttrMap("format", formatage) );
    xw.writeTaggedString( "DateEnd", datedefin, AttrMap("format", formatage) );
    xw.writeTaggedString( "ConfidenceIndex", indexdeconfiance, AttrMap() );
    xw.writeCloseTag("PMH_Item");
    xw.writeCloseTag("PMHx");
    xw.writeRaw("<!-- Populate Form items -->");
    xw.newLine();
    xw.writeCloseTag("Patient");
    xw.newLine();

}
Exemplo n.º 3
0
//! \internal
void XmlPreferencesPrivate::writeSection(XmlWriter& out, const QString& name, const Section& section)
{
	QHash<QString,QString> attrs;

	attrs.insert("name", name);
	out.writeOpenTag("section", attrs);
	attrs.clear();

	for (Section::ConstIterator sectionIterator = section.constBegin();
		sectionIterator != section.constEnd(); ++sectionIterator)
	{
		const EncVariant& v = sectionIterator.value();

		attrs.insert("name", sectionIterator.key());

		switch (v.data.type())
		{
		case QVariant::String :
			attrs.insert("type", "string");
			out.writeTaggedString("setting", v.data.toString(), attrs);
			break;
		case QVariant::StringList :
			{
				attrs.insert("type", "stringlist");
				out.writeOpenTag("setting", attrs);
				attrs.clear();
				QStringList list = v.data.toStringList();
				for (int i = 0; i < list.size(); ++i)
					out.writeTaggedString("value", list.at(i), attrs);
				out.writeCloseTag("setting");
			}
			break;
		case QVariant::Bool :
			attrs.insert("type", "bool");
			out.writeTaggedString("setting", v.data.toBool() ? "true" : "false", attrs);
			break;
		case QVariant::Int :
			attrs.insert("type", "int");
			out.writeTaggedString("setting", QString::number(v.data.toInt()), attrs);
			break;
		case QVariant::LongLong :
			attrs.insert("type", "int64");
			out.writeTaggedString("setting", QString::number(v.data.toLongLong()), attrs);
			break;
		case QVariant::Rect :
			{
				attrs.insert("type", "rect");
				QRect rect = v.data.toRect();
				QString s = QString("%1;%2;%3;%4").arg(rect.x()).arg(rect.y()).arg(rect.width()).arg(rect.height());
				out.writeTaggedString("setting", s, attrs);
			}
			break;
		case QVariant::Point :
			{
				attrs.insert("type", "point");
				QPoint point = v.data.toPoint();
				QString s = QString("%1;%2").arg(point.x()).arg(point.y());
				out.writeTaggedString("setting", s, attrs);
			}
			break;
		case QVariant::Size :
			{
				attrs.insert("type", "size");
				QSize size = v.data.toSize();
				QString s = QString("%1;%2").arg(size.width()).arg(size.height());
				out.writeTaggedString("setting", s, attrs);
			}
			break;
		case QVariant::ByteArray :
			{
				attrs.insert("type", "bytearray");
				const QByteArray ba = v.data.toByteArray();
				switch (v.encoding)
				{
				case XmlPreferences::Base64:
					attrs.insert("encoding", "base64");
					out.writeTaggedString("setting", Base64::encode(ba), attrs);
					break;
				default:
					attrs.insert("encoding", "csv");
					QString s;
					for (uint i = 0; i < (uint) ba.size(); ++i)
						(i != 0) ? s += "," + QString::number((uint)ba.at(i), 16) : s += QString::number((uint)ba.at(i), 16);
					out.writeTaggedString("setting", s, attrs);
				}
				attrs.clear();
			}
			break;
		case QVariant::BitArray :
			{
				attrs.insert("type", "bitarray");
				const QBitArray ba = v.data.toBitArray();
				attrs.insert("size", QString::number(ba.size()));
				switch (v.encoding)
				{
				case XmlPreferences::Base64:
					attrs.insert("encoding", "base64");
					out.writeTaggedString("setting", Base64::encode(ba), attrs);
					break;
				default:
					attrs.insert("encoding", "csv");
					QString s;
					for (uint i = 0; i < (uint) ba.size(); ++i)
						(i != 0) ? s += ba.testBit(i) ? ",1" : ",0" : s += ba.testBit(i) ? "1" : "0";
					out.writeTaggedString("setting", s, attrs);
				}
				attrs.clear();
			}
			break;
#ifndef QT_CORE_ONLY
		case QVariant::Color :
			attrs.insert("type", "color");
			out.writeTaggedString("setting", v.data.value<QColor>().name(), attrs);
			break;
#endif // QT_CORE_ONLY
		default:
			;
		}
	}

	out.writeCloseTag("section");
}