[Uml-devel] kdesdk/umbrello/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Wed Dec 29 14:45:01 UTC 2004


CVS commit by okellogg: 

parseTemplate(): New.


  M +20 -0     model_utils.cpp   1.14
  M +12 -0     model_utils.h   1.11


--- kdesdk/umbrello/umbrello/model_utils.cpp  #1.13:1.14
@@ -210,4 +210,24 @@ QString scopeToString(Uml::Scope scope, 
 }
 
+Parse_Status parseTemplate(QString t, NameAndType& nmTpPair, UMLPackage *owningScope) {
+
+        UMLDoc *pDoc = UMLApp::app()->getDocument();
+
+        t = t.stripWhiteSpace();
+        if (t.isEmpty())
+                return PS_Empty;
+
+        QStringList nameAndType = QStringList::split( QRegExp("\\s*:\\s*"), t);
+        if (nameAndType.count() == 2) {
+                UMLObject *pType = pDoc->findUMLObject(nameAndType[1], Uml::ot_UMLObject, owningScope);
+                if (pType == NULL)
+                        return PS_Unknown_ArgType;
+                nmTpPair = NameAndType(nameAndType[0], dynamic_cast<UMLClassifier*>(pType));
+        } else {
+                nmTpPair = NameAndType(t, NULL);
+        }
+        return PS_OK;
+}
+
 Parse_Status parseAttribute(QString a, NameAndType& nmTpPair, UMLPackage *owningScope) {
         UMLDoc *pDoc = UMLApp::app()->getDocument();

--- kdesdk/umbrello/umbrello/model_utils.h  #1.10:1.11
@@ -122,4 +122,16 @@ namespace Umbrello {
 
         /**
+         * Parses a template parameter given in UML syntax.
+         *
+         * @param t             Input text of the template parameter.
+         *                      Example:  parname : partype
+         *                      or just:  parname          (for class type)
+         * @param nmTpPair      NameAndType returned by this method.
+         * @param owningScope   Pointer to the owning scope of the template param.
+         * @return      Error status of the parse, PS_OK for success.
+         */
+        Parse_Status parseTemplate(QString t, NameAndType& nmTpPair, UMLPackage *owningScope);
+
+        /**
          * Parses an attribute given in UML syntax.
          *






More information about the umbrello-devel mailing list