summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2d16426)
raw | patch | inline | side by side (parent: 2d16426)
author | ishmal <ishmal@users.sourceforge.net> | |
Sun, 1 Jun 2008 19:36:31 +0000 (19:36 +0000) | ||
committer | ishmal <ishmal@users.sourceforge.net> | |
Sun, 1 Jun 2008 19:36:31 +0000 (19:36 +0000) |
src/dom/svgreader.cpp | patch | blob | history |
diff --git a/src/dom/svgreader.cpp b/src/dom/svgreader.cpp
index 205151dbf91cb91ba4bb803a6ccb11b72c81db66..9db6affa2537b5d22f7db22f7af9b3ca343e9679 100644 (file)
--- a/src/dom/svgreader.cpp
+++ b/src/dom/svgreader.cpp
/**
* Defines a hyperlink
*/
-SVG_A_ELEMENT,
+SVG_A_ELEMENT = 0,
/**
* Allows control over glyphs used to render particular character
* data (e.g. for music symbols or Asian text)
/**
*
*/
-SVG_VKERN_ELEMENT
+SVG_VKERN_ELEMENT,
+/**
+ *
+ */
+SVG_MAX_ELEMENT
} SVGElementType;
{ "tspan", SVG_TSPAN_ELEMENT },
{ "use", SVG_USE_ELEMENT },
{ "view", SVG_VIEW_ELEMENT },
- { "vkern", SVG_VKERN_ELEMENT }
+ { "vkern", SVG_VKERN_ELEMENT },
+ { NULL, -1 }
};
+/**
+ * Look up the SVG Element type enum for a given string
+ * Return -1 if not found
+ */
+int svgElementStrToEnum(const char *str)
+{
+ if (!str)
+ return -1;
+ for (SVGElementTableEntry *entry = svgElementTable ;
+ entry->name; entry++)
+ {
+ if (strcmp(str, entry->name) == 0)
+ return entry->type;
+ }
+ return -1;
+}
+
+
+/**
+ * Return the string corresponding to a given SVG element type enum
+ * Return "unknown" if not found
+ */
+const char *svgElementStrToEnum(int type)
+{
+ if (type < 0 || type >= SVG_MAX_ELEMENT)
+ return "unknown";
+ return svgElementTable[type].name;
+}
/**