Code

New crosshairs cursor for geometry context
[inkscape.git] / src / trace / trace.h
index 5e2c0799d7197cd7a9d1ff352b9340d13125a3a4..2c9922e1069ec7b4841d0b063bf8908ddf5c696d 100644 (file)
@@ -1,11 +1,11 @@
-/*
+/**
  * A generic interface for plugging different
  *  autotracers into Inkscape.
  *
  * Authors:
  *   Bob Jamison <rjamison@titan.com>
  *
- * Copyright (C) 2004 Bob Jamison
+ * Copyright (C) 2004-2006 Bob Jamison
  *
  * Released under GNU GPL, read the file 'COPYING' for more information
  */
@@ -49,38 +49,39 @@ public:
     /**
      *
      */
-    TracingEngineResult(char *theStyle, char *thePathData, long theNodeCount)
+    TracingEngineResult(const std::string &theStyle,
+                        const std::string &thePathData,
+                        long theNodeCount)
         {
-        next      = NULL;
-        style     = strdup(theStyle);
-        pathData  = strdup(thePathData);
+        style     = theStyle;
+        pathData  = thePathData;
         nodeCount = theNodeCount;
         }
 
+    TracingEngineResult(const TracingEngineResult &other)
+        { assign(other); }
+
+    virtual TracingEngineResult &operator=(const TracingEngineResult &other)
+        { assign(other); return *this; }
+
+
     /**
      *
      */
     virtual ~TracingEngineResult()
-        {
-        if (next)
-            delete next;
-        if (style)
-            free(style);
-        if (pathData)
-            free(pathData);
-        }
+        { }
 
 
     /**
      *
      */
-    char *getStyle()
+    std::string getStyle()
         { return style; }
 
     /**
      *
      */
-    char *getPathData()
+    std::string getPathData()
         { return pathData; }
 
     /**
@@ -89,16 +90,18 @@ public:
     long getNodeCount()
         { return nodeCount; }
 
-    /**
-     *
-     */
-    TracingEngineResult *next;
-
 private:
 
-    char *style;
+    void assign(const TracingEngineResult &other)
+        {
+        style = other.style;
+        pathData = other.pathData;
+        nodeCount = other.nodeCount;
+        }
+
+    std::string style;
 
-    char *pathData;
+    std::string pathData;
 
     long nodeCount;
 
@@ -133,9 +136,9 @@ class TracingEngine
      *  compatible with the d="" attribute
      *  of an SVG <path> element.
      */
-    virtual  TracingEngineResult *trace(Glib::RefPtr<Gdk::Pixbuf> pixbuf,
-                                        int *nrPaths)
-        { return NULL; }
+    virtual  std::vector<TracingEngineResult> trace(
+                           Glib::RefPtr<Gdk::Pixbuf> /*pixbuf*/)
+        { std::vector<TracingEngineResult> dummy;  return dummy; }
 
 
     /**