[Uml-devel] kdesdk/umbrello/umbrello

Sebastian Stein seb.kde at hpfsc.de
Tue Aug 17 05:21:05 UTC 2004


CVS commit by sstein: 

patch (86831) by Heiko Nardmann (and slightly edited by me):
- replace C++ pointer list with QPtrList
- new reserved keywords for ActionScript, Python and XMLSchemaWriter
- added some source comments
- reformated some parts of the source
- in XMLSchemaWriter use the correct indentation and new line chars


  M +27 -7     codegenerator.cpp   1.55
  M +6 -1      codegenerator.h   1.28


--- kdesdk/umbrello/umbrello/codegenerator.h  #1.27:1.28
@@ -331,5 +331,5 @@ public:
    * get list of reserved keywords
    */
-  virtual const char **getReservedKeywords() { return NULL; }
+        virtual const QPtrList<const char *> * getReservedKeywords() { return NULL; }
 
 protected:
@@ -394,4 +394,9 @@ protected:
         UMLDoc* m_document;
 
+        /**
+         * convert a NULL terminated char * list of reserved keywords to a new QPtrList<const char *>
+         */
+        QPtrList<const char *> * convertListOfReservedKeywords(const char **);
+
 private:
 

--- kdesdk/umbrello/umbrello/codegenerator.cpp  #1.54:1.55
@@ -778,13 +777,17 @@ void CodeGenerator::createDefaultDatatyp
  */
 bool CodeGenerator::isReservedKeyword(const QString & rPossiblyReservedKeyword) {
-  const char **tmpReservedWords = getReservedKeywords();
+  const QPtrList<const char *> *listOfReservedKeywords = getReservedKeywords();
 
-  if (tmpReservedWords == NULL)
+  if (listOfReservedKeywords == NULL)
   {
     return false;
   }
 
-  while (tmpReservedWords[0] != NULL) {
-                QString keyword(tmpReservedWords[0]);
+  QPtrListIterator<const char *> iteratorReservedKeywords (*listOfReservedKeywords);
+  const char **ppszReservedKeyword = NULL;
+
+  while ( (ppszReservedKeyword = iteratorReservedKeywords.current()) != 0 )
+  {
+                QString keyword(*ppszReservedKeyword);
 
                 if (keyword == rPossiblyReservedKeyword) {
@@ -792,5 +795,5 @@ bool CodeGenerator::isReservedKeyword(co
                 }
 
-    tmpReservedWords++;
+                ++iteratorReservedKeywords;
         }
 
@@ -798,4 +801,21 @@ bool CodeGenerator::isReservedKeyword(co
 }
 
-#include "codegenerator.moc"
+/**
+ * convert a NULL terminated char * list of reserved keywords to a new
+ * QPtrList<const char *>
+ */
+QPtrList<const char *> * CodeGenerator::convertListOfReservedKeywords(const char ** ppszReservedKeywords) {
+  QPtrList<const char *> * pListOfReservedKeywords = new QPtrList<const char *>;
 
+  const char **reservedKeywords = ppszReservedKeywords;
+
+  while (reservedKeywords[0] != NULL)
+  {
+    pListOfReservedKeywords->append(&reservedKeywords[0]);
+    reservedKeywords++;
+  }
+
+  return pListOfReservedKeywords;
+}
+
+#include "codegenerator.moc"






More information about the umbrello-devel mailing list