1 /*
2     SPDX-License-Identifier: GPL-2.0-or-later
3 
4     SPDX-FileCopyrightText: 2003-2021 Oliver Kellogg <okellogg@users.sourceforge.net>
5     SPDX-FileCopyrightText: 2003-2021 Umbrello UML Modeller Authors <umbrello-devel@kde.org>
6 */
7 
8 #ifndef IDLWRITER_H
9 #define IDLWRITER_H
10 
11 #include "simplecodegenerator.h"
12 #include "umlobject.h"
13 
14 class UMLAssociation;
15 class UMLOperation;
16 class QTextStream;
17 
18 /**
19  * Class IDLWriter is a code generator for UMLClassifier objects.
20  * Create an instance of this class, and feed it a UMLClassifier when
21  * calling writeClass and it will generate an IDL interface for that
22  * concept.
23  */
24 class IDLWriter : public SimpleCodeGenerator
25 {
26 public:
27 
28     IDLWriter();
29     virtual ~IDLWriter();
30 
31     virtual void writeClass(UMLClassifier *c);
32 
33     virtual Uml::ProgrammingLanguage::Enum language() const;
34 
35     QStringList defaultDatatypes() const;
36 
37     virtual QStringList reservedKeywords() const;
38 
39 private:
40 
41     void writeOperation(UMLOperation* op, QTextStream& idl, bool is_comment = false);
42 
43     void computeAssocTypeAndRole(UMLAssociation* a, UMLClassifier *c,
44                                  QString& typeName, QString& roleName);
45 
46     static bool isOOClass(UMLClassifier* c);
47 
48     static bool assocTypeIsMappableToAttribute(Uml::AssociationType::Enum at);
49 
50 };
51 
52 #endif // IDLWRITER_H
53