summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2575032)
raw | patch | inline | side by side (parent: 2575032)
author | ishmal <ishmal@users.sourceforge.net> | |
Sat, 14 Jun 2008 21:17:27 +0000 (21:17 +0000) | ||
committer | ishmal <ishmal@users.sourceforge.net> | |
Sat, 14 Jun 2008 21:17:27 +0000 (21:17 +0000) |
src/dom/svg2.h | patch | blob | history |
diff --git a/src/dom/svg2.h b/src/dom/svg2.h
index 0e980cf89bae24f5901954890d989240b2d1f456..0da3d861d220992da22df7f250a2dbc287d1fc06 100644 (file)
--- a/src/dom/svg2.h
+++ b/src/dom/svg2.h
\r
\r
\r
+/*#########################################################################\r
+## SVGValue\r
+#########################################################################*/\r
+\r
+\r
+/**\r
+ * A helper class to provide a common API across several data types\r
+ */\r
+class SVGValue\r
+{\r
+public:\r
+\r
+ /**\r
+ * Constructors\r
+ */\r
+ SVGValue()\r
+ { init(); }\r
+\r
+ SVGValue(const SVGValue &other)\r
+ { assign(other); }\r
+\r
+ SVGValue(double val)\r
+ { init(); type = SVG_DOUBLE; dval = val; }\r
+\r
+ SVGValue(long val)\r
+ { init(); type = SVG_INT; ival = val; }\r
+\r
+ SVGValue(const DOMString &val)\r
+ { init(); type = SVG_STRING; sval = val; }\r
+\r
+ int getType()\r
+ { return type; }\r
+\r
+ /**\r
+ * Assignment\r
+ */\r
+ SVGValue &operator=(const SVGValue &val)\r
+ { assign(val); return *this; }\r
+\r
+ SVGValue &operator=(double val)\r
+ { init(); type = SVG_DOUBLE; dval = val; return *this; }\r
+\r
+ SVGValue &operator=(long val)\r
+ { init(); type = SVG_INT; ival = val; return *this; }\r
+\r
+ SVGValue &operator=(const DOMString &val)\r
+ { init(); type = SVG_STRING; sval = val; return *this; }\r
+\r
+ /**\r
+ * Getters\r
+ */\r
+ double doubleValue()\r
+ { return dval; }\r
+ \r
+ long intValue()\r
+ { return ival; }\r
+ \r
+ DOMString &stringValue()\r
+ { return sval; }\r
+\r
+private:\r
+\r
+ void init()\r
+ {\r
+ type = SVG_DOUBLE;\r
+ dval = 0.0;\r
+ ival = 0;\r
+ sval.clear();\r
+ }\r
+\r
+ void assign(const SVGValue &other)\r
+ {\r
+ type = other.type;\r
+ dval = other.dval;\r
+ ival = other.ival;\r
+ sval = other.sval;\r
+ }\r
+\r
+ int type;\r
+ double dval;\r
+ long ival;\r
+ DOMString sval;\r
+\r
+};\r
+\r
+\r
/*#########################################################################\r
## SVGElement\r
#########################################################################*/\r