1 #include "xmeareader.h"
12 qDebug()<<
"bool XMeaReader::readFile(QIODevice *device)";
15 if (readNextStartElement()) {
16 if (name() ==
"xmea" && attributes().value(
"version") ==
"1.0")
23 raiseError(QObject::tr(
"The file is not an XMEA version 1.0 file."));
32 qDebug()<<
"void XMeaReader::readMea()";
33 Q_ASSERT(isStartElement() && name() ==
"xmea");
35 readNextStartElement();
37 if (name() ==
"entities")
39 readNextStartElement();
40 if (name() ==
"links")
45 qDebug()<<
"void XMeaReader::readField(Entite* lEntite)";
46 Q_ASSERT(isStartElement() && name() ==
"property");
47 QString nom=attributes().value(
"fieldname").toString();
48 QString type=attributes().value(
"fieldtype").toString();
49 QString taille=attributes().value(
"fieldsize").toString();
50 QString role=attributes().value(
"fieldrole").toString();
60 qDebug()<<
"void XMeaReader::readFields(Entite* lEntite)";
61 Q_ASSERT(isStartElement() && name() ==
"fields");
63 while (readNextStartElement())
65 if (name() ==
"property")
74 qDebug()<<
"void XMeaReader::readEntite()";
75 Q_ASSERT(isStartElement() && name() ==
"entity");
76 QString nom=attributes().value(
"name").toString();
77 QString left=attributes().value(
"left").toString();
78 QString top=attributes().value(
"top").toString();
79 QString type=attributes().value(
"type").toString();
80 QStringList listeDesChamps;
81 bool isAssoc=type==
"association";
85 Entite * lEntite=
new Entite(mum,nom,left.toFloat(),top.toFloat(),0,mum->
getScene(),listeDesChamps,isAssoc);
88 lEntite->setPos(left.toFloat(),top.toFloat());
93 while (readNextStartElement())
95 if (name() ==
"fields")
107 lEntite->setPos(left.toFloat(),top.toFloat());
112 while (readNextStartElement())
114 if (name() ==
"fields")
128 qDebug()<<
"void XMeaReader::readLien()";
129 Q_ASSERT(isStartElement() && name() ==
"link");
130 QString nomt1=attributes().value(
"t1").toString();
131 QString nomt2=attributes().value(
"t2").toString();
132 QString nomType=attributes().value(
"type").toString();
133 QString nomCard1=attributes().value(
"card1").toString();
134 QString nomCard2=attributes().value(
"card2").toString();
135 QString role=attributes().value(
"role").toString();
139 Lien * nouveauLien=
new Lien(t2,t1,0,nomType,
"",role);
140 mum->
getScene()->addItem(nouveauLien);
142 skipCurrentElement();
147 qDebug()<<
"void XMeaReader::readEntites()";
148 Q_ASSERT(isStartElement() && name() ==
"entities");
150 while (readNextStartElement())
152 if (name() ==
"entity")
162 qDebug()<<
"void XMeaReader::readLiens()";
163 Q_ASSERT(isStartElement() && name() ==
"links");
165 while (readNextStartElement())
167 if (name() ==
"link")
QCustomGraphicsScene * getScene()
getScene
void readMea()
readMea read MEA main content
void tableAjouterChamp(Entite *lEntite, QString nomDuChamp="property name", QString typeDuChamp="Son type", QString roleDuChamp="Son rôle dans l'objet", QString tailleDuChamp="")
tableAjouterChamp
The Lien class a link is betwwen to objects it contains a line a role text cardinality ...
XMeaReader(MainWindow *)
XMeaReader Constructor.
void readField(Entite *lEntite)
readField
The Association class Association inherit Entite Association is a relation between at least two entit...
void readEntite()
readEntite read one Entity
void readLien()
readLien read one link
bool readFile(QIODevice *device)
readFile
void effaceTout()
effaceTout remove all from vectors and scene
void readEntites()
readEntites read Entites Section
Entite * getEntiteByName(QString nom)
getEntiteByName
void ajouteTable(Entite *t)
ajouteTable
void readLiens()
readLiens read Links Section
The Entite class Entity is an object we have to deal with.
The MainWindow class main code of application.
void readFields(Entite *lEntite)
readFields