1 /* 2 This file is part of dia2code. It generates code from an UML Dia Diagram. 3 Copyright (C) 2014-2014 Vincent Le Garrec 4 5 This program is free software: you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation, either version 3 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 19 20 #ifndef DIA_GRAM_HPP 21 #define DIA_GRAM_HPP 22 23 #include "config.h" 24 25 #include <string> 26 #include <list> 27 28 #include "decls.hpp" 29 30 class DiaGram { 31 private: 32 // Diagram under uml format. 33 std::list <umlClassNode *> uml; 34 // Selection of classes to generate code for. 35 std::list <std::string> genClasses; 36 // Flag that inverts the above selection. 37 bool invertsel : 1; 38 #ifdef ENABLE_CORBA 39 bool usecorba : 1; 40 #endif 41 42 // To detect circular loop. 43 std::list <umlClassNode *> tmp_classes; 44 std::list <std::pair <std::list <umlPackage *>, const umlClassNode *> > 45 includes; 46 std::list <declaration> decl; 47 48 // if expandPackages then all classes in the package and in the 49 // sub-packages are add to resCla 50 void listClasses (umlClassNode & current, 51 std::list <umlClassNode *> & resCla, 52 // bit 0 : expandPackages 53 // bit 1 : do not include connection with NoLoop 54 // stereotype. 55 uint8_t flag); 56 57 bool haveInclude (std::list <umlPackage *> & packages, 58 const umlClassNode * cla) const; 59 void addInclude (std::list <umlPackage *> & packages, 60 const umlClassNode * cla); 61 void pushInclude (const umlClassNode * node); 62 void pushInclude (umlPackage * node); 63 void pushTmp (umlClassNode * node); 64 void popTmp (); 65 public: 66 DiaGram (); 67 // DiaGram (DiaGram & diagram) = delete; 68 69 std::list <umlClassNode *> & getUml (); 70 71 void addGenClasses (std::list <std::string> classes); 72 std::list <std::string> getGenClasses () const; 73 74 bool getInvertSel () const; 75 void setInvertSel (bool invert); 76 77 #ifdef ENABLE_CORBA 78 bool getUseCorba () const; 79 void setUseCorba (bool corba); 80 #endif 81 82 void push (umlClassNode * node); 83 const std::list <std::pair <std::list <umlPackage *>, 84 const umlClassNode * > > & getIncludes () const; 85 void cleanIncludes (); 86 void determineIncludes (declaration &d, 87 bool expandPackages, 88 bool noLoop); 89 90 std::list <declaration>::iterator getDeclBegin (); 91 std::list <declaration>::iterator getDeclEnd (); 92 ~DiaGram (); 93 }; 94 95 #endif 96 97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 98