umbrello 2.34.70-5524f40e1
Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology
|
#include <xmlschemawriter.h>
Public Member Functions | |
XMLSchemaWriter () | |
virtual | ~XMLSchemaWriter () |
virtual void | writeClass (UMLClassifier *c) |
virtual Uml::ProgrammingLanguage::Enum | language () const |
virtual QStringList | reservedKeywords () const |
![]() | |
SimpleCodeGenerator (bool createDirHierarchyForPackages=true) | |
virtual | ~SimpleCodeGenerator () |
void | writeCodeToFile (UMLClassifierList &concepts) |
void | writeCodeToFile () |
![]() | |
CodeGenerator () | |
virtual | ~CodeGenerator () |
bool | addCodeDocument (CodeDocument *add_object) |
bool | removeCodeDocument (CodeDocument *remove_object) |
CodeDocumentList * | getCodeDocumentList () |
QString | getUniqueID (CodeDocument *codeDoc) |
virtual void | saveToXMI (QXmlStreamWriter &writer) |
CodeDocument * | findCodeDocumentByID (const QString &id) |
void | setIncludeHeadings (bool i) |
bool | includeHeadings () const |
void | setHeadingFileDir (const QString &) |
QString | headingFileDir () const |
void | setForceDoc (bool f) |
bool | forceDoc () const |
void | setForceSections (bool f) |
bool | forceSections () const |
virtual QString | getHeadingFile (const QString &file) |
QString | findFileName (CodeDocument *codeDocument) |
virtual void | loadFromXMI (QDomElement &element) |
CodeDocument * | findCodeDocumentByClassifier (UMLClassifier *classifier) |
virtual QStringList | defaultDatatypes () const |
virtual bool | isReservedKeyword (const QString &keyword) |
virtual void | createDefaultStereotypes () |
Private Member Functions | |
void | writeClassifier (UMLClassifier *c, QTextStream &XMLSchema) |
void | writeAbstractClassifier (UMLClassifier *c, QTextStream &XMLSchema) |
void | writeConcreteClassifier (UMLClassifier *c, QTextStream &XMLSchema) |
void | writeComplexTypeClassifierDecl (UMLClassifier *c, UMLAssociationList associations, UMLAssociationList aggregations, UMLAssociationList compositions, UMLClassifierList superclassifiers, QTextStream &XMLSchema) |
void | writeGroupClassifierDecl (UMLClassifier *c, UMLClassifierList superclassifiers, QTextStream &XMLSchema) |
bool | determineIfHasChildNodes (UMLClassifier *c) |
void | writeElementDecl (const QString &elementName, const QString &elementTypeName, QTextStream &xs) |
void | writeAttributeDecls (UMLAttributeList &attribs, QTextStream &xs) |
void | writeAttributeDecl (UMLAttribute *attrib, QTextStream &xs) |
UMLAttributeList | findAttributes (UMLClassifier *c) |
QStringList | findAttributeGroups (UMLClassifier *c) |
bool | writeAssociationDecls (UMLAssociationList associations, bool noRoleOK, bool didOne, Uml::ID::Type id, QTextStream &xs) |
void | writeAttributeGroupDecl (const QString &elementName, UMLAttributeList &attribs, QTextStream &xs) |
void | writeAssociationRoleDecl (UMLClassifier *c, const QString &multi, QTextStream &xs) |
QString | makeSchemaTag (QString tagName) |
QString | makePackageTag (QString tagName) |
void | writeComment (const QString &text, QTextStream &xs) |
UMLObjectList | findChildObjsInAssociations (UMLClassifier *c, UMLAssociationList associations) |
QString | fixTypeName (const QString &string) |
QString | fixInitialStringDeclValue (QString value, const QString &type) |
QString | getElementName (UMLClassifier *c) |
QString | getElementTypeName (UMLClassifier *c) |
QString | getElementGroupTypeName (UMLClassifier *c) |
void | writeChildObjsInAssociation (UMLClassifier *c, UMLAssociationList assoc, QTextStream &s) |
bool | hasBeenWritten (UMLClassifier *c) |
void | markAsWritten (UMLClassifier *c) |
Private Attributes | |
QString | schemaNamespaceTag |
basic schemaNamespace tag More... | |
QString | packageNamespaceTag |
basic packageNamespace tag More... | |
QString | schemaNamespaceURI |
basic schemaNamespace URI More... | |
QString | packageNamespaceURI |
basic packageNamespace URI More... | |
QString | startline |
a , used at the end of each line More... | |
UMLClassifierList | writtenClassifiers |
a list of UMLClassifiers we have already written More... | |
Additional Inherited Members | |
![]() | |
enum | GenerationState { Generated , Failed , Skipped } |
![]() | |
virtual void | syncCodeToDocument () |
![]() | |
virtual void | syncCodeToDocument () |
![]() | |
void | codeGenerated (UMLClassifier *concept, bool generated) |
void | codeGenerated (UMLClassifier *concept, CodeGenerator::GenerationState result) |
void | showGeneratedFile (const QString &filename) |
![]() | |
static QString | cleanName (const QString &name) |
static QString | formatDoc (const QString &text, const QString &linePrefix=QLatin1String(" *"), int lineWidth=80) |
static QString | formatSourceCode (const QString &code, const QString &indentation) |
static void | findObjectsRelated (UMLClassifier *c, UMLPackageList &cList) |
![]() | |
QString | findFileName (UMLPackage *concept, const QString &ext) |
QString | overwritableName (UMLPackage *concept, const QString &name, const QString &ext) |
bool | hasDefaultValueAttr (UMLClassifier *c) |
bool | hasAbstractOps (UMLClassifier *c) |
QString | indent () |
virtual void | initFromParentDocument () |
![]() | |
QString | overwritableName (const QString &name, const QString &extension) |
bool | openFile (QFile &file, const QString &name) |
void | writeListedCodeDocsToFile (CodeDocumentList *docs) |
virtual void | finalizeRun () |
![]() | |
QString | className_ |
QString | fileName_ |
QMap< UMLPackage *, QString > | m_fileMap |
bool | m_createDirHierarchyForPackages |
QString | m_indentation |
int | m_indentLevel |
QString | m_endl |
![]() | |
QHash< QString, CodeDocument * > | m_codeDocumentDictionary |
bool | m_applyToAllRemaining |
UMLDoc * | m_document |
Class XMLSchemaWriter is a code generator for UMLClassifier objects. Create an instance of this class, and feed it a UMLClassifier when calling writeClass and it will generate a XMLschema source file for that concept
Our basic approach is to map UMLClassifiers (classes/interfaces) into XML elements (or nodes). We declare these element in the schema either as complexType or as groups based on whether they are concrete or abstract in nature. This is not a perfect decision, but that's life with XML Schema... you cant fully represent Objects in the XML world ..yet. -b.t.
XMLSchemaWriter::XMLSchemaWriter | ( | ) |
Constructor, initialises a couple of variables
|
virtual |
Destructor, empty.
|
private |
Find if the classifier would have any Child elements.
|
private |
Discover the string name of all the attribute groups (which are child nodes) of this concept (err.. element). These exist for abstract classes only (which become xs:group nodes).
|
private |
Find all attributes for this concept.
|
private |
Find and return a list of child UMLObjects pointed to by the associations in this UMLClassifier.
|
private |
Check that initial values of strings DON'T have quotes around them (we get double quoting then)!!
|
private |
Replaces `string' with `String' and `bool' with `boolean' IF the type is "string" we need to declare it as the XMLSchema Object "String" (there is no string primitive in XMLSchema). Same thing again for "bool" to "boolean".
|
private |
Find the group node "type" name. Used for elements which define an interface/are abstract.
|
private |
Find the element node name for this concept.
|
private |
Find the element node "type" name. Used in the "complexType" which might define that element node.
|
private |
Quick check to see if we have written the declaration for this concept yet.
|
virtual |
Returns "XMLSchema".
Implements CodeGenerator.
|
private |
Construct an element tag with the package namespace.
|
private |
Construct an element tag with the schema namespace.
|
private |
Mark a concept as written, so it is not repeatedly re-declared in the schema.
|
virtual |
Get list of reserved keywords.
Reimplemented from CodeGenerator.
|
private |
|
private |
Searches a list of associations for appropriate ones to write out as attributes. This works well for compositions, aggregations and self-associations but will not work right for plain associations between 2 different classes. all that matters here is roleA, the role served by the children of this class in any composition or aggregation association. In full associations, I have only considered the case of "self" association, so it shouldn't matter if we use role A or B to find the child class as long as we don't use BOTH roles. I bet this will fail badly for someone using a plain association between 2 different classes. THAT should be done, but isnt yet (this is why I have left role b code in for now). -b.t.
|
private |
Writes out an association as an attribute using Vector
|
private |
Write an element attribute.
|
private |
Writes the Attribute declarations.
attribs | List of attributes |
xs | text stream |
|
private |
Find all attributes that belong in group.
|
private |
Find all the child objects in this association and make sure they get written out (if they havent already been).
|
virtual |
Call this method to generate XMLschema code for a UMLClassifier.
c | the class to generate code for |
Implements SimpleCodeGenerator.
|
private |
Writes concept's documentation then guts.
|
private |
Writes a comment.
|
private |
Write a <complexType> declaration for this classifier.
|
private |
|
private |
Write an element declaration.
|
private |
Write a <group> declaration for this classifier. Used for interfaces to classes with inheriting children.
|
private |
basic packageNamespace tag
|
private |
basic packageNamespace URI
|
private |
basic schemaNamespace tag
|
private |
basic schemaNamespace URI
|
private |
a
, used at the end of each line
|
private |
a list of UMLClassifiers we have already written