Code

Display CMS adjustment per-desktop view
[inkscape.git] / src / pedro / pedrodom.h
index 9c6651259bdd288991ba7cf1f719f788dfd999dc..b8078dce14fa46abb9e3d29c7dd1bfbf19a9334c 100644 (file)
@@ -6,7 +6,7 @@
  * Authors:
  *   Bob Jamison
  *
- * Copyright (C) 2005-2006 Bob Jamison
+ * Copyright (C) 2005-2007 Bob Jamison
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
@@ -23,6 +23,8 @@
  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <glib.h>
+
 #include <string>
 #include <vector>
 
@@ -176,6 +178,9 @@ public:
     Element *getParent()
         { return parent; }
 
+    Element *getFirstChild()
+        { return (children.size() == 0) ? NULL : children[0]; }
+
     std::vector<Element *> getChildren()
         { return children; }
 
@@ -183,6 +188,9 @@ public:
 
     DOMString getAttribute(const DOMString &name);
 
+    std::vector<Attribute> &getAttributes()
+        { return attributes; } 
+
     DOMString getTagAttribute(const DOMString &tagName, const DOMString &attrName);
 
     DOMString getTagValue(const DOMString &tagName);
@@ -193,6 +201,8 @@ public:
 
     void addNamespace(const DOMString &prefix, const DOMString &namespaceURI);
 
+    bool exists(const DOMString &name)
+        { return (findElements(name).size() > 0); }
 
     /**
      * Prettyprint an XML tree to an output stream.  Elements are indented
@@ -277,7 +287,7 @@ public:
      * @param fileName the name of the file to read
      * @return a pointer to the root of the XML document;
      */
-    Element *parseFile(const char *fileName);
+    Element *parseFile(const DOMString &fileName);
 
     /**
      * Utility method to preprocess a string for XML
@@ -286,6 +296,10 @@ public:
      */
     static DOMString encode(const DOMString &str);
 
+    /**
+     *  Removes whitespace from beginning and end of a string
+     */
+    DOMString trim(const DOMString &s);
 
 private:
 
@@ -300,7 +314,7 @@ private:
 
     void getLineAndColumn(long pos, long *lineNr, long *colNr);
 
-    void error(char *fmt, ...);
+    void error(char *fmt, ...) G_GNUC_PRINTF(2,3);
 
     int peek(long pos);