umbrello API Documentation

model_utils.h

00001 /***************************************************************************
00002  *                                                                         *
00003  *   This program is free software; you can redistribute it and/or modify  *
00004  *   it under the terms of the GNU General Public License as published by  *
00005  *   the Free Software Foundation; either version 2 of the License, or     *
00006  *   (at your option) any later version.                                   *
00007  *                                                                         *
00008  *  copyright (C) 2004-2006                                                *
00009  *  Umbrello UML Modeller Authors <uml-devel@uml.sf.net>                   *
00010  ***************************************************************************/
00011 
00012 #ifndef MODEL_UTILS_H
00013 #define MODEL_UTILS_H
00014 
00015 #include <qstring.h>
00016 #include <qvaluelist.h>
00017 
00018 #include "umlnamespace.h"
00019 #include "umlobjectlist.h"
00020 
00028 // forward declarations
00029 class UMLClassifier;
00030 class UMLPackage;
00031 
00032 namespace Model_Utils {
00033 
00040 bool isCloneable(Uml::Widget_Type type);
00041 
00052 UMLObject * findObjectInList(Uml::IDType id, const UMLObjectList& inList);
00053 
00068 UMLObject* findUMLObject( const UMLObjectList& inList,
00069                           const QString& name,
00070                           Uml::Object_Type type = Uml::ot_UMLObject,
00071                           UMLObject *currentObj = NULL);
00072 
00083 QString uniqObjectName(Uml::Object_Type type,
00084                        UMLPackage *parentPkg,
00085                        QString prefix = QString::null);
00086 
00093 bool isCommonXMIAttribute(const QString &tag);
00094 
00100 bool isCommonDataType(QString type);
00101 
00105 bool isClassifierListitem(Uml::Object_Type ot);
00106 
00110 bool typeIsCanvasWidget(Uml::ListView_Type type);
00111 
00117 bool typeIsRootView(Uml::ListView_Type type);
00118 
00122 bool typeIsFolder(Uml::ListView_Type type);
00123 
00128 bool typeIsContainer(Uml::ListView_Type type);
00129 
00133 bool typeIsDiagram(Uml::ListView_Type type);
00134 
00138 bool typeIsClassifierList(Uml::ListView_Type type);
00139 
00143 Uml::Model_Type convert_DT_MT(Uml::Diagram_Type dt);
00144 
00148 Uml::ListView_Type convert_MT_LVT(Uml::Model_Type mt);
00149 
00155 Uml::Model_Type convert_LVT_MT(Uml::ListView_Type lvt);
00156 
00160 Uml::ListView_Type convert_DT_LVT(Uml::Diagram_Type dt);
00161 
00169 Uml::Object_Type convert_LVT_OT(Uml::ListView_Type lvt);
00170 
00182 Uml::ListView_Type convert_OT_LVT(UMLObject *o);
00183 
00191 Uml::Icon_Type convert_LVT_IT(Uml::ListView_Type lvt);
00192 
00200 Uml::Diagram_Type convert_LVT_DT(Uml::ListView_Type lvt);
00201 
00205 Uml::Model_Type convert_OT_MT(Uml::Object_Type ot);
00206 
00213 Uml::Model_Type guessContainer(UMLObject *o);
00214 
00224 int stringToDirection(QString input, Uml::Parameter_Direction & result);
00225 
00229 QString progLangToString(Uml::Programming_Language pl);
00230 
00234 Uml::Programming_Language stringToProgLang(QString str);
00235 
00239 enum Parse_Status {
00240     PS_OK, PS_Empty, PS_Malformed_Arg, PS_Unknown_ArgType,
00241     PS_Illegal_MethodName, PS_Unknown_ReturnType, PS_Unspecified_Error
00242 };
00243 
00247 struct NameAndType {
00248     QString m_name;
00249     UMLObject *m_type;
00250     Uml::Parameter_Direction m_direction;
00251     QString m_initialValue;
00252     NameAndType() : m_type(0), m_direction(Uml::pd_In) {
00253     }
00254     NameAndType(QString name, UMLObject *type,
00255                 Uml::Parameter_Direction direction = Uml::pd_In,
00256                 QString initialValue = QString::null)
00257             : m_name(name), m_type(type),
00258               m_direction(direction), m_initialValue(initialValue) {
00259     }
00260 };
00261 
00265 typedef QValueList<NameAndType> NameAndType_List;
00266 typedef QValueListIterator<NameAndType> NameAndType_ListIt;
00267 
00271 struct OpDescriptor {
00272     QString m_name;
00273     NameAndType_List m_args;
00274     UMLObject *m_pReturnType;
00275 };
00276 
00287 Parse_Status parseTemplate(QString t, NameAndType& nmTp, UMLClassifier *owningScope);
00288 
00306 Parse_Status parseAttribute(QString a, NameAndType& nmTp, UMLClassifier *owningScope,
00307                             Uml::Visibility *vis = 0);
00308 
00319 Parse_Status parseOperation(QString m, OpDescriptor& desc, UMLClassifier *owningScope);
00320 
00324 QString psText(Parse_Status value);
00325 
00326 }
00327 
00328 #endif
KDE Logo
This file is part of the documentation for umbrello Version 3.1.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Jun 26 08:07:58 2007 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003