umbrello 2.32.3 Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology

xmlschemawriter.h
Go to the documentation of this file.
1 /***************************************************************************
2 * This program is free software; you can redistribute it and/or modify *
3 * it under the terms of the GNU General Public License as published by *
4 * the Free Software Foundation; either version 2 of the License, or *
5 * (at your option) any later version. *
6 * *
7 * copyright (C) 2003 Brian Thomas <brian.thomas@gsfc.nasa.gov> *
8 * copyright (C) 2004-2020 *
9 * Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
10 ***************************************************************************/
11
12 #ifndef XMLSCHEMAWRITER_H
13 #define XMLSCHEMAWRITER_H
14
15 #include "attribute.h"
16 #include "association.h"
17 #include "codegenerator.h"
18 #include "umlclassifierlist.h"
19 #include "umlattributelist.h"
20 #include "umlobjectlist.h"
21 #include "umlassociationlist.h"
22 #include "simplecodegenerator.h"
23
37 class XMLSchemaWriter : public SimpleCodeGenerator
38 {
39 Q_OBJECT
40 public:
41
42 XMLSchemaWriter();
43 virtual ~XMLSchemaWriter();
44
45 virtual void writeClass(UMLClassifier *c);
46
47 virtual Uml::ProgrammingLanguage::Enum language() const;
48
49 virtual QStringList reservedKeywords() const;
50
51 private:
52
53 void writeClassifier(UMLClassifier *c, QTextStream &XMLSchema);
54 void writeAbstractClassifier(UMLClassifier *c, QTextStream &XMLSchema);
55 void writeConcreteClassifier(UMLClassifier *c, QTextStream &XMLSchema);
56
57 void writeComplexTypeClassifierDecl(UMLClassifier *c,
58 UMLAssociationList associations,
59 UMLAssociationList aggregations,
60 UMLAssociationList compositions,
61 UMLClassifierList superclassifiers,
62 QTextStream &XMLSchema);
63
64 void writeGroupClassifierDecl(UMLClassifier *c,
65 UMLClassifierList superclassifiers,
66 QTextStream &XMLSchema);
67
68 bool determineIfHasChildNodes(UMLClassifier *c);
69
75 // void writeAttributes(UMLClassifier *c, QTextStream &j);
76
77 void writeElementDecl(const QString &elementName, const QString &elementTypeName, QTextStream &xs);
78
79 void writeAttributeDecls(UMLAttributeList &attribs, QTextStream &xs);
80
81 void writeAttributeDecl(UMLAttribute *attrib, QTextStream &xs);
82
83 UMLAttributeList findAttributes(UMLClassifier *c);
84
85 QStringList findAttributeGroups(UMLClassifier *c);
86
87 bool writeAssociationDecls(UMLAssociationList associations, bool noRoleOK, bool didOne,
88 Uml::ID::Type id, QTextStream &xs);
89
90 void writeAttributeGroupDecl(const QString &elementName, UMLAttributeList &attribs, QTextStream &xs);
91
92 void writeAssociationRoleDecl(UMLClassifier *c, const QString &multi, QTextStream &xs);
93
94 QString makeSchemaTag(QString tagName);
95 QString makePackageTag(QString tagName);
96
97 void writeComment(const QString &text, QTextStream &xs);
98
99 UMLObjectList findChildObjsInAssociations(UMLClassifier *c, UMLAssociationList associations);
100
101 QString fixTypeName(const QString& string);
102
103 QString fixInitialStringDeclValue(QString value, const QString &type);
104
105 QString getElementName(UMLClassifier *c);
106 QString getElementTypeName(UMLClassifier *c);
107 QString getElementGroupTypeName(UMLClassifier *c);
108
109 void writeChildObjsInAssociation(UMLClassifier *c, UMLAssociationList assoc, QTextStream &s);
110
111 bool hasBeenWritten(UMLClassifier *c);
112 void markAsWritten(UMLClassifier *c);
113
114 QString schemaNamespaceTag;
115 QString packageNamespaceTag;
116 QString schemaNamespaceURI;
117 QString packageNamespaceURI;
118 QString startline;
119 UMLClassifierList writtenClassifiers;
120 };
121
122 #endif // XMLSCHEMAWRITER_H
UMLObject::package
QString package(const QString &separator=QString(), bool includeRoot=false)
Definition: umlobject.cpp:578
UMLObject::id
virtual Uml::ID::Type id() const
Definition: umlobject.cpp:425
umlattributelist.h
XMLSchemaWriter::writeAttributeDecl
void writeAttributeDecl(UMLAttribute *attrib, QTextStream &xs)
Definition: xmlschemawriter.cpp:497
XMLSchemaWriter::packageNamespaceURI
QString packageNamespaceURI
basic packageNamespace URI
Definition: xmlschemawriter.h:117
UMLObject::asUMLClassifier
UMLClassifier * asUMLClassifier()
Definition: umlobject.cpp:1309
XMLSchemaWriter::writeAssociationRoleDecl
void writeAssociationRoleDecl(UMLClassifier *c, const QString &multi, QTextStream &xs)
Definition: xmlschemawriter.cpp:682
xmlschemawriter.h
XMLSchemaWriter::packageNamespaceTag
QString packageNamespaceTag
basic packageNamespace tag
Definition: xmlschemawriter.h:115
XMLSchemaWriter::getElementGroupTypeName
QString getElementGroupTypeName(UMLClassifier *c)
Definition: xmlschemawriter.cpp:823
Uml::ProgrammingLanguage::Enum
Enum
Definition: basictypes.h:271
UMLClassifier::isInterface
bool isInterface() const
Definition: classifier.cpp:118
UMLAttributeList
Definition: umlattributelist.h:27
UMLObject::name
QString name() const
Definition: umlobject.cpp:211
XMLSchemaWriter::getElementTypeName
QString getElementTypeName(UMLClassifier *c)
Definition: xmlschemawriter.cpp:814
XMLSchemaWriter::makeSchemaTag
QString makeSchemaTag(QString tagName)
Definition: xmlschemawriter.cpp:841
CodeGenerator::getHeadingFile
virtual QString getHeadingFile(const QString &file)
Definition: codegenerator.cpp:407
XMLSchemaWriter::writeAssociationDecls
bool writeAssociationDecls(UMLAssociationList associations, bool noRoleOK, bool didOne, Uml::ID::Type id, QTextStream &xs)
Definition: xmlschemawriter.cpp:588
XMLSchemaWriter::writeAttributeGroupDecl
void writeAttributeGroupDecl(const QString &elementName, UMLAttributeList &attribs, QTextStream &xs)
Definition: xmlschemawriter.cpp:529
XMLSchemaWriter::XMLSchemaWriter
XMLSchemaWriter()
Definition: xmlschemawriter.cpp:29
XMLSchemaWriter::writeAbstractClassifier
void writeAbstractClassifier(UMLClassifier *c, QTextStream &XMLSchema)
Definition: xmlschemawriter.cpp:220
CodeGenerator::cleanName
static QString cleanName(const QString &name)
Definition: codegenerator.cpp:549
operation.h
UMLAttribute::getInitialValue
QString getInitialValue() const
Definition: attribute.cpp:99
UMLClassifierListItem::getTypeName
virtual QString getTypeName() const
Definition: classifierlistitem.cpp:112
Uml::RoleType::A
@ A
Definition: basictypes.h:239
XMLSchemaWriter::language
virtual Uml::ProgrammingLanguage::Enum language() const
Definition: xmlschemawriter.cpp:47
XMLSchemaWriter::schemaNamespaceURI
QString schemaNamespaceURI
basic schemaNamespace URI
Definition: xmlschemawriter.h:116
association.h
Uml::ProgrammingLanguage::XMLSchema
@ XMLSchema
Definition: basictypes.h:291
UMLObject::isStatic
bool isStatic() const
Definition: umlobject.cpp:366
Model_Utils::hasAssociations
bool hasAssociations(UMLObject::ObjectType type)
Definition: model_utils.cpp:2295
UMLClassifierList
QList< UMLClassifier * > UMLClassifierList
Definition: umlclassifierlist.h:17
Uml::ID::Type
std::string Type
Definition: basictypes.h:351
XMLSchemaWriter::~XMLSchemaWriter
virtual ~XMLSchemaWriter()
Definition: xmlschemawriter.cpp:40
XMLSchemaWriter::writeGroupClassifierDecl
void writeGroupClassifierDecl(UMLClassifier *c, UMLClassifierList superclassifiers, QTextStream &XMLSchema)
Definition: xmlschemawriter.cpp:255
XMLSchemaWriter::fixInitialStringDeclValue
QString fixInitialStringDeclValue(QString value, const QString &type)
Definition: xmlschemawriter.cpp:790
UMLObject
The base class for UML objects.
Definition: umlobject.h:74
SimpleCodeGenerator::indent
QString indent()
Definition: simplecodegenerator.cpp:76
XMLSchemaWriter::startline
QString startline
a , used at the end of each line
Definition: xmlschemawriter.h:118
UMLObject::isAbstract
bool isAbstract() const
Definition: umlobject.cpp:348
SimpleCodeGenerator::m_indentLevel
int m_indentLevel
Definition: simplecodegenerator.h:77
XMLSchemaWriter::writeConcreteClassifier
void writeConcreteClassifier(UMLClassifier *c, QTextStream &XMLSchema)
Definition: xmlschemawriter.cpp:379
CodeGenerator::forceDoc
bool forceDoc() const
Definition: codegenerator.cpp:765
XMLSchemaWriter::fixTypeName
QString fixTypeName(const QString &string)
Definition: xmlschemawriter.cpp:779
Uml::Visibility::Public
@ Public
Definition: basictypes.h:60
XMLSchemaWriter::writeChildObjsInAssociation
void writeChildObjsInAssociation(UMLClassifier *c, UMLAssociationList assoc, QTextStream &s)
Definition: xmlschemawriter.cpp:451
CodeGenerator::showGeneratedFile
void showGeneratedFile(const QString &filename)
Definition: moc_codegenerator.cpp:161
UMLObject::visibility
Uml::Visibility::Enum visibility() const
Definition: umlobject.cpp:466
UMLCanvasObject::getSpecificAssocs
UMLAssociationList getSpecificAssocs(Uml::AssociationType::Enum assocType)
Definition: umlcanvasobject.cpp:61
attribute.h
XMLSchemaWriter::markAsWritten
void markAsWritten(UMLClassifier *c)
Definition: xmlschemawriter.cpp:477
a
QString a
Definition: petalnode.cpp:18
SimpleCodeGenerator::m_endl
QString m_endl
Definition: simplecodegenerator.h:78
UMLClassifier::findSuperClassConcepts
UMLClassifierList findSuperClassConcepts(ClassifierType type=ALL)
Definition: classifier.cpp:609
XMLSchemaWriter::writeComplexTypeClassifierDecl
void writeComplexTypeClassifierDecl(UMLClassifier *c, UMLAssociationList associations, UMLAssociationList aggregations, UMLAssociationList compositions, UMLClassifierList superclassifiers, QTextStream &XMLSchema)
Definition: xmlschemawriter.cpp:285
Uml::AssociationType::Association
@ Association
Definition: basictypes.h:110
umlclassifierlist.h
XMLSchemaWriter::writtenClassifiers
UMLClassifierList writtenClassifiers
a list of UMLClassifiers we have already written
Definition: xmlschemawriter.h:119
uDebug
#define uDebug()
Definition: debug_utils.h:122
SimpleCodeGenerator
Definition: simplecodegenerator.h:34
Uml::RoleType::B
@ B
Definition: basictypes.h:240
XMLSchemaWriter::writeElementDecl
void writeElementDecl(const QString &elementName, const QString &elementTypeName, QTextStream &xs)
Definition: xmlschemawriter.cpp:151
XMLSchemaWriter::findAttributeGroups
QStringList findAttributeGroups(UMLClassifier *c)
Definition: xmlschemawriter.cpp:414
UMLObject::doc
QString doc() const
Definition: umlobject.cpp:435
XMLSchemaWriter::writeClassifier
void writeClassifier(UMLClassifier *c, QTextStream &XMLSchema)
Definition: xmlschemawriter.cpp:165
UMLAttribute
Sets up attribute information.
Definition: attribute.h:28
UMLClassifier::getAttributeList
UMLAttributeList getAttributeList() const
Definition: classifier.cpp:436
UMLClassifier::findSubClassConcepts
UMLClassifierList findSubClassConcepts(ClassifierType type=ALL)
Definition: classifier.cpp:570
UMLCanvasObject::getAggregations
UMLAssociationList getAggregations()
Definition: umlcanvasobject.cpp:412
CodeGenerator::codeGenerated
void codeGenerated(UMLClassifier *concept, bool generated)
Definition: moc_codegenerator.cpp:154
XMLSchemaWriter::findChildObjsInAssociations
UMLObjectList findChildObjsInAssociations(UMLClassifier *c, UMLAssociationList associations)
Definition: xmlschemawriter.cpp:658
classifier.h
XMLSchemaWriter::writeClass
virtual void writeClass(UMLClassifier *c)
Definition: xmlschemawriter.cpp:56
XMLSchemaWriter::hasBeenWritten
bool hasBeenWritten(UMLClassifier *c)
Definition: xmlschemawriter.cpp:466
XMLSchemaWriter::findAttributes
UMLAttributeList findAttributes(UMLClassifier *c)
Definition: xmlschemawriter.cpp:186
UMLClassifier
Information for a non-graphical Concept/Class.
Definition: classifier.h:40
debug_utils.h
XMLSchemaWriter::determineIfHasChildNodes
bool determineIfHasChildNodes(UMLClassifier *c)
Definition: xmlschemawriter.cpp:438
umlassociationlist.h
UMLAssociation
Sets up association information.
Definition: association.h:33
UMLCanvasObject::getCompositions
UMLAssociationList getCompositions()
Definition: umlcanvasobject.cpp:422
XMLSchemaWriter::getElementName
QString getElementName(UMLClassifier *c)
Definition: xmlschemawriter.cpp:805
XMLSchemaWriter::reservedKeywords
virtual QStringList reservedKeywords() const
Definition: xmlschemawriter.cpp:850
codegenerator.h
simplecodegenerator.h
XMLSchemaWriter::schemaNamespaceTag
QString schemaNamespaceTag
basic schemaNamespace tag
Definition: xmlschemawriter.h:114
Uml::Visibility::Private
@ Private
Definition: basictypes.h:61
XMLSchemaWriter::writeComment
void writeComment(const QString &text, QTextStream &xs)
Definition: xmlschemawriter.cpp:556
umlobjectlist.h
Uml::Visibility::Protected
@ Protected
Definition: basictypes.h:62
XMLSchemaWriter::makePackageTag
QString makePackageTag(QString tagName)
Definition: xmlschemawriter.cpp:832
UMLObjectList
Definition: umlobjectlist.h:29
UMLAssociationList
QList< UMLAssociation * > UMLAssociationList
Definition: umlassociationlist.h:18
SimpleCodeGenerator::findFileName
QString findFileName(UMLPackage *concept, const QString &ext)
Definition: simplecodegenerator.cpp:91
umldoc.h
XMLSchemaWriter::writeAttributeDecls
void writeAttributeDecls(UMLAttributeList &attribs, QTextStream &xs)
Definition: xmlschemawriter.cpp:487
CodeGenerator::openFile
bool openFile(QFile &file, const QString &name)
Definition: codegenerator.cpp:523
XMLSchemaWriter
Definition: xmlschemawriter.h:38