[Kst] branches/work/kst/portto4/kst/src

Adam Treat treat at kde.org
Wed Jul 18 18:17:18 CEST 2007


SVN commit 689588 by treat:

* Add prelim loading of vectors.


 M  +2 -0      libkst/builtinprimitives.cpp  
 M  +1 -0      libkst/kstvector.cpp  
 M  +4 -2      libkst/libkst.pro  
 A             libkst/vectorfactory.cpp   [License: GPL (v2+)]
 A             libkst/vectorfactory.h   [License: GPL (v2+)]
 M  +2 -2      libkstmath/builtinobjects.cpp  
 A             libkstmath/equationfactory.cpp   [License: GPL (v2+)]
 A             libkstmath/equationfactory.h   [License: GPL (v2+)]
 M  +0 -57     libkstmath/kstequation.cpp  
 M  +0 -11     libkstmath/kstequation.h  
 M  +4 -2      libkstmath/libkstmath.pro  


--- branches/work/kst/portto4/kst/src/libkst/builtinprimitives.cpp #689587:689588
@@ -10,10 +10,12 @@
  ***************************************************************************/
 
 #include "builtinprimitives.h"
+#include "vectorfactory.h"
 
 namespace Kst {
   namespace Builtins {
     void initPrimitives() {
+      new VectorFactory;
     }
   }
 }
--- branches/work/kst/portto4/kst/src/libkst/kstvector.cpp #689587:689588
@@ -30,6 +30,7 @@
 #include "defaultprimitivenames.h"
 #include "kstmath.h"
 #include "kstvector.h"
+#include "kstdebug.h"
 
 static int anonymousVectorCounter = 1;
 
--- branches/work/kst/portto4/kst/src/libkst/libkst.pro #689587:689588
@@ -49,7 +49,8 @@
     kstobjectlist.cpp \
     kstobjectmap.cpp \
     kstobjecttag.cpp \
-    builtinprimitives.cpp
+    builtinprimitives.cpp \
+    vectorfactory.cpp
 
 HEADERS += \
     datasourcefactory.h \
@@ -95,4 +96,5 @@
     kstobjectlist.h \
     kstobjectmap.h \
     kstobjecttag.h \
-    builtinprimitives.h
+    builtinprimitives.h \
+    vectorfactory.h
--- branches/work/kst/portto4/kst/src/libkstmath/builtinobjects.cpp #689587:689588
@@ -10,12 +10,12 @@
  ***************************************************************************/
 
 #include "builtinobjects.h"
-#include "kstequation.h"
+#include "equationfactory.h"
 
 namespace Kst {
   namespace Builtins {
     void initObjects() {
-      new EquationObjectFactory;
+      new EquationFactory;
     }
   }
 }
--- branches/work/kst/portto4/kst/src/libkstmath/kstequation.cpp #689587:689588
@@ -560,61 +560,4 @@
   return KstDataObject::uses(p);
 }
 
-
-namespace Kst {
-
-EquationObjectFactory::EquationObjectFactory()
-: ObjectFactory() {
-  registerFactory("equation", this);
-}
-
-EquationObjectFactory::~EquationObjectFactory() {
-}
-
-
-KstDataObjectPtr EquationObjectFactory::generateObject(QXmlStreamReader& xml) {
-  QString eq, name, xVector, output;
-  bool interpolate = false;
-
-  while (!xml.atEnd()) {
-    if (xml.isStartElement()) {
-      const QString n = xml.name().toString();
-      if (n == "equation") {
-        QXmlStreamAttributes attrs = xml.attributes();
-        name = attrs.value("name").toString();
-        interpolate = attrs.value("interpolate").toString().toLower() == "true";
-        xVector = attrs.value("xvector").toString();
-        output = attrs.value("output").toString();
-        //FIXME Don't know if this is a bug in QXmlStreamReader or what, but readElementNext takes us
-        //past the </equation> node to the </objects> node...
-        //eq = xml.readElementText();
-      } else {
-        return 0;
-      }
-    } else if (xml.isEndElement()) {
-      if (xml.name().toString() == "equation") {
-        break;
-      } else {
-        KstDebug::self()->log(QObject::tr("Error creating equation from Kst file."), KstDebug::Warning);
-        return 0;
-      }
-    }
-    xml.readNext();
-  }
-
-  if (xml.hasError()) {
-    return 0;
-  }
-
-  //FIXME verify this works when we get real vectors loading
-  KstVectorPtr vector = KST::vectorList.retrieveObject(QStringList(xVector));
-
-  KstEquationPtr ep = new KstEquation(name, eq, vector, interpolate);
-  return ep.data();
-}
-
-
-}
-
-
 // vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/src/libkstmath/kstequation.h #689587:689588
@@ -98,17 +98,6 @@
     Equation::Node *_pe;
 };
 
-namespace Kst {
-
-class EquationObjectFactory : public ObjectFactory {
-  public:
-    EquationObjectFactory();
-    ~EquationObjectFactory();
-    KstDataObjectPtr generateObject(QXmlStreamReader& stream);
-};
-
-}
-
 typedef KstSharedPtr<KstEquation> KstEquationPtr;
 typedef KstObjectList<KstEquationPtr> KstEquationList;
 
--- branches/work/kst/portto4/kst/src/libkstmath/libkstmath.pro #689587:689588
@@ -45,7 +45,8 @@
     escan.c \
     objectfactory.cpp \
     relationfactory.cpp \
-    builtinobjects.cpp
+    builtinobjects.cpp \
+    equationfactory.cpp
 
 HEADERS += \
     builtinobjects.h \
@@ -76,4 +77,5 @@
     labelparser.h \
     objectfactory.h \
     psdcalculator.h \
-    relationfactory.h
+    relationfactory.h \
+    equationfactory.h


More information about the Kst mailing list