summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBob Jamison <ishmalius@gmail.com>2006-05-21 21:51:51 +0000
committerishmal <ishmal@users.sourceforge.net>2006-05-21 21:51:51 +0000
commit12c02a7a645e0bc0a2acdddfe3fdb9911b8c6a61 (patch)
tree2ab648845475b57afc3837bf1883b8785861d95e /src
parentCheck if we are already SSL before trying STARTTLS (diff)
downloadinkscape-12c02a7a645e0bc0a2acdddfe3fdb9911b8c6a61.tar.gz
inkscape-12c02a7a645e0bc0a2acdddfe3fdb9911b8c6a61.zip
Unix-ify the sources
(bzr r928)
Diffstat (limited to 'src')
-rw-r--r--src/dom/charclass.cpp1090
-rw-r--r--src/dom/charclass.h440
-rw-r--r--src/dom/domconfig.h104
-rw-r--r--src/dom/io/base64stream.cpp678
-rw-r--r--src/dom/io/base64stream.h292
-rw-r--r--src/dom/io/gzipstream.cpp490
-rw-r--r--src/dom/io/gzipstream.h250
-rw-r--r--src/dom/io/httpclient.cpp334
-rw-r--r--src/dom/io/httpclient.h230
-rw-r--r--src/dom/minidom.cpp1380
-rw-r--r--src/dom/minidom.h540
-rw-r--r--src/dom/odf/SvgOdg.cpp3102
-rw-r--r--src/dom/odf/odfdocument.cpp322
-rw-r--r--src/dom/odf/odfdocument.h306
-rw-r--r--src/dom/svg/svg.h8948
-rw-r--r--src/dom/svg/svgimpl.h10216
-rw-r--r--src/dom/svg/svgtypes.h13778
-rw-r--r--src/dom/util/thread.cpp252
-rw-r--r--src/dom/util/thread.h310
-rw-r--r--src/dom/util/ziptool.cpp5968
-rw-r--r--src/dom/util/ziptool.h1102
-rw-r--r--src/dom/work/testxpath.cpp2832
-rw-r--r--src/dom/work/testzip.cpp130
-rw-r--r--src/dom/work/xpathtests.cpp2580
-rw-r--r--src/dom/xmlreader.cpp1974
-rw-r--r--src/dom/xmlreader.h258
-rw-r--r--src/dom/xpathparser.cpp4094
-rw-r--r--src/dom/xpathparser.h1582
-rw-r--r--src/dom/xpathtoken.cpp1030
-rw-r--r--src/dom/xpathtoken.h2904
30 files changed, 33758 insertions, 33758 deletions
diff --git a/src/dom/charclass.cpp b/src/dom/charclass.cpp
index 132402f34..28a9dc1b6 100644
--- a/src/dom/charclass.cpp
+++ b/src/dom/charclass.cpp
@@ -1,545 +1,545 @@
-/**
- * Phoebe DOM Implementation.
- *
- * This is a C++ approximation of the W3C DOM model, which follows
- * fairly closely the specifications in the various .idl files, copies of
- * which are provided for reference. Most important is this one:
- *
- * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
- *
- * Authors:
- * Bob Jamison
- *
- * Copyright (C) 2005 Bob Jamison
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "charclass.h"
-
-
-/**
- * (impl) LetterOrDigit ::=
- * Letter | Digit
- */
-bool isLetterOrDigit(int ch)
-{
- if (isLetter(ch))
- return true;
- if (isDigit(ch))
- return true;
- return false;
-}
-
-/**
- * (84) Letter ::=
- * BaseChar | Ideographic
- */
-bool isLetter(int ch)
-{
- if (isBaseChar(ch))
- return true;
- if (isIdeographic(ch))
- return true;
- return false;
-}
-
-
-/**
- * (85) BaseChar ::=
- */
-bool isBaseChar(int ch)
-{
-
- if ( (0x0041 <= ch && ch <= 0x005A) |
- (0x0061 <= ch && ch <= 0x007A) |
- (0x00C0 <= ch && ch <= 0x00D6) |
- (0x00D8 <= ch && ch <= 0x00F6) |
- (0x00F8 <= ch && ch <= 0x00FF) |
- (0x0100 <= ch && ch <= 0x0131) |
- (0x0134 <= ch && ch <= 0x013E) |
- (0x0141 <= ch && ch <= 0x0148) |
- (0x014A <= ch && ch <= 0x017E) |
- (0x0180 <= ch && ch <= 0x01C3) |
- (0x01CD <= ch && ch <= 0x01F0) |
- (0x01F4 <= ch && ch <= 0x01F5) |
- (0x01FA <= ch && ch <= 0x0217) |
- (0x0250 <= ch && ch <= 0x02A8) |
- (0x02BB <= ch && ch <= 0x02C1) |
- ch == 0x0386 |
- (0x0388 <= ch && ch <= 0x038A) |
- ch == 0x038C |
- (0x038E <= ch && ch <= 0x03A1) |
- (0x03A3 <= ch && ch <= 0x03CE) |
- (0x03D0 <= ch && ch <= 0x03D6) |
- ch == 0x03DA |
- ch == 0x03DC |
- ch == 0x03DE |
- ch == 0x03E0 |
- (0x03E2 <= ch && ch <= 0x03F3) |
- (0x0401 <= ch && ch <= 0x040C) |
- (0x040E <= ch && ch <= 0x044F) |
- (0x0451 <= ch && ch <= 0x045C) |
- (0x045E <= ch && ch <= 0x0481) |
- (0x0490 <= ch && ch <= 0x04C4) |
- (0x04C7 <= ch && ch <= 0x04C8) |
- (0x04CB <= ch && ch <= 0x04CC) |
- (0x04D0 <= ch && ch <= 0x04EB) |
- (0x04EE <= ch && ch <= 0x04F5) |
- (0x04F8 <= ch && ch <= 0x04F9) |
- (0x0531 <= ch && ch <= 0x0556) |
- ch == 0x0559 |
- (0x0561 <= ch && ch <= 0x0586) |
- (0x05D0 <= ch && ch <= 0x05EA) |
- (0x05F0 <= ch && ch <= 0x05F2) |
- (0x0621 <= ch && ch <= 0x063A) |
- (0x0641 <= ch && ch <= 0x064A) |
- (0x0671 <= ch && ch <= 0x06B7) |
- (0x06BA <= ch && ch <= 0x06BE) |
- (0x06C0 <= ch && ch <= 0x06CE) |
- (0x06D0 <= ch && ch <= 0x06D3) |
- ch == 0x06D5 |
- (0x06E5 <= ch && ch <= 0x06E6) |
- (0x0905 <= ch && ch <= 0x0939) |
- ch == 0x093D |
- (0x0958 <= ch && ch <= 0x0961) |
- (0x0985 <= ch && ch <= 0x098C) |
- (0x098F <= ch && ch <= 0x0990) |
- (0x0993 <= ch && ch <= 0x09A8) |
- (0x09AA <= ch && ch <= 0x09B0) |
- ch == 0x09B2 |
- (0x09B6 <= ch && ch <= 0x09B9) |
- (0x09DC <= ch && ch <= 0x09DD) |
- (0x09DF <= ch && ch <= 0x09E1) |
- (0x09F0 <= ch && ch <= 0x09F1) |
- (0x0A05 <= ch && ch <= 0x0A0A) |
- (0x0A0F <= ch && ch <= 0x0A10) |
- (0x0A13 <= ch && ch <= 0x0A28) |
- (0x0A2A <= ch && ch <= 0x0A30) |
- (0x0A32 <= ch && ch <= 0x0A33) |
- (0x0A35 <= ch && ch <= 0x0A36) |
- (0x0A38 <= ch && ch <= 0x0A39) |
- (0x0A59 <= ch && ch <= 0x0A5C) |
- ch == 0x0A5E |
- (0x0A72 <= ch && ch <= 0x0A74) |
- (0x0A85 <= ch && ch <= 0x0A8B) |
- ch == 0x0A8D |
- (0x0A8F <= ch && ch <= 0x0A91) |
- (0x0A93 <= ch && ch <= 0x0AA8) |
- (0x0AAA <= ch && ch <= 0x0AB0) |
- (0x0AB2 <= ch && ch <= 0x0AB3) |
- (0x0AB5 <= ch && ch <= 0x0AB9) |
- ch == 0x0ABD |
- ch == 0x0AE0 |
- (0x0B05 <= ch && ch <= 0x0B0C) |
- (0x0B0F <= ch && ch <= 0x0B10) |
- (0x0B13 <= ch && ch <= 0x0B28) |
- (0x0B2A <= ch && ch <= 0x0B30) |
- (0x0B32 <= ch && ch <= 0x0B33) |
- (0x0B36 <= ch && ch <= 0x0B39) |
- ch == 0x0B3D |
- (0x0B5C <= ch && ch <= 0x0B5D) |
- (0x0B5F <= ch && ch <= 0x0B61) |
- (0x0B85 <= ch && ch <= 0x0B8A) |
- (0x0B8E <= ch && ch <= 0x0B90) |
- (0x0B92 <= ch && ch <= 0x0B95) |
- (0x0B99 <= ch && ch <= 0x0B9A) |
- ch == 0x0B9C |
- (0x0B9E <= ch && ch <= 0x0B9F) |
- (0x0BA3 <= ch && ch <= 0x0BA4) |
- (0x0BA8 <= ch && ch <= 0x0BAA) |
- (0x0BAE <= ch && ch <= 0x0BB5) |
- (0x0BB7 <= ch && ch <= 0x0BB9) |
- (0x0C05 <= ch && ch <= 0x0C0C) |
- (0x0C0E <= ch && ch <= 0x0C10) |
- (0x0C12 <= ch && ch <= 0x0C28) |
- (0x0C2A <= ch && ch <= 0x0C33) |
- (0x0C35 <= ch && ch <= 0x0C39) |
- (0x0C60 <= ch && ch <= 0x0C61) |
- (0x0C85 <= ch && ch <= 0x0C8C) |
- (0x0C8E <= ch && ch <= 0x0C90) |
- (0x0C92 <= ch && ch <= 0x0CA8) |
- (0x0CAA <= ch && ch <= 0x0CB3) |
- (0x0CB5 <= ch && ch <= 0x0CB9) |
- ch == 0x0CDE |
- (0x0CE0 <= ch && ch <= 0x0CE1) |
- (0x0D05 <= ch && ch <= 0x0D0C) |
- (0x0D0E <= ch && ch <= 0x0D10) |
- (0x0D12 <= ch && ch <= 0x0D28) |
- (0x0D2A <= ch && ch <= 0x0D39) |
- (0x0D60 <= ch && ch <= 0x0D61) |
- (0x0E01 <= ch && ch <= 0x0E2E) |
- ch == 0x0E30 |
- (0x0E32 <= ch && ch <= 0x0E33) |
- (0x0E40 <= ch && ch <= 0x0E45) |
- (0x0E81 <= ch && ch <= 0x0E82) |
- ch == 0x0E84 |
- (0x0E87 <= ch && ch <= 0x0E88) |
- ch == 0x0E8A |
- ch == 0x0E8D |
- (0x0E94 <= ch && ch <= 0x0E97) |
- (0x0E99 <= ch && ch <= 0x0E9F) |
- (0x0EA1 <= ch && ch <= 0x0EA3) |
- ch == 0x0EA5 |
- ch == 0x0EA7 |
- (0x0EAA <= ch && ch <= 0x0EAB) |
- (0x0EAD <= ch && ch <= 0x0EAE) |
- ch == 0x0EB0 |
- (0x0EB2 <= ch && ch <= 0x0EB3) |
- ch == 0x0EBD |
- (0x0EC0 <= ch && ch <= 0x0EC4) |
- (0x0F40 <= ch && ch <= 0x0F47) |
- (0x0F49 <= ch && ch <= 0x0F69) |
- (0x10A0 <= ch && ch <= 0x10C5) |
- (0x10D0 <= ch && ch <= 0x10F6) |
- ch == 0x1100 |
- (0x1102 <= ch && ch <= 0x1103) |
- (0x1105 <= ch && ch <= 0x1107) |
- ch == 0x1109 |
- (0x110B <= ch && ch <= 0x110C) |
- (0x110E <= ch && ch <= 0x1112) |
- ch == 0x113C |
- ch == 0x113E |
- ch == 0x1140 |
- ch == 0x114C |
- ch == 0x114E |
- ch == 0x1150 |
- (0x1154 <= ch && ch <= 0x1155) |
- ch == 0x1159 |
- (0x115F <= ch && ch <= 0x1161) |
- ch == 0x1163 |
- ch == 0x1165 |
- ch == 0x1167 |
- ch == 0x1169 |
- (0x116D <= ch && ch <= 0x116E) |
- (0x1172 <= ch && ch <= 0x1173) |
- ch == 0x1175 |
- ch == 0x119E |
- ch == 0x11A8 |
- ch == 0x11AB |
- (0x11AE <= ch && ch <= 0x11AF) |
- (0x11B7 <= ch && ch <= 0x11B8) |
- ch == 0x11BA |
- (0x11BC <= ch && ch <= 0x11C2) |
- ch == 0x11EB |
- ch == 0x11F0 |
- ch == 0x11F9 |
- (0x1E00 <= ch && ch <= 0x1E9B) |
- (0x1EA0 <= ch && ch <= 0x1EF9) |
- (0x1F00 <= ch && ch <= 0x1F15) |
- (0x1F18 <= ch && ch <= 0x1F1D) |
- (0x1F20 <= ch && ch <= 0x1F45) |
- (0x1F48 <= ch && ch <= 0x1F4D) |
- (0x1F50 <= ch && ch <= 0x1F57) |
- ch == 0x1F59 |
- ch == 0x1F5B |
- ch == 0x1F5D |
- (0x1F5F <= ch && ch <= 0x1F7D) |
- (0x1F80 <= ch && ch <= 0x1FB4) |
- (0x1FB6 <= ch && ch <= 0x1FBC) |
- ch == 0x1FBE |
- (0x1FC2 <= ch && ch <= 0x1FC4) |
- (0x1FC6 <= ch && ch <= 0x1FCC) |
- (0x1FD0 <= ch && ch <= 0x1FD3) |
- (0x1FD6 <= ch && ch <= 0x1FDB) |
- (0x1FE0 <= ch && ch <= 0x1FEC) |
- (0x1FF2 <= ch && ch <= 0x1FF4) |
- (0x1FF6 <= ch && ch <= 0x1FFC) |
- ch == 0x2126 |
- (0x212A <= ch && ch <= 0x212B) |
- ch == 0x212E |
- (0x2180 <= ch && ch <= 0x2182) |
- (0x3041 <= ch && ch <= 0x3094) |
- (0x30A1 <= ch && ch <= 0x30FA) |
- (0x3105 <= ch && ch <= 0x312C) |
- (0xAC00 <= ch && ch <= 0xD7A3) )
- return true;
- return false;
-}
-
-
-
-/**
- * (86) Ideographic ::=
- */
-bool isIdeographic(int ch)
-{
- if ( (0x4E00 <= ch && ch <=0x9FA5) |
- ch == 0x3007 |
- (0x3021 <= ch && ch <=0x3029) )
- return true;
- return false;
-}
-
-/**
- * (87) CombiningChar ::=
- */
-bool isCombiningChar(int ch)
-{
- if ( (0x0300 <= ch && ch <= 0x0345) |
- (0x0360 <= ch && ch <= 0x0361) |
- (0x0483 <= ch && ch <= 0x0486) |
- (0x0591 <= ch && ch <= 0x05A1) |
- (0x05A3 <= ch && ch <= 0x05B9) |
- (0x05BB <= ch && ch <= 0x05BD) |
- ch == 0x05BF |
- (0x05C1 <= ch && ch <= 0x05C2) |
- ch == 0x05C4 |
- (0x064B <= ch && ch <= 0x0652) |
- ch == 0x0670 |
- (0x06D6 <= ch && ch <= 0x06DC) |
- (0x06DD <= ch && ch <= 0x06DF) |
- (0x06E0 <= ch && ch <= 0x06E4) |
- (0x06E7 <= ch && ch <= 0x06E8) |
- (0x06EA <= ch && ch <= 0x06ED) |
- (0x0901 <= ch && ch <= 0x0903) |
- ch == 0x093C |
- (0x093E <= ch && ch <= 0x094C) |
- ch == 0x094D |
- (0x0951 <= ch && ch <= 0x0954) |
- (0x0962 <= ch && ch <= 0x0963) |
- (0x0981 <= ch && ch <= 0x0983) |
- ch == 0x09BC |
- ch == 0x09BE |
- ch == 0x09BF |
- (0x09C0 <= ch && ch <= 0x09C4) |
- (0x09C7 <= ch && ch <= 0x09C8) |
- (0x09CB <= ch && ch <= 0x09CD) |
- ch == 0x09D7 |
- (0x09E2 <= ch && ch <= 0x09E3) |
- ch == 0x0A02 |
- ch == 0x0A3C |
- ch == 0x0A3E |
- ch == 0x0A3F |
- (0x0A40 <= ch && ch <= 0x0A42) |
- (0x0A47 <= ch && ch <= 0x0A48) |
- (0x0A4B <= ch && ch <= 0x0A4D) |
- (0x0A70 <= ch && ch <= 0x0A71) |
- (0x0A81 <= ch && ch <= 0x0A83) |
- ch == 0x0ABC |
- (0x0ABE <= ch && ch <= 0x0AC5) |
- (0x0AC7 <= ch && ch <= 0x0AC9) |
- (0x0ACB <= ch && ch <= 0x0ACD) |
- (0x0B01 <= ch && ch <= 0x0B03) |
- ch == 0x0B3C |
- (0x0B3E <= ch && ch <= 0x0B43) |
- (0x0B47 <= ch && ch <= 0x0B48) |
- (0x0B4B <= ch && ch <= 0x0B4D) |
- (0x0B56 <= ch && ch <= 0x0B57) |
- (0x0B82 <= ch && ch <= 0x0B83) |
- (0x0BBE <= ch && ch <= 0x0BC2) |
- (0x0BC6 <= ch && ch <= 0x0BC8) |
- (0x0BCA <= ch && ch <= 0x0BCD) |
- ch == 0x0BD7 |
- (0x0C01 <= ch && ch <= 0x0C03) |
- (0x0C3E <= ch && ch <= 0x0C44) |
- (0x0C46 <= ch && ch <= 0x0C48) |
- (0x0C4A <= ch && ch <= 0x0C4D) |
- (0x0C55 <= ch && ch <= 0x0C56) |
- (0x0C82 <= ch && ch <= 0x0C83) |
- (0x0CBE <= ch && ch <= 0x0CC4) |
- (0x0CC6 <= ch && ch <= 0x0CC8) |
- (0x0CCA <= ch && ch <= 0x0CCD) |
- (0x0CD5 <= ch && ch <= 0x0CD6) |
- (0x0D02 <= ch && ch <= 0x0D03) |
- (0x0D3E <= ch && ch <= 0x0D43) |
- (0x0D46 <= ch && ch <= 0x0D48) |
- (0x0D4A <= ch && ch <= 0x0D4D) |
- ch == 0x0D57 |
- ch == 0x0E31 |
- (0x0E34 <= ch && ch <= 0x0E3A) |
- (0x0E47 <= ch && ch <= 0x0E4E) |
- ch == 0x0EB1 |
- (0x0EB4 <= ch && ch <= 0x0EB9) |
- (0x0EBB <= ch && ch <= 0x0EBC) |
- (0x0EC8 <= ch && ch <= 0x0ECD) |
- (0x0F18 <= ch && ch <= 0x0F19) |
- ch == 0x0F35 |
- ch == 0x0F37 |
- ch == 0x0F39 |
- ch == 0x0F3E |
- ch == 0x0F3F |
- (0x0F71 <= ch && ch <= 0x0F84) |
- (0x0F86 <= ch && ch <= 0x0F8B) |
- (0x0F90 <= ch && ch <= 0x0F95) |
- ch == 0x0F97 |
- (0x0F99 <= ch && ch <= 0x0FAD) |
- (0x0FB1 <= ch && ch <= 0x0FB7) |
- ch == 0x0FB9 |
- (0x20D0 <= ch && ch <= 0x20DC) |
- ch == 0x20E1 |
- (0x302A <= ch && ch <= 0x302F) |
- ch == 0x3099 |
- ch == 0x309A )
- return true;
- return false;
-}
-
-
-/**
- * (88) Digit ::=
- */
-bool isDigit(int ch)
-{
- if ( (0x0030 <= ch && ch <= 0x0039) |
- (0x0660 <= ch && ch <= 0x0669) |
- (0x06F0 <= ch && ch <= 0x06F9) |
- (0x0966 <= ch && ch <= 0x096F) |
- (0x09E6 <= ch && ch <= 0x09EF) |
- (0x0A66 <= ch && ch <= 0x0A6F) |
- (0x0AE6 <= ch && ch <= 0x0AEF) |
- (0x0B66 <= ch && ch <= 0x0B6F) |
- (0x0BE7 <= ch && ch <= 0x0BEF) |
- (0x0C66 <= ch && ch <= 0x0C6F) |
- (0x0CE6 <= ch && ch <= 0x0CEF) |
- (0x0D66 <= ch && ch <= 0x0D6F) |
- (0x0E50 <= ch && ch <= 0x0E59) |
- (0x0ED0 <= ch && ch <= 0x0ED9) |
- (0x0F20 <= ch && ch <= 0x0F29) )
- return true;
- return false;
-}
-
-
-/**
- * (89) Extender ::=
- */
-bool isExtender(int ch)
-{
- if ( ch == 0x00B7 |
- ch == 0x02D0 |
- ch == 0x02D1 |
- ch == 0x0387 |
- ch == 0x0640 |
- ch == 0x0E46 |
- ch == 0x0EC6 |
- ch == 0x3005 |
- (0x3031 <= ch && ch <= 0x3035) |
- (0x309D <= ch && ch <= 0x309E) |
- (0x30FC <= ch && ch <= 0x30FE) )
- return true;
- return false;
-}
-
-
-
-
-
-
-/**
- *
- * Following are from unicode.org, in the UnicodeData file
- * in the Unicode Database
- */
-
-/**
- * UNICODE general class Zs
- */
-bool isSpaceSeparator(int ch)
-{
- if (ch == 0x0020 ||
- ch == 0x200A ||
- ch == 0x2003 ||
- ch == 0x205F ||
- ch == 0x2005 ||
- ch == 0x202F ||
- ch == 0x2000 ||
- ch == 0x180E ||
- ch == 0x2001 ||
- ch == 0x2004 ||
- ch == 0x3000 ||
- ch == 0x2008 ||
- ch == 0x2006 ||
- ch == 0x2002 ||
- ch == 0x2007 ||
- ch == 0x2009 ||
- ch == 0x00A0 ||
- ch == 0x1680)
- return true;
- return false;
-}
-
-/**
- * UNICODE general class Zl
- */
-bool isLineSeparator(int ch)
-{
- if (ch == 0x2028)
- return true;
- return false;
-}
-
-/**
- * UNICODE general class Zp
- */
-bool isParagraphSeparator(int ch)
-{
- if (ch == 0x2029)
- return true;
- return false;
-}
-
-/**
- * The union of the 3 space types.
- */
-bool isSpaceChar(int ch)
-{
- if ( isSpaceSeparator(ch) ||
- isLineSeparator(ch) ||
- isParagraphSeparator(ch))
- return true;
- return false;
-}
-
-/**
- * 3 spaces in isSpaceChar() which don't break
- */
-bool isNonBreakingSpace(int ch)
-{
- if (ch == 0x00A0 || ch == 0x2007 || ch == 0x202F)
- return true;
- return false;
-}
-
-/**
- *
- */
-bool isWhitespace(int ch)
-{
- if (isSpaceChar(ch) && !isNonBreakingSpace(ch))
- return true;
- if (ch == 0x0009 || // HORIZONTAL TABULATION
- ch == 0x000A || // LINE FEED.
- ch == 0x000B || // VERTICAL TABULATION.
- ch == 0x000C || // FORM FEED.
- ch == 0x000D || // CARRIAGE RETURN.
- ch == 0x001C || // FILE SEPARATOR.
- ch == 0x001D || // GROUP SEPARATOR.
- ch == 0x001E || // RECORD SEPARATOR.
- ch == 0x001F) // UNIT SEPARATOR.
- return true;
- return false;
-}
-
-
-
-
-
-
-
-
-
-
-
+/**
+ * Phoebe DOM Implementation.
+ *
+ * This is a C++ approximation of the W3C DOM model, which follows
+ * fairly closely the specifications in the various .idl files, copies of
+ * which are provided for reference. Most important is this one:
+ *
+ * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
+ *
+ * Authors:
+ * Bob Jamison
+ *
+ * Copyright (C) 2005 Bob Jamison
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "charclass.h"
+
+
+/**
+ * (impl) LetterOrDigit ::=
+ * Letter | Digit
+ */
+bool isLetterOrDigit(int ch)
+{
+ if (isLetter(ch))
+ return true;
+ if (isDigit(ch))
+ return true;
+ return false;
+}
+
+/**
+ * (84) Letter ::=
+ * BaseChar | Ideographic
+ */
+bool isLetter(int ch)
+{
+ if (isBaseChar(ch))
+ return true;
+ if (isIdeographic(ch))
+ return true;
+ return false;
+}
+
+
+/**
+ * (85) BaseChar ::=
+ */
+bool isBaseChar(int ch)
+{
+
+ if ( (0x0041 <= ch && ch <= 0x005A) |
+ (0x0061 <= ch && ch <= 0x007A) |
+ (0x00C0 <= ch && ch <= 0x00D6) |
+ (0x00D8 <= ch && ch <= 0x00F6) |
+ (0x00F8 <= ch && ch <= 0x00FF) |
+ (0x0100 <= ch && ch <= 0x0131) |
+ (0x0134 <= ch && ch <= 0x013E) |
+ (0x0141 <= ch && ch <= 0x0148) |
+ (0x014A <= ch && ch <= 0x017E) |
+ (0x0180 <= ch && ch <= 0x01C3) |
+ (0x01CD <= ch && ch <= 0x01F0) |
+ (0x01F4 <= ch && ch <= 0x01F5) |
+ (0x01FA <= ch && ch <= 0x0217) |
+ (0x0250 <= ch && ch <= 0x02A8) |
+ (0x02BB <= ch && ch <= 0x02C1) |
+ ch == 0x0386 |
+ (0x0388 <= ch && ch <= 0x038A) |
+ ch == 0x038C |
+ (0x038E <= ch && ch <= 0x03A1) |
+ (0x03A3 <= ch && ch <= 0x03CE) |
+ (0x03D0 <= ch && ch <= 0x03D6) |
+ ch == 0x03DA |
+ ch == 0x03DC |
+ ch == 0x03DE |
+ ch == 0x03E0 |
+ (0x03E2 <= ch && ch <= 0x03F3) |
+ (0x0401 <= ch && ch <= 0x040C) |
+ (0x040E <= ch && ch <= 0x044F) |
+ (0x0451 <= ch && ch <= 0x045C) |
+ (0x045E <= ch && ch <= 0x0481) |
+ (0x0490 <= ch && ch <= 0x04C4) |
+ (0x04C7 <= ch && ch <= 0x04C8) |
+ (0x04CB <= ch && ch <= 0x04CC) |
+ (0x04D0 <= ch && ch <= 0x04EB) |
+ (0x04EE <= ch && ch <= 0x04F5) |
+ (0x04F8 <= ch && ch <= 0x04F9) |
+ (0x0531 <= ch && ch <= 0x0556) |
+ ch == 0x0559 |
+ (0x0561 <= ch && ch <= 0x0586) |
+ (0x05D0 <= ch && ch <= 0x05EA) |
+ (0x05F0 <= ch && ch <= 0x05F2) |
+ (0x0621 <= ch && ch <= 0x063A) |
+ (0x0641 <= ch && ch <= 0x064A) |
+ (0x0671 <= ch && ch <= 0x06B7) |
+ (0x06BA <= ch && ch <= 0x06BE) |
+ (0x06C0 <= ch && ch <= 0x06CE) |
+ (0x06D0 <= ch && ch <= 0x06D3) |
+ ch == 0x06D5 |
+ (0x06E5 <= ch && ch <= 0x06E6) |
+ (0x0905 <= ch && ch <= 0x0939) |
+ ch == 0x093D |
+ (0x0958 <= ch && ch <= 0x0961) |
+ (0x0985 <= ch && ch <= 0x098C) |
+ (0x098F <= ch && ch <= 0x0990) |
+ (0x0993 <= ch && ch <= 0x09A8) |
+ (0x09AA <= ch && ch <= 0x09B0) |
+ ch == 0x09B2 |
+ (0x09B6 <= ch && ch <= 0x09B9) |
+ (0x09DC <= ch && ch <= 0x09DD) |
+ (0x09DF <= ch && ch <= 0x09E1) |
+ (0x09F0 <= ch && ch <= 0x09F1) |
+ (0x0A05 <= ch && ch <= 0x0A0A) |
+ (0x0A0F <= ch && ch <= 0x0A10) |
+ (0x0A13 <= ch && ch <= 0x0A28) |
+ (0x0A2A <= ch && ch <= 0x0A30) |
+ (0x0A32 <= ch && ch <= 0x0A33) |
+ (0x0A35 <= ch && ch <= 0x0A36) |
+ (0x0A38 <= ch && ch <= 0x0A39) |
+ (0x0A59 <= ch && ch <= 0x0A5C) |
+ ch == 0x0A5E |
+ (0x0A72 <= ch && ch <= 0x0A74) |
+ (0x0A85 <= ch && ch <= 0x0A8B) |
+ ch == 0x0A8D |
+ (0x0A8F <= ch && ch <= 0x0A91) |
+ (0x0A93 <= ch && ch <= 0x0AA8) |
+ (0x0AAA <= ch && ch <= 0x0AB0) |
+ (0x0AB2 <= ch && ch <= 0x0AB3) |
+ (0x0AB5 <= ch && ch <= 0x0AB9) |
+ ch == 0x0ABD |
+ ch == 0x0AE0 |
+ (0x0B05 <= ch && ch <= 0x0B0C) |
+ (0x0B0F <= ch && ch <= 0x0B10) |
+ (0x0B13 <= ch && ch <= 0x0B28) |
+ (0x0B2A <= ch && ch <= 0x0B30) |
+ (0x0B32 <= ch && ch <= 0x0B33) |
+ (0x0B36 <= ch && ch <= 0x0B39) |
+ ch == 0x0B3D |
+ (0x0B5C <= ch && ch <= 0x0B5D) |
+ (0x0B5F <= ch && ch <= 0x0B61) |
+ (0x0B85 <= ch && ch <= 0x0B8A) |
+ (0x0B8E <= ch && ch <= 0x0B90) |
+ (0x0B92 <= ch && ch <= 0x0B95) |
+ (0x0B99 <= ch && ch <= 0x0B9A) |
+ ch == 0x0B9C |
+ (0x0B9E <= ch && ch <= 0x0B9F) |
+ (0x0BA3 <= ch && ch <= 0x0BA4) |
+ (0x0BA8 <= ch && ch <= 0x0BAA) |
+ (0x0BAE <= ch && ch <= 0x0BB5) |
+ (0x0BB7 <= ch && ch <= 0x0BB9) |
+ (0x0C05 <= ch && ch <= 0x0C0C) |
+ (0x0C0E <= ch && ch <= 0x0C10) |
+ (0x0C12 <= ch && ch <= 0x0C28) |
+ (0x0C2A <= ch && ch <= 0x0C33) |
+ (0x0C35 <= ch && ch <= 0x0C39) |
+ (0x0C60 <= ch && ch <= 0x0C61) |
+ (0x0C85 <= ch && ch <= 0x0C8C) |
+ (0x0C8E <= ch && ch <= 0x0C90) |
+ (0x0C92 <= ch && ch <= 0x0CA8) |
+ (0x0CAA <= ch && ch <= 0x0CB3) |
+ (0x0CB5 <= ch && ch <= 0x0CB9) |
+ ch == 0x0CDE |
+ (0x0CE0 <= ch && ch <= 0x0CE1) |
+ (0x0D05 <= ch && ch <= 0x0D0C) |
+ (0x0D0E <= ch && ch <= 0x0D10) |
+ (0x0D12 <= ch && ch <= 0x0D28) |
+ (0x0D2A <= ch && ch <= 0x0D39) |
+ (0x0D60 <= ch && ch <= 0x0D61) |
+ (0x0E01 <= ch && ch <= 0x0E2E) |
+ ch == 0x0E30 |
+ (0x0E32 <= ch && ch <= 0x0E33) |
+ (0x0E40 <= ch && ch <= 0x0E45) |
+ (0x0E81 <= ch && ch <= 0x0E82) |
+ ch == 0x0E84 |
+ (0x0E87 <= ch && ch <= 0x0E88) |
+ ch == 0x0E8A |
+ ch == 0x0E8D |
+ (0x0E94 <= ch && ch <= 0x0E97) |
+ (0x0E99 <= ch && ch <= 0x0E9F) |
+ (0x0EA1 <= ch && ch <= 0x0EA3) |
+ ch == 0x0EA5 |
+ ch == 0x0EA7 |
+ (0x0EAA <= ch && ch <= 0x0EAB) |
+ (0x0EAD <= ch && ch <= 0x0EAE) |
+ ch == 0x0EB0 |
+ (0x0EB2 <= ch && ch <= 0x0EB3) |
+ ch == 0x0EBD |
+ (0x0EC0 <= ch && ch <= 0x0EC4) |
+ (0x0F40 <= ch && ch <= 0x0F47) |
+ (0x0F49 <= ch && ch <= 0x0F69) |
+ (0x10A0 <= ch && ch <= 0x10C5) |
+ (0x10D0 <= ch && ch <= 0x10F6) |
+ ch == 0x1100 |
+ (0x1102 <= ch && ch <= 0x1103) |
+ (0x1105 <= ch && ch <= 0x1107) |
+ ch == 0x1109 |
+ (0x110B <= ch && ch <= 0x110C) |
+ (0x110E <= ch && ch <= 0x1112) |
+ ch == 0x113C |
+ ch == 0x113E |
+ ch == 0x1140 |
+ ch == 0x114C |
+ ch == 0x114E |
+ ch == 0x1150 |
+ (0x1154 <= ch && ch <= 0x1155) |
+ ch == 0x1159 |
+ (0x115F <= ch && ch <= 0x1161) |
+ ch == 0x1163 |
+ ch == 0x1165 |
+ ch == 0x1167 |
+ ch == 0x1169 |
+ (0x116D <= ch && ch <= 0x116E) |
+ (0x1172 <= ch && ch <= 0x1173) |
+ ch == 0x1175 |
+ ch == 0x119E |
+ ch == 0x11A8 |
+ ch == 0x11AB |
+ (0x11AE <= ch && ch <= 0x11AF) |
+ (0x11B7 <= ch && ch <= 0x11B8) |
+ ch == 0x11BA |
+ (0x11BC <= ch && ch <= 0x11C2) |
+ ch == 0x11EB |
+ ch == 0x11F0 |
+ ch == 0x11F9 |
+ (0x1E00 <= ch && ch <= 0x1E9B) |
+ (0x1EA0 <= ch && ch <= 0x1EF9) |
+ (0x1F00 <= ch && ch <= 0x1F15) |
+ (0x1F18 <= ch && ch <= 0x1F1D) |
+ (0x1F20 <= ch && ch <= 0x1F45) |
+ (0x1F48 <= ch && ch <= 0x1F4D) |
+ (0x1F50 <= ch && ch <= 0x1F57) |
+ ch == 0x1F59 |
+ ch == 0x1F5B |
+ ch == 0x1F5D |
+ (0x1F5F <= ch && ch <= 0x1F7D) |
+ (0x1F80 <= ch && ch <= 0x1FB4) |
+ (0x1FB6 <= ch && ch <= 0x1FBC) |
+ ch == 0x1FBE |
+ (0x1FC2 <= ch && ch <= 0x1FC4) |
+ (0x1FC6 <= ch && ch <= 0x1FCC) |
+ (0x1FD0 <= ch && ch <= 0x1FD3) |
+ (0x1FD6 <= ch && ch <= 0x1FDB) |
+ (0x1FE0 <= ch && ch <= 0x1FEC) |
+ (0x1FF2 <= ch && ch <= 0x1FF4) |
+ (0x1FF6 <= ch && ch <= 0x1FFC) |
+ ch == 0x2126 |
+ (0x212A <= ch && ch <= 0x212B) |
+ ch == 0x212E |
+ (0x2180 <= ch && ch <= 0x2182) |
+ (0x3041 <= ch && ch <= 0x3094) |
+ (0x30A1 <= ch && ch <= 0x30FA) |
+ (0x3105 <= ch && ch <= 0x312C) |
+ (0xAC00 <= ch && ch <= 0xD7A3) )
+ return true;
+ return false;
+}
+
+
+
+/**
+ * (86) Ideographic ::=
+ */
+bool isIdeographic(int ch)
+{
+ if ( (0x4E00 <= ch && ch <=0x9FA5) |
+ ch == 0x3007 |
+ (0x3021 <= ch && ch <=0x3029) )
+ return true;
+ return false;
+}
+
+/**
+ * (87) CombiningChar ::=
+ */
+bool isCombiningChar(int ch)
+{
+ if ( (0x0300 <= ch && ch <= 0x0345) |
+ (0x0360 <= ch && ch <= 0x0361) |
+ (0x0483 <= ch && ch <= 0x0486) |
+ (0x0591 <= ch && ch <= 0x05A1) |
+ (0x05A3 <= ch && ch <= 0x05B9) |
+ (0x05BB <= ch && ch <= 0x05BD) |
+ ch == 0x05BF |
+ (0x05C1 <= ch && ch <= 0x05C2) |
+ ch == 0x05C4 |
+ (0x064B <= ch && ch <= 0x0652) |
+ ch == 0x0670 |
+ (0x06D6 <= ch && ch <= 0x06DC) |
+ (0x06DD <= ch && ch <= 0x06DF) |
+ (0x06E0 <= ch && ch <= 0x06E4) |
+ (0x06E7 <= ch && ch <= 0x06E8) |
+ (0x06EA <= ch && ch <= 0x06ED) |
+ (0x0901 <= ch && ch <= 0x0903) |
+ ch == 0x093C |
+ (0x093E <= ch && ch <= 0x094C) |
+ ch == 0x094D |
+ (0x0951 <= ch && ch <= 0x0954) |
+ (0x0962 <= ch && ch <= 0x0963) |
+ (0x0981 <= ch && ch <= 0x0983) |
+ ch == 0x09BC |
+ ch == 0x09BE |
+ ch == 0x09BF |
+ (0x09C0 <= ch && ch <= 0x09C4) |
+ (0x09C7 <= ch && ch <= 0x09C8) |
+ (0x09CB <= ch && ch <= 0x09CD) |
+ ch == 0x09D7 |
+ (0x09E2 <= ch && ch <= 0x09E3) |
+ ch == 0x0A02 |
+ ch == 0x0A3C |
+ ch == 0x0A3E |
+ ch == 0x0A3F |
+ (0x0A40 <= ch && ch <= 0x0A42) |
+ (0x0A47 <= ch && ch <= 0x0A48) |
+ (0x0A4B <= ch && ch <= 0x0A4D) |
+ (0x0A70 <= ch && ch <= 0x0A71) |
+ (0x0A81 <= ch && ch <= 0x0A83) |
+ ch == 0x0ABC |
+ (0x0ABE <= ch && ch <= 0x0AC5) |
+ (0x0AC7 <= ch && ch <= 0x0AC9) |
+ (0x0ACB <= ch && ch <= 0x0ACD) |
+ (0x0B01 <= ch && ch <= 0x0B03) |
+ ch == 0x0B3C |
+ (0x0B3E <= ch && ch <= 0x0B43) |
+ (0x0B47 <= ch && ch <= 0x0B48) |
+ (0x0B4B <= ch && ch <= 0x0B4D) |
+ (0x0B56 <= ch && ch <= 0x0B57) |
+ (0x0B82 <= ch && ch <= 0x0B83) |
+ (0x0BBE <= ch && ch <= 0x0BC2) |
+ (0x0BC6 <= ch && ch <= 0x0BC8) |
+ (0x0BCA <= ch && ch <= 0x0BCD) |
+ ch == 0x0BD7 |
+ (0x0C01 <= ch && ch <= 0x0C03) |
+ (0x0C3E <= ch && ch <= 0x0C44) |
+ (0x0C46 <= ch && ch <= 0x0C48) |
+ (0x0C4A <= ch && ch <= 0x0C4D) |
+ (0x0C55 <= ch && ch <= 0x0C56) |
+ (0x0C82 <= ch && ch <= 0x0C83) |
+ (0x0CBE <= ch && ch <= 0x0CC4) |
+ (0x0CC6 <= ch && ch <= 0x0CC8) |
+ (0x0CCA <= ch && ch <= 0x0CCD) |
+ (0x0CD5 <= ch && ch <= 0x0CD6) |
+ (0x0D02 <= ch && ch <= 0x0D03) |
+ (0x0D3E <= ch && ch <= 0x0D43) |
+ (0x0D46 <= ch && ch <= 0x0D48) |
+ (0x0D4A <= ch && ch <= 0x0D4D) |
+ ch == 0x0D57 |
+ ch == 0x0E31 |
+ (0x0E34 <= ch && ch <= 0x0E3A) |
+ (0x0E47 <= ch && ch <= 0x0E4E) |
+ ch == 0x0EB1 |
+ (0x0EB4 <= ch && ch <= 0x0EB9) |
+ (0x0EBB <= ch && ch <= 0x0EBC) |
+ (0x0EC8 <= ch && ch <= 0x0ECD) |
+ (0x0F18 <= ch && ch <= 0x0F19) |
+ ch == 0x0F35 |
+ ch == 0x0F37 |
+ ch == 0x0F39 |
+ ch == 0x0F3E |
+ ch == 0x0F3F |
+ (0x0F71 <= ch && ch <= 0x0F84) |
+ (0x0F86 <= ch && ch <= 0x0F8B) |
+ (0x0F90 <= ch && ch <= 0x0F95) |
+ ch == 0x0F97 |
+ (0x0F99 <= ch && ch <= 0x0FAD) |
+ (0x0FB1 <= ch && ch <= 0x0FB7) |
+ ch == 0x0FB9 |
+ (0x20D0 <= ch && ch <= 0x20DC) |
+ ch == 0x20E1 |
+ (0x302A <= ch && ch <= 0x302F) |
+ ch == 0x3099 |
+ ch == 0x309A )
+ return true;
+ return false;
+}
+
+
+/**
+ * (88) Digit ::=
+ */
+bool isDigit(int ch)
+{
+ if ( (0x0030 <= ch && ch <= 0x0039) |
+ (0x0660 <= ch && ch <= 0x0669) |
+ (0x06F0 <= ch && ch <= 0x06F9) |
+ (0x0966 <= ch && ch <= 0x096F) |
+ (0x09E6 <= ch && ch <= 0x09EF) |
+ (0x0A66 <= ch && ch <= 0x0A6F) |
+ (0x0AE6 <= ch && ch <= 0x0AEF) |
+ (0x0B66 <= ch && ch <= 0x0B6F) |
+ (0x0BE7 <= ch && ch <= 0x0BEF) |
+ (0x0C66 <= ch && ch <= 0x0C6F) |
+ (0x0CE6 <= ch && ch <= 0x0CEF) |
+ (0x0D66 <= ch && ch <= 0x0D6F) |
+ (0x0E50 <= ch && ch <= 0x0E59) |
+ (0x0ED0 <= ch && ch <= 0x0ED9) |
+ (0x0F20 <= ch && ch <= 0x0F29) )
+ return true;
+ return false;
+}
+
+
+/**
+ * (89) Extender ::=
+ */
+bool isExtender(int ch)
+{
+ if ( ch == 0x00B7 |
+ ch == 0x02D0 |
+ ch == 0x02D1 |
+ ch == 0x0387 |
+ ch == 0x0640 |
+ ch == 0x0E46 |
+ ch == 0x0EC6 |
+ ch == 0x3005 |
+ (0x3031 <= ch && ch <= 0x3035) |
+ (0x309D <= ch && ch <= 0x309E) |
+ (0x30FC <= ch && ch <= 0x30FE) )
+ return true;
+ return false;
+}
+
+
+
+
+
+
+/**
+ *
+ * Following are from unicode.org, in the UnicodeData file
+ * in the Unicode Database
+ */
+
+/**
+ * UNICODE general class Zs
+ */
+bool isSpaceSeparator(int ch)
+{
+ if (ch == 0x0020 ||
+ ch == 0x200A ||
+ ch == 0x2003 ||
+ ch == 0x205F ||
+ ch == 0x2005 ||
+ ch == 0x202F ||
+ ch == 0x2000 ||
+ ch == 0x180E ||
+ ch == 0x2001 ||
+ ch == 0x2004 ||
+ ch == 0x3000 ||
+ ch == 0x2008 ||
+ ch == 0x2006 ||
+ ch == 0x2002 ||
+ ch == 0x2007 ||
+ ch == 0x2009 ||
+ ch == 0x00A0 ||
+ ch == 0x1680)
+ return true;
+ return false;
+}
+
+/**
+ * UNICODE general class Zl
+ */
+bool isLineSeparator(int ch)
+{
+ if (ch == 0x2028)
+ return true;
+ return false;
+}
+
+/**
+ * UNICODE general class Zp
+ */
+bool isParagraphSeparator(int ch)
+{
+ if (ch == 0x2029)
+ return true;
+ return false;
+}
+
+/**
+ * The union of the 3 space types.
+ */
+bool isSpaceChar(int ch)
+{
+ if ( isSpaceSeparator(ch) ||
+ isLineSeparator(ch) ||
+ isParagraphSeparator(ch))
+ return true;
+ return false;
+}
+
+/**
+ * 3 spaces in isSpaceChar() which don't break
+ */
+bool isNonBreakingSpace(int ch)
+{
+ if (ch == 0x00A0 || ch == 0x2007 || ch == 0x202F)
+ return true;
+ return false;
+}
+
+/**
+ *
+ */
+bool isWhitespace(int ch)
+{
+ if (isSpaceChar(ch) && !isNonBreakingSpace(ch))
+ return true;
+ if (ch == 0x0009 || // HORIZONTAL TABULATION
+ ch == 0x000A || // LINE FEED.
+ ch == 0x000B || // VERTICAL TABULATION.
+ ch == 0x000C || // FORM FEED.
+ ch == 0x000D || // CARRIAGE RETURN.
+ ch == 0x001C || // FILE SEPARATOR.
+ ch == 0x001D || // GROUP SEPARATOR.
+ ch == 0x001E || // RECORD SEPARATOR.
+ ch == 0x001F) // UNIT SEPARATOR.
+ return true;
+ return false;
+}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/dom/charclass.h b/src/dom/charclass.h
index 8b3546ea7..1f39c7e8d 100644
--- a/src/dom/charclass.h
+++ b/src/dom/charclass.h
@@ -1,220 +1,220 @@
-#ifndef __CHARCLASS_H__
-#define __CHARCLASS_H__
-/**
- * Phoebe DOM Implementation.
- *
- * This is a C++ approximation of the W3C DOM model, which follows
- * fairly closely the specifications in the various .idl files, copies of
- * which are provided for reference. Most important is this one:
- *
- * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
- *
- * Authors:
- * Bob Jamison
- *
- * Copyright (C) 2005 Bob Jamison
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-
-/**
- * Utility classes to test characters for their class, as specified in
- * http://www.w3.org/TR/REC-xml/#CharClasses
- */
-
-/**
- * Convenience method. Not in spec
- * [impl] LetterOrDigit ::=
- * Letter | Digit
- */
-bool isLetterOrDigit(int ch);
-
-
-/**
- * [84] Letter ::=
- * BaseChar | Ideographic
- */
-bool isLetter(int ch);
-
-
-/**
- * [85] BaseChar ::=
- * [#x0041-#x005A] | [#x0061-#x007A] | [#x00C0-#x00D6] | [#x00D8-#x00F6] |
- * [#x00F8-#x00FF] | [#x0100-#x0131] | [#x0134-#x013E] | [#x0141-#x0148] |
- * [#x014A-#x017E] | [#x0180-#x01C3] | [#x01CD-#x01F0] | [#x01F4-#x01F5] |
- * [#x01FA-#x0217] | [#x0250-#x02A8] | [#x02BB-#x02C1] | #x0386 |
- * [#x0388-#x038A] | #x038C | [#x038E-#x03A1] | [#x03A3-#x03CE] |
- * [#x03D0-#x03D6] | #x03DA | #x03DC | #x03DE | #x03E0 | [#x03E2-#x03F3] |
- * [#x0401-#x040C] | [#x040E-#x044F] | [#x0451-#x045C] | [#x045E-#x0481] |
- * [#x0490-#x04C4] | [#x04C7-#x04C8] | [#x04CB-#x04CC] | [#x04D0-#x04EB] |
- * [#x04EE-#x04F5] | [#x04F8-#x04F9] | [#x0531-#x0556] | #x0559 |
- * [#x0561-#x0586] | [#x05D0-#x05EA] | [#x05F0-#x05F2] | [#x0621-#x063A] |
- * [#x0641-#x064A] | [#x0671-#x06B7] | [#x06BA-#x06BE] | [#x06C0-#x06CE] |
- * [#x06D0-#x06D3] | #x06D5 | [#x06E5-#x06E6] | [#x0905-#x0939] | #x093D |
- * [#x0958-#x0961] | [#x0985-#x098C] | [#x098F-#x0990] | [#x0993-#x09A8] |
- * [#x09AA-#x09B0] | #x09B2 | [#x09B6-#x09B9] | [#x09DC-#x09DD] |
- * [#x09DF-#x09E1] | [#x09F0-#x09F1] | [#x0A05-#x0A0A] | [#x0A0F-#x0A10] |
- * [#x0A13-#x0A28] | [#x0A2A-#x0A30] | [#x0A32-#x0A33] | [#x0A35-#x0A36] |
- * [#x0A38-#x0A39] | [#x0A59-#x0A5C] | #x0A5E | [#x0A72-#x0A74] |
- * [#x0A85-#x0A8B] | #x0A8D | [#x0A8F-#x0A91] | [#x0A93-#x0AA8] |
- * [#x0AAA-#x0AB0] | [#x0AB2-#x0AB3] | [#x0AB5-#x0AB9] | #x0ABD | #x0AE0 |
- * [#x0B05-#x0B0C] | [#x0B0F-#x0B10] | [#x0B13-#x0B28] | [#x0B2A-#x0B30] |
- * [#x0B32-#x0B33] | [#x0B36-#x0B39] | #x0B3D | [#x0B5C-#x0B5D] |
- * [#x0B5F-#x0B61] | [#x0B85-#x0B8A] | [#x0B8E-#x0B90] | [#x0B92-#x0B95] |
- * [#x0B99-#x0B9A] | #x0B9C | [#x0B9E-#x0B9F] | [#x0BA3-#x0BA4] |
- * [#x0BA8-#x0BAA] | [#x0BAE-#x0BB5] | [#x0BB7-#x0BB9] | [#x0C05-#x0C0C] |
- * [#x0C0E-#x0C10] | [#x0C12-#x0C28] | [#x0C2A-#x0C33] |
- * [#x0C35-#x0C39] | [#x0C60-#x0C61] | [#x0C85-#x0C8C] | [#x0C8E-#x0C90] |
- * [#x0C92-#x0CA8] | [#x0CAA-#x0CB3] | [#x0CB5-#x0CB9] | #x0CDE |
- * [#x0CE0-#x0CE1] | [#x0D05-#x0D0C] | [#x0D0E-#x0D10] | [#x0D12-#x0D28] |
- * [#x0D2A-#x0D39] | [#x0D60-#x0D61] | [#x0E01-#x0E2E] | #x0E30 |
- * [#x0E32-#x0E33] | [#x0E40-#x0E45] | [#x0E81-#x0E82] | #x0E84 |
- * [#x0E87-#x0E88] | #x0E8A | #x0E8D | [#x0E94-#x0E97] | [#x0E99-#x0E9F] |
- * [#x0EA1-#x0EA3] | #x0EA5 | #x0EA7 | [#x0EAA-#x0EAB] | [#x0EAD-#x0EAE] |
- * #x0EB0 | [#x0EB2-#x0EB3] | #x0EBD | [#x0EC0-#x0EC4] | [#x0F40-#x0F47] |
- * [#x0F49-#x0F69] | [#x10A0-#x10C5] | [#x10D0-#x10F6] | #x1100 |
- * [#x1102-#x1103] | [#x1105-#x1107] | #x1109 | [#x110B-#x110C] |
- * [#x110E-#x1112] | #x113C | #x113E | #x1140 | #x114C | #x114E |
- * #x1150 | [#x1154-#x1155] | #x1159 | [#x115F-#x1161] | #x1163 |
- * #x1165 | #x1167 | #x1169 | [#x116D-#x116E] | [#x1172-#x1173] | #x1175 |
- * #x119E | #x11A8 | #x11AB | [#x11AE-#x11AF] | [#x11B7-#x11B8] | #x11BA |
- * [#x11BC-#x11C2] | #x11EB | #x11F0 | #x11F9 | [#x1E00-#x1E9B] |
- * [#x1EA0-#x1EF9] | [#x1F00-#x1F15] | [#x1F18-#x1F1D] | [#x1F20-#x1F45] |
- * [#x1F48-#x1F4D] | [#x1F50-#x1F57] | #x1F59 | #x1F5B | #x1F5D |
- * [#x1F5F-#x1F7D] | [#x1F80-#x1FB4] | [#x1FB6-#x1FBC] | #x1FBE |
- * [#x1FC2-#x1FC4] | [#x1FC6-#x1FCC] | [#x1FD0-#x1FD3] | [#x1FD6-#x1FDB] |
- * [#x1FE0-#x1FEC] | [#x1FF2-#x1FF4] | [#x1FF6-#x1FFC] | #x2126 |
- * [#x212A-#x212B] | #x212E | [#x2180-#x2182] | [#x3041-#x3094] |
- * [#x30A1-#x30FA] | [#x3105-#x312C] | [#xAC00-#xD7A3]
- */
-bool isBaseChar(int ch);
-
-
-/**
- * [86] Ideographic ::=
- * [#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029]
- */
-bool isIdeographic(int ch);
-
-
-
-
-
-/**
- * [87] CombiningChar ::=
- * [#x0300-#x0345] | [#x0360-#x0361] | [#x0483-#x0486] | [#x0591-#x05A1] |
- * [#x05A3-#x05B9] | [#x05BB-#x05BD] | #x05BF | [#x05C1-#x05C2] | #x05C4 |
- * [#x064B-#x0652] | #x0670 | [#x06D6-#x06DC] | [#x06DD-#x06DF] |
- * [#x06E0-#x06E4] | [#x06E7-#x06E8] | [#x06EA-#x06ED] | [#x0901-#x0903] |
- * #x093C | [#x093E-#x094C] | #x094D | [#x0951-#x0954] |[#x0962-#x0963] |
- * [#x0981-#x0983] | #x09BC | #x09BE | #x09BF | [#x09C0-#x09C4] |
- * [#x09C7-#x09C8] | [#x09CB-#x09CD] | #x09D7 | [#x09E2-#x09E3] |
- * #x0A02 | #x0A3C | #x0A3E | #x0A3F | [#x0A40-#x0A42] | [#x0A47-#x0A48] |
- * [#x0A4B-#x0A4D] | [#x0A70-#x0A71] | [#x0A81-#x0A83] | #x0ABC |
- * [#x0ABE-#x0AC5] | [#x0AC7-#x0AC9] | [#x0ACB-#x0ACD] | [#x0B01-#x0B03] |
- * #x0B3C | [#x0B3E-#x0B43] | [#x0B47-#x0B48] | [#x0B4B-#x0B4D] |
- * [#x0B56-#x0B57] | [#x0B82-#x0B83] | [#x0BBE-#x0BC2] | [#x0BC6-#x0BC8] |
- * [#x0BCA-#x0BCD] | #x0BD7 | [#x0C01-#x0C03] | [#x0C3E-#x0C44] |
- * [#x0C46-#x0C48] | [#x0C4A-#x0C4D] | [#x0C55-#x0C56] | [#x0C82-#x0C83] |
- * [#x0CBE-#x0CC4] | [#x0CC6-#x0CC8] | [#x0CCA-#x0CCD] | [#x0CD5-#x0CD6] |
- * [#x0D02-#x0D03] | [#x0D3E-#x0D43] | [#x0D46-#x0D48] | [#x0D4A-#x0D4D] |
- * #x0D57 | #x0E31 | [#x0E34-#x0E3A] | [#x0E47-#x0E4E] | #x0EB1 |
- * [#x0EB4-#x0EB9] | [#x0EBB-#x0EBC] | [#x0EC8-#x0ECD] | [#x0F18-#x0F19] |
- * #x0F35 | #x0F37 | #x0F39 | #x0F3E | #x0F3F | [#x0F71-#x0F84] |
- * [#x0F86-#x0F8B] | [#x0F90-#x0F95] | #x0F97 | [#x0F99-#x0FAD] |
- * [#x0FB1-#x0FB7] | #x0FB9 | [#x20D0-#x20DC] | #x20E1 | [#x302A-#x302F] |
- * #x3099 | #x309A
- */
-bool isCombiningChar(int ch);
-
-
-
-/**
- * [88] Digit ::=
- * [#x0030-#x0039] | [#x0660-#x0669] | [#x06F0-#x06F9] |
- * [#x0966-#x096F] | [#x09E6-#x09EF] | [#x0A66-#x0A6F] | [#x0AE6-#x0AEF] |
- * [#x0B66-#x0B6F] | [#x0BE7-#x0BEF] | [#x0C66-#x0C6F] | [#x0CE6-#x0CEF] |
- * [#x0D66-#x0D6F] | [#x0E50-#x0E59] | [#x0ED0-#x0ED9] | [#x0F20-#x0F29]
- */
-bool isDigit(int ch);
-
-
-
-
-/**
- * [89] Extender ::=
- * #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 | #x0E46 | #x0EC6 |
- * #x3005 | [#x3031-#x3035] | [#x309D-#x309E] | [#x30FC-#x30FE]
- */
-bool isExtender(int ch);
-
-
-
-/**
- *
- * Following are from unicode.org, in the UnicodeData file
- * in the Unicode Database
- */
-
-/**
- *
- */
-bool isSpaceSeparator(int ch);
-
-/**
- *
- */
-bool isLineSeparator(int ch);
-
-/**
- *
- */
-bool isParagraphSeparator(int ch);
-
-/**
- *
- */
-bool isSpaceChar(int ch);
-
-/**
- *
- */
-bool isNonBreakingSpace(int ch);
-
-/**
- *
- */
-bool isWhitespace(int ch);
-
-#endif /* __CHARCLASS_H__ */
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+#ifndef __CHARCLASS_H__
+#define __CHARCLASS_H__
+/**
+ * Phoebe DOM Implementation.
+ *
+ * This is a C++ approximation of the W3C DOM model, which follows
+ * fairly closely the specifications in the various .idl files, copies of
+ * which are provided for reference. Most important is this one:
+ *
+ * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
+ *
+ * Authors:
+ * Bob Jamison
+ *
+ * Copyright (C) 2005 Bob Jamison
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+
+/**
+ * Utility classes to test characters for their class, as specified in
+ * http://www.w3.org/TR/REC-xml/#CharClasses
+ */
+
+/**
+ * Convenience method. Not in spec
+ * [impl] LetterOrDigit ::=
+ * Letter | Digit
+ */
+bool isLetterOrDigit(int ch);
+
+
+/**
+ * [84] Letter ::=
+ * BaseChar | Ideographic
+ */
+bool isLetter(int ch);
+
+
+/**
+ * [85] BaseChar ::=
+ * [#x0041-#x005A] | [#x0061-#x007A] | [#x00C0-#x00D6] | [#x00D8-#x00F6] |
+ * [#x00F8-#x00FF] | [#x0100-#x0131] | [#x0134-#x013E] | [#x0141-#x0148] |
+ * [#x014A-#x017E] | [#x0180-#x01C3] | [#x01CD-#x01F0] | [#x01F4-#x01F5] |
+ * [#x01FA-#x0217] | [#x0250-#x02A8] | [#x02BB-#x02C1] | #x0386 |
+ * [#x0388-#x038A] | #x038C | [#x038E-#x03A1] | [#x03A3-#x03CE] |
+ * [#x03D0-#x03D6] | #x03DA | #x03DC | #x03DE | #x03E0 | [#x03E2-#x03F3] |
+ * [#x0401-#x040C] | [#x040E-#x044F] | [#x0451-#x045C] | [#x045E-#x0481] |
+ * [#x0490-#x04C4] | [#x04C7-#x04C8] | [#x04CB-#x04CC] | [#x04D0-#x04EB] |
+ * [#x04EE-#x04F5] | [#x04F8-#x04F9] | [#x0531-#x0556] | #x0559 |
+ * [#x0561-#x0586] | [#x05D0-#x05EA] | [#x05F0-#x05F2] | [#x0621-#x063A] |
+ * [#x0641-#x064A] | [#x0671-#x06B7] | [#x06BA-#x06BE] | [#x06C0-#x06CE] |
+ * [#x06D0-#x06D3] | #x06D5 | [#x06E5-#x06E6] | [#x0905-#x0939] | #x093D |
+ * [#x0958-#x0961] | [#x0985-#x098C] | [#x098F-#x0990] | [#x0993-#x09A8] |
+ * [#x09AA-#x09B0] | #x09B2 | [#x09B6-#x09B9] | [#x09DC-#x09DD] |
+ * [#x09DF-#x09E1] | [#x09F0-#x09F1] | [#x0A05-#x0A0A] | [#x0A0F-#x0A10] |
+ * [#x0A13-#x0A28] | [#x0A2A-#x0A30] | [#x0A32-#x0A33] | [#x0A35-#x0A36] |
+ * [#x0A38-#x0A39] | [#x0A59-#x0A5C] | #x0A5E | [#x0A72-#x0A74] |
+ * [#x0A85-#x0A8B] | #x0A8D | [#x0A8F-#x0A91] | [#x0A93-#x0AA8] |
+ * [#x0AAA-#x0AB0] | [#x0AB2-#x0AB3] | [#x0AB5-#x0AB9] | #x0ABD | #x0AE0 |
+ * [#x0B05-#x0B0C] | [#x0B0F-#x0B10] | [#x0B13-#x0B28] | [#x0B2A-#x0B30] |
+ * [#x0B32-#x0B33] | [#x0B36-#x0B39] | #x0B3D | [#x0B5C-#x0B5D] |
+ * [#x0B5F-#x0B61] | [#x0B85-#x0B8A] | [#x0B8E-#x0B90] | [#x0B92-#x0B95] |
+ * [#x0B99-#x0B9A] | #x0B9C | [#x0B9E-#x0B9F] | [#x0BA3-#x0BA4] |
+ * [#x0BA8-#x0BAA] | [#x0BAE-#x0BB5] | [#x0BB7-#x0BB9] | [#x0C05-#x0C0C] |
+ * [#x0C0E-#x0C10] | [#x0C12-#x0C28] | [#x0C2A-#x0C33] |
+ * [#x0C35-#x0C39] | [#x0C60-#x0C61] | [#x0C85-#x0C8C] | [#x0C8E-#x0C90] |
+ * [#x0C92-#x0CA8] | [#x0CAA-#x0CB3] | [#x0CB5-#x0CB9] | #x0CDE |
+ * [#x0CE0-#x0CE1] | [#x0D05-#x0D0C] | [#x0D0E-#x0D10] | [#x0D12-#x0D28] |
+ * [#x0D2A-#x0D39] | [#x0D60-#x0D61] | [#x0E01-#x0E2E] | #x0E30 |
+ * [#x0E32-#x0E33] | [#x0E40-#x0E45] | [#x0E81-#x0E82] | #x0E84 |
+ * [#x0E87-#x0E88] | #x0E8A | #x0E8D | [#x0E94-#x0E97] | [#x0E99-#x0E9F] |
+ * [#x0EA1-#x0EA3] | #x0EA5 | #x0EA7 | [#x0EAA-#x0EAB] | [#x0EAD-#x0EAE] |
+ * #x0EB0 | [#x0EB2-#x0EB3] | #x0EBD | [#x0EC0-#x0EC4] | [#x0F40-#x0F47] |
+ * [#x0F49-#x0F69] | [#x10A0-#x10C5] | [#x10D0-#x10F6] | #x1100 |
+ * [#x1102-#x1103] | [#x1105-#x1107] | #x1109 | [#x110B-#x110C] |
+ * [#x110E-#x1112] | #x113C | #x113E | #x1140 | #x114C | #x114E |
+ * #x1150 | [#x1154-#x1155] | #x1159 | [#x115F-#x1161] | #x1163 |
+ * #x1165 | #x1167 | #x1169 | [#x116D-#x116E] | [#x1172-#x1173] | #x1175 |
+ * #x119E | #x11A8 | #x11AB | [#x11AE-#x11AF] | [#x11B7-#x11B8] | #x11BA |
+ * [#x11BC-#x11C2] | #x11EB | #x11F0 | #x11F9 | [#x1E00-#x1E9B] |
+ * [#x1EA0-#x1EF9] | [#x1F00-#x1F15] | [#x1F18-#x1F1D] | [#x1F20-#x1F45] |
+ * [#x1F48-#x1F4D] | [#x1F50-#x1F57] | #x1F59 | #x1F5B | #x1F5D |
+ * [#x1F5F-#x1F7D] | [#x1F80-#x1FB4] | [#x1FB6-#x1FBC] | #x1FBE |
+ * [#x1FC2-#x1FC4] | [#x1FC6-#x1FCC] | [#x1FD0-#x1FD3] | [#x1FD6-#x1FDB] |
+ * [#x1FE0-#x1FEC] | [#x1FF2-#x1FF4] | [#x1FF6-#x1FFC] | #x2126 |
+ * [#x212A-#x212B] | #x212E | [#x2180-#x2182] | [#x3041-#x3094] |
+ * [#x30A1-#x30FA] | [#x3105-#x312C] | [#xAC00-#xD7A3]
+ */
+bool isBaseChar(int ch);
+
+
+/**
+ * [86] Ideographic ::=
+ * [#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029]
+ */
+bool isIdeographic(int ch);
+
+
+
+
+
+/**
+ * [87] CombiningChar ::=
+ * [#x0300-#x0345] | [#x0360-#x0361] | [#x0483-#x0486] | [#x0591-#x05A1] |
+ * [#x05A3-#x05B9] | [#x05BB-#x05BD] | #x05BF | [#x05C1-#x05C2] | #x05C4 |
+ * [#x064B-#x0652] | #x0670 | [#x06D6-#x06DC] | [#x06DD-#x06DF] |
+ * [#x06E0-#x06E4] | [#x06E7-#x06E8] | [#x06EA-#x06ED] | [#x0901-#x0903] |
+ * #x093C | [#x093E-#x094C] | #x094D | [#x0951-#x0954] |[#x0962-#x0963] |
+ * [#x0981-#x0983] | #x09BC | #x09BE | #x09BF | [#x09C0-#x09C4] |
+ * [#x09C7-#x09C8] | [#x09CB-#x09CD] | #x09D7 | [#x09E2-#x09E3] |
+ * #x0A02 | #x0A3C | #x0A3E | #x0A3F | [#x0A40-#x0A42] | [#x0A47-#x0A48] |
+ * [#x0A4B-#x0A4D] | [#x0A70-#x0A71] | [#x0A81-#x0A83] | #x0ABC |
+ * [#x0ABE-#x0AC5] | [#x0AC7-#x0AC9] | [#x0ACB-#x0ACD] | [#x0B01-#x0B03] |
+ * #x0B3C | [#x0B3E-#x0B43] | [#x0B47-#x0B48] | [#x0B4B-#x0B4D] |
+ * [#x0B56-#x0B57] | [#x0B82-#x0B83] | [#x0BBE-#x0BC2] | [#x0BC6-#x0BC8] |
+ * [#x0BCA-#x0BCD] | #x0BD7 | [#x0C01-#x0C03] | [#x0C3E-#x0C44] |
+ * [#x0C46-#x0C48] | [#x0C4A-#x0C4D] | [#x0C55-#x0C56] | [#x0C82-#x0C83] |
+ * [#x0CBE-#x0CC4] | [#x0CC6-#x0CC8] | [#x0CCA-#x0CCD] | [#x0CD5-#x0CD6] |
+ * [#x0D02-#x0D03] | [#x0D3E-#x0D43] | [#x0D46-#x0D48] | [#x0D4A-#x0D4D] |
+ * #x0D57 | #x0E31 | [#x0E34-#x0E3A] | [#x0E47-#x0E4E] | #x0EB1 |
+ * [#x0EB4-#x0EB9] | [#x0EBB-#x0EBC] | [#x0EC8-#x0ECD] | [#x0F18-#x0F19] |
+ * #x0F35 | #x0F37 | #x0F39 | #x0F3E | #x0F3F | [#x0F71-#x0F84] |
+ * [#x0F86-#x0F8B] | [#x0F90-#x0F95] | #x0F97 | [#x0F99-#x0FAD] |
+ * [#x0FB1-#x0FB7] | #x0FB9 | [#x20D0-#x20DC] | #x20E1 | [#x302A-#x302F] |
+ * #x3099 | #x309A
+ */
+bool isCombiningChar(int ch);
+
+
+
+/**
+ * [88] Digit ::=
+ * [#x0030-#x0039] | [#x0660-#x0669] | [#x06F0-#x06F9] |
+ * [#x0966-#x096F] | [#x09E6-#x09EF] | [#x0A66-#x0A6F] | [#x0AE6-#x0AEF] |
+ * [#x0B66-#x0B6F] | [#x0BE7-#x0BEF] | [#x0C66-#x0C6F] | [#x0CE6-#x0CEF] |
+ * [#x0D66-#x0D6F] | [#x0E50-#x0E59] | [#x0ED0-#x0ED9] | [#x0F20-#x0F29]
+ */
+bool isDigit(int ch);
+
+
+
+
+/**
+ * [89] Extender ::=
+ * #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 | #x0E46 | #x0EC6 |
+ * #x3005 | [#x3031-#x3035] | [#x309D-#x309E] | [#x30FC-#x30FE]
+ */
+bool isExtender(int ch);
+
+
+
+/**
+ *
+ * Following are from unicode.org, in the UnicodeData file
+ * in the Unicode Database
+ */
+
+/**
+ *
+ */
+bool isSpaceSeparator(int ch);
+
+/**
+ *
+ */
+bool isLineSeparator(int ch);
+
+/**
+ *
+ */
+bool isParagraphSeparator(int ch);
+
+/**
+ *
+ */
+bool isSpaceChar(int ch);
+
+/**
+ *
+ */
+bool isNonBreakingSpace(int ch);
+
+/**
+ *
+ */
+bool isWhitespace(int ch);
+
+#endif /* __CHARCLASS_H__ */
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/dom/domconfig.h b/src/dom/domconfig.h
index ec9e76b31..41dce7a10 100644
--- a/src/dom/domconfig.h
+++ b/src/dom/domconfig.h
@@ -1,52 +1,52 @@
-#ifndef __DOMCONFIG_H__
-#define __DOMCONFIG_H__
-/**
- * Phoebe DOM Implementation.
- *
- * This is a C++ approximation of the W3C DOM model, which follows
- * fairly closely the specifications in the various .idl files, copies of
- * which are provided for reference. Most important is this one:
- *
- * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
- *
- * Authors:
- * Bob Jamison
- *
- * Copyright (C) 2006 Bob Jamison
- *
- * rwjj@earthlink.net
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * What kind of implementation of DOMString and XMLCh do we want?
- * Define one of the two below for either our own implementation,
- * or GlibMM's Glib::ustring. If neither one is defined, then DOMString
- * is defined as stdc++'s std::string.
- */
-#define DOM_STRING_GLIBMM
-//#define DOM_STRING_OWN
-
-
-
-
-
-#endif /* __DOMCONFIG_H__ */
-/*#########################################################################
-## E N D O F F I L E
-#########################################################################*/
-
-
+#ifndef __DOMCONFIG_H__
+#define __DOMCONFIG_H__
+/**
+ * Phoebe DOM Implementation.
+ *
+ * This is a C++ approximation of the W3C DOM model, which follows
+ * fairly closely the specifications in the various .idl files, copies of
+ * which are provided for reference. Most important is this one:
+ *
+ * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
+ *
+ * Authors:
+ * Bob Jamison
+ *
+ * Copyright (C) 2006 Bob Jamison
+ *
+ * rwjj@earthlink.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * What kind of implementation of DOMString and XMLCh do we want?
+ * Define one of the two below for either our own implementation,
+ * or GlibMM's Glib::ustring. If neither one is defined, then DOMString
+ * is defined as stdc++'s std::string.
+ */
+#define DOM_STRING_GLIBMM
+//#define DOM_STRING_OWN
+
+
+
+
+
+#endif /* __DOMCONFIG_H__ */
+/*#########################################################################
+## E N D O F F I L E
+#########################################################################*/
+
+
diff --git a/src/dom/io/base64stream.cpp b/src/dom/io/base64stream.cpp
index 42df842c4..f71532e8b 100644
--- a/src/dom/io/base64stream.cpp
+++ b/src/dom/io/base64stream.cpp
@@ -1,339 +1,339 @@
-/**
- * Phoebe DOM Implementation.
- *
- * Base64-enabled input and output streams
- *
- * This class allows easy encoding and decoding
- * of Base64 data with a stream interface, hiding
- * the implementation from the user.
- *
- * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
- *
- * Authors:
- * Bob Jamison
- *
- * Copyright (C) 2006 Bob Jamison
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-
-#include "base64stream.h"
-
-
-namespace org
-{
-namespace w3c
-{
-namespace dom
-{
-namespace io
-{
-
-
-//#########################################################################
-//# B A S E 6 4 I N P U T S T R E A M
-//#########################################################################
-
-static int base64decode[] =
-{
-/*00*/ -1, -1, -1, -1, -1, -1, -1, -1,
-/*08*/ -1, -1, -1, -1, -1, -1, -1, -1,
-/*10*/ -1, -1, -1, -1, -1, -1, -1, -1,
-/*18*/ -1, -1, -1, -1, -1, -1, -1, -1,
-/*20*/ -1, -1, -1, -1, -1, -1, -1, -1,
-/*28*/ -1, -1, -1, 62, -1, -1, -1, 63,
-/*30*/ 52, 53, 54, 55, 56, 57, 58, 59,
-/*38*/ 60, 61, -1, -1, -1, -1, -1, -1,
-/*40*/ -1, 0, 1, 2, 3, 4, 5, 6,
-/*48*/ 7, 8, 9, 10, 11, 12, 13, 14,
-/*50*/ 15, 16, 17, 18, 19, 20, 21, 22,
-/*58*/ 23, 24, 25, -1, -1, -1, -1, -1,
-/*60*/ -1, 26, 27, 28, 29, 30, 31, 32,
-/*68*/ 33, 34, 35, 36, 37, 38, 39, 40,
-/*70*/ 41, 42, 43, 44, 45, 46, 47, 48,
-/*78*/ 49, 50, 51, -1, -1, -1, -1, -1
-};
-
-
-/**
- *
- */
-Base64InputStream::Base64InputStream(InputStream &sourceStream)
- : BasicInputStream(sourceStream)
-{
- outCount = 0;
- padCount = 0;
- closed = false;
- done = false;
-}
-
-/**
- *
- */
-Base64InputStream::~Base64InputStream()
-{
- close();
-}
-
-/**
- * Returns the number of bytes that can be read (or skipped over) from
- * this input stream without blocking by the next caller of a method for
- * this input stream.
- */
-int Base64InputStream::available()
-{
- if (closed )
- return 0;
- int len = source.available() * 2 / 3;
- return len;
-}
-
-
-/**
- * Closes this input stream and releases any system resources
- * associated with the stream.
- */
-void Base64InputStream::close()
-{
- if (closed)
- return;
- source.close();
- closed = true;
-}
-
-/**
- * Reads the next byte of data from the input stream. -1 if EOF
- */
-int Base64InputStream::get()
-{
- if (closed)
- return -1;
-
- if (outCount - padCount > 0)
- {
- return outBytes[3-(outCount--)];
- }
-
- if (done)
- return -1;
-
- int inBytes[4];
- int inCount = 0;
- while (inCount < 4)
- {
- int ch = source.get();
- if (ch < 0)
- {
- while (inCount < 4) //pad if needed
- {
- inBytes[inCount++] = 0;
- padCount++;
- }
- done = true;
- break;
- }
- if (isspace(ch)) //ascii whitespace
- {
- //nothing
- }
- else if (ch == '=') //padding
- {
- inBytes[inCount++] = 0;
- padCount++;
- }
- else
- {
- int byteVal = base64decode[ch & 0x7f];
- //printf("char:%c %d\n", ch, byteVal);
- if (byteVal < 0)
- {
- //Bad lookup value
- }
- inBytes[inCount++] = byteVal;
- }
- }
-
- outBytes[0] = ((inBytes[0]<<2) & 0xfc) | ((inBytes[1]>>4) & 0x03);
- outBytes[1] = ((inBytes[1]<<4) & 0xf0) | ((inBytes[2]>>2) & 0x0f);
- outBytes[2] = ((inBytes[2]<<6) & 0xc0) | ((inBytes[3] ) & 0x3f);
-
- outCount = 3;
-
- //try again
- if (outCount - padCount > 0)
- {
- return outBytes[3-(outCount--)];
- }
-
- return -1;
-
-}
-
-
-//#########################################################################
-//# B A S E 6 4 O U T P U T S T R E A M
-//#########################################################################
-
-static char *base64encode =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
-/**
- *
- */
-Base64OutputStream::Base64OutputStream(OutputStream &destinationStream)
- : BasicOutputStream(destinationStream)
-{
- column = 0;
- columnWidth = 72;
- outBuf = 0L;
- bitCount = 0;
-}
-
-/**
- *
- */
-Base64OutputStream::~Base64OutputStream()
-{
- close();
-}
-
-/**
- * Closes this output stream and releases any system resources
- * associated with this stream.
- */
-void Base64OutputStream::close()
-{
- if (closed)
- return;
-
- //get any last bytes (1 or 2) out of the buffer
- if (bitCount == 16)
- {
- outBuf <<= 2; //pad to make 18 bits
-
- int indx = (int)((outBuf & 0x0003f000L) >> 12);
- int obyte = (int)base64encode[indx & 63];
- putCh(obyte);
-
- indx = (int)((outBuf & 0x00000fc0L) >> 6);
- obyte = (int)base64encode[indx & 63];
- putCh(obyte);
-
- indx = (int)((outBuf & 0x0000003fL) );
- obyte = (int)base64encode[indx & 63];
- putCh(obyte);
-
- putCh('=');
- }
- else if (bitCount == 8)
- {
- outBuf <<= 4; //pad to make 12 bits
-
- int indx = (int)((outBuf & 0x00000fc0L) >> 6);
- int obyte = (int)base64encode[indx & 63];
- putCh(obyte);
-
- indx = (int)((outBuf & 0x0000003fL) );
- obyte = (int)base64encode[indx & 63];
- putCh(obyte);
-
- putCh('=');
- putCh('=');
- }
-
- if (columnWidth > 0) //if <=0, no newlines
- destination.put('\n');
-
- destination.close();
- closed = true;
-}
-
-/**
- * Flushes this output stream and forces any buffered output
- * bytes to be written out.
- */
-void Base64OutputStream::flush()
-{
- if (closed)
- return;
- //dont flush here. do it on close()
- destination.flush();
-}
-
-/**
- * Private. Put a char to the output stream, checking for line length
- */
-void Base64OutputStream::putCh(int ch)
-{
- destination.put(ch);
- column++;
- if (columnWidth > 0 && column >= columnWidth)
- {
- destination.put('\n');
- column = 0;
- }
-}
-
-
-/**
- * Writes the specified byte to this output stream.
- */
-void Base64OutputStream::put(XMLCh ch)
-{
- if (closed)
- {
- //probably throw an exception here
- return;
- }
-
- outBuf <<= 8;
- outBuf |= (ch & 0xff);
- bitCount += 8;
- if (bitCount >= 24)
- {
- int indx = (int)((outBuf & 0x00fc0000L) >> 18);
- int obyte = (int)base64encode[indx & 63];
- putCh(obyte);
-
- indx = (int)((outBuf & 0x0003f000L) >> 12);
- obyte = (int)base64encode[indx & 63];
- putCh(obyte);
-
- indx = (int)((outBuf & 0x00000fc0L) >> 6);
- obyte = (int)base64encode[indx & 63];
- putCh(obyte);
-
- indx = (int)((outBuf & 0x0000003fL) );
- obyte = (int)base64encode[indx & 63];
- putCh(obyte);
-
- bitCount = 0;
- outBuf = 0L;
- }
-}
-
-
-
-} //namespace io
-} //namespace dom
-} //namespace w3c
-} //namespace org
-
-
-//#########################################################################
-//# E N D O F F I L E
-//#########################################################################
+/**
+ * Phoebe DOM Implementation.
+ *
+ * Base64-enabled input and output streams
+ *
+ * This class allows easy encoding and decoding
+ * of Base64 data with a stream interface, hiding
+ * the implementation from the user.
+ *
+ * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
+ *
+ * Authors:
+ * Bob Jamison
+ *
+ * Copyright (C) 2006 Bob Jamison
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+
+#include "base64stream.h"
+
+
+namespace org
+{
+namespace w3c
+{
+namespace dom
+{
+namespace io
+{
+
+
+//#########################################################################
+//# B A S E 6 4 I N P U T S T R E A M
+//#########################################################################
+
+static int base64decode[] =
+{
+/*00*/ -1, -1, -1, -1, -1, -1, -1, -1,
+/*08*/ -1, -1, -1, -1, -1, -1, -1, -1,
+/*10*/ -1, -1, -1, -1, -1, -1, -1, -1,
+/*18*/ -1, -1, -1, -1, -1, -1, -1, -1,
+/*20*/ -1, -1, -1, -1, -1, -1, -1, -1,
+/*28*/ -1, -1, -1, 62, -1, -1, -1, 63,
+/*30*/ 52, 53, 54, 55, 56, 57, 58, 59,
+/*38*/ 60, 61, -1, -1, -1, -1, -1, -1,
+/*40*/ -1, 0, 1, 2, 3, 4, 5, 6,
+/*48*/ 7, 8, 9, 10, 11, 12, 13, 14,
+/*50*/ 15, 16, 17, 18, 19, 20, 21, 22,
+/*58*/ 23, 24, 25, -1, -1, -1, -1, -1,
+/*60*/ -1, 26, 27, 28, 29, 30, 31, 32,
+/*68*/ 33, 34, 35, 36, 37, 38, 39, 40,
+/*70*/ 41, 42, 43, 44, 45, 46, 47, 48,
+/*78*/ 49, 50, 51, -1, -1, -1, -1, -1
+};
+
+
+/**
+ *
+ */
+Base64InputStream::Base64InputStream(InputStream &sourceStream)
+ : BasicInputStream(sourceStream)
+{
+ outCount = 0;
+ padCount = 0;
+ closed = false;
+ done = false;
+}
+
+/**
+ *
+ */
+Base64InputStream::~Base64InputStream()
+{
+ close();
+}
+
+/**
+ * Returns the number of bytes that can be read (or skipped over) from
+ * this input stream without blocking by the next caller of a method for
+ * this input stream.
+ */
+int Base64InputStream::available()
+{
+ if (closed )
+ return 0;
+ int len = source.available() * 2 / 3;
+ return len;
+}
+
+
+/**
+ * Closes this input stream and releases any system resources
+ * associated with the stream.
+ */
+void Base64InputStream::close()
+{
+ if (closed)
+ return;
+ source.close();
+ closed = true;
+}
+
+/**
+ * Reads the next byte of data from the input stream. -1 if EOF
+ */
+int Base64InputStream::get()
+{
+ if (closed)
+ return -1;
+
+ if (outCount - padCount > 0)
+ {
+ return outBytes[3-(outCount--)];
+ }
+
+ if (done)
+ return -1;
+
+ int inBytes[4];
+ int inCount = 0;
+ while (inCount < 4)
+ {
+ int ch = source.get();
+ if (ch < 0)
+ {
+ while (inCount < 4) //pad if needed
+ {
+ inBytes[inCount++] = 0;
+ padCount++;
+ }
+ done = true;
+ break;
+ }
+ if (isspace(ch)) //ascii whitespace
+ {
+ //nothing
+ }
+ else if (ch == '=') //padding
+ {
+ inBytes[inCount++] = 0;
+ padCount++;
+ }
+ else
+ {
+ int byteVal = base64decode[ch & 0x7f];
+ //printf("char:%c %d\n", ch, byteVal);
+ if (byteVal < 0)
+ {
+ //Bad lookup value
+ }
+ inBytes[inCount++] = byteVal;
+ }
+ }
+
+ outBytes[0] = ((inBytes[0]<<2) & 0xfc) | ((inBytes[1]>>4) & 0x03);
+ outBytes[1] = ((inBytes[1]<<4) & 0xf0) | ((inBytes[2]>>2) & 0x0f);
+ outBytes[2] = ((inBytes[2]<<6) & 0xc0) | ((inBytes[3] ) & 0x3f);
+
+ outCount = 3;
+
+ //try again
+ if (outCount - padCount > 0)
+ {
+ return outBytes[3-(outCount--)];
+ }
+
+ return -1;
+
+}
+
+
+//#########################################################################
+//# B A S E 6 4 O U T P U T S T R E A M
+//#########################################################################
+
+static char *base64encode =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+/**
+ *
+ */
+Base64OutputStream::Base64OutputStream(OutputStream &destinationStream)
+ : BasicOutputStream(destinationStream)
+{
+ column = 0;
+ columnWidth = 72;
+ outBuf = 0L;
+ bitCount = 0;
+}
+
+/**
+ *
+ */
+Base64OutputStream::~Base64OutputStream()
+{
+ close();
+}
+
+/**
+ * Closes this output stream and releases any system resources
+ * associated with this stream.
+ */
+void Base64OutputStream::close()
+{
+ if (closed)
+ return;
+
+ //get any last bytes (1 or 2) out of the buffer
+ if (bitCount == 16)
+ {
+ outBuf <<= 2; //pad to make 18 bits
+
+ int indx = (int)((outBuf & 0x0003f000L) >> 12);
+ int obyte = (int)base64encode[indx & 63];
+ putCh(obyte);
+
+ indx = (int)((outBuf & 0x00000fc0L) >> 6);
+ obyte = (int)base64encode[indx & 63];
+ putCh(obyte);
+
+ indx = (int)((outBuf & 0x0000003fL) );
+ obyte = (int)base64encode[indx & 63];
+ putCh(obyte);
+
+ putCh('=');
+ }
+ else if (bitCount == 8)
+ {
+ outBuf <<= 4; //pad to make 12 bits
+
+ int indx = (int)((outBuf & 0x00000fc0L) >> 6);
+ int obyte = (int)base64encode[indx & 63];
+ putCh(obyte);
+
+ indx = (int)((outBuf & 0x0000003fL) );
+ obyte = (int)base64encode[indx & 63];
+ putCh(obyte);
+
+ putCh('=');
+ putCh('=');
+ }
+
+ if (columnWidth > 0) //if <=0, no newlines
+ destination.put('\n');
+
+ destination.close();
+ closed = true;
+}
+
+/**
+ * Flushes this output stream and forces any buffered output
+ * bytes to be written out.
+ */
+void Base64OutputStream::flush()
+{
+ if (closed)
+ return;
+ //dont flush here. do it on close()
+ destination.flush();
+}
+
+/**
+ * Private. Put a char to the output stream, checking for line length
+ */
+void Base64OutputStream::putCh(int ch)
+{
+ destination.put(ch);
+ column++;
+ if (columnWidth > 0 && column >= columnWidth)
+ {
+ destination.put('\n');
+ column = 0;
+ }
+}
+
+
+/**
+ * Writes the specified byte to this output stream.
+ */
+void Base64OutputStream::put(XMLCh ch)
+{
+ if (closed)
+ {
+ //probably throw an exception here
+ return;
+ }
+
+ outBuf <<= 8;
+ outBuf |= (ch & 0xff);
+ bitCount += 8;
+ if (bitCount >= 24)
+ {
+ int indx = (int)((outBuf & 0x00fc0000L) >> 18);
+ int obyte = (int)base64encode[indx & 63];
+ putCh(obyte);
+
+ indx = (int)((outBuf & 0x0003f000L) >> 12);
+ obyte = (int)base64encode[indx & 63];
+ putCh(obyte);
+
+ indx = (int)((outBuf & 0x00000fc0L) >> 6);
+ obyte = (int)base64encode[indx & 63];
+ putCh(obyte);
+
+ indx = (int)((outBuf & 0x0000003fL) );
+ obyte = (int)base64encode[indx & 63];
+ putCh(obyte);
+
+ bitCount = 0;
+ outBuf = 0L;
+ }
+}
+
+
+
+} //namespace io
+} //namespace dom
+} //namespace w3c
+} //namespace org
+
+
+//#########################################################################
+//# E N D O F F I L E
+//#########################################################################
diff --git a/src/dom/io/base64stream.h b/src/dom/io/base64stream.h
index ed5159b3c..23ec1ce07 100644
--- a/src/dom/io/base64stream.h
+++ b/src/dom/io/base64stream.h
@@ -1,146 +1,146 @@
-#ifndef __DOM_IO_BASE64STREAM_H__
-#define __DOM_IO_BASE64STREAM_H__
-
-/**
- * Phoebe DOM Implementation.
- *
- * Base64-enabled input and output streams
- *
- * This class allows easy encoding and decoding
- * of Base64 data with a stream interface, hiding
- * the implementation from the user.
- *
- * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
- *
- * Authors:
- * Bob Jamison
- *
- * Copyright (C) 2006 Bob Jamison
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-
-#include "domstream.h"
-
-
-namespace org
-{
-namespace w3c
-{
-namespace dom
-{
-namespace io
-{
-
-
-
-//#########################################################################
-//# B A S E 6 4 I N P U T S T R E A M
-//#########################################################################
-
-/**
- * This class is for decoding a Base-64 encoded InputStream source
- *
- */
-class Base64InputStream : public BasicInputStream
-{
-
-public:
-
- Base64InputStream(InputStream &sourceStream);
-
- virtual ~Base64InputStream();
-
- virtual int available();
-
- virtual void close();
-
- virtual int get();
-
-private:
-
- int outBytes[3];
-
- int outCount;
-
- int padCount;
-
- bool done;
-
-}; // class Base64InputStream
-
-
-
-
-//#########################################################################
-//# B A S E 6 4 O U T P U T S T R E A M
-//#########################################################################
-
-/**
- * This class is for Base-64 encoding data going to the
- * destination OutputStream
- *
- */
-class Base64OutputStream : public BasicOutputStream
-{
-
-public:
-
- Base64OutputStream(OutputStream &destinationStream);
-
- virtual ~Base64OutputStream();
-
- virtual void close();
-
- virtual void flush();
-
- virtual void put(XMLCh ch);
-
- /**
- * Sets the maximum line length for base64 output. If
- * set to <=0, then there will be no line breaks;
- */
- virtual void setColumnWidth(int val)
- { columnWidth = val; }
-
-private:
-
- void putCh(int ch);
-
- int column;
-
- int columnWidth;
-
- unsigned long outBuf;
-
- int bitCount;
-
-}; // class Base64OutputStream
-
-
-
-
-
-
-
-} //namespace io
-} //namespace dom
-} //namespace w3c
-} //namespace org
-
-
-#endif /* __INKSCAPE_IO_BASE64STREAM_H__ */
+#ifndef __DOM_IO_BASE64STREAM_H__
+#define __DOM_IO_BASE64STREAM_H__
+
+/**
+ * Phoebe DOM Implementation.
+ *
+ * Base64-enabled input and output streams
+ *
+ * This class allows easy encoding and decoding
+ * of Base64 data with a stream interface, hiding
+ * the implementation from the user.
+ *
+ * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
+ *
+ * Authors:
+ * Bob Jamison
+ *
+ * Copyright (C) 2006 Bob Jamison
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+
+#include "domstream.h"
+
+
+namespace org
+{
+namespace w3c
+{
+namespace dom
+{
+namespace io
+{
+
+
+
+//#########################################################################
+//# B A S E 6 4 I N P U T S T R E A M
+//#########################################################################
+
+/**
+ * This class is for decoding a Base-64 encoded InputStream source
+ *
+ */
+class Base64InputStream : public BasicInputStream
+{
+
+public:
+
+ Base64InputStream(InputStream &sourceStream);
+
+ virtual ~Base64InputStream();
+
+ virtual int available();
+
+ virtual void close();
+
+ virtual int get();
+
+private:
+
+ int outBytes[3];
+
+ int outCount;
+
+ int padCount;
+
+ bool done;
+
+}; // class Base64InputStream
+
+
+
+
+//#########################################################################
+//# B A S E 6 4 O U T P U T S T R E A M
+//#########################################################################
+
+/**
+ * This class is for Base-64 encoding data going to the
+ * destination OutputStream
+ *
+ */
+class Base64OutputStream : public BasicOutputStream
+{
+
+public:
+
+ Base64OutputStream(OutputStream &destinationStream);
+
+ virtual ~Base64OutputStream();
+
+ virtual void close();
+
+ virtual void flush();
+
+ virtual void put(XMLCh ch);
+
+ /**
+ * Sets the maximum line length for base64 output. If
+ * set to <=0, then there will be no line breaks;
+ */
+ virtual void setColumnWidth(int val)
+ { columnWidth = val; }
+
+private:
+
+ void putCh(int ch);
+
+ int column;
+
+ int columnWidth;
+
+ unsigned long outBuf;
+
+ int bitCount;
+
+}; // class Base64OutputStream
+
+
+
+
+
+
+
+} //namespace io
+} //namespace dom
+} //namespace w3c
+} //namespace org
+
+
+#endif /* __INKSCAPE_IO_BASE64STREAM_H__ */
diff --git a/src/dom/io/gzipstream.cpp b/src/dom/io/gzipstream.cpp
index 510101553..19369b6dc 100644
--- a/src/dom/io/gzipstream.cpp
+++ b/src/dom/io/gzipstream.cpp
@@ -1,245 +1,245 @@
-/**
- * Zlib-enabled input and output streams
- *
- * This is a thin wrapper of libz calls, in order
- * to provide a simple interface to our developers
- * for gzip input and output.
- *
- * Authors:
- * Bob Jamison
- *
- * Copyright (C) 2006 Bob Jamison
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-
-#include "gzipstream.h"
-
-#include "dom/util/ziptool.h"
-
-
-namespace org
-{
-namespace w3c
-{
-namespace dom
-{
-namespace io
-{
-
-
-//#########################################################################
-//# G Z I P I N P U T S T R E A M
-//#########################################################################
-
-/**
- *
- */
-GzipInputStream::GzipInputStream(InputStream &sourceStream)
- : BasicInputStream(sourceStream)
-{
- loaded = false;
- bufPos = 0;
-}
-
-/**
- *
- */
-GzipInputStream::~GzipInputStream()
-{
- close();
-}
-
-/**
- * Returns the number of bytes that can be read (or skipped over) from
- * this input stream without blocking by the next caller of a method for
- * this input stream.
- */
-int GzipInputStream::available()
-{
- if (closed)
- return 0;
- if (!loaded)
- if (!load())
- return 0;
- return (int) buffer.size();
-}
-
-
-/**
- * Closes this input stream and releases any system resources
- * associated with the stream.
- */
-void GzipInputStream::close()
-{
- if (closed)
- return;
-
- closed = true;
-}
-
-/**
- * Reads the next byte of data from the input stream. -1 if EOF
- */
-int GzipInputStream::get()
-{
- if (closed)
- return -1;
-
- if (!loaded)
- if (!load())
- return -1;
-
- if (bufPos >= buffer.size())
- return -1;
- int ch = (int) buffer[bufPos++];
-
- return ch;
-}
-
-/**
- * Processes input. Fills read buffer.
- */
-bool GzipInputStream::load()
-{
- if (closed)
- return false;
-
- if (loaded)
- return true;
-
- std::vector<unsigned char> compBuf;
- while (true)
- {
- int ch = source.get();
- if (ch < 0)
- break;
- compBuf.push_back(ch);
- }
- GzipFile gz;
- if (!gz.readBuffer(compBuf))
- {
- return -1;
- }
- buffer = gz.getData();
- bufPos = 0;
- loaded = true;
- return true;
-}
-
-
-
-
-
-
-//#########################################################################
-//# G Z I P O U T P U T S T R E A M
-//#########################################################################
-
-/**
- *
- */
-GzipOutputStream::GzipOutputStream(OutputStream &destinationStream)
- : BasicOutputStream(destinationStream)
-{
-
- closed = false;
-}
-
-/**
- *
- */
-GzipOutputStream::~GzipOutputStream()
-{
- close();
-}
-
-/**
- * Closes this output stream and releases any system resources
- * associated with this stream.
- */
-void GzipOutputStream::close()
-{
- if (closed)
- return;
-
- flush();
-
- closed = true;
-}
-
-/**
- * Flushes this output stream and forces any buffered output
- * bytes to be written out.
- */
-void GzipOutputStream::flush()
-{
- if (closed || buffer.size()<1)
- return;
-
- std::vector<unsigned char> compBuf;
- GzipFile gz;
-
- gz.writeBuffer(buffer);
-
- std::vector<unsigned char>::iterator iter;
- for (iter=compBuf.begin() ; iter!=compBuf.end() ; iter++)
- {
- int ch = (int) *iter;
- destination.put(ch);
- }
-
- buffer.clear();
-
- //printf("done\n");
-
-}
-
-
-
-/**
- * Writes the specified byte to this output stream.
- */
-void GzipOutputStream::put(XMLCh ch)
-{
- if (closed)
- {
- //probably throw an exception here
- return;
- }
-
- //Add char to buffer
- buffer.push_back(ch);
-
-}
-
-
-
-} // namespace io
-} // namespace dom
-} // namespace w3c
-} // namespace org
-
-
-
-
-//#########################################################################
-//# E N D O F F I L E
-//#########################################################################
-
-
-
+/**
+ * Zlib-enabled input and output streams
+ *
+ * This is a thin wrapper of libz calls, in order
+ * to provide a simple interface to our developers
+ * for gzip input and output.
+ *
+ * Authors:
+ * Bob Jamison
+ *
+ * Copyright (C) 2006 Bob Jamison
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+
+#include "gzipstream.h"
+
+#include "dom/util/ziptool.h"
+
+
+namespace org
+{
+namespace w3c
+{
+namespace dom
+{
+namespace io
+{
+
+
+//#########################################################################
+//# G Z I P I N P U T S T R E A M
+//#########################################################################
+
+/**
+ *
+ */
+GzipInputStream::GzipInputStream(InputStream &sourceStream)
+ : BasicInputStream(sourceStream)
+{
+ loaded = false;
+ bufPos = 0;
+}
+
+/**
+ *
+ */
+GzipInputStream::~GzipInputStream()
+{
+ close();
+}
+
+/**
+ * Returns the number of bytes that can be read (or skipped over) from
+ * this input stream without blocking by the next caller of a method for
+ * this input stream.
+ */
+int GzipInputStream::available()
+{
+ if (closed)
+ return 0;
+ if (!loaded)
+ if (!load())
+ return 0;
+ return (int) buffer.size();
+}
+
+
+/**
+ * Closes this input stream and releases any system resources
+ * associated with the stream.
+ */
+void GzipInputStream::close()
+{
+ if (closed)
+ return;
+
+ closed = true;
+}
+
+/**
+ * Reads the next byte of data from the input stream. -1 if EOF
+ */
+int GzipInputStream::get()
+{
+ if (closed)
+ return -1;
+
+ if (!loaded)
+ if (!load())
+ return -1;
+
+ if (bufPos >= buffer.size())
+ return -1;
+ int ch = (int) buffer[bufPos++];
+
+ return ch;
+}
+
+/**
+ * Processes input. Fills read buffer.
+ */
+bool GzipInputStream::load()
+{
+ if (closed)
+ return false;
+
+ if (loaded)
+ return true;
+
+ std::vector<unsigned char> compBuf;
+ while (true)
+ {
+ int ch = source.get();
+ if (ch < 0)
+ break;
+ compBuf.push_back(ch);
+ }
+ GzipFile gz;
+ if (!gz.readBuffer(compBuf))
+ {
+ return -1;
+ }
+ buffer = gz.getData();
+ bufPos = 0;
+ loaded = true;
+ return true;
+}
+
+
+
+
+
+
+//#########################################################################
+//# G Z I P O U T P U T S T R E A M
+//#########################################################################
+
+/**
+ *
+ */
+GzipOutputStream::GzipOutputStream(OutputStream &destinationStream)
+ : BasicOutputStream(destinationStream)
+{
+
+ closed = false;
+}
+
+/**
+ *
+ */
+GzipOutputStream::~GzipOutputStream()
+{
+ close();
+}
+
+/**
+ * Closes this output stream and releases any system resources
+ * associated with this stream.
+ */
+void GzipOutputStream::close()
+{
+ if (closed)
+ return;
+
+ flush();
+
+ closed = true;
+}
+
+/**
+ * Flushes this output stream and forces any buffered output
+ * bytes to be written out.
+ */
+void GzipOutputStream::flush()
+{
+ if (closed || buffer.size()<1)
+ return;
+
+ std::vector<unsigned char> compBuf;
+ GzipFile gz;
+
+ gz.writeBuffer(buffer);
+
+ std::vector<unsigned char>::iterator iter;
+ for (iter=compBuf.begin() ; iter!=compBuf.end() ; iter++)
+ {
+ int ch = (int) *iter;
+ destination.put(ch);
+ }
+
+ buffer.clear();
+
+ //printf("done\n");
+
+}
+
+
+
+/**
+ * Writes the specified byte to this output stream.
+ */
+void GzipOutputStream::put(XMLCh ch)
+{
+ if (closed)
+ {
+ //probably throw an exception here
+ return;
+ }
+
+ //Add char to buffer
+ buffer.push_back(ch);
+
+}
+
+
+
+} // namespace io
+} // namespace dom
+} // namespace w3c
+} // namespace org
+
+
+
+
+//#########################################################################
+//# E N D O F F I L E
+//#########################################################################
+
+
+
diff --git a/src/dom/io/gzipstream.h b/src/dom/io/gzipstream.h
index 8fc26f0a2..6396772a5 100644
--- a/src/dom/io/gzipstream.h
+++ b/src/dom/io/gzipstream.h
@@ -1,125 +1,125 @@
-#ifndef __GZIPSTREAM_H__
-#define __GZIPSTREAM_H__
-/**
- * Zlib-enabled input and output streams
- *
- * This provides a simple mechanism for reading and
- * writing Gzip files. We use our own 'ZipTool' class
- * to accomplish this, avoiding a zlib dependency.
- *
- * Authors:
- * Bob Jamison
- *
- * Copyright (C) 2006 Bob Jamison
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-
-
-#include "domstream.h"
-
-namespace org
-{
-namespace w3c
-{
-namespace dom
-{
-namespace io
-{
-
-//#########################################################################
-//# G Z I P I N P U T S T R E A M
-//#########################################################################
-
-/**
- * This class is for deflating a gzip-compressed InputStream source
- *
- */
-class GzipInputStream : public BasicInputStream
-{
-
-public:
-
- GzipInputStream(InputStream &sourceStream);
-
- virtual ~GzipInputStream();
-
- virtual int available();
-
- virtual void close();
-
- virtual int get();
-
-private:
-
- bool load();
-
- bool loaded;
-
- std::vector<unsigned char> buffer;
- unsigned int bufPos;
-
-
-}; // class GzipInputStream
-
-
-
-
-//#########################################################################
-//# G Z I P O U T P U T S T R E A M
-//#########################################################################
-
-/**
- * This class is for gzip-compressing data going to the
- * destination OutputStream
- *
- */
-class GzipOutputStream : public BasicOutputStream
-{
-
-public:
-
- GzipOutputStream(OutputStream &destinationStream);
-
- virtual ~GzipOutputStream();
-
- virtual void close();
-
- virtual void flush();
-
- virtual void put(XMLCh ch);
-
-private:
-
- std::vector<unsigned char> buffer;
-
-
-}; // class GzipOutputStream
-
-
-
-
-
-
-
-} // namespace io
-} // namespace dom
-} // namespace w3c
-} // namespace org
-
-
-#endif /* __GZIPSTREAM_H__ */
+#ifndef __GZIPSTREAM_H__
+#define __GZIPSTREAM_H__
+/**
+ * Zlib-enabled input and output streams
+ *
+ * This provides a simple mechanism for reading and
+ * writing Gzip files. We use our own 'ZipTool' class
+ * to accomplish this, avoiding a zlib dependency.
+ *
+ * Authors:
+ * Bob Jamison
+ *
+ * Copyright (C) 2006 Bob Jamison
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+
+
+#include "domstream.h"
+
+namespace org
+{
+namespace w3c
+{
+namespace dom
+{
+namespace io
+{
+
+//#########################################################################
+//# G Z I P I N P U T S T R E A M
+//#########################################################################
+
+/**
+ * This class is for deflating a gzip-compressed InputStream source
+ *
+ */
+class GzipInputStream : public BasicInputStream
+{
+
+public:
+
+ GzipInputStream(InputStream &sourceStream);
+
+ virtual ~GzipInputStream();
+
+ virtual int available();
+
+ virtual void close();
+
+ virtual int get();
+
+private:
+
+ bool load();
+
+ bool loaded;
+
+ std::vector<unsigned char> buffer;
+ unsigned int bufPos;
+
+
+}; // class GzipInputStream
+
+
+
+
+//#########################################################################
+//# G Z I P O U T P U T S T R E A M
+//#########################################################################
+
+/**
+ * This class is for gzip-compressing data going to the
+ * destination OutputStream
+ *
+ */
+class GzipOutputStream : public BasicOutputStream
+{
+
+public:
+
+ GzipOutputStream(OutputStream &destinationStream);
+
+ virtual ~GzipOutputStream();
+
+ virtual void close();
+
+ virtual void flush();
+
+ virtual void put(XMLCh ch);
+
+private:
+
+ std::vector<unsigned char> buffer;
+
+
+}; // class GzipOutputStream
+
+
+
+
+
+
+
+} // namespace io
+} // namespace dom
+} // namespace w3c
+} // namespace org
+
+
+#endif /* __GZIPSTREAM_H__ */
diff --git a/src/dom/io/httpclient.cpp b/src/dom/io/httpclient.cpp
index b81e9aedf..4245d71f2 100644
--- a/src/dom/io/httpclient.cpp
+++ b/src/dom/io/httpclient.cpp
@@ -1,167 +1,167 @@
-/**
- * Phoebe DOM Implementation.
- *
- * This is a C++ approximation of the W3C DOM model, which follows
- * fairly closely the specifications in the various .idl files, copies of
- * which are provided for reference. Most important is this one:
- *
- * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
- *
- * Authors:
- * Bob Jamison
- *
- * Copyright (C) 2006 Bob Jamison
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-
-#include "httpclient.h"
-
-namespace org
-{
-namespace w3c
-{
-namespace dom
-{
-namespace io
-{
-
-
-
-
-/**
- *
- */
-HttpClient::HttpClient()
-{
-}
-
-
-/**
- *
- */
-HttpClient::~HttpClient()
-{
-}
-
-
-/**
- *
- */
-bool HttpClient::openGet(const URI &uri)
-{
-
- socket.disconnect();
-
- if (uri.getScheme() == URI::SCHEME_HTTP)
- socket.enableSSL(false);
- else if (uri.getScheme() == URI::SCHEME_HTTPS)
- socket.enableSSL(true);
- else
- {
- printf("Bad proto scheme:%d\n", uri.getScheme());
- return false;
- }
-
- DOMString host = uri.getHost();
- int port = uri.getPort();
- DOMString path = uri.getPath();
- if (path.size() == 0)
- path = "/";
-
- //printf("host:%s port:%d, path:%s\n", host.c_str(), port, path.c_str());
-
- if (!socket.connect(host, port))
- {
- return false;
- }
-
- DOMString msg = "GET ";
- msg.append(path);
- msg.append(" HTTP/1.0\r\n\r\n");
- //printf("msg:'%s'\n", msg.c_str());
-
- //# Make the request
- if (!socket.write(msg))
- {
- return false;
- }
-
- //# Read the HTTP headers
- while (true)
- {
- if (!socket.readLine(msg))
- return false;
- printf("header:'%s'\n", msg.c_str());
- if (msg.size() < 1)
- break;
- }
-
- return true;
-}
-
-
-/**
- *
- */
-int HttpClient::read()
-{
- int ret = socket.read();
- return ret;
-}
-
-/**
- *
- */
-bool HttpClient::write(int ch)
-{
- if (!socket.write(ch))
- return false;
- return true;
-}
-
-/**
- *
- */
-bool HttpClient::write(const DOMString &msg)
-{
- if (!socket.write(msg))
- return false;
- return true;
-}
-
-/**
- *
- */
-bool HttpClient::close()
-{
- socket.disconnect();
- return true;
-}
-
-
-
-} //namespace io
-} //namespace dom
-} //namespace w3c
-} //namespace org
-
-
-//#########################################################################
-//# E N D O F F I L E
-//#########################################################################
-
+/**
+ * Phoebe DOM Implementation.
+ *
+ * This is a C++ approximation of the W3C DOM model, which follows
+ * fairly closely the specifications in the various .idl files, copies of
+ * which are provided for reference. Most important is this one:
+ *
+ * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
+ *
+ * Authors:
+ * Bob Jamison
+ *
+ * Copyright (C) 2006 Bob Jamison
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+
+#include "httpclient.h"
+
+namespace org
+{
+namespace w3c
+{
+namespace dom
+{
+namespace io
+{
+
+
+
+
+/**
+ *
+ */
+HttpClient::HttpClient()
+{
+}
+
+
+/**
+ *
+ */
+HttpClient::~HttpClient()
+{
+}
+
+
+/**
+ *
+ */
+bool HttpClient::openGet(const URI &uri)
+{
+
+ socket.disconnect();
+
+ if (uri.getScheme() == URI::SCHEME_HTTP)
+ socket.enableSSL(false);
+ else if (uri.getScheme() == URI::SCHEME_HTTPS)
+ socket.enableSSL(true);
+ else
+ {
+ printf("Bad proto scheme:%d\n", uri.getScheme());
+ return false;
+ }
+
+ DOMString host = uri.getHost();
+ int port = uri.getPort();
+ DOMString path = uri.getPath();
+ if (path.size() == 0)
+ path = "/";
+
+ //printf("host:%s port:%d, path:%s\n", host.c_str(), port, path.c_str());
+
+ if (!socket.connect(host, port))
+ {
+ return false;
+ }
+
+ DOMString msg = "GET ";
+ msg.append(path);
+ msg.append(" HTTP/1.0\r\n\r\n");
+ //printf("msg:'%s'\n", msg.c_str());
+
+ //# Make the request
+ if (!socket.write(msg))
+ {
+ return false;
+ }
+
+ //# Read the HTTP headers
+ while (true)
+ {
+ if (!socket.readLine(msg))
+ return false;
+ printf("header:'%s'\n", msg.c_str());
+ if (msg.size() < 1)
+ break;
+ }
+
+ return true;
+}
+
+
+/**
+ *
+ */
+int HttpClient::read()
+{
+ int ret = socket.read();
+ return ret;
+}
+
+/**
+ *
+ */
+bool HttpClient::write(int ch)
+{
+ if (!socket.write(ch))
+ return false;
+ return true;
+}
+
+/**
+ *
+ */
+bool HttpClient::write(const DOMString &msg)
+{
+ if (!socket.write(msg))
+ return false;
+ return true;
+}
+
+/**
+ *
+ */
+bool HttpClient::close()
+{
+ socket.disconnect();
+ return true;
+}
+
+
+
+} //namespace io
+} //namespace dom
+} //namespace w3c
+} //namespace org
+
+
+//#########################################################################
+//# E N D O F F I L E
+//#########################################################################
+
diff --git a/src/dom/io/httpclient.h b/src/dom/io/httpclient.h
index 4c4bbcfe6..50538d0f5 100644
--- a/src/dom/io/httpclient.h
+++ b/src/dom/io/httpclient.h
@@ -1,115 +1,115 @@
-#ifndef __HTTPCLIENT_H__
-#define __HTTPCLIENT_H__
-/**
- * Phoebe DOM Implementation.
- *
- * This is a C++ approximation of the W3C DOM model, which follows
- * fairly closely the specifications in the various .idl files, copies of
- * which are provided for reference. Most important is this one:
- *
- * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
- *
- * Authors:
- * Bob Jamison
- *
- * Copyright (C) 2006 Bob Jamison
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-
-#include "dom/dom.h"
-#include "dom/uri.h"
-#include "dom/io/socket.h"
-
-namespace org
-{
-namespace w3c
-{
-namespace dom
-{
-namespace io
-{
-
-
-
-
-
-
-class HttpClient
-{
-
-public:
-
- /**
- *
- */
- HttpClient();
-
- /**
- *
- */
- virtual ~HttpClient();
-
- /**
- *
- */
- bool openGet(const URI &uri);
-
- /**
- *
- */
- int read();
-
- /**
- *
- */
- bool write(int ch);
-
- /**
- *
- */
- bool write(const DOMString &msg);
-
- /**
- *
- */
- bool close();
-
-
-private:
-
-
- TcpSocket socket;
-
-};
-
-
-
-
-} //namespace io
-} //namespace dom
-} //namespace w3c
-} //namespace org
-
-
-#endif /* __HTTPCLIENT_H__ */
-
-
-//#########################################################################
-//# E N D O F F I L E
-//#########################################################################
-
+#ifndef __HTTPCLIENT_H__
+#define __HTTPCLIENT_H__
+/**
+ * Phoebe DOM Implementation.
+ *
+ * This is a C++ approximation of the W3C DOM model, which follows
+ * fairly closely the specifications in the various .idl files, copies of
+ * which are provided for reference. Most important is this one:
+ *
+ * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
+ *
+ * Authors:
+ * Bob Jamison
+ *
+ * Copyright (C) 2006 Bob Jamison
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+
+#include "dom/dom.h"
+#include "dom/uri.h"
+#include "dom/io/socket.h"
+
+namespace org
+{
+namespace w3c
+{
+namespace dom
+{
+namespace io
+{
+
+
+
+
+
+
+class HttpClient
+{
+
+public:
+
+ /**
+ *
+ */
+ HttpClient();
+
+ /**
+ *
+ */
+ virtual ~HttpClient();
+
+ /**
+ *
+ */
+ bool openGet(const URI &uri);
+
+ /**
+ *
+ */
+ int read();
+
+ /**
+ *
+ */
+ bool write(int ch);
+
+ /**
+ *
+ */
+ bool write(const DOMString &msg);
+
+ /**
+ *
+ */
+ bool close();
+
+
+private:
+
+
+ TcpSocket socket;
+
+};
+
+
+
+
+} //namespace io
+} //namespace dom
+} //namespace w3c
+} //namespace org
+
+
+#endif /* __HTTPCLIENT_H__ */
+
+
+//#########################################################################
+//# E N D O F F I L E
+//#########################################################################
+
diff --git a/src/dom/minidom.cpp b/src/dom/minidom.cpp
index 0a5001eaa..bdb1065b2 100644
--- a/src/dom/minidom.cpp
+++ b/src/dom/minidom.cpp
@@ -1,690 +1,690 @@
-
-
-
-#include <stdio.h>
-#include <string.h>
-#include <stdarg.h>
-#include <malloc.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-
-#include "minidom.h"
-
-namespace MiniDom
-{
-
-
-
-//########################################################################
-//# E L E M E N T
-//########################################################################
-
-void Element::findElementsRecursive(std::vector<Element *>&res, const DOMString &name)
-{
- if (getName() == name)
- res.push_back(this);
- for (unsigned int i=0; i<children.size() ; i++)
- children[i]->findElementsRecursive(res, name);
-}
-
-std::vector<Element *> Element::findElements(const DOMString &name)
-{
- std::vector<Element *> res;
- findElementsRecursive(res, name);
- return res;
-}
-
-DOMString Element::getAttribute(const DOMString &name)
-{
- for (unsigned int i=0 ; i<attributes.size() ; i++)
- if (attributes[i].getName() ==name)
- return attributes[i].getValue();
- return "";
-}
-
-void Element::addChild(Element *child)
-{
- children.push_back(child);
-}
-
-
-void Element::addAttribute(const DOMString &name, const DOMString &value)
-{
- Attribute attr(name, value);
- attributes.push_back(attr);
-}
-
-void Element::addNamespace(const DOMString &prefix, const DOMString &namespaceURI)
-{
- Namespace ns(prefix, namespaceURI);
- namespaces.push_back(ns);
-}
-
-void Element::writeIndentedRecursive(FILE *f, int indent)
-{
- int i;
- if (!f)
- return;
- //Opening tag, and attributes
- for (i=0;i<indent;i++)
- fputc(' ',f);
- fprintf(f,"<%s",name.c_str());
- for (unsigned int i=0 ; i<attributes.size() ; i++)
- {
- fprintf(f," %s=\"%s\"",
- attributes[i].getName().c_str(),
- attributes[i].getValue().c_str());
- }
- for (unsigned int i=0 ; i<namespaces.size() ; i++)
- {
- fprintf(f," xmlns:%s=\"%s\"",
- namespaces[i].getPrefix().c_str(),
- namespaces[i].getNamespaceURI().c_str());
- }
- fprintf(f,">\n");
-
- //Between the tags
- if (value.size() > 0)
- {
- for (int i=0;i<indent;i++)
- fputc(' ', f);
- fprintf(f," %s\n", value.c_str());
- }
-
- for (unsigned int i=0 ; i<children.size() ; i++)
- children[i]->writeIndentedRecursive(f, indent+2);
-
- //Closing tag
- for (int i=0; i<indent; i++)
- fputc(' ',f);
- fprintf(f,"</%s>\n", name.c_str());
-}
-
-void Element::writeIndented(FILE *f)
-{
- writeIndentedRecursive(f, 0);
-}
-
-void Element::print()
-{
- writeIndented(stdout);
-}
-
-
-//########################################################################
-//# P A R S E R
-//########################################################################
-
-
-
-typedef struct
- {
- char *escaped;
- char value;
- } EntityEntry;
-
-static EntityEntry entities[] =
-{
- { "&amp;" , '&' },
- { "&lt;" , '<' },
- { "&gt;" , '>' },
- { "&apos;", '\'' },
- { "&quot;", '"' },
- { NULL , '\0' }
-};
-
-
-
-void Parser::getLineAndColumn(long pos, long *lineNr, long *colNr)
-{
- long line = 1;
- long col = 1;
- for (long i=0 ; i<pos ; i++)
- {
- XMLCh ch = parsebuf[i];
- if (ch == '\n' || ch == '\r')
- {
- col = 0;
- line ++;
- }
- else
- col++;
- }
- *lineNr = line;
- *colNr = col;
-
-}
-
-
-void Parser::error(char *fmt, ...)
-{
- long lineNr;
- long colNr;
- getLineAndColumn(currentPosition, &lineNr, &colNr);
- va_list args;
- fprintf(stderr, "xml error at line %d, column %d:", lineNr, colNr);
- va_start(args,fmt);
- vfprintf(stderr,fmt,args);
- va_end(args) ;
- fprintf(stderr, "\n");
-}
-
-
-
-int Parser::peek(long pos)
-{
- if (pos >= parselen)
- return -1;
- currentPosition = pos;
- int ch = parsebuf[pos];
- //printf("ch:%c\n", ch);
- return ch;
-}
-
-
-
-int Parser::match(long p0, const char *text)
-{
- int p = p0;
- while (*text)
- {
- if (peek(p) != *text)
- return p0;
- p++; text++;
- }
- return p;
-}
-
-
-
-int Parser::skipwhite(long p)
-{
-
- while (p<parselen)
- {
- int p2 = match(p, "<!--");
- if (p2 > p)
- {
- p = p2;
- while (p<parselen)
- {
- p2 = match(p, "-->");
- if (p2 > p)
- {
- p = p2;
- break;
- }
- p++;
- }
- }
- XMLCh b = peek(p);
- if (!isspace(b))
- break;
- p++;
- }
- return p;
-}
-
-/* modify this to allow all chars for an element or attribute name*/
-int Parser::getWord(int p0, DOMString &buf)
-{
- int p = p0;
- while (p<parselen)
- {
- XMLCh b = peek(p);
- if (b<=' ' || b=='/' || b=='>' || b=='=')
- break;
- buf.push_back(b);
- p++;
- }
- return p;
-}
-
-int Parser::getQuoted(int p0, DOMString &buf, int do_i_parse)
-{
-
- int p = p0;
- if (peek(p) != '"' && peek(p) != '\'')
- return p0;
- p++;
-
- while ( p<parselen )
- {
- XMLCh b = peek(p);
- if (b=='"' || b=='\'')
- break;
- if (b=='&' && do_i_parse)
- {
- bool found = false;
- for (EntityEntry *ee = entities ; ee->value ; ee++)
- {
- int p2 = match(p, ee->escaped);
- if (p2>p)
- {
- buf.push_back(ee->value);
- p = p2;
- found = true;
- break;
- }
- }
- if (!found)
- {
- error("unterminated entity");
- return false;
- }
- }
- else
- {
- buf.push_back(b);
- p++;
- }
- }
- return p;
-}
-
-int Parser::parseVersion(int p0)
-{
- //printf("### parseVersion: %d\n", p0);
-
- int p = p0;
-
- p = skipwhite(p0);
-
- if (peek(p) != '<')
- return p0;
-
- p++;
- if (p>=parselen || peek(p)!='?')
- return p0;
-
- p++;
-
- DOMString buf;
-
- while (p<parselen)
- {
- XMLCh ch = peek(p++);
- if (ch=='?')
- break;
- buf.push_back(ch);
- }
- if (peek(p) != '>')
- return p0;
- p++;
-
- //printf("Got version:%s\n",buf.c_str());
- return p;
-}
-
-int Parser::parseDoctype(int p0)
-{
- //printf("### parseDoctype: %d\n", p0);
-
- int p = p0;
- p = skipwhite(p);
-
- if (p>=parselen || peek(p)!='<')
- return p0;
-
- p++;
-
- if (peek(p)!='!' || peek(p+1)=='-')
- return p0;
- p++;
-
- DOMString buf;
- while (p<parselen)
- {
- XMLCh ch = peek(p);
- if (ch=='>')
- {
- p++;
- break;
- }
- buf.push_back(ch);
- p++;
- }
-
- //printf("Got doctype:%s\n",buf.c_str());
- return p;
-}
-
-int Parser::parseElement(int p0, Element *par,int depth)
-{
-
- int p = p0;
-
- int p2 = p;
-
- p = skipwhite(p);
-
- //## Get open tag
- XMLCh ch = peek(p);
- if (ch!='<')
- return p0;
-
- p++;
-
- DOMString openTagName;
- p = skipwhite(p);
- p = getWord(p, openTagName);
- //printf("####tag :%s\n", openTagName.c_str());
- p = skipwhite(p);
-
- //Add element to tree
- Element *n = new Element(openTagName);
- n->parent = par;
- par->addChild(n);
-
- // Get attributes
- if (peek(p) != '>')
- {
- while (p<parselen)
- {
- p = skipwhite(p);
- ch = peek(p);
- //printf("ch:%c\n",ch);
- if (ch=='>')
- break;
- else if (ch=='/' && p<parselen+1)
- {
- p++;
- p = skipwhite(p);
- ch = peek(p);
- if (ch=='>')
- {
- p++;
- //printf("quick close\n");
- return p;
- }
- }
- DOMString attrName;
- p2 = getWord(p, attrName);
- if (p2==p)
- break;
- //printf("name:%s",buf);
- p=p2;
- p = skipwhite(p);
- ch = peek(p);
- //printf("ch:%c\n",ch);
- if (ch!='=')
- break;
- p++;
- p = skipwhite(p);
- // ch = parsebuf[p];
- // printf("ch:%c\n",ch);
- DOMString attrVal;
- p2 = getQuoted(p, attrVal, true);
- p=p2+1;
- //printf("name:'%s' value:'%s'\n",attrName.c_str(),attrVal.c_str());
- char *namestr = (char *)attrName.c_str();
- if (strncmp(namestr, "xmlns:", 6)==0)
- n->addNamespace(attrName, attrVal);
- else
- n->addAttribute(attrName, attrVal);
- }
- }
-
- bool cdata = false;
-
- p++;
- // ### Get intervening data ### */
- DOMString data;
- while (p<parselen)
- {
- //# COMMENT
- p2 = match(p, "<!--");
- if (!cdata && p2>p)
- {
- p = p2;
- while (p<parselen)
- {
- p2 = match(p, "-->");
- if (p2 > p)
- {
- p = p2;
- break;
- }
- p++;
- }
- }
-
- ch = peek(p);
- //# END TAG
- if (ch=='<' && !cdata && peek(p+1)=='/')
- {
- break;
- }
- //# CDATA
- p2 = match(p, "<![CDATA[");
- if (p2 > p)
- {
- cdata = true;
- p = p2;
- continue;
- }
-
- //# CHILD ELEMENT
- if (ch == '<')
- {
- p2 = parseElement(p, n, depth+1);
- if (p2 == p)
- {
- /*
- printf("problem on element:%s. p2:%d p:%d\n",
- openTagName.c_str(), p2, p);
- */
- return p0;
- }
- p = p2;
- continue;
- }
- //# ENTITY
- if (ch=='&' && !cdata)
- {
- bool found = false;
- for (EntityEntry *ee = entities ; ee->value ; ee++)
- {
- int p2 = match(p, ee->escaped);
- if (p2>p)
- {
- data.push_back(ee->value);
- p = p2;
- found = true;
- break;
- }
- }
- if (!found)
- {
- error("unterminated entity");
- return -1;
- }
- continue;
- }
-
- //# NONE OF THE ABOVE
- data.push_back(ch);
- p++;
- }/*while*/
-
-
- n->value = data;
- //printf("%d : data:%s\n",p,data.c_str());
-
- //## Get close tag
- p = skipwhite(p);
- ch = peek(p);
- if (ch != '<')
- {
- error("no < for end tag\n");
- return p0;
- }
- p++;
- ch = peek(p);
- if (ch != '/')
- {
- error("no / on end tag");
- return p0;
- }
- p++;
- ch = peek(p);
- p = skipwhite(p);
- DOMString closeTagName;
- p = getWord(p, closeTagName);
- if (openTagName != closeTagName)
- {
- error("Mismatched closing tag. Expected </%S>. Got '%S'.",
- openTagName.c_str(), closeTagName.c_str());
- return p0;
- }
- p = skipwhite(p);
- if (peek(p) != '>')
- {
- error("no > on end tag for '%s'", closeTagName.c_str());
- return p0;
- }
- p++;
- // printf("close element:%s\n",closeTagName.c_str());
- p = skipwhite(p);
- return p;
-}
-
-
-
-
-Element *Parser::parse(XMLCh *buf,int pos,int len)
-{
- parselen = len;
- parsebuf = buf;
- Element *rootNode = new Element("root");
- pos = parseVersion(pos);
- pos = parseDoctype(pos);
- pos = parseElement(pos, rootNode, 0);
- return rootNode;
-}
-
-
-Element *Parser::parse(const char *buf, int pos, int len)
-{
-
- XMLCh *charbuf = (XMLCh *)malloc((len+1) * sizeof(XMLCh));
- long i = 0;
- while (i< len)
- {
- charbuf[i] = (XMLCh)buf[i];
- i++;
- }
- charbuf[i] = '\0';
- Element *n = parse(charbuf, 0, len-1);
- free(charbuf);
- return n;
-}
-
-Element *Parser::parse(const DOMString &buf)
-{
- long len = buf.size();
- XMLCh *charbuf = (XMLCh *)malloc((len+1) * sizeof(XMLCh));
- long i = 0;
- while (i< len)
- {
- charbuf[i] = (XMLCh)buf[i];
- i++;
- }
- charbuf[i] = '\0';
- Element *n = parse(charbuf, 0, len-1);
- free(charbuf);
- return n;
-}
-
-Element *Parser::parseFile(const char *fileName)
-{
-
- //##### LOAD INTO A CHAR BUF, THEN CONVERT TO XMLCh
- if (!fileName)
- return NULL;
-
- FILE *f = fopen(fileName, "rb");
- if (!f)
- return NULL;
-
- struct stat statBuf;
- if (fstat(fileno(f),&statBuf)<0)
- {
- fclose(f);
- return NULL;
- }
- long filelen = statBuf.st_size;
-
- //printf("length:%d\n",filelen);
- XMLCh *charbuf = (XMLCh *)malloc((filelen+1) * sizeof(XMLCh));
- for (XMLCh *p=charbuf ; !feof(f) ; p++)
- {
- *p = (XMLCh)fgetc(f);
- }
- fclose(f);
- charbuf[filelen] = '\0';
-
-
- /*
- printf("nrbytes:%d\n",wc_count);
- printf("buf:%ls\n======\n",charbuf);
- */
- Element *n = parse(charbuf, 0, filelen-1);
- free(charbuf);
- return n;
-}
-
-
-
-
-
-
-
-}//namespace MiniDom
-//########################################################################
-//# T E S T
-//########################################################################
-
-bool doTest(char *fileName)
-{
- MiniDom::Parser parser;
-
- MiniDom::Element *elem = parser.parseFile(fileName);
-
- if (!elem)
- {
- printf("Parsing failed\n");
- return false;
- }
-
- elem->print();
-
- delete elem;
-
- return true;
-}
-
-
-
-int main(int argc, char **argv)
-{
- if (argc != 2)
- {
- printf("usage: %s <xmlfile>\n", argv[0]);
- return 1;
- }
-
- if (!doTest(argv[1]))
- return 1;
-
- return 0;
-}
-
-
-
-//########################################################################
-//# E N D O F F I L E
-//########################################################################
-
-
+
+
+
+#include <stdio.h>
+#include <string.h>
+#include <stdarg.h>
+#include <malloc.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+
+#include "minidom.h"
+
+namespace MiniDom
+{
+
+
+
+//########################################################################
+//# E L E M E N T
+//########################################################################
+
+void Element::findElementsRecursive(std::vector<Element *>&res, const DOMString &name)
+{
+ if (getName() == name)
+ res.push_back(this);
+ for (unsigned int i=0; i<children.size() ; i++)
+ children[i]->findElementsRecursive(res, name);
+}
+
+std::vector<Element *> Element::findElements(const DOMString &name)
+{
+ std::vector<Element *> res;
+ findElementsRecursive(res, name);
+ return res;
+}
+
+DOMString Element::getAttribute(const DOMString &name)
+{
+ for (unsigned int i=0 ; i<attributes.size() ; i++)
+ if (attributes[i].getName() ==name)
+ return attributes[i].getValue();
+ return "";
+}
+
+void Element::addChild(Element *child)
+{
+ children.push_back(child);
+}
+
+
+void Element::addAttribute(const DOMString &name, const DOMString &value)
+{
+ Attribute attr(name, value);
+ attributes.push_back(attr);
+}
+
+void Element::addNamespace(const DOMString &prefix, const DOMString &namespaceURI)
+{
+ Namespace ns(prefix, namespaceURI);
+ namespaces.push_back(ns);
+}
+
+void Element::writeIndentedRecursive(FILE *f, int indent)
+{
+ int i;
+ if (!f)
+ return;
+ //Opening tag, and attributes
+ for (i=0;i<indent;i++)
+ fputc(' ',f);
+ fprintf(f,"<%s",name.c_str());
+ for (unsigned int i=0 ; i<attributes.size() ; i++)
+ {
+ fprintf(f," %s=\"%s\"",
+ attributes[i].getName().c_str(),
+ attributes[i].getValue().c_str());
+ }
+ for (unsigned int i=0 ; i<namespaces.size() ; i++)
+ {
+ fprintf(f," xmlns:%s=\"%s\"",
+ namespaces[i].getPrefix().c_str(),
+ namespaces[i].getNamespaceURI().c_str());
+ }
+ fprintf(f,">\n");
+
+ //Between the tags
+ if (value.size() > 0)
+ {
+ for (int i=0;i<indent;i++)
+ fputc(' ', f);
+ fprintf(f," %s\n", value.c_str());
+ }
+
+ for (unsigned int i=0 ; i<children.size() ; i++)
+ children[i]->writeIndentedRecursive(f, indent+2);
+
+ //Closing tag
+ for (int i=0; i<indent; i++)
+ fputc(' ',f);
+ fprintf(f,"</%s>\n", name.c_str());
+}
+
+void Element::writeIndented(FILE *f)
+{
+ writeIndentedRecursive(f, 0);
+}
+
+void Element::print()
+{
+ writeIndented(stdout);
+}
+
+
+//########################################################################
+//# P A R S E R
+//########################################################################
+
+
+
+typedef struct
+ {
+ char *escaped;
+ char value;
+ } EntityEntry;
+
+static EntityEntry entities[] =
+{
+ { "&amp;" , '&' },
+ { "&lt;" , '<' },
+ { "&gt;" , '>' },
+ { "&apos;", '\'' },
+ { "&quot;", '"' },
+ { NULL , '\0' }
+};
+
+
+
+void Parser::getLineAndColumn(long pos, long *lineNr, long *colNr)
+{
+ long line = 1;
+ long col = 1;
+ for (long i=0 ; i<pos ; i++)
+ {
+ XMLCh ch = parsebuf[i];
+ if (ch == '\n' || ch == '\r')
+ {
+ col = 0;
+ line ++;
+ }
+ else
+ col++;
+ }
+ *lineNr = line;
+ *colNr = col;
+
+}
+
+
+void Parser::error(char *fmt, ...)
+{
+ long lineNr;
+ long colNr;
+ getLineAndColumn(currentPosition, &lineNr, &colNr);
+ va_list args;
+ fprintf(stderr, "xml error at line %d, column %d:", lineNr, colNr);
+ va_start(args,fmt);
+ vfprintf(stderr,fmt,args);
+ va_end(args) ;
+ fprintf(stderr, "\n");
+}
+
+
+
+int Parser::peek(long pos)
+{
+ if (pos >= parselen)
+ return -1;
+ currentPosition = pos;
+ int ch = parsebuf[pos];
+ //printf("ch:%c\n", ch);
+ return ch;
+}
+
+
+
+int Parser::match(long p0, const char *text)
+{
+ int p = p0;
+ while (*text)
+ {
+ if (peek(p) != *text)
+ return p0;
+ p++; text++;
+ }
+ return p;
+}
+
+
+
+int Parser::skipwhite(long p)
+{
+
+ while (p<parselen)
+ {
+ int p2 = match(p, "<!--");
+ if (p2 > p)
+ {
+ p = p2;
+ while (p<parselen)
+ {
+ p2 = match(p, "-->");
+ if (p2 > p)
+ {
+ p = p2;
+ break;
+ }
+ p++;
+ }
+ }
+ XMLCh b = peek(p);
+ if (!isspace(b))
+ break;
+ p++;
+ }
+ return p;
+}
+
+/* modify this to allow all chars for an element or attribute name*/
+int Parser::getWord(int p0, DOMString &buf)
+{
+ int p = p0;
+ while (p<parselen)
+ {
+ XMLCh b = peek(p);
+ if (b<=' ' || b=='/' || b=='>' || b=='=')
+ break;
+ buf.push_back(b);
+ p++;
+ }
+ return p;
+}
+
+int Parser::getQuoted(int p0, DOMString &buf, int do_i_parse)
+{
+
+ int p = p0;
+ if (peek(p) != '"' && peek(p) != '\'')
+ return p0;
+ p++;
+
+ while ( p<parselen )
+ {
+ XMLCh b = peek(p);
+ if (b=='"' || b=='\'')
+ break;
+ if (b=='&' && do_i_parse)
+ {
+ bool found = false;
+ for (EntityEntry *ee = entities ; ee->value ; ee++)
+ {
+ int p2 = match(p, ee->escaped);
+ if (p2>p)
+ {
+ buf.push_back(ee->value);
+ p = p2;
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ {
+ error("unterminated entity");
+ return false;
+ }
+ }
+ else
+ {
+ buf.push_back(b);
+ p++;
+ }
+ }
+ return p;
+}
+
+int Parser::parseVersion(int p0)
+{
+ //printf("### parseVersion: %d\n", p0);
+
+ int p = p0;
+
+ p = skipwhite(p0);
+
+ if (peek(p) != '<')
+ return p0;
+
+ p++;
+ if (p>=parselen || peek(p)!='?')
+ return p0;
+
+ p++;
+
+ DOMString buf;
+
+ while (p<parselen)
+ {
+ XMLCh ch = peek(p++);
+ if (ch=='?')
+ break;
+ buf.push_back(ch);
+ }
+ if (peek(p) != '>')
+ return p0;
+ p++;
+
+ //printf("Got version:%s\n",buf.c_str());
+ return p;
+}
+
+int Parser::parseDoctype(int p0)
+{
+ //printf("### parseDoctype: %d\n", p0);
+
+ int p = p0;
+ p = skipwhite(p);
+
+ if (p>=parselen || peek(p)!='<')
+ return p0;
+
+ p++;
+
+ if (peek(p)!='!' || peek(p+1)=='-')
+ return p0;
+ p++;
+
+ DOMString buf;
+ while (p<parselen)
+ {
+ XMLCh ch = peek(p);
+ if (ch=='>')
+ {
+ p++;
+ break;
+ }
+ buf.push_back(ch);
+ p++;
+ }
+
+ //printf("Got doctype:%s\n",buf.c_str());
+ return p;
+}
+
+int Parser::parseElement(int p0, Element *par,int depth)
+{
+
+ int p = p0;
+
+ int p2 = p;
+
+ p = skipwhite(p);
+
+ //## Get open tag
+ XMLCh ch = peek(p);
+ if (ch!='<')
+ return p0;
+
+ p++;
+
+ DOMString openTagName;
+ p = skipwhite(p);
+ p = getWord(p, openTagName);
+ //printf("####tag :%s\n", openTagName.c_str());
+ p = skipwhite(p);
+
+ //Add element to tree
+ Element *n = new Element(openTagName);
+ n->parent = par;
+ par->addChild(n);
+
+ // Get attributes
+ if (peek(p) != '>')
+ {
+ while (p<parselen)
+ {
+ p = skipwhite(p);
+ ch = peek(p);
+ //printf("ch:%c\n",ch);
+ if (ch=='>')
+ break;
+ else if (ch=='/' && p<parselen+1)
+ {
+ p++;
+ p = skipwhite(p);
+ ch = peek(p);
+ if (ch=='>')
+ {
+ p++;
+ //printf("quick close\n");
+ return p;
+ }
+ }
+ DOMString attrName;
+ p2 = getWord(p, attrName);
+ if (p2==p)
+ break;
+ //printf("name:%s",buf);
+ p=p2;
+ p = skipwhite(p);
+ ch = peek(p);
+ //printf("ch:%c\n",ch);
+ if (ch!='=')
+ break;
+ p++;
+ p = skipwhite(p);
+ // ch = parsebuf[p];
+ // printf("ch:%c\n",ch);
+ DOMString attrVal;
+ p2 = getQuoted(p, attrVal, true);
+ p=p2+1;
+ //printf("name:'%s' value:'%s'\n",attrName.c_str(),attrVal.c_str());
+ char *namestr = (char *)attrName.c_str();
+ if (strncmp(namestr, "xmlns:", 6)==0)
+ n->addNamespace(attrName, attrVal);
+ else
+ n->addAttribute(attrName, attrVal);
+ }
+ }
+
+ bool cdata = false;
+
+ p++;
+ // ### Get intervening data ### */
+ DOMString data;
+ while (p<parselen)
+ {
+ //# COMMENT
+ p2 = match(p, "<!--");
+ if (!cdata && p2>p)
+ {
+ p = p2;
+ while (p<parselen)
+ {
+ p2 = match(p, "-->");
+ if (p2 > p)
+ {
+ p = p2;
+ break;
+ }
+ p++;
+ }
+ }
+
+ ch = peek(p);
+ //# END TAG
+ if (ch=='<' && !cdata && peek(p+1)=='/')
+ {
+ break;
+ }
+ //# CDATA
+ p2 = match(p, "<![CDATA[");
+ if (p2 > p)
+ {
+ cdata = true;
+ p = p2;
+ continue;
+ }
+
+ //# CHILD ELEMENT
+ if (ch == '<')
+ {
+ p2 = parseElement(p, n, depth+1);
+ if (p2 == p)
+ {
+ /*
+ printf("problem on element:%s. p2:%d p:%d\n",
+ openTagName.c_str(), p2, p);
+ */
+ return p0;
+ }
+ p = p2;
+ continue;
+ }
+ //# ENTITY
+ if (ch=='&' && !cdata)
+ {
+ bool found = false;
+ for (EntityEntry *ee = entities ; ee->value ; ee++)
+ {
+ int p2 = match(p, ee->escaped);
+ if (p2>p)
+ {
+ data.push_back(ee->value);
+ p = p2;
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ {
+ error("unterminated entity");
+ return -1;
+ }
+ continue;
+ }
+
+ //# NONE OF THE ABOVE
+ data.push_back(ch);
+ p++;
+ }/*while*/
+
+
+ n->value = data;
+ //printf("%d : data:%s\n",p,data.c_str());
+
+ //## Get close tag
+ p = skipwhite(p);
+ ch = peek(p);
+ if (ch != '<')
+ {
+ error("no < for end tag\n");
+ return p0;
+ }
+ p++;
+ ch = peek(p);
+ if (ch != '/')
+ {
+ error("no / on end tag");
+ return p0;
+ }
+ p++;
+ ch = peek(p);
+ p = skipwhite(p);
+ DOMString closeTagName;
+ p = getWord(p, closeTagName);
+ if (openTagName != closeTagName)
+ {
+ error("Mismatched closing tag. Expected </%S>. Got '%S'.",
+ openTagName.c_str(), closeTagName.c_str());
+ return p0;
+ }
+ p = skipwhite(p);
+ if (peek(p) != '>')
+ {
+ error("no > on end tag for '%s'", closeTagName.c_str());
+ return p0;
+ }
+ p++;
+ // printf("close element:%s\n",closeTagName.c_str());
+ p = skipwhite(p);
+ return p;
+}
+
+
+
+
+Element *Parser::parse(XMLCh *buf,int pos,int len)
+{
+ parselen = len;
+ parsebuf = buf;
+ Element *rootNode = new Element("root");
+ pos = parseVersion(pos);
+ pos = parseDoctype(pos);
+ pos = parseElement(pos, rootNode, 0);
+ return rootNode;
+}
+
+
+Element *Parser::parse(const char *buf, int pos, int len)
+{
+
+ XMLCh *charbuf = (XMLCh *)malloc((len+1) * sizeof(XMLCh));
+ long i = 0;
+ while (i< len)
+ {
+ charbuf[i] = (XMLCh)buf[i];
+ i++;
+ }
+ charbuf[i] = '\0';
+ Element *n = parse(charbuf, 0, len-1);
+ free(charbuf);
+ return n;
+}
+
+Element *Parser::parse(const DOMString &buf)
+{
+ long len = buf.size();
+ XMLCh *charbuf = (XMLCh *)malloc((len+1) * sizeof(XMLCh));
+ long i = 0;
+ while (i< len)
+ {
+ charbuf[i] = (XMLCh)buf[i];
+ i++;
+ }
+ charbuf[i] = '\0';
+ Element *n = parse(charbuf, 0, len-1);
+ free(charbuf);
+ return n;
+}
+
+Element *Parser::parseFile(const char *fileName)
+{
+
+ //##### LOAD INTO A CHAR BUF, THEN CONVERT TO XMLCh
+ if (!fileName)
+ return NULL;
+
+ FILE *f = fopen(fileName, "rb");
+ if (!f)
+ return NULL;
+
+ struct stat statBuf;
+ if (fstat(fileno(f),&statBuf)<0)
+ {
+ fclose(f);
+ return NULL;
+ }
+ long filelen = statBuf.st_size;
+
+ //printf("length:%d\n",filelen);
+ XMLCh *charbuf = (XMLCh *)malloc((filelen+1) * sizeof(XMLCh));
+ for (XMLCh *p=charbuf ; !feof(f) ; p++)
+ {
+ *p = (XMLCh)fgetc(f);
+ }
+ fclose(f);
+ charbuf[filelen] = '\0';
+
+
+ /*
+ printf("nrbytes:%d\n",wc_count);
+ printf("buf:%ls\n======\n",charbuf);
+ */
+ Element *n = parse(charbuf, 0, filelen-1);
+ free(charbuf);
+ return n;
+}
+
+
+
+
+
+
+
+}//namespace MiniDom
+//########################################################################
+//# T E S T
+//########################################################################
+
+bool doTest(char *fileName)
+{
+ MiniDom::Parser parser;
+
+ MiniDom::Element *elem = parser.parseFile(fileName);
+
+ if (!elem)
+ {
+ printf("Parsing failed\n");
+ return false;
+ }
+
+ elem->print();
+
+ delete elem;
+
+ return true;
+}
+
+
+
+int main(int argc, char **argv)
+{
+ if (argc != 2)
+ {
+ printf("usage: %s <xmlfile>\n", argv[0]);
+ return 1;
+ }
+
+ if (!doTest(argv[1]))
+ return 1;
+
+ return 0;
+}
+
+
+
+//########################################################################
+//# E N D O F F I L E
+//########################################################################
+
+
diff --git a/src/dom/minidom.h b/src/dom/minidom.h
index df8cca881..30b53dd18 100644
--- a/src/dom/minidom.h
+++ b/src/dom/minidom.h
@@ -1,270 +1,270 @@
-#include <string>
-#include <vector>
-
-
-namespace MiniDom
-{
-typedef std::string DOMString;
-typedef unsigned int XMLCh;
-
-
-class Namespace
-{
-public:
- Namespace()
- {}
-
- Namespace(const DOMString &prefixArg, const DOMString &namespaceURIArg)
- {
- prefix = prefixArg;
- namespaceURI = namespaceURIArg;
- }
-
- Namespace(const Namespace &other)
- {
- prefix = other.prefix;
- namespaceURI = other.namespaceURI;
- }
-
- virtual ~Namespace()
- {}
-
- virtual DOMString getPrefix()
- { return prefix; }
-
- virtual DOMString getNamespaceURI()
- { return namespaceURI; }
-
-protected:
-
- DOMString prefix;
- DOMString namespaceURI;
-
-};
-
-class Attribute
-{
-public:
- Attribute()
- {}
-
- Attribute(const DOMString &nameArg, const DOMString &valueArg)
- {
- name = nameArg;
- value = valueArg;
- }
-
- Attribute(const Attribute &other)
- {
- name = other.name;
- value = other.value;
- }
-
- virtual ~Attribute()
- {}
-
- virtual DOMString getName()
- { return name; }
-
- virtual DOMString getValue()
- { return value; }
-
-protected:
-
- DOMString name;
- DOMString value;
-
-};
-
-
-class Element
-{
-friend class Parser;
-
-public:
- Element()
- {
- parent = NULL;
- }
-
- Element(const DOMString &nameArg)
- {
- parent = NULL;
- name = nameArg;
- }
-
- Element(const DOMString &nameArg, const DOMString &valueArg)
- {
- parent = NULL;
- name = nameArg;
- value = valueArg;
- }
-
- Element(const Element &other)
- {
- parent = other.parent;
- children = other.children;
- attributes = other.attributes;
- namespaces = other.namespaces;
- name = other.name;
- value = other.value;
- }
-
- virtual ~Element()
- {
- for (unsigned int i=0 ; i<children.size() ; i++)
- delete children[i];
- }
-
- virtual DOMString getName()
- { return name; }
-
- virtual DOMString getValue()
- { return value; }
-
- Element *getParent()
- { return parent; }
-
- std::vector<Element *> getChildren()
- { return children; }
-
- std::vector<Element *> findElements(const DOMString &name);
-
- DOMString getAttribute(const DOMString &name);
-
- void addChild(Element *child);
-
- void addAttribute(const DOMString &name, const DOMString &value);
-
- void addNamespace(const DOMString &prefix, const DOMString &namespaceURI);
-
-
- /**
- * Prettyprint an XML tree to an output stream. Elements are indented
- * according to element hierarchy.
- * @param f a stream to receive the output
- * @param elem the element to output
- */
- void writeIndented(FILE *f);
-
- /**
- * Prettyprint an XML tree to standard output. This is the equivalent of
- * writeIndented(stdout).
- * @param elem the element to output
- */
- void print();
-
-protected:
-
-
- void findElementsRecursive(std::vector<Element *>&res, const DOMString &name);
-
- void writeIndentedRecursive(FILE *f, int indent);
-
- Element *parent;
-
- std::vector<Element *>children;
-
- std::vector<Attribute> attributes;
- std::vector<Namespace> namespaces;
-
- DOMString name;
- DOMString value;
-
-};
-
-
-
-
-
-class Parser
-{
-public:
- Parser()
- { init(); }
-
- virtual ~Parser()
- {}
-
- /**
- * Parse XML in a char buffer.
- * @param buf a character buffer to parse
- * @param pos position to start parsing
- * @param len number of chars, from pos, to parse.
- * @return a pointer to the root of the XML document;
- */
- Element *parse(const char *buf,int pos,int len);
-
- /**
- * Parse XML in a char buffer.
- * @param buf a character buffer to parse
- * @param pos position to start parsing
- * @param len number of chars, from pos, to parse.
- * @return a pointer to the root of the XML document;
- */
- Element *parse(const DOMString &buf);
-
- /**
- * Parse a named XML file. The file is loaded like a data file;
- * the original format is not preserved.
- * @param fileName the name of the file to read
- * @return a pointer to the root of the XML document;
- */
- Element *parseFile(const char *fileName);
-
-
-
-
-private:
-
- void init()
- {
- keepGoing = true;
- currentNode = NULL;
- parselen = 0;
- parsebuf = NULL;
- currentPosition = 0;
- }
-
- void getLineAndColumn(long pos, long *lineNr, long *colNr);
-
- void error(char *fmt, ...);
-
- int peek(long pos);
-
- int match(long pos, const char *text);
-
- int skipwhite(long p);
-
- int getWord(int p0, DOMString &buf);
-
- int getQuoted(int p0, DOMString &buf, int do_i_parse);
-
- int parseVersion(int p0);
-
- int parseDoctype(int p0);
-
- int parseElement(int p0, Element *par,int depth);
-
- Element *parse(XMLCh *buf,int pos,int len);
-
- bool keepGoing;
- Element *currentNode;
- long parselen;
- XMLCh *parsebuf;
- DOMString cdatabuf;
- long currentPosition;
- int colNr;
-
-
-};
-
-
-
-}//namespace MiniDom
-
-
-//########################################################################
-//# E N D O F F I L E
-//########################################################################
-
+#include <string>
+#include <vector>
+
+
+namespace MiniDom
+{
+typedef std::string DOMString;
+typedef unsigned int XMLCh;
+
+
+class Namespace
+{
+public:
+ Namespace()
+ {}
+
+ Namespace(const DOMString &prefixArg, const DOMString &namespaceURIArg)
+ {
+ prefix = prefixArg;
+ namespaceURI = namespaceURIArg;
+ }
+
+ Namespace(const Namespace &other)
+ {
+ prefix = other.prefix;
+ namespaceURI = other.namespaceURI;
+ }
+
+ virtual ~Namespace()
+ {}
+
+ virtual DOMString getPrefix()
+ { return prefix; }
+
+ virtual DOMString getNamespaceURI()
+ { return namespaceURI; }
+
+protected:
+
+ DOMString prefix;
+ DOMString namespaceURI;
+
+};
+
+class Attribute
+{
+public:
+ Attribute()
+ {}
+
+ Attribute(const DOMString &nameArg, const DOMString &valueArg)
+ {
+ name = nameArg;
+ value = valueArg;
+ }
+
+ Attribute(const Attribute &other)
+ {
+ name = other.name;
+ value = other.value;
+ }
+
+ virtual ~Attribute()
+ {}
+
+ virtual DOMString getName()
+ { return name; }
+
+ virtual DOMString getValue()
+ { return value; }
+
+protected:
+
+ DOMString name;
+ DOMString value;
+
+};
+
+
+class Element
+{
+friend class Parser;
+
+public:
+ Element()
+ {
+ parent = NULL;
+ }
+
+ Element(const DOMString &nameArg)
+ {
+ parent = NULL;
+ name = nameArg;
+ }
+
+ Element(const DOMString &nameArg, const DOMString &valueArg)
+ {
+ parent = NULL;
+ name = nameArg;
+ value = valueArg;
+ }
+
+ Element(const Element &other)
+ {
+ parent = other.parent;
+ children = other.children;
+ attributes = other.attributes;
+ namespaces = other.namespaces;
+ name = other.name;
+ value = other.value;
+ }
+
+ virtual ~Element()
+ {
+ for (unsigned int i=0 ; i<children.size() ; i++)
+ delete children[i];
+ }
+
+ virtual DOMString getName()
+ { return name; }
+
+ virtual DOMString getValue()
+ { return value; }
+
+ Element *getParent()
+ { return parent; }
+
+ std::vector<Element *> getChildren()
+ { return children; }
+
+ std::vector<Element *> findElements(const DOMString &name);
+
+ DOMString getAttribute(const DOMString &name);
+
+ void addChild(Element *child);
+
+ void addAttribute(const DOMString &name, const DOMString &value);
+
+ void addNamespace(const DOMString &prefix, const DOMString &namespaceURI);
+
+
+ /**
+ * Prettyprint an XML tree to an output stream. Elements are indented
+ * according to element hierarchy.
+ * @param f a stream to receive the output
+ * @param elem the element to output
+ */
+ void writeIndented(FILE *f);
+
+ /**
+ * Prettyprint an XML tree to standard output. This is the equivalent of
+ * writeIndented(stdout).
+ * @param elem the element to output
+ */
+ void print();
+
+protected:
+
+
+ void findElementsRecursive(std::vector<Element *>&res, const DOMString &name);
+
+ void writeIndentedRecursive(FILE *f, int indent);
+
+ Element *parent;
+
+ std::vector<Element *>children;
+
+ std::vector<Attribute> attributes;
+ std::vector<Namespace> namespaces;
+
+ DOMString name;
+ DOMString value;
+
+};
+
+
+
+
+
+class Parser
+{
+public:
+ Parser()
+ { init(); }
+
+ virtual ~Parser()
+ {}
+
+ /**
+ * Parse XML in a char buffer.
+ * @param buf a character buffer to parse
+ * @param pos position to start parsing
+ * @param len number of chars, from pos, to parse.
+ * @return a pointer to the root of the XML document;
+ */
+ Element *parse(const char *buf,int pos,int len);
+
+ /**
+ * Parse XML in a char buffer.
+ * @param buf a character buffer to parse
+ * @param pos position to start parsing
+ * @param len number of chars, from pos, to parse.
+ * @return a pointer to the root of the XML document;
+ */
+ Element *parse(const DOMString &buf);
+
+ /**
+ * Parse a named XML file. The file is loaded like a data file;
+ * the original format is not preserved.
+ * @param fileName the name of the file to read
+ * @return a pointer to the root of the XML document;
+ */
+ Element *parseFile(const char *fileName);
+
+
+
+
+private:
+
+ void init()
+ {
+ keepGoing = true;
+ currentNode = NULL;
+ parselen = 0;
+ parsebuf = NULL;
+ currentPosition = 0;
+ }
+
+ void getLineAndColumn(long pos, long *lineNr, long *colNr);
+
+ void error(char *fmt, ...);
+
+ int peek(long pos);
+
+ int match(long pos, const char *text);
+
+ int skipwhite(long p);
+
+ int getWord(int p0, DOMString &buf);
+
+ int getQuoted(int p0, DOMString &buf, int do_i_parse);
+
+ int parseVersion(int p0);
+
+ int parseDoctype(int p0);
+
+ int parseElement(int p0, Element *par,int depth);
+
+ Element *parse(XMLCh *buf,int pos,int len);
+
+ bool keepGoing;
+ Element *currentNode;
+ long parselen;
+ XMLCh *parsebuf;
+ DOMString cdatabuf;
+ long currentPosition;
+ int colNr;
+
+
+};
+
+
+
+}//namespace MiniDom
+
+
+//########################################################################
+//# E N D O F F I L E
+//########################################################################
+
diff --git a/src/dom/odf/SvgOdg.cpp b/src/dom/odf/SvgOdg.cpp
index f55114701..2b1161310 100644
--- a/src/dom/odf/SvgOdg.cpp
+++ b/src/dom/odf/SvgOdg.cpp
@@ -1,1551 +1,1551 @@
-/**
- *
- * This is a small experimental class for converting between
- * SVG and OpenDocument .odg files. This code is not intended
- * to be a permanent solution for SVG-to-ODG conversion. Rather,
- * it is a quick-and-easy test bed for ideas which will be later
- * recoded into C++.
- *
- * ---------------------------------------------------------------------
- *
- * SvgOdg - A program to experiment with conversions between SVG and ODG
- * Copyright (C) 2006 Bob Jamison
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * For more information, please write to rwjj@earthlink.net
- *
- */
-
-
-/**
- *
- */
-public class SvgOdg
-{
-
-
-
-/**
- * Namespace declarations
- */
-public static final String SVG_NS =
- "http://www.w3.org/2000/svg";
-public static final String XLINK_NS =
- "http://www.w3.org/1999/xlink";
-public static final String ODF_NS =
- "urn:oasis:names:tc:opendocument:xmlns:office:1.0";
-public static final String ODG_NS =
- "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0";
-public static final String ODSVG_NS =
- "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0";
-
-
-DecimalFormat nrfmt;
-//static final double pxToCm = 0.0339;
-static final double pxToCm = 0.0275;
-static final double piToRad = 0.0174532925;
-BufferedWriter out;
-BufferedReader in;
-int imageNr;
-int styleNr;
-
-//########################################################################
-//# M E S S A G E S
-//########################################################################
-
-/**
- *
- */
-void err(String msg)
-{
- System.out.println("SvgOdg ERROR:" + msg);
-}
-
-/**
- *
- */
-void trace(String msg)
-{
- System.out.println("SvgOdg:" + msg);
-}
-
-
-
-
-//########################################################################
-//# I N P U T / O U T P U T
-//########################################################################
-
-boolean po(String s)
-{
- try
- {
- out.write(s);
- }
- catch(IOException e)
- {
- return false;
- }
- return true;
-}
-
-//########################################################################
-//# U T I L I T Y
-//########################################################################
-
-public void dumpDocument(Document doc)
-{
- String s = "";
- try
- {
- TransformerFactory factory = TransformerFactory.newInstance();
- Transformer trans = factory.newTransformer();
- DOMSource source = new DOMSource(doc);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- StreamResult result = new StreamResult(bos);
- trans.transform(source, result);
- byte buf[] = bos.toByteArray();
- s = new String(buf);
- }
- catch (javax.xml.transform.TransformerException e)
- {
- }
- trace("doc:" + s);
-}
-
-
-//########################################################################
-//# I N N E R C L A S S ImageInfo
-//########################################################################
-public class ImageInfo
-{
-String name;
-String newName;
-byte buf[];
-
-public String getName()
-{
- return name;
-}
-
-public String getNewName()
-{
- return newName;
-}
-
-
-public byte[] getBuf()
-{
- return buf;
-}
-
-public ImageInfo(String name, String newName, byte buf[])
-{
- this.name = name;
- this.name = newName;
- this.buf = buf;
-}
-
-}
-//########################################################################
-//# I N N E R C L A S S StyleInfo
-//########################################################################
-public class StyleInfo
-{
-
-String name;
-public String getName()
-{
- return name;
-}
-
-String cssStyle;
-public String getCssStyle()
-{
- return cssStyle;
-}
-
-String stroke;
-public String getStroke()
-{
- return stroke;
-}
-
-String strokeColor;
-public String getStrokeColor()
-{
- return strokeColor;
-}
-
-String strokeWidth;
-public String getStrokeWidth()
-{
- return strokeWidth;
-}
-
-String fill;
-public String getFill()
-{
- return fill;
-}
-
-String fillColor;
-public String getFillColor()
-{
- return fillColor;
-}
-
-public StyleInfo(String name, String cssStyle)
-{
- this.name = name;
- this.cssStyle = cssStyle;
- fill = "none";
- stroke = "none";
-}
-
-}
-//########################################################################
-//# E N D I N N E R C L A S S E S
-//########################################################################
-
-
-
-
-//########################################################################
-//# V A R I A B L E S
-//########################################################################
-
-/**
- * ODF content.xml file
- */
-Document content;
-public Document getContent()
-{
- return content;
-}
-
-/**
- * ODF meta.xml file
- */
-Document meta;
-public Document getMeta()
-{
- return meta;
-}
-
-/**
- * SVG file
- */
-Document svg;
-public Document getSvg()
-{
- return svg;
-}
-
-/**
- * Loaded ODF or SVG images
- */
-ArrayList<ImageInfo> images;
-public ArrayList<ImageInfo> getImages()
-{
- return images;
-}
-
-/**
- * CSS styles
- */
-HashMap<String, StyleInfo> styles;
-public HashMap<String, StyleInfo> getStyles()
-{
- return styles;
-}
-
-
-
-
-
-//########################################################################
-//# S V G T O O D F
-//########################################################################
-
-class PathData
-{
-String cmd;
-double nr[];
-PathData(String s, double buf[])
-{
- cmd=s; nr = buf;
-}
-}
-
-double getPathNum(StringTokenizer st)
-{
- if (!st.hasMoreTokens())
- return 0.0;
- String s = st.nextToken();
- double nr = Double.parseDouble(s);
- return nr;
-}
-
-String parsePathData(String pathData, double bounds[])
-{
- double minx = Double.MAX_VALUE;
- double maxx = Double.MIN_VALUE;
- double miny = Double.MAX_VALUE;
- double maxy = Double.MIN_VALUE;
- //trace("#### pathData:" + pathData);
- ArrayList<PathData> data = new ArrayList<PathData>();
- StringTokenizer st = new StringTokenizer(pathData, " ,");
- while (true)
- {
- String s = st.nextToken();
- if ( s.equals("z") || s.equals("Z") )
- {
- PathData pd = new PathData(s, new double[0]);
- data.add(pd);
- break;
- }
- else if ( s.equals("h") || s.equals("H") )
- {
- double d[] = new double[1];
- d[0] = getPathNum(st) * pxToCm;
- if (d[0] < minx) minx = d[0];
- else if (d[0] > maxx) maxx = d[0];
- PathData pd = new PathData(s, d);
- data.add(pd);
- }
- else if ( s.equals("v") || s.equals("V") )
- {
- double d[] = new double[1];
- d[0] = getPathNum(st) * pxToCm;
- if (d[0] < miny) miny = d[0];
- else if (d[0] > maxy) maxy = d[0];
- PathData pd = new PathData(s, d);
- data.add(pd);
- }
- else if ( s.equals("m") || s.equals("M") ||
- s.equals("l") || s.equals("L") ||
- s.equals("t") || s.equals("T") )
- {
- double d[] = new double[2];
- d[0] = getPathNum(st) * pxToCm;
- d[1] = getPathNum(st) * pxToCm;
- if (d[0] < minx) minx = d[0];
- else if (d[0] > maxx) maxx = d[0];
- if (d[1] < miny) miny = d[1];
- else if (d[1] > maxy) maxy = d[1];
- PathData pd = new PathData(s, d);
- data.add(pd);
- }
- else if ( s.equals("q") || s.equals("Q") ||
- s.equals("s") || s.equals("S") )
- {
- double d[] = new double[4];
- d[0] = getPathNum(st) * pxToCm;
- d[1] = getPathNum(st) * pxToCm;
- if (d[0] < minx) minx = d[0];
- else if (d[0] > maxx) maxx = d[0];
- if (d[1] < miny) miny = d[1];
- else if (d[1] > maxy) maxy = d[1];
- d[2] = getPathNum(st) * pxToCm;
- d[3] = getPathNum(st) * pxToCm;
- if (d[2] < minx) minx = d[2];
- else if (d[2] > maxx) maxx = d[2];
- if (d[3] < miny) miny = d[3];
- else if (d[3] > maxy) maxy = d[3];
- PathData pd = new PathData(s, d);
- data.add(pd);
- }
- else if ( s.equals("c") || s.equals("C") )
- {
- double d[] = new double[6];
- d[0] = getPathNum(st) * pxToCm;
- d[1] = getPathNum(st) * pxToCm;
- if (d[0] < minx) minx = d[0];
- else if (d[0] > maxx) maxx = d[0];
- if (d[1] < miny) miny = d[1];
- else if (d[1] > maxy) maxy = d[1];
- d[2] = getPathNum(st) * pxToCm;
- d[3] = getPathNum(st) * pxToCm;
- if (d[2] < minx) minx = d[2];
- else if (d[2] > maxx) maxx = d[2];
- if (d[3] < miny) miny = d[3];
- else if (d[3] > maxy) maxy = d[3];
- d[4] = getPathNum(st) * pxToCm;
- d[5] = getPathNum(st) * pxToCm;
- if (d[4] < minx) minx = d[4];
- else if (d[4] > maxx) maxx = d[4];
- if (d[5] < miny) miny = d[5];
- else if (d[5] > maxy) maxy = d[5];
- PathData pd = new PathData(s, d);
- data.add(pd);
- }
- else if ( s.equals("a") || s.equals("A") )
- {
- double d[] = new double[6];
- d[0] = getPathNum(st) * pxToCm;
- d[1] = getPathNum(st) * pxToCm;
- if (d[0] < minx) minx = d[0];
- else if (d[0] > maxx) maxx = d[0];
- if (d[1] < miny) miny = d[1];
- else if (d[1] > maxy) maxy = d[1];
- d[2] = getPathNum(st) * piToRad;//angle
- d[3] = getPathNum(st) * piToRad;//angle
- d[4] = getPathNum(st) * pxToCm;
- d[5] = getPathNum(st) * pxToCm;
- if (d[4] < minx) minx = d[4];
- else if (d[4] > maxx) maxx = d[4];
- if (d[5] < miny) miny = d[5];
- else if (d[5] > maxy) maxy = d[5];
- PathData pd = new PathData(s, d);
- data.add(pd);
- }
- //trace("x:" + x + " y:" + y);
- }
-
- trace("minx:" + minx + " maxx:" + maxx +
- " miny:" + miny + " maxy:" + maxy);
-
- StringBuffer buf = new StringBuffer();
- for (PathData pd : data)
- {
- buf.append(pd.cmd);
- buf.append(" ");
- for (double d:pd.nr)
- {
- buf.append(nrfmt.format(d * 1000.0));
- buf.append(" ");
- }
- }
-
- bounds[0] = minx;
- bounds[1] = miny;
- bounds[2] = maxx;
- bounds[3] = maxy;
-
- return buf.toString();
-}
-
-
-
-boolean parseTransform(String transStr, AffineTransform trans)
-{
- trace("== transform:"+ transStr);
- StringTokenizer st = new StringTokenizer(transStr, ")");
- while (st.hasMoreTokens())
- {
- String chunk = st.nextToken();
- StringTokenizer st2 = new StringTokenizer(chunk, " ,(");
- if (!st2.hasMoreTokens())
- continue;
- String name = st2.nextToken();
- trace(" ++name:"+ name);
- if (name.equals("matrix"))
- {
- double v[] = new double[6];
- for (int i=0 ; i<6 ; i++)
- {
- if (!st2.hasMoreTokens())
- break;
- v[i] = Double.parseDouble(st2.nextToken()) * pxToCm;
- }
- AffineTransform mat = new AffineTransform(v);
- trans.concatenate(mat);
- }
- else if (name.equals("translate"))
- {
- double dx = 0.0;
- double dy = 0.0;
- if (!st2.hasMoreTokens())
- continue;
- dx = Double.parseDouble(st2.nextToken()) * pxToCm;
- if (st2.hasMoreTokens())
- dy = Double.parseDouble(st2.nextToken()) * pxToCm;
- trans.translate(dx, dy);
- }
- else if (name.equals("scale"))
- {
- double sx = 1.0;
- double sy = 1.0;
- if (!st2.hasMoreTokens())
- continue;
- sx = sy = Double.parseDouble(st2.nextToken());
- if (st2.hasMoreTokens())
- sy = Double.parseDouble(st2.nextToken());
- trans.scale(sx, sy);
- }
- else if (name.equals("rotate"))
- {
- double r = 0.0;
- double cx = 0.0;
- double cy = 0.0;
- if (!st2.hasMoreTokens())
- continue;
- r = Double.parseDouble(st2.nextToken()) * piToRad;
- if (st2.hasMoreTokens())
- {
- cx = Double.parseDouble(st2.nextToken()) * pxToCm;
- if (!st2.hasMoreTokens())
- continue;
- cy = Double.parseDouble(st2.nextToken()) * pxToCm;
- trans.rotate(r, cx, cy);
- }
- else
- {
- trans.rotate(r);
- }
- }
- else if (name.equals("skewX"))
- {
- double angle = 0.0;
- if (!st2.hasMoreTokens())
- continue;
- angle = Double.parseDouble(st2.nextToken());
- trans.shear(angle, 0.0);
- }
- else if (name.equals("skewY"))
- {
- double angle = 0.0;
- if (!st2.hasMoreTokens())
- continue;
- angle = Double.parseDouble(st2.nextToken());
- trans.shear(0.0, angle);
- }
- }
- return true;
-}
-
-
-
-String coordToOdg(String sval)
-{
- double nr = Double.parseDouble(sval);
- nr = nr * pxToCm;
- String s = nrfmt.format(nr) + "cm";
- return s;
-}
-
-
-boolean writeSvgAttributes(Element elem, AffineTransform trans)
-{
- NamedNodeMap attrs = elem.getAttributes();
- String ename = elem.getLocalName();
- for (int i=0 ; i<attrs.getLength() ; i++)
- {
- Attr attr = (Attr)attrs.item(i);
- String aname = attr.getName();
- String aval = attr.getValue();
- if (aname.startsWith("xmlns"))
- continue;
- else if (aname.equals("d"))//already handled
- continue;
- else if (aname.startsWith("transform"))
- {
- parseTransform(aval, trans);
- continue;
- }
- else if (aname.equals("style"))
- {
- StyleInfo style = styles.get(aval);
- if (style != null)
- {
- po(" draw:style-name=\"");
- po(style.getName());
- po("\"");
- }
- continue;
- }
- if (aname.equals("x") || aname.equals("y") ||
- aname.equals("width") || aname.equals("height"))
- {
- aval = coordToOdg(aval);
- }
- if ("id".equals(aname))
- po(" ");
- else if ("transform".equals(aname))
- po(" draw:");
- else
- po(" svg:");
- po(aname);
- po("=\"");
- po(aval);
- po("\"");
- }
-
- //Output the current transform
- if (!trans.isIdentity() &&
- !(
- ename.equals("g") ||
- ename.equals("defs") ||
- ename.equals("metadata")
- )
- )
- {
- double v[] = new double[6];
- trans.getMatrix(v);
- po(" draw:transform=\"matrix(" +
- nrfmt.format(v[0]) + "," +
- nrfmt.format(v[1]) + "," +
- nrfmt.format(v[2]) + "," +
- nrfmt.format(v[3]) + "," +
- nrfmt.format(v[4]) + "," +
- nrfmt.format(v[5]) + ")\"");
- }
- return true;
-}
-
-public boolean writeOdfContent(Element elem, AffineTransform trans)
-{
- String ns = elem.getNamespaceURI();
- String tagName = elem.getLocalName();
- //trace("ns:" + ns + " tagName:" + tagName);
- if (!ns.equals(SVG_NS))
- return true;
- if (tagName.equals("svg"))
- {
- NodeList children = elem.getChildNodes();
- for (int i=0 ; i<children.getLength() ; i++)
- {
- Node n = children.item(i);
- if (n.getNodeType() == Node.ELEMENT_NODE)
- if (!writeOdfContent((Element)n,
- (AffineTransform)trans.clone()))
- return false;
- }
- }
- else if (tagName.equals("g"))
- {
- //String transform = elem.getAttribute("transform");
- po("<draw:g");
- writeSvgAttributes(elem, trans); po(">\n");
- NodeList children = elem.getChildNodes();
- for (int i=0 ; i<children.getLength() ; i++)
- {
- Node n = children.item(i);
- if (n.getNodeType() == Node.ELEMENT_NODE)
- if (!writeOdfContent((Element)n,
- (AffineTransform)trans.clone()))
- return false;
- }
- po("</draw:g>\n");
- }
- else if (tagName.equals("text"))
- {
- String x = coordToOdg(elem.getAttribute("x"));
- String y = coordToOdg(elem.getAttribute("y"));
- String width = "5cm";
- String height = "2cm";
- String txt = elem.getTextContent();
- po("<draw:frame draw:style-name=\"grx1\" draw:layer=\"layout\" ");
- po("svg:x=\"" + x + "\" svg:y=\"" + y + "\" ");
- po("svg:width=\"" + width + "\" svg:height=\"" + height + "\"");
- po(">\n");
- po(" <draw:text-box draw:auto-grow-height=\"true\" draw:auto-grow-width=\"true\">\n");
- po(" <text:p text:style-name=\"P1\"> " + txt + "</text:p>\n");
- po(" </draw:text-box>\n");
- po("</draw:frame>\n");
- return true;
- }
- else if (tagName.equals("image"))
- {
- String x = coordToOdg(elem.getAttribute("x"));
- String y = coordToOdg(elem.getAttribute("y"));
- String width = coordToOdg(elem.getAttribute("width"));
- String height = coordToOdg(elem.getAttribute("height"));
- String imageName = elem.getAttributeNS(XLINK_NS, "href");
- po("<draw:frame draw:style-name=\"grx1\" draw:layer=\"layout\" ");
- po("svg:x=\"" + x + "\" svg:y=\"" + y + "\" ");
- po("svg:width=\"" + width + "\" svg:height=\"" + height + "\">\n");
- po(" <draw:image xlink:href=\"Pictures/" + imageName + "\" xlink:type=\"simple\" xlink:show=\"embed\" xlink:actuate=\"onLoad\"><text:p/></draw:image>\n");
- po("</draw:frame>\n");
- return true;
- }
- else if (tagName.equals("path"))
- {
- double bounds[] = new double[4];
- String d = elem.getAttribute("d");
- String newd = parsePathData(d, bounds);
- double x = bounds[0];
- double y = bounds[1];
- double width = (bounds[2]-bounds[0]);
- double height = (bounds[3]-bounds[1]);
- po("<draw:path draw:layer=\"layout\" \n");
- po(" svg:x=\"" + nrfmt.format(x) + "cm\" ");
- po("svg:y=\"" + nrfmt.format(y) + "cm\" ");
- po("svg:width=\"" + nrfmt.format(width) + "cm\" ");
- po("svg:height=\"" + nrfmt.format(height) + "cm\" ");
- po("svg:viewBox=\"0.0 0.0 " +
- nrfmt.format(bounds[2] * 1000.0) + " " +
- nrfmt.format(bounds[3] * 1000.0) + "\"\n");
- po(" svg:d=\"" + newd + "\"\n ");
-
- writeSvgAttributes(elem, trans); po("/>\n");
- //po(" svg:d=\"" + d + "\"/>\n");
- return true;
- }
-
- else
- {
- //Verbatim tab mapping
- po("<draw:"); po(tagName);
- writeSvgAttributes(elem, trans); po(">\n");
- po("</draw:"); po(tagName); po(">\n");
- }
-
- return true;
-}
-
-
-boolean writeOdfContent(ZipOutputStream outs)
-{
- try
- {
- ZipEntry ze = new ZipEntry("content.xml");
- outs.putNextEntry(ze);
- out = new BufferedWriter(new OutputStreamWriter(outs));
- }
- catch (IOException e)
- {
- return false;
- }
-
- NodeList res = svg.getElementsByTagNameNS(SVG_NS, "svg");
- if (res.getLength() < 1)
- {
- err("saveOdf: no <svg> root in .svg file");
- return false;
- }
- Element root = (Element)res.item(0);
-
-
- po("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
- po("<office:document-content\n");
- po(" xmlns:office=\"urn:oasis:names:tc:opendocument:xmlns:office:1.0\"\n");
- po(" xmlns:style=\"urn:oasis:names:tc:opendocument:xmlns:style:1.0\"\n");
- po(" xmlns:text=\"urn:oasis:names:tc:opendocument:xmlns:text:1.0\"\n");
- po(" xmlns:table=\"urn:oasis:names:tc:opendocument:xmlns:table:1.0\"\n");
- po(" xmlns:draw=\"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0\"\n");
- po(" xmlns:fo=\"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0\"\n");
- po(" xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n");
- po(" xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n");
- po(" xmlns:meta=\"urn:oasis:names:tc:opendocument:xmlns:meta:1.0\"\n");
- po(" xmlns:number=\"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0\"\n");
- po(" xmlns:presentation=\"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0\"\n");
- po(" xmlns:svg=\"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0\"\n");
- po(" xmlns:chart=\"urn:oasis:names:tc:opendocument:xmlns:chart:1.0\"\n");
- po(" xmlns:dr3d=\"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0\"\n");
- po(" xmlns:math=\"http://www.w3.org/1998/Math/MathML\"\n");
- po(" xmlns:form=\"urn:oasis:names:tc:opendocument:xmlns:form:1.0\"\n");
- po(" xmlns:script=\"urn:oasis:names:tc:opendocument:xmlns:script:1.0\"\n");
- po(" xmlns:ooo=\"http://openoffice.org/2004/office\"\n");
- po(" xmlns:ooow=\"http://openoffice.org/2004/writer\"\n");
- po(" xmlns:oooc=\"http://openoffice.org/2004/calc\"\n");
- po(" xmlns:dom=\"http://www.w3.org/2001/xml-events\"\n");
- po(" xmlns:xforms=\"http://www.w3.org/2002/xforms\"\n");
- po(" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n");
- po(" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n");
- po(" xmlns:smil=\"urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0\"\n");
- po(" xmlns:anim=\"urn:oasis:names:tc:opendocument:xmlns:animation:1.0\"\n");
- po(" office:version=\"1.0\">\n");
- po("\n");
- po("\n");
- po("<office:scripts/>\n");
- po("<office:automatic-styles>\n");
- po("<style:style style:name=\"dp1\" style:family=\"drawing-page\"/>\n");
- po("<style:style style:name=\"grx1\" style:family=\"graphic\" style:parent-style-name=\"standard\">\n");
- po(" <style:graphic-properties draw:stroke=\"none\" draw:fill=\"solid\" draw:textarea-horizontal-align=\"center\" draw:textarea-vertical-align=\"middle\" draw:color-mode=\"standard\" draw:luminance=\"0%\" draw:contrast=\"0%\" draw:gamma=\"100%\" draw:red=\"0%\" draw:green=\"0%\" draw:blue=\"0%\" fo:clip=\"rect(0cm 0cm 0cm 0cm)\" draw:image-opacity=\"100%\" style:mirror=\"none\"/>\n");
- po("</style:style>\n");
- po("<style:style style:name=\"P1\" style:family=\"paragraph\">\n");
- po(" <style:paragraph-properties fo:text-align=\"center\"/>\n");
- po("</style:style>\n");
-
- //## Dump our style table
- for (StyleInfo s : styles.values())
- {
- po("<style:style style:name=\"" + s.getName() + "\" style:family=\"graphic\" style:parent-style-name=\"standard\">\n");
- po(" <style:graphic-properties");
- po(" draw:fill=\"" + s.getFill() + "\"");
- if (!s.getFill().equals("none"))
- po(" draw:fill-color=\"" + s.getFillColor() + "\"");
- po(" draw:stroke=\"" + s.getStroke() + "\"");
- if (!s.getStroke().equals("none"))
- {
- po(" svg:stroke-width=\"" + s.getStrokeWidth() + "\"");
- po(" svg:stroke-color=\"" + s.getStrokeColor() + "\"");
- }
- po("/>\n");
- po("</style:style>\n");
- }
- po("</office:automatic-styles>\n");
- po("\n");
- po("\n");
- po("<office:body>\n");
- po("<office:drawing>\n");
- po("<draw:page draw:name=\"page1\" draw:style-name=\"dp1\" draw:master-page-name=\"Default\">\n");
- po("\n\n\n");
- AffineTransform trans = new AffineTransform();
- //trans.scale(12.0, 12.0);
- po("<!-- ######### CONVERSION FROM SVG STARTS ######## -->\n");
- writeOdfContent(root, trans);
- po("<!-- ######### CONVERSION FROM SVG ENDS ######## -->\n");
- po("\n\n\n");
-
- po("</draw:page>\n");
- po("</office:drawing>\n");
- po("</office:body>\n");
- po("</office:document-content>\n");
-
-
- try
- {
- out.flush();
- outs.closeEntry();
- }
- catch (IOException e)
- {
- err("writeOdfContent:" + e);
- return false;
- }
- return true;
-}
-
-boolean writeOdfMeta(ZipOutputStream outs)
-{
- try
- {
- ZipEntry ze = new ZipEntry("meta.xml");
- outs.putNextEntry(ze);
- out = new BufferedWriter(new OutputStreamWriter(outs));
- }
- catch (IOException e)
- {
- return false;
- }
-
- po("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
- po("<office:document-meta\n");
- po(" xmlns:office=\"urn:oasis:names:tc:opendocument:xmlns:office:1.0\"\n");
- po(" xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n");
- po(" xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n");
- po(" xmlns:meta=\"urn:oasis:names:tc:opendocument:xmlns:meta:1.0\"\n");
- po(" xmlns:presentation=\"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0\"\n");
- po(" xmlns:ooo=\"http://openoffice.org/2004/office\"\n");
- po(" xmlns:smil=\"urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0\"\n");
- po(" xmlns:anim=\"urn:oasis:names:tc:opendocument:xmlns:animation:1.0\"\n");
- po(" office:version=\"1.0\">\n");
- po("<office:meta>\n");
- po(" <meta:generator>Inkscape-0.43</meta:generator>\n");
- po(" <meta:initial-creator>clark kent</meta:initial-creator>\n");
- po(" <meta:creation-date>2005-12-10T10:55:13</meta:creation-date>\n");
- po(" <dc:creator>clark kent</dc:creator>\n");
- po(" <dc:date>2005-12-10T10:56:20</dc:date>\n");
- po(" <dc:language>en-US</dc:language>\n");
- po(" <meta:editing-cycles>2</meta:editing-cycles>\n");
- po(" <meta:editing-duration>PT1M13S</meta:editing-duration>\n");
- po(" <meta:user-defined meta:name=\"Info 1\"/>\n");
- po(" <meta:user-defined meta:name=\"Info 2\"/>\n");
- po(" <meta:user-defined meta:name=\"Info 3\"/>\n");
- po(" <meta:user-defined meta:name=\"Info 4\"/>\n");
- po(" <meta:document-statistic meta:object-count=\"2\"/>\n");
- po("</office:meta>\n");
- po("</office:document-meta>\n");
-
-
- try
- {
- out.flush();
- outs.closeEntry();
- }
- catch (IOException e)
- {
- err("writeOdfContent:" + e);
- return false;
- }
- return true;
-}
-
-
-boolean writeOdfManifest(ZipOutputStream outs)
-{
- try
- {
- ZipEntry ze = new ZipEntry("META-INF/manifest.xml");
- outs.putNextEntry(ze);
- out = new BufferedWriter(new OutputStreamWriter(outs));
- }
- catch (IOException e)
- {
- return false;
- }
-
- po("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
- po("<!DOCTYPE manifest:manifest PUBLIC \"-//OpenOffice.org//DTD Manifest 1.0//EN\" \"Manifest.dtd\">\n");
- po("<manifest:manifest xmlns:manifest=\"urn:oasis:names:tc:opendocument:xmlns:manifest:1.0\">\n");
- po(" <manifest:file-entry manifest:media-type=\"application/vnd.oasis.opendocument.graphics\" manifest:full-path=\"/\"/>\n");
- po(" <manifest:file-entry manifest:media-type=\"text/xml\" manifest:full-path=\"content.xml\"/>\n");
- po(" <manifest:file-entry manifest:media-type=\"text/xml\" manifest:full-path=\"meta.xml\"/>\n");
- po(" <!--List our images here-->\n");
- for (int i=0 ; i<images.size() ; i++)
- {
- ImageInfo ie = images.get(i);
- String fname = ie.getName();
- if (fname.length() < 5)
- {
- err("image file name too short:" + fname);
- return false;
- }
- String ext = fname.substring(fname.length() - 4);
- po(" <manifest:file-entry manifest:media-type=\"");
- if (ext.equals(".gif"))
- po("image/gif");
- else if (ext.equals(".png"))
- po("image/png");
- else if (ext.equals(".jpg") || ext.equals(".jpeg"))
- po("image/jpeg");
- po("\" manifest:full-path=\"");
- po(fname);
- po("\"/>\n");
- }
- po("</manifest:manifest>\n");
-
- try
- {
- out.flush();
- outs.closeEntry();
- }
- catch (IOException e)
- {
- err("writeOdfContent:" + e);
- return false;
- }
- return true;
-}
-
-boolean writeOdfImages(ZipOutputStream outs)
-{
- for (int i=0 ; i<images.size() ; i++)
- {
- ImageInfo ie = images.get(i);
- try
- {
- String iname = "Pictures/" + ie.getName();
- ZipEntry ze = new ZipEntry(iname);
- outs.putNextEntry(ze);
- outs.write(ie.getBuf());
- outs.closeEntry();
- }
- catch (IOException e)
- {
- err("writing images:" + e);
- return false;
- }
- }
- return true;
-}
-
-/**
- *
- */
-public boolean writeOdf(OutputStream outs)
-{
- try
- {
- ZipOutputStream zos = new ZipOutputStream(outs);
- if (!writeOdfContent(zos))
- return false;
- if (!writeOdfManifest(zos))
- return false;
- if (!writeOdfMeta(zos))
- return false;
- if (!writeOdfImages(zos))
- return false;
- //if (!writeOdfStyles(zos))
- // return false;
- zos.close();
- }
- catch (IOException e)
- {
- err("closing ODF zip output stream:" + e);
- return false;
- }
- return true;
-}
-
-
-
-/**
- *
- */
-public boolean saveOdf(String fileName)
-{
- boolean ret = true;
- try
- {
- FileOutputStream fos = new FileOutputStream(fileName);
- ret = writeOdf(fos);
- fos.close();
- }
- catch (IOException e)
- {
- err("writing odf " + fileName + " : " + e);
- return false;
- }
- return ret;
-}
-
-
-
-boolean parseCss(String css)
-{
- trace("##### STYLE ### :" + css);
- String name = "gr" + styleNr;
- styleNr++;
- StyleInfo si = new StyleInfo(name, css);
- StringTokenizer st = new StringTokenizer(css, ";");
- while (st.hasMoreTokens())
- {
- String style = st.nextToken();
- //trace(" " + style);
- int pos = style.indexOf(':');
- if (pos < 1 || pos > style.length()-2)
- continue;
- String attrName = style.substring(0, pos);
- String attrVal = style.substring(pos+1);
- trace(" =" + attrName + ':' + attrVal);
- if ("stroke".equals(attrName))
- {
- si.stroke = "solid";
- si.strokeColor = attrVal;
- }
- else if ("stroke-width".equals(attrName))
- {
- si.strokeWidth = attrVal;
- }
- else if ("fill".equals(attrName))
- {
- si.fill = "solid";
- si.fillColor = attrVal;
- }
- }
- styles.put(css, si);
- return true;
-}
-
-boolean readSvg(InputStream ins)
-{
- //### LOAD XML
- try
- {
- DocumentBuilderFactory factory =
- DocumentBuilderFactory.newInstance();
- factory.setNamespaceAware(true);
- DocumentBuilder builder =
- factory.newDocumentBuilder();
- builder.setEntityResolver(new EntityResolver()
- {
- public InputSource resolveEntity(String publicId, String systemId)
- {
- return new InputSource(new ByteArrayInputStream(new byte[0]));
- }
- });
- Document doc = builder.parse(ins);
- svg = doc;
- }
- catch (javax.xml.parsers.ParserConfigurationException e)
- {
- err("making DOM parser:"+e);
- return false;
- }
- catch (org.xml.sax.SAXException e)
- {
- err("parsing svg document:"+e);
- return false;
- }
- catch (IOException e)
- {
- err("parsing svg document:"+e);
- return false;
- }
- //dumpDocument(svg);
-
- //### LOAD IMAGES
- imageNr = 0;
- images = new ArrayList<ImageInfo>();
- NodeList res = svg.getElementsByTagNameNS(SVG_NS, "image");
- for (int i=0 ; i<res.getLength() ; i++)
- {
- Element elem = (Element) res.item(i);
- String fileName = elem.getAttributeNS(XLINK_NS, "href");
- if (fileName == null)
- {
- err("No xlink:href pointer to image data for image");
- return false;
- }
- File f = new File(fileName);
- if (!f.exists())
- {
- err("image '" + fileName + "' does not exist");
- return false;
- }
- int bufSize = (int)f.length();
- byte buf[] = new byte[bufSize];
- int pos = 0;
- try
- {
- FileInputStream fis = new FileInputStream(fileName);
- while (pos < bufSize)
- {
- int len = fis.read(buf, pos, bufSize - pos);
- if (len < 0)
- break;
- pos += len;
- }
- fis.close();
- }
- catch (IOException e)
- {
- err("reading image '" + fileName + "' :" + e);
- return false;
- }
- if (pos != bufSize)
- {
- err("reading image entry. expected " +
- bufSize + ", found " + pos + " bytes.");
- return false;
- }
- ImageInfo ie = new ImageInfo(fileName, fileName, buf);
- images.add(ie);
- }
-
- //### Parse styles
- styleNr = 0;
- styles = new HashMap<String, StyleInfo>();
- res = svg.getElementsByTagName("*");
- for (int i=0 ; i<res.getLength() ; i++)
- {
- Element elem = (Element) res.item(i);
- trace("elem:"+ elem.getNodeName());
- String style = elem.getAttribute("style");
- if (style != null && style.length() > 0)
- parseCss(style);
- }
-
- return true;
-}
-
-boolean readSvg(String fileName)
-{
- try
- {
- FileInputStream fis = new FileInputStream(fileName);
- if (!readSvg(fis))
- return false;
- fis.close();
- }
- catch (IOException e)
- {
- err("opening svg file:"+e);
- return false;
- }
- return true;
-}
-
-
-//########################################################################
-//# O D F T O S V G
-//########################################################################
-
-/**
- *
- */
-public boolean readOdfEntry(ZipInputStream zis, ZipEntry ent)
-{
- String fileName = ent.getName();
- trace("fileName:" + fileName);
- if (fileName.length() < 4)
- return true;
- String ext = fileName.substring(fileName.length() - 4);
- trace("ext:" + ext);
- ArrayList<Byte> arr = new ArrayList<Byte>();
- try
- {
- while (true)
- {
- int inb = zis.read();
- if (inb < 0)
- break;
- arr.add((byte)inb);
- }
- }
- catch (IOException e)
- {
- return false;
- }
- byte buf[] = new byte[arr.size()];
- for (int i=0 ; i<buf.length ; i++)
- buf[i] = arr.get(i);
- trace("bufsize:" + buf.length);
-
- if (ext.equals(".xml"))
- {
- try
- {
- DocumentBuilderFactory factory =
- DocumentBuilderFactory.newInstance();
- factory.setNamespaceAware(true);
- DocumentBuilder builder =
- factory.newDocumentBuilder();
- builder.setEntityResolver(new EntityResolver()
- {
- public InputSource resolveEntity(String publicId, String systemId)
- {
- return new InputSource(new ByteArrayInputStream(new byte[0]));
- }
- });
- //trace("doc:"+new String(buf));
- Document doc = builder.parse(new ByteArrayInputStream(buf));
- if (fileName.equals("content.xml"))
- content = doc;
- else if (fileName.equals("meta.xml"))
- meta = doc;
- else if (fileName.equals("styles.xml"))
- {
- //styles = doc;
- }
- }
- catch (javax.xml.parsers.ParserConfigurationException e)
- {
- err("making DOM parser:"+e);
- return false;
- }
- catch (org.xml.sax.SAXException e)
- {
- err("parsing document:"+e);
- return false;
- }
- catch (IOException e)
- {
- err("parsing document:"+e);
- return false;
- }
- }
- else if (ext.equals(".png") ||
- ext.equals(".gif") ||
- ext.equals(".jpg") ||
- ext.equals(".jpeg") )
- {
- String imageName = "image" + imageNr + ext;
- imageNr++;
- ImageInfo ie = new ImageInfo(fileName, imageName, buf);
- trace("added image '" + imageName + "'. " + buf.length +" bytes.");
- images.add(ie);
-
- }
- dumpDocument(content);
- return true;
-}
-
-
-/**
- *
- */
-public boolean readOdf(InputStream ins)
-{
- imageNr = 0;
- images = new ArrayList<ImageInfo>();
- styleNr = 0;
- styles = new HashMap<String, StyleInfo>();
- ZipInputStream zis = new ZipInputStream(ins);
- while (true)
- {
- try
- {
- ZipEntry ent = zis.getNextEntry();
- if (ent == null)
- break;
- if (!readOdfEntry(zis, ent))
- return false;
- zis.closeEntry();
- }
- catch (IOException e)
- {
- err("reading zip entry");
- return false;
- }
- }
-
- return true;
-}
-
-
-/**
- *
- */
-public boolean readOdf(String fileName)
-{
- boolean ret = true;
- try
- {
- FileInputStream fis = new FileInputStream(fileName);
- ret = readOdf(fis);
- fis.close();
- }
- catch (IOException e)
- {
- err("reading " + fileName + " : " + e);
- ret = false;
- }
- return true;
-}
-
-
-
-
-public boolean writeSvgElement(Element elem)
-{
- String ns = elem.getNamespaceURI();
- String tagName = elem.getLocalName();
- trace("tag:" + tagName + " : " + ns);
- if (ns.equals(ODSVG_NS))
- {
- po("<"); po(tagName);
- NamedNodeMap attrs = elem.getAttributes();
- for (int i=0 ; i<attrs.getLength() ; i++)
- {
- Attr attr = (Attr)attrs.item(i);
- String aname = attr.getName();
- String aval = attr.getValue();
- //Replace image name
- if ("xlink:href".equals(aname) && "image".equals(tagName))
- {
- for (int j=0 ; j<images.size() ; j++)
- {
- ImageInfo ie = images.get(i);
- if (aval.equals(ie.getName()))
- aval = ie.getNewName();
- }
- }
- po(" ");
- po(aname);
- po("=\"");
- po(aval);
- po("\"");
- }
- po(">\n");
- }
- NodeList children = elem.getChildNodes();
- for (int i=0 ; i<children.getLength() ; i++)
- {
- Node n = children.item(i);
- if (n.getNodeType() == Node.ELEMENT_NODE)
- if (!writeSvgElement((Element)n))
- return false;
- }
- if (ns.equals(ODSVG_NS))
- {
- po("</"); po(tagName); po(">\n");
- }
- return true;
-}
-
-
-public boolean saveSvg(String svgFileName)
-{
- trace("====== Saving images ===========");
- try
- {
- for (int i=0 ; i<images.size() ; i++)
- {
- ImageInfo entry = images.get(i);
- trace("saving:" + entry.name);
- FileOutputStream fos = new FileOutputStream(entry.name);
- fos.write(entry.buf);
- fos.close();
- }
- }
- catch (IOException e)
- {
- err("saveAsSVG:" + e);
- return false;
- }
-
- try
- {
- out = new BufferedWriter(new FileWriter(svgFileName));
- }
- catch (IOException e)
- {
- err("save:" + e);
- return false;
- }
-
- if (content == null)
- {
- err("no content in odf");
- return false;
- }
-
- NodeList res = content.getElementsByTagNameNS(ODF_NS, "drawing");
- if (res.getLength() < 1)
- {
- err("save: no drawing in document");
- return false;
- }
- Element root = (Element)res.item(0);
- trace("NS:"+root.getNamespaceURI());
-
- res = root.getElementsByTagNameNS(ODG_NS, "page");
- if (res.getLength() < 1)
- {
- err("save: no page in drawing");
- return false;
- }
- Element page = (Element)res.item(0);
-
- po("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
- po("<svg\n");
- po(" xmlns:svg=\"http://www.w3.org/2000/svg\"\n");
- po(" xmlns=\"http://www.w3.org/2000/svg\"\n");
- po(" xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n");
- po(" version=\"1.0\"\n");
- po(" >\n");
-
- writeSvgElement(page);
-
- po("</svg>\n");
-
- try
- {
- out.close();
- }
- catch (IOException e)
- {
- err("save:close:" + e);
- return false;
- }
- return true;
-}
-
-
-
-//########################################################################
-//# C O N S T R U C T O R
-//########################################################################
-
-SvgOdg()
-{
- //init, if necessary
- nrfmt = new DecimalFormat("#.####");
-}
-
-
-//########################################################################
-//# C O M M A N D L I N E
-//########################################################################
-
-public boolean odfToSvg(String odfName, String svgName)
-{
- if (!readOdf(odfName))
- return false;
- if (!saveSvg(svgName))
- return false;
- return true;
-}
-
-public boolean svgToOdf(String svgName, String odfName)
-{
- if (!readSvg(svgName))
- return false;
- System.out.println("ok");
- if (!saveOdf(odfName))
- return false;
- return true;
-}
-
-void usage()
-{
- System.out.println("usage: SvgOdf input_file.odg output_file.svg");
- System.out.println(" SvgOdf input_file.svg output_file.odg");
-}
-
-
-boolean parseArguments(String argv[])
-{
- if (argv.length != 2)
- {
- usage();
- return false;
- }
-
- String fileName1 = argv[0];
- String fileName2 = argv[1];
-
- if (fileName1.length()<5 || fileName2.length()<5)
- {
- System.out.println("one or more file names is too short");
- usage();
- return false;
- }
-
- String ext1 = fileName1.substring(fileName1.length()-4);
- String ext2 = fileName2.substring(fileName2.length()-4);
- //System.out.println("ext1:"+ext1+" ext2:"+ext2);
-
- //##### ODG -> SVG #####
- if ((ext1.equals(".odg") || ext1.equals(".odf") || ext1.equals(".zip") ) &&
- ext2.equals(".svg"))
- {
- if (!odfToSvg(argv[0], argv[1]))
- {
- System.out.println("Conversion from ODG to SVG failed");
- return false;
- }
- }
-
- //##### SVG -> ODG #####
- else if (ext1.equals(".svg") &&
- ( ext2.equals(".odg") || ext2.equals(".odf") || ext2.equals(".zip") ) )
- {
- if (!svgToOdf(fileName1, fileName2))
- {
- System.out.println("Conversion from SVG to ODG failed");
- return false;
- }
- }
-
- //##### none of the above #####
- else
- {
- usage();
- return false;
- }
- return true;
-}
-
-
-public static void main(String argv[])
-{
- SvgOdg svgodg = new SvgOdg();
- svgodg.parseArguments(argv);
-}
-
-
-}
-
-//########################################################################
-//# E N D O F F I L E
-//########################################################################
-
+/**
+ *
+ * This is a small experimental class for converting between
+ * SVG and OpenDocument .odg files. This code is not intended
+ * to be a permanent solution for SVG-to-ODG conversion. Rather,
+ * it is a quick-and-easy test bed for ideas which will be later
+ * recoded into C++.
+ *
+ * ---------------------------------------------------------------------
+ *
+ * SvgOdg - A program to experiment with conversions between SVG and ODG
+ * Copyright (C) 2006 Bob Jamison
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * For more information, please write to rwjj@earthlink.net
+ *
+ */
+
+
+/**
+ *
+ */
+public class SvgOdg
+{
+
+
+
+/**
+ * Namespace declarations
+ */
+public static final String SVG_NS =
+ "http://www.w3.org/2000/svg";
+public static final String XLINK_NS =
+ "http://www.w3.org/1999/xlink";
+public static final String ODF_NS =
+ "urn:oasis:names:tc:opendocument:xmlns:office:1.0";
+public static final String ODG_NS =
+ "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0";
+public static final String ODSVG_NS =
+ "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0";
+
+
+DecimalFormat nrfmt;
+//static final double pxToCm = 0.0339;
+static final double pxToCm = 0.0275;
+static final double piToRad = 0.0174532925;
+BufferedWriter out;
+BufferedReader in;
+int imageNr;
+int styleNr;
+
+//########################################################################
+//# M E S S A G E S
+//########################################################################
+
+/**
+ *
+ */
+void err(String msg)
+{
+ System.out.println("SvgOdg ERROR:" + msg);
+}
+
+/**
+ *
+ */
+void trace(String msg)
+{
+ System.out.println("SvgOdg:" + msg);
+}
+
+
+
+
+//########################################################################
+//# I N P U T / O U T P U T
+//########################################################################
+
+boolean po(String s)
+{
+ try
+ {
+ out.write(s);
+ }
+ catch(IOException e)
+ {
+ return false;
+ }
+ return true;
+}
+
+//########################################################################
+//# U T I L I T Y
+//########################################################################
+
+public void dumpDocument(Document doc)
+{
+ String s = "";
+ try
+ {
+ TransformerFactory factory = TransformerFactory.newInstance();
+ Transformer trans = factory.newTransformer();
+ DOMSource source = new DOMSource(doc);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ StreamResult result = new StreamResult(bos);
+ trans.transform(source, result);
+ byte buf[] = bos.toByteArray();
+ s = new String(buf);
+ }
+ catch (javax.xml.transform.TransformerException e)
+ {
+ }
+ trace("doc:" + s);
+}
+
+
+//########################################################################
+//# I N N E R C L A S S ImageInfo
+//########################################################################
+public class ImageInfo
+{
+String name;
+String newName;
+byte buf[];
+
+public String getName()
+{
+ return name;
+}
+
+public String getNewName()
+{
+ return newName;
+}
+
+
+public byte[] getBuf()
+{
+ return buf;
+}
+
+public ImageInfo(String name, String newName, byte buf[])
+{
+ this.name = name;
+ this.name = newName;
+ this.buf = buf;
+}
+
+}
+//########################################################################
+//# I N N E R C L A S S StyleInfo
+//########################################################################
+public class StyleInfo
+{
+
+String name;
+public String getName()
+{
+ return name;
+}
+
+String cssStyle;
+public String getCssStyle()
+{
+ return cssStyle;
+}
+
+String stroke;
+public String getStroke()
+{
+ return stroke;
+}
+
+String strokeColor;
+public String getStrokeColor()
+{
+ return strokeColor;
+}
+
+String strokeWidth;
+public String getStrokeWidth()
+{
+ return strokeWidth;
+}
+
+String fill;
+public String getFill()
+{
+ return fill;
+}
+
+String fillColor;
+public String getFillColor()
+{
+ return fillColor;
+}
+
+public StyleInfo(String name, String cssStyle)
+{
+ this.name = name;
+ this.cssStyle = cssStyle;
+ fill = "none";
+ stroke = "none";
+}
+
+}
+//########################################################################
+//# E N D I N N E R C L A S S E S
+//########################################################################
+
+
+
+
+//########################################################################
+//# V A R I A B L E S
+//########################################################################
+
+/**
+ * ODF content.xml file
+ */
+Document content;
+public Document getContent()
+{
+ return content;
+}
+
+/**
+ * ODF meta.xml file
+ */
+Document meta;
+public Document getMeta()
+{
+ return meta;
+}
+
+/**
+ * SVG file
+ */
+Document svg;
+public Document getSvg()
+{
+ return svg;
+}
+
+/**
+ * Loaded ODF or SVG images
+ */
+ArrayList<ImageInfo> images;
+public ArrayList<ImageInfo> getImages()
+{
+ return images;
+}
+
+/**
+ * CSS styles
+ */
+HashMap<String, StyleInfo> styles;
+public HashMap<String, StyleInfo> getStyles()
+{
+ return styles;
+}
+
+
+
+
+
+//########################################################################
+//# S V G T O O D F
+//########################################################################
+
+class PathData
+{
+String cmd;
+double nr[];
+PathData(String s, double buf[])
+{
+ cmd=s; nr = buf;
+}
+}
+
+double getPathNum(StringTokenizer st)
+{
+ if (!st.hasMoreTokens())
+ return 0.0;
+ String s = st.nextToken();
+ double nr = Double.parseDouble(s);
+ return nr;
+}
+
+String parsePathData(String pathData, double bounds[])
+{
+ double minx = Double.MAX_VALUE;
+ double maxx = Double.MIN_VALUE;
+ double miny = Double.MAX_VALUE;
+ double maxy = Double.MIN_VALUE;
+ //trace("#### pathData:" + pathData);
+ ArrayList<PathData> data = new ArrayList<PathData>();
+ StringTokenizer st = new StringTokenizer(pathData, " ,");
+ while (true)
+ {
+ String s = st.nextToken();
+ if ( s.equals("z") || s.equals("Z") )
+ {
+ PathData pd = new PathData(s, new double[0]);
+ data.add(pd);
+ break;
+ }
+ else if ( s.equals("h") || s.equals("H") )
+ {
+ double d[] = new double[1];
+ d[0] = getPathNum(st) * pxToCm;
+ if (d[0] < minx) minx = d[0];
+ else if (d[0] > maxx) maxx = d[0];
+ PathData pd = new PathData(s, d);
+ data.add(pd);
+ }
+ else if ( s.equals("v") || s.equals("V") )
+ {
+ double d[] = new double[1];
+ d[0] = getPathNum(st) * pxToCm;
+ if (d[0] < miny) miny = d[0];
+ else if (d[0] > maxy) maxy = d[0];
+ PathData pd = new PathData(s, d);
+ data.add(pd);
+ }
+ else if ( s.equals("m") || s.equals("M") ||
+ s.equals("l") || s.equals("L") ||
+ s.equals("t") || s.equals("T") )
+ {
+ double d[] = new double[2];
+ d[0] = getPathNum(st) * pxToCm;
+ d[1] = getPathNum(st) * pxToCm;
+ if (d[0] < minx) minx = d[0];
+ else if (d[0] > maxx) maxx = d[0];
+ if (d[1] < miny) miny = d[1];
+ else if (d[1] > maxy) maxy = d[1];
+ PathData pd = new PathData(s, d);
+ data.add(pd);
+ }
+ else if ( s.equals("q") || s.equals("Q") ||
+ s.equals("s") || s.equals("S") )
+ {
+ double d[] = new double[4];
+ d[0] = getPathNum(st) * pxToCm;
+ d[1] = getPathNum(st) * pxToCm;
+ if (d[0] < minx) minx = d[0];
+ else if (d[0] > maxx) maxx = d[0];
+ if (d[1] < miny) miny = d[1];
+ else if (d[1] > maxy) maxy = d[1];
+ d[2] = getPathNum(st) * pxToCm;
+ d[3] = getPathNum(st) * pxToCm;
+ if (d[2] < minx) minx = d[2];
+ else if (d[2] > maxx) maxx = d[2];
+ if (d[3] < miny) miny = d[3];
+ else if (d[3] > maxy) maxy = d[3];
+ PathData pd = new PathData(s, d);
+ data.add(pd);
+ }
+ else if ( s.equals("c") || s.equals("C") )
+ {
+ double d[] = new double[6];
+ d[0] = getPathNum(st) * pxToCm;
+ d[1] = getPathNum(st) * pxToCm;
+ if (d[0] < minx) minx = d[0];
+ else if (d[0] > maxx) maxx = d[0];
+ if (d[1] < miny) miny = d[1];
+ else if (d[1] > maxy) maxy = d[1];
+ d[2] = getPathNum(st) * pxToCm;
+ d[3] = getPathNum(st) * pxToCm;
+ if (d[2] < minx) minx = d[2];
+ else if (d[2] > maxx) maxx = d[2];
+ if (d[3] < miny) miny = d[3];
+ else if (d[3] > maxy) maxy = d[3];
+ d[4] = getPathNum(st) * pxToCm;
+ d[5] = getPathNum(st) * pxToCm;
+ if (d[4] < minx) minx = d[4];
+ else if (d[4] > maxx) maxx = d[4];
+ if (d[5] < miny) miny = d[5];
+ else if (d[5] > maxy) maxy = d[5];
+ PathData pd = new PathData(s, d);
+ data.add(pd);
+ }
+ else if ( s.equals("a") || s.equals("A") )
+ {
+ double d[] = new double[6];
+ d[0] = getPathNum(st) * pxToCm;
+ d[1] = getPathNum(st) * pxToCm;
+ if (d[0] < minx) minx = d[0];
+ else if (d[0] > maxx) maxx = d[0];
+ if (d[1] < miny) miny = d[1];
+ else if (d[1] > maxy) maxy = d[1];
+ d[2] = getPathNum(st) * piToRad;//angle
+ d[3] = getPathNum(st) * piToRad;//angle
+ d[4] = getPathNum(st) * pxToCm;
+ d[5] = getPathNum(st) * pxToCm;
+ if (d[4] < minx) minx = d[4];
+ else if (d[4] > maxx) maxx = d[4];
+ if (d[5] < miny) miny = d[5];
+ else if (d[5] > maxy) maxy = d[5];
+ PathData pd = new PathData(s, d);
+ data.add(pd);
+ }
+ //trace("x:" + x + " y:" + y);
+ }
+
+ trace("minx:" + minx + " maxx:" + maxx +
+ " miny:" + miny + " maxy:" + maxy);
+
+ StringBuffer buf = new StringBuffer();
+ for (PathData pd : data)
+ {
+ buf.append(pd.cmd);
+ buf.append(" ");
+ for (double d:pd.nr)
+ {
+ buf.append(nrfmt.format(d * 1000.0));
+ buf.append(" ");
+ }
+ }
+
+ bounds[0] = minx;
+ bounds[1] = miny;
+ bounds[2] = maxx;
+ bounds[3] = maxy;
+
+ return buf.toString();
+}
+
+
+
+boolean parseTransform(String transStr, AffineTransform trans)
+{
+ trace("== transform:"+ transStr);
+ StringTokenizer st = new StringTokenizer(transStr, ")");
+ while (st.hasMoreTokens())
+ {
+ String chunk = st.nextToken();
+ StringTokenizer st2 = new StringTokenizer(chunk, " ,(");
+ if (!st2.hasMoreTokens())
+ continue;
+ String name = st2.nextToken();
+ trace(" ++name:"+ name);
+ if (name.equals("matrix"))
+ {
+ double v[] = new double[6];
+ for (int i=0 ; i<6 ; i++)
+ {
+ if (!st2.hasMoreTokens())
+ break;
+ v[i] = Double.parseDouble(st2.nextToken()) * pxToCm;
+ }
+ AffineTransform mat = new AffineTransform(v);
+ trans.concatenate(mat);
+ }
+ else if (name.equals("translate"))
+ {
+ double dx = 0.0;
+ double dy = 0.0;
+ if (!st2.hasMoreTokens())
+ continue;
+ dx = Double.parseDouble(st2.nextToken()) * pxToCm;
+ if (st2.hasMoreTokens())
+ dy = Double.parseDouble(st2.nextToken()) * pxToCm;
+ trans.translate(dx, dy);
+ }
+ else if (name.equals("scale"))
+ {
+ double sx = 1.0;
+ double sy = 1.0;
+ if (!st2.hasMoreTokens())
+ continue;
+ sx = sy = Double.parseDouble(st2.nextToken());
+ if (st2.hasMoreTokens())
+ sy = Double.parseDouble(st2.nextToken());
+ trans.scale(sx, sy);
+ }
+ else if (name.equals("rotate"))
+ {
+ double r = 0.0;
+ double cx = 0.0;
+ double cy = 0.0;
+ if (!st2.hasMoreTokens())
+ continue;
+ r = Double.parseDouble(st2.nextToken()) * piToRad;
+ if (st2.hasMoreTokens())
+ {
+ cx = Double.parseDouble(st2.nextToken()) * pxToCm;
+ if (!st2.hasMoreTokens())
+ continue;
+ cy = Double.parseDouble(st2.nextToken()) * pxToCm;
+ trans.rotate(r, cx, cy);
+ }
+ else
+ {
+ trans.rotate(r);
+ }
+ }
+ else if (name.equals("skewX"))
+ {
+ double angle = 0.0;
+ if (!st2.hasMoreTokens())
+ continue;
+ angle = Double.parseDouble(st2.nextToken());
+ trans.shear(angle, 0.0);
+ }
+ else if (name.equals("skewY"))
+ {
+ double angle = 0.0;
+ if (!st2.hasMoreTokens())
+ continue;
+ angle = Double.parseDouble(st2.nextToken());
+ trans.shear(0.0, angle);
+ }
+ }
+ return true;
+}
+
+
+
+String coordToOdg(String sval)
+{
+ double nr = Double.parseDouble(sval);
+ nr = nr * pxToCm;
+ String s = nrfmt.format(nr) + "cm";
+ return s;
+}
+
+
+boolean writeSvgAttributes(Element elem, AffineTransform trans)
+{
+ NamedNodeMap attrs = elem.getAttributes();
+ String ename = elem.getLocalName();
+ for (int i=0 ; i<attrs.getLength() ; i++)
+ {
+ Attr attr = (Attr)attrs.item(i);
+ String aname = attr.getName();
+ String aval = attr.getValue();
+ if (aname.startsWith("xmlns"))
+ continue;
+ else if (aname.equals("d"))//already handled
+ continue;
+ else if (aname.startsWith("transform"))
+ {
+ parseTransform(aval, trans);
+ continue;
+ }
+ else if (aname.equals("style"))
+ {
+ StyleInfo style = styles.get(aval);
+ if (style != null)
+ {
+ po(" draw:style-name=\"");
+ po(style.getName());
+ po("\"");
+ }
+ continue;
+ }
+ if (aname.equals("x") || aname.equals("y") ||
+ aname.equals("width") || aname.equals("height"))
+ {
+ aval = coordToOdg(aval);
+ }
+ if ("id".equals(aname))
+ po(" ");
+ else if ("transform".equals(aname))
+ po(" draw:");
+ else
+ po(" svg:");
+ po(aname);
+ po("=\"");
+ po(aval);
+ po("\"");
+ }
+
+ //Output the current transform
+ if (!trans.isIdentity() &&
+ !(
+ ename.equals("g") ||
+ ename.equals("defs") ||
+ ename.equals("metadata")
+ )
+ )
+ {
+ double v[] = new double[6];
+ trans.getMatrix(v);
+ po(" draw:transform=\"matrix(" +
+ nrfmt.format(v[0]) + "," +
+ nrfmt.format(v[1]) + "," +
+ nrfmt.format(v[2]) + "," +
+ nrfmt.format(v[3]) + "," +
+ nrfmt.format(v[4]) + "," +
+ nrfmt.format(v[5]) + ")\"");
+ }
+ return true;
+}
+
+public boolean writeOdfContent(Element elem, AffineTransform trans)
+{
+ String ns = elem.getNamespaceURI();
+ String tagName = elem.getLocalName();
+ //trace("ns:" + ns + " tagName:" + tagName);
+ if (!ns.equals(SVG_NS))
+ return true;
+ if (tagName.equals("svg"))
+ {
+ NodeList children = elem.getChildNodes();
+ for (int i=0 ; i<children.getLength() ; i++)
+ {
+ Node n = children.item(i);
+ if (n.getNodeType() == Node.ELEMENT_NODE)
+ if (!writeOdfContent((Element)n,
+ (AffineTransform)trans.clone()))
+ return false;
+ }
+ }
+ else if (tagName.equals("g"))
+ {
+ //String transform = elem.getAttribute("transform");
+ po("<draw:g");
+ writeSvgAttributes(elem, trans); po(">\n");
+ NodeList children = elem.getChildNodes();
+ for (int i=0 ; i<children.getLength() ; i++)
+ {
+ Node n = children.item(i);
+ if (n.getNodeType() == Node.ELEMENT_NODE)
+ if (!writeOdfContent((Element)n,
+ (AffineTransform)trans.clone()))
+ return false;
+ }
+ po("</draw:g>\n");
+ }
+ else if (tagName.equals("text"))
+ {
+ String x = coordToOdg(elem.getAttribute("x"));
+ String y = coordToOdg(elem.getAttribute("y"));
+ String width = "5cm";
+ String height = "2cm";
+ String txt = elem.getTextContent();
+ po("<draw:frame draw:style-name=\"grx1\" draw:layer=\"layout\" ");
+ po("svg:x=\"" + x + "\" svg:y=\"" + y + "\" ");
+ po("svg:width=\"" + width + "\" svg:height=\"" + height + "\"");
+ po(">\n");
+ po(" <draw:text-box draw:auto-grow-height=\"true\" draw:auto-grow-width=\"true\">\n");
+ po(" <text:p text:style-name=\"P1\"> " + txt + "</text:p>\n");
+ po(" </draw:text-box>\n");
+ po("</draw:frame>\n");
+ return true;
+ }
+ else if (tagName.equals("image"))
+ {
+ String x = coordToOdg(elem.getAttribute("x"));
+ String y = coordToOdg(elem.getAttribute("y"));
+ String width = coordToOdg(elem.getAttribute("width"));
+ String height = coordToOdg(elem.getAttribute("height"));
+ String imageName = elem.getAttributeNS(XLINK_NS, "href");
+ po("<draw:frame draw:style-name=\"grx1\" draw:layer=\"layout\" ");
+ po("svg:x=\"" + x + "\" svg:y=\"" + y + "\" ");
+ po("svg:width=\"" + width + "\" svg:height=\"" + height + "\">\n");
+ po(" <draw:image xlink:href=\"Pictures/" + imageName + "\" xlink:type=\"simple\" xlink:show=\"embed\" xlink:actuate=\"onLoad\"><text:p/></draw:image>\n");
+ po("</draw:frame>\n");
+ return true;
+ }
+ else if (tagName.equals("path"))
+ {
+ double bounds[] = new double[4];
+ String d = elem.getAttribute("d");
+ String newd = parsePathData(d, bounds);
+ double x = bounds[0];
+ double y = bounds[1];
+ double width = (bounds[2]-bounds[0]);
+ double height = (bounds[3]-bounds[1]);
+ po("<draw:path draw:layer=\"layout\" \n");
+ po(" svg:x=\"" + nrfmt.format(x) + "cm\" ");
+ po("svg:y=\"" + nrfmt.format(y) + "cm\" ");
+ po("svg:width=\"" + nrfmt.format(width) + "cm\" ");
+ po("svg:height=\"" + nrfmt.format(height) + "cm\" ");
+ po("svg:viewBox=\"0.0 0.0 " +
+ nrfmt.format(bounds[2] * 1000.0) + " " +
+ nrfmt.format(bounds[3] * 1000.0) + "\"\n");
+ po(" svg:d=\"" + newd + "\"\n ");
+
+ writeSvgAttributes(elem, trans); po("/>\n");
+ //po(" svg:d=\"" + d + "\"/>\n");
+ return true;
+ }
+
+ else
+ {
+ //Verbatim tab mapping
+ po("<draw:"); po(tagName);
+ writeSvgAttributes(elem, trans); po(">\n");
+ po("</draw:"); po(tagName); po(">\n");
+ }
+
+ return true;
+}
+
+
+boolean writeOdfContent(ZipOutputStream outs)
+{
+ try
+ {
+ ZipEntry ze = new ZipEntry("content.xml");
+ outs.putNextEntry(ze);
+ out = new BufferedWriter(new OutputStreamWriter(outs));
+ }
+ catch (IOException e)
+ {
+ return false;
+ }
+
+ NodeList res = svg.getElementsByTagNameNS(SVG_NS, "svg");
+ if (res.getLength() < 1)
+ {
+ err("saveOdf: no <svg> root in .svg file");
+ return false;
+ }
+ Element root = (Element)res.item(0);
+
+
+ po("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+ po("<office:document-content\n");
+ po(" xmlns:office=\"urn:oasis:names:tc:opendocument:xmlns:office:1.0\"\n");
+ po(" xmlns:style=\"urn:oasis:names:tc:opendocument:xmlns:style:1.0\"\n");
+ po(" xmlns:text=\"urn:oasis:names:tc:opendocument:xmlns:text:1.0\"\n");
+ po(" xmlns:table=\"urn:oasis:names:tc:opendocument:xmlns:table:1.0\"\n");
+ po(" xmlns:draw=\"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0\"\n");
+ po(" xmlns:fo=\"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0\"\n");
+ po(" xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n");
+ po(" xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n");
+ po(" xmlns:meta=\"urn:oasis:names:tc:opendocument:xmlns:meta:1.0\"\n");
+ po(" xmlns:number=\"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0\"\n");
+ po(" xmlns:presentation=\"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0\"\n");
+ po(" xmlns:svg=\"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0\"\n");
+ po(" xmlns:chart=\"urn:oasis:names:tc:opendocument:xmlns:chart:1.0\"\n");
+ po(" xmlns:dr3d=\"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0\"\n");
+ po(" xmlns:math=\"http://www.w3.org/1998/Math/MathML\"\n");
+ po(" xmlns:form=\"urn:oasis:names:tc:opendocument:xmlns:form:1.0\"\n");
+ po(" xmlns:script=\"urn:oasis:names:tc:opendocument:xmlns:script:1.0\"\n");
+ po(" xmlns:ooo=\"http://openoffice.org/2004/office\"\n");
+ po(" xmlns:ooow=\"http://openoffice.org/2004/writer\"\n");
+ po(" xmlns:oooc=\"http://openoffice.org/2004/calc\"\n");
+ po(" xmlns:dom=\"http://www.w3.org/2001/xml-events\"\n");
+ po(" xmlns:xforms=\"http://www.w3.org/2002/xforms\"\n");
+ po(" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n");
+ po(" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n");
+ po(" xmlns:smil=\"urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0\"\n");
+ po(" xmlns:anim=\"urn:oasis:names:tc:opendocument:xmlns:animation:1.0\"\n");
+ po(" office:version=\"1.0\">\n");
+ po("\n");
+ po("\n");
+ po("<office:scripts/>\n");
+ po("<office:automatic-styles>\n");
+ po("<style:style style:name=\"dp1\" style:family=\"drawing-page\"/>\n");
+ po("<style:style style:name=\"grx1\" style:family=\"graphic\" style:parent-style-name=\"standard\">\n");
+ po(" <style:graphic-properties draw:stroke=\"none\" draw:fill=\"solid\" draw:textarea-horizontal-align=\"center\" draw:textarea-vertical-align=\"middle\" draw:color-mode=\"standard\" draw:luminance=\"0%\" draw:contrast=\"0%\" draw:gamma=\"100%\" draw:red=\"0%\" draw:green=\"0%\" draw:blue=\"0%\" fo:clip=\"rect(0cm 0cm 0cm 0cm)\" draw:image-opacity=\"100%\" style:mirror=\"none\"/>\n");
+ po("</style:style>\n");
+ po("<style:style style:name=\"P1\" style:family=\"paragraph\">\n");
+ po(" <style:paragraph-properties fo:text-align=\"center\"/>\n");
+ po("</style:style>\n");
+
+ //## Dump our style table
+ for (StyleInfo s : styles.values())
+ {
+ po("<style:style style:name=\"" + s.getName() + "\" style:family=\"graphic\" style:parent-style-name=\"standard\">\n");
+ po(" <style:graphic-properties");
+ po(" draw:fill=\"" + s.getFill() + "\"");
+ if (!s.getFill().equals("none"))
+ po(" draw:fill-color=\"" + s.getFillColor() + "\"");
+ po(" draw:stroke=\"" + s.getStroke() + "\"");
+ if (!s.getStroke().equals("none"))
+ {
+ po(" svg:stroke-width=\"" + s.getStrokeWidth() + "\"");
+ po(" svg:stroke-color=\"" + s.getStrokeColor() + "\"");
+ }
+ po("/>\n");
+ po("</style:style>\n");
+ }
+ po("</office:automatic-styles>\n");
+ po("\n");
+ po("\n");
+ po("<office:body>\n");
+ po("<office:drawing>\n");
+ po("<draw:page draw:name=\"page1\" draw:style-name=\"dp1\" draw:master-page-name=\"Default\">\n");
+ po("\n\n\n");
+ AffineTransform trans = new AffineTransform();
+ //trans.scale(12.0, 12.0);
+ po("<!-- ######### CONVERSION FROM SVG STARTS ######## -->\n");
+ writeOdfContent(root, trans);
+ po("<!-- ######### CONVERSION FROM SVG ENDS ######## -->\n");
+ po("\n\n\n");
+
+ po("</draw:page>\n");
+ po("</office:drawing>\n");
+ po("</office:body>\n");
+ po("</office:document-content>\n");
+
+
+ try
+ {
+ out.flush();
+ outs.closeEntry();
+ }
+ catch (IOException e)
+ {
+ err("writeOdfContent:" + e);
+ return false;
+ }
+ return true;
+}
+
+boolean writeOdfMeta(ZipOutputStream outs)
+{
+ try
+ {
+ ZipEntry ze = new ZipEntry("meta.xml");
+ outs.putNextEntry(ze);
+ out = new BufferedWriter(new OutputStreamWriter(outs));
+ }
+ catch (IOException e)
+ {
+ return false;
+ }
+
+ po("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+ po("<office:document-meta\n");
+ po(" xmlns:office=\"urn:oasis:names:tc:opendocument:xmlns:office:1.0\"\n");
+ po(" xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n");
+ po(" xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n");
+ po(" xmlns:meta=\"urn:oasis:names:tc:opendocument:xmlns:meta:1.0\"\n");
+ po(" xmlns:presentation=\"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0\"\n");
+ po(" xmlns:ooo=\"http://openoffice.org/2004/office\"\n");
+ po(" xmlns:smil=\"urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0\"\n");
+ po(" xmlns:anim=\"urn:oasis:names:tc:opendocument:xmlns:animation:1.0\"\n");
+ po(" office:version=\"1.0\">\n");
+ po("<office:meta>\n");
+ po(" <meta:generator>Inkscape-0.43</meta:generator>\n");
+ po(" <meta:initial-creator>clark kent</meta:initial-creator>\n");
+ po(" <meta:creation-date>2005-12-10T10:55:13</meta:creation-date>\n");
+ po(" <dc:creator>clark kent</dc:creator>\n");
+ po(" <dc:date>2005-12-10T10:56:20</dc:date>\n");
+ po(" <dc:language>en-US</dc:language>\n");
+ po(" <meta:editing-cycles>2</meta:editing-cycles>\n");
+ po(" <meta:editing-duration>PT1M13S</meta:editing-duration>\n");
+ po(" <meta:user-defined meta:name=\"Info 1\"/>\n");
+ po(" <meta:user-defined meta:name=\"Info 2\"/>\n");
+ po(" <meta:user-defined meta:name=\"Info 3\"/>\n");
+ po(" <meta:user-defined meta:name=\"Info 4\"/>\n");
+ po(" <meta:document-statistic meta:object-count=\"2\"/>\n");
+ po("</office:meta>\n");
+ po("</office:document-meta>\n");
+
+
+ try
+ {
+ out.flush();
+ outs.closeEntry();
+ }
+ catch (IOException e)
+ {
+ err("writeOdfContent:" + e);
+ return false;
+ }
+ return true;
+}
+
+
+boolean writeOdfManifest(ZipOutputStream outs)
+{
+ try
+ {
+ ZipEntry ze = new ZipEntry("META-INF/manifest.xml");
+ outs.putNextEntry(ze);
+ out = new BufferedWriter(new OutputStreamWriter(outs));
+ }
+ catch (IOException e)
+ {
+ return false;
+ }
+
+ po("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+ po("<!DOCTYPE manifest:manifest PUBLIC \"-//OpenOffice.org//DTD Manifest 1.0//EN\" \"Manifest.dtd\">\n");
+ po("<manifest:manifest xmlns:manifest=\"urn:oasis:names:tc:opendocument:xmlns:manifest:1.0\">\n");
+ po(" <manifest:file-entry manifest:media-type=\"application/vnd.oasis.opendocument.graphics\" manifest:full-path=\"/\"/>\n");
+ po(" <manifest:file-entry manifest:media-type=\"text/xml\" manifest:full-path=\"content.xml\"/>\n");
+ po(" <manifest:file-entry manifest:media-type=\"text/xml\" manifest:full-path=\"meta.xml\"/>\n");
+ po(" <!--List our images here-->\n");
+ for (int i=0 ; i<images.size() ; i++)
+ {
+ ImageInfo ie = images.get(i);
+ String fname = ie.getName();
+ if (fname.length() < 5)
+ {
+ err("image file name too short:" + fname);
+ return false;
+ }
+ String ext = fname.substring(fname.length() - 4);
+ po(" <manifest:file-entry manifest:media-type=\"");
+ if (ext.equals(".gif"))
+ po("image/gif");
+ else if (ext.equals(".png"))
+ po("image/png");
+ else if (ext.equals(".jpg") || ext.equals(".jpeg"))
+ po("image/jpeg");
+ po("\" manifest:full-path=\"");
+ po(fname);
+ po("\"/>\n");
+ }
+ po("</manifest:manifest>\n");
+
+ try
+ {
+ out.flush();
+ outs.closeEntry();
+ }
+ catch (IOException e)
+ {
+ err("writeOdfContent:" + e);
+ return false;
+ }
+ return true;
+}
+
+boolean writeOdfImages(ZipOutputStream outs)
+{
+ for (int i=0 ; i<images.size() ; i++)
+ {
+ ImageInfo ie = images.get(i);
+ try
+ {
+ String iname = "Pictures/" + ie.getName();
+ ZipEntry ze = new ZipEntry(iname);
+ outs.putNextEntry(ze);
+ outs.write(ie.getBuf());
+ outs.closeEntry();
+ }
+ catch (IOException e)
+ {
+ err("writing images:" + e);
+ return false;
+ }
+ }
+ return true;
+}
+
+/**
+ *
+ */
+public boolean writeOdf(OutputStream outs)
+{
+ try
+ {
+ ZipOutputStream zos = new ZipOutputStream(outs);
+ if (!writeOdfContent(zos))
+ return false;
+ if (!writeOdfManifest(zos))
+ return false;
+ if (!writeOdfMeta(zos))
+ return false;
+ if (!writeOdfImages(zos))
+ return false;
+ //if (!writeOdfStyles(zos))
+ // return false;
+ zos.close();
+ }
+ catch (IOException e)
+ {
+ err("closing ODF zip output stream:" + e);
+ return false;
+ }
+ return true;
+}
+
+
+
+/**
+ *
+ */
+public boolean saveOdf(String fileName)
+{
+ boolean ret = true;
+ try
+ {
+ FileOutputStream fos = new FileOutputStream(fileName);
+ ret = writeOdf(fos);
+ fos.close();
+ }
+ catch (IOException e)
+ {
+ err("writing odf " + fileName + " : " + e);
+ return false;
+ }
+ return ret;
+}
+
+
+
+boolean parseCss(String css)
+{
+ trace("##### STYLE ### :" + css);
+ String name = "gr" + styleNr;
+ styleNr++;
+ StyleInfo si = new StyleInfo(name, css);
+ StringTokenizer st = new StringTokenizer(css, ";");
+ while (st.hasMoreTokens())
+ {
+ String style = st.nextToken();
+ //trace(" " + style);
+ int pos = style.indexOf(':');
+ if (pos < 1 || pos > style.length()-2)
+ continue;
+ String attrName = style.substring(0, pos);
+ String attrVal = style.substring(pos+1);
+ trace(" =" + attrName + ':' + attrVal);
+ if ("stroke".equals(attrName))
+ {
+ si.stroke = "solid";
+ si.strokeColor = attrVal;
+ }
+ else if ("stroke-width".equals(attrName))
+ {
+ si.strokeWidth = attrVal;
+ }
+ else if ("fill".equals(attrName))
+ {
+ si.fill = "solid";
+ si.fillColor = attrVal;
+ }
+ }
+ styles.put(css, si);
+ return true;
+}
+
+boolean readSvg(InputStream ins)
+{
+ //### LOAD XML
+ try
+ {
+ DocumentBuilderFactory factory =
+ DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
+ DocumentBuilder builder =
+ factory.newDocumentBuilder();
+ builder.setEntityResolver(new EntityResolver()
+ {
+ public InputSource resolveEntity(String publicId, String systemId)
+ {
+ return new InputSource(new ByteArrayInputStream(new byte[0]));
+ }
+ });
+ Document doc = builder.parse(ins);
+ svg = doc;
+ }
+ catch (javax.xml.parsers.ParserConfigurationException e)
+ {
+ err("making DOM parser:"+e);
+ return false;
+ }
+ catch (org.xml.sax.SAXException e)
+ {
+ err("parsing svg document:"+e);
+ return false;
+ }
+ catch (IOException e)
+ {
+ err("parsing svg document:"+e);
+ return false;
+ }
+ //dumpDocument(svg);
+
+ //### LOAD IMAGES
+ imageNr = 0;
+ images = new ArrayList<ImageInfo>();
+ NodeList res = svg.getElementsByTagNameNS(SVG_NS, "image");
+ for (int i=0 ; i<res.getLength() ; i++)
+ {
+ Element elem = (Element) res.item(i);
+ String fileName = elem.getAttributeNS(XLINK_NS, "href");
+ if (fileName == null)
+ {
+ err("No xlink:href pointer to image data for image");
+ return false;
+ }
+ File f = new File(fileName);
+ if (!f.exists())
+ {
+ err("image '" + fileName + "' does not exist");
+ return false;
+ }
+ int bufSize = (int)f.length();
+ byte buf[] = new byte[bufSize];
+ int pos = 0;
+ try
+ {
+ FileInputStream fis = new FileInputStream(fileName);
+ while (pos < bufSize)
+ {
+ int len = fis.read(buf, pos, bufSize - pos);
+ if (len < 0)
+ break;
+ pos += len;
+ }
+ fis.close();
+ }
+ catch (IOException e)
+ {
+ err("reading image '" + fileName + "' :" + e);
+ return false;
+ }
+ if (pos != bufSize)
+ {
+ err("reading image entry. expected " +
+ bufSize + ", found " + pos + " bytes.");
+ return false;
+ }
+ ImageInfo ie = new ImageInfo(fileName, fileName, buf);
+ images.add(ie);
+ }
+
+ //### Parse styles
+ styleNr = 0;
+ styles = new HashMap<String, StyleInfo>();
+ res = svg.getElementsByTagName("*");
+ for (int i=0 ; i<res.getLength() ; i++)
+ {
+ Element elem = (Element) res.item(i);
+ trace("elem:"+ elem.getNodeName());
+ String style = elem.getAttribute("style");
+ if (style != null && style.length() > 0)
+ parseCss(style);
+ }
+
+ return true;
+}
+
+boolean readSvg(String fileName)
+{
+ try
+ {
+ FileInputStream fis = new FileInputStream(fileName);
+ if (!readSvg(fis))
+ return false;
+ fis.close();
+ }
+ catch (IOException e)
+ {
+ err("opening svg file:"+e);
+ return false;
+ }
+ return true;
+}
+
+
+//########################################################################
+//# O D F T O S V G
+//########################################################################
+
+/**
+ *
+ */
+public boolean readOdfEntry(ZipInputStream zis, ZipEntry ent)
+{
+ String fileName = ent.getName();
+ trace("fileName:" + fileName);
+ if (fileName.length() < 4)
+ return true;
+ String ext = fileName.substring(fileName.length() - 4);
+ trace("ext:" + ext);
+ ArrayList<Byte> arr = new ArrayList<Byte>();
+ try
+ {
+ while (true)
+ {
+ int inb = zis.read();
+ if (inb < 0)
+ break;
+ arr.add((byte)inb);
+ }
+ }
+ catch (IOException e)
+ {
+ return false;
+ }
+ byte buf[] = new byte[arr.size()];
+ for (int i=0 ; i<buf.length ; i++)
+ buf[i] = arr.get(i);
+ trace("bufsize:" + buf.length);
+
+ if (ext.equals(".xml"))
+ {
+ try
+ {
+ DocumentBuilderFactory factory =
+ DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
+ DocumentBuilder builder =
+ factory.newDocumentBuilder();
+ builder.setEntityResolver(new EntityResolver()
+ {
+ public InputSource resolveEntity(String publicId, String systemId)
+ {
+ return new InputSource(new ByteArrayInputStream(new byte[0]));
+ }
+ });
+ //trace("doc:"+new String(buf));
+ Document doc = builder.parse(new ByteArrayInputStream(buf));
+ if (fileName.equals("content.xml"))
+ content = doc;
+ else if (fileName.equals("meta.xml"))
+ meta = doc;
+ else if (fileName.equals("styles.xml"))
+ {
+ //styles = doc;
+ }
+ }
+ catch (javax.xml.parsers.ParserConfigurationException e)
+ {
+ err("making DOM parser:"+e);
+ return false;
+ }
+ catch (org.xml.sax.SAXException e)
+ {
+ err("parsing document:"+e);
+ return false;
+ }
+ catch (IOException e)
+ {
+ err("parsing document:"+e);
+ return false;
+ }
+ }
+ else if (ext.equals(".png") ||
+ ext.equals(".gif") ||
+ ext.equals(".jpg") ||
+ ext.equals(".jpeg") )
+ {
+ String imageName = "image" + imageNr + ext;
+ imageNr++;
+ ImageInfo ie = new ImageInfo(fileName, imageName, buf);
+ trace("added image '" + imageName + "'. " + buf.length +" bytes.");
+ images.add(ie);
+
+ }
+ dumpDocument(content);
+ return true;
+}
+
+
+/**
+ *
+ */
+public boolean readOdf(InputStream ins)
+{
+ imageNr = 0;
+ images = new ArrayList<ImageInfo>();
+ styleNr = 0;
+ styles = new HashMap<String, StyleInfo>();
+ ZipInputStream zis = new ZipInputStream(ins);
+ while (true)
+ {
+ try
+ {
+ ZipEntry ent = zis.getNextEntry();
+ if (ent == null)
+ break;
+ if (!readOdfEntry(zis, ent))
+ return false;
+ zis.closeEntry();
+ }
+ catch (IOException e)
+ {
+ err("reading zip entry");
+ return false;
+ }
+ }
+
+ return true;
+}
+
+
+/**
+ *
+ */
+public boolean readOdf(String fileName)
+{
+ boolean ret = true;
+ try
+ {
+ FileInputStream fis = new FileInputStream(fileName);
+ ret = readOdf(fis);
+ fis.close();
+ }
+ catch (IOException e)
+ {
+ err("reading " + fileName + " : " + e);
+ ret = false;
+ }
+ return true;
+}
+
+
+
+
+public boolean writeSvgElement(Element elem)
+{
+ String ns = elem.getNamespaceURI();
+ String tagName = elem.getLocalName();
+ trace("tag:" + tagName + " : " + ns);
+ if (ns.equals(ODSVG_NS))
+ {
+ po("<"); po(tagName);
+ NamedNodeMap attrs = elem.getAttributes();
+ for (int i=0 ; i<attrs.getLength() ; i++)
+ {
+ Attr attr = (Attr)attrs.item(i);
+ String aname = attr.getName();
+ String aval = attr.getValue();
+ //Replace image name
+ if ("xlink:href".equals(aname) && "image".equals(tagName))
+ {
+ for (int j=0 ; j<images.size() ; j++)
+ {
+ ImageInfo ie = images.get(i);
+ if (aval.equals(ie.getName()))
+ aval = ie.getNewName();
+ }
+ }
+ po(" ");
+ po(aname);
+ po("=\"");
+ po(aval);
+ po("\"");
+ }
+ po(">\n");
+ }
+ NodeList children = elem.getChildNodes();
+ for (int i=0 ; i<children.getLength() ; i++)
+ {
+ Node n = children.item(i);
+ if (n.getNodeType() == Node.ELEMENT_NODE)
+ if (!writeSvgElement((Element)n))
+ return false;
+ }
+ if (ns.equals(ODSVG_NS))
+ {
+ po("</"); po(tagName); po(">\n");
+ }
+ return true;
+}
+
+
+public boolean saveSvg(String svgFileName)
+{
+ trace("====== Saving images ===========");
+ try
+ {
+ for (int i=0 ; i<images.size() ; i++)
+ {
+ ImageInfo entry = images.get(i);
+ trace("saving:" + entry.name);
+ FileOutputStream fos = new FileOutputStream(entry.name);
+ fos.write(entry.buf);
+ fos.close();
+ }
+ }
+ catch (IOException e)
+ {
+ err("saveAsSVG:" + e);
+ return false;
+ }
+
+ try
+ {
+ out = new BufferedWriter(new FileWriter(svgFileName));
+ }
+ catch (IOException e)
+ {
+ err("save:" + e);
+ return false;
+ }
+
+ if (content == null)
+ {
+ err("no content in odf");
+ return false;
+ }
+
+ NodeList res = content.getElementsByTagNameNS(ODF_NS, "drawing");
+ if (res.getLength() < 1)
+ {
+ err("save: no drawing in document");
+ return false;
+ }
+ Element root = (Element)res.item(0);
+ trace("NS:"+root.getNamespaceURI());
+
+ res = root.getElementsByTagNameNS(ODG_NS, "page");
+ if (res.getLength() < 1)
+ {
+ err("save: no page in drawing");
+ return false;
+ }
+ Element page = (Element)res.item(0);
+
+ po("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+ po("<svg\n");
+ po(" xmlns:svg=\"http://www.w3.org/2000/svg\"\n");
+ po(" xmlns=\"http://www.w3.org/2000/svg\"\n");
+ po(" xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n");
+ po(" version=\"1.0\"\n");
+ po(" >\n");
+
+ writeSvgElement(page);
+
+ po("</svg>\n");
+
+ try
+ {
+ out.close();
+ }
+ catch (IOException e)
+ {
+ err("save:close:" + e);
+ return false;
+ }
+ return true;
+}
+
+
+
+//########################################################################
+//# C O N S T R U C T O R
+//########################################################################
+
+SvgOdg()
+{
+ //init, if necessary
+ nrfmt = new DecimalFormat("#.####");
+}
+
+
+//########################################################################
+//# C O M M A N D L I N E
+//########################################################################
+
+public boolean odfToSvg(String odfName, String svgName)
+{
+ if (!readOdf(odfName))
+ return false;
+ if (!saveSvg(svgName))
+ return false;
+ return true;
+}
+
+public boolean svgToOdf(String svgName, String odfName)
+{
+ if (!readSvg(svgName))
+ return false;
+ System.out.println("ok");
+ if (!saveOdf(odfName))
+ return false;
+ return true;
+}
+
+void usage()
+{
+ System.out.println("usage: SvgOdf input_file.odg output_file.svg");
+ System.out.println(" SvgOdf input_file.svg output_file.odg");
+}
+
+
+boolean parseArguments(String argv[])
+{
+ if (argv.length != 2)
+ {
+ usage();
+ return false;
+ }
+
+ String fileName1 = argv[0];
+ String fileName2 = argv[1];
+
+ if (fileName1.length()<5 || fileName2.length()<5)
+ {
+ System.out.println("one or more file names is too short");
+ usage();
+ return false;
+ }
+
+ String ext1 = fileName1.substring(fileName1.length()-4);
+ String ext2 = fileName2.substring(fileName2.length()-4);
+ //System.out.println("ext1:"+ext1+" ext2:"+ext2);
+
+ //##### ODG -> SVG #####
+ if ((ext1.equals(".odg") || ext1.equals(".odf") || ext1.equals(".zip") ) &&
+ ext2.equals(".svg"))
+ {
+ if (!odfToSvg(argv[0], argv[1]))
+ {
+ System.out.println("Conversion from ODG to SVG failed");
+ return false;
+ }
+ }
+
+ //##### SVG -> ODG #####
+ else if (ext1.equals(".svg") &&
+ ( ext2.equals(".odg") || ext2.equals(".odf") || ext2.equals(".zip") ) )
+ {
+ if (!svgToOdf(fileName1, fileName2))
+ {
+ System.out.println("Conversion from SVG to ODG failed");
+ return false;
+ }
+ }
+
+ //##### none of the above #####
+ else
+ {
+ usage();
+ return false;
+ }
+ return true;
+}
+
+
+public static void main(String argv[])
+{
+ SvgOdg svgodg = new SvgOdg();
+ svgodg.parseArguments(argv);
+}
+
+
+}
+
+//########################################################################
+//# E N D O F F I L E
+//########################################################################
+
diff --git a/src/dom/odf/odfdocument.cpp b/src/dom/odf/odfdocument.cpp
index ba6cfc63b..cba9e1349 100644
--- a/src/dom/odf/odfdocument.cpp
+++ b/src/dom/odf/odfdocument.cpp
@@ -1,161 +1,161 @@
-/**
- *
- * This class contains an ODF Document.
- * Initially, we are just concerned with .odg content.xml + resources
- *
- * ---------------------------------------------------------------------
- *
- * Copyright (C) 2006 Bob Jamison
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * For more information, please write to rwjj@earthlink.net
- *
- */
-
-#include "odfdocument.h"
-
-
-namespace odf
-{
-
-
-//########################################################################
-//# I M A G E D A T A
-//########################################################################
-
-
-/**
- *
- */
-ImageData::ImageData(const std::string &fname,
- const std::vector<unsigned char> &buf)
-{
- fileName = fname;
- data = buf;
-}
-
-/**
- *
- */
-ImageData::ImageData(const ImageData &other)
-{
- fileName = other.fileName;
- data = other.data;
-}
-
-/**
- *
- */
-ImageData::~ImageData()
-{
-}
-
-/**
- *
- */
-std::string ImageData::getFileName()
-{
- return fileName;
-}
-
-/**
- *
- */
-void ImageData::setFileName(const std::string &val)
-{
- fileName = val;
-}
-
-/**
- *
- */
-std::vector<unsigned char> &ImageData::getData()
-{
- return data;
-}
-
-/**
- *
- */
-void ImageData::setData(const std::vector<unsigned char> &buf)
-{
- data = buf;
-}
-
-
-
-
-
-//########################################################################
-//# O D F D O C U M E N T
-//########################################################################
-
-
-
-/**
- *
- */
-OdfDocument::OdfDocument()
-{
-}
-
-
-/**
- *
- */
-OdfDocument::OdfDocument(const OdfDocument &other)
-{
- content = other.content;
- images = other.images;
-}
-
-
-/**
- *
- */
-OdfDocument::~OdfDocument()
-{
-}
-
-/**
- *
- */
-bool OdfDocument::readFile(const std::string &fileName)
-{
- return true;
-}
-
-/**
- *
- */
-bool OdfDocument::writeFile(const std::string &fileName)
-{
- return true;
-}
-
-
-
-
-
-} //namespace odf
-
-
-
-
-//########################################################################
-//# E N D O F F I L E
-//########################################################################
-
+/**
+ *
+ * This class contains an ODF Document.
+ * Initially, we are just concerned with .odg content.xml + resources
+ *
+ * ---------------------------------------------------------------------
+ *
+ * Copyright (C) 2006 Bob Jamison
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * For more information, please write to rwjj@earthlink.net
+ *
+ */
+
+#include "odfdocument.h"
+
+
+namespace odf
+{
+
+
+//########################################################################
+//# I M A G E D A T A
+//########################################################################
+
+
+/**
+ *
+ */
+ImageData::ImageData(const std::string &fname,
+ const std::vector<unsigned char> &buf)
+{
+ fileName = fname;
+ data = buf;
+}
+
+/**
+ *
+ */
+ImageData::ImageData(const ImageData &other)
+{
+ fileName = other.fileName;
+ data = other.data;
+}
+
+/**
+ *
+ */
+ImageData::~ImageData()
+{
+}
+
+/**
+ *
+ */
+std::string ImageData::getFileName()
+{
+ return fileName;
+}
+
+/**
+ *
+ */
+void ImageData::setFileName(const std::string &val)
+{
+ fileName = val;
+}
+
+/**
+ *
+ */
+std::vector<unsigned char> &ImageData::getData()
+{
+ return data;
+}
+
+/**
+ *
+ */
+void ImageData::setData(const std::vector<unsigned char> &buf)
+{
+ data = buf;
+}
+
+
+
+
+
+//########################################################################
+//# O D F D O C U M E N T
+//########################################################################
+
+
+
+/**
+ *
+ */
+OdfDocument::OdfDocument()
+{
+}
+
+
+/**
+ *
+ */
+OdfDocument::OdfDocument(const OdfDocument &other)
+{
+ content = other.content;
+ images = other.images;
+}
+
+
+/**
+ *
+ */
+OdfDocument::~OdfDocument()
+{
+}
+
+/**
+ *
+ */
+bool OdfDocument::readFile(const std::string &fileName)
+{
+ return true;
+}
+
+/**
+ *
+ */
+bool OdfDocument::writeFile(const std::string &fileName)
+{
+ return true;
+}
+
+
+
+
+
+} //namespace odf
+
+
+
+
+//########################################################################
+//# E N D O F F I L E
+//########################################################################
+
diff --git a/src/dom/odf/odfdocument.h b/src/dom/odf/odfdocument.h
index 9710de385..c18dc4b72 100644
--- a/src/dom/odf/odfdocument.h
+++ b/src/dom/odf/odfdocument.h
@@ -1,153 +1,153 @@
-#ifndef __ODF_DOCUMENT_H__
-#define __ODF_DOCUMENT_H__
-/**
- *
- * This class contains an ODF Document.
- * Initially, we are just concerned with .odg content.xml + resources
- *
- * ---------------------------------------------------------------------
- *
- * Copyright (C) 2006 Bob Jamison
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * For more information, please write to rwjj@earthlink.net
- *
- */
-
-#include <vector>
-#include <string>
-
-#include "dom/dom.h"
-
-namespace odf
-{
-
-
-//########################################################################
-//# I M A G E D A T A
-//########################################################################
-
-/**
- *
- */
-class ImageData
-{
-public:
-
- /**
- *
- */
- ImageData(const std::string &fileName,
- const std::vector<unsigned char> &buf);
-
- /**
- *
- */
- ImageData(const ImageData &other);
-
- /**
- *
- */
- virtual ~ImageData();
-
- /**
- *
- */
- virtual std::string getFileName();
-
- /**
- *
- */
- virtual void setFileName(const std::string &val);
-
- /**
- *
- */
- virtual std::vector<unsigned char> &getData();
-
- /**
- *
- */
- virtual void setData(const std::vector<unsigned char> &buf);
-
-private:
-
- std::string fileName;
-
- std::vector<unsigned char> data;
-
-};
-
-
-
-
-
-//########################################################################
-//# O D F D O C U M E N T
-//########################################################################
-
-
-/**
- *
- */
-class OdfDocument
-{
-public:
-
- /**
- *
- */
- OdfDocument();
-
- /**
- * Copy constructor
- */
- OdfDocument(const OdfDocument &other);
-
- /**
- *
- */
- virtual ~OdfDocument();
-
- /**
- *
- */
- virtual bool readFile(const std::string &fileName);
-
- /**
- *
- */
- virtual bool writeFile(const std::string &fileName);
-
-
-private:
-
- org::w3c::dom::Document *content;
-
- std::vector<ImageData> images;
-
-};
-
-} //namespace odf
-
-
-
-#endif /*__ODF_DOCUMENT_H__*/
-
-//########################################################################
-//# E N D O F F I L E
-//########################################################################
-
+#ifndef __ODF_DOCUMENT_H__
+#define __ODF_DOCUMENT_H__
+/**
+ *
+ * This class contains an ODF Document.
+ * Initially, we are just concerned with .odg content.xml + resources
+ *
+ * ---------------------------------------------------------------------
+ *
+ * Copyright (C) 2006 Bob Jamison
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * For more information, please write to rwjj@earthlink.net
+ *
+ */
+
+#include <vector>
+#include <string>
+
+#include "dom/dom.h"
+
+namespace odf
+{
+
+
+//########################################################################
+//# I M A G E D A T A
+//########################################################################
+
+/**
+ *
+ */
+class ImageData
+{
+public:
+
+ /**
+ *
+ */
+ ImageData(const std::string &fileName,
+ const std::vector<unsigned char> &buf);
+
+ /**
+ *
+ */
+ ImageData(const ImageData &other);
+
+ /**
+ *
+ */
+ virtual ~ImageData();
+
+ /**
+ *
+ */
+ virtual std::string getFileName();
+
+ /**
+ *
+ */
+ virtual void setFileName(const std::string &val);
+
+ /**
+ *
+ */
+ virtual std::vector<unsigned char> &getData();
+
+ /**
+ *
+ */
+ virtual void setData(const std::vector<unsigned char> &buf);
+
+private:
+
+ std::string fileName;
+
+ std::vector<unsigned char> data;
+
+};
+
+
+
+
+
+//########################################################################
+//# O D F D O C U M E N T
+//########################################################################
+
+
+/**
+ *
+ */
+class OdfDocument
+{
+public:
+
+ /**
+ *
+ */
+ OdfDocument();
+
+ /**
+ * Copy constructor
+ */
+ OdfDocument(const OdfDocument &other);
+
+ /**
+ *
+ */
+ virtual ~OdfDocument();
+
+ /**
+ *
+ */
+ virtual bool readFile(const std::string &fileName);
+
+ /**
+ *
+ */
+ virtual bool writeFile(const std::string &fileName);
+
+
+private:
+
+ org::w3c::dom::Document *content;
+
+ std::vector<ImageData> images;
+
+};
+
+} //namespace odf
+
+
+
+#endif /*__ODF_DOCUMENT_H__*/
+
+//########################################################################
+//# E N D O F F I L E
+//########################################################################
+
diff --git a/src/dom/svg/svg.h b/src/dom/svg/svg.h
index b02ccc933..0bf44b817 100644
--- a/src/dom/svg/svg.h
+++ b/src/dom/svg/svg.h
@@ -1,4474 +1,4474 @@
-#ifndef __SVG_H__
-#define __SVG_H__
-
-/**
- * Phoebe DOM Implementation.
- *
- * This is a C++ approximation of the W3C DOM model, which follows
- * fairly closely the specifications in the various .idl files, copies of
- * which are provided for reference. Most important is this one:
- *
- * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
- *
- * Authors:
- * Bob Jamison
- *
- * Copyright (C) 2005 Bob Jamison
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-// For access to DOM2 core
-#include "dom/dom.h"
-
-// For access to DOM2 events
-#include "dom/events.h"
-
-// For access to those parts from DOM2 CSS OM used by SVG DOM.
-#include "dom/css.h"
-
-// For access to those parts from DOM2 Views OM used by SVG DOM.
-#include "dom/views.h"
-
-// For access to the SMIL OM used by SVG DOM.
-#include "dom/smil.h"
-
-
-
-#include "svgtypes.h"
-
-#include <math.h>
-
-
-
-namespace org
-{
-namespace w3c
-{
-namespace dom
-{
-namespace svg
-{
-
-
-//local definitions
-typedef dom::DOMString DOMString;
-typedef dom::DOMException DOMException;
-typedef dom::Element Element;
-typedef dom::Document Document;
-typedef dom::NodeList NodeList;
-
-
-
-class SVGSVGElement;
-
-
-
-/*#########################################################################
-## SVGElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGElement : virtual public Element
-{
-public:
-
- /**
- *
- */
- virtual DOMString getId() =0;
-
- /**
- *
- */
- virtual void setId(const DOMString &val)
- throw (DOMException) =0;
-
- /**
- *
- */
- virtual DOMString getXmlBase() = 0;
-
- /**
- *
- */
- virtual void setXmlBase(const DOMString &val)
- throw (DOMException) = 0;
-
- /**
- *
- */
- virtual SVGSVGElement *getOwnerSVGElement() = 0;
-
- /**
- *
- */
- virtual SVGElement *getViewportElement() = 0;
-
-
- //##################
- //# Non-API methods
- //##################
-
-
- /**
- *
- */
- virtual ~SVGElement() {}
-
-
-};
-
-
-
-/*#########################################################################
-## SVGDocument
-#########################################################################*/
-
-/**
- *
- */
-class SVGDocument : virtual public Document,
- virtual public events::DocumentEvent
-{
-public:
-
-
- /**
- *
- */
- virtual DOMString getTitle() =0;
-
- /**
- *
- */
- virtual DOMString getReferrer() =0;
-
- /**
- *
- */
- virtual DOMString getDomain() =0;
-
- /**
- *
- */
- virtual DOMString getURL() =0;
-
- /**
- *
- */
- virtual SVGSVGElement *getRootElement() =0;
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGDocument() {}
-
-};
-
-
-
-/*#########################################################################
-## SVGSVGElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGSVGElement : virtual public SVGElement,
- public SVGTests,
- public SVGLangSpace,
- public SVGExternalResourcesRequired,
- public SVGStylable,
- public SVGLocatable,
- public SVGFitToViewBox,
- public SVGZoomAndPan,
- public events::EventTarget,
- public events::DocumentEvent,
- public css::ViewCSS,
- public css::DocumentCSS
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedLength getX() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getY() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getWidth() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getHeight() =0;
-
- /**
- *
- */
- virtual DOMString getContentScriptType() =0;
-
- /**
- *
- */
- virtual void setContentScriptType(const DOMString &val)
- throw (DOMException) =0;
-
-
- /**
- *
- */
- virtual DOMString getContentStyleType() =0;
-
- /**
- *
- */
- virtual void setContentStyleType(const DOMString &val)
- throw (DOMException) =0;
-
- /**
- *
- */
- virtual SVGRect getViewport() =0;
-
- /**
- *
- */
- virtual double getPixelUnitToMillimeterX() =0;
-
- /**
- *
- */
- virtual double getPixelUnitToMillimeterY() =0;
-
- /**
- *
- */
- virtual double getScreenPixelToMillimeterX() =0;
-
- /**
- *
- */
- virtual double getScreenPixelToMillimeterY() =0;
-
-
- /**
- *
- */
- virtual bool getUseCurrentView() =0;
-
- /**
- *
- */
- virtual void setUseCurrentView(bool val) throw (DOMException) =0;
-
- /**
- *
- */
- virtual SVGViewSpec getCurrentView() =0;
-
-
- /**
- *
- */
- virtual double getCurrentScale() =0;
-
- /**
- *
- */
- virtual void setCurrentScale(double val)
- throw (DOMException) =0;
-
-
- /**
- *
- */
- virtual SVGPoint getCurrentTranslate() =0;
-
-
- /**
- *
- */
- virtual unsigned long suspendRedraw (unsigned long max_wait_milliseconds ) =0;
-
- /**
- *
- */
- virtual void unsuspendRedraw (unsigned long suspend_handle_id )
- throw( DOMException ) =0;
-
- /**
- *
- */
- virtual void unsuspendRedrawAll ( ) =0;
-
- /**
- *
- */
- virtual void forceRedraw ( ) =0;
-
- /**
- *
- */
- virtual void pauseAnimations ( ) =0;
-
- /**
- *
- */
- virtual void unpauseAnimations ( ) =0;
-
- /**
- *
- */
- virtual bool animationsPaused ( ) =0;
-
- /**
- *
- */
- virtual double getCurrentTime ( ) =0;
-
- /**
- *
- */
- virtual void setCurrentTime (double seconds ) =0;
-
- /**
- *
- */
- virtual NodeList getIntersectionList (const SVGRect &rect,
- const SVGElement *referenceElement ) =0;
-
- /**
- *
- */
- virtual NodeList getEnclosureList (const SVGRect &rect,
- const SVGElement *referenceElement ) =0;
-
- /**
- *
- */
- virtual bool checkIntersection (const SVGElement *element, const SVGRect &rect ) =0;
-
- /**
- *
- */
- virtual bool checkEnclosure (const SVGElement *element, const SVGRect &rect ) =0;
-
- /**
- *
- */
- virtual void deselectAll ( ) =0;
-
- /**
- *
- */
- virtual SVGNumber createSVGNumber ( ) =0;
-
- /**
- *
- */
- virtual SVGLength createSVGLength ( ) =0;
-
- /**
- *
- */
- virtual SVGAngle createSVGAngle ( ) =0;
-
- /**
- *
- */
- virtual SVGPoint createSVGPoint ( ) =0;
-
- /**
- *
- */
- virtual SVGMatrix createSVGMatrix ( ) =0;
-
- /**
- *
- */
- virtual SVGRect createSVGRect ( ) =0;
-
- /**
- *
- */
- virtual SVGTransform createSVGTransform ( ) =0;
-
- /**
- *
- */
- virtual SVGTransform createSVGTransformFromMatrix(const SVGMatrix &matrix ) =0;
-
- /**
- *
- */
- virtual Element *getElementById (const DOMString& elementId ) =0;
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGSVGElement() {}
-
-};
-
-
-
-/*#########################################################################
-## SVGGElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGGElement : virtual public SVGElement,
- public SVGTests,
- public SVGLangSpace,
- public SVGExternalResourcesRequired,
- public SVGStylable,
- public SVGTransformable,
- public events::EventTarget
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGGElement() {}
-
-};
-
-
-
-
-/*#########################################################################
-## SVGDefsElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGDefsElement :
- virtual public SVGElement,
- public SVGTests,
- public SVGLangSpace,
- public SVGExternalResourcesRequired,
- public SVGStylable,
- public SVGTransformable,
- public events::EventTarget
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGDefsElement() {}
-
-};
-
-
-
-
-/*#########################################################################
-## SVGDescElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGDescElement :
- virtual public SVGElement,
- public SVGLangSpace,
- public SVGStylable
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGDescElement() {}
-
-};
-
-
-
-
-/*#########################################################################
-## SVGTitleElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGTitleElement :
- virtual public SVGElement,
- public SVGLangSpace,
- public SVGStylable
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGTitleElement() {}
-
-};
-
-
-
-
-/*#########################################################################
-## SVGSymbolElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGSymbolElement :
- virtual public SVGElement,
- public SVGLangSpace,
- public SVGExternalResourcesRequired,
- public SVGStylable,
- public SVGFitToViewBox,
- public events::EventTarget
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGSymbolElement() {}
-
-};
-
-
-
-
-/*#########################################################################
-## SVGUseElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGUseElement :
- virtual public SVGElement,
- public SVGURIReference,
- public SVGTests,
- public SVGLangSpace,
- public SVGExternalResourcesRequired,
- public SVGStylable,
- public SVGTransformable,
- public events::EventTarget
-{
-public:
-
-
-
-
- /**
- *
- */
- virtual SVGAnimatedLength getX() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getY() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getWidth() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getHeight() =0;
-
- /**
- *
- */
- virtual SVGElementInstance getInstanceRoot() =0;
-
- /**
- *
- */
- virtual SVGElementInstance getAnimatedInstanceRoot() =0;
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGUseElement() {}
-
-};
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGImageElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGImageElement :
- virtual public SVGElement,
- public SVGURIReference,
- public SVGTests,
- public SVGLangSpace,
- public SVGExternalResourcesRequired,
- public SVGStylable,
- public SVGTransformable,
- public events::EventTarget
-{
-public:
-
-
- /**
- *
- */
- virtual SVGAnimatedLength getX() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getY() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getWidth() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getHeight() =0;
-
-
- /**
- *
- */
- virtual SVGAnimatedPreserveAspectRatio getPreserveAspectRatio() =0;
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGImageElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGSwitchElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGSwitchElement :
- virtual public SVGElement,
- public SVGTests,
- public SVGLangSpace,
- public SVGExternalResourcesRequired,
- public SVGStylable,
- public SVGTransformable,
- public events::EventTarget
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGSwitchElement() {}
-
-};
-
-
-
-
-/*#########################################################################
-## GetSVGDocument
-#########################################################################*/
-
-/**
- *
- */
-class GetSVGDocument
-{
-public:
-
- /**
- *
- */
- virtual SVGDocument *getSVGDocument ( )
- throw( DOMException ) =0;
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~GetSVGDocument() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGStyleElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGStyleElement : virtual public SVGElement
-{
-public:
-
- /**
- *
- */
- virtual DOMString getXmlspace() = 0;
-
- /**
- *
- */
- virtual void setXmlspace(const DOMString &val)
- throw (DOMException) =0;
-
- /**
- *
- */
- virtual DOMString getType() = 0;
-
- /**
- *
- */
- virtual void setType(const DOMString &val)
- throw (DOMException) =0;
-
- /**
- *
- */
- virtual DOMString getMedia() = 0;
-
- /**
- *
- */
- virtual void setMedia(const DOMString &val)
- throw (DOMException) =0;
-
- /**
- *
- */
- virtual DOMString getTitle() = 0;
-
- /**
- *
- */
- virtual void setTitle(const DOMString &val)
- throw (DOMException) =0;
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGStyleElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGPathElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGPathElement :
- virtual public SVGElement,
- public SVGTests,
- public SVGLangSpace,
- public SVGExternalResourcesRequired,
- public SVGStylable,
- public SVGTransformable,
- public events::EventTarget,
- public SVGAnimatedPathData
-{
-public:
-
-
-
-
- /**
- *
- */
- virtual SVGAnimatedNumber getPathLength() =0;
-
- /**
- *
- */
- virtual double getTotalLength ( ) =0;
-
- /**
- *
- */
- virtual SVGPoint getPointAtLength (double distance ) =0;
-
- /**
- *
- */
- virtual unsigned long getPathSegAtLength (double distance ) =0;
-
- /**
- *
- */
- virtual SVGPathSegClosePath
- createSVGPathSegClosePath ( ) =0;
-
- /**
- *
- */
- virtual SVGPathSegMovetoAbs
- createSVGPathSegMovetoAbs (double x, double y ) =0;
-
- /**
- *
- */
- virtual SVGPathSegMovetoRel
- createSVGPathSegMovetoRel (double x, double y ) =0;
-
- /**
- *
- */
- virtual SVGPathSegLinetoAbs
- createSVGPathSegLinetoAbs (double x, double y ) =0;
-
- /**
- *
- */
- virtual SVGPathSegLinetoRel
- createSVGPathSegLinetoRel (double x, double y ) =0;
-
- /**
- *
- */
- virtual SVGPathSegCurvetoCubicAbs
- createSVGPathSegCurvetoCubicAbs (double x, double y,
- double x1, double y1, double x2, double y2 ) =0;
-
- /**
- *
- */
- virtual SVGPathSegCurvetoCubicRel
- createSVGPathSegCurvetoCubicRel (double x, double y,
- double x1, double y1, double x2, double y2 ) =0;
-
- /**
- *
- */
- virtual SVGPathSegCurvetoQuadraticAbs
- createSVGPathSegCurvetoQuadraticAbs (double x, double y,
- double x1, double y1 ) =0;
-
- /**
- *
- */
- virtual SVGPathSegCurvetoQuadraticRel
- createSVGPathSegCurvetoQuadraticRel (double x, double y,
- double x1, double y1 ) =0;
-
- /**
- *
- */
- virtual SVGPathSegArcAbs
- createSVGPathSegArcAbs (double x, double y,
- double r1, double r2, double angle,
- bool largeArcFlag, bool sweepFlag ) =0;
-
- /**
- *
- */
- virtual SVGPathSegArcRel
- createSVGPathSegArcRel (double x, double y, double r1,
- double r2, double angle, bool largeArcFlag,
- bool sweepFlag ) =0;
-
- /**
- *
- */
- virtual SVGPathSegLinetoHorizontalAbs
- createSVGPathSegLinetoHorizontalAbs (double x ) =0;
-
- /**
- *
- */
- virtual SVGPathSegLinetoHorizontalRel
- createSVGPathSegLinetoHorizontalRel (double x ) =0;
-
- /**
- *
- */
- virtual SVGPathSegLinetoVerticalAbs
- createSVGPathSegLinetoVerticalAbs (double y ) =0;
-
- /**
- *
- */
- virtual SVGPathSegLinetoVerticalRel
- createSVGPathSegLinetoVerticalRel (double y ) =0;
-
- /**
- *
- */
- virtual SVGPathSegCurvetoCubicSmoothAbs
- createSVGPathSegCurvetoCubicSmoothAbs (double x, double y,
- double x2, double y2 ) =0;
-
- /**
- *
- */
- virtual SVGPathSegCurvetoCubicSmoothRel
- createSVGPathSegCurvetoCubicSmoothRel (double x, double y,
- double x2, double y2 ) =0;
-
- /**
- *
- */
- virtual SVGPathSegCurvetoQuadraticSmoothAbs
- createSVGPathSegCurvetoQuadraticSmoothAbs (double x, double y ) =0;
-
- /**
- *
- */
- virtual SVGPathSegCurvetoQuadraticSmoothRel
- createSVGPathSegCurvetoQuadraticSmoothRel (double x, double y ) =0;
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGPathElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGRectElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGRectElement :
- virtual public SVGElement,
- public SVGTests,
- public SVGLangSpace,
- public SVGExternalResourcesRequired,
- public SVGStylable,
- public SVGTransformable,
- public events::EventTarget
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedLength getX() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getY() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getWidth() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getHeight() =0;
-
-
- /**
- *
- */
- virtual SVGAnimatedLength getRx() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getRy() =0;
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGRectElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGCircleElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGCircleElement :
- virtual public SVGElement,
- public SVGTests,
- public SVGLangSpace,
- public SVGExternalResourcesRequired,
- public SVGStylable,
- public SVGTransformable,
- public events::EventTarget
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedLength getCx() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getCy() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getR() =0;
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGCircleElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGEllipseElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGEllipseElement :
- virtual public SVGElement,
- public SVGTests,
- public SVGLangSpace,
- public SVGExternalResourcesRequired,
- public SVGStylable,
- public SVGTransformable,
- public events::EventTarget
-{
-public:
- /**
- *
- */
- virtual SVGAnimatedLength getCx() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getCy() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getRx() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getRy() =0;
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGEllipseElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGLineElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGLineElement :
- virtual public SVGElement,
- public SVGTests,
- public SVGLangSpace,
- public SVGExternalResourcesRequired,
- public SVGStylable,
- public SVGTransformable,
- public events::EventTarget
-{
-public:
- /**
- *
- */
- virtual SVGAnimatedLength getX1() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getY1() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getX2() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getY2() =0;
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGLineElement() {}
-
-};
-
-
-
-
-/*#########################################################################
-## SVGPolylineElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGPolylineElement :
- virtual public SVGElement,
- public SVGTests,
- public SVGLangSpace,
- public SVGExternalResourcesRequired,
- public SVGStylable,
- public SVGTransformable,
- public events::EventTarget,
- public SVGAnimatedPoints
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGPolylineElement() {}
-
-};
-
-
-
-
-/*#########################################################################
-## SVGPolygonElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGPolygonElement :
- virtual public SVGElement,
- public SVGTests,
- public SVGLangSpace,
- public SVGExternalResourcesRequired,
- public SVGStylable,
- public SVGTransformable,
- public events::EventTarget,
- public SVGAnimatedPoints
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGPolygonElement() {}
-
-};
-
-
-
-
-/*#########################################################################
-## SVGTextContentElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGTextContentElement :
- virtual public SVGElement,
- public SVGTests,
- public SVGLangSpace,
- public SVGExternalResourcesRequired,
- public SVGStylable,
- public events::EventTarget
-{
-public:
-
-
-
- /**
- * lengthAdjust Types
- */
- typedef enum
- {
- LENGTHADJUST_UNKNOWN = 0,
- LENGTHADJUST_SPACING = 1,
- LENGTHADJUST_SPACINGANDGLYPHS = 2
- } LengthAdjustType;
-
-
- /**
- *
- */
- virtual SVGAnimatedLength getTextLength() =0;
-
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getLengthAdjust() =0;
-
-
- /**
- *
- */
- virtual long getNumberOfChars ( ) =0;
-
- /**
- *
- */
- virtual double getComputedTextLength ( ) =0;
-
- /**
- *
- */
- virtual double getSubStringLength (unsigned long charnum, unsigned long nchars )
- throw( DOMException ) =0;
-
- /**
- *
- */
- virtual SVGPoint getStartPositionOfChar (unsigned long charnum )
- throw( DOMException ) =0;
-
- /**
- *
- */
- virtual SVGPoint getEndPositionOfChar (unsigned long charnum )
- throw( DOMException ) =0;
-
- /**
- *
- */
- virtual SVGRect getExtentOfChar (unsigned long charnum )
- throw( DOMException ) =0;
-
- /**
- *
- */
- virtual double getRotationOfChar (unsigned long charnum )
- throw( DOMException ) =0;
-
- /**
- *
- */
- virtual long getCharNumAtPosition (const SVGPoint &point ) =0;
-
- /**
- *
- */
- virtual void selectSubString (unsigned long charnum, unsigned long nchars )
- throw( DOMException ) =0;
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGTextContentElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGTextPositioningElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGTextPositioningElement : virtual public SVGTextContentElement
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedLength getX() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getY() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getDx() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getDy() =0;
-
-
- /**
- *
- */
- virtual SVGAnimatedNumberList getRotate() =0;
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGTextPositioningElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGTextElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGTextElement : virtual public SVGTextPositioningElement,
- public SVGTransformable
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGTextElement() {}
-
-};
-
-
-
-
-/*#########################################################################
-## SVGTSpanElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGTSpanElement : virtual public SVGTextPositioningElement
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGTSpanElement() {}
-
-};
-
-
-
-
-/*#########################################################################
-## SVGTRefElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGTRefElement :
- virtual public SVGTextPositioningElement,
- public SVGURIReference
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGTRefElement() {}
-
-};
-
-
-
-
-/*#########################################################################
-## SVGTextPathElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGTextPathElement :
- virtual public SVGTextContentElement,
- public SVGURIReference
-{
-public:
-
-
-
- /**
- * textPath Method Types
- */
- typedef enum
- {
- TEXTPATH_METHODTYPE_UNKNOWN = 0,
- TEXTPATH_METHODTYPE_ALIGN = 1,
- TEXTPATH_METHODTYPE_STRETCH = 2
- } TextPathMethodType;
-
- /**
- * textPath Spacing Types
- */
- typedef enum
- {
- TEXTPATH_SPACINGTYPE_UNKNOWN = 0,
- TEXTPATH_SPACINGTYPE_AUTO = 1,
- TEXTPATH_SPACINGTYPE_EXACT = 2
- } TextPathSpacingType;
-
-
- /**
- *
- */
- virtual SVGAnimatedLength getStartOffset() =0;
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getMethod() =0;
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getSpacing() =0;
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGTextPathElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGAltGlyphElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGAltGlyphElement :
- virtual public SVGTextPositioningElement,
- public SVGURIReference
-{
-public:
-
- /**
- *
- */
- virtual DOMString getGlyphRef() =0;
-
- /**
- *
- */
- virtual void setGlyphRef(const DOMString &val)
- throw (DOMException) =0;
-
- /**
- *
- */
- virtual DOMString getFormat() =0;
-
- /**
- *
- */
- virtual void setFormat(const DOMString &val)
- throw (DOMException) =0;
-
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGAltGlyphElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGAltGlyphDefElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGAltGlyphDefElement : virtual public SVGElement
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGAltGlyphDefElement() {}
-
-};
-
-
-
-
-/*#########################################################################
-## SVGAltGlyphItemElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGAltGlyphItemElement : virtual public SVGElement
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGAltGlyphItemElement() {}
-
-};
-
-
-
-
-/*#########################################################################
-## SVGGlyphRefElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGGlyphRefElement : virtual public SVGElement,
- public SVGURIReference,
- public SVGStylable
-{
-public:
- /**
- *
- */
- virtual DOMString getGlyphRef() =0;
-
- /**
- *
- */
- virtual void setGlyphRef(const DOMString &val)
- throw (DOMException) =0;
-
- /**
- *
- */
- virtual DOMString getFormat() =0;
-
- /**
- *
- */
- virtual void setFormat(const DOMString &val)
- throw (DOMException) =0;
-
- /**
- *
- */
- virtual double getX() = 0;
-
- /**
- *
- */
- virtual void setX(double val) throw (DOMException) =0;
-
- /**
- *
- */
- virtual double getY() = 0;
-
- /**
- *
- */
- virtual void setY(double val) throw (DOMException) =0;
-
- /**
- *
- */
- virtual double getDx() = 0;
-
- /**
- *
- */
- virtual void setDx(double val) throw (DOMException) =0;
-
- /**
- *
- */
- virtual double getDy() = 0;
-
- /**
- *
- */
- virtual void setDy(double val) throw (DOMException) =0;
-
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGGlyphRefElement() {}
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGMarkerElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGMarkerElement :
- virtual public SVGElement,
- public SVGLangSpace,
- public SVGExternalResourcesRequired,
- public SVGStylable,
- public SVGFitToViewBox
-{
-public:
-
-
-
- /**
- * Marker Unit Types
- */
- typedef enum
- {
- SVG_MARKERUNITS_UNKNOWN = 0,
- SVG_MARKERUNITS_USERSPACEONUSE = 1,
- SVG_MARKERUNITS_STROKEWIDTH = 2
- } MarkerUnitType;
-
- /**
- * Marker Orientation Types
- */
- typedef enum
- {
- SVG_MARKER_ORIENT_UNKNOWN = 0,
- SVG_MARKER_ORIENT_AUTO = 1,
- SVG_MARKER_ORIENT_ANGLE = 2
- } MarkerOrientationType;
-
-
- /**
- *
- */
- virtual SVGAnimatedLength getRefX() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getRefY() =0;
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getMarkerUnits() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getMarkerWidth() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getMarkerHeight() =0;
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getOrientType() =0;
-
- /**
- *
- */
- virtual SVGAnimatedAngle getOrientAngle() =0;
-
-
- /**
- *
- */
- virtual void setOrientToAuto ( ) =0;
-
- /**
- *
- */
- virtual void setOrientToAngle (const SVGAngle &angle) =0;
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGMarkerElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGColorProfileElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGColorProfileElement :
- virtual public SVGElement,
- public SVGURIReference,
- public SVGRenderingIntent
-{
-public:
- /**
- *
- */
- virtual DOMString getLocal() =0;
-
- /**
- *
- */
- virtual void setLocal(const DOMString &val)
- throw (DOMException) =0;
-
- /**
- *
- */
- virtual DOMString getName() =0;
-
- /**
- *
- */
- virtual void setName(const DOMString &val)
- throw (DOMException) =0;
-
- /**
- *
- */
- virtual unsigned short getRenderingIntent() =0;
-
- /**
- *
- */
- virtual void setRenderingIntent(unsigned short val)
- throw (DOMException) =0;
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGColorProfileElement() {}
-
-};
-
-
-
-
-/*#########################################################################
-## SVGGradientElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGGradientElement :
- virtual public SVGElement,
- public SVGURIReference,
- public SVGExternalResourcesRequired,
- public SVGStylable,
- public SVGUnitTypes
-{
-public:
-
-
-
- /**
- * Spread Method Types
- */
- typedef enum
- {
- SVG_SPREADMETHOD_UNKNOWN = 0,
- SVG_SPREADMETHOD_PAD = 1,
- SVG_SPREADMETHOD_REFLECT = 2,
- SVG_SPREADMETHOD_REPEAT = 3
- } SpreadMethodType;
-
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getGradientUnits() =0;
-
- /**
- *
- */
- virtual SVGAnimatedTransformList getGradientTransform() =0;
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getSpreadMethod() =0;
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGGradientElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGLinearGradientElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGLinearGradientElement : virtual public SVGGradientElement
-{
-public:
-
-
- /**
- *
- */
- virtual SVGAnimatedLength getX1() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getY1() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getX2() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getY2() =0;
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGLinearGradientElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGRadialGradientElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGRadialGradientElement : virtual public SVGGradientElement
-{
-public:
-
-
- /**
- *
- */
- virtual SVGAnimatedLength getCx() =0;
-
-
- /**
- *
- */
- virtual SVGAnimatedLength getCy() =0;
-
-
- /**
- *
- */
- virtual SVGAnimatedLength getR() =0;
-
-
- /**
- *
- */
- virtual SVGAnimatedLength getFx() =0;
-
-
- /**
- *
- */
- virtual SVGAnimatedLength getFy() =0;
-
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGRadialGradientElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGStopElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGStopElement :
- virtual public SVGElement,
- public SVGStylable
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedNumber getOffset() =0;
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGStopElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGPatternElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGPatternElement :
- virtual public SVGElement,
- public SVGURIReference,
- public SVGTests,
- public SVGLangSpace,
- public SVGExternalResourcesRequired,
- public SVGStylable,
- public SVGFitToViewBox,
- public SVGUnitTypes
-{
-public:
-
-
-
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getPatternUnits() =0;
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getPatternContentUnits() =0;
-
- /**
- *
- */
- virtual SVGAnimatedTransformList getPatternTransform() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getX() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getY() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getWidth() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getHeight() =0;
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGPatternElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGClipPathElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGClipPathElement :
- virtual public SVGElement,
- public SVGTests,
- public SVGLangSpace,
- public SVGExternalResourcesRequired,
- public SVGStylable,
- public SVGTransformable,
- public SVGUnitTypes
-{
-public:
- /**
- *
- */
- virtual SVGAnimatedEnumeration getClipPathUnits() =0;
-
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGClipPathElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGMaskElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGMaskElement :
- virtual public SVGElement,
- public SVGTests,
- public SVGLangSpace,
- public SVGExternalResourcesRequired,
- public SVGStylable,
- public SVGUnitTypes
-{
-public:
-
-
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getMaskUnits() =0;
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getMaskContentUnits() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getX() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getY() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getWidth() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getHeight() =0;
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGMaskElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGFilterElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGFilterElement :
- virtual public SVGElement,
- public SVGURIReference,
- public SVGLangSpace,
- public SVGExternalResourcesRequired,
- public SVGStylable,
- public SVGUnitTypes
-{
-public:
-
-
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getFilterUnits() =0;
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getPrimitiveUnits() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getX() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getY() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getWidth() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getHeight() =0;
-
-
- /**
- *
- */
- virtual SVGAnimatedInteger getFilterResX() =0;
-
- /**
- *
- */
- virtual SVGAnimatedInteger getFilterResY() =0;
-
- /**
- *
- */
- virtual void setFilterRes (unsigned long filterResX,
- unsigned long filterResY ) =0;
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFilterElement() {}
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGFEBlendElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGFEBlendElement :
- virtual public SVGElement,
- public SVGFilterPrimitiveStandardAttributes
-{
-public:
-
-
- /**
- * Blend Mode Types
- */
- typedef enum
- {
- SVG_FEBLEND_MODE_UNKNOWN = 0,
- SVG_FEBLEND_MODE_NORMAL = 1,
- SVG_FEBLEND_MODE_MULTIPLY = 2,
- SVG_FEBLEND_MODE_SCREEN = 3,
- SVG_FEBLEND_MODE_DARKEN = 4,
- SVG_FEBLEND_MODE_LIGHTEN = 5
- } BlendModeType;
-
- /**
- *
- */
- virtual SVGAnimatedString getIn1() =0;
-
- /**
- *
- */
- virtual SVGAnimatedString getIn2() =0;
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getMode() =0;
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFEBlendElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGFEColorMatrixElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGFEColorMatrixElement :
- virtual public SVGElement,
- public SVGFilterPrimitiveStandardAttributes
-{
-public:
-
-
-
- /**
- * Color Matrix Types
- */
- typedef enum
- {
- SVG_FECOLORMATRIX_TYPE_UNKNOWN = 0,
- SVG_FECOLORMATRIX_TYPE_MATRIX = 1,
- SVG_FECOLORMATRIX_TYPE_SATURATE = 2,
- SVG_FECOLORMATRIX_TYPE_HUEROTATE = 3,
- SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA = 4
- } ColorMatrixType;
-
-
- /**
- *
- */
- virtual SVGAnimatedString getIn1() =0;
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getType() =0;
-
- /**
- *
- */
- virtual SVGAnimatedNumberList getValues() =0;
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFEColorMatrixElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGFEComponentTransferElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGFEComponentTransferElement :
- virtual public SVGElement,
- public SVGFilterPrimitiveStandardAttributes
-{
-public:
- /**
- *
- */
- virtual SVGAnimatedString getIn1() =0;
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFEComponentTransferElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGComponentTransferFunctionElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGComponentTransferFunctionElement : virtual public SVGElement
-{
-public:
-
-
- /**
- * Component Transfer Types
- */
- typedef enum
- {
- SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN = 0,
- SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY = 1,
- SVG_FECOMPONENTTRANSFER_TYPE_TABLE = 2,
- SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE = 3,
- SVG_FECOMPONENTTRANSFER_TYPE_LINEAR = 4,
- SVG_FECOMPONENTTRANSFER_TYPE_GAMMA = 5
- } ComponentTransferType;
-
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getType() =0;
-
- /**
- *
- */
- virtual SVGAnimatedNumberList getTableValues() =0;
-
- /**
- *
- */
- virtual SVGAnimatedNumber getSlope() =0;
-
- /**
- *
- */
- virtual SVGAnimatedNumber getIntercept() =0;
-
- /**
- *
- */
- virtual SVGAnimatedNumber getAmplitude() =0;
-
- /**
- *
- */
- virtual SVGAnimatedNumber getExponent() =0;
-
- /**
- *
- */
- virtual SVGAnimatedNumber getOffset() =0;
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGComponentTransferFunctionElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGFEFuncRElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGFEFuncRElement : virtual public SVGComponentTransferFunctionElement
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFEFuncRElement() {}
-
-};
-
-
-
-
-/*#########################################################################
-## SVGFEFuncGElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGFEFuncGElement : public virtual SVGComponentTransferFunctionElement
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFEFuncGElement() {}
-
-};
-
-
-
-
-/*#########################################################################
-## SVGFEFuncBElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGFEFuncBElement : virtual public SVGComponentTransferFunctionElement
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFEFuncBElement() {}
-
-};
-
-
-
-
-/*#########################################################################
-## SVGFEFuncAElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGFEFuncAElement : virtual public SVGComponentTransferFunctionElement
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFEFuncAElement() {}
-
-};
-
-
-
-
-/*#########################################################################
-## SVGFECompositeElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGFECompositeElement :
- virtual public SVGElement,
- public SVGFilterPrimitiveStandardAttributes
-{
-public:
-
-
-
- /**
- * Composite Operators
- */
- typedef enum
- {
- SVG_FECOMPOSITE_OPERATOR_UNKNOWN = 0,
- SVG_FECOMPOSITE_OPERATOR_OVER = 1,
- SVG_FECOMPOSITE_OPERATOR_IN = 2,
- SVG_FECOMPOSITE_OPERATOR_OUT = 3,
- SVG_FECOMPOSITE_OPERATOR_ATOP = 4,
- SVG_FECOMPOSITE_OPERATOR_XOR = 5,
- SVG_FECOMPOSITE_OPERATOR_ARITHMETIC = 6
- } CompositeOperatorType;
-
- /**
- *
- */
- virtual SVGAnimatedString getIn1() =0;
-
- /**
- *
- */
- virtual SVGAnimatedString getIn2() =0;
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getOperator() =0;
-
- /**
- *
- */
- virtual SVGAnimatedNumber getK1() =0;
-
- /**
- *
- */
- virtual SVGAnimatedNumber getK2() =0;
-
- /**
- *
- */
- virtual SVGAnimatedNumber getK3() =0;
-
- /**
- *
- */
- virtual SVGAnimatedNumber getK4() =0;
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFECompositeElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGFEConvolveMatrixElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGFEConvolveMatrixElement :
- virtual public SVGElement,
- public SVGFilterPrimitiveStandardAttributes
-{
-public:
-
-
-
- /**
- * Edge Mode Values
- */
- typedef enum
- {
- SVG_EDGEMODE_UNKNOWN = 0,
- SVG_EDGEMODE_DUPLICATE = 1,
- SVG_EDGEMODE_WRAP = 2,
- SVG_EDGEMODE_NONE = 3
- } EdgeModeType;
-
-
- /**
- *
- */
- virtual SVGAnimatedInteger getOrderX() =0;
-
- /**
- *
- */
- virtual SVGAnimatedInteger getOrderY() =0;
-
- /**
- *
- */
- virtual SVGAnimatedNumberList getKernelMatrix() =0;
-
- /**
- *
- */
- virtual SVGAnimatedNumber getDivisor() =0;
-
- /**
- *
- */
- virtual SVGAnimatedNumber getBias() =0;
-
- /**
- *
- */
- virtual SVGAnimatedInteger getTargetX() =0;
-
- /**
- *
- */
- virtual SVGAnimatedInteger getTargetY() =0;
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getEdgeMode() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getKernelUnitLengthX() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getKernelUnitLengthY() =0;
-
- /**
- *
- */
- virtual SVGAnimatedBoolean getPreserveAlpha() =0;
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFEConvolveMatrixElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGFEDiffuseLightingElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGFEDiffuseLightingElement :
- virtual public SVGElement,
- public SVGFilterPrimitiveStandardAttributes
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedString getIn1() =0;
-
- /**
- *
- */
- virtual SVGAnimatedNumber getSurfaceScale() =0;
-
- /**
- *
- */
- virtual SVGAnimatedNumber getDiffuseConstant() =0;
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFEDiffuseLightingElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGFEDistantLightElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGFEDistantLightElement : virtual public SVGElement
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedNumber getAzimuth() =0;
-
-
- /**
- *
- */
- virtual SVGAnimatedNumber getElevation() =0;
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFEDistantLightElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGFEPointLightElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGFEPointLightElement : virtual public SVGElement
-{
-public:
- /**
- *
- */
- virtual SVGAnimatedNumber getX() =0;
-
-
- /**
- *
- */
- virtual SVGAnimatedNumber getY() =0;
-
- /**
- *
- */
- virtual SVGAnimatedNumber getZ() =0;
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFEPointLightElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGFESpotLightElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGFESpotLightElement : virtual public SVGElement
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedNumber getX() =0;
-
-
- /**
- *
- */
- virtual SVGAnimatedNumber getY() =0;
-
- /**
- *
- */
- virtual SVGAnimatedNumber getZ() =0;
-
- /**
- *
- */
- virtual SVGAnimatedNumber getPointsAtX() =0;
-
- /**
- *
- */
- virtual SVGAnimatedNumber getPointsAtY() =0;
-
- /**
- *
- */
- virtual SVGAnimatedNumber getPointsAtZ() =0;
-
- /**
- *
- */
- virtual SVGAnimatedNumber getSpecularExponent() =0;
-
- /**
- *
- */
- virtual SVGAnimatedNumber getLimitingConeAngle() =0;
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFESpotLightElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGFEDisplacementMapElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGFEDisplacementMapElement :
- virtual public SVGElement,
- public SVGFilterPrimitiveStandardAttributes
-{
-public:
-
-
-
- /**
- * Channel Selectors
- */
- typedef enum
- {
- SVG_CHANNEL_UNKNOWN = 0,
- SVG_CHANNEL_R = 1,
- SVG_CHANNEL_G = 2,
- SVG_CHANNEL_B = 3,
- SVG_CHANNEL_A = 4
- } ChannelSelector;
-
- /**
- *
- */
- virtual SVGAnimatedString getIn1() =0;
-
- /**
- *
- */
- virtual SVGAnimatedString getIn2() =0;
-
-
- /**
- *
- */
- virtual SVGAnimatedNumber getScale() =0;
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getXChannelSelector() =0;
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getYChannelSelector() =0;
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFEDisplacementMapElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGFEFloodElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGFEFloodElement :
- virtual public SVGElement,
- public SVGFilterPrimitiveStandardAttributes
-{
-public:
- /**
- *
- */
- virtual SVGAnimatedString getIn1() =0;
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFEFloodElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGFEGaussianBlurElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGFEGaussianBlurElement :
- virtual public SVGElement,
- public SVGFilterPrimitiveStandardAttributes
-{
-public:
- /**
- *
- */
- virtual SVGAnimatedString getIn1() =0;
-
-
- /**
- *
- */
- virtual SVGAnimatedNumber getStdDeviationX() =0;
-
- /**
- *
- */
- virtual SVGAnimatedNumber getStdDeviationY() =0;
-
-
- /**
- *
- */
- virtual void setStdDeviation (double stdDeviationX, double stdDeviationY ) =0;
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFEGaussianBlurElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGFEImageElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGFEImageElement :
- virtual public SVGElement,
- public SVGURIReference,
- public SVGLangSpace,
- public SVGExternalResourcesRequired,
- public SVGFilterPrimitiveStandardAttributes
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFEImageElement() {}
-
-};
-
-
-
-
-/*#########################################################################
-## SVGFEMergeElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGFEMergeElement :
- virtual public SVGElement,
- public SVGFilterPrimitiveStandardAttributes
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFEMergeElement() {}
-
-};
-
-
-
-
-/*#########################################################################
-## SVGFEMergeNodeElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGFEMergeNodeElement : virtual public SVGElement
-{
-public:
- /**
- *
- */
- virtual SVGAnimatedString getIn1() =0;
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFEMergeNodeElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGFEMorphologyElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGFEMorphologyElement :
- virtual public SVGElement,
- public SVGFilterPrimitiveStandardAttributes
-{
-public:
-
-
-
- /**
- * Morphology Operators
- */
- typedef enum
- {
- SVG_MORPHOLOGY_OPERATOR_UNKNOWN = 0,
- SVG_MORPHOLOGY_OPERATOR_ERODE = 1,
- SVG_MORPHOLOGY_OPERATOR_DILATE = 2
- } MorphologyOperatorType;
-
-
- /**
- *
- */
- virtual SVGAnimatedString getIn1() =0;
-
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getOperator() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getRadiusX() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getRadiusY() =0;
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFEMorphologyElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGFEOffsetElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGFEOffsetElement :
- virtual public SVGElement,
- public SVGFilterPrimitiveStandardAttributes
-{
-public:
-
-
-
- /**
- *
- */
- virtual SVGAnimatedString getIn1() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getDx() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getDy() =0;
-
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFEOffsetElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGFESpecularLightingElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGFESpecularLightingElement :
- virtual public SVGElement,
- public SVGFilterPrimitiveStandardAttributes
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedString getIn1() =0;
-
- /**
- *
- */
- virtual SVGAnimatedNumber getSurfaceScale() =0;
-
- /**
- *
- */
- virtual SVGAnimatedNumber getSpecularConstant() =0;
-
- /**
- *
- */
- virtual SVGAnimatedNumber getSpecularExponent() =0;
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFESpecularLightingElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGFETileElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGFETileElement :
- virtual public SVGElement,
- public SVGFilterPrimitiveStandardAttributes
-{
-public:
-
-
- /**
- *
- */
- virtual SVGAnimatedString getIn1() =0;
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFETileElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGFETurbulenceElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGFETurbulenceElement :
- virtual public SVGElement,
- public SVGFilterPrimitiveStandardAttributes
-{
-public:
-
-
-
- /**
- * Turbulence Types
- */
- typedef enum
- {
- SVG_TURBULENCE_TYPE_UNKNOWN = 0,
- SVG_TURBULENCE_TYPE_FRACTALNOISE = 1,
- SVG_TURBULENCE_TYPE_TURBULENCE = 2
- } TurbulenceType;
-
- /**
- * Stitch Options
- */
- typedef enum
- {
- SVG_STITCHTYPE_UNKNOWN = 0,
- SVG_STITCHTYPE_STITCH = 1,
- SVG_STITCHTYPE_NOSTITCH = 2
- } StitchOption;
-
-
-
- /**
- *
- */
- virtual SVGAnimatedNumber getBaseFrequencyX() =0;
-
- /**
- *
- */
- virtual SVGAnimatedNumber getBaseFrequencyY() =0;
-
- /**
- *
- */
- virtual SVGAnimatedInteger getNumOctaves() =0;
-
- /**
- *
- */
- virtual SVGAnimatedNumber getSeed() =0;
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getStitchTiles() =0;
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getType() =0;
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFETurbulenceElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGCursorElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGCursorElement :
- virtual public SVGElement,
- public SVGURIReference,
- public SVGTests,
- public SVGExternalResourcesRequired
-{
-public:
- /**
- *
- */
- virtual SVGAnimatedLength getX() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getY() =0;
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGCursorElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGAElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGAElement : virtual public SVGElement,
- public SVGURIReference,
- public SVGTests,
- public SVGLangSpace,
- public SVGExternalResourcesRequired,
- public SVGStylable,
- public SVGTransformable,
- public events::EventTarget
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedString getTarget() =0;
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGAElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGViewElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGViewElement : virtual public SVGElement,
- public SVGExternalResourcesRequired,
- public SVGFitToViewBox,
- public SVGZoomAndPan
-{
-public:
-
- /**
- *
- */
- virtual SVGStringList getViewTarget() =0;
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGViewElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGScriptElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGScriptElement :
- virtual public SVGElement,
- public SVGURIReference,
- public SVGExternalResourcesRequired
-{
-public:
-
- /**
- *
- */
- virtual DOMString getType() =0;
-
- /**
- *
- */
- virtual void setType(const DOMString &val)
- throw (DOMException) =0;
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGScriptElement() {}
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGAnimationElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGAnimationElement :
- virtual public SVGElement,
- public SVGTests,
- public SVGExternalResourcesRequired,
- public smil::ElementTimeControl,
- public events::EventTarget
-{
-public:
-
-
- /**
- *
- */
- virtual SVGElement *getTargetElement() =0;
-
-
- /**
- *
- */
- virtual double getStartTime ( ) =0;
-
- /**
- *
- */
- virtual double getCurrentTime ( ) =0;
-
- /**
- *
- */
- virtual double getSimpleDuration ( )
- throw( DOMException ) =0;
-;
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGAnimationElement() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGAnimateElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGAnimateElement : virtual public SVGAnimationElement
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGAnimateElement() {}
-
-};
-
-
-
-
-/*#########################################################################
-## SVGSetElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGSetElement : virtual public SVGAnimationElement
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGSetElement() {}
-
-};
-
-
-
-
-/*#########################################################################
-## SVGAnimateMotionElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGAnimateMotionElement : virtual public SVGAnimationElement
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGAnimateMotionElement() {}
-
-};
-
-
-
-
-/*#########################################################################
-## SVGMPathElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGMPathElement :
- virtual public SVGElement,
- public SVGURIReference,
- public SVGExternalResourcesRequired
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGMPathElement() {}
-
-};
-
-
-
-
-/*#########################################################################
-## SVGAnimateColorElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGAnimateColorElement : virtual public SVGAnimationElement
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGAnimateColorElement() {}
-
-};
-
-
-
-
-/*#########################################################################
-## SVGAnimateTransformElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGAnimateTransformElement : virtual public SVGAnimationElement
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGAnimateTransformElement() {}
-
-};
-
-
-
-
-/*#########################################################################
-## SVGFontElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGFontElement : virtual public SVGElement,
- public SVGExternalResourcesRequired,
- public SVGStylable
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFontElement() {}
-
-};
-
-
-
-
-/*#########################################################################
-## SVGGlyphElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGGlyphElement : virtual public SVGElement,
- public SVGStylable
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGGlyphElement() {}
-
-};
-
-
-
-
-/*#########################################################################
-## SVGMissingGlyphElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGMissingGlyphElement :
- virtual public SVGElement,
- public SVGStylable
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGMissingGlyphElement() {}
-
-};
-
-
-
-
-/*#########################################################################
-## SVGHKernElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGHKernElement : virtual public SVGElement
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGHKernElement() {}
-
-};
-
-
-
-
-/*#########################################################################
-## SVGVKernElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGVKernElement : public virtual SVGElement
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGVKernElement() {}
-
-};
-
-
-
-
-/*#########################################################################
-## SVGFontFaceElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGFontFaceElement : virtual public SVGElement
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFontFaceElement() {}
-
-};
-
-
-
-
-/*#########################################################################
-## SVGFontFaceSrcElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGFontFaceSrcElement : virtual public SVGElement
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFontFaceSrcElement() {}
-
-};
-
-
-
-
-/*#########################################################################
-## SVGFontFaceUriElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGFontFaceUriElement : virtual public SVGElement
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFontFaceUriElement() {}
-
-};
-
-
-
-
-/*#########################################################################
-## SVGFontFaceFormatElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGFontFaceFormatElement : virtual public SVGElement
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFontFaceFormatElement() {}
-
-};
-
-
-
-
-/*#########################################################################
-## SVGFontFaceNameElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGFontFaceNameElement : virtual public SVGElement
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFontFaceNameElement() {}
-
-};
-
-
-
-
-/*#########################################################################
-## SVGDefinitionSrcElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGDefinitionSrcElement : virtual public SVGElement
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGDefinitionSrcElement() {}
-
-};
-
-
-
-
-/*#########################################################################
-## SVGMetadataElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGMetadataElement : virtual public SVGElement
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGMetadataElement() {}
-
-};
-
-
-
-/*#########################################################################
-## SVGForeignObjectElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGForeignObjectElement :
- virtual public SVGElement,
- public SVGTests,
- public SVGLangSpace,
- public SVGExternalResourcesRequired,
- public SVGStylable,
- public SVGTransformable,
- public events::EventTarget
-{
-public:
-
-
- /**
- *
- */
- virtual SVGAnimatedLength getX() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getY() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getWidth() =0;
-
- /**
- *
- */
- virtual SVGAnimatedLength getHeight() =0;
-
-
-
- //##################
- //# Non-API methods
- //##################
-
-
- /**
- *
- */
- virtual ~SVGForeignObjectElement() {}
-
-};
-
-
-
-
-
-} //namespace svg
-} //namespace dom
-} //namespace w3c
-} //namespace org
-
-#endif // __SVG_H__
-/*#########################################################################
-## E N D O F F I L E
-#########################################################################*/
-
+#ifndef __SVG_H__
+#define __SVG_H__
+
+/**
+ * Phoebe DOM Implementation.
+ *
+ * This is a C++ approximation of the W3C DOM model, which follows
+ * fairly closely the specifications in the various .idl files, copies of
+ * which are provided for reference. Most important is this one:
+ *
+ * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
+ *
+ * Authors:
+ * Bob Jamison
+ *
+ * Copyright (C) 2005 Bob Jamison
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+// For access to DOM2 core
+#include "dom/dom.h"
+
+// For access to DOM2 events
+#include "dom/events.h"
+
+// For access to those parts from DOM2 CSS OM used by SVG DOM.
+#include "dom/css.h"
+
+// For access to those parts from DOM2 Views OM used by SVG DOM.
+#include "dom/views.h"
+
+// For access to the SMIL OM used by SVG DOM.
+#include "dom/smil.h"
+
+
+
+#include "svgtypes.h"
+
+#include <math.h>
+
+
+
+namespace org
+{
+namespace w3c
+{
+namespace dom
+{
+namespace svg
+{
+
+
+//local definitions
+typedef dom::DOMString DOMString;
+typedef dom::DOMException DOMException;
+typedef dom::Element Element;
+typedef dom::Document Document;
+typedef dom::NodeList NodeList;
+
+
+
+class SVGSVGElement;
+
+
+
+/*#########################################################################
+## SVGElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGElement : virtual public Element
+{
+public:
+
+ /**
+ *
+ */
+ virtual DOMString getId() =0;
+
+ /**
+ *
+ */
+ virtual void setId(const DOMString &val)
+ throw (DOMException) =0;
+
+ /**
+ *
+ */
+ virtual DOMString getXmlBase() = 0;
+
+ /**
+ *
+ */
+ virtual void setXmlBase(const DOMString &val)
+ throw (DOMException) = 0;
+
+ /**
+ *
+ */
+ virtual SVGSVGElement *getOwnerSVGElement() = 0;
+
+ /**
+ *
+ */
+ virtual SVGElement *getViewportElement() = 0;
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+
+ /**
+ *
+ */
+ virtual ~SVGElement() {}
+
+
+};
+
+
+
+/*#########################################################################
+## SVGDocument
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGDocument : virtual public Document,
+ virtual public events::DocumentEvent
+{
+public:
+
+
+ /**
+ *
+ */
+ virtual DOMString getTitle() =0;
+
+ /**
+ *
+ */
+ virtual DOMString getReferrer() =0;
+
+ /**
+ *
+ */
+ virtual DOMString getDomain() =0;
+
+ /**
+ *
+ */
+ virtual DOMString getURL() =0;
+
+ /**
+ *
+ */
+ virtual SVGSVGElement *getRootElement() =0;
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGDocument() {}
+
+};
+
+
+
+/*#########################################################################
+## SVGSVGElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGSVGElement : virtual public SVGElement,
+ public SVGTests,
+ public SVGLangSpace,
+ public SVGExternalResourcesRequired,
+ public SVGStylable,
+ public SVGLocatable,
+ public SVGFitToViewBox,
+ public SVGZoomAndPan,
+ public events::EventTarget,
+ public events::DocumentEvent,
+ public css::ViewCSS,
+ public css::DocumentCSS
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getX() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getY() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getWidth() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getHeight() =0;
+
+ /**
+ *
+ */
+ virtual DOMString getContentScriptType() =0;
+
+ /**
+ *
+ */
+ virtual void setContentScriptType(const DOMString &val)
+ throw (DOMException) =0;
+
+
+ /**
+ *
+ */
+ virtual DOMString getContentStyleType() =0;
+
+ /**
+ *
+ */
+ virtual void setContentStyleType(const DOMString &val)
+ throw (DOMException) =0;
+
+ /**
+ *
+ */
+ virtual SVGRect getViewport() =0;
+
+ /**
+ *
+ */
+ virtual double getPixelUnitToMillimeterX() =0;
+
+ /**
+ *
+ */
+ virtual double getPixelUnitToMillimeterY() =0;
+
+ /**
+ *
+ */
+ virtual double getScreenPixelToMillimeterX() =0;
+
+ /**
+ *
+ */
+ virtual double getScreenPixelToMillimeterY() =0;
+
+
+ /**
+ *
+ */
+ virtual bool getUseCurrentView() =0;
+
+ /**
+ *
+ */
+ virtual void setUseCurrentView(bool val) throw (DOMException) =0;
+
+ /**
+ *
+ */
+ virtual SVGViewSpec getCurrentView() =0;
+
+
+ /**
+ *
+ */
+ virtual double getCurrentScale() =0;
+
+ /**
+ *
+ */
+ virtual void setCurrentScale(double val)
+ throw (DOMException) =0;
+
+
+ /**
+ *
+ */
+ virtual SVGPoint getCurrentTranslate() =0;
+
+
+ /**
+ *
+ */
+ virtual unsigned long suspendRedraw (unsigned long max_wait_milliseconds ) =0;
+
+ /**
+ *
+ */
+ virtual void unsuspendRedraw (unsigned long suspend_handle_id )
+ throw( DOMException ) =0;
+
+ /**
+ *
+ */
+ virtual void unsuspendRedrawAll ( ) =0;
+
+ /**
+ *
+ */
+ virtual void forceRedraw ( ) =0;
+
+ /**
+ *
+ */
+ virtual void pauseAnimations ( ) =0;
+
+ /**
+ *
+ */
+ virtual void unpauseAnimations ( ) =0;
+
+ /**
+ *
+ */
+ virtual bool animationsPaused ( ) =0;
+
+ /**
+ *
+ */
+ virtual double getCurrentTime ( ) =0;
+
+ /**
+ *
+ */
+ virtual void setCurrentTime (double seconds ) =0;
+
+ /**
+ *
+ */
+ virtual NodeList getIntersectionList (const SVGRect &rect,
+ const SVGElement *referenceElement ) =0;
+
+ /**
+ *
+ */
+ virtual NodeList getEnclosureList (const SVGRect &rect,
+ const SVGElement *referenceElement ) =0;
+
+ /**
+ *
+ */
+ virtual bool checkIntersection (const SVGElement *element, const SVGRect &rect ) =0;
+
+ /**
+ *
+ */
+ virtual bool checkEnclosure (const SVGElement *element, const SVGRect &rect ) =0;
+
+ /**
+ *
+ */
+ virtual void deselectAll ( ) =0;
+
+ /**
+ *
+ */
+ virtual SVGNumber createSVGNumber ( ) =0;
+
+ /**
+ *
+ */
+ virtual SVGLength createSVGLength ( ) =0;
+
+ /**
+ *
+ */
+ virtual SVGAngle createSVGAngle ( ) =0;
+
+ /**
+ *
+ */
+ virtual SVGPoint createSVGPoint ( ) =0;
+
+ /**
+ *
+ */
+ virtual SVGMatrix createSVGMatrix ( ) =0;
+
+ /**
+ *
+ */
+ virtual SVGRect createSVGRect ( ) =0;
+
+ /**
+ *
+ */
+ virtual SVGTransform createSVGTransform ( ) =0;
+
+ /**
+ *
+ */
+ virtual SVGTransform createSVGTransformFromMatrix(const SVGMatrix &matrix ) =0;
+
+ /**
+ *
+ */
+ virtual Element *getElementById (const DOMString& elementId ) =0;
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGSVGElement() {}
+
+};
+
+
+
+/*#########################################################################
+## SVGGElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGGElement : virtual public SVGElement,
+ public SVGTests,
+ public SVGLangSpace,
+ public SVGExternalResourcesRequired,
+ public SVGStylable,
+ public SVGTransformable,
+ public events::EventTarget
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGGElement() {}
+
+};
+
+
+
+
+/*#########################################################################
+## SVGDefsElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGDefsElement :
+ virtual public SVGElement,
+ public SVGTests,
+ public SVGLangSpace,
+ public SVGExternalResourcesRequired,
+ public SVGStylable,
+ public SVGTransformable,
+ public events::EventTarget
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGDefsElement() {}
+
+};
+
+
+
+
+/*#########################################################################
+## SVGDescElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGDescElement :
+ virtual public SVGElement,
+ public SVGLangSpace,
+ public SVGStylable
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGDescElement() {}
+
+};
+
+
+
+
+/*#########################################################################
+## SVGTitleElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGTitleElement :
+ virtual public SVGElement,
+ public SVGLangSpace,
+ public SVGStylable
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGTitleElement() {}
+
+};
+
+
+
+
+/*#########################################################################
+## SVGSymbolElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGSymbolElement :
+ virtual public SVGElement,
+ public SVGLangSpace,
+ public SVGExternalResourcesRequired,
+ public SVGStylable,
+ public SVGFitToViewBox,
+ public events::EventTarget
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGSymbolElement() {}
+
+};
+
+
+
+
+/*#########################################################################
+## SVGUseElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGUseElement :
+ virtual public SVGElement,
+ public SVGURIReference,
+ public SVGTests,
+ public SVGLangSpace,
+ public SVGExternalResourcesRequired,
+ public SVGStylable,
+ public SVGTransformable,
+ public events::EventTarget
+{
+public:
+
+
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getX() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getY() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getWidth() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getHeight() =0;
+
+ /**
+ *
+ */
+ virtual SVGElementInstance getInstanceRoot() =0;
+
+ /**
+ *
+ */
+ virtual SVGElementInstance getAnimatedInstanceRoot() =0;
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGUseElement() {}
+
+};
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGImageElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGImageElement :
+ virtual public SVGElement,
+ public SVGURIReference,
+ public SVGTests,
+ public SVGLangSpace,
+ public SVGExternalResourcesRequired,
+ public SVGStylable,
+ public SVGTransformable,
+ public events::EventTarget
+{
+public:
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getX() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getY() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getWidth() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getHeight() =0;
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedPreserveAspectRatio getPreserveAspectRatio() =0;
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGImageElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGSwitchElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGSwitchElement :
+ virtual public SVGElement,
+ public SVGTests,
+ public SVGLangSpace,
+ public SVGExternalResourcesRequired,
+ public SVGStylable,
+ public SVGTransformable,
+ public events::EventTarget
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGSwitchElement() {}
+
+};
+
+
+
+
+/*#########################################################################
+## GetSVGDocument
+#########################################################################*/
+
+/**
+ *
+ */
+class GetSVGDocument
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGDocument *getSVGDocument ( )
+ throw( DOMException ) =0;
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~GetSVGDocument() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGStyleElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGStyleElement : virtual public SVGElement
+{
+public:
+
+ /**
+ *
+ */
+ virtual DOMString getXmlspace() = 0;
+
+ /**
+ *
+ */
+ virtual void setXmlspace(const DOMString &val)
+ throw (DOMException) =0;
+
+ /**
+ *
+ */
+ virtual DOMString getType() = 0;
+
+ /**
+ *
+ */
+ virtual void setType(const DOMString &val)
+ throw (DOMException) =0;
+
+ /**
+ *
+ */
+ virtual DOMString getMedia() = 0;
+
+ /**
+ *
+ */
+ virtual void setMedia(const DOMString &val)
+ throw (DOMException) =0;
+
+ /**
+ *
+ */
+ virtual DOMString getTitle() = 0;
+
+ /**
+ *
+ */
+ virtual void setTitle(const DOMString &val)
+ throw (DOMException) =0;
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGStyleElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGPathElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGPathElement :
+ virtual public SVGElement,
+ public SVGTests,
+ public SVGLangSpace,
+ public SVGExternalResourcesRequired,
+ public SVGStylable,
+ public SVGTransformable,
+ public events::EventTarget,
+ public SVGAnimatedPathData
+{
+public:
+
+
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getPathLength() =0;
+
+ /**
+ *
+ */
+ virtual double getTotalLength ( ) =0;
+
+ /**
+ *
+ */
+ virtual SVGPoint getPointAtLength (double distance ) =0;
+
+ /**
+ *
+ */
+ virtual unsigned long getPathSegAtLength (double distance ) =0;
+
+ /**
+ *
+ */
+ virtual SVGPathSegClosePath
+ createSVGPathSegClosePath ( ) =0;
+
+ /**
+ *
+ */
+ virtual SVGPathSegMovetoAbs
+ createSVGPathSegMovetoAbs (double x, double y ) =0;
+
+ /**
+ *
+ */
+ virtual SVGPathSegMovetoRel
+ createSVGPathSegMovetoRel (double x, double y ) =0;
+
+ /**
+ *
+ */
+ virtual SVGPathSegLinetoAbs
+ createSVGPathSegLinetoAbs (double x, double y ) =0;
+
+ /**
+ *
+ */
+ virtual SVGPathSegLinetoRel
+ createSVGPathSegLinetoRel (double x, double y ) =0;
+
+ /**
+ *
+ */
+ virtual SVGPathSegCurvetoCubicAbs
+ createSVGPathSegCurvetoCubicAbs (double x, double y,
+ double x1, double y1, double x2, double y2 ) =0;
+
+ /**
+ *
+ */
+ virtual SVGPathSegCurvetoCubicRel
+ createSVGPathSegCurvetoCubicRel (double x, double y,
+ double x1, double y1, double x2, double y2 ) =0;
+
+ /**
+ *
+ */
+ virtual SVGPathSegCurvetoQuadraticAbs
+ createSVGPathSegCurvetoQuadraticAbs (double x, double y,
+ double x1, double y1 ) =0;
+
+ /**
+ *
+ */
+ virtual SVGPathSegCurvetoQuadraticRel
+ createSVGPathSegCurvetoQuadraticRel (double x, double y,
+ double x1, double y1 ) =0;
+
+ /**
+ *
+ */
+ virtual SVGPathSegArcAbs
+ createSVGPathSegArcAbs (double x, double y,
+ double r1, double r2, double angle,
+ bool largeArcFlag, bool sweepFlag ) =0;
+
+ /**
+ *
+ */
+ virtual SVGPathSegArcRel
+ createSVGPathSegArcRel (double x, double y, double r1,
+ double r2, double angle, bool largeArcFlag,
+ bool sweepFlag ) =0;
+
+ /**
+ *
+ */
+ virtual SVGPathSegLinetoHorizontalAbs
+ createSVGPathSegLinetoHorizontalAbs (double x ) =0;
+
+ /**
+ *
+ */
+ virtual SVGPathSegLinetoHorizontalRel
+ createSVGPathSegLinetoHorizontalRel (double x ) =0;
+
+ /**
+ *
+ */
+ virtual SVGPathSegLinetoVerticalAbs
+ createSVGPathSegLinetoVerticalAbs (double y ) =0;
+
+ /**
+ *
+ */
+ virtual SVGPathSegLinetoVerticalRel
+ createSVGPathSegLinetoVerticalRel (double y ) =0;
+
+ /**
+ *
+ */
+ virtual SVGPathSegCurvetoCubicSmoothAbs
+ createSVGPathSegCurvetoCubicSmoothAbs (double x, double y,
+ double x2, double y2 ) =0;
+
+ /**
+ *
+ */
+ virtual SVGPathSegCurvetoCubicSmoothRel
+ createSVGPathSegCurvetoCubicSmoothRel (double x, double y,
+ double x2, double y2 ) =0;
+
+ /**
+ *
+ */
+ virtual SVGPathSegCurvetoQuadraticSmoothAbs
+ createSVGPathSegCurvetoQuadraticSmoothAbs (double x, double y ) =0;
+
+ /**
+ *
+ */
+ virtual SVGPathSegCurvetoQuadraticSmoothRel
+ createSVGPathSegCurvetoQuadraticSmoothRel (double x, double y ) =0;
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGPathElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGRectElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGRectElement :
+ virtual public SVGElement,
+ public SVGTests,
+ public SVGLangSpace,
+ public SVGExternalResourcesRequired,
+ public SVGStylable,
+ public SVGTransformable,
+ public events::EventTarget
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getX() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getY() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getWidth() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getHeight() =0;
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getRx() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getRy() =0;
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGRectElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGCircleElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGCircleElement :
+ virtual public SVGElement,
+ public SVGTests,
+ public SVGLangSpace,
+ public SVGExternalResourcesRequired,
+ public SVGStylable,
+ public SVGTransformable,
+ public events::EventTarget
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getCx() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getCy() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getR() =0;
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGCircleElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGEllipseElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGEllipseElement :
+ virtual public SVGElement,
+ public SVGTests,
+ public SVGLangSpace,
+ public SVGExternalResourcesRequired,
+ public SVGStylable,
+ public SVGTransformable,
+ public events::EventTarget
+{
+public:
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getCx() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getCy() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getRx() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getRy() =0;
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGEllipseElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGLineElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGLineElement :
+ virtual public SVGElement,
+ public SVGTests,
+ public SVGLangSpace,
+ public SVGExternalResourcesRequired,
+ public SVGStylable,
+ public SVGTransformable,
+ public events::EventTarget
+{
+public:
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getX1() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getY1() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getX2() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getY2() =0;
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGLineElement() {}
+
+};
+
+
+
+
+/*#########################################################################
+## SVGPolylineElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGPolylineElement :
+ virtual public SVGElement,
+ public SVGTests,
+ public SVGLangSpace,
+ public SVGExternalResourcesRequired,
+ public SVGStylable,
+ public SVGTransformable,
+ public events::EventTarget,
+ public SVGAnimatedPoints
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGPolylineElement() {}
+
+};
+
+
+
+
+/*#########################################################################
+## SVGPolygonElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGPolygonElement :
+ virtual public SVGElement,
+ public SVGTests,
+ public SVGLangSpace,
+ public SVGExternalResourcesRequired,
+ public SVGStylable,
+ public SVGTransformable,
+ public events::EventTarget,
+ public SVGAnimatedPoints
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGPolygonElement() {}
+
+};
+
+
+
+
+/*#########################################################################
+## SVGTextContentElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGTextContentElement :
+ virtual public SVGElement,
+ public SVGTests,
+ public SVGLangSpace,
+ public SVGExternalResourcesRequired,
+ public SVGStylable,
+ public events::EventTarget
+{
+public:
+
+
+
+ /**
+ * lengthAdjust Types
+ */
+ typedef enum
+ {
+ LENGTHADJUST_UNKNOWN = 0,
+ LENGTHADJUST_SPACING = 1,
+ LENGTHADJUST_SPACINGANDGLYPHS = 2
+ } LengthAdjustType;
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getTextLength() =0;
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getLengthAdjust() =0;
+
+
+ /**
+ *
+ */
+ virtual long getNumberOfChars ( ) =0;
+
+ /**
+ *
+ */
+ virtual double getComputedTextLength ( ) =0;
+
+ /**
+ *
+ */
+ virtual double getSubStringLength (unsigned long charnum, unsigned long nchars )
+ throw( DOMException ) =0;
+
+ /**
+ *
+ */
+ virtual SVGPoint getStartPositionOfChar (unsigned long charnum )
+ throw( DOMException ) =0;
+
+ /**
+ *
+ */
+ virtual SVGPoint getEndPositionOfChar (unsigned long charnum )
+ throw( DOMException ) =0;
+
+ /**
+ *
+ */
+ virtual SVGRect getExtentOfChar (unsigned long charnum )
+ throw( DOMException ) =0;
+
+ /**
+ *
+ */
+ virtual double getRotationOfChar (unsigned long charnum )
+ throw( DOMException ) =0;
+
+ /**
+ *
+ */
+ virtual long getCharNumAtPosition (const SVGPoint &point ) =0;
+
+ /**
+ *
+ */
+ virtual void selectSubString (unsigned long charnum, unsigned long nchars )
+ throw( DOMException ) =0;
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGTextContentElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGTextPositioningElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGTextPositioningElement : virtual public SVGTextContentElement
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getX() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getY() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getDx() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getDy() =0;
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumberList getRotate() =0;
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGTextPositioningElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGTextElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGTextElement : virtual public SVGTextPositioningElement,
+ public SVGTransformable
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGTextElement() {}
+
+};
+
+
+
+
+/*#########################################################################
+## SVGTSpanElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGTSpanElement : virtual public SVGTextPositioningElement
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGTSpanElement() {}
+
+};
+
+
+
+
+/*#########################################################################
+## SVGTRefElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGTRefElement :
+ virtual public SVGTextPositioningElement,
+ public SVGURIReference
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGTRefElement() {}
+
+};
+
+
+
+
+/*#########################################################################
+## SVGTextPathElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGTextPathElement :
+ virtual public SVGTextContentElement,
+ public SVGURIReference
+{
+public:
+
+
+
+ /**
+ * textPath Method Types
+ */
+ typedef enum
+ {
+ TEXTPATH_METHODTYPE_UNKNOWN = 0,
+ TEXTPATH_METHODTYPE_ALIGN = 1,
+ TEXTPATH_METHODTYPE_STRETCH = 2
+ } TextPathMethodType;
+
+ /**
+ * textPath Spacing Types
+ */
+ typedef enum
+ {
+ TEXTPATH_SPACINGTYPE_UNKNOWN = 0,
+ TEXTPATH_SPACINGTYPE_AUTO = 1,
+ TEXTPATH_SPACINGTYPE_EXACT = 2
+ } TextPathSpacingType;
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getStartOffset() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getMethod() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getSpacing() =0;
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGTextPathElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGAltGlyphElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGAltGlyphElement :
+ virtual public SVGTextPositioningElement,
+ public SVGURIReference
+{
+public:
+
+ /**
+ *
+ */
+ virtual DOMString getGlyphRef() =0;
+
+ /**
+ *
+ */
+ virtual void setGlyphRef(const DOMString &val)
+ throw (DOMException) =0;
+
+ /**
+ *
+ */
+ virtual DOMString getFormat() =0;
+
+ /**
+ *
+ */
+ virtual void setFormat(const DOMString &val)
+ throw (DOMException) =0;
+
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGAltGlyphElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGAltGlyphDefElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGAltGlyphDefElement : virtual public SVGElement
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGAltGlyphDefElement() {}
+
+};
+
+
+
+
+/*#########################################################################
+## SVGAltGlyphItemElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGAltGlyphItemElement : virtual public SVGElement
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGAltGlyphItemElement() {}
+
+};
+
+
+
+
+/*#########################################################################
+## SVGGlyphRefElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGGlyphRefElement : virtual public SVGElement,
+ public SVGURIReference,
+ public SVGStylable
+{
+public:
+ /**
+ *
+ */
+ virtual DOMString getGlyphRef() =0;
+
+ /**
+ *
+ */
+ virtual void setGlyphRef(const DOMString &val)
+ throw (DOMException) =0;
+
+ /**
+ *
+ */
+ virtual DOMString getFormat() =0;
+
+ /**
+ *
+ */
+ virtual void setFormat(const DOMString &val)
+ throw (DOMException) =0;
+
+ /**
+ *
+ */
+ virtual double getX() = 0;
+
+ /**
+ *
+ */
+ virtual void setX(double val) throw (DOMException) =0;
+
+ /**
+ *
+ */
+ virtual double getY() = 0;
+
+ /**
+ *
+ */
+ virtual void setY(double val) throw (DOMException) =0;
+
+ /**
+ *
+ */
+ virtual double getDx() = 0;
+
+ /**
+ *
+ */
+ virtual void setDx(double val) throw (DOMException) =0;
+
+ /**
+ *
+ */
+ virtual double getDy() = 0;
+
+ /**
+ *
+ */
+ virtual void setDy(double val) throw (DOMException) =0;
+
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGGlyphRefElement() {}
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGMarkerElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGMarkerElement :
+ virtual public SVGElement,
+ public SVGLangSpace,
+ public SVGExternalResourcesRequired,
+ public SVGStylable,
+ public SVGFitToViewBox
+{
+public:
+
+
+
+ /**
+ * Marker Unit Types
+ */
+ typedef enum
+ {
+ SVG_MARKERUNITS_UNKNOWN = 0,
+ SVG_MARKERUNITS_USERSPACEONUSE = 1,
+ SVG_MARKERUNITS_STROKEWIDTH = 2
+ } MarkerUnitType;
+
+ /**
+ * Marker Orientation Types
+ */
+ typedef enum
+ {
+ SVG_MARKER_ORIENT_UNKNOWN = 0,
+ SVG_MARKER_ORIENT_AUTO = 1,
+ SVG_MARKER_ORIENT_ANGLE = 2
+ } MarkerOrientationType;
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getRefX() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getRefY() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getMarkerUnits() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getMarkerWidth() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getMarkerHeight() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getOrientType() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedAngle getOrientAngle() =0;
+
+
+ /**
+ *
+ */
+ virtual void setOrientToAuto ( ) =0;
+
+ /**
+ *
+ */
+ virtual void setOrientToAngle (const SVGAngle &angle) =0;
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGMarkerElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGColorProfileElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGColorProfileElement :
+ virtual public SVGElement,
+ public SVGURIReference,
+ public SVGRenderingIntent
+{
+public:
+ /**
+ *
+ */
+ virtual DOMString getLocal() =0;
+
+ /**
+ *
+ */
+ virtual void setLocal(const DOMString &val)
+ throw (DOMException) =0;
+
+ /**
+ *
+ */
+ virtual DOMString getName() =0;
+
+ /**
+ *
+ */
+ virtual void setName(const DOMString &val)
+ throw (DOMException) =0;
+
+ /**
+ *
+ */
+ virtual unsigned short getRenderingIntent() =0;
+
+ /**
+ *
+ */
+ virtual void setRenderingIntent(unsigned short val)
+ throw (DOMException) =0;
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGColorProfileElement() {}
+
+};
+
+
+
+
+/*#########################################################################
+## SVGGradientElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGGradientElement :
+ virtual public SVGElement,
+ public SVGURIReference,
+ public SVGExternalResourcesRequired,
+ public SVGStylable,
+ public SVGUnitTypes
+{
+public:
+
+
+
+ /**
+ * Spread Method Types
+ */
+ typedef enum
+ {
+ SVG_SPREADMETHOD_UNKNOWN = 0,
+ SVG_SPREADMETHOD_PAD = 1,
+ SVG_SPREADMETHOD_REFLECT = 2,
+ SVG_SPREADMETHOD_REPEAT = 3
+ } SpreadMethodType;
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getGradientUnits() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedTransformList getGradientTransform() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getSpreadMethod() =0;
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGGradientElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGLinearGradientElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGLinearGradientElement : virtual public SVGGradientElement
+{
+public:
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getX1() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getY1() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getX2() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getY2() =0;
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGLinearGradientElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGRadialGradientElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGRadialGradientElement : virtual public SVGGradientElement
+{
+public:
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getCx() =0;
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getCy() =0;
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getR() =0;
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getFx() =0;
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getFy() =0;
+
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGRadialGradientElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGStopElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGStopElement :
+ virtual public SVGElement,
+ public SVGStylable
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getOffset() =0;
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGStopElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGPatternElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGPatternElement :
+ virtual public SVGElement,
+ public SVGURIReference,
+ public SVGTests,
+ public SVGLangSpace,
+ public SVGExternalResourcesRequired,
+ public SVGStylable,
+ public SVGFitToViewBox,
+ public SVGUnitTypes
+{
+public:
+
+
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getPatternUnits() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getPatternContentUnits() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedTransformList getPatternTransform() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getX() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getY() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getWidth() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getHeight() =0;
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGPatternElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGClipPathElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGClipPathElement :
+ virtual public SVGElement,
+ public SVGTests,
+ public SVGLangSpace,
+ public SVGExternalResourcesRequired,
+ public SVGStylable,
+ public SVGTransformable,
+ public SVGUnitTypes
+{
+public:
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getClipPathUnits() =0;
+
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGClipPathElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGMaskElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGMaskElement :
+ virtual public SVGElement,
+ public SVGTests,
+ public SVGLangSpace,
+ public SVGExternalResourcesRequired,
+ public SVGStylable,
+ public SVGUnitTypes
+{
+public:
+
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getMaskUnits() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getMaskContentUnits() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getX() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getY() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getWidth() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getHeight() =0;
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGMaskElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGFilterElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFilterElement :
+ virtual public SVGElement,
+ public SVGURIReference,
+ public SVGLangSpace,
+ public SVGExternalResourcesRequired,
+ public SVGStylable,
+ public SVGUnitTypes
+{
+public:
+
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getFilterUnits() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getPrimitiveUnits() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getX() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getY() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getWidth() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getHeight() =0;
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedInteger getFilterResX() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedInteger getFilterResY() =0;
+
+ /**
+ *
+ */
+ virtual void setFilterRes (unsigned long filterResX,
+ unsigned long filterResY ) =0;
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFilterElement() {}
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGFEBlendElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFEBlendElement :
+ virtual public SVGElement,
+ public SVGFilterPrimitiveStandardAttributes
+{
+public:
+
+
+ /**
+ * Blend Mode Types
+ */
+ typedef enum
+ {
+ SVG_FEBLEND_MODE_UNKNOWN = 0,
+ SVG_FEBLEND_MODE_NORMAL = 1,
+ SVG_FEBLEND_MODE_MULTIPLY = 2,
+ SVG_FEBLEND_MODE_SCREEN = 3,
+ SVG_FEBLEND_MODE_DARKEN = 4,
+ SVG_FEBLEND_MODE_LIGHTEN = 5
+ } BlendModeType;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedString getIn1() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedString getIn2() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getMode() =0;
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFEBlendElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGFEColorMatrixElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFEColorMatrixElement :
+ virtual public SVGElement,
+ public SVGFilterPrimitiveStandardAttributes
+{
+public:
+
+
+
+ /**
+ * Color Matrix Types
+ */
+ typedef enum
+ {
+ SVG_FECOLORMATRIX_TYPE_UNKNOWN = 0,
+ SVG_FECOLORMATRIX_TYPE_MATRIX = 1,
+ SVG_FECOLORMATRIX_TYPE_SATURATE = 2,
+ SVG_FECOLORMATRIX_TYPE_HUEROTATE = 3,
+ SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA = 4
+ } ColorMatrixType;
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedString getIn1() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getType() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumberList getValues() =0;
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFEColorMatrixElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGFEComponentTransferElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFEComponentTransferElement :
+ virtual public SVGElement,
+ public SVGFilterPrimitiveStandardAttributes
+{
+public:
+ /**
+ *
+ */
+ virtual SVGAnimatedString getIn1() =0;
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFEComponentTransferElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGComponentTransferFunctionElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGComponentTransferFunctionElement : virtual public SVGElement
+{
+public:
+
+
+ /**
+ * Component Transfer Types
+ */
+ typedef enum
+ {
+ SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN = 0,
+ SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY = 1,
+ SVG_FECOMPONENTTRANSFER_TYPE_TABLE = 2,
+ SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE = 3,
+ SVG_FECOMPONENTTRANSFER_TYPE_LINEAR = 4,
+ SVG_FECOMPONENTTRANSFER_TYPE_GAMMA = 5
+ } ComponentTransferType;
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getType() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumberList getTableValues() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getSlope() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getIntercept() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getAmplitude() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getExponent() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getOffset() =0;
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGComponentTransferFunctionElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGFEFuncRElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFEFuncRElement : virtual public SVGComponentTransferFunctionElement
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFEFuncRElement() {}
+
+};
+
+
+
+
+/*#########################################################################
+## SVGFEFuncGElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFEFuncGElement : public virtual SVGComponentTransferFunctionElement
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFEFuncGElement() {}
+
+};
+
+
+
+
+/*#########################################################################
+## SVGFEFuncBElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFEFuncBElement : virtual public SVGComponentTransferFunctionElement
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFEFuncBElement() {}
+
+};
+
+
+
+
+/*#########################################################################
+## SVGFEFuncAElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFEFuncAElement : virtual public SVGComponentTransferFunctionElement
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFEFuncAElement() {}
+
+};
+
+
+
+
+/*#########################################################################
+## SVGFECompositeElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFECompositeElement :
+ virtual public SVGElement,
+ public SVGFilterPrimitiveStandardAttributes
+{
+public:
+
+
+
+ /**
+ * Composite Operators
+ */
+ typedef enum
+ {
+ SVG_FECOMPOSITE_OPERATOR_UNKNOWN = 0,
+ SVG_FECOMPOSITE_OPERATOR_OVER = 1,
+ SVG_FECOMPOSITE_OPERATOR_IN = 2,
+ SVG_FECOMPOSITE_OPERATOR_OUT = 3,
+ SVG_FECOMPOSITE_OPERATOR_ATOP = 4,
+ SVG_FECOMPOSITE_OPERATOR_XOR = 5,
+ SVG_FECOMPOSITE_OPERATOR_ARITHMETIC = 6
+ } CompositeOperatorType;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedString getIn1() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedString getIn2() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getOperator() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getK1() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getK2() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getK3() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getK4() =0;
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFECompositeElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGFEConvolveMatrixElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFEConvolveMatrixElement :
+ virtual public SVGElement,
+ public SVGFilterPrimitiveStandardAttributes
+{
+public:
+
+
+
+ /**
+ * Edge Mode Values
+ */
+ typedef enum
+ {
+ SVG_EDGEMODE_UNKNOWN = 0,
+ SVG_EDGEMODE_DUPLICATE = 1,
+ SVG_EDGEMODE_WRAP = 2,
+ SVG_EDGEMODE_NONE = 3
+ } EdgeModeType;
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedInteger getOrderX() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedInteger getOrderY() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumberList getKernelMatrix() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getDivisor() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getBias() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedInteger getTargetX() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedInteger getTargetY() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getEdgeMode() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getKernelUnitLengthX() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getKernelUnitLengthY() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedBoolean getPreserveAlpha() =0;
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFEConvolveMatrixElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGFEDiffuseLightingElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFEDiffuseLightingElement :
+ virtual public SVGElement,
+ public SVGFilterPrimitiveStandardAttributes
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedString getIn1() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getSurfaceScale() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getDiffuseConstant() =0;
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFEDiffuseLightingElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGFEDistantLightElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFEDistantLightElement : virtual public SVGElement
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getAzimuth() =0;
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getElevation() =0;
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFEDistantLightElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGFEPointLightElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFEPointLightElement : virtual public SVGElement
+{
+public:
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getX() =0;
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getY() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getZ() =0;
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFEPointLightElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGFESpotLightElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFESpotLightElement : virtual public SVGElement
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getX() =0;
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getY() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getZ() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getPointsAtX() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getPointsAtY() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getPointsAtZ() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getSpecularExponent() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getLimitingConeAngle() =0;
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFESpotLightElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGFEDisplacementMapElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFEDisplacementMapElement :
+ virtual public SVGElement,
+ public SVGFilterPrimitiveStandardAttributes
+{
+public:
+
+
+
+ /**
+ * Channel Selectors
+ */
+ typedef enum
+ {
+ SVG_CHANNEL_UNKNOWN = 0,
+ SVG_CHANNEL_R = 1,
+ SVG_CHANNEL_G = 2,
+ SVG_CHANNEL_B = 3,
+ SVG_CHANNEL_A = 4
+ } ChannelSelector;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedString getIn1() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedString getIn2() =0;
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getScale() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getXChannelSelector() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getYChannelSelector() =0;
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFEDisplacementMapElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGFEFloodElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFEFloodElement :
+ virtual public SVGElement,
+ public SVGFilterPrimitiveStandardAttributes
+{
+public:
+ /**
+ *
+ */
+ virtual SVGAnimatedString getIn1() =0;
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFEFloodElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGFEGaussianBlurElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFEGaussianBlurElement :
+ virtual public SVGElement,
+ public SVGFilterPrimitiveStandardAttributes
+{
+public:
+ /**
+ *
+ */
+ virtual SVGAnimatedString getIn1() =0;
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getStdDeviationX() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getStdDeviationY() =0;
+
+
+ /**
+ *
+ */
+ virtual void setStdDeviation (double stdDeviationX, double stdDeviationY ) =0;
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFEGaussianBlurElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGFEImageElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFEImageElement :
+ virtual public SVGElement,
+ public SVGURIReference,
+ public SVGLangSpace,
+ public SVGExternalResourcesRequired,
+ public SVGFilterPrimitiveStandardAttributes
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFEImageElement() {}
+
+};
+
+
+
+
+/*#########################################################################
+## SVGFEMergeElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFEMergeElement :
+ virtual public SVGElement,
+ public SVGFilterPrimitiveStandardAttributes
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFEMergeElement() {}
+
+};
+
+
+
+
+/*#########################################################################
+## SVGFEMergeNodeElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFEMergeNodeElement : virtual public SVGElement
+{
+public:
+ /**
+ *
+ */
+ virtual SVGAnimatedString getIn1() =0;
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFEMergeNodeElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGFEMorphologyElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFEMorphologyElement :
+ virtual public SVGElement,
+ public SVGFilterPrimitiveStandardAttributes
+{
+public:
+
+
+
+ /**
+ * Morphology Operators
+ */
+ typedef enum
+ {
+ SVG_MORPHOLOGY_OPERATOR_UNKNOWN = 0,
+ SVG_MORPHOLOGY_OPERATOR_ERODE = 1,
+ SVG_MORPHOLOGY_OPERATOR_DILATE = 2
+ } MorphologyOperatorType;
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedString getIn1() =0;
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getOperator() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getRadiusX() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getRadiusY() =0;
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFEMorphologyElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGFEOffsetElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFEOffsetElement :
+ virtual public SVGElement,
+ public SVGFilterPrimitiveStandardAttributes
+{
+public:
+
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedString getIn1() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getDx() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getDy() =0;
+
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFEOffsetElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGFESpecularLightingElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFESpecularLightingElement :
+ virtual public SVGElement,
+ public SVGFilterPrimitiveStandardAttributes
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedString getIn1() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getSurfaceScale() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getSpecularConstant() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getSpecularExponent() =0;
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFESpecularLightingElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGFETileElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFETileElement :
+ virtual public SVGElement,
+ public SVGFilterPrimitiveStandardAttributes
+{
+public:
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedString getIn1() =0;
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFETileElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGFETurbulenceElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFETurbulenceElement :
+ virtual public SVGElement,
+ public SVGFilterPrimitiveStandardAttributes
+{
+public:
+
+
+
+ /**
+ * Turbulence Types
+ */
+ typedef enum
+ {
+ SVG_TURBULENCE_TYPE_UNKNOWN = 0,
+ SVG_TURBULENCE_TYPE_FRACTALNOISE = 1,
+ SVG_TURBULENCE_TYPE_TURBULENCE = 2
+ } TurbulenceType;
+
+ /**
+ * Stitch Options
+ */
+ typedef enum
+ {
+ SVG_STITCHTYPE_UNKNOWN = 0,
+ SVG_STITCHTYPE_STITCH = 1,
+ SVG_STITCHTYPE_NOSTITCH = 2
+ } StitchOption;
+
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getBaseFrequencyX() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getBaseFrequencyY() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedInteger getNumOctaves() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getSeed() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getStitchTiles() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getType() =0;
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFETurbulenceElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGCursorElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGCursorElement :
+ virtual public SVGElement,
+ public SVGURIReference,
+ public SVGTests,
+ public SVGExternalResourcesRequired
+{
+public:
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getX() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getY() =0;
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGCursorElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGAElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGAElement : virtual public SVGElement,
+ public SVGURIReference,
+ public SVGTests,
+ public SVGLangSpace,
+ public SVGExternalResourcesRequired,
+ public SVGStylable,
+ public SVGTransformable,
+ public events::EventTarget
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedString getTarget() =0;
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGAElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGViewElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGViewElement : virtual public SVGElement,
+ public SVGExternalResourcesRequired,
+ public SVGFitToViewBox,
+ public SVGZoomAndPan
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGStringList getViewTarget() =0;
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGViewElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGScriptElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGScriptElement :
+ virtual public SVGElement,
+ public SVGURIReference,
+ public SVGExternalResourcesRequired
+{
+public:
+
+ /**
+ *
+ */
+ virtual DOMString getType() =0;
+
+ /**
+ *
+ */
+ virtual void setType(const DOMString &val)
+ throw (DOMException) =0;
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGScriptElement() {}
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGAnimationElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGAnimationElement :
+ virtual public SVGElement,
+ public SVGTests,
+ public SVGExternalResourcesRequired,
+ public smil::ElementTimeControl,
+ public events::EventTarget
+{
+public:
+
+
+ /**
+ *
+ */
+ virtual SVGElement *getTargetElement() =0;
+
+
+ /**
+ *
+ */
+ virtual double getStartTime ( ) =0;
+
+ /**
+ *
+ */
+ virtual double getCurrentTime ( ) =0;
+
+ /**
+ *
+ */
+ virtual double getSimpleDuration ( )
+ throw( DOMException ) =0;
+;
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGAnimationElement() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGAnimateElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGAnimateElement : virtual public SVGAnimationElement
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGAnimateElement() {}
+
+};
+
+
+
+
+/*#########################################################################
+## SVGSetElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGSetElement : virtual public SVGAnimationElement
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGSetElement() {}
+
+};
+
+
+
+
+/*#########################################################################
+## SVGAnimateMotionElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGAnimateMotionElement : virtual public SVGAnimationElement
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGAnimateMotionElement() {}
+
+};
+
+
+
+
+/*#########################################################################
+## SVGMPathElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGMPathElement :
+ virtual public SVGElement,
+ public SVGURIReference,
+ public SVGExternalResourcesRequired
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGMPathElement() {}
+
+};
+
+
+
+
+/*#########################################################################
+## SVGAnimateColorElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGAnimateColorElement : virtual public SVGAnimationElement
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGAnimateColorElement() {}
+
+};
+
+
+
+
+/*#########################################################################
+## SVGAnimateTransformElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGAnimateTransformElement : virtual public SVGAnimationElement
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGAnimateTransformElement() {}
+
+};
+
+
+
+
+/*#########################################################################
+## SVGFontElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFontElement : virtual public SVGElement,
+ public SVGExternalResourcesRequired,
+ public SVGStylable
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFontElement() {}
+
+};
+
+
+
+
+/*#########################################################################
+## SVGGlyphElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGGlyphElement : virtual public SVGElement,
+ public SVGStylable
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGGlyphElement() {}
+
+};
+
+
+
+
+/*#########################################################################
+## SVGMissingGlyphElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGMissingGlyphElement :
+ virtual public SVGElement,
+ public SVGStylable
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGMissingGlyphElement() {}
+
+};
+
+
+
+
+/*#########################################################################
+## SVGHKernElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGHKernElement : virtual public SVGElement
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGHKernElement() {}
+
+};
+
+
+
+
+/*#########################################################################
+## SVGVKernElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGVKernElement : public virtual SVGElement
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGVKernElement() {}
+
+};
+
+
+
+
+/*#########################################################################
+## SVGFontFaceElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFontFaceElement : virtual public SVGElement
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFontFaceElement() {}
+
+};
+
+
+
+
+/*#########################################################################
+## SVGFontFaceSrcElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFontFaceSrcElement : virtual public SVGElement
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFontFaceSrcElement() {}
+
+};
+
+
+
+
+/*#########################################################################
+## SVGFontFaceUriElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFontFaceUriElement : virtual public SVGElement
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFontFaceUriElement() {}
+
+};
+
+
+
+
+/*#########################################################################
+## SVGFontFaceFormatElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFontFaceFormatElement : virtual public SVGElement
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFontFaceFormatElement() {}
+
+};
+
+
+
+
+/*#########################################################################
+## SVGFontFaceNameElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFontFaceNameElement : virtual public SVGElement
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFontFaceNameElement() {}
+
+};
+
+
+
+
+/*#########################################################################
+## SVGDefinitionSrcElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGDefinitionSrcElement : virtual public SVGElement
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGDefinitionSrcElement() {}
+
+};
+
+
+
+
+/*#########################################################################
+## SVGMetadataElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGMetadataElement : virtual public SVGElement
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGMetadataElement() {}
+
+};
+
+
+
+/*#########################################################################
+## SVGForeignObjectElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGForeignObjectElement :
+ virtual public SVGElement,
+ public SVGTests,
+ public SVGLangSpace,
+ public SVGExternalResourcesRequired,
+ public SVGStylable,
+ public SVGTransformable,
+ public events::EventTarget
+{
+public:
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getX() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getY() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getWidth() =0;
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getHeight() =0;
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+
+ /**
+ *
+ */
+ virtual ~SVGForeignObjectElement() {}
+
+};
+
+
+
+
+
+} //namespace svg
+} //namespace dom
+} //namespace w3c
+} //namespace org
+
+#endif // __SVG_H__
+/*#########################################################################
+## E N D O F F I L E
+#########################################################################*/
+
diff --git a/src/dom/svg/svgimpl.h b/src/dom/svg/svgimpl.h
index 2e70590cb..a9f6ace9b 100644
--- a/src/dom/svg/svgimpl.h
+++ b/src/dom/svg/svgimpl.h
@@ -1,5108 +1,5108 @@
-#ifndef __SVGIMPL_H__
-#define __SVGIMPL_H__
-
-/**
- * Phoebe DOM Implementation.
- *
- * This is a C++ approximation of the W3C DOM model, which follows
- * fairly closely the specifications in the various .idl files, copies of
- * which are provided for reference. Most important is this one:
- *
- * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
- *
- * Authors:
- * Bob Jamison
- *
- * Copyright (C) 2006 Bob Jamison
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-#include "svg.h"
-#include "dom/domimpl.h"
-#include "dom/smilimpl.h"
-
-#include <math.h>
-
-
-
-namespace org
-{
-namespace w3c
-{
-namespace dom
-{
-namespace svg
-{
-
-
-//local definitions
-typedef dom::DOMString DOMString;
-typedef dom::DOMException DOMException;
-typedef dom::Element Element;
-typedef dom::Document Document;
-typedef dom::NodeList NodeList;
-
-
-
-class SVGSVGElementImpl;
-
-/*#########################################################################
-## SVGDocumentImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGDocumentImpl : virtual public SVGDocument, public DocumentImpl
-{
-public:
-
-
- /**
- *
- */
- virtual DOMString getTitle()
- { return title; }
-
- /**
- *
- */
- virtual DOMString getReferrer()
- { return referrer; }
-
- /**
- *
- */
- virtual DOMString getDomain()
- { return domain; }
-
- /**
- *
- */
- virtual DOMString getURL()
- { return url; }
-
- /**
- *
- */
- virtual SVGSVGElement *getRootElement()
- { return rootElement; }
-
-
- //####################################################
- //# Overload some createXXX() methods from DocumentImpl,
- //# To create our SVG-DOM types (in .cpp)
- //####################################################
-
- /**
- *
- */
- virtual Element *createElement(const DOMString& tagName)
- throw(DOMException);
-
-
- /**
- *
- */
- virtual Element *createElementNS(const DOMString& namespaceURI,
- const DOMString& qualifiedName)
- throw(DOMException);
-
- //##################
- //# Non-API methods
- //##################
-
- SVGDocumentImpl(const DOMImplementation *domImpl,
- const DOMString &namespaceURI,
- const DOMString &qualifiedName,
- const DocumentType *doctype)
- : DocumentImpl(domImpl, namespaceURI,
- qualifiedName, doctype)
- {
- init();
- }
-
-
- /**
- *
- */
- virtual ~SVGDocumentImpl()
- {
- if (rootElement)
- delete rootElement;
- }
-
-protected:
-
-friend class SvgParser;
-
- void init()
- {
- title = "";
- referrer = "";
- domain = "";
- rootElement = NULL;
- }
-
- DOMString title;
- DOMString referrer;
- DOMString domain;
- DOMString url;
- SVGSVGElement *rootElement;
-};
-
-
-
-/*#########################################################################
-## SVGElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGElementImpl : virtual public SVGElement,
- public ElementImpl
-{
-public:
-
- /**
- *
- */
- virtual DOMString getId()
- { return id; }
-
- /**
- *
- */
- virtual void setId(const DOMString &val)
- throw (DOMException)
- { id = val; }
-
- /**
- *
- */
- virtual DOMString getXmlBase()
- { return xmlBase; }
-
- /**
- *
- */
- virtual void setXmlBase(const DOMString &val)
- throw (DOMException)
- { xmlBase = val; }
-
- /**
- *
- */
- virtual SVGSVGElement *getOwnerSVGElement()
- { return ownerSvgElement; }
-
- /**
- *
- */
- virtual SVGElement *getViewportElement()
- { return viewportElement; }
-
-
- //##################
- //# Non-API methods
- //##################
-
-
- /**
- *
- */
- SVGElementImpl()
- {}
-
- /**
- *
- */
- SVGElementImpl(SVGDocumentImpl *owner, const DOMString &tagName)
- : ElementImpl(owner, tagName)
- { init(); }
-
- /**
- *
- */
- SVGElementImpl(SVGDocumentImpl *owner,
- const DOMString &namespaceURI,
- const DOMString &tagName)
- : ElementImpl(owner, namespaceURI, tagName)
- { init(); }
-
-
- /**
- *
- */
- virtual ~SVGElementImpl()
- {}
-
-protected:
-
- void init()
- {
- id = "";
- xmlBase = "";
- ownerSvgElement = NULL;
- viewportElement = NULL;
- }
-
- DOMString id;
- DOMString xmlBase;
- SVGSVGElement *ownerSvgElement;
- SVGElement *viewportElement;
-
-};
-
-
-
-/*#########################################################################
-## SVGSVGElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGSVGElementImpl : virtual public SVGSVGElement,
- public SVGElementImpl
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedLength getX()
- { return x; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getY()
- { return y; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getWidth()
- { return width; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getHeight()
- { return height; }
-
- /**
- *
- */
- virtual DOMString getContentScriptType()
- { return contentScriptType; }
-
- /**
- *
- */
- virtual void setContentScriptType(const DOMString &val)
- throw (DOMException)
- { contentScriptType = val; }
-
-
- /**
- *
- */
- virtual DOMString getContentStyleType()
- { return contentStyleType; }
-
- /**
- *
- */
- virtual void setContentStyleType(const DOMString &val)
- throw (DOMException)
- { contentStyleType = val; }
-
- /**
- *
- */
- virtual SVGRect getViewport()
- { return viewport; }
-
- /**
- *
- */
- virtual double getPixelUnitToMillimeterX()
- { return pixelUnitToMillimeterX; }
-
- /**
- *
- */
- virtual double getPixelUnitToMillimeterY()
- { return pixelUnitToMillimeterY; }
-
- /**
- *
- */
- virtual double getScreenPixelToMillimeterX()
- { return screenPixelToMillimeterX; }
-
- /**
- *
- */
- virtual double getScreenPixelToMillimeterY()
- { return screenPixelToMillimeterY; }
-
-
- /**
- *
- */
- virtual bool getUseCurrentView()
- { return useCurrentView; }
-
- /**
- *
- */
- virtual void setUseCurrentView(bool val) throw (DOMException)
- { useCurrentView = val; }
-
- /**
- *
- */
- virtual SVGViewSpec getCurrentView()
- { return currentView; }
-
-
- /**
- *
- */
- virtual double getCurrentScale()
- { return currentScale; }
-
- /**
- *
- */
- virtual void setCurrentScale(double val) throw (DOMException)
- { currentScale = val; }
-
-
- /**
- *
- */
- virtual SVGPoint getCurrentTranslate()
- { return currentTranslate; }
-
-
- /**
- *
- */
- virtual unsigned long suspendRedraw (unsigned long max_wait_milliseconds );
-
- /**
- *
- */
- virtual void unsuspendRedraw (unsigned long suspend_handle_id )
- throw( DOMException );
-
- /**
- *
- */
- virtual void unsuspendRedrawAll ( );
-
- /**
- *
- */
- virtual void forceRedraw ( );
-
- /**
- *
- */
- virtual void pauseAnimations ( );
-
- /**
- *
- */
- virtual void unpauseAnimations ( );
-
- /**
- *
- */
- virtual bool animationsPaused ( );
-
- /**
- *
- */
- virtual double getCurrentTime ( )
- { return currentTime; }
-
- /**
- *
- */
- virtual void setCurrentTime (double seconds )
- { currentTime = seconds; }
-
- /**
- *
- */
- virtual NodeList getIntersectionList (const SVGRect &rect,
- const SVGElement *referenceElement );
-
- /**
- *
- */
- virtual NodeList getEnclosureList (const SVGRect &rect,
- const SVGElement *referenceElement );
-
- /**
- *
- */
- virtual bool checkIntersection (const SVGElement *element, const SVGRect &rect );
-
- /**
- *
- */
- virtual bool checkEnclosure (const SVGElement *element, const SVGRect &rect );
-
- /**
- *
- */
- virtual void deselectAll ( );
-
- /**
- *
- */
- virtual SVGNumber createSVGNumber ( )
- {
- SVGNumber ret;
- return ret;
- }
-
- /**
- *
- */
- virtual SVGLength createSVGLength ( )
- {
- SVGLength ret;
- return ret;
- }
-
- /**
- *
- */
- virtual SVGAngle createSVGAngle ( )
- {
- SVGAngle ret;
- return ret;
- }
-
- /**
- *
- */
- virtual SVGPoint createSVGPoint ( )
- {
- SVGPoint ret;
- return ret;
- }
-
- /**
- *
- */
- virtual SVGMatrix createSVGMatrix ( )
- {
- SVGMatrix ret;
- return ret;
- }
-
- /**
- *
- */
- virtual SVGRect createSVGRect ( )
- {
- SVGRect ret;
- return ret;
- }
-
- /**
- *
- */
- virtual SVGTransform createSVGTransform ( )
- {
- SVGTransform ret;
- return ret;
- }
-
- /**
- *
- */
- virtual SVGTransform createSVGTransformFromMatrix(const SVGMatrix &matrix )
- {
- SVGTransform ret;
- ret.setMatrix(matrix);
- return ret;
- }
-
-
- /**
- *
- */
- virtual Element *getElementById (const DOMString& elementId );
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGSVGElementImpl() : SVGElementImpl()
- {}
-
-
-
- /**
- *
- */
- virtual ~SVGSVGElementImpl() {}
-
-protected:
-
- SVGAnimatedLength x;
- SVGAnimatedLength y;
- SVGAnimatedLength width;
- SVGAnimatedLength height;
- DOMString contentScriptType;
- DOMString contentStyleType;
- SVGRect viewport;
- double pixelUnitToMillimeterX;
- double pixelUnitToMillimeterY;
- double screenPixelToMillimeterX;
- double screenPixelToMillimeterY;
- bool useCurrentView;
- SVGViewSpec currentView;
- double currentScale;
- SVGPoint currentTranslate;
-
- double currentTime;
-
-};
-
-
-
-/*#########################################################################
-## SVGGElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGGElementImpl : virtual public SVGGElement, public SVGElementImpl
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGGElementImpl() {}
-
- /**
- *
- */
- virtual ~SVGGElementImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-/*#########################################################################
-## SVGDefsElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGDefsElementImpl : virtual public SVGDefsElement,
- public SVGElementImpl
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGDefsElementImpl() {}
-
- /**
- *
- */
- virtual ~SVGDefsElementImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGDescElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGDescElementImpl : virtual public SVGDescElement,
- public SVGElementImpl
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGDescElementImpl() {}
-
- /**
- *
- */
- virtual ~SVGDescElementImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGTitleElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGTitleElementImpl : virtual public SVGTitleElement,
- public SVGElementImpl
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGTitleElementImpl() {}
-
- /**
- *
- */
- virtual ~SVGTitleElementImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGSymbolElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGSymbolElementImpl : virtual public SVGSymbolElement,
- public SVGElementImpl
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGSymbolElementImpl() {}
-
- /**
- *
- */
- virtual ~SVGSymbolElementImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGUseElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGUseElementImpl : public SVGElementImpl
-{
-public:
-
-
- /**
- *
- */
- virtual SVGAnimatedLength getX()
- { return x; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getY()
- { return y; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getWidth()
- { return width; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getHeight()
- { return height; }
-
- /**
- *
- */
- virtual SVGElementInstance getInstanceRoot()
- { return instanceRoot; }
-
- /**
- *
- */
- virtual SVGElementInstance getAnimatedInstanceRoot()
- { return animatedInstanceRoot; }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGUseElementImpl() {}
-
- /**
- *
- */
- virtual ~SVGUseElementImpl() {}
-
-protected:
-
- SVGAnimatedLength x;
- SVGAnimatedLength y;
- SVGAnimatedLength width;
- SVGAnimatedLength height;
- SVGElementInstance instanceRoot;
- SVGElementInstance animatedInstanceRoot;
-};
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGImageElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGImageElementImpl : virtual public SVGImageElement,
- public SVGElementImpl
-{
-public:
-
-
- /**
- *
- */
- virtual SVGAnimatedLength getX()
- { return x; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getY()
- { return y; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getWidth()
- { return width; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getHeight()
- { return height; }
-
-
- /**
- *
- */
- virtual SVGAnimatedPreserveAspectRatio getPreserveAspectRatio()
- { return preserveAspectRatio; }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGImageElementImpl() {}
-
- /**
- *
- */
- virtual ~SVGImageElementImpl() {}
-
-protected:
-
- SVGAnimatedLength x;
- SVGAnimatedLength y;
- SVGAnimatedLength width;
- SVGAnimatedLength height;
- SVGAnimatedPreserveAspectRatio preserveAspectRatio;
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGSwitchElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGSwitchElementImpl : virtual public SVGSwitchElement,
- public SVGElementImpl
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGSwitchElementImpl() {}
-
- /**
- *
- */
- virtual ~SVGSwitchElementImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-
-/*#########################################################################
-## GetSVGDocumentImpl
-#########################################################################*/
-
-/**
- *
- */
-class GetSVGDocumentImpl : public virtual GetSVGDocument
-{
-public:
-
- /**
- *
- */
- virtual SVGDocument *getSVGDocument ( )
- throw( DOMException );
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- GetSVGDocumentImpl() {}
-
- /**
- *
- */
- virtual ~GetSVGDocumentImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGStyleElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGStyleElementImpl : virtual public SVGStyleElement,
- public SVGElementImpl
-{
-public:
-
- /**
- *
- */
- virtual DOMString getXmlspace()
- { return xmlSpace; }
-
- /**
- *
- */
- virtual void setXmlspace(const DOMString &val)
- throw (DOMException)
- { xmlSpace = val; }
-
- /**
- *
- */
- virtual DOMString getType()
- { return type; }
-
- /**
- *
- */
- virtual void setType(const DOMString &val)
- throw (DOMException)
- { type = val; }
-
- /**
- *
- */
- virtual DOMString getMedia()
- { return media; }
-
- /**
- *
- */
- virtual void setMedia(const DOMString &val)
- throw (DOMException)
- { media = val; }
-
- /**
- *
- */
- virtual DOMString getTitle()
- { return title; }
-
- /**
- *
- */
- virtual void setTitle(const DOMString &val)
- throw (DOMException)
- { title = val; }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGStyleElementImpl() {}
-
- /**
- *
- */
- virtual ~SVGStyleElementImpl() {}
-
-protected:
-
- DOMString xmlSpace;
- DOMString type;
- DOMString media;
- DOMString title;
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGPathElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGPathElementImpl : virtual public SVGPathElement,
- public SVGElementImpl
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedNumber getPathLength();
-
- /**
- *
- */
- virtual double getTotalLength ( );
-
- /**
- *
- */
- virtual SVGPoint getPointAtLength (double distance );
-
- /**
- *
- */
- virtual unsigned long getPathSegAtLength (double distance );
-
- /**
- *
- */
- virtual SVGPathSegClosePath
- createSVGPathSegClosePath ( )
- {
- SVGPathSegClosePath ret;
- return ret;
- }
-
- /**
- *
- */
- virtual SVGPathSegMovetoAbs
- createSVGPathSegMovetoAbs (double x, double y )
- {
- SVGPathSegMovetoAbs ret(x, y);
- return ret;
- }
-
- /**
- *
- */
- virtual SVGPathSegMovetoRel
- createSVGPathSegMovetoRel (double x, double y )
- {
- SVGPathSegMovetoRel ret(x, y);
- return ret;
- }
-
- /**
- *
- */
- virtual SVGPathSegLinetoAbs
- createSVGPathSegLinetoAbs (double x, double y )
- {
- SVGPathSegLinetoAbs ret(x, y);
- return ret;
- }
-
- /**
- *
- */
- virtual SVGPathSegLinetoRel
- createSVGPathSegLinetoRel (double x, double y )
- {
- SVGPathSegLinetoRel ret(x, y);
- return ret;
- }
-
- /**
- *
- */
- virtual SVGPathSegCurvetoCubicAbs
- createSVGPathSegCurvetoCubicAbs (double x, double y,
- double x1, double y1, double x2, double y2 )
- {
- SVGPathSegCurvetoCubicAbs ret(x, y, x1, y1, x2, y2);
- return ret;
- }
-
- /**
- *
- */
- virtual SVGPathSegCurvetoCubicRel
- createSVGPathSegCurvetoCubicRel (double x, double y,
- double x1, double y1, double x2, double y2 )
- {
- SVGPathSegCurvetoCubicRel ret(x, y, x1, y1, x2, y2);
- return ret;
- }
-
- /**
- *
- */
- virtual SVGPathSegCurvetoQuadraticAbs
- createSVGPathSegCurvetoQuadraticAbs (double x, double y,
- double x1, double y1 )
- {
- SVGPathSegCurvetoQuadraticAbs ret(x, y, x1, y1);
- return ret;
- }
-
- /**
- *
- */
- virtual SVGPathSegCurvetoQuadraticRel
- createSVGPathSegCurvetoQuadraticRel (double x, double y,
- double x1, double y1 )
- {
- SVGPathSegCurvetoQuadraticRel ret(x, y, x1, y1);
- return ret;
- }
-
- /**
- *
- */
- virtual SVGPathSegArcAbs
- createSVGPathSegArcAbs (double x, double y,
- double r1, double r2, double angle,
- bool largeArcFlag, bool sweepFlag )
- {
- SVGPathSegArcAbs ret(x, y, r1, r2, angle, largeArcFlag, sweepFlag);
- return ret;
- }
-
- /**
- *
- */
- virtual SVGPathSegArcRel
- createSVGPathSegArcRel (double x, double y, double r1,
- double r2, double angle, bool largeArcFlag,
- bool sweepFlag )
- {
- SVGPathSegArcRel ret(x, y, r1, r2, angle, largeArcFlag, sweepFlag);
- return ret;
- }
-
- /**
- *
- */
- virtual SVGPathSegLinetoHorizontalAbs
- createSVGPathSegLinetoHorizontalAbs (double x )
- {
- SVGPathSegLinetoHorizontalAbs ret(x);
- return ret;
- }
-
- /**
- *
- */
- virtual SVGPathSegLinetoHorizontalRel
- createSVGPathSegLinetoHorizontalRel (double x )
- {
- SVGPathSegLinetoHorizontalRel ret(x);
- return ret;
- }
-
- /**
- *
- */
- virtual SVGPathSegLinetoVerticalAbs
- createSVGPathSegLinetoVerticalAbs (double y )
- {
- SVGPathSegLinetoVerticalAbs ret(y);
- return ret;
- }
-
- /**
- *
- */
- virtual SVGPathSegLinetoVerticalRel
- createSVGPathSegLinetoVerticalRel (double y )
- {
- SVGPathSegLinetoVerticalRel ret(y);
- return ret;
- }
-
- /**
- *
- */
- virtual SVGPathSegCurvetoCubicSmoothAbs
- createSVGPathSegCurvetoCubicSmoothAbs (double x, double y,
- double x2, double y2 )
- {
- SVGPathSegCurvetoCubicSmoothAbs ret(x, y, x2, y2);
- return ret;
- }
-
- /**
- *
- */
- virtual SVGPathSegCurvetoCubicSmoothRel
- createSVGPathSegCurvetoCubicSmoothRel (double x, double y,
- double x2, double y2 )
- {
- SVGPathSegCurvetoCubicSmoothRel ret(x, y, x2, y2);
- return ret;
- }
-
- /**
- *
- */
- virtual SVGPathSegCurvetoQuadraticSmoothAbs
- createSVGPathSegCurvetoQuadraticSmoothAbs (double x, double y )
- {
- SVGPathSegCurvetoQuadraticSmoothAbs ret(x, y);
- return ret;
- }
-
- /**
- *
- */
- virtual SVGPathSegCurvetoQuadraticSmoothRel
- createSVGPathSegCurvetoQuadraticSmoothRel (double x, double y )
- {
- SVGPathSegCurvetoQuadraticSmoothRel ret(x, y);
- return ret;
- }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGPathElementImpl() {}
-
-
- /**
- *
- */
- virtual ~SVGPathElementImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGRectElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGRectElementImpl : virtual public SVGRectElement,
- public SVGElementImpl
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedLength getX()
- { return x; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getY()
- { return y; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getWidth()
- { return width; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getHeight()
- { return height; }
-
-
- /**
- *
- */
- virtual SVGAnimatedLength getRx()
- { return rx; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getRy()
- { return ry; }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGRectElementImpl() {}
-
- /**
- *
- */
- virtual ~SVGRectElementImpl() {}
-
-protected:
-
- SVGAnimatedLength x;
- SVGAnimatedLength y;
- SVGAnimatedLength width;
- SVGAnimatedLength height;
- SVGAnimatedLength rx;
- SVGAnimatedLength ry;
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGCircleElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGCircleElementImpl : virtual public SVGCircleElement,
- public SVGElementImpl
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedLength getCx()
- { return cx; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getCy()
- { return cy; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getR()
- { return r; }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGCircleElementImpl() {}
-
- /**
- *
- */
- virtual ~SVGCircleElementImpl() {}
-
-protected:
-
- SVGAnimatedLength cx;
- SVGAnimatedLength cy;
- SVGAnimatedLength r;
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGEllipseElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGEllipseElementImpl : virtual public SVGEllipseElement,
- public SVGElementImpl
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedLength getCx()
- { return cx; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getCy()
- { return cy; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getRx()
- { return rx; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getRy()
- { return ry; }
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGEllipseElementImpl() {}
-
- /**
- *
- */
- virtual ~SVGEllipseElementImpl() {}
-
-protected:
-
- SVGAnimatedLength cx;
- SVGAnimatedLength cy;
- SVGAnimatedLength rx;
- SVGAnimatedLength ry;
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGLineElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGLineElementImpl : virtual public SVGLineElement,
- public SVGElementImpl
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedLength getX1()
- { return x1; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getY1()
- { return y1; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getX2()
- { return x2; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getY2()
- { return y2; }
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGLineElementImpl() {}
-
-protected:
-
- SVGAnimatedLength x1;
- SVGAnimatedLength x2;
- SVGAnimatedLength y1;
- SVGAnimatedLength y2;
-};
-
-
-
-
-/*#########################################################################
-## SVGPolylineElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGPolylineElementImpl : virtual public SVGPolylineElement,
- public SVGElementImpl
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGPolylineElementImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGPolygonElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGPolygonElementImpl : virtual public SVGPolygonElement,
- public SVGElementImpl
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGPolygonElementImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGTextContentElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGTextContentElementImpl : virtual public SVGTextContentElement,
- public SVGElementImpl
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedLength getTextLength();
-
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getLengthAdjust();
-
-
- /**
- *
- */
- virtual long getNumberOfChars ( );
-
- /**
- *
- */
- virtual double getComputedTextLength ( );
-
- /**
- *
- */
- virtual double getSubStringLength (unsigned long charnum, unsigned long nchars )
- throw( DOMException );
-
- /**
- *
- */
- virtual SVGPoint getStartPositionOfChar (unsigned long charnum )
- throw( DOMException );
-
- /**
- *
- */
- virtual SVGPoint getEndPositionOfChar (unsigned long charnum )
- throw( DOMException );
-
- /**
- *
- */
- virtual SVGRect getExtentOfChar (unsigned long charnum )
- throw( DOMException );
-
- /**
- *
- */
- virtual double getRotationOfChar (unsigned long charnum )
- throw( DOMException );
-
- /**
- *
- */
- virtual long getCharNumAtPosition (const SVGPoint &point );
-
- /**
- *
- */
- virtual void selectSubString (unsigned long charnum, unsigned long nchars )
- throw( DOMException );
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGTextContentElementImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGTextPositioningElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGTextPositioningElementImpl : virtual public SVGTextPositioningElement,
- public SVGTextContentElementImpl
-{
-public:
-
-
-
- /**
- *
- */
- virtual SVGAnimatedLength getX()
- { return x; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getY()
- { return y; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getDx()
- { return dx; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getDy()
- { return dy; }
-
-
- /**
- *
- */
- virtual SVGAnimatedNumberList getRotate()
- { return rotate; }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGTextPositioningElementImpl() {}
-
-protected:
-
- SVGAnimatedLength x;
- SVGAnimatedLength y;
- SVGAnimatedLength dx;
- SVGAnimatedLength dy;
- SVGAnimatedNumberList rotate;
-
-};
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGTextElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGTextElementImpl : virtual public SVGTextElement,
- public SVGTextPositioningElementImpl
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGTextElementImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGTSpanElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGTSpanElementImpl : virtual public SVGTSpanElement,
- public SVGTextPositioningElementImpl
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGTSpanElementImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGTRefElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGTRefElementImpl : virtual public SVGTRefElement,
- public SVGTextPositioningElementImpl
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGTRefElementImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGTextPathElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGTextPathElementImpl : virtual public SVGTextPathElement,
- public SVGTextContentElementImpl
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedLength getStartOffset()
- { return startOffset; }
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getMethod()
- { return method; }
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getSpacing()
- { return spacing; }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGTextPathElementImpl() {}
-
-protected:
-
- SVGAnimatedLength startOffset;
- SVGAnimatedEnumeration method;
- SVGAnimatedEnumeration spacing;
-};
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGAltGlyphElement
-#########################################################################*/
-
-/**
- *
- */
-class SVGAltGlyphElementImpl : virtual public SVGAltGlyphElement,
- public SVGTextPositioningElementImpl
-{
-public:
-
- /**
- *
- */
- virtual DOMString getGlyphRef()
- { return glyphRef; }
-
- /**
- *
- */
- virtual void setGlyphRef(const DOMString &val)
- throw (DOMException)
- { glyphRef = val; }
-
- /**
- *
- */
- virtual DOMString getFormat()
- { return format; }
-
- /**
- *
- */
- virtual void setFormat(const DOMString &val)
- throw (DOMException)
- { format = val; }
-
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGAltGlyphElementImpl() {}
-
-protected:
-
- DOMString glyphRef;
- DOMString format;
-
-};
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGAltGlyphDefElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGAltGlyphDefElementImpl : virtual public SVGAltGlyphDefElement,
- public SVGElementImpl
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGAltGlyphDefElementImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGAltGlyphItemElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGAltGlyphItemElementImpl : virtual public SVGAltGlyphItemElement,
- public SVGElementImpl
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGAltGlyphItemElementImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGGlyphRefElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGGlyphRefElementImpl : virtual public SVGGlyphRefElement,
- public SVGElementImpl
-{
-public:
- /**
- *
- */
- virtual DOMString getGlyphRef()
- { return glyphRef; }
-
- /**
- *
- */
- virtual void setGlyphRef(const DOMString &val) throw (DOMException)
- { glyphRef = val; }
-
- /**
- *
- */
- virtual DOMString getFormat()
- { return format; }
-
- /**
- *
- */
- virtual void setFormat(const DOMString &val) throw (DOMException)
- { format = val; }
-
- /**
- *
- */
- virtual double getX()
- { return x; }
-
- /**
- *
- */
- virtual void setX(double val) throw (DOMException)
- { x = val; }
-
- /**
- *
- */
- virtual double getY()
- { return y; }
-
- /**
- *
- */
- virtual void setY(double val) throw (DOMException)
- { y = val; }
-
- /**
- *
- */
- virtual double getDx()
- { return dx; }
-
- /**
- *
- */
- virtual void setDx(double val) throw (DOMException)
- { dx = val; }
-
- /**
- *
- */
- virtual double getDy()
- { return dy; }
-
- /**
- *
- */
- virtual void setDy(double val) throw (DOMException)
- { dy = val; }
-
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGGlyphRefElementImpl() {}
-
-protected:
-
- DOMString glyphRef;
- DOMString format;
- double x, y, dx, dy;
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGMarkerElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGMarkerElementImpl : virtual public SVGMarkerElement,
- public SVGElementImpl
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedLength getRefX()
- { return refX; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getRefY()
- { return refY; }
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getMarkerUnits()
- { return markerUnits; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getMarkerWidth()
- { return markerWidth; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getMarkerHeight()
- { return markerHeight; }
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getOrientType()
- { return orientType; }
-
- /**
- *
- */
- virtual SVGAnimatedAngle getOrientAngle()
- { return orientAngle; }
-
-
- /**
- *
- */
- virtual void setOrientToAuto ( )
- { orientAuto = true; }
-
- /**
- *
- */
- virtual void setOrientToAngle (const SVGAngle &angle)
- {
- orientAuto = false;
- orientAngle = SVGAnimatedAngle(angle);
- }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGMarkerElementImpl() {}
-
-protected:
-
- SVGAnimatedLength refX;
- SVGAnimatedLength refY;
- SVGAnimatedEnumeration markerUnits;
- SVGAnimatedLength markerWidth;
- SVGAnimatedLength markerHeight;
- SVGAnimatedEnumeration orientType;
- SVGAnimatedAngle orientAngle;
- bool orientAuto;
-
-
-};
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGColorProfileElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGColorProfileElementImpl : virtual public SVGColorProfileElement,
- public SVGElementImpl
-{
-public:
- /**
- *
- */
- virtual DOMString getLocal()
- { return local; }
-
- /**
- *
- */
- virtual void setLocal(const DOMString &val) throw (DOMException)
- { local = val; }
-
- /**
- *
- */
- virtual DOMString getName()
- { return name; }
-
- /**
- *
- */
- virtual void setName(const DOMString &val) throw (DOMException)
- { name = val; }
-
- /**
- *
- */
- virtual unsigned short getRenderingIntent()
- { return renderingIntent; }
-
- /**
- *
- */
- virtual void setRenderingIntent(unsigned short val) throw (DOMException)
- { renderingIntent = val; }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGColorProfileElementImpl() {}
-
-protected:
-
- DOMString local;
- DOMString name;
- unsigned short renderingIntent;
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGGradientElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGGradientElementImpl : virtual public SVGGradientElement,
- public SVGElementImpl
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getGradientUnits()
- { return gradientUnits; }
-
- /**
- *
- */
- virtual SVGAnimatedTransformList getGradientTransform()
- { return gradientTransform; }
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getSpreadMethod()
- { return spreadMethod; }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGGradientElementImpl() {}
-
-protected:
-
-
- SVGAnimatedEnumeration gradientUnits;
- SVGAnimatedTransformList gradientTransform;
- SVGAnimatedEnumeration spreadMethod;
-};
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGLinearGradientElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGLinearGradientElementImpl : virtual public SVGLinearGradientElement,
- public SVGGradientElementImpl
-{
-public:
-
-
- /**
- *
- */
- virtual SVGAnimatedLength getX1()
- { return x1; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getY1()
- { return y1; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getX2()
- { return x2; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getY2()
- { return y2; }
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGLinearGradientElementImpl() {}
-
-protected:
-
- SVGAnimatedLength x1, x2, y1, y2;
-
-};
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGRadialGradientElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGRadialGradientElementImpl : virtual public SVGRadialGradientElement,
- public SVGGradientElementImpl
-{
-public:
-
-
- /**
- *
- */
- virtual SVGAnimatedLength getCx()
- { return cx; }
-
-
- /**
- *
- */
- virtual SVGAnimatedLength getCy()
- { return cy; }
-
-
- /**
- *
- */
- virtual SVGAnimatedLength getR()
- { return r; }
-
-
- /**
- *
- */
- virtual SVGAnimatedLength getFx()
- { return fx; }
-
-
- /**
- *
- */
- virtual SVGAnimatedLength getFy()
- { return fy; }
-
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGRadialGradientElementImpl() {}
-
-protected:
-
- SVGAnimatedLength cx, cy, r, fx, fy;
-
-};
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGStopElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGStopElementImpl : virtual public SVGStopElement,
- public SVGElementImpl
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedNumber getOffset()
- { return offset; }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGStopElementImpl() {}
-
-protected:
-
- SVGAnimatedNumber offset;
-
-};
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGPatternElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGPatternElementImpl : virtual public SVGPatternElement,
- public SVGElementImpl
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getPatternUnits()
- { return patternUnits; }
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getPatternContentUnits()
- { return patternContentUnits; }
-
- /**
- *
- */
- virtual SVGAnimatedTransformList getPatternTransform()
- { return patternTransform; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getX()
- { return x; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getY()
- { return y; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getWidth()
- { return width; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getHeight()
- { return height; }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGPatternElementImpl() {}
-
-protected:
-
-
- SVGAnimatedEnumeration patternUnits;
- SVGAnimatedEnumeration patternContentUnits;
- SVGAnimatedTransformList patternTransform;
- SVGAnimatedLength x;
- SVGAnimatedLength y;
- SVGAnimatedLength width;
- SVGAnimatedLength height;
-};
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGClipPathElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGClipPathElementImpl : virtual public SVGClipPathElement,
- public SVGElementImpl
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getClipPathUnits()
- { return clipPathUnits; }
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGClipPathElementImpl() {}
-
-protected:
-
- SVGAnimatedEnumeration clipPathUnits;
-
-};
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGMaskElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGMaskElementImpl : virtual public SVGMaskElement,
- public SVGElementImpl
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getMaskUnits()
- { return maskUnits; }
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getMaskContentUnits()
- { return maskContentUnits; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getX()
- { return x; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getY()
- { return y; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getWidth()
- { return width; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getHeight()
- { return height; }
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGMaskElementImpl() {}
-
-protected:
-
-
- SVGAnimatedEnumeration maskUnits;
- SVGAnimatedEnumeration maskContentUnits;
- SVGAnimatedLength x;
- SVGAnimatedLength y;
- SVGAnimatedLength width;
- SVGAnimatedLength height;
-};
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGFilterElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGFilterElementImpl : virtual public SVGFilterElement,
- public SVGElementImpl
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getFilterUnits()
- { return filterUnits; }
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getPrimitiveUnits()
- { return filterUnits; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getX()
- { return x; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getY()
- { return y; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getWidth()
- { return width; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getHeight()
- { return height; }
-
- /**
- *
- */
- virtual SVGAnimatedInteger getFilterResX()
- { return filterResX; }
-
- /**
- *
- */
- virtual SVGAnimatedInteger getFilterResY()
- { return filterResY; }
-
- /**
- *
- */
- virtual void setFilterRes (unsigned long filterResXArg,
- unsigned long filterResYArg )
- {
- filterResX = filterResXArg;
- filterResY = filterResYArg;
- }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFilterElementImpl() {}
-
-protected:
-
- SVGAnimatedEnumeration filterUnits;
- SVGAnimatedEnumeration primitiveUnits;
- SVGAnimatedLength x;
- SVGAnimatedLength y;
- SVGAnimatedLength width;
- SVGAnimatedLength height;
- SVGAnimatedInteger filterResX;
- SVGAnimatedInteger filterResY;
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGFEBlendElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGFEBlendElementImpl : virtual public SVGFEBlendElement,
- public SVGElementImpl
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedString getIn1()
- { return in1; }
-
- /**
- *
- */
- virtual SVGAnimatedString getIn2()
- { return in2; }
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getMode()
- { return mode; }
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFEBlendElementImpl() {}
-
-protected:
-
- SVGAnimatedString in1, in2;
- SVGAnimatedEnumeration mode;
-};
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGFEColorMatrixElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGFEColorMatrixElementImpl : virtual public SVGFEColorMatrixElement,
- public SVGElementImpl
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedString getIn1()
- { return in1; }
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getType()
- { return type; }
-
- /**
- *
- */
- virtual SVGAnimatedNumberList getValues()
- { return values; }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFEColorMatrixElementImpl() {}
-
-protected:
-
- SVGAnimatedString in1;
- SVGAnimatedEnumeration type;
- SVGAnimatedNumberList values;
-
-};
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGFEComponentTransferElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGFEComponentTransferElementImpl :
- virtual public SVGFEComponentTransferElement,
- public SVGElementImpl
-{
-public:
- /**
- *
- */
- virtual SVGAnimatedString getIn1()
- { return in1; }
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFEComponentTransferElementImpl() {}
-
-protected:
-
- SVGAnimatedString in1;
-
-};
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGComponentTransferFunctionElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGComponentTransferFunctionElementImpl :
- virtual public SVGComponentTransferFunctionElement,
- public SVGElementImpl
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getType()
- { return type; }
-
- /**
- *
- */
- virtual SVGAnimatedNumberList getTableValues()
- { return tableValues; }
-
- /**
- *
- */
- virtual SVGAnimatedNumber getSlope()
- { return slope; }
-
- /**
- *
- */
- virtual SVGAnimatedNumber getIntercept()
- { return intercept; }
-
- /**
- *
- */
- virtual SVGAnimatedNumber getAmplitude()
- { return amplitude; }
-
- /**
- *
- */
- virtual SVGAnimatedNumber getExponent()
- { return exponent; }
-
- /**
- *
- */
- virtual SVGAnimatedNumber getOffset()
- { return offset; }
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGComponentTransferFunctionElementImpl() {}
-
-protected:
-
- SVGAnimatedEnumeration type;
- SVGAnimatedNumberList tableValues;
- SVGAnimatedNumber slope;
- SVGAnimatedNumber intercept;
- SVGAnimatedNumber amplitude;
- SVGAnimatedNumber exponent;
- SVGAnimatedNumber offset;
-
-};
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGFEFuncRElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGFEFuncRElementImpl :
- virtual public SVGFEFuncRElement,
- public SVGComponentTransferFunctionElementImpl
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFEFuncRElementImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGFEFuncGElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGFEFuncGElementImpl : virtual public SVGFEFuncGElement,
- public SVGComponentTransferFunctionElementImpl
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFEFuncGElementImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGFEFuncBElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGFEFuncBElementImpl : virtual public SVGFEFuncBElement,
- public SVGComponentTransferFunctionElementImpl
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFEFuncBElementImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGFEFuncAElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGFEFuncAElementImpl : virtual public SVGFEFuncAElement,
- public SVGComponentTransferFunctionElementImpl
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFEFuncAElementImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGFECompositeElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGFECompositeElementImpl : virtual public SVGFECompositeElement,
- public SVGElementImpl
-{
-public:
-
-
- /**
- *
- */
- virtual SVGAnimatedString getIn1()
- { return in1; }
-
- /**
- *
- */
- virtual SVGAnimatedString getIn2()
- { return in2; }
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getOperator()
- { return ae_operator; }
-
- /**
- *
- */
- virtual SVGAnimatedNumber getK1()
- { return k1; }
-
- /**
- *
- */
- virtual SVGAnimatedNumber getK2()
- { return k2; }
-
- /**
- *
- */
- virtual SVGAnimatedNumber getK3()
- { return k3; }
-
- /**
- *
- */
- virtual SVGAnimatedNumber getK4()
- { return k4; }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFECompositeElementImpl() {}
-
-protected:
-
-
- SVGAnimatedString in1;
- SVGAnimatedString in2;
- SVGAnimatedEnumeration ae_operator;
- SVGAnimatedNumber k1;
- SVGAnimatedNumber k2;
- SVGAnimatedNumber k3;
- SVGAnimatedNumber k4;
-
-};
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGFEConvolveMatrixElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGFEConvolveMatrixElementImpl : virtual public SVGFEConvolveMatrixElement,
- public SVGElementImpl
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedInteger getOrderX()
- { return orderX; }
-
- /**
- *
- */
- virtual SVGAnimatedInteger getOrderY()
- { return orderY; }
-
- /**
- *
- */
- virtual SVGAnimatedNumberList getKernelMatrix()
- { return kernelMatrix; }
-
- /**
- *
- */
- virtual SVGAnimatedNumber getDivisor()
- { return divisor; }
-
- /**
- *
- */
- virtual SVGAnimatedNumber getBias()
- { return bias; }
-
- /**
- *
- */
- virtual SVGAnimatedInteger getTargetX()
- { return targetX; }
-
- /**
- *
- */
- virtual SVGAnimatedInteger getTargetY()
- { return targetY; }
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getEdgeMode()
- { return edgeMode; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getKernelUnitLengthX()
- { return kernelUnitLengthX; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getKernelUnitLengthY()
- { return kernelUnitLengthY; }
-
- /**
- *
- */
- virtual SVGAnimatedBoolean getPreserveAlpha()
- { return preserveAlpha; }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFEConvolveMatrixElementImpl() {}
-
-protected:
-
- SVGAnimatedInteger orderX;
- SVGAnimatedInteger orderY;
- SVGAnimatedNumberList kernelMatrix;
- SVGAnimatedNumber divisor;
- SVGAnimatedNumber bias;
- SVGAnimatedInteger targetX;
- SVGAnimatedInteger targetY;
- SVGAnimatedEnumeration edgeMode;
- SVGAnimatedLength kernelUnitLengthX;
- SVGAnimatedLength kernelUnitLengthY;
- SVGAnimatedBoolean preserveAlpha;
-
-};
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGFEDiffuseLightingElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGFEDiffuseLightingElementImpl : virtual public SVGFEDiffuseLightingElement,
- public SVGElementImpl
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedString getIn1()
- { return in1; }
-
- /**
- *
- */
- virtual SVGAnimatedNumber getSurfaceScale()
- { return surfaceScale; }
-
- /**
- *
- */
- virtual SVGAnimatedNumber getDiffuseConstant()
- { return diffuseConstant; }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFEDiffuseLightingElementImpl() {}
-
-protected:
-
- SVGAnimatedString in1;
- SVGAnimatedNumber surfaceScale;
- SVGAnimatedNumber diffuseConstant;
-
-};
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGFEDistantLightElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGFEDistantLightElementImpl : virtual public SVGFEDistantLightElement,
- public SVGElementImpl
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedNumber getAzimuth()
- { return azimuth; }
-
-
- /**
- *
- */
- virtual SVGAnimatedNumber getElevation()
- { return elevation; }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFEDistantLightElementImpl() {}
-
-protected:
-
- SVGAnimatedNumber azimuth;
- SVGAnimatedNumber elevation;
-
-};
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGFEPointLightElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGFEPointLightElementImpl : public virtual SVGFEPointLightElement,
- public SVGElementImpl
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedNumber getX()
- { return x; }
-
-
- /**
- *
- */
- virtual SVGAnimatedNumber getY()
- { return y; }
-
- /**
- *
- */
- virtual SVGAnimatedNumber getZ()
- { return z; }
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFEPointLightElementImpl() {}
-
-protected:
-
- SVGAnimatedNumber x, y, z;
-
-};
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGFESpotLightElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGFESpotLightElementImpl : virtual public SVGFESpotLightElement,
- public SVGElementImpl
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedNumber getX()
- { return x; }
-
-
- /**
- *
- */
- virtual SVGAnimatedNumber getY()
- { return y; }
-
- /**
- *
- */
- virtual SVGAnimatedNumber getZ()
- { return z; }
-
- /**
- *
- */
- virtual SVGAnimatedNumber getPointsAtX()
- { return pointsAtX; }
-
- /**
- *
- */
- virtual SVGAnimatedNumber getPointsAtY()
- { return pointsAtY; }
-
- /**
- *
- */
- virtual SVGAnimatedNumber getPointsAtZ()
- { return pointsAtZ; }
-
- /**
- *
- */
- virtual SVGAnimatedNumber getSpecularExponent()
- { return specularExponent; }
-
- /**
- *
- */
- virtual SVGAnimatedNumber getLimitingConeAngle()
- { return limitingConeAngle; }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFESpotLightElementImpl() {}
-
-protected:
-
- SVGAnimatedNumber x, y, z;
- SVGAnimatedNumber pointsAtX, pointsAtY, pointsAtZ;
- SVGAnimatedNumber specularExponent;
- SVGAnimatedNumber limitingConeAngle;
-};
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGFEDisplacementMapElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGFEDisplacementMapElementImpl : virtual public SVGFEDisplacementMapElement,
- public SVGElementImpl
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedString getIn1()
- { return in1; }
-
- /**
- *
- */
- virtual SVGAnimatedString getIn2()
- { return in2; }
-
-
- /**
- *
- */
- virtual SVGAnimatedNumber getScale()
- { return scale; }
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getXChannelSelector()
- { return xChannelSelector; }
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getYChannelSelector()
- { return yChannelSelector; }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFEDisplacementMapElementImpl() {}
-
-protected:
-
- SVGAnimatedString in1;
- SVGAnimatedString in2;
- SVGAnimatedNumber scale;
- SVGAnimatedEnumeration xChannelSelector;
- SVGAnimatedEnumeration yChannelSelector;
-
-};
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGFEFloodElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGFEFloodElementImpl : virtual public SVGFEFloodElement,
- public SVGElementImpl
-{
-public:
- /**
- *
- */
- virtual SVGAnimatedString getIn1()
- { return in1; }
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFEFloodElementImpl() {}
-
-protected:
-
- SVGAnimatedString in1;
-
-};
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGFEGaussianBlurElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGFEGaussianBlurElementImpl : virtual public SVGFEGaussianBlurElement,
- public SVGElementImpl
-{
-public:
- /**
- *
- */
- virtual SVGAnimatedString getIn1()
- { return in1; }
-
-
- /**
- *
- */
- virtual SVGAnimatedNumber getStdDeviationX()
- { return stdDeviationX; }
-
- /**
- *
- */
- virtual SVGAnimatedNumber getStdDeviationY()
- { return stdDeviationY; }
-
-
- /**
- *
- */
- virtual void setStdDeviation (double stdDeviationXArg, double stdDeviationYArg )
- {
- stdDeviationX = stdDeviationXArg;
- stdDeviationY = stdDeviationYArg;
- }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFEGaussianBlurElementImpl() {}
-
-protected:
-
- SVGAnimatedString in1;
- SVGAnimatedNumber stdDeviationX, stdDeviationY;
-
-};
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGFEImageElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGFEImageElementImpl : virtual public SVGFEImageElement,
- public SVGElementImpl
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFEImageElementImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGFEMergeElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGFEMergeElementImpl : virtual public SVGFEMergeElement,
- public SVGElementImpl
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFEMergeElementImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGFEMergeNodeElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGFEMergeNodeElementImpl : virtual public SVGFEMergeNodeElement,
- public SVGElementImpl
-{
-public:
- /**
- *
- */
- virtual SVGAnimatedString getIn1()
- { return in1; }
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFEMergeNodeElementImpl() {}
-
-protected:
-
- SVGAnimatedString in1;
-
-};
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGFEMorphologyElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGFEMorphologyElementImpl : virtual public SVGFEMorphologyElement,
- public SVGElementImpl
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedString getIn1()
- { return in1; }
-
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getOperator()
- { return me_operator; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getRadiusX()
- { return radiusX; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getRadiusY()
- { return radiusY; }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFEMorphologyElementImpl() {}
-
-protected:
-
- SVGAnimatedString in1;
- SVGAnimatedEnumeration me_operator;
- SVGAnimatedLength radiusX;
- SVGAnimatedLength radiusY;
-
-};
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGFEOffsetElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGFEOffsetElementImpl : virtual public SVGFEOffsetElement,
- public SVGElementImpl
-{
-public:
-
-
-
- /**
- *
- */
- virtual SVGAnimatedString getIn1()
- { return in1; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getDx()
- { return dx; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getDy()
- { return dy; }
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFEOffsetElementImpl() {}
-
-protected:
-
- SVGAnimatedString in1;
- SVGAnimatedLength dx, dy;
-
-};
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGFESpecularLightingElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGFESpecularLightingElementImpl :
- virtual public SVGFESpecularLightingElement,
- public SVGElementImpl
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedString getIn1()
- { return in1; }
-
- /**
- *
- */
- virtual SVGAnimatedNumber getSurfaceScale()
- { return surfaceScale; }
-
- /**
- *
- */
- virtual SVGAnimatedNumber getSpecularConstant()
- { return specularConstant; }
-
- /**
- *
- */
- virtual SVGAnimatedNumber getSpecularExponent()
- { return specularExponent; }
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFESpecularLightingElementImpl() {}
-
-protected:
-
- SVGAnimatedString in1;
- SVGAnimatedNumber surfaceScale;
- SVGAnimatedNumber specularConstant;
- SVGAnimatedNumber specularExponent;
-};
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGFETileElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGFETileElementImpl : virtual public SVGFETileElement,
- public SVGElementImpl
-{
-public:
-
-
- /**
- *
- */
- virtual SVGAnimatedString getIn1()
- { return in1; }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFETileElementImpl() {}
-
-protected:
-
- SVGAnimatedString in1;
-
-};
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGFETurbulenceElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGFETurbulenceElementImpl : virtual public SVGFETurbulenceElement,
- public SVGElementImpl
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedNumber getBaseFrequencyX()
- { return baseFrequencyX; }
-
- /**
- *
- */
- virtual SVGAnimatedNumber getBaseFrequencyY()
- { return baseFrequencyY; }
-
- /**
- *
- */
- virtual SVGAnimatedInteger getNumOctaves()
- { return numOctaves; }
-
- /**
- *
- */
- virtual SVGAnimatedNumber getSeed()
- { return seed; }
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getStitchTiles()
- { return stitchTiles; }
-
- /**
- *
- */
- virtual SVGAnimatedEnumeration getType()
- { return type; }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFETurbulenceElementImpl() {}
-
-protected:
-
- SVGAnimatedNumber baseFrequencyX;
- SVGAnimatedNumber baseFrequencyY;
- SVGAnimatedInteger numOctaves;
- SVGAnimatedNumber seed;
- SVGAnimatedEnumeration stitchTiles;
- SVGAnimatedEnumeration type;
-
-};
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGCursorElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGCursorElementImpl : virtual public SVGCursorElement,
- public SVGElementImpl
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedLength getX()
- { return x; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getY()
- { return x; }
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGCursorElementImpl() {}
-
-protected:
-
- SVGAnimatedLength x, y;
-};
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGAElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGAElementImpl : virtual public SVGAElement,
- public SVGElementImpl
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedString getTarget()
- { return target; }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGAElementImpl() {}
-
-protected:
-
- SVGAnimatedString target;
-};
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGViewElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGViewElementImpl : virtual public SVGViewElement,
- public SVGElementImpl
-{
-public:
-
- /**
- *
- */
- virtual SVGStringList getViewTarget()
- { return viewTarget; }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGViewElementImpl() {}
-
-protected:
-
- SVGStringList viewTarget;
-};
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGScriptElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGScriptElementImpl : virtual public SVGScriptElement,
- public SVGElementImpl
-{
-public:
-
- /**
- *
- */
- virtual DOMString getType()
- { return type; }
-
- /**
- *
- */
- virtual void setType(const DOMString &val) throw (DOMException)
- { type = val; }
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGScriptElementImpl() {}
-
-protected:
-
- DOMString type;
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGAnimationElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGAnimationElementImpl : virtual public SVGAnimationElement,
- public SVGElementImpl
-{
-public:
-
-
- /**
- *
- */
- virtual SVGElement *getTargetElement()
- { return targetElement; }
-
-
- /**
- *
- */
- virtual double getStartTime ( )
- { return startTime; }
-
- /**
- *
- */
- virtual double getCurrentTime ( )
- { return currentTime; }
-
- /**
- *
- */
- virtual double getSimpleDuration ( ) throw( DOMException )
- { return simpleDuration; }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGAnimationElementImpl() {}
-
-protected:
-
- SVGElement *targetElement;
- double startTime, currentTime, simpleDuration;
-};
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGAnimateElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGAnimateElementImpl : virtual public SVGAnimateElement,
- public SVGAnimationElementImpl
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGAnimateElementImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGSetElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGSetElementImpl : virtual public SVGSetElement,
- public SVGAnimationElementImpl
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGSetElementImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGAnimateMotionElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGAnimateMotionElementImpl : virtual public SVGAnimateMotionElement,
- public SVGAnimationElementImpl
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGAnimateMotionElementImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGMPathElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGMPathElementImpl : virtual public SVGMPathElement,
- public SVGElementImpl
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGMPathElementImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGAnimateColorElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGAnimateColorElementImpl : virtual public SVGAnimateColorElement,
- public SVGAnimationElementImpl
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGAnimateColorElementImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGAnimateTransformElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGAnimateTransformElementImpl : virtual public SVGAnimateTransformElement,
- public SVGAnimationElementImpl
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGAnimateTransformElementImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGFontElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGFontElementImpl : virtual public SVGFontElement,
- public SVGElementImpl
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFontElementImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGGlyphElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGGlyphElementImpl : virtual public SVGGlyphElement,
- public SVGElementImpl
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGGlyphElementImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGMissingGlyphElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGMissingGlyphElementImpl : virtual public SVGMissingGlyphElement,
- public SVGElementImpl
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGMissingGlyphElementImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGHKernElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGHKernElementImpl : virtual public SVGHKernElement,
- public SVGElementImpl
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGHKernElementImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGVKernElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGVKernElementImpl : virtual public SVGVKernElement,
- public SVGElementImpl
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGVKernElementImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGFontFaceElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGFontFaceElementImpl : virtual public SVGFontFaceElement,
- public SVGElementImpl
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFontFaceElementImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGFontFaceSrcElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGFontFaceSrcElementImpl : virtual public SVGFontFaceSrcElement,
- public SVGElementImpl
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFontFaceSrcElementImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGFontFaceUriElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGFontFaceUriElementImpl : virtual public SVGFontFaceUriElement,
- public SVGElementImpl
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFontFaceUriElementImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGFontFaceFormatElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGFontFaceFormatElementImpl : virtual public SVGFontFaceFormatElement,
- public SVGElementImpl
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFontFaceFormatElementImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGFontFaceNameElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGFontFaceNameElementImpl : virtual public SVGFontFaceNameElement,
- public SVGElementImpl
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGFontFaceNameElementImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGDefinitionSrcElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGDefinitionSrcElementImpl : virtual public SVGDefinitionSrcElement,
- public SVGElementImpl
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGDefinitionSrcElementImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGMetadataElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGMetadataElementImpl : virtual public SVGMetadataElement,
- public SVGElementImpl
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- virtual ~SVGMetadataElementImpl() {}
-
-protected:
-
-
-};
-
-
-
-
-/*#########################################################################
-## SVGForeignObjectElementImpl
-#########################################################################*/
-
-/**
- *
- */
-class SVGForeignObjectElementImpl : virtual public SVGForeignObjectElement,
- public SVGElementImpl
-{
-public:
-
-
- /**
- *
- */
- virtual SVGAnimatedLength getX()
- { return x; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getY()
- { return y; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getWidth()
- { return width; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getHeight()
- { return height; }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
-
- /**
- *
- */
- virtual ~SVGForeignObjectElementImpl() {}
-
-protected:
-
- SVGAnimatedLength x, y, width, height;
-};
-
-
-
-
-
-
-} //namespace svg
-} //namespace dom
-} //namespace w3c
-} //namespace org
-
-#endif // __SVG_H__
-/*#########################################################################
-## E N D O F F I L E
-#########################################################################*/
-
+#ifndef __SVGIMPL_H__
+#define __SVGIMPL_H__
+
+/**
+ * Phoebe DOM Implementation.
+ *
+ * This is a C++ approximation of the W3C DOM model, which follows
+ * fairly closely the specifications in the various .idl files, copies of
+ * which are provided for reference. Most important is this one:
+ *
+ * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
+ *
+ * Authors:
+ * Bob Jamison
+ *
+ * Copyright (C) 2006 Bob Jamison
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+#include "svg.h"
+#include "dom/domimpl.h"
+#include "dom/smilimpl.h"
+
+#include <math.h>
+
+
+
+namespace org
+{
+namespace w3c
+{
+namespace dom
+{
+namespace svg
+{
+
+
+//local definitions
+typedef dom::DOMString DOMString;
+typedef dom::DOMException DOMException;
+typedef dom::Element Element;
+typedef dom::Document Document;
+typedef dom::NodeList NodeList;
+
+
+
+class SVGSVGElementImpl;
+
+/*#########################################################################
+## SVGDocumentImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGDocumentImpl : virtual public SVGDocument, public DocumentImpl
+{
+public:
+
+
+ /**
+ *
+ */
+ virtual DOMString getTitle()
+ { return title; }
+
+ /**
+ *
+ */
+ virtual DOMString getReferrer()
+ { return referrer; }
+
+ /**
+ *
+ */
+ virtual DOMString getDomain()
+ { return domain; }
+
+ /**
+ *
+ */
+ virtual DOMString getURL()
+ { return url; }
+
+ /**
+ *
+ */
+ virtual SVGSVGElement *getRootElement()
+ { return rootElement; }
+
+
+ //####################################################
+ //# Overload some createXXX() methods from DocumentImpl,
+ //# To create our SVG-DOM types (in .cpp)
+ //####################################################
+
+ /**
+ *
+ */
+ virtual Element *createElement(const DOMString& tagName)
+ throw(DOMException);
+
+
+ /**
+ *
+ */
+ virtual Element *createElementNS(const DOMString& namespaceURI,
+ const DOMString& qualifiedName)
+ throw(DOMException);
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ SVGDocumentImpl(const DOMImplementation *domImpl,
+ const DOMString &namespaceURI,
+ const DOMString &qualifiedName,
+ const DocumentType *doctype)
+ : DocumentImpl(domImpl, namespaceURI,
+ qualifiedName, doctype)
+ {
+ init();
+ }
+
+
+ /**
+ *
+ */
+ virtual ~SVGDocumentImpl()
+ {
+ if (rootElement)
+ delete rootElement;
+ }
+
+protected:
+
+friend class SvgParser;
+
+ void init()
+ {
+ title = "";
+ referrer = "";
+ domain = "";
+ rootElement = NULL;
+ }
+
+ DOMString title;
+ DOMString referrer;
+ DOMString domain;
+ DOMString url;
+ SVGSVGElement *rootElement;
+};
+
+
+
+/*#########################################################################
+## SVGElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGElementImpl : virtual public SVGElement,
+ public ElementImpl
+{
+public:
+
+ /**
+ *
+ */
+ virtual DOMString getId()
+ { return id; }
+
+ /**
+ *
+ */
+ virtual void setId(const DOMString &val)
+ throw (DOMException)
+ { id = val; }
+
+ /**
+ *
+ */
+ virtual DOMString getXmlBase()
+ { return xmlBase; }
+
+ /**
+ *
+ */
+ virtual void setXmlBase(const DOMString &val)
+ throw (DOMException)
+ { xmlBase = val; }
+
+ /**
+ *
+ */
+ virtual SVGSVGElement *getOwnerSVGElement()
+ { return ownerSvgElement; }
+
+ /**
+ *
+ */
+ virtual SVGElement *getViewportElement()
+ { return viewportElement; }
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+
+ /**
+ *
+ */
+ SVGElementImpl()
+ {}
+
+ /**
+ *
+ */
+ SVGElementImpl(SVGDocumentImpl *owner, const DOMString &tagName)
+ : ElementImpl(owner, tagName)
+ { init(); }
+
+ /**
+ *
+ */
+ SVGElementImpl(SVGDocumentImpl *owner,
+ const DOMString &namespaceURI,
+ const DOMString &tagName)
+ : ElementImpl(owner, namespaceURI, tagName)
+ { init(); }
+
+
+ /**
+ *
+ */
+ virtual ~SVGElementImpl()
+ {}
+
+protected:
+
+ void init()
+ {
+ id = "";
+ xmlBase = "";
+ ownerSvgElement = NULL;
+ viewportElement = NULL;
+ }
+
+ DOMString id;
+ DOMString xmlBase;
+ SVGSVGElement *ownerSvgElement;
+ SVGElement *viewportElement;
+
+};
+
+
+
+/*#########################################################################
+## SVGSVGElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGSVGElementImpl : virtual public SVGSVGElement,
+ public SVGElementImpl
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getX()
+ { return x; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getY()
+ { return y; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getWidth()
+ { return width; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getHeight()
+ { return height; }
+
+ /**
+ *
+ */
+ virtual DOMString getContentScriptType()
+ { return contentScriptType; }
+
+ /**
+ *
+ */
+ virtual void setContentScriptType(const DOMString &val)
+ throw (DOMException)
+ { contentScriptType = val; }
+
+
+ /**
+ *
+ */
+ virtual DOMString getContentStyleType()
+ { return contentStyleType; }
+
+ /**
+ *
+ */
+ virtual void setContentStyleType(const DOMString &val)
+ throw (DOMException)
+ { contentStyleType = val; }
+
+ /**
+ *
+ */
+ virtual SVGRect getViewport()
+ { return viewport; }
+
+ /**
+ *
+ */
+ virtual double getPixelUnitToMillimeterX()
+ { return pixelUnitToMillimeterX; }
+
+ /**
+ *
+ */
+ virtual double getPixelUnitToMillimeterY()
+ { return pixelUnitToMillimeterY; }
+
+ /**
+ *
+ */
+ virtual double getScreenPixelToMillimeterX()
+ { return screenPixelToMillimeterX; }
+
+ /**
+ *
+ */
+ virtual double getScreenPixelToMillimeterY()
+ { return screenPixelToMillimeterY; }
+
+
+ /**
+ *
+ */
+ virtual bool getUseCurrentView()
+ { return useCurrentView; }
+
+ /**
+ *
+ */
+ virtual void setUseCurrentView(bool val) throw (DOMException)
+ { useCurrentView = val; }
+
+ /**
+ *
+ */
+ virtual SVGViewSpec getCurrentView()
+ { return currentView; }
+
+
+ /**
+ *
+ */
+ virtual double getCurrentScale()
+ { return currentScale; }
+
+ /**
+ *
+ */
+ virtual void setCurrentScale(double val) throw (DOMException)
+ { currentScale = val; }
+
+
+ /**
+ *
+ */
+ virtual SVGPoint getCurrentTranslate()
+ { return currentTranslate; }
+
+
+ /**
+ *
+ */
+ virtual unsigned long suspendRedraw (unsigned long max_wait_milliseconds );
+
+ /**
+ *
+ */
+ virtual void unsuspendRedraw (unsigned long suspend_handle_id )
+ throw( DOMException );
+
+ /**
+ *
+ */
+ virtual void unsuspendRedrawAll ( );
+
+ /**
+ *
+ */
+ virtual void forceRedraw ( );
+
+ /**
+ *
+ */
+ virtual void pauseAnimations ( );
+
+ /**
+ *
+ */
+ virtual void unpauseAnimations ( );
+
+ /**
+ *
+ */
+ virtual bool animationsPaused ( );
+
+ /**
+ *
+ */
+ virtual double getCurrentTime ( )
+ { return currentTime; }
+
+ /**
+ *
+ */
+ virtual void setCurrentTime (double seconds )
+ { currentTime = seconds; }
+
+ /**
+ *
+ */
+ virtual NodeList getIntersectionList (const SVGRect &rect,
+ const SVGElement *referenceElement );
+
+ /**
+ *
+ */
+ virtual NodeList getEnclosureList (const SVGRect &rect,
+ const SVGElement *referenceElement );
+
+ /**
+ *
+ */
+ virtual bool checkIntersection (const SVGElement *element, const SVGRect &rect );
+
+ /**
+ *
+ */
+ virtual bool checkEnclosure (const SVGElement *element, const SVGRect &rect );
+
+ /**
+ *
+ */
+ virtual void deselectAll ( );
+
+ /**
+ *
+ */
+ virtual SVGNumber createSVGNumber ( )
+ {
+ SVGNumber ret;
+ return ret;
+ }
+
+ /**
+ *
+ */
+ virtual SVGLength createSVGLength ( )
+ {
+ SVGLength ret;
+ return ret;
+ }
+
+ /**
+ *
+ */
+ virtual SVGAngle createSVGAngle ( )
+ {
+ SVGAngle ret;
+ return ret;
+ }
+
+ /**
+ *
+ */
+ virtual SVGPoint createSVGPoint ( )
+ {
+ SVGPoint ret;
+ return ret;
+ }
+
+ /**
+ *
+ */
+ virtual SVGMatrix createSVGMatrix ( )
+ {
+ SVGMatrix ret;
+ return ret;
+ }
+
+ /**
+ *
+ */
+ virtual SVGRect createSVGRect ( )
+ {
+ SVGRect ret;
+ return ret;
+ }
+
+ /**
+ *
+ */
+ virtual SVGTransform createSVGTransform ( )
+ {
+ SVGTransform ret;
+ return ret;
+ }
+
+ /**
+ *
+ */
+ virtual SVGTransform createSVGTransformFromMatrix(const SVGMatrix &matrix )
+ {
+ SVGTransform ret;
+ ret.setMatrix(matrix);
+ return ret;
+ }
+
+
+ /**
+ *
+ */
+ virtual Element *getElementById (const DOMString& elementId );
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGSVGElementImpl() : SVGElementImpl()
+ {}
+
+
+
+ /**
+ *
+ */
+ virtual ~SVGSVGElementImpl() {}
+
+protected:
+
+ SVGAnimatedLength x;
+ SVGAnimatedLength y;
+ SVGAnimatedLength width;
+ SVGAnimatedLength height;
+ DOMString contentScriptType;
+ DOMString contentStyleType;
+ SVGRect viewport;
+ double pixelUnitToMillimeterX;
+ double pixelUnitToMillimeterY;
+ double screenPixelToMillimeterX;
+ double screenPixelToMillimeterY;
+ bool useCurrentView;
+ SVGViewSpec currentView;
+ double currentScale;
+ SVGPoint currentTranslate;
+
+ double currentTime;
+
+};
+
+
+
+/*#########################################################################
+## SVGGElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGGElementImpl : virtual public SVGGElement, public SVGElementImpl
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGGElementImpl() {}
+
+ /**
+ *
+ */
+ virtual ~SVGGElementImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+/*#########################################################################
+## SVGDefsElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGDefsElementImpl : virtual public SVGDefsElement,
+ public SVGElementImpl
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGDefsElementImpl() {}
+
+ /**
+ *
+ */
+ virtual ~SVGDefsElementImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGDescElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGDescElementImpl : virtual public SVGDescElement,
+ public SVGElementImpl
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGDescElementImpl() {}
+
+ /**
+ *
+ */
+ virtual ~SVGDescElementImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGTitleElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGTitleElementImpl : virtual public SVGTitleElement,
+ public SVGElementImpl
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGTitleElementImpl() {}
+
+ /**
+ *
+ */
+ virtual ~SVGTitleElementImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGSymbolElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGSymbolElementImpl : virtual public SVGSymbolElement,
+ public SVGElementImpl
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGSymbolElementImpl() {}
+
+ /**
+ *
+ */
+ virtual ~SVGSymbolElementImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGUseElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGUseElementImpl : public SVGElementImpl
+{
+public:
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getX()
+ { return x; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getY()
+ { return y; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getWidth()
+ { return width; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getHeight()
+ { return height; }
+
+ /**
+ *
+ */
+ virtual SVGElementInstance getInstanceRoot()
+ { return instanceRoot; }
+
+ /**
+ *
+ */
+ virtual SVGElementInstance getAnimatedInstanceRoot()
+ { return animatedInstanceRoot; }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGUseElementImpl() {}
+
+ /**
+ *
+ */
+ virtual ~SVGUseElementImpl() {}
+
+protected:
+
+ SVGAnimatedLength x;
+ SVGAnimatedLength y;
+ SVGAnimatedLength width;
+ SVGAnimatedLength height;
+ SVGElementInstance instanceRoot;
+ SVGElementInstance animatedInstanceRoot;
+};
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGImageElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGImageElementImpl : virtual public SVGImageElement,
+ public SVGElementImpl
+{
+public:
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getX()
+ { return x; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getY()
+ { return y; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getWidth()
+ { return width; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getHeight()
+ { return height; }
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedPreserveAspectRatio getPreserveAspectRatio()
+ { return preserveAspectRatio; }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGImageElementImpl() {}
+
+ /**
+ *
+ */
+ virtual ~SVGImageElementImpl() {}
+
+protected:
+
+ SVGAnimatedLength x;
+ SVGAnimatedLength y;
+ SVGAnimatedLength width;
+ SVGAnimatedLength height;
+ SVGAnimatedPreserveAspectRatio preserveAspectRatio;
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGSwitchElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGSwitchElementImpl : virtual public SVGSwitchElement,
+ public SVGElementImpl
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGSwitchElementImpl() {}
+
+ /**
+ *
+ */
+ virtual ~SVGSwitchElementImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+
+/*#########################################################################
+## GetSVGDocumentImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class GetSVGDocumentImpl : public virtual GetSVGDocument
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGDocument *getSVGDocument ( )
+ throw( DOMException );
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ GetSVGDocumentImpl() {}
+
+ /**
+ *
+ */
+ virtual ~GetSVGDocumentImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGStyleElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGStyleElementImpl : virtual public SVGStyleElement,
+ public SVGElementImpl
+{
+public:
+
+ /**
+ *
+ */
+ virtual DOMString getXmlspace()
+ { return xmlSpace; }
+
+ /**
+ *
+ */
+ virtual void setXmlspace(const DOMString &val)
+ throw (DOMException)
+ { xmlSpace = val; }
+
+ /**
+ *
+ */
+ virtual DOMString getType()
+ { return type; }
+
+ /**
+ *
+ */
+ virtual void setType(const DOMString &val)
+ throw (DOMException)
+ { type = val; }
+
+ /**
+ *
+ */
+ virtual DOMString getMedia()
+ { return media; }
+
+ /**
+ *
+ */
+ virtual void setMedia(const DOMString &val)
+ throw (DOMException)
+ { media = val; }
+
+ /**
+ *
+ */
+ virtual DOMString getTitle()
+ { return title; }
+
+ /**
+ *
+ */
+ virtual void setTitle(const DOMString &val)
+ throw (DOMException)
+ { title = val; }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGStyleElementImpl() {}
+
+ /**
+ *
+ */
+ virtual ~SVGStyleElementImpl() {}
+
+protected:
+
+ DOMString xmlSpace;
+ DOMString type;
+ DOMString media;
+ DOMString title;
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGPathElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGPathElementImpl : virtual public SVGPathElement,
+ public SVGElementImpl
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getPathLength();
+
+ /**
+ *
+ */
+ virtual double getTotalLength ( );
+
+ /**
+ *
+ */
+ virtual SVGPoint getPointAtLength (double distance );
+
+ /**
+ *
+ */
+ virtual unsigned long getPathSegAtLength (double distance );
+
+ /**
+ *
+ */
+ virtual SVGPathSegClosePath
+ createSVGPathSegClosePath ( )
+ {
+ SVGPathSegClosePath ret;
+ return ret;
+ }
+
+ /**
+ *
+ */
+ virtual SVGPathSegMovetoAbs
+ createSVGPathSegMovetoAbs (double x, double y )
+ {
+ SVGPathSegMovetoAbs ret(x, y);
+ return ret;
+ }
+
+ /**
+ *
+ */
+ virtual SVGPathSegMovetoRel
+ createSVGPathSegMovetoRel (double x, double y )
+ {
+ SVGPathSegMovetoRel ret(x, y);
+ return ret;
+ }
+
+ /**
+ *
+ */
+ virtual SVGPathSegLinetoAbs
+ createSVGPathSegLinetoAbs (double x, double y )
+ {
+ SVGPathSegLinetoAbs ret(x, y);
+ return ret;
+ }
+
+ /**
+ *
+ */
+ virtual SVGPathSegLinetoRel
+ createSVGPathSegLinetoRel (double x, double y )
+ {
+ SVGPathSegLinetoRel ret(x, y);
+ return ret;
+ }
+
+ /**
+ *
+ */
+ virtual SVGPathSegCurvetoCubicAbs
+ createSVGPathSegCurvetoCubicAbs (double x, double y,
+ double x1, double y1, double x2, double y2 )
+ {
+ SVGPathSegCurvetoCubicAbs ret(x, y, x1, y1, x2, y2);
+ return ret;
+ }
+
+ /**
+ *
+ */
+ virtual SVGPathSegCurvetoCubicRel
+ createSVGPathSegCurvetoCubicRel (double x, double y,
+ double x1, double y1, double x2, double y2 )
+ {
+ SVGPathSegCurvetoCubicRel ret(x, y, x1, y1, x2, y2);
+ return ret;
+ }
+
+ /**
+ *
+ */
+ virtual SVGPathSegCurvetoQuadraticAbs
+ createSVGPathSegCurvetoQuadraticAbs (double x, double y,
+ double x1, double y1 )
+ {
+ SVGPathSegCurvetoQuadraticAbs ret(x, y, x1, y1);
+ return ret;
+ }
+
+ /**
+ *
+ */
+ virtual SVGPathSegCurvetoQuadraticRel
+ createSVGPathSegCurvetoQuadraticRel (double x, double y,
+ double x1, double y1 )
+ {
+ SVGPathSegCurvetoQuadraticRel ret(x, y, x1, y1);
+ return ret;
+ }
+
+ /**
+ *
+ */
+ virtual SVGPathSegArcAbs
+ createSVGPathSegArcAbs (double x, double y,
+ double r1, double r2, double angle,
+ bool largeArcFlag, bool sweepFlag )
+ {
+ SVGPathSegArcAbs ret(x, y, r1, r2, angle, largeArcFlag, sweepFlag);
+ return ret;
+ }
+
+ /**
+ *
+ */
+ virtual SVGPathSegArcRel
+ createSVGPathSegArcRel (double x, double y, double r1,
+ double r2, double angle, bool largeArcFlag,
+ bool sweepFlag )
+ {
+ SVGPathSegArcRel ret(x, y, r1, r2, angle, largeArcFlag, sweepFlag);
+ return ret;
+ }
+
+ /**
+ *
+ */
+ virtual SVGPathSegLinetoHorizontalAbs
+ createSVGPathSegLinetoHorizontalAbs (double x )
+ {
+ SVGPathSegLinetoHorizontalAbs ret(x);
+ return ret;
+ }
+
+ /**
+ *
+ */
+ virtual SVGPathSegLinetoHorizontalRel
+ createSVGPathSegLinetoHorizontalRel (double x )
+ {
+ SVGPathSegLinetoHorizontalRel ret(x);
+ return ret;
+ }
+
+ /**
+ *
+ */
+ virtual SVGPathSegLinetoVerticalAbs
+ createSVGPathSegLinetoVerticalAbs (double y )
+ {
+ SVGPathSegLinetoVerticalAbs ret(y);
+ return ret;
+ }
+
+ /**
+ *
+ */
+ virtual SVGPathSegLinetoVerticalRel
+ createSVGPathSegLinetoVerticalRel (double y )
+ {
+ SVGPathSegLinetoVerticalRel ret(y);
+ return ret;
+ }
+
+ /**
+ *
+ */
+ virtual SVGPathSegCurvetoCubicSmoothAbs
+ createSVGPathSegCurvetoCubicSmoothAbs (double x, double y,
+ double x2, double y2 )
+ {
+ SVGPathSegCurvetoCubicSmoothAbs ret(x, y, x2, y2);
+ return ret;
+ }
+
+ /**
+ *
+ */
+ virtual SVGPathSegCurvetoCubicSmoothRel
+ createSVGPathSegCurvetoCubicSmoothRel (double x, double y,
+ double x2, double y2 )
+ {
+ SVGPathSegCurvetoCubicSmoothRel ret(x, y, x2, y2);
+ return ret;
+ }
+
+ /**
+ *
+ */
+ virtual SVGPathSegCurvetoQuadraticSmoothAbs
+ createSVGPathSegCurvetoQuadraticSmoothAbs (double x, double y )
+ {
+ SVGPathSegCurvetoQuadraticSmoothAbs ret(x, y);
+ return ret;
+ }
+
+ /**
+ *
+ */
+ virtual SVGPathSegCurvetoQuadraticSmoothRel
+ createSVGPathSegCurvetoQuadraticSmoothRel (double x, double y )
+ {
+ SVGPathSegCurvetoQuadraticSmoothRel ret(x, y);
+ return ret;
+ }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGPathElementImpl() {}
+
+
+ /**
+ *
+ */
+ virtual ~SVGPathElementImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGRectElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGRectElementImpl : virtual public SVGRectElement,
+ public SVGElementImpl
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getX()
+ { return x; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getY()
+ { return y; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getWidth()
+ { return width; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getHeight()
+ { return height; }
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getRx()
+ { return rx; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getRy()
+ { return ry; }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGRectElementImpl() {}
+
+ /**
+ *
+ */
+ virtual ~SVGRectElementImpl() {}
+
+protected:
+
+ SVGAnimatedLength x;
+ SVGAnimatedLength y;
+ SVGAnimatedLength width;
+ SVGAnimatedLength height;
+ SVGAnimatedLength rx;
+ SVGAnimatedLength ry;
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGCircleElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGCircleElementImpl : virtual public SVGCircleElement,
+ public SVGElementImpl
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getCx()
+ { return cx; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getCy()
+ { return cy; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getR()
+ { return r; }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGCircleElementImpl() {}
+
+ /**
+ *
+ */
+ virtual ~SVGCircleElementImpl() {}
+
+protected:
+
+ SVGAnimatedLength cx;
+ SVGAnimatedLength cy;
+ SVGAnimatedLength r;
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGEllipseElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGEllipseElementImpl : virtual public SVGEllipseElement,
+ public SVGElementImpl
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getCx()
+ { return cx; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getCy()
+ { return cy; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getRx()
+ { return rx; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getRy()
+ { return ry; }
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGEllipseElementImpl() {}
+
+ /**
+ *
+ */
+ virtual ~SVGEllipseElementImpl() {}
+
+protected:
+
+ SVGAnimatedLength cx;
+ SVGAnimatedLength cy;
+ SVGAnimatedLength rx;
+ SVGAnimatedLength ry;
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGLineElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGLineElementImpl : virtual public SVGLineElement,
+ public SVGElementImpl
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getX1()
+ { return x1; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getY1()
+ { return y1; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getX2()
+ { return x2; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getY2()
+ { return y2; }
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGLineElementImpl() {}
+
+protected:
+
+ SVGAnimatedLength x1;
+ SVGAnimatedLength x2;
+ SVGAnimatedLength y1;
+ SVGAnimatedLength y2;
+};
+
+
+
+
+/*#########################################################################
+## SVGPolylineElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGPolylineElementImpl : virtual public SVGPolylineElement,
+ public SVGElementImpl
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGPolylineElementImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGPolygonElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGPolygonElementImpl : virtual public SVGPolygonElement,
+ public SVGElementImpl
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGPolygonElementImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGTextContentElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGTextContentElementImpl : virtual public SVGTextContentElement,
+ public SVGElementImpl
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getTextLength();
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getLengthAdjust();
+
+
+ /**
+ *
+ */
+ virtual long getNumberOfChars ( );
+
+ /**
+ *
+ */
+ virtual double getComputedTextLength ( );
+
+ /**
+ *
+ */
+ virtual double getSubStringLength (unsigned long charnum, unsigned long nchars )
+ throw( DOMException );
+
+ /**
+ *
+ */
+ virtual SVGPoint getStartPositionOfChar (unsigned long charnum )
+ throw( DOMException );
+
+ /**
+ *
+ */
+ virtual SVGPoint getEndPositionOfChar (unsigned long charnum )
+ throw( DOMException );
+
+ /**
+ *
+ */
+ virtual SVGRect getExtentOfChar (unsigned long charnum )
+ throw( DOMException );
+
+ /**
+ *
+ */
+ virtual double getRotationOfChar (unsigned long charnum )
+ throw( DOMException );
+
+ /**
+ *
+ */
+ virtual long getCharNumAtPosition (const SVGPoint &point );
+
+ /**
+ *
+ */
+ virtual void selectSubString (unsigned long charnum, unsigned long nchars )
+ throw( DOMException );
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGTextContentElementImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGTextPositioningElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGTextPositioningElementImpl : virtual public SVGTextPositioningElement,
+ public SVGTextContentElementImpl
+{
+public:
+
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getX()
+ { return x; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getY()
+ { return y; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getDx()
+ { return dx; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getDy()
+ { return dy; }
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumberList getRotate()
+ { return rotate; }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGTextPositioningElementImpl() {}
+
+protected:
+
+ SVGAnimatedLength x;
+ SVGAnimatedLength y;
+ SVGAnimatedLength dx;
+ SVGAnimatedLength dy;
+ SVGAnimatedNumberList rotate;
+
+};
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGTextElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGTextElementImpl : virtual public SVGTextElement,
+ public SVGTextPositioningElementImpl
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGTextElementImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGTSpanElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGTSpanElementImpl : virtual public SVGTSpanElement,
+ public SVGTextPositioningElementImpl
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGTSpanElementImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGTRefElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGTRefElementImpl : virtual public SVGTRefElement,
+ public SVGTextPositioningElementImpl
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGTRefElementImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGTextPathElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGTextPathElementImpl : virtual public SVGTextPathElement,
+ public SVGTextContentElementImpl
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getStartOffset()
+ { return startOffset; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getMethod()
+ { return method; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getSpacing()
+ { return spacing; }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGTextPathElementImpl() {}
+
+protected:
+
+ SVGAnimatedLength startOffset;
+ SVGAnimatedEnumeration method;
+ SVGAnimatedEnumeration spacing;
+};
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGAltGlyphElement
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGAltGlyphElementImpl : virtual public SVGAltGlyphElement,
+ public SVGTextPositioningElementImpl
+{
+public:
+
+ /**
+ *
+ */
+ virtual DOMString getGlyphRef()
+ { return glyphRef; }
+
+ /**
+ *
+ */
+ virtual void setGlyphRef(const DOMString &val)
+ throw (DOMException)
+ { glyphRef = val; }
+
+ /**
+ *
+ */
+ virtual DOMString getFormat()
+ { return format; }
+
+ /**
+ *
+ */
+ virtual void setFormat(const DOMString &val)
+ throw (DOMException)
+ { format = val; }
+
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGAltGlyphElementImpl() {}
+
+protected:
+
+ DOMString glyphRef;
+ DOMString format;
+
+};
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGAltGlyphDefElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGAltGlyphDefElementImpl : virtual public SVGAltGlyphDefElement,
+ public SVGElementImpl
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGAltGlyphDefElementImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGAltGlyphItemElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGAltGlyphItemElementImpl : virtual public SVGAltGlyphItemElement,
+ public SVGElementImpl
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGAltGlyphItemElementImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGGlyphRefElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGGlyphRefElementImpl : virtual public SVGGlyphRefElement,
+ public SVGElementImpl
+{
+public:
+ /**
+ *
+ */
+ virtual DOMString getGlyphRef()
+ { return glyphRef; }
+
+ /**
+ *
+ */
+ virtual void setGlyphRef(const DOMString &val) throw (DOMException)
+ { glyphRef = val; }
+
+ /**
+ *
+ */
+ virtual DOMString getFormat()
+ { return format; }
+
+ /**
+ *
+ */
+ virtual void setFormat(const DOMString &val) throw (DOMException)
+ { format = val; }
+
+ /**
+ *
+ */
+ virtual double getX()
+ { return x; }
+
+ /**
+ *
+ */
+ virtual void setX(double val) throw (DOMException)
+ { x = val; }
+
+ /**
+ *
+ */
+ virtual double getY()
+ { return y; }
+
+ /**
+ *
+ */
+ virtual void setY(double val) throw (DOMException)
+ { y = val; }
+
+ /**
+ *
+ */
+ virtual double getDx()
+ { return dx; }
+
+ /**
+ *
+ */
+ virtual void setDx(double val) throw (DOMException)
+ { dx = val; }
+
+ /**
+ *
+ */
+ virtual double getDy()
+ { return dy; }
+
+ /**
+ *
+ */
+ virtual void setDy(double val) throw (DOMException)
+ { dy = val; }
+
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGGlyphRefElementImpl() {}
+
+protected:
+
+ DOMString glyphRef;
+ DOMString format;
+ double x, y, dx, dy;
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGMarkerElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGMarkerElementImpl : virtual public SVGMarkerElement,
+ public SVGElementImpl
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getRefX()
+ { return refX; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getRefY()
+ { return refY; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getMarkerUnits()
+ { return markerUnits; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getMarkerWidth()
+ { return markerWidth; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getMarkerHeight()
+ { return markerHeight; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getOrientType()
+ { return orientType; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedAngle getOrientAngle()
+ { return orientAngle; }
+
+
+ /**
+ *
+ */
+ virtual void setOrientToAuto ( )
+ { orientAuto = true; }
+
+ /**
+ *
+ */
+ virtual void setOrientToAngle (const SVGAngle &angle)
+ {
+ orientAuto = false;
+ orientAngle = SVGAnimatedAngle(angle);
+ }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGMarkerElementImpl() {}
+
+protected:
+
+ SVGAnimatedLength refX;
+ SVGAnimatedLength refY;
+ SVGAnimatedEnumeration markerUnits;
+ SVGAnimatedLength markerWidth;
+ SVGAnimatedLength markerHeight;
+ SVGAnimatedEnumeration orientType;
+ SVGAnimatedAngle orientAngle;
+ bool orientAuto;
+
+
+};
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGColorProfileElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGColorProfileElementImpl : virtual public SVGColorProfileElement,
+ public SVGElementImpl
+{
+public:
+ /**
+ *
+ */
+ virtual DOMString getLocal()
+ { return local; }
+
+ /**
+ *
+ */
+ virtual void setLocal(const DOMString &val) throw (DOMException)
+ { local = val; }
+
+ /**
+ *
+ */
+ virtual DOMString getName()
+ { return name; }
+
+ /**
+ *
+ */
+ virtual void setName(const DOMString &val) throw (DOMException)
+ { name = val; }
+
+ /**
+ *
+ */
+ virtual unsigned short getRenderingIntent()
+ { return renderingIntent; }
+
+ /**
+ *
+ */
+ virtual void setRenderingIntent(unsigned short val) throw (DOMException)
+ { renderingIntent = val; }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGColorProfileElementImpl() {}
+
+protected:
+
+ DOMString local;
+ DOMString name;
+ unsigned short renderingIntent;
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGGradientElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGGradientElementImpl : virtual public SVGGradientElement,
+ public SVGElementImpl
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getGradientUnits()
+ { return gradientUnits; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedTransformList getGradientTransform()
+ { return gradientTransform; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getSpreadMethod()
+ { return spreadMethod; }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGGradientElementImpl() {}
+
+protected:
+
+
+ SVGAnimatedEnumeration gradientUnits;
+ SVGAnimatedTransformList gradientTransform;
+ SVGAnimatedEnumeration spreadMethod;
+};
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGLinearGradientElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGLinearGradientElementImpl : virtual public SVGLinearGradientElement,
+ public SVGGradientElementImpl
+{
+public:
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getX1()
+ { return x1; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getY1()
+ { return y1; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getX2()
+ { return x2; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getY2()
+ { return y2; }
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGLinearGradientElementImpl() {}
+
+protected:
+
+ SVGAnimatedLength x1, x2, y1, y2;
+
+};
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGRadialGradientElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGRadialGradientElementImpl : virtual public SVGRadialGradientElement,
+ public SVGGradientElementImpl
+{
+public:
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getCx()
+ { return cx; }
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getCy()
+ { return cy; }
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getR()
+ { return r; }
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getFx()
+ { return fx; }
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getFy()
+ { return fy; }
+
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGRadialGradientElementImpl() {}
+
+protected:
+
+ SVGAnimatedLength cx, cy, r, fx, fy;
+
+};
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGStopElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGStopElementImpl : virtual public SVGStopElement,
+ public SVGElementImpl
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getOffset()
+ { return offset; }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGStopElementImpl() {}
+
+protected:
+
+ SVGAnimatedNumber offset;
+
+};
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGPatternElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGPatternElementImpl : virtual public SVGPatternElement,
+ public SVGElementImpl
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getPatternUnits()
+ { return patternUnits; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getPatternContentUnits()
+ { return patternContentUnits; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedTransformList getPatternTransform()
+ { return patternTransform; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getX()
+ { return x; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getY()
+ { return y; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getWidth()
+ { return width; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getHeight()
+ { return height; }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGPatternElementImpl() {}
+
+protected:
+
+
+ SVGAnimatedEnumeration patternUnits;
+ SVGAnimatedEnumeration patternContentUnits;
+ SVGAnimatedTransformList patternTransform;
+ SVGAnimatedLength x;
+ SVGAnimatedLength y;
+ SVGAnimatedLength width;
+ SVGAnimatedLength height;
+};
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGClipPathElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGClipPathElementImpl : virtual public SVGClipPathElement,
+ public SVGElementImpl
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getClipPathUnits()
+ { return clipPathUnits; }
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGClipPathElementImpl() {}
+
+protected:
+
+ SVGAnimatedEnumeration clipPathUnits;
+
+};
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGMaskElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGMaskElementImpl : virtual public SVGMaskElement,
+ public SVGElementImpl
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getMaskUnits()
+ { return maskUnits; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getMaskContentUnits()
+ { return maskContentUnits; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getX()
+ { return x; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getY()
+ { return y; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getWidth()
+ { return width; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getHeight()
+ { return height; }
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGMaskElementImpl() {}
+
+protected:
+
+
+ SVGAnimatedEnumeration maskUnits;
+ SVGAnimatedEnumeration maskContentUnits;
+ SVGAnimatedLength x;
+ SVGAnimatedLength y;
+ SVGAnimatedLength width;
+ SVGAnimatedLength height;
+};
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGFilterElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFilterElementImpl : virtual public SVGFilterElement,
+ public SVGElementImpl
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getFilterUnits()
+ { return filterUnits; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getPrimitiveUnits()
+ { return filterUnits; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getX()
+ { return x; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getY()
+ { return y; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getWidth()
+ { return width; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getHeight()
+ { return height; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedInteger getFilterResX()
+ { return filterResX; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedInteger getFilterResY()
+ { return filterResY; }
+
+ /**
+ *
+ */
+ virtual void setFilterRes (unsigned long filterResXArg,
+ unsigned long filterResYArg )
+ {
+ filterResX = filterResXArg;
+ filterResY = filterResYArg;
+ }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFilterElementImpl() {}
+
+protected:
+
+ SVGAnimatedEnumeration filterUnits;
+ SVGAnimatedEnumeration primitiveUnits;
+ SVGAnimatedLength x;
+ SVGAnimatedLength y;
+ SVGAnimatedLength width;
+ SVGAnimatedLength height;
+ SVGAnimatedInteger filterResX;
+ SVGAnimatedInteger filterResY;
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGFEBlendElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFEBlendElementImpl : virtual public SVGFEBlendElement,
+ public SVGElementImpl
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedString getIn1()
+ { return in1; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedString getIn2()
+ { return in2; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getMode()
+ { return mode; }
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFEBlendElementImpl() {}
+
+protected:
+
+ SVGAnimatedString in1, in2;
+ SVGAnimatedEnumeration mode;
+};
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGFEColorMatrixElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFEColorMatrixElementImpl : virtual public SVGFEColorMatrixElement,
+ public SVGElementImpl
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedString getIn1()
+ { return in1; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getType()
+ { return type; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumberList getValues()
+ { return values; }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFEColorMatrixElementImpl() {}
+
+protected:
+
+ SVGAnimatedString in1;
+ SVGAnimatedEnumeration type;
+ SVGAnimatedNumberList values;
+
+};
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGFEComponentTransferElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFEComponentTransferElementImpl :
+ virtual public SVGFEComponentTransferElement,
+ public SVGElementImpl
+{
+public:
+ /**
+ *
+ */
+ virtual SVGAnimatedString getIn1()
+ { return in1; }
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFEComponentTransferElementImpl() {}
+
+protected:
+
+ SVGAnimatedString in1;
+
+};
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGComponentTransferFunctionElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGComponentTransferFunctionElementImpl :
+ virtual public SVGComponentTransferFunctionElement,
+ public SVGElementImpl
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getType()
+ { return type; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumberList getTableValues()
+ { return tableValues; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getSlope()
+ { return slope; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getIntercept()
+ { return intercept; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getAmplitude()
+ { return amplitude; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getExponent()
+ { return exponent; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getOffset()
+ { return offset; }
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGComponentTransferFunctionElementImpl() {}
+
+protected:
+
+ SVGAnimatedEnumeration type;
+ SVGAnimatedNumberList tableValues;
+ SVGAnimatedNumber slope;
+ SVGAnimatedNumber intercept;
+ SVGAnimatedNumber amplitude;
+ SVGAnimatedNumber exponent;
+ SVGAnimatedNumber offset;
+
+};
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGFEFuncRElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFEFuncRElementImpl :
+ virtual public SVGFEFuncRElement,
+ public SVGComponentTransferFunctionElementImpl
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFEFuncRElementImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGFEFuncGElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFEFuncGElementImpl : virtual public SVGFEFuncGElement,
+ public SVGComponentTransferFunctionElementImpl
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFEFuncGElementImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGFEFuncBElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFEFuncBElementImpl : virtual public SVGFEFuncBElement,
+ public SVGComponentTransferFunctionElementImpl
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFEFuncBElementImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGFEFuncAElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFEFuncAElementImpl : virtual public SVGFEFuncAElement,
+ public SVGComponentTransferFunctionElementImpl
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFEFuncAElementImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGFECompositeElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFECompositeElementImpl : virtual public SVGFECompositeElement,
+ public SVGElementImpl
+{
+public:
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedString getIn1()
+ { return in1; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedString getIn2()
+ { return in2; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getOperator()
+ { return ae_operator; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getK1()
+ { return k1; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getK2()
+ { return k2; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getK3()
+ { return k3; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getK4()
+ { return k4; }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFECompositeElementImpl() {}
+
+protected:
+
+
+ SVGAnimatedString in1;
+ SVGAnimatedString in2;
+ SVGAnimatedEnumeration ae_operator;
+ SVGAnimatedNumber k1;
+ SVGAnimatedNumber k2;
+ SVGAnimatedNumber k3;
+ SVGAnimatedNumber k4;
+
+};
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGFEConvolveMatrixElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFEConvolveMatrixElementImpl : virtual public SVGFEConvolveMatrixElement,
+ public SVGElementImpl
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedInteger getOrderX()
+ { return orderX; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedInteger getOrderY()
+ { return orderY; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumberList getKernelMatrix()
+ { return kernelMatrix; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getDivisor()
+ { return divisor; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getBias()
+ { return bias; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedInteger getTargetX()
+ { return targetX; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedInteger getTargetY()
+ { return targetY; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getEdgeMode()
+ { return edgeMode; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getKernelUnitLengthX()
+ { return kernelUnitLengthX; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getKernelUnitLengthY()
+ { return kernelUnitLengthY; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedBoolean getPreserveAlpha()
+ { return preserveAlpha; }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFEConvolveMatrixElementImpl() {}
+
+protected:
+
+ SVGAnimatedInteger orderX;
+ SVGAnimatedInteger orderY;
+ SVGAnimatedNumberList kernelMatrix;
+ SVGAnimatedNumber divisor;
+ SVGAnimatedNumber bias;
+ SVGAnimatedInteger targetX;
+ SVGAnimatedInteger targetY;
+ SVGAnimatedEnumeration edgeMode;
+ SVGAnimatedLength kernelUnitLengthX;
+ SVGAnimatedLength kernelUnitLengthY;
+ SVGAnimatedBoolean preserveAlpha;
+
+};
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGFEDiffuseLightingElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFEDiffuseLightingElementImpl : virtual public SVGFEDiffuseLightingElement,
+ public SVGElementImpl
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedString getIn1()
+ { return in1; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getSurfaceScale()
+ { return surfaceScale; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getDiffuseConstant()
+ { return diffuseConstant; }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFEDiffuseLightingElementImpl() {}
+
+protected:
+
+ SVGAnimatedString in1;
+ SVGAnimatedNumber surfaceScale;
+ SVGAnimatedNumber diffuseConstant;
+
+};
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGFEDistantLightElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFEDistantLightElementImpl : virtual public SVGFEDistantLightElement,
+ public SVGElementImpl
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getAzimuth()
+ { return azimuth; }
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getElevation()
+ { return elevation; }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFEDistantLightElementImpl() {}
+
+protected:
+
+ SVGAnimatedNumber azimuth;
+ SVGAnimatedNumber elevation;
+
+};
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGFEPointLightElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFEPointLightElementImpl : public virtual SVGFEPointLightElement,
+ public SVGElementImpl
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getX()
+ { return x; }
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getY()
+ { return y; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getZ()
+ { return z; }
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFEPointLightElementImpl() {}
+
+protected:
+
+ SVGAnimatedNumber x, y, z;
+
+};
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGFESpotLightElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFESpotLightElementImpl : virtual public SVGFESpotLightElement,
+ public SVGElementImpl
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getX()
+ { return x; }
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getY()
+ { return y; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getZ()
+ { return z; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getPointsAtX()
+ { return pointsAtX; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getPointsAtY()
+ { return pointsAtY; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getPointsAtZ()
+ { return pointsAtZ; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getSpecularExponent()
+ { return specularExponent; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getLimitingConeAngle()
+ { return limitingConeAngle; }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFESpotLightElementImpl() {}
+
+protected:
+
+ SVGAnimatedNumber x, y, z;
+ SVGAnimatedNumber pointsAtX, pointsAtY, pointsAtZ;
+ SVGAnimatedNumber specularExponent;
+ SVGAnimatedNumber limitingConeAngle;
+};
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGFEDisplacementMapElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFEDisplacementMapElementImpl : virtual public SVGFEDisplacementMapElement,
+ public SVGElementImpl
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedString getIn1()
+ { return in1; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedString getIn2()
+ { return in2; }
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getScale()
+ { return scale; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getXChannelSelector()
+ { return xChannelSelector; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getYChannelSelector()
+ { return yChannelSelector; }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFEDisplacementMapElementImpl() {}
+
+protected:
+
+ SVGAnimatedString in1;
+ SVGAnimatedString in2;
+ SVGAnimatedNumber scale;
+ SVGAnimatedEnumeration xChannelSelector;
+ SVGAnimatedEnumeration yChannelSelector;
+
+};
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGFEFloodElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFEFloodElementImpl : virtual public SVGFEFloodElement,
+ public SVGElementImpl
+{
+public:
+ /**
+ *
+ */
+ virtual SVGAnimatedString getIn1()
+ { return in1; }
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFEFloodElementImpl() {}
+
+protected:
+
+ SVGAnimatedString in1;
+
+};
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGFEGaussianBlurElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFEGaussianBlurElementImpl : virtual public SVGFEGaussianBlurElement,
+ public SVGElementImpl
+{
+public:
+ /**
+ *
+ */
+ virtual SVGAnimatedString getIn1()
+ { return in1; }
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getStdDeviationX()
+ { return stdDeviationX; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getStdDeviationY()
+ { return stdDeviationY; }
+
+
+ /**
+ *
+ */
+ virtual void setStdDeviation (double stdDeviationXArg, double stdDeviationYArg )
+ {
+ stdDeviationX = stdDeviationXArg;
+ stdDeviationY = stdDeviationYArg;
+ }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFEGaussianBlurElementImpl() {}
+
+protected:
+
+ SVGAnimatedString in1;
+ SVGAnimatedNumber stdDeviationX, stdDeviationY;
+
+};
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGFEImageElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFEImageElementImpl : virtual public SVGFEImageElement,
+ public SVGElementImpl
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFEImageElementImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGFEMergeElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFEMergeElementImpl : virtual public SVGFEMergeElement,
+ public SVGElementImpl
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFEMergeElementImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGFEMergeNodeElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFEMergeNodeElementImpl : virtual public SVGFEMergeNodeElement,
+ public SVGElementImpl
+{
+public:
+ /**
+ *
+ */
+ virtual SVGAnimatedString getIn1()
+ { return in1; }
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFEMergeNodeElementImpl() {}
+
+protected:
+
+ SVGAnimatedString in1;
+
+};
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGFEMorphologyElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFEMorphologyElementImpl : virtual public SVGFEMorphologyElement,
+ public SVGElementImpl
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedString getIn1()
+ { return in1; }
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getOperator()
+ { return me_operator; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getRadiusX()
+ { return radiusX; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getRadiusY()
+ { return radiusY; }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFEMorphologyElementImpl() {}
+
+protected:
+
+ SVGAnimatedString in1;
+ SVGAnimatedEnumeration me_operator;
+ SVGAnimatedLength radiusX;
+ SVGAnimatedLength radiusY;
+
+};
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGFEOffsetElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFEOffsetElementImpl : virtual public SVGFEOffsetElement,
+ public SVGElementImpl
+{
+public:
+
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedString getIn1()
+ { return in1; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getDx()
+ { return dx; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getDy()
+ { return dy; }
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFEOffsetElementImpl() {}
+
+protected:
+
+ SVGAnimatedString in1;
+ SVGAnimatedLength dx, dy;
+
+};
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGFESpecularLightingElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFESpecularLightingElementImpl :
+ virtual public SVGFESpecularLightingElement,
+ public SVGElementImpl
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedString getIn1()
+ { return in1; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getSurfaceScale()
+ { return surfaceScale; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getSpecularConstant()
+ { return specularConstant; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getSpecularExponent()
+ { return specularExponent; }
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFESpecularLightingElementImpl() {}
+
+protected:
+
+ SVGAnimatedString in1;
+ SVGAnimatedNumber surfaceScale;
+ SVGAnimatedNumber specularConstant;
+ SVGAnimatedNumber specularExponent;
+};
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGFETileElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFETileElementImpl : virtual public SVGFETileElement,
+ public SVGElementImpl
+{
+public:
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedString getIn1()
+ { return in1; }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFETileElementImpl() {}
+
+protected:
+
+ SVGAnimatedString in1;
+
+};
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGFETurbulenceElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFETurbulenceElementImpl : virtual public SVGFETurbulenceElement,
+ public SVGElementImpl
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getBaseFrequencyX()
+ { return baseFrequencyX; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getBaseFrequencyY()
+ { return baseFrequencyY; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedInteger getNumOctaves()
+ { return numOctaves; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedNumber getSeed()
+ { return seed; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getStitchTiles()
+ { return stitchTiles; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedEnumeration getType()
+ { return type; }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFETurbulenceElementImpl() {}
+
+protected:
+
+ SVGAnimatedNumber baseFrequencyX;
+ SVGAnimatedNumber baseFrequencyY;
+ SVGAnimatedInteger numOctaves;
+ SVGAnimatedNumber seed;
+ SVGAnimatedEnumeration stitchTiles;
+ SVGAnimatedEnumeration type;
+
+};
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGCursorElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGCursorElementImpl : virtual public SVGCursorElement,
+ public SVGElementImpl
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getX()
+ { return x; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getY()
+ { return x; }
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGCursorElementImpl() {}
+
+protected:
+
+ SVGAnimatedLength x, y;
+};
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGAElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGAElementImpl : virtual public SVGAElement,
+ public SVGElementImpl
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedString getTarget()
+ { return target; }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGAElementImpl() {}
+
+protected:
+
+ SVGAnimatedString target;
+};
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGViewElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGViewElementImpl : virtual public SVGViewElement,
+ public SVGElementImpl
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGStringList getViewTarget()
+ { return viewTarget; }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGViewElementImpl() {}
+
+protected:
+
+ SVGStringList viewTarget;
+};
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGScriptElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGScriptElementImpl : virtual public SVGScriptElement,
+ public SVGElementImpl
+{
+public:
+
+ /**
+ *
+ */
+ virtual DOMString getType()
+ { return type; }
+
+ /**
+ *
+ */
+ virtual void setType(const DOMString &val) throw (DOMException)
+ { type = val; }
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGScriptElementImpl() {}
+
+protected:
+
+ DOMString type;
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGAnimationElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGAnimationElementImpl : virtual public SVGAnimationElement,
+ public SVGElementImpl
+{
+public:
+
+
+ /**
+ *
+ */
+ virtual SVGElement *getTargetElement()
+ { return targetElement; }
+
+
+ /**
+ *
+ */
+ virtual double getStartTime ( )
+ { return startTime; }
+
+ /**
+ *
+ */
+ virtual double getCurrentTime ( )
+ { return currentTime; }
+
+ /**
+ *
+ */
+ virtual double getSimpleDuration ( ) throw( DOMException )
+ { return simpleDuration; }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGAnimationElementImpl() {}
+
+protected:
+
+ SVGElement *targetElement;
+ double startTime, currentTime, simpleDuration;
+};
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGAnimateElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGAnimateElementImpl : virtual public SVGAnimateElement,
+ public SVGAnimationElementImpl
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGAnimateElementImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGSetElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGSetElementImpl : virtual public SVGSetElement,
+ public SVGAnimationElementImpl
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGSetElementImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGAnimateMotionElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGAnimateMotionElementImpl : virtual public SVGAnimateMotionElement,
+ public SVGAnimationElementImpl
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGAnimateMotionElementImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGMPathElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGMPathElementImpl : virtual public SVGMPathElement,
+ public SVGElementImpl
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGMPathElementImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGAnimateColorElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGAnimateColorElementImpl : virtual public SVGAnimateColorElement,
+ public SVGAnimationElementImpl
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGAnimateColorElementImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGAnimateTransformElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGAnimateTransformElementImpl : virtual public SVGAnimateTransformElement,
+ public SVGAnimationElementImpl
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGAnimateTransformElementImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGFontElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFontElementImpl : virtual public SVGFontElement,
+ public SVGElementImpl
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFontElementImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGGlyphElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGGlyphElementImpl : virtual public SVGGlyphElement,
+ public SVGElementImpl
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGGlyphElementImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGMissingGlyphElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGMissingGlyphElementImpl : virtual public SVGMissingGlyphElement,
+ public SVGElementImpl
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGMissingGlyphElementImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGHKernElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGHKernElementImpl : virtual public SVGHKernElement,
+ public SVGElementImpl
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGHKernElementImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGVKernElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGVKernElementImpl : virtual public SVGVKernElement,
+ public SVGElementImpl
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGVKernElementImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGFontFaceElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFontFaceElementImpl : virtual public SVGFontFaceElement,
+ public SVGElementImpl
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFontFaceElementImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGFontFaceSrcElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFontFaceSrcElementImpl : virtual public SVGFontFaceSrcElement,
+ public SVGElementImpl
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFontFaceSrcElementImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGFontFaceUriElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFontFaceUriElementImpl : virtual public SVGFontFaceUriElement,
+ public SVGElementImpl
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFontFaceUriElementImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGFontFaceFormatElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFontFaceFormatElementImpl : virtual public SVGFontFaceFormatElement,
+ public SVGElementImpl
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFontFaceFormatElementImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGFontFaceNameElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFontFaceNameElementImpl : virtual public SVGFontFaceNameElement,
+ public SVGElementImpl
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGFontFaceNameElementImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGDefinitionSrcElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGDefinitionSrcElementImpl : virtual public SVGDefinitionSrcElement,
+ public SVGElementImpl
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGDefinitionSrcElementImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGMetadataElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGMetadataElementImpl : virtual public SVGMetadataElement,
+ public SVGElementImpl
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ virtual ~SVGMetadataElementImpl() {}
+
+protected:
+
+
+};
+
+
+
+
+/*#########################################################################
+## SVGForeignObjectElementImpl
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGForeignObjectElementImpl : virtual public SVGForeignObjectElement,
+ public SVGElementImpl
+{
+public:
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getX()
+ { return x; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getY()
+ { return y; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getWidth()
+ { return width; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getHeight()
+ { return height; }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+
+ /**
+ *
+ */
+ virtual ~SVGForeignObjectElementImpl() {}
+
+protected:
+
+ SVGAnimatedLength x, y, width, height;
+};
+
+
+
+
+
+
+} //namespace svg
+} //namespace dom
+} //namespace w3c
+} //namespace org
+
+#endif // __SVG_H__
+/*#########################################################################
+## E N D O F F I L E
+#########################################################################*/
+
diff --git a/src/dom/svg/svgtypes.h b/src/dom/svg/svgtypes.h
index 9b70178ea..bb169885d 100644
--- a/src/dom/svg/svgtypes.h
+++ b/src/dom/svg/svgtypes.h
@@ -1,6889 +1,6889 @@
-#ifndef __SVGTYPES_H__
-#define __SVGTYPES_H__
-
-/**
- * Phoebe DOM Implementation.
- *
- * This is a C++ approximation of the W3C DOM model, which follows
- * fairly closely the specifications in the various .idl files, copies of
- * which are provided for reference. Most important is this one:
- *
- * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
- *
- * Authors:
- * Bob Jamison
- *
- * Copyright (C) 2006 Bob Jamison
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-// For access to DOM2 core
-#include "dom/dom.h"
-
-// For access to DOM2 events
-#include "dom/events.h"
-
-// For access to those parts from DOM2 CSS OM used by SVG DOM.
-#include "dom/css.h"
-
-// For access to those parts from DOM2 Views OM used by SVG DOM.
-#include "dom/views.h"
-
-// For access to the SMIL OM used by SVG DOM.
-#include "dom/smil.h"
-
-
-#include <math.h>
-
-
-
-namespace org {
-namespace w3c {
-namespace dom {
-namespace svg {
-
-
-
-
-//local definitions
-typedef dom::DOMString DOMString;
-typedef dom::DOMException DOMException;
-typedef dom::Element Element;
-typedef dom::Document Document;
-typedef dom::NodeList NodeList;
-
-
-class SVGElement;
-class SVGUseElement;
-class SVGAnimatedPreserveAspectRatio;
-
-
-/*#########################################################################
-## SVGException
-#########################################################################*/
-
-/**
- *
- */
-class SVGException
-{
-public:
- // unsigned short code; //inherited
-};
-
- /**
- * SVGExceptionCode
- */
- typedef enum
- {
- SVG_WRONG_TYPE_ERR = 0,
- SVG_INVALID_VALUE_ERR = 1,
- SVG_MATRIX_NOT_INVERTABLE = 2
- } SVGExceptionCode;
-
-
-
-
-
-/*#########################################################################
-## SVGMatrix
-#########################################################################*/
-
-/**
- * In SVG, a Matrix is defined like this:
- *
- * | a c e |
- * | b d f |
- * | 0 0 1 |
- *
- */
-class SVGMatrix
-{
-public:
-
-
- /**
- *
- */
- virtual double getA()
- { return a; }
-
- /**
- *
- */
- virtual void setA(double val) throw (DOMException)
- { a = val; }
-
- /**
- *
- */
- virtual double getB()
- { return b; }
-
- /**
- *
- */
- virtual void setB(double val) throw (DOMException)
- { b = val; }
-
- /**
- *
- */
- virtual double getC()
- { return c; }
-
- /**
- *
- */
- virtual void setC(double val) throw (DOMException)
- { c = val; }
-
- /**
- *
- */
- virtual double getD()
- { return d; }
-
- /**
- *
- */
- virtual void setD(double val) throw (DOMException)
- { d = val; }
- /**
- *
- */
- virtual double getE()
- { return e; }
-
- /**
- *
- */
- virtual void setE(double val) throw (DOMException)
- { e = val; }
- /**
- *
- */
- virtual double getF()
- { return f; }
-
- /**
- *
- */
- virtual void setF(double val) throw (DOMException)
- { f = val; }
-
-
- /**
- * Return the result of postmultiplying this matrix with another.
- */
- virtual SVGMatrix multiply(const SVGMatrix &other)
- {
- SVGMatrix result;
- result.a = a * other.a + c * other.b;
- result.b = b * other.a + d * other.b;
- result.c = a * other.c + c * other.d;
- result.d = b * other.c + d * other.d;
- result.e = a * other.e + c * other.f + e;
- result.f = b * other.e + d * other.f + f;
- return result;
- }
-
- /**
- * Calculate the inverse of this matrix
- *
- */
- virtual SVGMatrix inverse( ) throw( SVGException )
- {
- /*###########################################
- The determinant of a 3x3 matrix E
- (let's use our own notation for a bit)
-
- A B C
- D E F
- G H I
- is
- AEI - AFH - BDI + BFG + CDH - CEG
-
- Since in our affine transforms, G and H==0 and I==1,
- this reduces to:
- AE - BD
- In SVG's naming scheme, that is: a * d - c * b . SIMPLE!
-
- In a similar method of attack, SVG's adjunct matrix is:
-
- d -c cf-ed
- -b a eb-af
- 0 0 ad-cb
-
- To get the inverse matrix, we divide the adjunct matrix by
- the determinant. Notice that (ad-cb)/(ad-cb)==1. Very cool.
- So what we end up with is this:
-
- a = d/(ad-cb) c = -c/(ad-cb) e = (cf-ed)/(ad-cb)
- b = -b/(ad-cb) d = a/(ad-cb) f = (eb-af)/(ad-cb)
-
- (Since this would be in all SVG-DOM implementations,
- somebody needed to document this! ^^ )
- #############################################*/
-
- SVGMatrix result;
- double determinant = a * d - c * b;
- if (determinant < 1.0e-18)//invertible?
- {
- result.identity();//cop out
- return result;
- }
-
- double idet = 1.0 / determinant;
- result.a = d * idet;
- result.b = -b * idet;
- result.c = -c * idet;
- result.d = a * idet;
- result.e = (c*f - e*d) * idet;
- result.f = (e*b - a*f) * idet;
- return result;
- }
-
- /**
- * Equivalent to multiplying by:
- * | 1 0 x |
- * | 0 1 y |
- * | 0 0 1 |
- *
- */
- virtual SVGMatrix translate(double x, double y )
- {
- SVGMatrix result;
- result.a = a;
- result.b = b;
- result.c = c;
- result.d = d;
- result.e = a * x + c * y + e;
- result.f = b * x + d * y + f;
- return result;
- }
-
- /**
- * Equivalent to multiplying by:
- * | scale 0 0 |
- * | 0 scale 0 |
- * | 0 0 1 |
- *
- */
- virtual SVGMatrix scale(double scale)
- {
- SVGMatrix result;
- result.a = a * scale;
- result.b = b * scale;
- result.c = c * scale;
- result.d = d * scale;
- result.e = e;
- result.f = f;
- return result;
- }
-
- /**
- * Equivalent to multiplying by:
- * | scaleX 0 0 |
- * | 0 scaleY 0 |
- * | 0 0 1 |
- *
- */
- virtual SVGMatrix scaleNonUniform(double scaleX,
- double scaleY )
- {
- SVGMatrix result;
- result.a = a * scaleX;
- result.b = b * scaleX;
- result.c = c * scaleY;
- result.d = d * scaleY;
- result.e = e;
- result.f = f;
- return result;
- }
-
- /**
- * Equivalent to multiplying by:
- * | cos(a) -sin(a) 0 |
- * | sin(a) cos(a) 0 |
- * | 0 0 1 |
- *
- */
- virtual SVGMatrix rotate (double angle)
- {
- double sina = sin(angle);
- double msina = -sina;
- double cosa = cos(angle);
- SVGMatrix result;
- result.a = a * cosa + c * sina;
- result.b = b * cosa + d + sina;
- result.c = a * msina + c * cosa;
- result.d = b * msina + d * cosa;
- result.e = e;
- result.f = f;
- return result;
- }
-
- /**
- * Equivalent to multiplying by:
- * | cos(a) -sin(a) 0 |
- * | sin(a) cos(a) 0 |
- * | 0 0 1 |
- * In this case, angle 'a' is computed as the artangent
- * of the slope y/x . It is negative if the slope is negative.
- */
- virtual SVGMatrix rotateFromVector(double x, double y)
- throw( SVGException )
- {
- double angle = atan(y / x);
- if (y < 0.0)
- angle = -angle;
- SVGMatrix result;
- double sina = sin(angle);
- double msina = -sina;
- double cosa = cos(angle);
- result.a = a * cosa + c * sina;
- result.b = b * cosa + d + sina;
- result.c = a * msina + c * cosa;
- result.d = b * msina + d * cosa;
- result.e = e;
- result.f = f;
- return result;
- }
-
- /**
- * Equivalent to multiplying by:
- * | -1 0 0 |
- * | 0 1 0 |
- * | 0 0 1 |
- *
- */
- virtual SVGMatrix flipX( )
- {
- SVGMatrix result;
- result.a = -a;
- result.b = -b;
- result.c = c;
- result.d = d;
- result.e = e;
- result.f = f;
- return result;
- }
-
- /**
- * Equivalent to multiplying by:
- * | 1 0 0 |
- * | 0 -1 0 |
- * | 0 0 1 |
- *
- */
- virtual SVGMatrix flipY( )
- {
- SVGMatrix result;
- result.a = a;
- result.b = b;
- result.c = -c;
- result.d = -d;
- result.e = e;
- result.f = f;
- return result;
- }
-
- /**
- * | 1 tan(a) 0 |
- * | 0 1 0 |
- * | 0 0 1 |
- *
- */
- virtual SVGMatrix skewX(double angle)
- {
- double tana = tan(angle);
- SVGMatrix result;
- result.a = a;
- result.b = b;
- result.c = a * tana + c;
- result.d = b * tana + d;
- result.e = e;
- result.f = f;
- return result;
- }
-
- /**
- * Equivalent to multiplying by:
- * | 1 0 0 |
- * | tan(a) 1 0 |
- * | 0 0 1 |
- *
- */
- virtual SVGMatrix skewY(double angle)
- {
- double tana = tan(angle);
- SVGMatrix result;
- result.a = a + c * tana;
- result.b = b + d * tana;
- result.c = c;
- result.d = d;
- result.e = e;
- result.f = f;
- return result;
- }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGMatrix()
- {
- identity();
- }
-
- /**
- *
- */
- SVGMatrix(double aArg, double bArg, double cArg,
- double dArg, double eArg, double fArg )
- {
- a = aArg; b = bArg; c = cArg;
- d = dArg; e = eArg; f = fArg;
- }
-
- /**
- * Copy constructor
- */
- SVGMatrix(const SVGMatrix &other)
- {
- a = other.a;
- b = other.b;
- c = other.c;
- d = other.d;
- e = other.e;
- f = other.f;
- }
-
-
-
- /**
- *
- */
- virtual ~SVGMatrix() {}
-
-protected:
-
-friend class SVGTransform;
-
- /*
- * Set to the identify matrix
- */
- void identity()
- {
- a = 1.0;
- b = 0.0;
- c = 0.0;
- d = 1.0;
- e = 0.0;
- f = 0.0;
- }
-
- double a, b, c, d, e, f;
-
-};
-
-
-/*#########################################################################
-## SVGTransform
-#########################################################################*/
-
-/**
- *
- */
-class SVGTransform
-{
-public:
-
- /**
- * Transform Types
- */
- typedef enum
- {
- SVG_TRANSFORM_UNKNOWN = 0,
- SVG_TRANSFORM_MATRIX = 1,
- SVG_TRANSFORM_TRANSLATE = 2,
- SVG_TRANSFORM_SCALE = 3,
- SVG_TRANSFORM_ROTATE = 4,
- SVG_TRANSFORM_SKEWX = 5,
- SVG_TRANSFORM_SKEWY = 6,
- } TransformType;
-
- /**
- *
- */
- virtual unsigned short getType()
- { return type; }
-
-
- /**
- *
- */
- virtual SVGMatrix getMatrix()
- {
- return matrix;
- }
-
- /**
- *
- */
- virtual double getAngle()
- {
- return angle;
- }
-
-
- /**
- *
- */
- virtual void setMatrix(const SVGMatrix &matrixArg)
- {
- type = SVG_TRANSFORM_MATRIX;
- matrix = matrixArg;
- }
-
- /**
- *
- */
- virtual void setTranslate (double tx, double ty )
- {
- type = SVG_TRANSFORM_TRANSLATE;
- matrix.setA(1.0);
- matrix.setB(0.0);
- matrix.setC(0.0);
- matrix.setD(1.0);
- matrix.setE(tx);
- matrix.setF(ty);
- }
-
- /**
- *
- */
- virtual void setScale (double sx, double sy )
- {
- type = SVG_TRANSFORM_SCALE;
- matrix.setA(sx);
- matrix.setB(0.0);
- matrix.setC(0.0);
- matrix.setD(sy);
- matrix.setE(0.0);
- matrix.setF(0.0);
- }
-
- /**
- *
- */
- virtual void setRotate (double angleArg, double cx, double cy)
- {
- angle = angleArg;
- setTranslate(cx, cy);
- type = SVG_TRANSFORM_ROTATE;
- matrix.rotate(angle);
- }
-
- /**
- *
- */
- virtual void setSkewX (double angleArg)
- {
- angle = angleArg;
- type = SVG_TRANSFORM_SKEWX;
- matrix.identity();
- matrix.skewX(angle);
- }
-
- /**
- *
- */
- virtual void setSkewY (double angleArg)
- {
- angle = angleArg;
- type = SVG_TRANSFORM_SKEWY;
- matrix.identity();
- matrix.skewY(angle);
- }
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGTransform()
- {
- type = SVG_TRANSFORM_UNKNOWN;
- angle = 0.0;
- }
-
- /**
- *
- */
- SVGTransform(const SVGTransform &other)
- {
- type = other.type;
- angle = other.angle;
- matrix = other.matrix;
- }
-
- /**
- *
- */
- virtual ~SVGTransform()
- {}
-
-protected:
-
- int type;
- double angle;
-
- SVGMatrix matrix;
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGTransformList
-#########################################################################*/
-
-/**
- *
- */
-class SVGTransformList
-{
-public:
-
-
- /**
- *
- */
- virtual unsigned long getNumberOfItems()
- { return items.size(); }
-
-
- /**
- *
- */
- virtual void clear( ) throw( DOMException )
- { items.clear(); }
-
- /**
- *
- */
- virtual SVGTransform initialize (const SVGTransform &newItem)
- throw( DOMException, SVGException )
- {
- items.clear();
- items.push_back(newItem);
- return newItem;
- }
-
- /**
- *
- */
- virtual SVGTransform getItem (unsigned long index )
- throw( DOMException )
- {
- if (index>=items.size())
- {
- SVGTransform transform;
- return transform;
- }
- return items[index];
- }
-
- /**
- *
- */
- virtual SVGTransform insertItemBefore (const SVGTransform &newItem,
- unsigned long index )
- throw( DOMException, SVGException )
- {
- if (index > items.size())
- items.push_back(newItem);
- else
- {
- std::vector<SVGTransform>::iterator iter = items.begin() + index;
- items.insert(iter, newItem);
- }
- return newItem;
- }
-
- /**
- *
- */
- virtual SVGTransform replaceItem (const SVGTransform &newItem,
- unsigned long index )
- throw( DOMException, SVGException )
- {
- if (index>=items.size())
- {
- SVGTransform transform;
- return transform;
- }
- else
- {
- std::vector<SVGTransform>::iterator iter = items.begin() + index;
- *iter = newItem;
- }
- return newItem;
- }
-
- /**
- *
- */
- virtual SVGTransform removeItem (unsigned long index )
- throw( DOMException )
- {
- if (index>=items.size())
- {
- SVGTransform transform;
- return transform;
- }
- std::vector<SVGTransform>::iterator iter = items.begin() + index;
- SVGTransform oldItem = *iter;
- items.erase(iter);
- return oldItem;
- }
-
- /**
- *
- */
- virtual SVGTransform appendItem (const SVGTransform &newItem)
- throw( DOMException, SVGException )
- {
- items.push_back(newItem);
- return newItem;
- }
-
- /**
- *
- */
- virtual SVGTransform createSVGTransformFromMatrix(const SVGMatrix &matrix)
- {
- SVGTransform transform;
- transform.setMatrix(matrix);
- return transform;
- }
-
- /**
- *
- */
- virtual SVGTransform consolidate()
- {
- SVGMatrix matrix;
- for (unsigned int i=0 ; i<items.size() ; i++)
- matrix = matrix.multiply(items[i].getMatrix());
- SVGTransform transform;
- transform.setMatrix(matrix);
- items.clear();
- items.push_back(transform);
- return transform;
- }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGTransformList()
- {}
-
- /**
- *
- */
- SVGTransformList(const SVGTransformList &other)
- {
- items = other.items;
- }
-
- /**
- *
- */
- virtual ~SVGTransformList() {}
-
-protected:
-
- std::vector<SVGTransform> items;
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGAnimatedTransformList
-#########################################################################*/
-
-/**
- *
- */
-class SVGAnimatedTransformList
-{
-public:
-
- /**
- *
- */
- virtual SVGTransformList getBaseVal()
- { return baseVal; }
-
- /**
- *
- */
- virtual SVGTransformList getAnimVal()
- { return animVal; }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGAnimatedTransformList()
- {}
-
- /**
- *
- */
- SVGAnimatedTransformList(const SVGAnimatedTransformList &other)
- {
- baseVal = other.baseVal;
- animVal = other.animVal;
- }
-
- /**
- *
- */
- virtual ~SVGAnimatedTransformList() {}
-
-protected:
-
- SVGTransformList baseVal;
- SVGTransformList animVal;
-
-};
-
-
-
-
-/*#########################################################################
-## SVGAnimatedBoolean
-#########################################################################*/
-
-/**
- *
- */
-class SVGAnimatedBoolean
-{
-public:
-
- /**
- *
- */
- virtual bool getBaseVal()
- {
- return baseVal;
- }
-
- /**
- *
- */
- virtual void setBaseVal(bool val) throw (DOMException)
- {
- baseVal = val;
- }
-
- /**
- *
- */
- virtual bool getAnimVal()
- {
- return animVal;
- }
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGAnimatedBoolean()
- {
- baseVal = animVal = false;
- }
-
- /**
- *
- */
- SVGAnimatedBoolean(const SVGAnimatedBoolean &other)
- {
- baseVal = other.baseVal;
- animVal = other.animVal;
- }
-
- /**
- *
- */
- virtual ~SVGAnimatedBoolean() {}
-
-protected:
-
- bool baseVal, animVal;
-
-};
-
-
-
-
-/*#########################################################################
-## SVGAnimatedString
-#########################################################################*/
-
-/**
- *
- */
-class SVGAnimatedString
-{
-public:
-
- /**
- *
- */
- virtual DOMString getBaseVal()
- {
- return baseVal;
- }
-
- /**
- *
- */
- virtual void setBaseVal(const DOMString &val)
- throw (DOMException)
- {
- baseVal = val;
- }
-
- /**
- *
- */
- virtual DOMString getAnimVal()
- {
- return animVal;
- }
-
-
- //##################
- //# Non-API methods
- //##################
-
-
- /**
- *
- */
- SVGAnimatedString()
- {
- baseVal = "";
- animVal = "";
- }
-
- /**
- *
- */
- SVGAnimatedString(const SVGAnimatedString &other)
- {
- baseVal = other.baseVal;
- animVal = other.animVal;
- }
-
- /**
- *
- */
- virtual ~SVGAnimatedString() {}
-
-protected:
-
- DOMString baseVal, animVal;
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGStringList
-#########################################################################*/
-
-/**
- *
- */
-class SVGStringList
-{
-public:
-
-
- /**
- *
- */
- virtual unsigned long getNumberOfItems()
- {
- return items.size();
- }
-
- /**
- *
- */
- virtual void clear () throw( DOMException )
- {
- items.clear();
- }
-
- /**
- *
- */
- virtual DOMString initialize ( const DOMString& newItem )
- throw( DOMException, SVGException )
- {
- items.clear();
- items.push_back(newItem);
- return newItem;
- }
-
- /**
- *
- */
- virtual DOMString getItem ( unsigned long index )
- throw( DOMException )
- {
- if (index >= items.size())
- return "";
- return items[index];
- }
-
- /**
- *
- */
- virtual DOMString insertItemBefore ( const DOMString& newItem,
- unsigned long index )
- throw( DOMException, SVGException )
- {
- if (index>=items.size())
- {
- items.push_back(newItem);
- }
- else
- {
- std::vector<DOMString>::iterator iter = items.begin() + index;
- items.insert(iter, newItem);
- }
- return newItem;
- }
-
- /**
- *
- */
- virtual DOMString replaceItem ( const DOMString& newItem,
- unsigned long index )
- throw( DOMException, SVGException )
- {
- if (index>=items.size())
- return "";
- std::vector<DOMString>::iterator iter = items.begin() + index;
- *iter = newItem;
- return newItem;
- }
-
- /**
- *
- */
- virtual DOMString removeItem ( unsigned long index )
- throw( DOMException )
- {
- if (index>=items.size())
- return "";
- std::vector<DOMString>::iterator iter = items.begin() + index;
- DOMString oldstr = *iter;
- items.erase(iter);
- return oldstr;
- }
-
- /**
- *
- */
- virtual DOMString appendItem ( const DOMString& newItem )
- throw( DOMException, SVGException )
- {
- items.push_back(newItem);
- return newItem;
- }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGStringList() {}
-
- /**
- *
- */
- SVGStringList(const SVGStringList &other)
- {
- items = other.items;
- }
-
- /**
- *
- */
- virtual ~SVGStringList() {}
-
-protected:
-
- std::vector<DOMString>items;
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGAnimatedEnumeration
-#########################################################################*/
-
-/**
- *
- */
-class SVGAnimatedEnumeration
-{
-public:
-
- /**
- *
- */
- virtual unsigned short getBaseVal()
- {
- return baseVal;
- }
-
- /**
- *
- */
- virtual void setBaseVal(unsigned short val)
- throw (DOMException)
- {
- baseVal = val;
- }
-
- /**
- *
- */
- virtual unsigned short getAnimVal()
- {
- return animVal;
- }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
-
- /**
- *
- */
- SVGAnimatedEnumeration()
- {
- baseVal = animVal = 0;
- }
-
- /**
- *
- */
- SVGAnimatedEnumeration(const SVGAnimatedEnumeration &other)
- {
- baseVal = other.baseVal;
- animVal = other.animVal;
- }
-
- /**
- *
- */
- virtual ~SVGAnimatedEnumeration() {}
-
-protected:
-
- int baseVal, animVal;
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGAnimatedInteger
-#########################################################################*/
-
-/**
- *
- */
-class SVGAnimatedInteger
-{
-public:
-
-
- /**
- *
- */
- virtual long getBaseVal()
- {
- return baseVal;
- }
-
- /**
- *
- */
- virtual void setBaseVal(long val) throw (DOMException)
- {
- baseVal = val;
- }
-
- /**
- *
- */
- virtual long getAnimVal()
- {
- return animVal;
- }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
-
- /**
- *
- */
- SVGAnimatedInteger()
- { baseVal = animVal = 0L;}
-
-
- /**
- *
- */
- SVGAnimatedInteger(long value)
- {
- baseVal = value;
- animVal = 0L;
- }
-
- /**
- *
- */
- SVGAnimatedInteger(long baseValArg, long animValArg)
- {
- baseVal = baseValArg;
- animVal = animValArg;
- }
-
-
- /**
- *
- */
- SVGAnimatedInteger(const SVGAnimatedInteger &other)
- {
- baseVal = other.baseVal;
- animVal = other.animVal;
- }
-
- /**
- *
- */
- virtual ~SVGAnimatedInteger() {}
-
-protected:
-
- long baseVal, animVal;
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGNumber
-#########################################################################*/
-
-/**
- *
- */
-class SVGNumber
-{
-public:
-
-
- /**
- *
- */
- virtual double getValue()
- {
- return value;
- }
-
- /**
- *
- */
- virtual void setValue(double val) throw (DOMException)
- {
- value = val;
- }
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGNumber()
- {
- value = 0.0;
- }
-
- /**
- *
- */
- SVGNumber(const SVGNumber &other)
- {
- value = other.value;
- }
-
- /**
- *
- */
- virtual ~SVGNumber() {}
-
-protected:
-
- double value;
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGAnimatedNumber
-#########################################################################*/
-
-/**
- *
- */
-class SVGAnimatedNumber
-{
-public:
-
-
-
- /**
- *
- */
- virtual double getBaseVal()
- {
- return baseVal;
- }
-
- /**
- *
- */
- virtual void setBaseVal(double val) throw (DOMException)
- {
- baseVal = val;
- }
-
- /**
- *
- */
- virtual double getAnimVal()
- {
- return animVal;
- }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGAnimatedNumber()
- {
- baseVal = animVal = 0.0;
- }
-
-
- /**
- *
- */
- SVGAnimatedNumber(double val)
- {
- baseVal = val;
- animVal = 0.0;
- }
-
-
- /**
- *
- */
- SVGAnimatedNumber(double baseValArg, double animValArg)
- {
- baseVal = baseValArg;
- animVal = animValArg;
- }
-
- /**
- *
- */
- SVGAnimatedNumber(const SVGAnimatedNumber &other)
- {
- baseVal = other.baseVal;
- animVal = other.animVal;
- }
-
- /**
- *
- */
- virtual ~SVGAnimatedNumber() {}
-
-protected:
-
- double baseVal, animVal;
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGNumberList
-#########################################################################*/
-
-/**
- *
- */
-class SVGNumberList
-{
-public:
-
- /**
- *
- */
- virtual unsigned long getNumberOfItems()
- {
- return items.size();
- }
-
-
- /**
- *
- */
- virtual void clear() throw( DOMException )
- {
- items.clear();
- }
-
- /**
- *
- */
- virtual SVGNumber initialize (const SVGNumber &newItem)
- throw( DOMException, SVGException )
- {
- items.clear();
- items.push_back(newItem);
- return newItem;
- }
-
- /**
- *
- */
- virtual SVGNumber getItem ( unsigned long index )
- throw( DOMException )
- {
- if (index>=items.size())
- {
- SVGNumber num;
- return num;
- }
- return items[index];
- }
-
- /**
- *
- */
- virtual SVGNumber insertItemBefore ( const SVGNumber &newItem,
- unsigned long index )
- throw( DOMException, SVGException )
- {
- if (index>=items.size())
- {
- items.push_back(newItem);
- }
- else
- {
- std::vector<SVGNumber>::iterator iter = items.begin() + index;
- items.insert(iter, newItem);
- }
- return newItem;
- }
-
- /**
- *
- */
- virtual SVGNumber replaceItem ( const SVGNumber &newItem,
- unsigned long index )
- throw( DOMException, SVGException )
- {
- if (index>=items.size())
- {
- SVGNumber num;
- return num;
- }
- std::vector<SVGNumber>::iterator iter = items.begin() + index;
- *iter = newItem;
- return newItem;
- }
-
- /**
- *
- */
- virtual SVGNumber removeItem ( unsigned long index )
- throw( DOMException )
- {
- if (index>=items.size())
- {
- SVGNumber num;
- return num;
- }
- std::vector<SVGNumber>::iterator iter = items.begin() + index;
- SVGNumber oldval = *iter;
- items.erase(iter);
- return oldval;
- }
-
- /**
- *
- */
- virtual SVGNumber appendItem ( const SVGNumber &newItem )
- throw( DOMException, SVGException )
- {
- items.push_back(newItem);
- return newItem;
- }
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGNumberList() {}
-
- /**
- *
- */
- SVGNumberList(const SVGNumberList &other)
- {
- items = other.items;
- }
-
- /**
- *
- */
- virtual ~SVGNumberList() {}
-
-protected:
-
- std::vector<SVGNumber>items;
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGAnimatedNumberList
-#########################################################################*/
-
-/**
- *
- */
-class SVGAnimatedNumberList
-{
-public:
-
-
- /**
- *
- */
- virtual SVGNumberList &getBaseVal()
- {
- return baseVal;
- }
-
- /**
- *
- */
- virtual SVGNumberList &getAnimVal()
- {
- return animVal;
- }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGAnimatedNumberList() {}
-
- /**
- *
- */
- SVGAnimatedNumberList(const SVGAnimatedNumberList &other)
- {
- baseVal = other.baseVal;
- animVal = other.animVal;
- }
-
- /**
- *
- */
- virtual ~SVGAnimatedNumberList() {}
-
-protected:
-
- SVGNumberList baseVal;
- SVGNumberList animVal;
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGLength
-#########################################################################*/
-
-/**
- *
- */
-class SVGLength
-{
-public:
-
- /**
- * Length Unit Types
- */
- typedef enum
- {
- SVG_LENGTHTYPE_UNKNOWN = 0,
- SVG_LENGTHTYPE_NUMBER = 1,
- SVG_LENGTHTYPE_PERCENTAGE = 2,
- SVG_LENGTHTYPE_EMS = 3,
- SVG_LENGTHTYPE_EXS = 4,
- SVG_LENGTHTYPE_PX = 5,
- SVG_LENGTHTYPE_CM = 6,
- SVG_LENGTHTYPE_MM = 7,
- SVG_LENGTHTYPE_IN = 8,
- SVG_LENGTHTYPE_PT = 9,
- SVG_LENGTHTYPE_PC = 10
- } LengthUnitType;
-
-
- /**
- *
- */
- virtual unsigned short getUnitType( )
- {
- return unitType;
- }
-
- /**
- *
- */
- virtual double getValue( )
- {
- return value;
- }
-
- /**
- *
- */
- virtual void setValue( double val ) throw (DOMException)
- {
- value = val;
- }
-
- /**
- *
- */
- virtual double getValueInSpecifiedUnits( )
- {
- double result = 0.0;
- //fill this in
- return result;
- }
-
- /**
- *
- */
- virtual void setValueInSpecifiedUnits( double val )
- throw (DOMException)
- {
- //fill this in
- }
-
- /**
- *
- */
- virtual DOMString getValueAsString( )
- {
- DOMString ret;
- char buf[32];
- snprintf(buf, 31, "%f", value);
- ret.append(buf);
- return ret;
- }
-
- /**
- *
- */
- virtual void setValueAsString( const DOMString& val )
- throw (DOMException)
- {
- }
-
-
- /**
- *
- */
- virtual void newValueSpecifiedUnits ( unsigned short unitType, double val )
- {
- }
-
- /**
- *
- */
- virtual void convertToSpecifiedUnits ( unsigned short unitType )
- {
- }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGLength()
- {
- unitType = SVG_LENGTHTYPE_UNKNOWN;
- value = 0.0;
- }
-
-
- /**
- *
- */
- SVGLength(const SVGLength &other)
- {
- unitType = other.unitType;
- value = other.value;
- }
-
- /**
- *
- */
- virtual ~SVGLength() {}
-
-protected:
-
- int unitType;
-
- double value;
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGAnimatedLength
-#########################################################################*/
-
-/**
- *
- */
-class SVGAnimatedLength
-{
-public:
-
- /**
- *
- */
- virtual SVGLength &getBaseVal()
- {
- return baseVal;
- }
-
- /**
- *
- */
- virtual SVGLength &getAnimVal()
- {
- return animVal;
- }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGAnimatedLength() {}
-
- /**
- *
- */
- SVGAnimatedLength(const SVGAnimatedLength &other)
- {
- baseVal = other.baseVal;
- animVal = other.animVal;
- }
-
- /**
- *
- */
- virtual ~SVGAnimatedLength() {}
-
-protected:
-
- SVGLength baseVal, animVal;
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGLengthList
-#########################################################################*/
-
-/**
- *
- */
-class SVGLengthList
-{
-public:
-
- /**
- *
- */
- virtual unsigned long getNumberOfItems()
- {
- return items.size();
- }
-
-
- /**
- *
- */
- virtual void clear ( ) throw( DOMException )
- {
- items.clear();
- }
-
- /**
- *
- */
- virtual SVGLength initialize (const SVGLength &newItem )
- throw( DOMException, SVGException )
- {
- items.clear();
- items.push_back(newItem);
- return newItem;
- }
-
- /**
- *
- */
- virtual SVGLength getItem (unsigned long index)
- throw( DOMException )
- {
- if (index>=items.size())
- {
- SVGLength ret;
- return ret;
- }
- return items[index];
- }
-
- /**
- *
- */
- virtual SVGLength insertItemBefore (const SVGLength &newItem,
- unsigned long index )
- throw( DOMException, SVGException )
- {
- if (index>=items.size())
- {
- items.push_back(newItem);
- }
- else
- {
- std::vector<SVGLength>::iterator iter = items.begin() + index;
- items.insert(iter, newItem);
- }
- return newItem;
- }
-
- /**
- *
- */
- virtual SVGLength replaceItem (const SVGLength &newItem,
- unsigned long index )
- throw( DOMException, SVGException )
- {
- if (index>=items.size())
- {
- SVGLength ret;
- return ret;
- }
- std::vector<SVGLength>::iterator iter = items.begin() + index;
- *iter = newItem;
- return newItem;
- }
-
- /**
- *
- */
- virtual SVGLength removeItem (unsigned long index )
- throw( DOMException )
- {
- if (index>=items.size())
- {
- SVGLength ret;
- return ret;
- }
- std::vector<SVGLength>::iterator iter = items.begin() + index;
- SVGLength oldval = *iter;
- items.erase(iter);
- return oldval;
- }
-
- /**
- *
- */
- virtual SVGLength appendItem (const SVGLength &newItem )
- throw( DOMException, SVGException )
- {
- items.push_back(newItem);
- return newItem;
- }
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGLengthList() {}
-
- /**
- *
- */
- SVGLengthList(const SVGLengthList &other)
- {
- items = other.items;
- }
-
- /**
- *
- */
- virtual ~SVGLengthList() {}
-
-protected:
-
- std::vector<SVGLength>items;
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGAnimatedLengthList
-#########################################################################*/
-
-/**
- *
- */
-class SVGAnimatedLengthList
-{
-public:
-
- /**
- *
- */
- virtual SVGLengthList &getBaseVal()
- {
- return baseVal;
- }
-
- /**
- *
- */
- virtual SVGLengthList &getAnimVal()
- {
- return animVal;
- }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGAnimatedLengthList() {}
-
- /**
- *
- */
- SVGAnimatedLengthList(const SVGAnimatedLengthList &other)
- {
- baseVal = other.baseVal;
- animVal = other.animVal;
- }
-
- /**
- *
- */
- virtual ~SVGAnimatedLengthList() {}
-
-protected:
-
- SVGLengthList baseVal, animVal;
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGAngle
-#########################################################################*/
-
-/**
- *
- */
-class SVGAngle
-{
-public:
-
- /**
- * Angle Unit Types
- */
- typedef enum
- {
- SVG_ANGLETYPE_UNKNOWN = 0,
- SVG_ANGLETYPE_UNSPECIFIED = 1,
- SVG_ANGLETYPE_DEG = 2,
- SVG_ANGLETYPE_RAD = 3,
- SVG_ANGLETYPE_GRAD = 4
- } AngleUnitType;
-
-
-
- /**
- *
- */
- virtual unsigned short getUnitType()
- {
- return unitType;
- }
-
- /**
- *
- */
- virtual double getValue()
- {
- return value;
- }
-
- /**
- *
- */
- virtual void setValue(double val) throw (DOMException)
- {
- value = val;
- }
-
- /**
- *
- */
- virtual double getValueInSpecifiedUnits()
- {
- double result = 0.0;
- //convert here
- return result;
- }
-
- /**
- *
- */
- virtual void setValueInSpecifiedUnits(double val)
- throw (DOMException)
- {
- //do conversion
- }
-
- /**
- *
- */
- virtual DOMString getValueAsString()
- {
- DOMString result;
- char buf[32];
- snprintf(buf, 31, "%f", value);
- result.append(buf);
- return result;
- }
-
- /**
- *
- */
- virtual void setValueAsString(const DOMString &val)
- throw (DOMException)
- {
- //convert here
- }
-
-
- /**
- *
- */
- virtual void newValueSpecifiedUnits (unsigned short unitType,
- double valueInSpecifiedUnits )
- {
- //convert here
- }
-
- /**
- *
- */
- virtual void convertToSpecifiedUnits (unsigned short unitType )
- {
- //convert here
- }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGAngle()
- {
- unitType = SVG_ANGLETYPE_UNKNOWN;
- value = 0.0;
- }
-
- /**
- *
- */
- SVGAngle(const SVGAngle &other)
- {
- unitType = other.unitType;
- value = other.value;
- }
-
- /**
- *
- */
- virtual ~SVGAngle() {}
-
-protected:
-
- int unitType;
-
- double value;
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGAnimatedAngle
-#########################################################################*/
-
-/**
- *
- */
-class SVGAnimatedAngle
-{
-public:
-
- /**
- *
- */
- virtual SVGAngle getBaseVal()
- {
- return baseVal;
- }
-
- /**
- *
- */
- virtual SVGAngle getAnimVal()
- {
- return animVal;
- }
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGAnimatedAngle() {}
-
- /**
- *
- */
- SVGAnimatedAngle(const SVGAngle &angle)
- { baseVal = angle; }
-
- /**
- *
- */
- SVGAnimatedAngle(const SVGAnimatedAngle &other)
- {
- baseVal = other.baseVal;
- animVal = other.animVal;
- }
-
- /**
- *
- */
- virtual ~SVGAnimatedAngle() {}
-
-protected:
-
- SVGAngle baseVal, animVal;
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGICCColor
-#########################################################################*/
-
-/**
- *
- */
-class SVGICCColor
-{
-public:
-
- /**
- *
- */
- virtual DOMString getColorProfile()
- {
- return colorProfile;
- }
-
- /**
- *
- */
- virtual void setColorProfile(const DOMString &val) throw (DOMException)
- {
- colorProfile = val;
- }
-
- /**
- *
- */
- virtual SVGNumberList &getColors()
- {
- return colors;
- }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGICCColor() {}
-
- /**
- *
- */
- SVGICCColor(const SVGICCColor &other)
- {
- colorProfile = other.colorProfile;
- colors = other.colors;
- }
-
- /**
- *
- */
- virtual ~SVGICCColor() {}
-
-protected:
-
- DOMString colorProfile;
-
- SVGNumberList colors;
-
-};
-
-
-/*#########################################################################
-## SVGColor
-#########################################################################*/
-
-/**
- *
- */
-class SVGColor : virtual public css::CSSValue
-{
-public:
-
-
- /**
- * Color Types
- */
- typedef enum
- {
- SVG_COLORTYPE_UNKNOWN = 0,
- SVG_COLORTYPE_RGBCOLOR = 1,
- SVG_COLORTYPE_RGBCOLOR_ICCCOLOR = 2,
- SVG_COLORTYPE_CURRENTCOLOR = 3
- } ColorType;
-
-
- /**
- *
- */
- virtual unsigned short getColorType()
- {
- return colorType;
- }
-
- /**
- *
- */
- virtual css::RGBColor getRgbColor()
- {
- css::RGBColor col;
- return col;
- }
-
- /**
- *
- */
- virtual SVGICCColor getIccColor()
- {
- SVGICCColor col;
- return col;
- }
-
-
- /**
- *
- */
- virtual void setRGBColor (const DOMString& rgbColor )
- throw( SVGException )
- {
- }
-
- /**
- *
- */
- virtual void setRGBColorICCColor (const DOMString& rgbColor,
- const DOMString& iccColor )
- throw( SVGException )
- {
- }
-
- /**
- *
- */
- virtual void setColor (unsigned short colorType,
- const DOMString& rgbColor,
- const DOMString& iccColor )
- throw( SVGException )
- {
- }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGColor()
- {
- colorType = SVG_COLORTYPE_UNKNOWN;
- }
-
- /**
- *
- */
- SVGColor(const SVGColor &other) : css::CSSValue(other)
- {
- colorType = other.colorType;
- }
-
- /**
- *
- */
- virtual ~SVGColor() {}
-
-protected:
-
- int colorType;
-
-};
-
-
-
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGRect
-#########################################################################*/
-
-/**
- *
- */
-class SVGRect
-{
-public:
-
- /**
- *
- */
- virtual double getX()
- {
- return x;
- }
-
- /**
- *
- */
- virtual void setX(double val) throw (DOMException)
- {
- x = val;
- }
-
- /**
- *
- */
- virtual double getY()
- {
- return y;
- }
-
- /**
- *
- */
- virtual void setY(double val) throw (DOMException)
- {
- y = val;
- }
-
- /**
- *
- */
- virtual double getWidth()
- {
- return width;
- }
-
- /**
- *
- */
- virtual void setWidth(double val) throw (DOMException)
- {
- width = val;
- }
-
- /**
- *
- */
- virtual double getHeight()
- {
- return height;
- }
-
- /**
- *
- */
- virtual void setHeight(double val) throw (DOMException)
- {
- height = val;
- }
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGRect()
- {
- x = y = width = height = 0.0;
- }
-
- /**
- *
- */
- SVGRect(const SVGRect &other)
- {
- x = other.x;
- y = other.y;
- width = other.width;
- height = other.height;
- }
-
- /**
- *
- */
- virtual ~SVGRect() {}
-
-protected:
-
- double x, y, width, height;
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGAnimatedRect
-#########################################################################*/
-
-/**
- *
- */
-class SVGAnimatedRect
-{
-public:
-
- /**
- *
- */
- virtual SVGRect &getBaseVal()
- {
- return baseVal;
- }
-
- /**
- *
- */
- virtual SVGRect &getAnimVal()
- {
- return animVal;
- }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGAnimatedRect()
- {
- }
-
- /**
- *
- */
- SVGAnimatedRect(const SVGAnimatedRect &other)
- {
- baseVal = other.baseVal;
- animVal = other.animVal;
- }
-
- /**
- *
- */
- virtual ~SVGAnimatedRect() {}
-
-protected:
-
- SVGRect baseVal, animVal;
-
-};
-
-
-
-/*#########################################################################
-## SVGPoint
-#########################################################################*/
-
-/**
- *
- */
-class SVGPoint
-{
-public:
-
-
-
- /**
- *
- */
- virtual double getX()
- { return x; }
-
- /**
- *
- */
- virtual void setX(double val) throw (DOMException)
- { x = val; }
-
- /**
- *
- */
- virtual double getY()
- { return y; }
-
- /**
- *
- */
- virtual void setY(double val) throw (DOMException)
- { y = val; }
-
- /**
- *
- */
- virtual SVGPoint matrixTransform(const SVGMatrix &matrix)
- {
- SVGPoint point;
- return point;
- }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGPoint()
- { x = y = 0; }
-
- /**
- *
- */
- SVGPoint(const SVGPoint &other)
- {
- x = other.x;
- y = other.y;
- }
-
- /**
- *
- */
- virtual ~SVGPoint() {}
-
-protected:
-
- double x, y;
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGPointList
-#########################################################################*/
-
-/**
- *
- */
-class SVGPointList
-{
-public:
-
- /**
- *
- */
- virtual unsigned long getNumberOfItems()
- { return items.size(); }
-
- /**
- *
- */
- virtual void clear() throw( DOMException )
- { items.clear(); }
-
- /**
- *
- */
- virtual SVGPoint initialize(const SVGPoint &newItem)
- throw( DOMException, SVGException )
- {
- items.clear();
- items.push_back(newItem);
- return newItem;
- }
-
- /**
- *
- */
- virtual SVGPoint getItem(unsigned long index )
- throw( DOMException )
- {
- if (index >= items.size())
- {
- SVGPoint point;
- return point;
- }
- return items[index];
- }
-
- /**
- *
- */
- virtual SVGPoint insertItemBefore(const SVGPoint &newItem,
- unsigned long index )
- throw( DOMException, SVGException )
- {
- if (index >= items.size())
- items.push_back(newItem);
- else
- {
- std::vector<SVGPoint>::iterator iter = items.begin() + index;
- items.insert(iter, newItem);
- }
- return newItem;
- }
-
- /**
- *
- */
- virtual SVGPoint replaceItem(const SVGPoint &newItem,
- unsigned long index )
- throw( DOMException, SVGException )
- {
- if (index >= items.size())
- {
- SVGPoint point;
- return point;
- }
- std::vector<SVGPoint>::iterator iter = items.begin() + index;
- *iter = newItem;
- return newItem;
- }
-
- /**
- *
- */
- virtual SVGPoint removeItem(unsigned long index )
- throw( DOMException )
- {
- if (index >= items.size())
- {
- SVGPoint point;
- return point;
- }
- std::vector<SVGPoint>::iterator iter = items.begin() + index;
- SVGPoint oldItem = *iter;
- items.erase(iter);
- return oldItem;
- }
-
- /**
- *
- */
- virtual SVGPoint appendItem(const SVGPoint &newItem)
- throw( DOMException, SVGException )
- {
- items.push_back(newItem);
- return newItem;
- }
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGPointList() {}
-
-
- /**
- *
- */
- SVGPointList(const SVGPointList &other)
- {
- items = other.items;
- }
-
-
- /**
- *
- */
- virtual ~SVGPointList() {}
-
-protected:
-
- std::vector<SVGPoint> items;
-
-};
-
-
-
-
-/*#########################################################################
-## SVGUnitTypes
-#########################################################################*/
-
-/**
- *
- */
-class SVGUnitTypes
-{
-public:
-
- /**
- * Unit Types
- */
- typedef enum
- {
- SVG_UNIT_TYPE_UNKNOWN = 0,
- SVG_UNIT_TYPE_USERSPACEONUSE = 1,
- SVG_UNIT_TYPE_OBJECTBOUNDINGBOX = 2
- } UnitType;
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGUnitTypes() {}
-
- /**
- *
- */
- virtual ~SVGUnitTypes() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGStylable
-#########################################################################*/
-
-/**
- *
- */
-class SVGStylable
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedString getClassName()
- {
- return className;
- }
-
- /**
- *
- */
- virtual css::CSSStyleDeclaration getStyle()
- {
- return style;
- }
-
-
- /**
- *
- */
- virtual css::CSSValue getPresentationAttribute (const DOMString& name )
- {
- css::CSSValue val;
- //perform a lookup
- return val;
- }
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGStylable() {}
-
- /**
- *
- */
- SVGStylable(const SVGStylable &other)
- {
- className = other.className;
- style = other.style;
- }
-
- /**
- *
- */
- virtual ~SVGStylable() {}
-
-protected:
-
- SVGAnimatedString className;
- css::CSSStyleDeclaration style;
-
-};
-
-
-/*#########################################################################
-## SVGLocatable
-#########################################################################*/
-
-/**
- *
- */
-class SVGLocatable
-{
-public:
-
- /**
- *
- */
- virtual SVGElement *getNearestViewportElement()
- {
- SVGElement *result = NULL;
- return result;
- }
-
- /**
- *
- */
- virtual SVGElement *getFarthestViewportElement()
- {
- SVGElement *result = NULL;
- return result;
- }
-
- /**
- *
- */
- virtual SVGRect getBBox ( )
- {
- return bbox;
- }
-
- /**
- *
- */
- virtual SVGMatrix getCTM ( )
- {
- return ctm;
- }
-
- /**
- *
- */
- virtual SVGMatrix getScreenCTM ( )
- {
- return screenCtm;
- }
-
- /**
- *
- */
- virtual SVGMatrix getTransformToElement (const SVGElement &element)
- throw( SVGException )
- {
- SVGMatrix result;
- //do calculations
- return result;
- }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGLocatable() {}
-
- /**
- *
- */
- SVGLocatable(const SVGLocatable &other)
- {
- }
-
- /**
- *
- */
- virtual ~SVGLocatable() {}
-
-protected:
-
- SVGRect bbox;
- SVGMatrix ctm;
- SVGMatrix screenCtm;
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGTransformable
-#########################################################################*/
-
-/**
- *
- */
-class SVGTransformable : public SVGLocatable
-{
-public:
-
-
- /**
- *
- */
- virtual SVGAnimatedTransformList &getTransform()
- {
- return transforms;
- }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGTransformable() {}
-
- /**
- *
- */
- SVGTransformable(const SVGTransformable &other) : SVGLocatable(other)
- {
- transforms = other.transforms;
- }
-
- /**
- *
- */
- virtual ~SVGTransformable() {}
-
-protected:
-
- SVGAnimatedTransformList transforms;
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGTests
-#########################################################################*/
-
-/**
- *
- */
-class SVGTests
-{
-public:
-
-
- /**
- *
- */
- virtual SVGStringList &getRequiredFeatures()
- {
- return requiredFeatures;
- }
-
- /**
- *
- */
- virtual SVGStringList &getRequiredExtensions()
- {
- return requiredExtensions;
- }
-
- /**
- *
- */
- virtual SVGStringList &getSystemLanguage()
- {
- return systemLanguage;
- }
-
-
- /**
- *
- */
- virtual bool hasExtension (const DOMString& extension )
- {
- return false;
- }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGTests() {}
-
- /**
- *
- */
- SVGTests(const SVGTests &other)
- {
- requiredFeatures = other.requiredFeatures;
- requiredExtensions = other.requiredExtensions;
- systemLanguage = other.systemLanguage;
- }
-
- /**
- *
- */
- virtual ~SVGTests() {}
-
-protected:
-
- SVGStringList requiredFeatures;
- SVGStringList requiredExtensions;
- SVGStringList systemLanguage;
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGLangSpace
-#########################################################################*/
-
-/**
- *
- */
-class SVGLangSpace
-{
-public:
-
-
- /**
- *
- */
- virtual DOMString getXmllang()
- {
- return xmlLang;
- }
-
- /**
- *
- */
- virtual void setXmllang(const DOMString &val)
- throw (DOMException)
- {
- xmlLang = val;
- }
-
- /**
- *
- */
- virtual DOMString getXmlspace()
- {
- return xmlSpace;
- }
-
- /**
- *
- */
- virtual void setXmlspace(const DOMString &val)
- throw (DOMException)
- {
- xmlSpace = val;
- }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGLangSpace() {}
-
- /**
- *
- */
- SVGLangSpace(const SVGLangSpace &other)
- {
- xmlLang = other.xmlLang;
- xmlSpace = other.xmlSpace;
- }
-
- /**
- *
- */
- virtual ~SVGLangSpace() {}
-
-protected:
-
- DOMString xmlLang;
- DOMString xmlSpace;
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGExternalResourcesRequired
-#########################################################################*/
-
-/**
- *
- */
-class SVGExternalResourcesRequired
-{
-public:
-
-
- /**
- *
- */
- virtual SVGAnimatedBoolean getExternalResourcesRequired()
- { return required; }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGExternalResourcesRequired()
- { }
-
-
- /**
- *
- */
- SVGExternalResourcesRequired(const SVGExternalResourcesRequired &other)
- {
- required = other.required;
- }
-
- /**
- *
- */
- virtual ~SVGExternalResourcesRequired() {}
-
-protected:
-
- SVGAnimatedBoolean required;
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGPreserveAspectRatio
-#########################################################################*/
-
-/**
- *
- */
-class SVGPreserveAspectRatio
-{
-public:
-
-
- /**
- * Alignment Types
- */
- typedef enum
- {
- SVG_PRESERVEASPECTRATIO_UNKNOWN = 0,
- SVG_PRESERVEASPECTRATIO_NONE = 1,
- SVG_PRESERVEASPECTRATIO_XMINYMIN = 2,
- SVG_PRESERVEASPECTRATIO_XMIDYMIN = 3,
- SVG_PRESERVEASPECTRATIO_XMAXYMIN = 4,
- SVG_PRESERVEASPECTRATIO_XMINYMID = 5,
- SVG_PRESERVEASPECTRATIO_XMIDYMID = 6,
- SVG_PRESERVEASPECTRATIO_XMAXYMID = 7,
- SVG_PRESERVEASPECTRATIO_XMINYMAX = 8,
- SVG_PRESERVEASPECTRATIO_XMIDYMAX = 9,
- SVG_PRESERVEASPECTRATIO_XMAXYMAX = 10
- } AlignmentType;
-
-
- /**
- * Meet-or-slice Types
- */
- typedef enum
- {
- SVG_MEETORSLICE_UNKNOWN = 0,
- SVG_MEETORSLICE_MEET = 1,
- SVG_MEETORSLICE_SLICE = 2
- } MeetOrSliceType;
-
-
- /**
- *
- */
- virtual unsigned short getAlign()
- { return align; }
-
- /**
- *
- */
- virtual void setAlign(unsigned short val) throw (DOMException)
- { align = val; }
-
- /**
- *
- */
- virtual unsigned short getMeetOrSlice()
- { return meetOrSlice; }
-
- /**
- *
- */
- virtual void setMeetOrSlice(unsigned short val) throw (DOMException)
- { meetOrSlice = val; }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGPreserveAspectRatio()
- {
- align = SVG_PRESERVEASPECTRATIO_UNKNOWN;
- meetOrSlice = SVG_MEETORSLICE_UNKNOWN;
- }
-
- /**
- *
- */
- SVGPreserveAspectRatio(const SVGPreserveAspectRatio &other)
- {
- align = other.align;
- meetOrSlice = other.meetOrSlice;
- }
-
- /**
- *
- */
- virtual ~SVGPreserveAspectRatio() {}
-
-protected:
-
- unsigned short align;
- unsigned short meetOrSlice;
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGAnimatedPreserveAspectRatio
-#########################################################################*/
-
-/**
- *
- */
-class SVGAnimatedPreserveAspectRatio
-{
-public:
-
-
- /**
- *
- */
- virtual SVGPreserveAspectRatio getBaseVal()
- { return baseVal; }
-
- /**
- *
- */
- virtual SVGPreserveAspectRatio getAnimVal()
- { return animVal; }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGAnimatedPreserveAspectRatio() {}
-
- /**
- *
- */
- SVGAnimatedPreserveAspectRatio(const SVGAnimatedPreserveAspectRatio &other)
- {
- baseVal = other.baseVal;
- baseVal = other.animVal;
- }
-
- /**
- *
- */
- virtual ~SVGAnimatedPreserveAspectRatio() {}
-
-protected:
-
- SVGPreserveAspectRatio baseVal;
- SVGPreserveAspectRatio animVal;
-
-};
-
-
-
-
-/*#########################################################################
-## SVGFitToViewBox
-#########################################################################*/
-
-/**
- *
- */
-class SVGFitToViewBox
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedRect getViewBox()
- { return viewBox; }
-
- /**
- *
- */
- virtual SVGAnimatedPreserveAspectRatio getPreserveAspectRatio()
- { return preserveAspectRatio; }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGFitToViewBox()
- {}
-
- /**
- *
- */
-
- SVGFitToViewBox(const SVGFitToViewBox &other)
- {
- viewBox = other.viewBox;
- preserveAspectRatio = other.preserveAspectRatio;
- }
-
- /**
- *
- */
- virtual ~SVGFitToViewBox() {}
-
-protected:
-
- SVGAnimatedRect viewBox;
-
- SVGAnimatedPreserveAspectRatio preserveAspectRatio;
-
-};
-
-
-/*#########################################################################
-## SVGZoomAndPan
-#########################################################################*/
-
-/**
- *
- */
-class SVGZoomAndPan
-{
-public:
-
-
- /**
- * Zoom and Pan Types
- */
- typedef enum
- {
- SVG_ZOOMANDPAN_UNKNOWN = 0,
- SVG_ZOOMANDPAN_DISABLE = 1,
- SVG_ZOOMANDPAN_MAGNIFY = 2
- } ZoomAndPanType;
-
-
- /**
- *
- */
- virtual unsigned short getZoomAndPan()
- { return zoomAndPan; }
-
- /**
- *
- */
- virtual void setZoomAndPan(unsigned short val) throw (DOMException)
- { zoomAndPan = val; }
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGZoomAndPan()
- { zoomAndPan = SVG_ZOOMANDPAN_UNKNOWN; }
-
- /**
- *
- */
- SVGZoomAndPan(const SVGZoomAndPan &other)
- { zoomAndPan = other.zoomAndPan; }
-
- /**
- *
- */
- virtual ~SVGZoomAndPan() {}
-
-protected:
-
- unsigned short zoomAndPan;
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGViewSpec
-#########################################################################*/
-
-/**
- *
- */
-class SVGViewSpec : public SVGZoomAndPan,
- public SVGFitToViewBox
-{
-public:
-
- /**
- *
- */
- virtual SVGTransformList getTransform()
- { return transform; }
-
- /**
- *
- */
- virtual SVGElement *getViewTarget()
- { return viewTarget; }
-
- /**
- *
- */
- virtual DOMString getViewBoxString()
- {
- DOMString ret;
- return ret;
- }
-
- /**
- *
- */
- virtual DOMString getPreserveAspectRatioString()
- {
- DOMString ret;
- return ret;
- }
-
- /**
- *
- */
- virtual DOMString getTransformString()
- {
- DOMString ret;
- return ret;
- }
-
- /**
- *
- */
- virtual DOMString getViewTargetString()
- {
- DOMString ret;
- return ret;
- }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGViewSpec()
- {
- viewTarget = NULL;
- }
-
- /**
- *
- */
- SVGViewSpec(const SVGViewSpec &other) : SVGZoomAndPan(other), SVGFitToViewBox(other)
- {
- viewTarget = other.viewTarget;
- transform = other.transform;
- }
-
- /**
- *
- */
- virtual ~SVGViewSpec() {}
-
-protected:
-
- SVGElement *viewTarget;
- SVGTransformList transform;
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGURIReference
-#########################################################################*/
-
-/**
- *
- */
-class SVGURIReference
-{
-public:
-
- /**
- *
- */
- virtual SVGAnimatedString getHref()
- { return href; }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGURIReference() {}
-
- /**
- *
- */
- SVGURIReference(const SVGURIReference &other)
- {
- href = other.href;
- }
-
- /**
- *
- */
- virtual ~SVGURIReference() {}
-
-protected:
-
- SVGAnimatedString href;
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGCSSRule
-#########################################################################*/
-
-/**
- *
- */
-class SVGCSSRule : public css::CSSRule
-{
-public:
-
-
- /**
- * Additional CSS RuleType to support ICC color specifications
- */
- typedef enum
- {
- COLOR_PROFILE_RULE = 7
- } ColorProfileRuleType;
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGCSSRule()
- { type = COLOR_PROFILE_RULE; }
-
- /**
- *
- */
- SVGCSSRule(const SVGCSSRule &other) : css::CSSRule(other)
- { type = COLOR_PROFILE_RULE; }
-
- /**
- *
- */
- virtual ~SVGCSSRule() {}
-
-};
-
-
-
-/*#########################################################################
-## SVGRenderingIntent
-#########################################################################*/
-
-/**
- *
- */
-class SVGRenderingIntent
-{
-public:
-
- /**
- * Rendering Intent Types
- */
- typedef enum
- {
- RENDERING_INTENT_UNKNOWN = 0,
- RENDERING_INTENT_AUTO = 1,
- RENDERING_INTENT_PERCEPTUAL = 2,
- RENDERING_INTENT_RELATIVE_COLORIMETRIC = 3,
- RENDERING_INTENT_SATURATION = 4,
- RENDERING_INTENT_ABSOLUTE_COLORIMETRIC = 5
- } RenderingIntentType;
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGRenderingIntent()
- {
- renderingIntentType = RENDERING_INTENT_UNKNOWN;
- }
-
- /**
- *
- */
- SVGRenderingIntent(const SVGRenderingIntent &other)
- {
- renderingIntentType = other.renderingIntentType;
- }
-
- /**
- *
- */
- virtual ~SVGRenderingIntent() {}
-
-protected:
-
- unsigned short renderingIntentType;
-};
-
-
-
-
-
-
-
-/*#########################################################################
-###########################################################################
-## P A T H S E G M E N T S
-###########################################################################
-#########################################################################*/
-
-static char *pathSegLetters[] =
-{
- "@", // PATHSEG_UNKNOWN,
- "z", // PATHSEG_CLOSEPATH
- "M", // PATHSEG_MOVETO_ABS
- "m", // PATHSEG_MOVETO_REL,
- "L", // PATHSEG_LINETO_ABS
- "l", // PATHSEG_LINETO_REL
- "C", // PATHSEG_CURVETO_CUBIC_ABS
- "c", // PATHSEG_CURVETO_CUBIC_REL
- "Q", // PATHSEG_CURVETO_QUADRATIC_ABS,
- "q", // PATHSEG_CURVETO_QUADRATIC_REL
- "A", // PATHSEG_ARC_ABS
- "a", // PATHSEG_ARC_REL,
- "H", // PATHSEG_LINETO_HORIZONTAL_ABS,
- "h", // PATHSEG_LINETO_HORIZONTAL_REL
- "V", // PATHSEG_LINETO_VERTICAL_ABS
- "v", // PATHSEG_LINETO_VERTICAL_REL
- "S", // PATHSEG_CURVETO_CUBIC_SMOOTH_ABS
- "s", // PATHSEG_CURVETO_CUBIC_SMOOTH_REL
- "T", // PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS
- "t" // PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL
-};
-
-/*#########################################################################
-## SVGPathSeg
-#########################################################################*/
-
-/**
- *
- */
-class SVGPathSeg
-{
-public:
-
-
-
- /**
- * Path Segment Types
- */
- typedef enum
- {
- PATHSEG_UNKNOWN = 0,
- PATHSEG_CLOSEPATH = 1,
- PATHSEG_MOVETO_ABS = 2,
- PATHSEG_MOVETO_REL = 3,
- PATHSEG_LINETO_ABS = 4,
- PATHSEG_LINETO_REL = 5,
- PATHSEG_CURVETO_CUBIC_ABS = 6,
- PATHSEG_CURVETO_CUBIC_REL = 7,
- PATHSEG_CURVETO_QUADRATIC_ABS = 8,
- PATHSEG_CURVETO_QUADRATIC_REL = 9,
- PATHSEG_ARC_ABS = 10,
- PATHSEG_ARC_REL = 11,
- PATHSEG_LINETO_HORIZONTAL_ABS = 12,
- PATHSEG_LINETO_HORIZONTAL_REL = 13,
- PATHSEG_LINETO_VERTICAL_ABS = 14,
- PATHSEG_LINETO_VERTICAL_REL = 15,
- PATHSEG_CURVETO_CUBIC_SMOOTH_ABS = 16,
- PATHSEG_CURVETO_CUBIC_SMOOTH_REL = 17,
- PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS = 18,
- PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL = 19
- } PathSegmentType;
-
- /**
- *
- */
- virtual unsigned short getPathSegType()
- { return type; }
-
- /**
- *
- */
- virtual DOMString getPathSegTypeAsLetter()
- {
- int typ = type;
- if (typ<0 || typ>PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL)
- typ = PATHSEG_UNKNOWN;
- char *ch = pathSegLetters[typ];
- DOMString letter = ch;
- return letter;
- }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGPathSeg()
- { type = PATHSEG_UNKNOWN; }
-
- /**
- *
- */
- SVGPathSeg(const SVGPathSeg &other)
- {
- type = other.type;
- }
-
- /**
- *
- */
- virtual ~SVGPathSeg() {}
-
-protected:
-
- int type;
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGPathSegClosePath
-#########################################################################*/
-
-/**
- *
- */
-class SVGPathSegClosePath : public SVGPathSeg
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGPathSegClosePath()
- {
- type = PATHSEG_CLOSEPATH;
- }
-
- /**
- *
- */
- SVGPathSegClosePath(const SVGPathSegClosePath &other) : SVGPathSeg(other)
- {
- type = PATHSEG_CLOSEPATH;
- }
-
- /**
- *
- */
- virtual ~SVGPathSegClosePath() {}
-
-};
-
-
-
-
-/*#########################################################################
-## SVGPathSegMovetoAbs
-#########################################################################*/
-
-/**
- *
- */
-class SVGPathSegMovetoAbs : public SVGPathSeg
-{
-public:
-
- /**
- *
- */
- virtual double getX()
- { return x; }
-
- /**
- *
- */
- virtual void setX(double val) throw (DOMException)
- { x = val; }
-
- /**
- *
- */
- virtual double getY()
- { return y; }
-
- /**
- *
- */
- virtual void setY(double val) throw (DOMException)
- { y = val; }
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGPathSegMovetoAbs()
- {
- type = PATHSEG_MOVETO_ABS;
- x = y = 0.0;
- }
-
- /**
- *
- */
- SVGPathSegMovetoAbs(double xArg, double yArg)
- {
- type = PATHSEG_MOVETO_ABS;
- x = xArg; y = yArg;
- }
-
- /**
- *
- */
- SVGPathSegMovetoAbs(const SVGPathSegMovetoAbs &other) : SVGPathSeg(other)
- {
- type = PATHSEG_MOVETO_ABS;
- x = other.x; y = other.y;
- }
-
- /**
- *
- */
- virtual ~SVGPathSegMovetoAbs() {}
-
-protected:
-
- double x,y;
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGPathSegMovetoRel
-#########################################################################*/
-
-/**
- *
- */
-class SVGPathSegMovetoRel : public SVGPathSeg
-{
-public:
-
- /**
- *
- */
- virtual double getX()
- { return x; }
-
- /**
- *
- */
- virtual void setX(double val) throw (DOMException)
- { x = val; }
-
- /**
- *
- */
- virtual double getY()
- { return y; }
-
- /**
- *
- */
- virtual void setY(double val) throw (DOMException)
- { y = val; }
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGPathSegMovetoRel()
- {
- type = PATHSEG_MOVETO_REL;
- x = y = 0.0;
- }
-
-
- /**
- *
- */
- SVGPathSegMovetoRel(double xArg, double yArg)
- {
- type = PATHSEG_MOVETO_REL;
- x = xArg; y = yArg;
- }
-
- /**
- *
- */
- SVGPathSegMovetoRel(const SVGPathSegMovetoRel &other) : SVGPathSeg(other)
- {
- type = PATHSEG_MOVETO_REL;
- x = other.x; y = other.y;
- }
-
- /**
- *
- */
- virtual ~SVGPathSegMovetoRel() {}
-
-protected:
-
- double x,y;
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGPathSegLinetoAbs
-#########################################################################*/
-
-/**
- *
- */
-class SVGPathSegLinetoAbs : public SVGPathSeg
-{
-public:
-
- /**
- *
- */
- virtual double getX()
- { return x; }
-
- /**
- *
- */
- virtual void setX(double val) throw (DOMException)
- { x = val; }
-
- /**
- *
- */
- virtual double getY()
- { return y; }
-
- /**
- *
- */
- virtual void setY(double val) throw (DOMException)
- { y = val; }
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGPathSegLinetoAbs()
- {
- type = PATHSEG_LINETO_ABS;
- x = y = 0.0;
- }
-
-
- /**
- *
- */
- SVGPathSegLinetoAbs(double xArg, double yArg)
- {
- type = PATHSEG_LINETO_ABS;
- x = xArg; y = yArg;
- }
-
- /**
- *
- */
- SVGPathSegLinetoAbs(const SVGPathSegLinetoAbs &other) : SVGPathSeg(other)
- {
- type = PATHSEG_LINETO_ABS;
- x = other.x; y = other.y;
- }
-
- /**
- *
- */
- virtual ~SVGPathSegLinetoAbs() {}
-
-protected:
-
- double x,y;
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGPathSegLinetoRel
-#########################################################################*/
-
-/**
- *
- */
-class SVGPathSegLinetoRel : public SVGPathSeg
-{
-public:
-
- /**
- *
- */
- virtual double getX()
- { return x; }
-
- /**
- *
- */
- virtual void setX(double val) throw (DOMException)
- { x = val; }
-
- /**
- *
- */
- virtual double getY()
- { return y; }
-
- /**
- *
- */
- virtual void setY(double val) throw (DOMException)
- { y = val; }
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGPathSegLinetoRel()
- {
- type = PATHSEG_LINETO_REL;
- x = y = 0.0;
- }
-
-
- /**
- *
- */
- SVGPathSegLinetoRel(double xArg, double yArg)
- {
- type = PATHSEG_LINETO_REL;
- x = xArg; y = yArg;
- }
-
- /**
- *
- */
- SVGPathSegLinetoRel(const SVGPathSegLinetoRel &other) : SVGPathSeg(other)
- {
- type = PATHSEG_LINETO_REL;
- x = other.x; y = other.y;
- }
-
- /**
- *
- */
- virtual ~SVGPathSegLinetoRel() {}
-
-protected:
-
- double x,y;
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGPathSegCurvetoCubicAbs
-#########################################################################*/
-
-/**
- *
- */
-class SVGPathSegCurvetoCubicAbs : public SVGPathSeg
-{
-public:
-
- /**
- *
- */
- virtual double getX()
- { return x; }
-
- /**
- *
- */
- virtual void setX(double val) throw (DOMException)
- { x = val; }
-
- /**
- *
- */
- virtual double getY()
- { return y; }
-
- /**
- *
- */
- virtual void setY(double val) throw (DOMException)
- { y = val; }
-
- /**
- *
- */
- virtual double getX1()
- { return x1; }
-
- /**
- *
- */
- virtual void setX1(double val) throw (DOMException)
- { x1 = val; }
-
- /**
- *
- */
- virtual double getY1()
- { return y1; }
-
- /**
- *
- */
- virtual void setY1(double val) throw (DOMException)
- { y1 = val; }
-
-
- /**
- *
- */
- virtual double getX2()
- { return x2; }
-
- /**
- *
- */
- virtual void setX2(double val) throw (DOMException)
- { x2 = val; }
-
- /**
- *
- */
- virtual double getY2()
- { return y2; }
-
- /**
- *
- */
- virtual void setY2(double val) throw (DOMException)
- { y2 = val; }
-
-
- //##################
- //# Non-API methods
- //##################
-
-
- /**
- *
- */
- SVGPathSegCurvetoCubicAbs()
- {
- type = PATHSEG_CURVETO_CUBIC_ABS;
- x = y = x1 = y1 = x2 = y2 = 0.0;
- }
-
- /**
- *
- */
- SVGPathSegCurvetoCubicAbs(double xArg, double yArg,
- double x1Arg, double y1Arg,
- double x2Arg, double y2Arg)
- {
- type = PATHSEG_CURVETO_CUBIC_ABS;
- x = xArg; y = yArg;
- x1 = x1Arg; y1 = y1Arg;
- x2 = x2Arg; y2 = y2Arg;
- }
-
- /**
- *
- */
- SVGPathSegCurvetoCubicAbs(const SVGPathSegCurvetoCubicAbs &other)
- : SVGPathSeg(other)
- {
- type = PATHSEG_CURVETO_CUBIC_ABS;
- x = other.x; y = other.y;
- x1 = other.x1; y1 = other.y1;
- x2 = other.x2; y2 = other.y2;
- }
-
- /**
- *
- */
- virtual ~SVGPathSegCurvetoCubicAbs() {}
-
-protected:
-
- double x, y, x1, y1, x2, y2;
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGPathSegCurvetoCubicRel
-#########################################################################*/
-
-/**
- *
- */
-class SVGPathSegCurvetoCubicRel : public SVGPathSeg
-{
-public:
-
- /**
- *
- */
- virtual double getX()
- { return x; }
-
- /**
- *
- */
- virtual void setX(double val) throw (DOMException)
- { x = val; }
-
- /**
- *
- */
- virtual double getY()
- { return y; }
-
- /**
- *
- */
- virtual void setY(double val) throw (DOMException)
- { y = val; }
-
- /**
- *
- */
- virtual double getX1()
- { return x1; }
-
- /**
- *
- */
- virtual void setX1(double val) throw (DOMException)
- { x1 = val; }
-
- /**
- *
- */
- virtual double getY1()
- { return y1; }
-
- /**
- *
- */
- virtual void setY1(double val) throw (DOMException)
- { y1 = val; }
-
-
- /**
- *
- */
- virtual double getX2()
- { return x2; }
-
- /**
- *
- */
- virtual void setX2(double val) throw (DOMException)
- { x2 = val; }
-
- /**
- *
- */
- virtual double getY2()
- { return y2; }
-
- /**
- *
- */
- virtual void setY2(double val) throw (DOMException)
- { y2 = val; }
-
-
- //##################
- //# Non-API methods
- //##################
-
-
- /**
- *
- */
- SVGPathSegCurvetoCubicRel()
- {
- type = PATHSEG_CURVETO_CUBIC_REL;
- x = y = x1 = y1 = x2 = y2 = 0.0;
- }
-
-
- /**
- *
- */
- SVGPathSegCurvetoCubicRel(double xArg, double yArg,
- double x1Arg, double y1Arg,
- double x2Arg, double y2Arg)
- {
- type = PATHSEG_CURVETO_CUBIC_REL;
- x = xArg; y = yArg;
- x1 = x1Arg; y1 = y1Arg;
- x2 = x2Arg; y2 = y2Arg;
- }
-
- /**
- *
- */
- SVGPathSegCurvetoCubicRel(const SVGPathSegCurvetoCubicRel &other)
- : SVGPathSeg(other)
- {
- type = PATHSEG_CURVETO_CUBIC_REL;
- x = other.x; y = other.y;
- x1 = other.x1; y1 = other.y1;
- x2 = other.x2; y2 = other.y2;
- }
-
- /**
- *
- */
- virtual ~SVGPathSegCurvetoCubicRel() {}
-
-protected:
-
- double x, y, x1, y1, x2, y2;
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGPathSegCurvetoQuadraticAbs
-#########################################################################*/
-
-/**
- *
- */
-class SVGPathSegCurvetoQuadraticAbs : public SVGPathSeg
-{
-public:
-
- /**
- *
- */
- virtual double getX()
- { return x; }
-
- /**
- *
- */
- virtual void setX(double val) throw (DOMException)
- { x = val; }
-
- /**
- *
- */
- virtual double getY()
- { return y; }
-
- /**
- *
- */
- virtual void setY(double val) throw (DOMException)
- { y = val; }
-
- /**
- *
- */
- virtual double getX1()
- { return x1; }
-
- /**
- *
- */
- virtual void setX1(double val) throw (DOMException)
- { x1 = val; }
-
- /**
- *
- */
- virtual double getY1()
- { return y1; }
-
- /**
- *
- */
- virtual void setY1(double val) throw (DOMException)
- { y1 = val; }
-
-
- //##################
- //# Non-API methods
- //##################
-
-
- /**
- *
- */
- SVGPathSegCurvetoQuadraticAbs()
- {
- type = PATHSEG_CURVETO_QUADRATIC_ABS;
- x = y = x1 = y1 = 0.0;
- }
-
- /**
- *
- */
- SVGPathSegCurvetoQuadraticAbs(double xArg, double yArg,
- double x1Arg, double y1Arg)
- {
- type = PATHSEG_CURVETO_QUADRATIC_ABS;
- x = xArg; y = yArg;
- x1 = x1Arg; y1 = y1Arg;
- }
-
- /**
- *
- */
- SVGPathSegCurvetoQuadraticAbs(const SVGPathSegCurvetoQuadraticAbs &other)
- : SVGPathSeg(other)
- {
- type = PATHSEG_CURVETO_QUADRATIC_ABS;
- x = other.x; y = other.y;
- x1 = other.x1; y1 = other.y1;
- }
-
- /**
- *
- */
- virtual ~SVGPathSegCurvetoQuadraticAbs() {}
-
-protected:
-
- double x, y, x1, y1;
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGPathSegCurvetoQuadraticRel
-#########################################################################*/
-
-/**
- *
- */
-class SVGPathSegCurvetoQuadraticRel : public SVGPathSeg
-{
-public:
-
- /**
- *
- */
- virtual double getX()
- { return x; }
-
- /**
- *
- */
- virtual void setX(double val) throw (DOMException)
- { x = val; }
-
- /**
- *
- */
- virtual double getY()
- { return y; }
-
- /**
- *
- */
- virtual void setY(double val) throw (DOMException)
- { y = val; }
-
- /**
- *
- */
- virtual double getX1()
- { return x1; }
-
- /**
- *
- */
- virtual void setX1(double val) throw (DOMException)
- { x1 = val; }
-
- /**
- *
- */
- virtual double getY1()
- { return y1; }
-
- /**
- *
- */
- virtual void setY1(double val) throw (DOMException)
- { y1 = val; }
-
-
- //##################
- //# Non-API methods
- //##################
-
-
- /**
- *
- */
- SVGPathSegCurvetoQuadraticRel()
- {
- type = PATHSEG_CURVETO_QUADRATIC_REL;
- x = y = x1 = y1 = 0.0;
- }
-
-
- /**
- *
- */
- SVGPathSegCurvetoQuadraticRel(double xArg, double yArg,
- double x1Arg, double y1Arg)
- {
- type = PATHSEG_CURVETO_QUADRATIC_REL;
- x = xArg; y = yArg;
- x1 = x1Arg; y1 = y1Arg;
- }
-
- /**
- *
- */
- SVGPathSegCurvetoQuadraticRel(const SVGPathSegCurvetoQuadraticRel &other)
- : SVGPathSeg(other)
- {
- type = PATHSEG_CURVETO_QUADRATIC_REL;
- x = other.x; y = other.y;
- x1 = other.x1; y1 = other.y1;
- }
-
- /**
- *
- */
- virtual ~SVGPathSegCurvetoQuadraticRel() {}
-
-protected:
-
- double x, y, x1, y1;
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGPathSegArcAbs
-#########################################################################*/
-
-/**
- *
- */
-class SVGPathSegArcAbs : public SVGPathSeg
-{
-public:
-
- /**
- *
- */
- virtual double getX()
- { return x; }
-
- /**
- *
- */
- virtual void setX(double val) throw (DOMException)
- { x = val; }
-
- /**
- *
- */
- virtual double getY()
- { return y; }
-
- /**
- *
- */
- virtual void setY(double val) throw (DOMException)
- { y = val; }
-
- /**
- *
- */
- virtual double getR1()
- { return r1; }
-
- /**
- *
- */
- virtual void setR1(double val) throw (DOMException)
- { r1 = val; }
-
- /**
- *
- */
- virtual double getR2()
- { return r2; }
-
- /**
- *
- */
- virtual void setR2(double val) throw (DOMException)
- { r2 = val; }
-
- /**
- *
- */
- virtual double getAngle()
- { return angle; }
-
- /**
- *
- */
- virtual void setAngle(double val) throw (DOMException)
- { angle = val; }
-
- /**
- *
- */
- virtual bool getLargeArcFlag()
- { return largeArcFlag; }
-
- /**
- *
- */
- virtual void setLargeArcFlag(bool val) throw (DOMException)
- { largeArcFlag = val; }
-
- /**
- *
- */
- virtual bool getSweepFlag()
- { return sweepFlag; }
-
- /**
- *
- */
- virtual void setSweepFlag(bool val) throw (DOMException)
- { sweepFlag = val; }
-
- //##################
- //# Non-API methods
- //##################
-
-
- /**
- *
- */
- SVGPathSegArcAbs()
- {
- type = PATHSEG_ARC_ABS;
- x = y = r1 = r2 = angle = 0.0;
- largeArcFlag = sweepFlag = false;
- }
-
- /**
- *
- */
- SVGPathSegArcAbs(double xArg, double yArg,
- double r1Arg, double r2Arg,
- double angleArg,
- bool largeArcFlagArg,
- bool sweepFlagArg )
-
- {
- type = PATHSEG_ARC_ABS;
- x = xArg; y = yArg;
- r1 = r1Arg; r2 = r2Arg;
- angle = angleArg;
- largeArcFlag = largeArcFlagArg;
- sweepFlag = sweepFlagArg;
- }
-
- /**
- *
- */
- SVGPathSegArcAbs(const SVGPathSegArcAbs &other)
- : SVGPathSeg(other)
- {
- type = PATHSEG_ARC_ABS;
- x = other.x; y = other.y;
- r1 = other.r1; r2 = other.r2;
- angle = other.angle;
- largeArcFlag = other.largeArcFlag;
- sweepFlag = other.sweepFlag;
- }
-
- /**
- *
- */
- virtual ~SVGPathSegArcAbs() {}
-
-protected:
-
- double x, y, r1, r2, angle;
- bool largeArcFlag;
- bool sweepFlag;
-
-};
-
-
-
-/*#########################################################################
-## SVGPathSegArcRel
-#########################################################################*/
-
-/**
- *
- */
-class SVGPathSegArcRel : public SVGPathSeg
-{
-public:
-
- /**
- *
- */
- virtual double getX()
- { return x; }
-
- /**
- *
- */
- virtual void setX(double val) throw (DOMException)
- { x = val; }
-
- /**
- *
- */
- virtual double getY()
- { return y; }
-
- /**
- *
- */
- virtual void setY(double val) throw (DOMException)
- { y = val; }
-
- /**
- *
- */
- virtual double getR1()
- { return r1; }
-
- /**
- *
- */
- virtual void setR1(double val) throw (DOMException)
- { r1 = val; }
-
- /**
- *
- */
- virtual double getR2()
- { return r2; }
-
- /**
- *
- */
- virtual void setR2(double val) throw (DOMException)
- { r2 = val; }
-
- /**
- *
- */
- virtual double getAngle()
- { return angle; }
-
- /**
- *
- */
- virtual void setAngle(double val) throw (DOMException)
- { angle = val; }
-
- /**
- *
- */
- virtual bool getLargeArcFlag()
- { return largeArcFlag; }
-
- /**
- *
- */
- virtual void setLargeArcFlag(bool val) throw (DOMException)
- { largeArcFlag = val; }
-
- /**
- *
- */
- virtual bool getSweepFlag()
- { return sweepFlag; }
-
- /**
- *
- */
- virtual void setSweepFlag(bool val) throw (DOMException)
- { sweepFlag = val; }
-
- //##################
- //# Non-API methods
- //##################
-
-
- /**
- *
- */
- SVGPathSegArcRel()
- {
- type = PATHSEG_ARC_REL;
- x = y = r1 = r2 = angle = 0.0;
- largeArcFlag = sweepFlag = false;
- }
-
-
- /**
- *
- */
- SVGPathSegArcRel(double xArg, double yArg,
- double r1Arg, double r2Arg,
- double angleArg,
- bool largeArcFlagArg,
- bool sweepFlagArg )
-
- {
- type = PATHSEG_ARC_REL;
- x = xArg; y = yArg;
- r1 = r1Arg; r2 = r2Arg;
- angle = angleArg;
- largeArcFlag = largeArcFlagArg;
- sweepFlag = sweepFlagArg;
- }
-
- /**
- *
- */
- SVGPathSegArcRel(const SVGPathSegArcRel &other)
- : SVGPathSeg(other)
- {
- type = PATHSEG_ARC_REL;
- x = other.x; y = other.y;
- r1 = other.r1; r2 = other.r2;
- angle = other.angle;
- largeArcFlag = other.largeArcFlag;
- sweepFlag = other.sweepFlag;
- }
-
- /**
- *
- */
- virtual ~SVGPathSegArcRel() {}
-
-protected:
-
- double x, y, r1, r2, angle;
- bool largeArcFlag;
- bool sweepFlag;
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGPathSegLinetoHorizontalAbs
-#########################################################################*/
-
-/**
- *
- */
-class SVGPathSegLinetoHorizontalAbs : public SVGPathSeg
-{
-public:
-
- /**
- *
- */
- virtual double getX()
- { return x; }
-
- /**
- *
- */
- virtual void setX(double val) throw (DOMException)
- { x = val; }
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGPathSegLinetoHorizontalAbs()
- {
- type = PATHSEG_LINETO_HORIZONTAL_ABS;
- x = 0.0;
- }
-
-
- /**
- *
- */
- SVGPathSegLinetoHorizontalAbs(double xArg)
- {
- type = PATHSEG_LINETO_HORIZONTAL_ABS;
- x = xArg;
- }
-
- /**
- *
- */
- SVGPathSegLinetoHorizontalAbs(const SVGPathSegLinetoHorizontalAbs &other)
- : SVGPathSeg(other)
- {
- type = PATHSEG_LINETO_HORIZONTAL_ABS;
- x = other.x;
- }
-
- /**
- *
- */
- virtual ~SVGPathSegLinetoHorizontalAbs() {}
-
-protected:
-
- double x;
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGPathSegLinetoHorizontalRel
-#########################################################################*/
-
-/**
- *
- */
-class SVGPathSegLinetoHorizontalRel : public SVGPathSeg
-{
-public:
-
- /**
- *
- */
- virtual double getX()
- { return x; }
-
- /**
- *
- */
- virtual void setX(double val) throw (DOMException)
- { x = val; }
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGPathSegLinetoHorizontalRel()
- {
- type = PATHSEG_LINETO_HORIZONTAL_REL;
- x = 0.0;
- }
-
-
- /**
- *
- */
- SVGPathSegLinetoHorizontalRel(double xArg)
- {
- type = PATHSEG_LINETO_HORIZONTAL_REL;
- x = xArg;
- }
-
- /**
- *
- */
- SVGPathSegLinetoHorizontalRel(const SVGPathSegLinetoHorizontalRel &other)
- : SVGPathSeg(other)
- {
- type = PATHSEG_LINETO_HORIZONTAL_REL;
- x = other.x;
- }
-
- /**
- *
- */
- virtual ~SVGPathSegLinetoHorizontalRel() {}
-
-protected:
-
- double x;
-
-};
-
-
-
-/*#########################################################################
-## SVGPathSegLinetoVerticalAbs
-#########################################################################*/
-
-/**
- *
- */
-class SVGPathSegLinetoVerticalAbs : public SVGPathSeg
-{
-public:
-
- /**
- *
- */
- virtual double getY()
- { return y; }
-
- /**
- *
- */
- virtual void setY(double val) throw (DOMException)
- { y = val; }
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGPathSegLinetoVerticalAbs()
- {
- type = PATHSEG_LINETO_VERTICAL_ABS;
- y = 0.0;
- }
-
-
- /**
- *
- */
- SVGPathSegLinetoVerticalAbs(double yArg)
- {
- type = PATHSEG_LINETO_VERTICAL_ABS;
- y = yArg;
- }
-
- /**
- *
- */
- SVGPathSegLinetoVerticalAbs(const SVGPathSegLinetoVerticalAbs &other)
- : SVGPathSeg(other)
- {
- type = PATHSEG_LINETO_VERTICAL_ABS;
- y = other.y;
- }
-
- /**
- *
- */
- virtual ~SVGPathSegLinetoVerticalAbs() {}
-
-protected:
-
- double y;
-
-};
-
-
-
-/*#########################################################################
-## SVGPathSegLinetoVerticalRel
-#########################################################################*/
-
-/**
- *
- */
-class SVGPathSegLinetoVerticalRel : public SVGPathSeg
-{
-public:
-
- /**
- *
- */
- virtual double getY()
- { return y; }
-
- /**
- *
- */
- virtual void setY(double val) throw (DOMException)
- { y = val; }
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGPathSegLinetoVerticalRel()
- {
- type = PATHSEG_LINETO_VERTICAL_REL;
- y = 0.0;
- }
-
-
- /**
- *
- */
- SVGPathSegLinetoVerticalRel(double yArg)
- {
- type = PATHSEG_LINETO_VERTICAL_REL;
- y = yArg;
- }
-
- /**
- *
- */
- SVGPathSegLinetoVerticalRel(const SVGPathSegLinetoVerticalRel &other)
- : SVGPathSeg(other)
- {
- type = PATHSEG_LINETO_VERTICAL_REL;
- y = other.y;
- }
-
- /**
- *
- */
- virtual ~SVGPathSegLinetoVerticalRel() {}
-
-protected:
-
- double y;
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGPathSegCurvetoCubicSmoothAbs
-#########################################################################*/
-
-/**
- *
- */
-class SVGPathSegCurvetoCubicSmoothAbs : public SVGPathSeg
-{
-public:
-
- /**
- *
- */
- virtual double getX()
- { return x; }
-
- /**
- *
- */
- virtual void setX(double val) throw (DOMException)
- { x = val; }
-
- /**
- *
- */
- virtual double getY()
- { return y; }
-
- /**
- *
- */
- virtual void setY(double val) throw (DOMException)
- { y = val; }
-
- /**
- *
- */
- virtual double getX2()
- { return x2; }
-
- /**
- *
- */
- virtual void setX2(double val) throw (DOMException)
- { x2 = val; }
-
- /**
- *
- */
- virtual double getY2()
- { return y2; }
-
- /**
- *
- */
- virtual void setY2(double val) throw (DOMException)
- { y2 = val; }
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGPathSegCurvetoCubicSmoothAbs()
- {
- type = PATHSEG_CURVETO_CUBIC_SMOOTH_ABS;
- x = y = x2 = y2 = 0.0;
- }
-
-
- /**
- *
- */
- SVGPathSegCurvetoCubicSmoothAbs(double xArg, double yArg,
- double x2Arg, double y2Arg)
- {
- type = PATHSEG_CURVETO_CUBIC_SMOOTH_ABS;
- x = xArg; y = yArg;
- x2 = x2Arg; y2 = y2Arg;
- }
-
- /**
- *
- */
- SVGPathSegCurvetoCubicSmoothAbs(const SVGPathSegCurvetoCubicSmoothAbs &other)
- : SVGPathSeg(other)
- {
- type = PATHSEG_CURVETO_CUBIC_SMOOTH_ABS;
- x = other.x; y = other.y;
- x2 = other.x2; y2 = other.y2;
- }
-
- /**
- *
- */
- virtual ~SVGPathSegCurvetoCubicSmoothAbs() {}
-
-protected:
-
- double x, y, x2, y2;
-
-};
-
-
-
-/*#########################################################################
-## SVGPathSegCurvetoCubicSmoothRel
-#########################################################################*/
-
-/**
- *
- */
-class SVGPathSegCurvetoCubicSmoothRel : public SVGPathSeg
-{
-public:
-
- /**
- *
- */
- virtual double getX()
- { return x; }
-
- /**
- *
- */
- virtual void setX(double val) throw (DOMException)
- { x = val; }
-
- /**
- *
- */
- virtual double getY()
- { return y; }
-
- /**
- *
- */
- virtual void setY(double val) throw (DOMException)
- { y = val; }
-
- /**
- *
- */
- virtual double getX2()
- { return x2; }
-
- /**
- *
- */
- virtual void setX2(double val) throw (DOMException)
- { x2 = val; }
-
- /**
- *
- */
- virtual double getY2()
- { return y2; }
-
- /**
- *
- */
- virtual void setY2(double val) throw (DOMException)
- { y2 = val; }
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGPathSegCurvetoCubicSmoothRel()
- {
- type = PATHSEG_CURVETO_CUBIC_SMOOTH_REL;
- x = y = x2 = y2 = 0.0;
- }
-
-
- /**
- *
- */
- SVGPathSegCurvetoCubicSmoothRel(double xArg, double yArg,
- double x2Arg, double y2Arg)
- {
- type = PATHSEG_CURVETO_CUBIC_SMOOTH_REL;
- x = xArg; y = yArg;
- x2 = x2Arg; y2 = y2Arg;
- }
-
- /**
- *
- */
- SVGPathSegCurvetoCubicSmoothRel(const SVGPathSegCurvetoCubicSmoothRel &other)
- : SVGPathSeg(other)
- {
- type = PATHSEG_CURVETO_CUBIC_SMOOTH_REL;
- x = other.x; y = other.y;
- x2 = other.x2; y2 = other.y2;
- }
-
- /**
- *
- */
- virtual ~SVGPathSegCurvetoCubicSmoothRel() {}
-
-protected:
-
- double x, y, x2, y2;
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGPathSegCurvetoQuadraticSmoothAbs
-#########################################################################*/
-
-/**
- *
- */
-class SVGPathSegCurvetoQuadraticSmoothAbs : public SVGPathSeg
-{
-public:
-
- /**
- *
- */
- virtual double getX()
- { return x; }
-
- /**
- *
- */
- virtual void setX(double val) throw (DOMException)
- { x = val; }
-
- /**
- *
- */
- virtual double getY()
- { return y; }
-
- /**
- *
- */
- virtual void setY(double val) throw (DOMException)
- { y = val; }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGPathSegCurvetoQuadraticSmoothAbs()
- {
- type = PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS;
- x = y = 0.0;
- }
-
-
- /**
- *
- */
- SVGPathSegCurvetoQuadraticSmoothAbs(double xArg, double yArg)
- {
- type = PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS;
- x = xArg; y = yArg;
- }
-
- /**
- *
- */
- SVGPathSegCurvetoQuadraticSmoothAbs(const SVGPathSegCurvetoQuadraticSmoothAbs &other)
- : SVGPathSeg(other)
- {
- type = PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS;
- x = y = 0.0;
- }
-
- /**
- *
- */
- virtual ~SVGPathSegCurvetoQuadraticSmoothAbs() {}
-
-protected:
-
- double x, y;
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGPathSegCurvetoQuadraticSmoothRel
-#########################################################################*/
-
-/**
- *
- */
-class SVGPathSegCurvetoQuadraticSmoothRel : public SVGPathSeg
-{
-public:
-
- /**
- *
- */
- virtual double getX()
- { return x; }
-
- /**
- *
- */
- virtual void setX(double val) throw (DOMException)
- { x = val; }
-
- /**
- *
- */
- virtual double getY()
- { return y; }
-
- /**
- *
- */
- virtual void setY(double val) throw (DOMException)
- { y = val; }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGPathSegCurvetoQuadraticSmoothRel()
- {
- type = PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL;
- x = y = 0.0;
- }
-
-
- /**
- *
- */
- SVGPathSegCurvetoQuadraticSmoothRel(double xArg, double yArg)
- {
- type = PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL;
- x = xArg; y = yArg;
- }
-
- /**
- *
- */
- SVGPathSegCurvetoQuadraticSmoothRel(const SVGPathSegCurvetoQuadraticSmoothRel &other)
- : SVGPathSeg(other)
- {
- type = PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL;
- x = y = 0.0;
- }
-
- /**
- *
- */
- virtual ~SVGPathSegCurvetoQuadraticSmoothRel() {}
-
-protected:
-
- double x, y;
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGPathSegList
-#########################################################################*/
-
-/**
- *
- */
-class SVGPathSegList
-{
-public:
-
- /**
- *
- */
- virtual unsigned long getNumberOfItems()
- { return items.size(); }
-
-
- /**
- *
- */
- virtual void clear () throw( DOMException )
- { items.clear(); }
-
- /**
- *
- */
- virtual SVGPathSeg initialize (const SVGPathSeg &newItem)
- throw( DOMException, SVGException )
- {
- items.clear();
- items.push_back(newItem);
- return newItem;
- }
-
- /**
- *
- */
- virtual SVGPathSeg getItem (unsigned long index)
- throw( DOMException )
- {
- if (index >= items.size())
- {
- SVGPathSeg seg;
- return seg;
- }
- return items[index];
- }
-
- /**
- *
- */
- virtual SVGPathSeg insertItemBefore(const SVGPathSeg &newItem,
- unsigned long index )
- throw( DOMException, SVGException )
- {
- if (index >= items.size())
- items.push_back(newItem);
- else
- {
- std::vector<SVGPathSeg>::iterator iter = items.begin() + index;
- items.insert(iter, newItem);
- }
- return newItem;
- }
-
- /**
- *
- */
- virtual SVGPathSeg replaceItem(const SVGPathSeg &newItem,
- unsigned long index )
- throw( DOMException, SVGException )
- {
- if (index >= items.size())
- {
- SVGPathSeg seg;
- return seg;
- }
- std::vector<SVGPathSeg>::iterator iter = items.begin() + index;
- *iter = newItem;
- return newItem;
- }
-
- /**
- *
- */
- virtual SVGPathSeg removeItem (unsigned long index)
- throw (DOMException)
- {
- if (index >= items.size())
- {
- SVGPathSeg seg;
- return seg;
- }
- std::vector<SVGPathSeg>::iterator iter = items.begin() + index;
- SVGPathSeg olditem = *iter;
- items.erase(iter);
- return olditem;
- }
-
- /**
- *
- */
- virtual SVGPathSeg appendItem (const SVGPathSeg &newItem)
- throw( DOMException, SVGException )
- {
- items.push_back(newItem);
- return newItem;
- }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGPathSegList() {}
-
-
- /**
- *
- */
- SVGPathSegList(const SVGPathSegList &other)
- {
- items = other.items;
- }
-
-
- /**
- *
- */
- virtual ~SVGPathSegList() {}
-
-protected:
-
- std::vector<SVGPathSeg> items;
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGAnimatedPathData
-#########################################################################*/
-
-/**
- *
- */
-class SVGAnimatedPathData
-{
-public:
-
- /**
- *
- */
- virtual SVGPathSegList getPathSegList()
- {
- SVGPathSegList list;
- return list;
- }
-
- /**
- *
- */
- virtual SVGPathSegList getNormalizedPathSegList()
- {
- SVGPathSegList list;
- return list;
- }
-
- /**
- *
- */
- virtual SVGPathSegList getAnimatedPathSegList()
- {
- SVGPathSegList list;
- return list;
- }
-
- /**
- *
- */
- virtual SVGPathSegList getAnimatedNormalizedPathSegList()
- {
- SVGPathSegList list;
- return list;
- }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGAnimatedPathData()
- {}
-
- /**
- *
- */
- SVGAnimatedPathData(const SVGAnimatedPathData &other)
- {
- }
-
- /**
- *
- */
- virtual ~SVGAnimatedPathData() {}
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGAnimatedPoints
-#########################################################################*/
-
-/**
- *
- */
-class SVGAnimatedPoints
-{
-public:
-
- /**
- *
- */
- virtual SVGPointList getPoints()
- { return points; }
-
- /**
- *
- */
- virtual SVGPointList getAnimatedPoints()
- { return animatedPoints; }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGAnimatedPoints() {}
-
- /**
- *
- */
- SVGAnimatedPoints(const SVGAnimatedPoints &other)
- {
- points = other.points;
- animatedPoints = other.animatedPoints;
- }
-
- /**
- *
- */
- virtual ~SVGAnimatedPoints() {}
-
-protected:
-
- SVGPointList points;
- SVGPointList animatedPoints;
-
-};
-
-
-
-
-
-/*#########################################################################
-## SVGPaint
-#########################################################################*/
-
-/**
- *
- */
-class SVGPaint : public SVGColor
-{
-public:
-
-
- /**
- * Paint Types
- */
- typedef enum
- {
- SVG_PAINTTYPE_UNKNOWN = 0,
- SVG_PAINTTYPE_RGBCOLOR = 1,
- SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR = 2,
- SVG_PAINTTYPE_NONE = 101,
- SVG_PAINTTYPE_CURRENTCOLOR = 102,
- SVG_PAINTTYPE_URI_NONE = 103,
- SVG_PAINTTYPE_URI_CURRENTCOLOR = 104,
- SVG_PAINTTYPE_URI_RGBCOLOR = 105,
- SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR = 106,
- SVG_PAINTTYPE_URI = 107
- } PaintType;
-
-
- /**
- *
- */
- virtual unsigned short getPaintType()
- { return paintType; }
-
- /**
- *
- */
- virtual DOMString getUri()
- { return uri; }
-
- /**
- *
- */
- virtual void setUri (const DOMString& uriArg )
- { uri = uriArg; }
-
- /**
- *
- */
- virtual void setPaint (unsigned short paintTypeArg,
- const DOMString& uriArg,
- const DOMString& rgbColor,
- const DOMString& iccColor )
- throw( SVGException )
- {
- paintType = paintTypeArg;
- uri = uriArg;
- //do something with rgbColor
- //do something with iccColor;
- }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGPaint()
- {
- uri = "";
- paintType = SVG_PAINTTYPE_UNKNOWN;
- }
-
- /**
- *
- */
- SVGPaint(const SVGPaint &other) : css::CSSValue(other), SVGColor(other)
- {
- uri = "";
- paintType = SVG_PAINTTYPE_UNKNOWN;
- }
-
- /**
- *
- */
- virtual ~SVGPaint() {}
-
-protected:
-
- unsigned int paintType;
- DOMString uri;
-
-};
-
-
-
-
-/*#########################################################################
-## SVGColorProfileRule
-#########################################################################*/
-
-/**
- *
- */
-class SVGColorProfileRule : public SVGCSSRule,
- public SVGRenderingIntent
-{
-
-public:
- /**
- *
- */
- virtual DOMString getSrc()
- { return src; }
-
- /**
- *
- */
- virtual void setSrc(const DOMString &val) throw (DOMException)
- { src = val; }
-
- /**
- *
- */
- virtual DOMString getName()
- { return name; }
-
- /**
- *
- */
- virtual void setName(const DOMString &val) throw (DOMException)
- { name = val; }
-
- /**
- *
- */
- virtual unsigned short getRenderingIntent()
- { return renderingIntent; }
-
- /**
- *
- */
- virtual void setRenderingIntent(unsigned short val) throw (DOMException)
- { renderingIntent = val; }
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGColorProfileRule() {}
-
- /**
- *
- */
- SVGColorProfileRule(const SVGColorProfileRule &other)
- : SVGCSSRule(other), SVGRenderingIntent(other)
- {
- renderingIntent = other.renderingIntent;
- src = other.src;
- name = other.name;
- }
-
- /**
- *
- */
- virtual ~SVGColorProfileRule() {}
-
-protected:
-
- unsigned short renderingIntent;
- DOMString src;
- DOMString name;
-
-};
-
-
-
-/*#########################################################################
-## SVGFilterPrimitiveStandardAttributes
-#########################################################################*/
-
-/**
- *
- */
-class SVGFilterPrimitiveStandardAttributes : public SVGStylable
-{
-public:
-
-
-
- /**
- *
- */
- virtual SVGAnimatedLength getX()
- { return x; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getY()
- { return y; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getWidth()
- { return width; }
-
- /**
- *
- */
- virtual SVGAnimatedLength getHeight()
- { return height; }
-
- /**
- *
- */
- virtual SVGAnimatedString getResult()
- { return result; }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
-
- /**
- *
- */
- SVGFilterPrimitiveStandardAttributes()
- {}
-
- /**
- *
- */
- SVGFilterPrimitiveStandardAttributes(const SVGFilterPrimitiveStandardAttributes &other)
- : SVGStylable(other)
- {
- x = other.x;
- y = other.y;
- width = other.width;
- height = other.height;
- result = other.result;
- }
-
- /**
- *
- */
- virtual ~SVGFilterPrimitiveStandardAttributes() {}
-
-protected:
-
- SVGAnimatedLength x;
- SVGAnimatedLength y;
- SVGAnimatedLength width;
- SVGAnimatedLength height;
- SVGAnimatedString result;
-
-};
-
-
-
-
-
-
-
-
-
-
-
-/*#########################################################################
-## SVGEvent
-#########################################################################*/
-
-/**
- *
- */
-class SVGEvent : events::Event
-{
-public:
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGEvent() {}
-
- /**
- *
- */
- SVGEvent(const SVGEvent &other) : events::Event(other)
- {}
-
- /**
- *
- */
- virtual ~SVGEvent() {}
-
-};
-
-
-
-
-/*#########################################################################
-## SVGZoomEvent
-#########################################################################*/
-
-/**
- *
- */
-class SVGZoomEvent : events::UIEvent
-{
-public:
-
- /**
- *
- */
- virtual SVGRect getZoomRectScreen()
- { return zoomRectScreen; }
-
- /**
- *
- */
- virtual double getPreviousScale()
- { return previousScale; }
-
- /**
- *
- */
- virtual SVGPoint getPreviousTranslate()
- { return previousTranslate; }
-
- /**
- *
- */
- virtual double getNewScale()
- { return newScale; }
-
- /**
- *
- */
- virtual SVGPoint getNewTranslate()
- { return newTranslate; }
-
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGZoomEvent()
- {}
-
- /**
- *
- */
- SVGZoomEvent(const SVGZoomEvent &other) : events::Event(other),
- events::UIEvent(other)
- {
- zoomRectScreen = other.zoomRectScreen;
- previousScale = other.previousScale;
- previousTranslate = other.previousTranslate;
- newScale = other.newScale;
- newTranslate = other.newTranslate;
- }
-
- /**
- *
- */
- virtual ~SVGZoomEvent() {}
-
-protected:
-
- SVGRect zoomRectScreen;
- double previousScale;
- SVGPoint previousTranslate;
- double newScale;
- SVGPoint newTranslate;
-
-};
-
-
-
-/*#########################################################################
-## SVGElementInstance
-#########################################################################*/
-
-/**
- *
- */
-class SVGElementInstance : public events::EventTarget
-{
-public:
-
- /**
- *
- */
- virtual SVGElement *getCorrespondingElement()
- { return correspondingElement; }
-
- /**
- *
- */
- virtual SVGUseElement *getCorrespondingUseElement()
- { return correspondingUseElement; }
-
- /**
- *
- */
- virtual SVGElementInstance getParentNode()
- {
- SVGElementInstance ret;
- return ret;
- }
-
- /**
- * Since we are using stack types and this is a circular definition,
- * we will instead implement this as a global function below:
- * SVGElementInstanceList getChildNodes(const SVGElementInstance instance);
- */
- //virtual SVGElementInstanceList getChildNodes();
-
- /**
- *
- */
- virtual SVGElementInstance getFirstChild()
- {
- SVGElementInstance ret;
- return ret;
- }
-
- /**
- *
- */
- virtual SVGElementInstance getLastChild()
- {
- SVGElementInstance ret;
- return ret;
- }
-
- /**
- *
- */
- virtual SVGElementInstance getPreviousSibling()
- {
- SVGElementInstance ret;
- return ret;
- }
-
- /**
- *
- */
- virtual SVGElementInstance getNextSibling()
- {
- SVGElementInstance ret;
- return ret;
- }
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGElementInstance() {}
-
- /**
- *
- */
- SVGElementInstance(const SVGElementInstance &other)
- : events::EventTarget(other)
- {
- }
-
- /**
- *
- */
- virtual ~SVGElementInstance() {}
-
-protected:
-
- SVGElement *correspondingElement;
- SVGUseElement *correspondingUseElement;
-
-};
-
-
-
-
-
-
-/*#########################################################################
-## SVGElementInstanceList
-#########################################################################*/
-
-/**
- *
- */
-class SVGElementInstanceList
-{
-public:
-
-
- /**
- *
- */
- virtual unsigned long getLength()
- { return items.size(); }
-
- /**
- *
- */
- virtual SVGElementInstance item (unsigned long index )
- {
- if (index >= items.size())
- {
- SVGElementInstance ret;
- return ret;
- }
- return items[index];
- }
-
- /**
- * This static method replaces the circular definition of:
- * SVGElementInstanceList SVGElementInstance::getChildNodes()
- *
- */
- static SVGElementInstanceList getChildNodes(const SVGElementInstance &instance)
- {
- SVGElementInstanceList list;
- return list;
- }
-
-
- //##################
- //# Non-API methods
- //##################
-
- /**
- *
- */
- SVGElementInstanceList() {}
-
- /**
- *
- */
- SVGElementInstanceList(const SVGElementInstanceList &other)
- {
- items = other.items;
- }
-
- /**
- *
- */
- virtual ~SVGElementInstanceList() {}
-
-protected:
-
- std::vector<SVGElementInstance> items;
-
-
-};
-
-
-
-
-
-
-
-
-
-
-
-
-
-} //namespace svg
-} //namespace dom
-} //namespace w3c
-} //namespace org
-
-#endif /* __SVGTYPES_H__ */
-/*#########################################################################
-## E N D O F F I L E
-#########################################################################*/
-
+#ifndef __SVGTYPES_H__
+#define __SVGTYPES_H__
+
+/**
+ * Phoebe DOM Implementation.
+ *
+ * This is a C++ approximation of the W3C DOM model, which follows
+ * fairly closely the specifications in the various .idl files, copies of
+ * which are provided for reference. Most important is this one:
+ *
+ * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
+ *
+ * Authors:
+ * Bob Jamison
+ *
+ * Copyright (C) 2006 Bob Jamison
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+// For access to DOM2 core
+#include "dom/dom.h"
+
+// For access to DOM2 events
+#include "dom/events.h"
+
+// For access to those parts from DOM2 CSS OM used by SVG DOM.
+#include "dom/css.h"
+
+// For access to those parts from DOM2 Views OM used by SVG DOM.
+#include "dom/views.h"
+
+// For access to the SMIL OM used by SVG DOM.
+#include "dom/smil.h"
+
+
+#include <math.h>
+
+
+
+namespace org {
+namespace w3c {
+namespace dom {
+namespace svg {
+
+
+
+
+//local definitions
+typedef dom::DOMString DOMString;
+typedef dom::DOMException DOMException;
+typedef dom::Element Element;
+typedef dom::Document Document;
+typedef dom::NodeList NodeList;
+
+
+class SVGElement;
+class SVGUseElement;
+class SVGAnimatedPreserveAspectRatio;
+
+
+/*#########################################################################
+## SVGException
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGException
+{
+public:
+ // unsigned short code; //inherited
+};
+
+ /**
+ * SVGExceptionCode
+ */
+ typedef enum
+ {
+ SVG_WRONG_TYPE_ERR = 0,
+ SVG_INVALID_VALUE_ERR = 1,
+ SVG_MATRIX_NOT_INVERTABLE = 2
+ } SVGExceptionCode;
+
+
+
+
+
+/*#########################################################################
+## SVGMatrix
+#########################################################################*/
+
+/**
+ * In SVG, a Matrix is defined like this:
+ *
+ * | a c e |
+ * | b d f |
+ * | 0 0 1 |
+ *
+ */
+class SVGMatrix
+{
+public:
+
+
+ /**
+ *
+ */
+ virtual double getA()
+ { return a; }
+
+ /**
+ *
+ */
+ virtual void setA(double val) throw (DOMException)
+ { a = val; }
+
+ /**
+ *
+ */
+ virtual double getB()
+ { return b; }
+
+ /**
+ *
+ */
+ virtual void setB(double val) throw (DOMException)
+ { b = val; }
+
+ /**
+ *
+ */
+ virtual double getC()
+ { return c; }
+
+ /**
+ *
+ */
+ virtual void setC(double val) throw (DOMException)
+ { c = val; }
+
+ /**
+ *
+ */
+ virtual double getD()
+ { return d; }
+
+ /**
+ *
+ */
+ virtual void setD(double val) throw (DOMException)
+ { d = val; }
+ /**
+ *
+ */
+ virtual double getE()
+ { return e; }
+
+ /**
+ *
+ */
+ virtual void setE(double val) throw (DOMException)
+ { e = val; }
+ /**
+ *
+ */
+ virtual double getF()
+ { return f; }
+
+ /**
+ *
+ */
+ virtual void setF(double val) throw (DOMException)
+ { f = val; }
+
+
+ /**
+ * Return the result of postmultiplying this matrix with another.
+ */
+ virtual SVGMatrix multiply(const SVGMatrix &other)
+ {
+ SVGMatrix result;
+ result.a = a * other.a + c * other.b;
+ result.b = b * other.a + d * other.b;
+ result.c = a * other.c + c * other.d;
+ result.d = b * other.c + d * other.d;
+ result.e = a * other.e + c * other.f + e;
+ result.f = b * other.e + d * other.f + f;
+ return result;
+ }
+
+ /**
+ * Calculate the inverse of this matrix
+ *
+ */
+ virtual SVGMatrix inverse( ) throw( SVGException )
+ {
+ /*###########################################
+ The determinant of a 3x3 matrix E
+ (let's use our own notation for a bit)
+
+ A B C
+ D E F
+ G H I
+ is
+ AEI - AFH - BDI + BFG + CDH - CEG
+
+ Since in our affine transforms, G and H==0 and I==1,
+ this reduces to:
+ AE - BD
+ In SVG's naming scheme, that is: a * d - c * b . SIMPLE!
+
+ In a similar method of attack, SVG's adjunct matrix is:
+
+ d -c cf-ed
+ -b a eb-af
+ 0 0 ad-cb
+
+ To get the inverse matrix, we divide the adjunct matrix by
+ the determinant. Notice that (ad-cb)/(ad-cb)==1. Very cool.
+ So what we end up with is this:
+
+ a = d/(ad-cb) c = -c/(ad-cb) e = (cf-ed)/(ad-cb)
+ b = -b/(ad-cb) d = a/(ad-cb) f = (eb-af)/(ad-cb)
+
+ (Since this would be in all SVG-DOM implementations,
+ somebody needed to document this! ^^ )
+ #############################################*/
+
+ SVGMatrix result;
+ double determinant = a * d - c * b;
+ if (determinant < 1.0e-18)//invertible?
+ {
+ result.identity();//cop out
+ return result;
+ }
+
+ double idet = 1.0 / determinant;
+ result.a = d * idet;
+ result.b = -b * idet;
+ result.c = -c * idet;
+ result.d = a * idet;
+ result.e = (c*f - e*d) * idet;
+ result.f = (e*b - a*f) * idet;
+ return result;
+ }
+
+ /**
+ * Equivalent to multiplying by:
+ * | 1 0 x |
+ * | 0 1 y |
+ * | 0 0 1 |
+ *
+ */
+ virtual SVGMatrix translate(double x, double y )
+ {
+ SVGMatrix result;
+ result.a = a;
+ result.b = b;
+ result.c = c;
+ result.d = d;
+ result.e = a * x + c * y + e;
+ result.f = b * x + d * y + f;
+ return result;
+ }
+
+ /**
+ * Equivalent to multiplying by:
+ * | scale 0 0 |
+ * | 0 scale 0 |
+ * | 0 0 1 |
+ *
+ */
+ virtual SVGMatrix scale(double scale)
+ {
+ SVGMatrix result;
+ result.a = a * scale;
+ result.b = b * scale;
+ result.c = c * scale;
+ result.d = d * scale;
+ result.e = e;
+ result.f = f;
+ return result;
+ }
+
+ /**
+ * Equivalent to multiplying by:
+ * | scaleX 0 0 |
+ * | 0 scaleY 0 |
+ * | 0 0 1 |
+ *
+ */
+ virtual SVGMatrix scaleNonUniform(double scaleX,
+ double scaleY )
+ {
+ SVGMatrix result;
+ result.a = a * scaleX;
+ result.b = b * scaleX;
+ result.c = c * scaleY;
+ result.d = d * scaleY;
+ result.e = e;
+ result.f = f;
+ return result;
+ }
+
+ /**
+ * Equivalent to multiplying by:
+ * | cos(a) -sin(a) 0 |
+ * | sin(a) cos(a) 0 |
+ * | 0 0 1 |
+ *
+ */
+ virtual SVGMatrix rotate (double angle)
+ {
+ double sina = sin(angle);
+ double msina = -sina;
+ double cosa = cos(angle);
+ SVGMatrix result;
+ result.a = a * cosa + c * sina;
+ result.b = b * cosa + d + sina;
+ result.c = a * msina + c * cosa;
+ result.d = b * msina + d * cosa;
+ result.e = e;
+ result.f = f;
+ return result;
+ }
+
+ /**
+ * Equivalent to multiplying by:
+ * | cos(a) -sin(a) 0 |
+ * | sin(a) cos(a) 0 |
+ * | 0 0 1 |
+ * In this case, angle 'a' is computed as the artangent
+ * of the slope y/x . It is negative if the slope is negative.
+ */
+ virtual SVGMatrix rotateFromVector(double x, double y)
+ throw( SVGException )
+ {
+ double angle = atan(y / x);
+ if (y < 0.0)
+ angle = -angle;
+ SVGMatrix result;
+ double sina = sin(angle);
+ double msina = -sina;
+ double cosa = cos(angle);
+ result.a = a * cosa + c * sina;
+ result.b = b * cosa + d + sina;
+ result.c = a * msina + c * cosa;
+ result.d = b * msina + d * cosa;
+ result.e = e;
+ result.f = f;
+ return result;
+ }
+
+ /**
+ * Equivalent to multiplying by:
+ * | -1 0 0 |
+ * | 0 1 0 |
+ * | 0 0 1 |
+ *
+ */
+ virtual SVGMatrix flipX( )
+ {
+ SVGMatrix result;
+ result.a = -a;
+ result.b = -b;
+ result.c = c;
+ result.d = d;
+ result.e = e;
+ result.f = f;
+ return result;
+ }
+
+ /**
+ * Equivalent to multiplying by:
+ * | 1 0 0 |
+ * | 0 -1 0 |
+ * | 0 0 1 |
+ *
+ */
+ virtual SVGMatrix flipY( )
+ {
+ SVGMatrix result;
+ result.a = a;
+ result.b = b;
+ result.c = -c;
+ result.d = -d;
+ result.e = e;
+ result.f = f;
+ return result;
+ }
+
+ /**
+ * | 1 tan(a) 0 |
+ * | 0 1 0 |
+ * | 0 0 1 |
+ *
+ */
+ virtual SVGMatrix skewX(double angle)
+ {
+ double tana = tan(angle);
+ SVGMatrix result;
+ result.a = a;
+ result.b = b;
+ result.c = a * tana + c;
+ result.d = b * tana + d;
+ result.e = e;
+ result.f = f;
+ return result;
+ }
+
+ /**
+ * Equivalent to multiplying by:
+ * | 1 0 0 |
+ * | tan(a) 1 0 |
+ * | 0 0 1 |
+ *
+ */
+ virtual SVGMatrix skewY(double angle)
+ {
+ double tana = tan(angle);
+ SVGMatrix result;
+ result.a = a + c * tana;
+ result.b = b + d * tana;
+ result.c = c;
+ result.d = d;
+ result.e = e;
+ result.f = f;
+ return result;
+ }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGMatrix()
+ {
+ identity();
+ }
+
+ /**
+ *
+ */
+ SVGMatrix(double aArg, double bArg, double cArg,
+ double dArg, double eArg, double fArg )
+ {
+ a = aArg; b = bArg; c = cArg;
+ d = dArg; e = eArg; f = fArg;
+ }
+
+ /**
+ * Copy constructor
+ */
+ SVGMatrix(const SVGMatrix &other)
+ {
+ a = other.a;
+ b = other.b;
+ c = other.c;
+ d = other.d;
+ e = other.e;
+ f = other.f;
+ }
+
+
+
+ /**
+ *
+ */
+ virtual ~SVGMatrix() {}
+
+protected:
+
+friend class SVGTransform;
+
+ /*
+ * Set to the identify matrix
+ */
+ void identity()
+ {
+ a = 1.0;
+ b = 0.0;
+ c = 0.0;
+ d = 1.0;
+ e = 0.0;
+ f = 0.0;
+ }
+
+ double a, b, c, d, e, f;
+
+};
+
+
+/*#########################################################################
+## SVGTransform
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGTransform
+{
+public:
+
+ /**
+ * Transform Types
+ */
+ typedef enum
+ {
+ SVG_TRANSFORM_UNKNOWN = 0,
+ SVG_TRANSFORM_MATRIX = 1,
+ SVG_TRANSFORM_TRANSLATE = 2,
+ SVG_TRANSFORM_SCALE = 3,
+ SVG_TRANSFORM_ROTATE = 4,
+ SVG_TRANSFORM_SKEWX = 5,
+ SVG_TRANSFORM_SKEWY = 6,
+ } TransformType;
+
+ /**
+ *
+ */
+ virtual unsigned short getType()
+ { return type; }
+
+
+ /**
+ *
+ */
+ virtual SVGMatrix getMatrix()
+ {
+ return matrix;
+ }
+
+ /**
+ *
+ */
+ virtual double getAngle()
+ {
+ return angle;
+ }
+
+
+ /**
+ *
+ */
+ virtual void setMatrix(const SVGMatrix &matrixArg)
+ {
+ type = SVG_TRANSFORM_MATRIX;
+ matrix = matrixArg;
+ }
+
+ /**
+ *
+ */
+ virtual void setTranslate (double tx, double ty )
+ {
+ type = SVG_TRANSFORM_TRANSLATE;
+ matrix.setA(1.0);
+ matrix.setB(0.0);
+ matrix.setC(0.0);
+ matrix.setD(1.0);
+ matrix.setE(tx);
+ matrix.setF(ty);
+ }
+
+ /**
+ *
+ */
+ virtual void setScale (double sx, double sy )
+ {
+ type = SVG_TRANSFORM_SCALE;
+ matrix.setA(sx);
+ matrix.setB(0.0);
+ matrix.setC(0.0);
+ matrix.setD(sy);
+ matrix.setE(0.0);
+ matrix.setF(0.0);
+ }
+
+ /**
+ *
+ */
+ virtual void setRotate (double angleArg, double cx, double cy)
+ {
+ angle = angleArg;
+ setTranslate(cx, cy);
+ type = SVG_TRANSFORM_ROTATE;
+ matrix.rotate(angle);
+ }
+
+ /**
+ *
+ */
+ virtual void setSkewX (double angleArg)
+ {
+ angle = angleArg;
+ type = SVG_TRANSFORM_SKEWX;
+ matrix.identity();
+ matrix.skewX(angle);
+ }
+
+ /**
+ *
+ */
+ virtual void setSkewY (double angleArg)
+ {
+ angle = angleArg;
+ type = SVG_TRANSFORM_SKEWY;
+ matrix.identity();
+ matrix.skewY(angle);
+ }
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGTransform()
+ {
+ type = SVG_TRANSFORM_UNKNOWN;
+ angle = 0.0;
+ }
+
+ /**
+ *
+ */
+ SVGTransform(const SVGTransform &other)
+ {
+ type = other.type;
+ angle = other.angle;
+ matrix = other.matrix;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGTransform()
+ {}
+
+protected:
+
+ int type;
+ double angle;
+
+ SVGMatrix matrix;
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGTransformList
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGTransformList
+{
+public:
+
+
+ /**
+ *
+ */
+ virtual unsigned long getNumberOfItems()
+ { return items.size(); }
+
+
+ /**
+ *
+ */
+ virtual void clear( ) throw( DOMException )
+ { items.clear(); }
+
+ /**
+ *
+ */
+ virtual SVGTransform initialize (const SVGTransform &newItem)
+ throw( DOMException, SVGException )
+ {
+ items.clear();
+ items.push_back(newItem);
+ return newItem;
+ }
+
+ /**
+ *
+ */
+ virtual SVGTransform getItem (unsigned long index )
+ throw( DOMException )
+ {
+ if (index>=items.size())
+ {
+ SVGTransform transform;
+ return transform;
+ }
+ return items[index];
+ }
+
+ /**
+ *
+ */
+ virtual SVGTransform insertItemBefore (const SVGTransform &newItem,
+ unsigned long index )
+ throw( DOMException, SVGException )
+ {
+ if (index > items.size())
+ items.push_back(newItem);
+ else
+ {
+ std::vector<SVGTransform>::iterator iter = items.begin() + index;
+ items.insert(iter, newItem);
+ }
+ return newItem;
+ }
+
+ /**
+ *
+ */
+ virtual SVGTransform replaceItem (const SVGTransform &newItem,
+ unsigned long index )
+ throw( DOMException, SVGException )
+ {
+ if (index>=items.size())
+ {
+ SVGTransform transform;
+ return transform;
+ }
+ else
+ {
+ std::vector<SVGTransform>::iterator iter = items.begin() + index;
+ *iter = newItem;
+ }
+ return newItem;
+ }
+
+ /**
+ *
+ */
+ virtual SVGTransform removeItem (unsigned long index )
+ throw( DOMException )
+ {
+ if (index>=items.size())
+ {
+ SVGTransform transform;
+ return transform;
+ }
+ std::vector<SVGTransform>::iterator iter = items.begin() + index;
+ SVGTransform oldItem = *iter;
+ items.erase(iter);
+ return oldItem;
+ }
+
+ /**
+ *
+ */
+ virtual SVGTransform appendItem (const SVGTransform &newItem)
+ throw( DOMException, SVGException )
+ {
+ items.push_back(newItem);
+ return newItem;
+ }
+
+ /**
+ *
+ */
+ virtual SVGTransform createSVGTransformFromMatrix(const SVGMatrix &matrix)
+ {
+ SVGTransform transform;
+ transform.setMatrix(matrix);
+ return transform;
+ }
+
+ /**
+ *
+ */
+ virtual SVGTransform consolidate()
+ {
+ SVGMatrix matrix;
+ for (unsigned int i=0 ; i<items.size() ; i++)
+ matrix = matrix.multiply(items[i].getMatrix());
+ SVGTransform transform;
+ transform.setMatrix(matrix);
+ items.clear();
+ items.push_back(transform);
+ return transform;
+ }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGTransformList()
+ {}
+
+ /**
+ *
+ */
+ SVGTransformList(const SVGTransformList &other)
+ {
+ items = other.items;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGTransformList() {}
+
+protected:
+
+ std::vector<SVGTransform> items;
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGAnimatedTransformList
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGAnimatedTransformList
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGTransformList getBaseVal()
+ { return baseVal; }
+
+ /**
+ *
+ */
+ virtual SVGTransformList getAnimVal()
+ { return animVal; }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGAnimatedTransformList()
+ {}
+
+ /**
+ *
+ */
+ SVGAnimatedTransformList(const SVGAnimatedTransformList &other)
+ {
+ baseVal = other.baseVal;
+ animVal = other.animVal;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGAnimatedTransformList() {}
+
+protected:
+
+ SVGTransformList baseVal;
+ SVGTransformList animVal;
+
+};
+
+
+
+
+/*#########################################################################
+## SVGAnimatedBoolean
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGAnimatedBoolean
+{
+public:
+
+ /**
+ *
+ */
+ virtual bool getBaseVal()
+ {
+ return baseVal;
+ }
+
+ /**
+ *
+ */
+ virtual void setBaseVal(bool val) throw (DOMException)
+ {
+ baseVal = val;
+ }
+
+ /**
+ *
+ */
+ virtual bool getAnimVal()
+ {
+ return animVal;
+ }
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGAnimatedBoolean()
+ {
+ baseVal = animVal = false;
+ }
+
+ /**
+ *
+ */
+ SVGAnimatedBoolean(const SVGAnimatedBoolean &other)
+ {
+ baseVal = other.baseVal;
+ animVal = other.animVal;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGAnimatedBoolean() {}
+
+protected:
+
+ bool baseVal, animVal;
+
+};
+
+
+
+
+/*#########################################################################
+## SVGAnimatedString
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGAnimatedString
+{
+public:
+
+ /**
+ *
+ */
+ virtual DOMString getBaseVal()
+ {
+ return baseVal;
+ }
+
+ /**
+ *
+ */
+ virtual void setBaseVal(const DOMString &val)
+ throw (DOMException)
+ {
+ baseVal = val;
+ }
+
+ /**
+ *
+ */
+ virtual DOMString getAnimVal()
+ {
+ return animVal;
+ }
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+
+ /**
+ *
+ */
+ SVGAnimatedString()
+ {
+ baseVal = "";
+ animVal = "";
+ }
+
+ /**
+ *
+ */
+ SVGAnimatedString(const SVGAnimatedString &other)
+ {
+ baseVal = other.baseVal;
+ animVal = other.animVal;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGAnimatedString() {}
+
+protected:
+
+ DOMString baseVal, animVal;
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGStringList
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGStringList
+{
+public:
+
+
+ /**
+ *
+ */
+ virtual unsigned long getNumberOfItems()
+ {
+ return items.size();
+ }
+
+ /**
+ *
+ */
+ virtual void clear () throw( DOMException )
+ {
+ items.clear();
+ }
+
+ /**
+ *
+ */
+ virtual DOMString initialize ( const DOMString& newItem )
+ throw( DOMException, SVGException )
+ {
+ items.clear();
+ items.push_back(newItem);
+ return newItem;
+ }
+
+ /**
+ *
+ */
+ virtual DOMString getItem ( unsigned long index )
+ throw( DOMException )
+ {
+ if (index >= items.size())
+ return "";
+ return items[index];
+ }
+
+ /**
+ *
+ */
+ virtual DOMString insertItemBefore ( const DOMString& newItem,
+ unsigned long index )
+ throw( DOMException, SVGException )
+ {
+ if (index>=items.size())
+ {
+ items.push_back(newItem);
+ }
+ else
+ {
+ std::vector<DOMString>::iterator iter = items.begin() + index;
+ items.insert(iter, newItem);
+ }
+ return newItem;
+ }
+
+ /**
+ *
+ */
+ virtual DOMString replaceItem ( const DOMString& newItem,
+ unsigned long index )
+ throw( DOMException, SVGException )
+ {
+ if (index>=items.size())
+ return "";
+ std::vector<DOMString>::iterator iter = items.begin() + index;
+ *iter = newItem;
+ return newItem;
+ }
+
+ /**
+ *
+ */
+ virtual DOMString removeItem ( unsigned long index )
+ throw( DOMException )
+ {
+ if (index>=items.size())
+ return "";
+ std::vector<DOMString>::iterator iter = items.begin() + index;
+ DOMString oldstr = *iter;
+ items.erase(iter);
+ return oldstr;
+ }
+
+ /**
+ *
+ */
+ virtual DOMString appendItem ( const DOMString& newItem )
+ throw( DOMException, SVGException )
+ {
+ items.push_back(newItem);
+ return newItem;
+ }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGStringList() {}
+
+ /**
+ *
+ */
+ SVGStringList(const SVGStringList &other)
+ {
+ items = other.items;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGStringList() {}
+
+protected:
+
+ std::vector<DOMString>items;
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGAnimatedEnumeration
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGAnimatedEnumeration
+{
+public:
+
+ /**
+ *
+ */
+ virtual unsigned short getBaseVal()
+ {
+ return baseVal;
+ }
+
+ /**
+ *
+ */
+ virtual void setBaseVal(unsigned short val)
+ throw (DOMException)
+ {
+ baseVal = val;
+ }
+
+ /**
+ *
+ */
+ virtual unsigned short getAnimVal()
+ {
+ return animVal;
+ }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+
+ /**
+ *
+ */
+ SVGAnimatedEnumeration()
+ {
+ baseVal = animVal = 0;
+ }
+
+ /**
+ *
+ */
+ SVGAnimatedEnumeration(const SVGAnimatedEnumeration &other)
+ {
+ baseVal = other.baseVal;
+ animVal = other.animVal;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGAnimatedEnumeration() {}
+
+protected:
+
+ int baseVal, animVal;
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGAnimatedInteger
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGAnimatedInteger
+{
+public:
+
+
+ /**
+ *
+ */
+ virtual long getBaseVal()
+ {
+ return baseVal;
+ }
+
+ /**
+ *
+ */
+ virtual void setBaseVal(long val) throw (DOMException)
+ {
+ baseVal = val;
+ }
+
+ /**
+ *
+ */
+ virtual long getAnimVal()
+ {
+ return animVal;
+ }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+
+ /**
+ *
+ */
+ SVGAnimatedInteger()
+ { baseVal = animVal = 0L;}
+
+
+ /**
+ *
+ */
+ SVGAnimatedInteger(long value)
+ {
+ baseVal = value;
+ animVal = 0L;
+ }
+
+ /**
+ *
+ */
+ SVGAnimatedInteger(long baseValArg, long animValArg)
+ {
+ baseVal = baseValArg;
+ animVal = animValArg;
+ }
+
+
+ /**
+ *
+ */
+ SVGAnimatedInteger(const SVGAnimatedInteger &other)
+ {
+ baseVal = other.baseVal;
+ animVal = other.animVal;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGAnimatedInteger() {}
+
+protected:
+
+ long baseVal, animVal;
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGNumber
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGNumber
+{
+public:
+
+
+ /**
+ *
+ */
+ virtual double getValue()
+ {
+ return value;
+ }
+
+ /**
+ *
+ */
+ virtual void setValue(double val) throw (DOMException)
+ {
+ value = val;
+ }
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGNumber()
+ {
+ value = 0.0;
+ }
+
+ /**
+ *
+ */
+ SVGNumber(const SVGNumber &other)
+ {
+ value = other.value;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGNumber() {}
+
+protected:
+
+ double value;
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGAnimatedNumber
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGAnimatedNumber
+{
+public:
+
+
+
+ /**
+ *
+ */
+ virtual double getBaseVal()
+ {
+ return baseVal;
+ }
+
+ /**
+ *
+ */
+ virtual void setBaseVal(double val) throw (DOMException)
+ {
+ baseVal = val;
+ }
+
+ /**
+ *
+ */
+ virtual double getAnimVal()
+ {
+ return animVal;
+ }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGAnimatedNumber()
+ {
+ baseVal = animVal = 0.0;
+ }
+
+
+ /**
+ *
+ */
+ SVGAnimatedNumber(double val)
+ {
+ baseVal = val;
+ animVal = 0.0;
+ }
+
+
+ /**
+ *
+ */
+ SVGAnimatedNumber(double baseValArg, double animValArg)
+ {
+ baseVal = baseValArg;
+ animVal = animValArg;
+ }
+
+ /**
+ *
+ */
+ SVGAnimatedNumber(const SVGAnimatedNumber &other)
+ {
+ baseVal = other.baseVal;
+ animVal = other.animVal;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGAnimatedNumber() {}
+
+protected:
+
+ double baseVal, animVal;
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGNumberList
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGNumberList
+{
+public:
+
+ /**
+ *
+ */
+ virtual unsigned long getNumberOfItems()
+ {
+ return items.size();
+ }
+
+
+ /**
+ *
+ */
+ virtual void clear() throw( DOMException )
+ {
+ items.clear();
+ }
+
+ /**
+ *
+ */
+ virtual SVGNumber initialize (const SVGNumber &newItem)
+ throw( DOMException, SVGException )
+ {
+ items.clear();
+ items.push_back(newItem);
+ return newItem;
+ }
+
+ /**
+ *
+ */
+ virtual SVGNumber getItem ( unsigned long index )
+ throw( DOMException )
+ {
+ if (index>=items.size())
+ {
+ SVGNumber num;
+ return num;
+ }
+ return items[index];
+ }
+
+ /**
+ *
+ */
+ virtual SVGNumber insertItemBefore ( const SVGNumber &newItem,
+ unsigned long index )
+ throw( DOMException, SVGException )
+ {
+ if (index>=items.size())
+ {
+ items.push_back(newItem);
+ }
+ else
+ {
+ std::vector<SVGNumber>::iterator iter = items.begin() + index;
+ items.insert(iter, newItem);
+ }
+ return newItem;
+ }
+
+ /**
+ *
+ */
+ virtual SVGNumber replaceItem ( const SVGNumber &newItem,
+ unsigned long index )
+ throw( DOMException, SVGException )
+ {
+ if (index>=items.size())
+ {
+ SVGNumber num;
+ return num;
+ }
+ std::vector<SVGNumber>::iterator iter = items.begin() + index;
+ *iter = newItem;
+ return newItem;
+ }
+
+ /**
+ *
+ */
+ virtual SVGNumber removeItem ( unsigned long index )
+ throw( DOMException )
+ {
+ if (index>=items.size())
+ {
+ SVGNumber num;
+ return num;
+ }
+ std::vector<SVGNumber>::iterator iter = items.begin() + index;
+ SVGNumber oldval = *iter;
+ items.erase(iter);
+ return oldval;
+ }
+
+ /**
+ *
+ */
+ virtual SVGNumber appendItem ( const SVGNumber &newItem )
+ throw( DOMException, SVGException )
+ {
+ items.push_back(newItem);
+ return newItem;
+ }
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGNumberList() {}
+
+ /**
+ *
+ */
+ SVGNumberList(const SVGNumberList &other)
+ {
+ items = other.items;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGNumberList() {}
+
+protected:
+
+ std::vector<SVGNumber>items;
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGAnimatedNumberList
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGAnimatedNumberList
+{
+public:
+
+
+ /**
+ *
+ */
+ virtual SVGNumberList &getBaseVal()
+ {
+ return baseVal;
+ }
+
+ /**
+ *
+ */
+ virtual SVGNumberList &getAnimVal()
+ {
+ return animVal;
+ }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGAnimatedNumberList() {}
+
+ /**
+ *
+ */
+ SVGAnimatedNumberList(const SVGAnimatedNumberList &other)
+ {
+ baseVal = other.baseVal;
+ animVal = other.animVal;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGAnimatedNumberList() {}
+
+protected:
+
+ SVGNumberList baseVal;
+ SVGNumberList animVal;
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGLength
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGLength
+{
+public:
+
+ /**
+ * Length Unit Types
+ */
+ typedef enum
+ {
+ SVG_LENGTHTYPE_UNKNOWN = 0,
+ SVG_LENGTHTYPE_NUMBER = 1,
+ SVG_LENGTHTYPE_PERCENTAGE = 2,
+ SVG_LENGTHTYPE_EMS = 3,
+ SVG_LENGTHTYPE_EXS = 4,
+ SVG_LENGTHTYPE_PX = 5,
+ SVG_LENGTHTYPE_CM = 6,
+ SVG_LENGTHTYPE_MM = 7,
+ SVG_LENGTHTYPE_IN = 8,
+ SVG_LENGTHTYPE_PT = 9,
+ SVG_LENGTHTYPE_PC = 10
+ } LengthUnitType;
+
+
+ /**
+ *
+ */
+ virtual unsigned short getUnitType( )
+ {
+ return unitType;
+ }
+
+ /**
+ *
+ */
+ virtual double getValue( )
+ {
+ return value;
+ }
+
+ /**
+ *
+ */
+ virtual void setValue( double val ) throw (DOMException)
+ {
+ value = val;
+ }
+
+ /**
+ *
+ */
+ virtual double getValueInSpecifiedUnits( )
+ {
+ double result = 0.0;
+ //fill this in
+ return result;
+ }
+
+ /**
+ *
+ */
+ virtual void setValueInSpecifiedUnits( double val )
+ throw (DOMException)
+ {
+ //fill this in
+ }
+
+ /**
+ *
+ */
+ virtual DOMString getValueAsString( )
+ {
+ DOMString ret;
+ char buf[32];
+ snprintf(buf, 31, "%f", value);
+ ret.append(buf);
+ return ret;
+ }
+
+ /**
+ *
+ */
+ virtual void setValueAsString( const DOMString& val )
+ throw (DOMException)
+ {
+ }
+
+
+ /**
+ *
+ */
+ virtual void newValueSpecifiedUnits ( unsigned short unitType, double val )
+ {
+ }
+
+ /**
+ *
+ */
+ virtual void convertToSpecifiedUnits ( unsigned short unitType )
+ {
+ }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGLength()
+ {
+ unitType = SVG_LENGTHTYPE_UNKNOWN;
+ value = 0.0;
+ }
+
+
+ /**
+ *
+ */
+ SVGLength(const SVGLength &other)
+ {
+ unitType = other.unitType;
+ value = other.value;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGLength() {}
+
+protected:
+
+ int unitType;
+
+ double value;
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGAnimatedLength
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGAnimatedLength
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGLength &getBaseVal()
+ {
+ return baseVal;
+ }
+
+ /**
+ *
+ */
+ virtual SVGLength &getAnimVal()
+ {
+ return animVal;
+ }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGAnimatedLength() {}
+
+ /**
+ *
+ */
+ SVGAnimatedLength(const SVGAnimatedLength &other)
+ {
+ baseVal = other.baseVal;
+ animVal = other.animVal;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGAnimatedLength() {}
+
+protected:
+
+ SVGLength baseVal, animVal;
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGLengthList
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGLengthList
+{
+public:
+
+ /**
+ *
+ */
+ virtual unsigned long getNumberOfItems()
+ {
+ return items.size();
+ }
+
+
+ /**
+ *
+ */
+ virtual void clear ( ) throw( DOMException )
+ {
+ items.clear();
+ }
+
+ /**
+ *
+ */
+ virtual SVGLength initialize (const SVGLength &newItem )
+ throw( DOMException, SVGException )
+ {
+ items.clear();
+ items.push_back(newItem);
+ return newItem;
+ }
+
+ /**
+ *
+ */
+ virtual SVGLength getItem (unsigned long index)
+ throw( DOMException )
+ {
+ if (index>=items.size())
+ {
+ SVGLength ret;
+ return ret;
+ }
+ return items[index];
+ }
+
+ /**
+ *
+ */
+ virtual SVGLength insertItemBefore (const SVGLength &newItem,
+ unsigned long index )
+ throw( DOMException, SVGException )
+ {
+ if (index>=items.size())
+ {
+ items.push_back(newItem);
+ }
+ else
+ {
+ std::vector<SVGLength>::iterator iter = items.begin() + index;
+ items.insert(iter, newItem);
+ }
+ return newItem;
+ }
+
+ /**
+ *
+ */
+ virtual SVGLength replaceItem (const SVGLength &newItem,
+ unsigned long index )
+ throw( DOMException, SVGException )
+ {
+ if (index>=items.size())
+ {
+ SVGLength ret;
+ return ret;
+ }
+ std::vector<SVGLength>::iterator iter = items.begin() + index;
+ *iter = newItem;
+ return newItem;
+ }
+
+ /**
+ *
+ */
+ virtual SVGLength removeItem (unsigned long index )
+ throw( DOMException )
+ {
+ if (index>=items.size())
+ {
+ SVGLength ret;
+ return ret;
+ }
+ std::vector<SVGLength>::iterator iter = items.begin() + index;
+ SVGLength oldval = *iter;
+ items.erase(iter);
+ return oldval;
+ }
+
+ /**
+ *
+ */
+ virtual SVGLength appendItem (const SVGLength &newItem )
+ throw( DOMException, SVGException )
+ {
+ items.push_back(newItem);
+ return newItem;
+ }
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGLengthList() {}
+
+ /**
+ *
+ */
+ SVGLengthList(const SVGLengthList &other)
+ {
+ items = other.items;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGLengthList() {}
+
+protected:
+
+ std::vector<SVGLength>items;
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGAnimatedLengthList
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGAnimatedLengthList
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGLengthList &getBaseVal()
+ {
+ return baseVal;
+ }
+
+ /**
+ *
+ */
+ virtual SVGLengthList &getAnimVal()
+ {
+ return animVal;
+ }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGAnimatedLengthList() {}
+
+ /**
+ *
+ */
+ SVGAnimatedLengthList(const SVGAnimatedLengthList &other)
+ {
+ baseVal = other.baseVal;
+ animVal = other.animVal;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGAnimatedLengthList() {}
+
+protected:
+
+ SVGLengthList baseVal, animVal;
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGAngle
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGAngle
+{
+public:
+
+ /**
+ * Angle Unit Types
+ */
+ typedef enum
+ {
+ SVG_ANGLETYPE_UNKNOWN = 0,
+ SVG_ANGLETYPE_UNSPECIFIED = 1,
+ SVG_ANGLETYPE_DEG = 2,
+ SVG_ANGLETYPE_RAD = 3,
+ SVG_ANGLETYPE_GRAD = 4
+ } AngleUnitType;
+
+
+
+ /**
+ *
+ */
+ virtual unsigned short getUnitType()
+ {
+ return unitType;
+ }
+
+ /**
+ *
+ */
+ virtual double getValue()
+ {
+ return value;
+ }
+
+ /**
+ *
+ */
+ virtual void setValue(double val) throw (DOMException)
+ {
+ value = val;
+ }
+
+ /**
+ *
+ */
+ virtual double getValueInSpecifiedUnits()
+ {
+ double result = 0.0;
+ //convert here
+ return result;
+ }
+
+ /**
+ *
+ */
+ virtual void setValueInSpecifiedUnits(double val)
+ throw (DOMException)
+ {
+ //do conversion
+ }
+
+ /**
+ *
+ */
+ virtual DOMString getValueAsString()
+ {
+ DOMString result;
+ char buf[32];
+ snprintf(buf, 31, "%f", value);
+ result.append(buf);
+ return result;
+ }
+
+ /**
+ *
+ */
+ virtual void setValueAsString(const DOMString &val)
+ throw (DOMException)
+ {
+ //convert here
+ }
+
+
+ /**
+ *
+ */
+ virtual void newValueSpecifiedUnits (unsigned short unitType,
+ double valueInSpecifiedUnits )
+ {
+ //convert here
+ }
+
+ /**
+ *
+ */
+ virtual void convertToSpecifiedUnits (unsigned short unitType )
+ {
+ //convert here
+ }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGAngle()
+ {
+ unitType = SVG_ANGLETYPE_UNKNOWN;
+ value = 0.0;
+ }
+
+ /**
+ *
+ */
+ SVGAngle(const SVGAngle &other)
+ {
+ unitType = other.unitType;
+ value = other.value;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGAngle() {}
+
+protected:
+
+ int unitType;
+
+ double value;
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGAnimatedAngle
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGAnimatedAngle
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAngle getBaseVal()
+ {
+ return baseVal;
+ }
+
+ /**
+ *
+ */
+ virtual SVGAngle getAnimVal()
+ {
+ return animVal;
+ }
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGAnimatedAngle() {}
+
+ /**
+ *
+ */
+ SVGAnimatedAngle(const SVGAngle &angle)
+ { baseVal = angle; }
+
+ /**
+ *
+ */
+ SVGAnimatedAngle(const SVGAnimatedAngle &other)
+ {
+ baseVal = other.baseVal;
+ animVal = other.animVal;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGAnimatedAngle() {}
+
+protected:
+
+ SVGAngle baseVal, animVal;
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGICCColor
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGICCColor
+{
+public:
+
+ /**
+ *
+ */
+ virtual DOMString getColorProfile()
+ {
+ return colorProfile;
+ }
+
+ /**
+ *
+ */
+ virtual void setColorProfile(const DOMString &val) throw (DOMException)
+ {
+ colorProfile = val;
+ }
+
+ /**
+ *
+ */
+ virtual SVGNumberList &getColors()
+ {
+ return colors;
+ }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGICCColor() {}
+
+ /**
+ *
+ */
+ SVGICCColor(const SVGICCColor &other)
+ {
+ colorProfile = other.colorProfile;
+ colors = other.colors;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGICCColor() {}
+
+protected:
+
+ DOMString colorProfile;
+
+ SVGNumberList colors;
+
+};
+
+
+/*#########################################################################
+## SVGColor
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGColor : virtual public css::CSSValue
+{
+public:
+
+
+ /**
+ * Color Types
+ */
+ typedef enum
+ {
+ SVG_COLORTYPE_UNKNOWN = 0,
+ SVG_COLORTYPE_RGBCOLOR = 1,
+ SVG_COLORTYPE_RGBCOLOR_ICCCOLOR = 2,
+ SVG_COLORTYPE_CURRENTCOLOR = 3
+ } ColorType;
+
+
+ /**
+ *
+ */
+ virtual unsigned short getColorType()
+ {
+ return colorType;
+ }
+
+ /**
+ *
+ */
+ virtual css::RGBColor getRgbColor()
+ {
+ css::RGBColor col;
+ return col;
+ }
+
+ /**
+ *
+ */
+ virtual SVGICCColor getIccColor()
+ {
+ SVGICCColor col;
+ return col;
+ }
+
+
+ /**
+ *
+ */
+ virtual void setRGBColor (const DOMString& rgbColor )
+ throw( SVGException )
+ {
+ }
+
+ /**
+ *
+ */
+ virtual void setRGBColorICCColor (const DOMString& rgbColor,
+ const DOMString& iccColor )
+ throw( SVGException )
+ {
+ }
+
+ /**
+ *
+ */
+ virtual void setColor (unsigned short colorType,
+ const DOMString& rgbColor,
+ const DOMString& iccColor )
+ throw( SVGException )
+ {
+ }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGColor()
+ {
+ colorType = SVG_COLORTYPE_UNKNOWN;
+ }
+
+ /**
+ *
+ */
+ SVGColor(const SVGColor &other) : css::CSSValue(other)
+ {
+ colorType = other.colorType;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGColor() {}
+
+protected:
+
+ int colorType;
+
+};
+
+
+
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGRect
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGRect
+{
+public:
+
+ /**
+ *
+ */
+ virtual double getX()
+ {
+ return x;
+ }
+
+ /**
+ *
+ */
+ virtual void setX(double val) throw (DOMException)
+ {
+ x = val;
+ }
+
+ /**
+ *
+ */
+ virtual double getY()
+ {
+ return y;
+ }
+
+ /**
+ *
+ */
+ virtual void setY(double val) throw (DOMException)
+ {
+ y = val;
+ }
+
+ /**
+ *
+ */
+ virtual double getWidth()
+ {
+ return width;
+ }
+
+ /**
+ *
+ */
+ virtual void setWidth(double val) throw (DOMException)
+ {
+ width = val;
+ }
+
+ /**
+ *
+ */
+ virtual double getHeight()
+ {
+ return height;
+ }
+
+ /**
+ *
+ */
+ virtual void setHeight(double val) throw (DOMException)
+ {
+ height = val;
+ }
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGRect()
+ {
+ x = y = width = height = 0.0;
+ }
+
+ /**
+ *
+ */
+ SVGRect(const SVGRect &other)
+ {
+ x = other.x;
+ y = other.y;
+ width = other.width;
+ height = other.height;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGRect() {}
+
+protected:
+
+ double x, y, width, height;
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGAnimatedRect
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGAnimatedRect
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGRect &getBaseVal()
+ {
+ return baseVal;
+ }
+
+ /**
+ *
+ */
+ virtual SVGRect &getAnimVal()
+ {
+ return animVal;
+ }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGAnimatedRect()
+ {
+ }
+
+ /**
+ *
+ */
+ SVGAnimatedRect(const SVGAnimatedRect &other)
+ {
+ baseVal = other.baseVal;
+ animVal = other.animVal;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGAnimatedRect() {}
+
+protected:
+
+ SVGRect baseVal, animVal;
+
+};
+
+
+
+/*#########################################################################
+## SVGPoint
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGPoint
+{
+public:
+
+
+
+ /**
+ *
+ */
+ virtual double getX()
+ { return x; }
+
+ /**
+ *
+ */
+ virtual void setX(double val) throw (DOMException)
+ { x = val; }
+
+ /**
+ *
+ */
+ virtual double getY()
+ { return y; }
+
+ /**
+ *
+ */
+ virtual void setY(double val) throw (DOMException)
+ { y = val; }
+
+ /**
+ *
+ */
+ virtual SVGPoint matrixTransform(const SVGMatrix &matrix)
+ {
+ SVGPoint point;
+ return point;
+ }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGPoint()
+ { x = y = 0; }
+
+ /**
+ *
+ */
+ SVGPoint(const SVGPoint &other)
+ {
+ x = other.x;
+ y = other.y;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGPoint() {}
+
+protected:
+
+ double x, y;
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGPointList
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGPointList
+{
+public:
+
+ /**
+ *
+ */
+ virtual unsigned long getNumberOfItems()
+ { return items.size(); }
+
+ /**
+ *
+ */
+ virtual void clear() throw( DOMException )
+ { items.clear(); }
+
+ /**
+ *
+ */
+ virtual SVGPoint initialize(const SVGPoint &newItem)
+ throw( DOMException, SVGException )
+ {
+ items.clear();
+ items.push_back(newItem);
+ return newItem;
+ }
+
+ /**
+ *
+ */
+ virtual SVGPoint getItem(unsigned long index )
+ throw( DOMException )
+ {
+ if (index >= items.size())
+ {
+ SVGPoint point;
+ return point;
+ }
+ return items[index];
+ }
+
+ /**
+ *
+ */
+ virtual SVGPoint insertItemBefore(const SVGPoint &newItem,
+ unsigned long index )
+ throw( DOMException, SVGException )
+ {
+ if (index >= items.size())
+ items.push_back(newItem);
+ else
+ {
+ std::vector<SVGPoint>::iterator iter = items.begin() + index;
+ items.insert(iter, newItem);
+ }
+ return newItem;
+ }
+
+ /**
+ *
+ */
+ virtual SVGPoint replaceItem(const SVGPoint &newItem,
+ unsigned long index )
+ throw( DOMException, SVGException )
+ {
+ if (index >= items.size())
+ {
+ SVGPoint point;
+ return point;
+ }
+ std::vector<SVGPoint>::iterator iter = items.begin() + index;
+ *iter = newItem;
+ return newItem;
+ }
+
+ /**
+ *
+ */
+ virtual SVGPoint removeItem(unsigned long index )
+ throw( DOMException )
+ {
+ if (index >= items.size())
+ {
+ SVGPoint point;
+ return point;
+ }
+ std::vector<SVGPoint>::iterator iter = items.begin() + index;
+ SVGPoint oldItem = *iter;
+ items.erase(iter);
+ return oldItem;
+ }
+
+ /**
+ *
+ */
+ virtual SVGPoint appendItem(const SVGPoint &newItem)
+ throw( DOMException, SVGException )
+ {
+ items.push_back(newItem);
+ return newItem;
+ }
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGPointList() {}
+
+
+ /**
+ *
+ */
+ SVGPointList(const SVGPointList &other)
+ {
+ items = other.items;
+ }
+
+
+ /**
+ *
+ */
+ virtual ~SVGPointList() {}
+
+protected:
+
+ std::vector<SVGPoint> items;
+
+};
+
+
+
+
+/*#########################################################################
+## SVGUnitTypes
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGUnitTypes
+{
+public:
+
+ /**
+ * Unit Types
+ */
+ typedef enum
+ {
+ SVG_UNIT_TYPE_UNKNOWN = 0,
+ SVG_UNIT_TYPE_USERSPACEONUSE = 1,
+ SVG_UNIT_TYPE_OBJECTBOUNDINGBOX = 2
+ } UnitType;
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGUnitTypes() {}
+
+ /**
+ *
+ */
+ virtual ~SVGUnitTypes() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGStylable
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGStylable
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedString getClassName()
+ {
+ return className;
+ }
+
+ /**
+ *
+ */
+ virtual css::CSSStyleDeclaration getStyle()
+ {
+ return style;
+ }
+
+
+ /**
+ *
+ */
+ virtual css::CSSValue getPresentationAttribute (const DOMString& name )
+ {
+ css::CSSValue val;
+ //perform a lookup
+ return val;
+ }
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGStylable() {}
+
+ /**
+ *
+ */
+ SVGStylable(const SVGStylable &other)
+ {
+ className = other.className;
+ style = other.style;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGStylable() {}
+
+protected:
+
+ SVGAnimatedString className;
+ css::CSSStyleDeclaration style;
+
+};
+
+
+/*#########################################################################
+## SVGLocatable
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGLocatable
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGElement *getNearestViewportElement()
+ {
+ SVGElement *result = NULL;
+ return result;
+ }
+
+ /**
+ *
+ */
+ virtual SVGElement *getFarthestViewportElement()
+ {
+ SVGElement *result = NULL;
+ return result;
+ }
+
+ /**
+ *
+ */
+ virtual SVGRect getBBox ( )
+ {
+ return bbox;
+ }
+
+ /**
+ *
+ */
+ virtual SVGMatrix getCTM ( )
+ {
+ return ctm;
+ }
+
+ /**
+ *
+ */
+ virtual SVGMatrix getScreenCTM ( )
+ {
+ return screenCtm;
+ }
+
+ /**
+ *
+ */
+ virtual SVGMatrix getTransformToElement (const SVGElement &element)
+ throw( SVGException )
+ {
+ SVGMatrix result;
+ //do calculations
+ return result;
+ }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGLocatable() {}
+
+ /**
+ *
+ */
+ SVGLocatable(const SVGLocatable &other)
+ {
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGLocatable() {}
+
+protected:
+
+ SVGRect bbox;
+ SVGMatrix ctm;
+ SVGMatrix screenCtm;
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGTransformable
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGTransformable : public SVGLocatable
+{
+public:
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedTransformList &getTransform()
+ {
+ return transforms;
+ }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGTransformable() {}
+
+ /**
+ *
+ */
+ SVGTransformable(const SVGTransformable &other) : SVGLocatable(other)
+ {
+ transforms = other.transforms;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGTransformable() {}
+
+protected:
+
+ SVGAnimatedTransformList transforms;
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGTests
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGTests
+{
+public:
+
+
+ /**
+ *
+ */
+ virtual SVGStringList &getRequiredFeatures()
+ {
+ return requiredFeatures;
+ }
+
+ /**
+ *
+ */
+ virtual SVGStringList &getRequiredExtensions()
+ {
+ return requiredExtensions;
+ }
+
+ /**
+ *
+ */
+ virtual SVGStringList &getSystemLanguage()
+ {
+ return systemLanguage;
+ }
+
+
+ /**
+ *
+ */
+ virtual bool hasExtension (const DOMString& extension )
+ {
+ return false;
+ }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGTests() {}
+
+ /**
+ *
+ */
+ SVGTests(const SVGTests &other)
+ {
+ requiredFeatures = other.requiredFeatures;
+ requiredExtensions = other.requiredExtensions;
+ systemLanguage = other.systemLanguage;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGTests() {}
+
+protected:
+
+ SVGStringList requiredFeatures;
+ SVGStringList requiredExtensions;
+ SVGStringList systemLanguage;
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGLangSpace
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGLangSpace
+{
+public:
+
+
+ /**
+ *
+ */
+ virtual DOMString getXmllang()
+ {
+ return xmlLang;
+ }
+
+ /**
+ *
+ */
+ virtual void setXmllang(const DOMString &val)
+ throw (DOMException)
+ {
+ xmlLang = val;
+ }
+
+ /**
+ *
+ */
+ virtual DOMString getXmlspace()
+ {
+ return xmlSpace;
+ }
+
+ /**
+ *
+ */
+ virtual void setXmlspace(const DOMString &val)
+ throw (DOMException)
+ {
+ xmlSpace = val;
+ }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGLangSpace() {}
+
+ /**
+ *
+ */
+ SVGLangSpace(const SVGLangSpace &other)
+ {
+ xmlLang = other.xmlLang;
+ xmlSpace = other.xmlSpace;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGLangSpace() {}
+
+protected:
+
+ DOMString xmlLang;
+ DOMString xmlSpace;
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGExternalResourcesRequired
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGExternalResourcesRequired
+{
+public:
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedBoolean getExternalResourcesRequired()
+ { return required; }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGExternalResourcesRequired()
+ { }
+
+
+ /**
+ *
+ */
+ SVGExternalResourcesRequired(const SVGExternalResourcesRequired &other)
+ {
+ required = other.required;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGExternalResourcesRequired() {}
+
+protected:
+
+ SVGAnimatedBoolean required;
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGPreserveAspectRatio
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGPreserveAspectRatio
+{
+public:
+
+
+ /**
+ * Alignment Types
+ */
+ typedef enum
+ {
+ SVG_PRESERVEASPECTRATIO_UNKNOWN = 0,
+ SVG_PRESERVEASPECTRATIO_NONE = 1,
+ SVG_PRESERVEASPECTRATIO_XMINYMIN = 2,
+ SVG_PRESERVEASPECTRATIO_XMIDYMIN = 3,
+ SVG_PRESERVEASPECTRATIO_XMAXYMIN = 4,
+ SVG_PRESERVEASPECTRATIO_XMINYMID = 5,
+ SVG_PRESERVEASPECTRATIO_XMIDYMID = 6,
+ SVG_PRESERVEASPECTRATIO_XMAXYMID = 7,
+ SVG_PRESERVEASPECTRATIO_XMINYMAX = 8,
+ SVG_PRESERVEASPECTRATIO_XMIDYMAX = 9,
+ SVG_PRESERVEASPECTRATIO_XMAXYMAX = 10
+ } AlignmentType;
+
+
+ /**
+ * Meet-or-slice Types
+ */
+ typedef enum
+ {
+ SVG_MEETORSLICE_UNKNOWN = 0,
+ SVG_MEETORSLICE_MEET = 1,
+ SVG_MEETORSLICE_SLICE = 2
+ } MeetOrSliceType;
+
+
+ /**
+ *
+ */
+ virtual unsigned short getAlign()
+ { return align; }
+
+ /**
+ *
+ */
+ virtual void setAlign(unsigned short val) throw (DOMException)
+ { align = val; }
+
+ /**
+ *
+ */
+ virtual unsigned short getMeetOrSlice()
+ { return meetOrSlice; }
+
+ /**
+ *
+ */
+ virtual void setMeetOrSlice(unsigned short val) throw (DOMException)
+ { meetOrSlice = val; }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGPreserveAspectRatio()
+ {
+ align = SVG_PRESERVEASPECTRATIO_UNKNOWN;
+ meetOrSlice = SVG_MEETORSLICE_UNKNOWN;
+ }
+
+ /**
+ *
+ */
+ SVGPreserveAspectRatio(const SVGPreserveAspectRatio &other)
+ {
+ align = other.align;
+ meetOrSlice = other.meetOrSlice;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGPreserveAspectRatio() {}
+
+protected:
+
+ unsigned short align;
+ unsigned short meetOrSlice;
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGAnimatedPreserveAspectRatio
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGAnimatedPreserveAspectRatio
+{
+public:
+
+
+ /**
+ *
+ */
+ virtual SVGPreserveAspectRatio getBaseVal()
+ { return baseVal; }
+
+ /**
+ *
+ */
+ virtual SVGPreserveAspectRatio getAnimVal()
+ { return animVal; }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGAnimatedPreserveAspectRatio() {}
+
+ /**
+ *
+ */
+ SVGAnimatedPreserveAspectRatio(const SVGAnimatedPreserveAspectRatio &other)
+ {
+ baseVal = other.baseVal;
+ baseVal = other.animVal;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGAnimatedPreserveAspectRatio() {}
+
+protected:
+
+ SVGPreserveAspectRatio baseVal;
+ SVGPreserveAspectRatio animVal;
+
+};
+
+
+
+
+/*#########################################################################
+## SVGFitToViewBox
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFitToViewBox
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedRect getViewBox()
+ { return viewBox; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedPreserveAspectRatio getPreserveAspectRatio()
+ { return preserveAspectRatio; }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGFitToViewBox()
+ {}
+
+ /**
+ *
+ */
+
+ SVGFitToViewBox(const SVGFitToViewBox &other)
+ {
+ viewBox = other.viewBox;
+ preserveAspectRatio = other.preserveAspectRatio;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGFitToViewBox() {}
+
+protected:
+
+ SVGAnimatedRect viewBox;
+
+ SVGAnimatedPreserveAspectRatio preserveAspectRatio;
+
+};
+
+
+/*#########################################################################
+## SVGZoomAndPan
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGZoomAndPan
+{
+public:
+
+
+ /**
+ * Zoom and Pan Types
+ */
+ typedef enum
+ {
+ SVG_ZOOMANDPAN_UNKNOWN = 0,
+ SVG_ZOOMANDPAN_DISABLE = 1,
+ SVG_ZOOMANDPAN_MAGNIFY = 2
+ } ZoomAndPanType;
+
+
+ /**
+ *
+ */
+ virtual unsigned short getZoomAndPan()
+ { return zoomAndPan; }
+
+ /**
+ *
+ */
+ virtual void setZoomAndPan(unsigned short val) throw (DOMException)
+ { zoomAndPan = val; }
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGZoomAndPan()
+ { zoomAndPan = SVG_ZOOMANDPAN_UNKNOWN; }
+
+ /**
+ *
+ */
+ SVGZoomAndPan(const SVGZoomAndPan &other)
+ { zoomAndPan = other.zoomAndPan; }
+
+ /**
+ *
+ */
+ virtual ~SVGZoomAndPan() {}
+
+protected:
+
+ unsigned short zoomAndPan;
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGViewSpec
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGViewSpec : public SVGZoomAndPan,
+ public SVGFitToViewBox
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGTransformList getTransform()
+ { return transform; }
+
+ /**
+ *
+ */
+ virtual SVGElement *getViewTarget()
+ { return viewTarget; }
+
+ /**
+ *
+ */
+ virtual DOMString getViewBoxString()
+ {
+ DOMString ret;
+ return ret;
+ }
+
+ /**
+ *
+ */
+ virtual DOMString getPreserveAspectRatioString()
+ {
+ DOMString ret;
+ return ret;
+ }
+
+ /**
+ *
+ */
+ virtual DOMString getTransformString()
+ {
+ DOMString ret;
+ return ret;
+ }
+
+ /**
+ *
+ */
+ virtual DOMString getViewTargetString()
+ {
+ DOMString ret;
+ return ret;
+ }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGViewSpec()
+ {
+ viewTarget = NULL;
+ }
+
+ /**
+ *
+ */
+ SVGViewSpec(const SVGViewSpec &other) : SVGZoomAndPan(other), SVGFitToViewBox(other)
+ {
+ viewTarget = other.viewTarget;
+ transform = other.transform;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGViewSpec() {}
+
+protected:
+
+ SVGElement *viewTarget;
+ SVGTransformList transform;
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGURIReference
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGURIReference
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGAnimatedString getHref()
+ { return href; }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGURIReference() {}
+
+ /**
+ *
+ */
+ SVGURIReference(const SVGURIReference &other)
+ {
+ href = other.href;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGURIReference() {}
+
+protected:
+
+ SVGAnimatedString href;
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGCSSRule
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGCSSRule : public css::CSSRule
+{
+public:
+
+
+ /**
+ * Additional CSS RuleType to support ICC color specifications
+ */
+ typedef enum
+ {
+ COLOR_PROFILE_RULE = 7
+ } ColorProfileRuleType;
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGCSSRule()
+ { type = COLOR_PROFILE_RULE; }
+
+ /**
+ *
+ */
+ SVGCSSRule(const SVGCSSRule &other) : css::CSSRule(other)
+ { type = COLOR_PROFILE_RULE; }
+
+ /**
+ *
+ */
+ virtual ~SVGCSSRule() {}
+
+};
+
+
+
+/*#########################################################################
+## SVGRenderingIntent
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGRenderingIntent
+{
+public:
+
+ /**
+ * Rendering Intent Types
+ */
+ typedef enum
+ {
+ RENDERING_INTENT_UNKNOWN = 0,
+ RENDERING_INTENT_AUTO = 1,
+ RENDERING_INTENT_PERCEPTUAL = 2,
+ RENDERING_INTENT_RELATIVE_COLORIMETRIC = 3,
+ RENDERING_INTENT_SATURATION = 4,
+ RENDERING_INTENT_ABSOLUTE_COLORIMETRIC = 5
+ } RenderingIntentType;
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGRenderingIntent()
+ {
+ renderingIntentType = RENDERING_INTENT_UNKNOWN;
+ }
+
+ /**
+ *
+ */
+ SVGRenderingIntent(const SVGRenderingIntent &other)
+ {
+ renderingIntentType = other.renderingIntentType;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGRenderingIntent() {}
+
+protected:
+
+ unsigned short renderingIntentType;
+};
+
+
+
+
+
+
+
+/*#########################################################################
+###########################################################################
+## P A T H S E G M E N T S
+###########################################################################
+#########################################################################*/
+
+static char *pathSegLetters[] =
+{
+ "@", // PATHSEG_UNKNOWN,
+ "z", // PATHSEG_CLOSEPATH
+ "M", // PATHSEG_MOVETO_ABS
+ "m", // PATHSEG_MOVETO_REL,
+ "L", // PATHSEG_LINETO_ABS
+ "l", // PATHSEG_LINETO_REL
+ "C", // PATHSEG_CURVETO_CUBIC_ABS
+ "c", // PATHSEG_CURVETO_CUBIC_REL
+ "Q", // PATHSEG_CURVETO_QUADRATIC_ABS,
+ "q", // PATHSEG_CURVETO_QUADRATIC_REL
+ "A", // PATHSEG_ARC_ABS
+ "a", // PATHSEG_ARC_REL,
+ "H", // PATHSEG_LINETO_HORIZONTAL_ABS,
+ "h", // PATHSEG_LINETO_HORIZONTAL_REL
+ "V", // PATHSEG_LINETO_VERTICAL_ABS
+ "v", // PATHSEG_LINETO_VERTICAL_REL
+ "S", // PATHSEG_CURVETO_CUBIC_SMOOTH_ABS
+ "s", // PATHSEG_CURVETO_CUBIC_SMOOTH_REL
+ "T", // PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS
+ "t" // PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL
+};
+
+/*#########################################################################
+## SVGPathSeg
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGPathSeg
+{
+public:
+
+
+
+ /**
+ * Path Segment Types
+ */
+ typedef enum
+ {
+ PATHSEG_UNKNOWN = 0,
+ PATHSEG_CLOSEPATH = 1,
+ PATHSEG_MOVETO_ABS = 2,
+ PATHSEG_MOVETO_REL = 3,
+ PATHSEG_LINETO_ABS = 4,
+ PATHSEG_LINETO_REL = 5,
+ PATHSEG_CURVETO_CUBIC_ABS = 6,
+ PATHSEG_CURVETO_CUBIC_REL = 7,
+ PATHSEG_CURVETO_QUADRATIC_ABS = 8,
+ PATHSEG_CURVETO_QUADRATIC_REL = 9,
+ PATHSEG_ARC_ABS = 10,
+ PATHSEG_ARC_REL = 11,
+ PATHSEG_LINETO_HORIZONTAL_ABS = 12,
+ PATHSEG_LINETO_HORIZONTAL_REL = 13,
+ PATHSEG_LINETO_VERTICAL_ABS = 14,
+ PATHSEG_LINETO_VERTICAL_REL = 15,
+ PATHSEG_CURVETO_CUBIC_SMOOTH_ABS = 16,
+ PATHSEG_CURVETO_CUBIC_SMOOTH_REL = 17,
+ PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS = 18,
+ PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL = 19
+ } PathSegmentType;
+
+ /**
+ *
+ */
+ virtual unsigned short getPathSegType()
+ { return type; }
+
+ /**
+ *
+ */
+ virtual DOMString getPathSegTypeAsLetter()
+ {
+ int typ = type;
+ if (typ<0 || typ>PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL)
+ typ = PATHSEG_UNKNOWN;
+ char *ch = pathSegLetters[typ];
+ DOMString letter = ch;
+ return letter;
+ }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGPathSeg()
+ { type = PATHSEG_UNKNOWN; }
+
+ /**
+ *
+ */
+ SVGPathSeg(const SVGPathSeg &other)
+ {
+ type = other.type;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGPathSeg() {}
+
+protected:
+
+ int type;
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGPathSegClosePath
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGPathSegClosePath : public SVGPathSeg
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGPathSegClosePath()
+ {
+ type = PATHSEG_CLOSEPATH;
+ }
+
+ /**
+ *
+ */
+ SVGPathSegClosePath(const SVGPathSegClosePath &other) : SVGPathSeg(other)
+ {
+ type = PATHSEG_CLOSEPATH;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGPathSegClosePath() {}
+
+};
+
+
+
+
+/*#########################################################################
+## SVGPathSegMovetoAbs
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGPathSegMovetoAbs : public SVGPathSeg
+{
+public:
+
+ /**
+ *
+ */
+ virtual double getX()
+ { return x; }
+
+ /**
+ *
+ */
+ virtual void setX(double val) throw (DOMException)
+ { x = val; }
+
+ /**
+ *
+ */
+ virtual double getY()
+ { return y; }
+
+ /**
+ *
+ */
+ virtual void setY(double val) throw (DOMException)
+ { y = val; }
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGPathSegMovetoAbs()
+ {
+ type = PATHSEG_MOVETO_ABS;
+ x = y = 0.0;
+ }
+
+ /**
+ *
+ */
+ SVGPathSegMovetoAbs(double xArg, double yArg)
+ {
+ type = PATHSEG_MOVETO_ABS;
+ x = xArg; y = yArg;
+ }
+
+ /**
+ *
+ */
+ SVGPathSegMovetoAbs(const SVGPathSegMovetoAbs &other) : SVGPathSeg(other)
+ {
+ type = PATHSEG_MOVETO_ABS;
+ x = other.x; y = other.y;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGPathSegMovetoAbs() {}
+
+protected:
+
+ double x,y;
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGPathSegMovetoRel
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGPathSegMovetoRel : public SVGPathSeg
+{
+public:
+
+ /**
+ *
+ */
+ virtual double getX()
+ { return x; }
+
+ /**
+ *
+ */
+ virtual void setX(double val) throw (DOMException)
+ { x = val; }
+
+ /**
+ *
+ */
+ virtual double getY()
+ { return y; }
+
+ /**
+ *
+ */
+ virtual void setY(double val) throw (DOMException)
+ { y = val; }
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGPathSegMovetoRel()
+ {
+ type = PATHSEG_MOVETO_REL;
+ x = y = 0.0;
+ }
+
+
+ /**
+ *
+ */
+ SVGPathSegMovetoRel(double xArg, double yArg)
+ {
+ type = PATHSEG_MOVETO_REL;
+ x = xArg; y = yArg;
+ }
+
+ /**
+ *
+ */
+ SVGPathSegMovetoRel(const SVGPathSegMovetoRel &other) : SVGPathSeg(other)
+ {
+ type = PATHSEG_MOVETO_REL;
+ x = other.x; y = other.y;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGPathSegMovetoRel() {}
+
+protected:
+
+ double x,y;
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGPathSegLinetoAbs
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGPathSegLinetoAbs : public SVGPathSeg
+{
+public:
+
+ /**
+ *
+ */
+ virtual double getX()
+ { return x; }
+
+ /**
+ *
+ */
+ virtual void setX(double val) throw (DOMException)
+ { x = val; }
+
+ /**
+ *
+ */
+ virtual double getY()
+ { return y; }
+
+ /**
+ *
+ */
+ virtual void setY(double val) throw (DOMException)
+ { y = val; }
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGPathSegLinetoAbs()
+ {
+ type = PATHSEG_LINETO_ABS;
+ x = y = 0.0;
+ }
+
+
+ /**
+ *
+ */
+ SVGPathSegLinetoAbs(double xArg, double yArg)
+ {
+ type = PATHSEG_LINETO_ABS;
+ x = xArg; y = yArg;
+ }
+
+ /**
+ *
+ */
+ SVGPathSegLinetoAbs(const SVGPathSegLinetoAbs &other) : SVGPathSeg(other)
+ {
+ type = PATHSEG_LINETO_ABS;
+ x = other.x; y = other.y;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGPathSegLinetoAbs() {}
+
+protected:
+
+ double x,y;
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGPathSegLinetoRel
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGPathSegLinetoRel : public SVGPathSeg
+{
+public:
+
+ /**
+ *
+ */
+ virtual double getX()
+ { return x; }
+
+ /**
+ *
+ */
+ virtual void setX(double val) throw (DOMException)
+ { x = val; }
+
+ /**
+ *
+ */
+ virtual double getY()
+ { return y; }
+
+ /**
+ *
+ */
+ virtual void setY(double val) throw (DOMException)
+ { y = val; }
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGPathSegLinetoRel()
+ {
+ type = PATHSEG_LINETO_REL;
+ x = y = 0.0;
+ }
+
+
+ /**
+ *
+ */
+ SVGPathSegLinetoRel(double xArg, double yArg)
+ {
+ type = PATHSEG_LINETO_REL;
+ x = xArg; y = yArg;
+ }
+
+ /**
+ *
+ */
+ SVGPathSegLinetoRel(const SVGPathSegLinetoRel &other) : SVGPathSeg(other)
+ {
+ type = PATHSEG_LINETO_REL;
+ x = other.x; y = other.y;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGPathSegLinetoRel() {}
+
+protected:
+
+ double x,y;
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGPathSegCurvetoCubicAbs
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGPathSegCurvetoCubicAbs : public SVGPathSeg
+{
+public:
+
+ /**
+ *
+ */
+ virtual double getX()
+ { return x; }
+
+ /**
+ *
+ */
+ virtual void setX(double val) throw (DOMException)
+ { x = val; }
+
+ /**
+ *
+ */
+ virtual double getY()
+ { return y; }
+
+ /**
+ *
+ */
+ virtual void setY(double val) throw (DOMException)
+ { y = val; }
+
+ /**
+ *
+ */
+ virtual double getX1()
+ { return x1; }
+
+ /**
+ *
+ */
+ virtual void setX1(double val) throw (DOMException)
+ { x1 = val; }
+
+ /**
+ *
+ */
+ virtual double getY1()
+ { return y1; }
+
+ /**
+ *
+ */
+ virtual void setY1(double val) throw (DOMException)
+ { y1 = val; }
+
+
+ /**
+ *
+ */
+ virtual double getX2()
+ { return x2; }
+
+ /**
+ *
+ */
+ virtual void setX2(double val) throw (DOMException)
+ { x2 = val; }
+
+ /**
+ *
+ */
+ virtual double getY2()
+ { return y2; }
+
+ /**
+ *
+ */
+ virtual void setY2(double val) throw (DOMException)
+ { y2 = val; }
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+
+ /**
+ *
+ */
+ SVGPathSegCurvetoCubicAbs()
+ {
+ type = PATHSEG_CURVETO_CUBIC_ABS;
+ x = y = x1 = y1 = x2 = y2 = 0.0;
+ }
+
+ /**
+ *
+ */
+ SVGPathSegCurvetoCubicAbs(double xArg, double yArg,
+ double x1Arg, double y1Arg,
+ double x2Arg, double y2Arg)
+ {
+ type = PATHSEG_CURVETO_CUBIC_ABS;
+ x = xArg; y = yArg;
+ x1 = x1Arg; y1 = y1Arg;
+ x2 = x2Arg; y2 = y2Arg;
+ }
+
+ /**
+ *
+ */
+ SVGPathSegCurvetoCubicAbs(const SVGPathSegCurvetoCubicAbs &other)
+ : SVGPathSeg(other)
+ {
+ type = PATHSEG_CURVETO_CUBIC_ABS;
+ x = other.x; y = other.y;
+ x1 = other.x1; y1 = other.y1;
+ x2 = other.x2; y2 = other.y2;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGPathSegCurvetoCubicAbs() {}
+
+protected:
+
+ double x, y, x1, y1, x2, y2;
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGPathSegCurvetoCubicRel
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGPathSegCurvetoCubicRel : public SVGPathSeg
+{
+public:
+
+ /**
+ *
+ */
+ virtual double getX()
+ { return x; }
+
+ /**
+ *
+ */
+ virtual void setX(double val) throw (DOMException)
+ { x = val; }
+
+ /**
+ *
+ */
+ virtual double getY()
+ { return y; }
+
+ /**
+ *
+ */
+ virtual void setY(double val) throw (DOMException)
+ { y = val; }
+
+ /**
+ *
+ */
+ virtual double getX1()
+ { return x1; }
+
+ /**
+ *
+ */
+ virtual void setX1(double val) throw (DOMException)
+ { x1 = val; }
+
+ /**
+ *
+ */
+ virtual double getY1()
+ { return y1; }
+
+ /**
+ *
+ */
+ virtual void setY1(double val) throw (DOMException)
+ { y1 = val; }
+
+
+ /**
+ *
+ */
+ virtual double getX2()
+ { return x2; }
+
+ /**
+ *
+ */
+ virtual void setX2(double val) throw (DOMException)
+ { x2 = val; }
+
+ /**
+ *
+ */
+ virtual double getY2()
+ { return y2; }
+
+ /**
+ *
+ */
+ virtual void setY2(double val) throw (DOMException)
+ { y2 = val; }
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+
+ /**
+ *
+ */
+ SVGPathSegCurvetoCubicRel()
+ {
+ type = PATHSEG_CURVETO_CUBIC_REL;
+ x = y = x1 = y1 = x2 = y2 = 0.0;
+ }
+
+
+ /**
+ *
+ */
+ SVGPathSegCurvetoCubicRel(double xArg, double yArg,
+ double x1Arg, double y1Arg,
+ double x2Arg, double y2Arg)
+ {
+ type = PATHSEG_CURVETO_CUBIC_REL;
+ x = xArg; y = yArg;
+ x1 = x1Arg; y1 = y1Arg;
+ x2 = x2Arg; y2 = y2Arg;
+ }
+
+ /**
+ *
+ */
+ SVGPathSegCurvetoCubicRel(const SVGPathSegCurvetoCubicRel &other)
+ : SVGPathSeg(other)
+ {
+ type = PATHSEG_CURVETO_CUBIC_REL;
+ x = other.x; y = other.y;
+ x1 = other.x1; y1 = other.y1;
+ x2 = other.x2; y2 = other.y2;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGPathSegCurvetoCubicRel() {}
+
+protected:
+
+ double x, y, x1, y1, x2, y2;
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGPathSegCurvetoQuadraticAbs
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGPathSegCurvetoQuadraticAbs : public SVGPathSeg
+{
+public:
+
+ /**
+ *
+ */
+ virtual double getX()
+ { return x; }
+
+ /**
+ *
+ */
+ virtual void setX(double val) throw (DOMException)
+ { x = val; }
+
+ /**
+ *
+ */
+ virtual double getY()
+ { return y; }
+
+ /**
+ *
+ */
+ virtual void setY(double val) throw (DOMException)
+ { y = val; }
+
+ /**
+ *
+ */
+ virtual double getX1()
+ { return x1; }
+
+ /**
+ *
+ */
+ virtual void setX1(double val) throw (DOMException)
+ { x1 = val; }
+
+ /**
+ *
+ */
+ virtual double getY1()
+ { return y1; }
+
+ /**
+ *
+ */
+ virtual void setY1(double val) throw (DOMException)
+ { y1 = val; }
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+
+ /**
+ *
+ */
+ SVGPathSegCurvetoQuadraticAbs()
+ {
+ type = PATHSEG_CURVETO_QUADRATIC_ABS;
+ x = y = x1 = y1 = 0.0;
+ }
+
+ /**
+ *
+ */
+ SVGPathSegCurvetoQuadraticAbs(double xArg, double yArg,
+ double x1Arg, double y1Arg)
+ {
+ type = PATHSEG_CURVETO_QUADRATIC_ABS;
+ x = xArg; y = yArg;
+ x1 = x1Arg; y1 = y1Arg;
+ }
+
+ /**
+ *
+ */
+ SVGPathSegCurvetoQuadraticAbs(const SVGPathSegCurvetoQuadraticAbs &other)
+ : SVGPathSeg(other)
+ {
+ type = PATHSEG_CURVETO_QUADRATIC_ABS;
+ x = other.x; y = other.y;
+ x1 = other.x1; y1 = other.y1;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGPathSegCurvetoQuadraticAbs() {}
+
+protected:
+
+ double x, y, x1, y1;
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGPathSegCurvetoQuadraticRel
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGPathSegCurvetoQuadraticRel : public SVGPathSeg
+{
+public:
+
+ /**
+ *
+ */
+ virtual double getX()
+ { return x; }
+
+ /**
+ *
+ */
+ virtual void setX(double val) throw (DOMException)
+ { x = val; }
+
+ /**
+ *
+ */
+ virtual double getY()
+ { return y; }
+
+ /**
+ *
+ */
+ virtual void setY(double val) throw (DOMException)
+ { y = val; }
+
+ /**
+ *
+ */
+ virtual double getX1()
+ { return x1; }
+
+ /**
+ *
+ */
+ virtual void setX1(double val) throw (DOMException)
+ { x1 = val; }
+
+ /**
+ *
+ */
+ virtual double getY1()
+ { return y1; }
+
+ /**
+ *
+ */
+ virtual void setY1(double val) throw (DOMException)
+ { y1 = val; }
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+
+ /**
+ *
+ */
+ SVGPathSegCurvetoQuadraticRel()
+ {
+ type = PATHSEG_CURVETO_QUADRATIC_REL;
+ x = y = x1 = y1 = 0.0;
+ }
+
+
+ /**
+ *
+ */
+ SVGPathSegCurvetoQuadraticRel(double xArg, double yArg,
+ double x1Arg, double y1Arg)
+ {
+ type = PATHSEG_CURVETO_QUADRATIC_REL;
+ x = xArg; y = yArg;
+ x1 = x1Arg; y1 = y1Arg;
+ }
+
+ /**
+ *
+ */
+ SVGPathSegCurvetoQuadraticRel(const SVGPathSegCurvetoQuadraticRel &other)
+ : SVGPathSeg(other)
+ {
+ type = PATHSEG_CURVETO_QUADRATIC_REL;
+ x = other.x; y = other.y;
+ x1 = other.x1; y1 = other.y1;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGPathSegCurvetoQuadraticRel() {}
+
+protected:
+
+ double x, y, x1, y1;
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGPathSegArcAbs
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGPathSegArcAbs : public SVGPathSeg
+{
+public:
+
+ /**
+ *
+ */
+ virtual double getX()
+ { return x; }
+
+ /**
+ *
+ */
+ virtual void setX(double val) throw (DOMException)
+ { x = val; }
+
+ /**
+ *
+ */
+ virtual double getY()
+ { return y; }
+
+ /**
+ *
+ */
+ virtual void setY(double val) throw (DOMException)
+ { y = val; }
+
+ /**
+ *
+ */
+ virtual double getR1()
+ { return r1; }
+
+ /**
+ *
+ */
+ virtual void setR1(double val) throw (DOMException)
+ { r1 = val; }
+
+ /**
+ *
+ */
+ virtual double getR2()
+ { return r2; }
+
+ /**
+ *
+ */
+ virtual void setR2(double val) throw (DOMException)
+ { r2 = val; }
+
+ /**
+ *
+ */
+ virtual double getAngle()
+ { return angle; }
+
+ /**
+ *
+ */
+ virtual void setAngle(double val) throw (DOMException)
+ { angle = val; }
+
+ /**
+ *
+ */
+ virtual bool getLargeArcFlag()
+ { return largeArcFlag; }
+
+ /**
+ *
+ */
+ virtual void setLargeArcFlag(bool val) throw (DOMException)
+ { largeArcFlag = val; }
+
+ /**
+ *
+ */
+ virtual bool getSweepFlag()
+ { return sweepFlag; }
+
+ /**
+ *
+ */
+ virtual void setSweepFlag(bool val) throw (DOMException)
+ { sweepFlag = val; }
+
+ //##################
+ //# Non-API methods
+ //##################
+
+
+ /**
+ *
+ */
+ SVGPathSegArcAbs()
+ {
+ type = PATHSEG_ARC_ABS;
+ x = y = r1 = r2 = angle = 0.0;
+ largeArcFlag = sweepFlag = false;
+ }
+
+ /**
+ *
+ */
+ SVGPathSegArcAbs(double xArg, double yArg,
+ double r1Arg, double r2Arg,
+ double angleArg,
+ bool largeArcFlagArg,
+ bool sweepFlagArg )
+
+ {
+ type = PATHSEG_ARC_ABS;
+ x = xArg; y = yArg;
+ r1 = r1Arg; r2 = r2Arg;
+ angle = angleArg;
+ largeArcFlag = largeArcFlagArg;
+ sweepFlag = sweepFlagArg;
+ }
+
+ /**
+ *
+ */
+ SVGPathSegArcAbs(const SVGPathSegArcAbs &other)
+ : SVGPathSeg(other)
+ {
+ type = PATHSEG_ARC_ABS;
+ x = other.x; y = other.y;
+ r1 = other.r1; r2 = other.r2;
+ angle = other.angle;
+ largeArcFlag = other.largeArcFlag;
+ sweepFlag = other.sweepFlag;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGPathSegArcAbs() {}
+
+protected:
+
+ double x, y, r1, r2, angle;
+ bool largeArcFlag;
+ bool sweepFlag;
+
+};
+
+
+
+/*#########################################################################
+## SVGPathSegArcRel
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGPathSegArcRel : public SVGPathSeg
+{
+public:
+
+ /**
+ *
+ */
+ virtual double getX()
+ { return x; }
+
+ /**
+ *
+ */
+ virtual void setX(double val) throw (DOMException)
+ { x = val; }
+
+ /**
+ *
+ */
+ virtual double getY()
+ { return y; }
+
+ /**
+ *
+ */
+ virtual void setY(double val) throw (DOMException)
+ { y = val; }
+
+ /**
+ *
+ */
+ virtual double getR1()
+ { return r1; }
+
+ /**
+ *
+ */
+ virtual void setR1(double val) throw (DOMException)
+ { r1 = val; }
+
+ /**
+ *
+ */
+ virtual double getR2()
+ { return r2; }
+
+ /**
+ *
+ */
+ virtual void setR2(double val) throw (DOMException)
+ { r2 = val; }
+
+ /**
+ *
+ */
+ virtual double getAngle()
+ { return angle; }
+
+ /**
+ *
+ */
+ virtual void setAngle(double val) throw (DOMException)
+ { angle = val; }
+
+ /**
+ *
+ */
+ virtual bool getLargeArcFlag()
+ { return largeArcFlag; }
+
+ /**
+ *
+ */
+ virtual void setLargeArcFlag(bool val) throw (DOMException)
+ { largeArcFlag = val; }
+
+ /**
+ *
+ */
+ virtual bool getSweepFlag()
+ { return sweepFlag; }
+
+ /**
+ *
+ */
+ virtual void setSweepFlag(bool val) throw (DOMException)
+ { sweepFlag = val; }
+
+ //##################
+ //# Non-API methods
+ //##################
+
+
+ /**
+ *
+ */
+ SVGPathSegArcRel()
+ {
+ type = PATHSEG_ARC_REL;
+ x = y = r1 = r2 = angle = 0.0;
+ largeArcFlag = sweepFlag = false;
+ }
+
+
+ /**
+ *
+ */
+ SVGPathSegArcRel(double xArg, double yArg,
+ double r1Arg, double r2Arg,
+ double angleArg,
+ bool largeArcFlagArg,
+ bool sweepFlagArg )
+
+ {
+ type = PATHSEG_ARC_REL;
+ x = xArg; y = yArg;
+ r1 = r1Arg; r2 = r2Arg;
+ angle = angleArg;
+ largeArcFlag = largeArcFlagArg;
+ sweepFlag = sweepFlagArg;
+ }
+
+ /**
+ *
+ */
+ SVGPathSegArcRel(const SVGPathSegArcRel &other)
+ : SVGPathSeg(other)
+ {
+ type = PATHSEG_ARC_REL;
+ x = other.x; y = other.y;
+ r1 = other.r1; r2 = other.r2;
+ angle = other.angle;
+ largeArcFlag = other.largeArcFlag;
+ sweepFlag = other.sweepFlag;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGPathSegArcRel() {}
+
+protected:
+
+ double x, y, r1, r2, angle;
+ bool largeArcFlag;
+ bool sweepFlag;
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGPathSegLinetoHorizontalAbs
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGPathSegLinetoHorizontalAbs : public SVGPathSeg
+{
+public:
+
+ /**
+ *
+ */
+ virtual double getX()
+ { return x; }
+
+ /**
+ *
+ */
+ virtual void setX(double val) throw (DOMException)
+ { x = val; }
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGPathSegLinetoHorizontalAbs()
+ {
+ type = PATHSEG_LINETO_HORIZONTAL_ABS;
+ x = 0.0;
+ }
+
+
+ /**
+ *
+ */
+ SVGPathSegLinetoHorizontalAbs(double xArg)
+ {
+ type = PATHSEG_LINETO_HORIZONTAL_ABS;
+ x = xArg;
+ }
+
+ /**
+ *
+ */
+ SVGPathSegLinetoHorizontalAbs(const SVGPathSegLinetoHorizontalAbs &other)
+ : SVGPathSeg(other)
+ {
+ type = PATHSEG_LINETO_HORIZONTAL_ABS;
+ x = other.x;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGPathSegLinetoHorizontalAbs() {}
+
+protected:
+
+ double x;
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGPathSegLinetoHorizontalRel
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGPathSegLinetoHorizontalRel : public SVGPathSeg
+{
+public:
+
+ /**
+ *
+ */
+ virtual double getX()
+ { return x; }
+
+ /**
+ *
+ */
+ virtual void setX(double val) throw (DOMException)
+ { x = val; }
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGPathSegLinetoHorizontalRel()
+ {
+ type = PATHSEG_LINETO_HORIZONTAL_REL;
+ x = 0.0;
+ }
+
+
+ /**
+ *
+ */
+ SVGPathSegLinetoHorizontalRel(double xArg)
+ {
+ type = PATHSEG_LINETO_HORIZONTAL_REL;
+ x = xArg;
+ }
+
+ /**
+ *
+ */
+ SVGPathSegLinetoHorizontalRel(const SVGPathSegLinetoHorizontalRel &other)
+ : SVGPathSeg(other)
+ {
+ type = PATHSEG_LINETO_HORIZONTAL_REL;
+ x = other.x;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGPathSegLinetoHorizontalRel() {}
+
+protected:
+
+ double x;
+
+};
+
+
+
+/*#########################################################################
+## SVGPathSegLinetoVerticalAbs
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGPathSegLinetoVerticalAbs : public SVGPathSeg
+{
+public:
+
+ /**
+ *
+ */
+ virtual double getY()
+ { return y; }
+
+ /**
+ *
+ */
+ virtual void setY(double val) throw (DOMException)
+ { y = val; }
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGPathSegLinetoVerticalAbs()
+ {
+ type = PATHSEG_LINETO_VERTICAL_ABS;
+ y = 0.0;
+ }
+
+
+ /**
+ *
+ */
+ SVGPathSegLinetoVerticalAbs(double yArg)
+ {
+ type = PATHSEG_LINETO_VERTICAL_ABS;
+ y = yArg;
+ }
+
+ /**
+ *
+ */
+ SVGPathSegLinetoVerticalAbs(const SVGPathSegLinetoVerticalAbs &other)
+ : SVGPathSeg(other)
+ {
+ type = PATHSEG_LINETO_VERTICAL_ABS;
+ y = other.y;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGPathSegLinetoVerticalAbs() {}
+
+protected:
+
+ double y;
+
+};
+
+
+
+/*#########################################################################
+## SVGPathSegLinetoVerticalRel
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGPathSegLinetoVerticalRel : public SVGPathSeg
+{
+public:
+
+ /**
+ *
+ */
+ virtual double getY()
+ { return y; }
+
+ /**
+ *
+ */
+ virtual void setY(double val) throw (DOMException)
+ { y = val; }
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGPathSegLinetoVerticalRel()
+ {
+ type = PATHSEG_LINETO_VERTICAL_REL;
+ y = 0.0;
+ }
+
+
+ /**
+ *
+ */
+ SVGPathSegLinetoVerticalRel(double yArg)
+ {
+ type = PATHSEG_LINETO_VERTICAL_REL;
+ y = yArg;
+ }
+
+ /**
+ *
+ */
+ SVGPathSegLinetoVerticalRel(const SVGPathSegLinetoVerticalRel &other)
+ : SVGPathSeg(other)
+ {
+ type = PATHSEG_LINETO_VERTICAL_REL;
+ y = other.y;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGPathSegLinetoVerticalRel() {}
+
+protected:
+
+ double y;
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGPathSegCurvetoCubicSmoothAbs
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGPathSegCurvetoCubicSmoothAbs : public SVGPathSeg
+{
+public:
+
+ /**
+ *
+ */
+ virtual double getX()
+ { return x; }
+
+ /**
+ *
+ */
+ virtual void setX(double val) throw (DOMException)
+ { x = val; }
+
+ /**
+ *
+ */
+ virtual double getY()
+ { return y; }
+
+ /**
+ *
+ */
+ virtual void setY(double val) throw (DOMException)
+ { y = val; }
+
+ /**
+ *
+ */
+ virtual double getX2()
+ { return x2; }
+
+ /**
+ *
+ */
+ virtual void setX2(double val) throw (DOMException)
+ { x2 = val; }
+
+ /**
+ *
+ */
+ virtual double getY2()
+ { return y2; }
+
+ /**
+ *
+ */
+ virtual void setY2(double val) throw (DOMException)
+ { y2 = val; }
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGPathSegCurvetoCubicSmoothAbs()
+ {
+ type = PATHSEG_CURVETO_CUBIC_SMOOTH_ABS;
+ x = y = x2 = y2 = 0.0;
+ }
+
+
+ /**
+ *
+ */
+ SVGPathSegCurvetoCubicSmoothAbs(double xArg, double yArg,
+ double x2Arg, double y2Arg)
+ {
+ type = PATHSEG_CURVETO_CUBIC_SMOOTH_ABS;
+ x = xArg; y = yArg;
+ x2 = x2Arg; y2 = y2Arg;
+ }
+
+ /**
+ *
+ */
+ SVGPathSegCurvetoCubicSmoothAbs(const SVGPathSegCurvetoCubicSmoothAbs &other)
+ : SVGPathSeg(other)
+ {
+ type = PATHSEG_CURVETO_CUBIC_SMOOTH_ABS;
+ x = other.x; y = other.y;
+ x2 = other.x2; y2 = other.y2;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGPathSegCurvetoCubicSmoothAbs() {}
+
+protected:
+
+ double x, y, x2, y2;
+
+};
+
+
+
+/*#########################################################################
+## SVGPathSegCurvetoCubicSmoothRel
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGPathSegCurvetoCubicSmoothRel : public SVGPathSeg
+{
+public:
+
+ /**
+ *
+ */
+ virtual double getX()
+ { return x; }
+
+ /**
+ *
+ */
+ virtual void setX(double val) throw (DOMException)
+ { x = val; }
+
+ /**
+ *
+ */
+ virtual double getY()
+ { return y; }
+
+ /**
+ *
+ */
+ virtual void setY(double val) throw (DOMException)
+ { y = val; }
+
+ /**
+ *
+ */
+ virtual double getX2()
+ { return x2; }
+
+ /**
+ *
+ */
+ virtual void setX2(double val) throw (DOMException)
+ { x2 = val; }
+
+ /**
+ *
+ */
+ virtual double getY2()
+ { return y2; }
+
+ /**
+ *
+ */
+ virtual void setY2(double val) throw (DOMException)
+ { y2 = val; }
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGPathSegCurvetoCubicSmoothRel()
+ {
+ type = PATHSEG_CURVETO_CUBIC_SMOOTH_REL;
+ x = y = x2 = y2 = 0.0;
+ }
+
+
+ /**
+ *
+ */
+ SVGPathSegCurvetoCubicSmoothRel(double xArg, double yArg,
+ double x2Arg, double y2Arg)
+ {
+ type = PATHSEG_CURVETO_CUBIC_SMOOTH_REL;
+ x = xArg; y = yArg;
+ x2 = x2Arg; y2 = y2Arg;
+ }
+
+ /**
+ *
+ */
+ SVGPathSegCurvetoCubicSmoothRel(const SVGPathSegCurvetoCubicSmoothRel &other)
+ : SVGPathSeg(other)
+ {
+ type = PATHSEG_CURVETO_CUBIC_SMOOTH_REL;
+ x = other.x; y = other.y;
+ x2 = other.x2; y2 = other.y2;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGPathSegCurvetoCubicSmoothRel() {}
+
+protected:
+
+ double x, y, x2, y2;
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGPathSegCurvetoQuadraticSmoothAbs
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGPathSegCurvetoQuadraticSmoothAbs : public SVGPathSeg
+{
+public:
+
+ /**
+ *
+ */
+ virtual double getX()
+ { return x; }
+
+ /**
+ *
+ */
+ virtual void setX(double val) throw (DOMException)
+ { x = val; }
+
+ /**
+ *
+ */
+ virtual double getY()
+ { return y; }
+
+ /**
+ *
+ */
+ virtual void setY(double val) throw (DOMException)
+ { y = val; }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGPathSegCurvetoQuadraticSmoothAbs()
+ {
+ type = PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS;
+ x = y = 0.0;
+ }
+
+
+ /**
+ *
+ */
+ SVGPathSegCurvetoQuadraticSmoothAbs(double xArg, double yArg)
+ {
+ type = PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS;
+ x = xArg; y = yArg;
+ }
+
+ /**
+ *
+ */
+ SVGPathSegCurvetoQuadraticSmoothAbs(const SVGPathSegCurvetoQuadraticSmoothAbs &other)
+ : SVGPathSeg(other)
+ {
+ type = PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS;
+ x = y = 0.0;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGPathSegCurvetoQuadraticSmoothAbs() {}
+
+protected:
+
+ double x, y;
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGPathSegCurvetoQuadraticSmoothRel
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGPathSegCurvetoQuadraticSmoothRel : public SVGPathSeg
+{
+public:
+
+ /**
+ *
+ */
+ virtual double getX()
+ { return x; }
+
+ /**
+ *
+ */
+ virtual void setX(double val) throw (DOMException)
+ { x = val; }
+
+ /**
+ *
+ */
+ virtual double getY()
+ { return y; }
+
+ /**
+ *
+ */
+ virtual void setY(double val) throw (DOMException)
+ { y = val; }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGPathSegCurvetoQuadraticSmoothRel()
+ {
+ type = PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL;
+ x = y = 0.0;
+ }
+
+
+ /**
+ *
+ */
+ SVGPathSegCurvetoQuadraticSmoothRel(double xArg, double yArg)
+ {
+ type = PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL;
+ x = xArg; y = yArg;
+ }
+
+ /**
+ *
+ */
+ SVGPathSegCurvetoQuadraticSmoothRel(const SVGPathSegCurvetoQuadraticSmoothRel &other)
+ : SVGPathSeg(other)
+ {
+ type = PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL;
+ x = y = 0.0;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGPathSegCurvetoQuadraticSmoothRel() {}
+
+protected:
+
+ double x, y;
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGPathSegList
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGPathSegList
+{
+public:
+
+ /**
+ *
+ */
+ virtual unsigned long getNumberOfItems()
+ { return items.size(); }
+
+
+ /**
+ *
+ */
+ virtual void clear () throw( DOMException )
+ { items.clear(); }
+
+ /**
+ *
+ */
+ virtual SVGPathSeg initialize (const SVGPathSeg &newItem)
+ throw( DOMException, SVGException )
+ {
+ items.clear();
+ items.push_back(newItem);
+ return newItem;
+ }
+
+ /**
+ *
+ */
+ virtual SVGPathSeg getItem (unsigned long index)
+ throw( DOMException )
+ {
+ if (index >= items.size())
+ {
+ SVGPathSeg seg;
+ return seg;
+ }
+ return items[index];
+ }
+
+ /**
+ *
+ */
+ virtual SVGPathSeg insertItemBefore(const SVGPathSeg &newItem,
+ unsigned long index )
+ throw( DOMException, SVGException )
+ {
+ if (index >= items.size())
+ items.push_back(newItem);
+ else
+ {
+ std::vector<SVGPathSeg>::iterator iter = items.begin() + index;
+ items.insert(iter, newItem);
+ }
+ return newItem;
+ }
+
+ /**
+ *
+ */
+ virtual SVGPathSeg replaceItem(const SVGPathSeg &newItem,
+ unsigned long index )
+ throw( DOMException, SVGException )
+ {
+ if (index >= items.size())
+ {
+ SVGPathSeg seg;
+ return seg;
+ }
+ std::vector<SVGPathSeg>::iterator iter = items.begin() + index;
+ *iter = newItem;
+ return newItem;
+ }
+
+ /**
+ *
+ */
+ virtual SVGPathSeg removeItem (unsigned long index)
+ throw (DOMException)
+ {
+ if (index >= items.size())
+ {
+ SVGPathSeg seg;
+ return seg;
+ }
+ std::vector<SVGPathSeg>::iterator iter = items.begin() + index;
+ SVGPathSeg olditem = *iter;
+ items.erase(iter);
+ return olditem;
+ }
+
+ /**
+ *
+ */
+ virtual SVGPathSeg appendItem (const SVGPathSeg &newItem)
+ throw( DOMException, SVGException )
+ {
+ items.push_back(newItem);
+ return newItem;
+ }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGPathSegList() {}
+
+
+ /**
+ *
+ */
+ SVGPathSegList(const SVGPathSegList &other)
+ {
+ items = other.items;
+ }
+
+
+ /**
+ *
+ */
+ virtual ~SVGPathSegList() {}
+
+protected:
+
+ std::vector<SVGPathSeg> items;
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGAnimatedPathData
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGAnimatedPathData
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGPathSegList getPathSegList()
+ {
+ SVGPathSegList list;
+ return list;
+ }
+
+ /**
+ *
+ */
+ virtual SVGPathSegList getNormalizedPathSegList()
+ {
+ SVGPathSegList list;
+ return list;
+ }
+
+ /**
+ *
+ */
+ virtual SVGPathSegList getAnimatedPathSegList()
+ {
+ SVGPathSegList list;
+ return list;
+ }
+
+ /**
+ *
+ */
+ virtual SVGPathSegList getAnimatedNormalizedPathSegList()
+ {
+ SVGPathSegList list;
+ return list;
+ }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGAnimatedPathData()
+ {}
+
+ /**
+ *
+ */
+ SVGAnimatedPathData(const SVGAnimatedPathData &other)
+ {
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGAnimatedPathData() {}
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGAnimatedPoints
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGAnimatedPoints
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGPointList getPoints()
+ { return points; }
+
+ /**
+ *
+ */
+ virtual SVGPointList getAnimatedPoints()
+ { return animatedPoints; }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGAnimatedPoints() {}
+
+ /**
+ *
+ */
+ SVGAnimatedPoints(const SVGAnimatedPoints &other)
+ {
+ points = other.points;
+ animatedPoints = other.animatedPoints;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGAnimatedPoints() {}
+
+protected:
+
+ SVGPointList points;
+ SVGPointList animatedPoints;
+
+};
+
+
+
+
+
+/*#########################################################################
+## SVGPaint
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGPaint : public SVGColor
+{
+public:
+
+
+ /**
+ * Paint Types
+ */
+ typedef enum
+ {
+ SVG_PAINTTYPE_UNKNOWN = 0,
+ SVG_PAINTTYPE_RGBCOLOR = 1,
+ SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR = 2,
+ SVG_PAINTTYPE_NONE = 101,
+ SVG_PAINTTYPE_CURRENTCOLOR = 102,
+ SVG_PAINTTYPE_URI_NONE = 103,
+ SVG_PAINTTYPE_URI_CURRENTCOLOR = 104,
+ SVG_PAINTTYPE_URI_RGBCOLOR = 105,
+ SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR = 106,
+ SVG_PAINTTYPE_URI = 107
+ } PaintType;
+
+
+ /**
+ *
+ */
+ virtual unsigned short getPaintType()
+ { return paintType; }
+
+ /**
+ *
+ */
+ virtual DOMString getUri()
+ { return uri; }
+
+ /**
+ *
+ */
+ virtual void setUri (const DOMString& uriArg )
+ { uri = uriArg; }
+
+ /**
+ *
+ */
+ virtual void setPaint (unsigned short paintTypeArg,
+ const DOMString& uriArg,
+ const DOMString& rgbColor,
+ const DOMString& iccColor )
+ throw( SVGException )
+ {
+ paintType = paintTypeArg;
+ uri = uriArg;
+ //do something with rgbColor
+ //do something with iccColor;
+ }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGPaint()
+ {
+ uri = "";
+ paintType = SVG_PAINTTYPE_UNKNOWN;
+ }
+
+ /**
+ *
+ */
+ SVGPaint(const SVGPaint &other) : css::CSSValue(other), SVGColor(other)
+ {
+ uri = "";
+ paintType = SVG_PAINTTYPE_UNKNOWN;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGPaint() {}
+
+protected:
+
+ unsigned int paintType;
+ DOMString uri;
+
+};
+
+
+
+
+/*#########################################################################
+## SVGColorProfileRule
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGColorProfileRule : public SVGCSSRule,
+ public SVGRenderingIntent
+{
+
+public:
+ /**
+ *
+ */
+ virtual DOMString getSrc()
+ { return src; }
+
+ /**
+ *
+ */
+ virtual void setSrc(const DOMString &val) throw (DOMException)
+ { src = val; }
+
+ /**
+ *
+ */
+ virtual DOMString getName()
+ { return name; }
+
+ /**
+ *
+ */
+ virtual void setName(const DOMString &val) throw (DOMException)
+ { name = val; }
+
+ /**
+ *
+ */
+ virtual unsigned short getRenderingIntent()
+ { return renderingIntent; }
+
+ /**
+ *
+ */
+ virtual void setRenderingIntent(unsigned short val) throw (DOMException)
+ { renderingIntent = val; }
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGColorProfileRule() {}
+
+ /**
+ *
+ */
+ SVGColorProfileRule(const SVGColorProfileRule &other)
+ : SVGCSSRule(other), SVGRenderingIntent(other)
+ {
+ renderingIntent = other.renderingIntent;
+ src = other.src;
+ name = other.name;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGColorProfileRule() {}
+
+protected:
+
+ unsigned short renderingIntent;
+ DOMString src;
+ DOMString name;
+
+};
+
+
+
+/*#########################################################################
+## SVGFilterPrimitiveStandardAttributes
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGFilterPrimitiveStandardAttributes : public SVGStylable
+{
+public:
+
+
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getX()
+ { return x; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getY()
+ { return y; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getWidth()
+ { return width; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedLength getHeight()
+ { return height; }
+
+ /**
+ *
+ */
+ virtual SVGAnimatedString getResult()
+ { return result; }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+
+ /**
+ *
+ */
+ SVGFilterPrimitiveStandardAttributes()
+ {}
+
+ /**
+ *
+ */
+ SVGFilterPrimitiveStandardAttributes(const SVGFilterPrimitiveStandardAttributes &other)
+ : SVGStylable(other)
+ {
+ x = other.x;
+ y = other.y;
+ width = other.width;
+ height = other.height;
+ result = other.result;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGFilterPrimitiveStandardAttributes() {}
+
+protected:
+
+ SVGAnimatedLength x;
+ SVGAnimatedLength y;
+ SVGAnimatedLength width;
+ SVGAnimatedLength height;
+ SVGAnimatedString result;
+
+};
+
+
+
+
+
+
+
+
+
+
+
+/*#########################################################################
+## SVGEvent
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGEvent : events::Event
+{
+public:
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGEvent() {}
+
+ /**
+ *
+ */
+ SVGEvent(const SVGEvent &other) : events::Event(other)
+ {}
+
+ /**
+ *
+ */
+ virtual ~SVGEvent() {}
+
+};
+
+
+
+
+/*#########################################################################
+## SVGZoomEvent
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGZoomEvent : events::UIEvent
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGRect getZoomRectScreen()
+ { return zoomRectScreen; }
+
+ /**
+ *
+ */
+ virtual double getPreviousScale()
+ { return previousScale; }
+
+ /**
+ *
+ */
+ virtual SVGPoint getPreviousTranslate()
+ { return previousTranslate; }
+
+ /**
+ *
+ */
+ virtual double getNewScale()
+ { return newScale; }
+
+ /**
+ *
+ */
+ virtual SVGPoint getNewTranslate()
+ { return newTranslate; }
+
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGZoomEvent()
+ {}
+
+ /**
+ *
+ */
+ SVGZoomEvent(const SVGZoomEvent &other) : events::Event(other),
+ events::UIEvent(other)
+ {
+ zoomRectScreen = other.zoomRectScreen;
+ previousScale = other.previousScale;
+ previousTranslate = other.previousTranslate;
+ newScale = other.newScale;
+ newTranslate = other.newTranslate;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGZoomEvent() {}
+
+protected:
+
+ SVGRect zoomRectScreen;
+ double previousScale;
+ SVGPoint previousTranslate;
+ double newScale;
+ SVGPoint newTranslate;
+
+};
+
+
+
+/*#########################################################################
+## SVGElementInstance
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGElementInstance : public events::EventTarget
+{
+public:
+
+ /**
+ *
+ */
+ virtual SVGElement *getCorrespondingElement()
+ { return correspondingElement; }
+
+ /**
+ *
+ */
+ virtual SVGUseElement *getCorrespondingUseElement()
+ { return correspondingUseElement; }
+
+ /**
+ *
+ */
+ virtual SVGElementInstance getParentNode()
+ {
+ SVGElementInstance ret;
+ return ret;
+ }
+
+ /**
+ * Since we are using stack types and this is a circular definition,
+ * we will instead implement this as a global function below:
+ * SVGElementInstanceList getChildNodes(const SVGElementInstance instance);
+ */
+ //virtual SVGElementInstanceList getChildNodes();
+
+ /**
+ *
+ */
+ virtual SVGElementInstance getFirstChild()
+ {
+ SVGElementInstance ret;
+ return ret;
+ }
+
+ /**
+ *
+ */
+ virtual SVGElementInstance getLastChild()
+ {
+ SVGElementInstance ret;
+ return ret;
+ }
+
+ /**
+ *
+ */
+ virtual SVGElementInstance getPreviousSibling()
+ {
+ SVGElementInstance ret;
+ return ret;
+ }
+
+ /**
+ *
+ */
+ virtual SVGElementInstance getNextSibling()
+ {
+ SVGElementInstance ret;
+ return ret;
+ }
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGElementInstance() {}
+
+ /**
+ *
+ */
+ SVGElementInstance(const SVGElementInstance &other)
+ : events::EventTarget(other)
+ {
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGElementInstance() {}
+
+protected:
+
+ SVGElement *correspondingElement;
+ SVGUseElement *correspondingUseElement;
+
+};
+
+
+
+
+
+
+/*#########################################################################
+## SVGElementInstanceList
+#########################################################################*/
+
+/**
+ *
+ */
+class SVGElementInstanceList
+{
+public:
+
+
+ /**
+ *
+ */
+ virtual unsigned long getLength()
+ { return items.size(); }
+
+ /**
+ *
+ */
+ virtual SVGElementInstance item (unsigned long index )
+ {
+ if (index >= items.size())
+ {
+ SVGElementInstance ret;
+ return ret;
+ }
+ return items[index];
+ }
+
+ /**
+ * This static method replaces the circular definition of:
+ * SVGElementInstanceList SVGElementInstance::getChildNodes()
+ *
+ */
+ static SVGElementInstanceList getChildNodes(const SVGElementInstance &instance)
+ {
+ SVGElementInstanceList list;
+ return list;
+ }
+
+
+ //##################
+ //# Non-API methods
+ //##################
+
+ /**
+ *
+ */
+ SVGElementInstanceList() {}
+
+ /**
+ *
+ */
+ SVGElementInstanceList(const SVGElementInstanceList &other)
+ {
+ items = other.items;
+ }
+
+ /**
+ *
+ */
+ virtual ~SVGElementInstanceList() {}
+
+protected:
+
+ std::vector<SVGElementInstance> items;
+
+
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+} //namespace svg
+} //namespace dom
+} //namespace w3c
+} //namespace org
+
+#endif /* __SVGTYPES_H__ */
+/*#########################################################################
+## E N D O F F I L E
+#########################################################################*/
+
diff --git a/src/dom/util/thread.cpp b/src/dom/util/thread.cpp
index e88aaa0f0..3bb614b45 100644
--- a/src/dom/util/thread.cpp
+++ b/src/dom/util/thread.cpp
@@ -1,126 +1,126 @@
-/**
- * Phoebe DOM Implementation.
- *
- * This is a C++ approximation of the W3C DOM model, which follows
- * fairly closely the specifications in the various .idl files, copies of
- * which are provided for reference. Most important is this one:
- *
- * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
- *
- * Authors:
- * Bob Jamison
- *
- * Copyright (C) 2006 Bob Jamison
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * Thread wrapper. This provides a platform-independent thread
- * class for IO and testing.
- *
- */
-
-#include "thread.h"
-#include <stdio.h>
-#include <string.h>
-
-namespace org
-{
-namespace w3c
-{
-namespace dom
-{
-namespace util
-{
-
-
-#ifdef __WIN32__
-#include <windows.h>
-
-static DWORD WINAPI WinThreadFunction(LPVOID context)
-{
- Thread *thread = (Thread *)context;
- thread->execute();
- return 0;
-}
-
-
-void Thread::start()
-{
- DWORD dwThreadId;
- HANDLE hThread = CreateThread(NULL, 0, WinThreadFunction,
- (LPVOID)this, 0, &dwThreadId);
- //Make sure the thread is started before 'this' is deallocated
- while (!started)
- sleep(10);
- CloseHandle(hThread);
-}
-
-void Thread::sleep(unsigned long millis)
-{
- Sleep(millis);
-}
-
-
-
-#else /* UNIX */
-#include <pthread.h>
-
-void *PthreadThreadFunction(void *context)
-{
- Thread *thread = (Thread *)context;
- thread->execute();
- return NULL;
-}
-
-
-void Thread::start()
-{
- pthread_t thread;
-
- int ret = pthread_create(&thread, NULL,
- PthreadThreadFunction, (void *)this);
- if (ret != 0)
- printf("Thread::start: thread creation failed: %s\n", strerror(ret));
-
- //Make sure the thread is started before 'this' is deallocated
- while (!started)
- sleep(10);
-
-}
-
-void Thread::sleep(unsigned long millis)
-{
- timespec requested;
- requested.tv_sec = millis / 1000;
- requested.tv_nsec = (millis % 1000 ) * 1000000L;
- nanosleep(&requested, NULL);
-}
-
-#endif /* __WIN32__ */
-
-} //namespace util
-} //namespace dom
-} //namespace w3c
-} //namespace org
-
-
-
-//#########################################################################
-//# E N D O F F I L E
-//#########################################################################
-
-
+/**
+ * Phoebe DOM Implementation.
+ *
+ * This is a C++ approximation of the W3C DOM model, which follows
+ * fairly closely the specifications in the various .idl files, copies of
+ * which are provided for reference. Most important is this one:
+ *
+ * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
+ *
+ * Authors:
+ * Bob Jamison
+ *
+ * Copyright (C) 2006 Bob Jamison
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * Thread wrapper. This provides a platform-independent thread
+ * class for IO and testing.
+ *
+ */
+
+#include "thread.h"
+#include <stdio.h>
+#include <string.h>
+
+namespace org
+{
+namespace w3c
+{
+namespace dom
+{
+namespace util
+{
+
+
+#ifdef __WIN32__
+#include <windows.h>
+
+static DWORD WINAPI WinThreadFunction(LPVOID context)
+{
+ Thread *thread = (Thread *)context;
+ thread->execute();
+ return 0;
+}
+
+
+void Thread::start()
+{
+ DWORD dwThreadId;
+ HANDLE hThread = CreateThread(NULL, 0, WinThreadFunction,
+ (LPVOID)this, 0, &dwThreadId);
+ //Make sure the thread is started before 'this' is deallocated
+ while (!started)
+ sleep(10);
+ CloseHandle(hThread);
+}
+
+void Thread::sleep(unsigned long millis)
+{
+ Sleep(millis);
+}
+
+
+
+#else /* UNIX */
+#include <pthread.h>
+
+void *PthreadThreadFunction(void *context)
+{
+ Thread *thread = (Thread *)context;
+ thread->execute();
+ return NULL;
+}
+
+
+void Thread::start()
+{
+ pthread_t thread;
+
+ int ret = pthread_create(&thread, NULL,
+ PthreadThreadFunction, (void *)this);
+ if (ret != 0)
+ printf("Thread::start: thread creation failed: %s\n", strerror(ret));
+
+ //Make sure the thread is started before 'this' is deallocated
+ while (!started)
+ sleep(10);
+
+}
+
+void Thread::sleep(unsigned long millis)
+{
+ timespec requested;
+ requested.tv_sec = millis / 1000;
+ requested.tv_nsec = (millis % 1000 ) * 1000000L;
+ nanosleep(&requested, NULL);
+}
+
+#endif /* __WIN32__ */
+
+} //namespace util
+} //namespace dom
+} //namespace w3c
+} //namespace org
+
+
+
+//#########################################################################
+//# E N D O F F I L E
+//#########################################################################
+
+
diff --git a/src/dom/util/thread.h b/src/dom/util/thread.h
index 37c68ffc8..dfad6d9b3 100644
--- a/src/dom/util/thread.h
+++ b/src/dom/util/thread.h
@@ -1,155 +1,155 @@
-#ifndef __DOM_THREAD_H__
-#define __DOM_THREAD_H__
-/**
- * Phoebe DOM Implementation.
- *
- * This is a C++ approximation of the W3C DOM model, which follows
- * fairly closely the specifications in the various .idl files, copies of
- * which are provided for reference. Most important is this one:
- *
- * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
- *
- * Authors:
- * Bob Jamison
- *
- * Copyright (C) 2006 Bob Jamison
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * Thread wrapper. This provides a platform-independent thread
- * class for IO and testing.
- *
- */
-
-
-namespace org
-{
-namespace w3c
-{
-namespace dom
-{
-namespace util
-{
-
-
-/**
- * This is the interface for a delegate class which can
- * be run by a Thread.
- * Thread thread(runnable);
- * thread.start();
- */
-class Runnable
-{
-public:
-
- Runnable()
- {}
- virtual ~Runnable()
- {}
-
- /**
- * The method of a delegate class which can
- * be run by a Thread. Thread is completed when this
- * method is done.
- */
- virtual void run() = 0;
-
-};
-
-
-
-/**
- * A simple wrapper of native threads in a portable class.
- * It can be used either to execute its own run() method, or
- * delegate to a Runnable class's run() method.
- */
-class Thread
-{
-public:
-
- /**
- * Create a thread which will execute its own run() method.
- */
- Thread()
- { runnable = (Runnable *)0 ; started = false; }
-
- /**
- * Create a thread which will run a Runnable class's run() method.
- */
- Thread(const Runnable &runner)
- { runnable = (Runnable *)&runner; started = false; }
-
- /**
- * This does not kill a spawned thread.
- */
- virtual ~Thread()
- {}
-
- /**
- * Static method to pause the current thread for a given
- * number of milliseconds.
- */
- static void sleep(unsigned long millis);
-
- /**
- * This method will be executed if the Thread was created with
- * no delegated Runnable class. The thread is completed when
- * the method is done.
- */
- virtual void run()
- {}
-
- /**
- * Starts the thread.
- */
- virtual void start();
-
- /**
- * Calls either this class's run() method, or that of a Runnable.
- * A user would normally not call this directly.
- */
- virtual void execute()
- {
- started = true;
- if (runnable)
- runnable->run();
- else
- run();
- }
-
-private:
-
- Runnable *runnable;
-
- bool started;
-
-};
-
-
-} //namespace util
-} //namespace dom
-} //namespace w3c
-} //namespace org
-
-
-
-#endif /* __DOM_THREAD_H__ */
-//#########################################################################
-//# E N D O F F I L E
-//#########################################################################
-
-
+#ifndef __DOM_THREAD_H__
+#define __DOM_THREAD_H__
+/**
+ * Phoebe DOM Implementation.
+ *
+ * This is a C++ approximation of the W3C DOM model, which follows
+ * fairly closely the specifications in the various .idl files, copies of
+ * which are provided for reference. Most important is this one:
+ *
+ * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
+ *
+ * Authors:
+ * Bob Jamison
+ *
+ * Copyright (C) 2006 Bob Jamison
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * Thread wrapper. This provides a platform-independent thread
+ * class for IO and testing.
+ *
+ */
+
+
+namespace org
+{
+namespace w3c
+{
+namespace dom
+{
+namespace util
+{
+
+
+/**
+ * This is the interface for a delegate class which can
+ * be run by a Thread.
+ * Thread thread(runnable);
+ * thread.start();
+ */
+class Runnable
+{
+public:
+
+ Runnable()
+ {}
+ virtual ~Runnable()
+ {}
+
+ /**
+ * The method of a delegate class which can
+ * be run by a Thread. Thread is completed when this
+ * method is done.
+ */
+ virtual void run() = 0;
+
+};
+
+
+
+/**
+ * A simple wrapper of native threads in a portable class.
+ * It can be used either to execute its own run() method, or
+ * delegate to a Runnable class's run() method.
+ */
+class Thread
+{
+public:
+
+ /**
+ * Create a thread which will execute its own run() method.
+ */
+ Thread()
+ { runnable = (Runnable *)0 ; started = false; }
+
+ /**
+ * Create a thread which will run a Runnable class's run() method.
+ */
+ Thread(const Runnable &runner)
+ { runnable = (Runnable *)&runner; started = false; }
+
+ /**
+ * This does not kill a spawned thread.
+ */
+ virtual ~Thread()
+ {}
+
+ /**
+ * Static method to pause the current thread for a given
+ * number of milliseconds.
+ */
+ static void sleep(unsigned long millis);
+
+ /**
+ * This method will be executed if the Thread was created with
+ * no delegated Runnable class. The thread is completed when
+ * the method is done.
+ */
+ virtual void run()
+ {}
+
+ /**
+ * Starts the thread.
+ */
+ virtual void start();
+
+ /**
+ * Calls either this class's run() method, or that of a Runnable.
+ * A user would normally not call this directly.
+ */
+ virtual void execute()
+ {
+ started = true;
+ if (runnable)
+ runnable->run();
+ else
+ run();
+ }
+
+private:
+
+ Runnable *runnable;
+
+ bool started;
+
+};
+
+
+} //namespace util
+} //namespace dom
+} //namespace w3c
+} //namespace org
+
+
+
+#endif /* __DOM_THREAD_H__ */
+//#########################################################################
+//# E N D O F F I L E
+//#########################################################################
+
+
diff --git a/src/dom/util/ziptool.cpp b/src/dom/util/ziptool.cpp
index 99df889d9..7dbd07be5 100644
--- a/src/dom/util/ziptool.cpp
+++ b/src/dom/util/ziptool.cpp
@@ -1,2984 +1,2984 @@
-/**
- * This is intended to be a standalone, reduced capability
- * implementation of Gzip and Zip functionality. Its
- * targeted use case is for archiving and retrieving single files
- * which use these encoding types. Being memory based and
- * non-optimized, it is not useful in cases where very large
- * archives are needed or where high performance is desired.
- * However, it should hopefully work very well for smaller,
- * one-at-a-time tasks. What you get in return is the ability
- * to drop these files into your project and remove the dependencies
- * on ZLib and Info-Zip. Enjoy.
- *
- * Authors:
- * Bob Jamison
- *
- * Copyright (C) 2006 Bob Jamison
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <time.h>
-
-#include <string>
-
-#include "ziptool.h"
-
-
-
-
-
-
-//########################################################################
-//# A D L E R 3 2
-//########################################################################
-
-/**
- * Constructor
- */
-Adler32::Adler32()
-{
- reset();
-}
-
-/**
- * Destructor
- */
-Adler32::~Adler32()
-{
-}
-
-/**
- * Reset Adler-32 checksum to initial value.
- */
-void Adler32::reset()
-{
- value = 1;
-}
-
-// ADLER32_BASE is the largest prime number smaller than 65536
-#define ADLER32_BASE 65521
-
-void Adler32::update(unsigned char b)
-{
- unsigned long s1 = value & 0xffff;
- unsigned long s2 = (value >> 16) & 0xffff;
- s1 += b & 0xff;
- s2 += s1;
- value = ((s2 % ADLER32_BASE) << 16) | (s1 % ADLER32_BASE);
-}
-
-void Adler32::update(char *str)
-{
- if (str)
- while (*str)
- update((unsigned char)*str++);
-}
-
-
-/**
- * Returns current checksum value.
- */
-unsigned long Adler32::getValue()
-{
- return value & 0xffffffffL;
-}
-
-
-
-//########################################################################
-//# C R C 3 2
-//########################################################################
-
-/**
- * Constructor
- */
-Crc32::Crc32()
-{
- reset();
-}
-
-/**
- * Destructor
- */
-Crc32::~Crc32()
-{
-}
-
-static bool crc_table_ready = false;
-static unsigned long crc_table[256];
-
-/**
- * make the table for a fast CRC.
- */
-void makeCrcTable()
-{
- if (crc_table_ready)
- return;
- for (int n = 0; n < 256; n++)
- {
- unsigned long c = n;
- for (int k = 8; --k >= 0; )
- {
- if ((c & 1) != 0)
- c = 0xedb88320 ^ (c >> 1);
- else
- c >>= 1;
- }
- crc_table[n] = c;
- }
- crc_table_ready = true;
-}
-
-
-/**
- * Reset CRC-32 checksum to initial value.
- */
-void Crc32::reset()
-{
- value = 0;
- makeCrcTable();
-}
-
-void Crc32::update(unsigned char b)
-{
- unsigned long c = ~value;
- c = crc_table[(c ^ b) & 0xff] ^ (c >> 8);
- value = ~c;
-}
-
-
-void Crc32::update(char *str)
-{
- if (str)
- while (*str)
- update((unsigned char)*str++);
-}
-
-void Crc32::update(const std::vector<unsigned char> &buf)
-{
- std::vector<unsigned char>::const_iterator iter;
- for (iter=buf.begin() ; iter!=buf.end() ; iter++)
- {
- unsigned char ch = *iter;
- update(ch);
- }
-}
-
-
-/**
- * Returns current checksum value.
- */
-unsigned long Crc32::getValue()
-{
- return value & 0xffffffffL;
-}
-
-//########################################################################
-//# I N F L A T E R
-//########################################################################
-
-
-/**
- *
- */
-typedef struct
-{
- int *count; // number of symbols of each length
- int *symbol; // canonically ordered symbols
-} Huffman;
-
-/**
- *
- */
-class Inflater
-{
-public:
-
- Inflater();
-
- virtual ~Inflater();
-
- static const int MAXBITS = 15; // max bits in a code
- static const int MAXLCODES = 286; // max number of literal/length codes
- static const int MAXDCODES = 30; // max number of distance codes
- static const int MAXCODES = 316; // max codes lengths to read
- static const int FIXLCODES = 288; // number of fixed literal/length codes
-
- /**
- *
- */
- bool inflate(std::vector<unsigned char> &destination,
- std::vector<unsigned char> &source);
-
-private:
-
- /**
- *
- */
- void error(char *fmt, ...);
-
- /**
- *
- */
- void trace(char *fmt, ...);
-
- /**
- *
- */
- void dump();
-
- /**
- *
- */
- int buildHuffman(Huffman *h, int *length, int n);
-
- /**
- *
- */
- bool getBits(int need, int *oval);
-
- /**
- *
- */
- int doDecode(Huffman *h);
-
- /**
- *
- */
- bool doCodes(Huffman *lencode, Huffman *distcode);
-
- /**
- *
- */
- bool doStored();
-
- /**
- *
- */
- bool doFixed();
-
- /**
- *
- */
- bool doDynamic();
-
-
- std::vector<unsigned char>dest;
-
- std::vector<unsigned char>src;
- unsigned long srcPos; //current read position
- int bitBuf;
- int bitCnt;
-
-};
-
-
-/**
- *
- */
-Inflater::Inflater()
-{
-}
-
-/**
- *
- */
-Inflater::~Inflater()
-{
-}
-
-/**
- *
- */
-void Inflater::error(char *fmt, ...)
-{
- va_list args;
- va_start(args, fmt);
- fprintf(stdout, "Inflater error:");
- vfprintf(stdout, fmt, args);
- fprintf(stdout, "\n");
- va_end(args);
-}
-
-/**
- *
- */
-void Inflater::trace(char *fmt, ...)
-{
- va_list args;
- va_start(args, fmt);
- fprintf(stdout, "Inflater:");
- vfprintf(stdout, fmt, args);
- fprintf(stdout, "\n");
- va_end(args);
-}
-
-
-/**
- *
- */
-void Inflater::dump()
-{
- for (unsigned int i=0 ; i<dest.size() ; i++)
- {
- fputc(dest[i], stdout);
- }
-}
-
-/**
- *
- */
-int Inflater::buildHuffman(Huffman *h, int *length, int n)
-{
- // count number of codes of each length
- for (int len = 0; len <= MAXBITS; len++)
- h->count[len] = 0;
- for (int symbol = 0; symbol < n; symbol++)
- (h->count[length[symbol]])++; // assumes lengths are within bounds
- if (h->count[0] == n) // no codes!
- {
- error("huffman tree will result in failed decode");
- return -1;
- }
-
- // check for an over-subscribed or incomplete set of lengths
- int left = 1; // number of possible codes left of current length
- for (int len = 1; len <= MAXBITS; len++)
- {
- left <<= 1; // one more bit, double codes left
- left -= h->count[len]; // deduct count from possible codes
- if (left < 0)
- {
- error("huffman over subscribed");
- return -1;
- }
- }
-
- // generate offsets into symbol table for each length for sorting
- int offs[MAXBITS+1]; //offsets in symbol table for each length
- offs[1] = 0;
- for (int len = 1; len < MAXBITS; len++)
- offs[len + 1] = offs[len] + h->count[len];
-
- /*
- * put symbols in table sorted by length, by symbol order within each
- * length
- */
- for (int symbol = 0; symbol < n; symbol++)
- if (length[symbol] != 0)
- h->symbol[offs[length[symbol]]++] = symbol;
-
- // return zero for complete set, positive for incomplete set
- return left;
-}
-
-
-/**
- *
- */
-bool Inflater::getBits(int requiredBits, int *oval)
-{
- long val = bitBuf;
-
- //add more bytes if needed
- while (bitCnt < requiredBits)
- {
- if (srcPos >= src.size())
- {
- error("premature end of input");
- return false;
- }
- val |= ((long)(src[srcPos++])) << bitCnt;
- bitCnt += 8;
- }
-
- //update the buffer and return the data
- bitBuf = (int)(val >> requiredBits);
- bitCnt -= requiredBits;
- *oval = (int)(val & ((1L << requiredBits) - 1));
-
- return true;
-}
-
-
-/**
- *
- */
-int Inflater::doDecode(Huffman *h)
-{
- int bitTmp = bitBuf;
- int left = bitCnt;
- int code = 0;
- int first = 0;
- int index = 0;
- int len = 1;
- int *next = h->count + 1;
- while (true)
- {
- while (left--)
- {
- code |= bitTmp & 1;
- bitTmp >>= 1;
- int count = *next++;
- if (code < first + count)
- { /* if length len, return symbol */
- bitBuf = bitTmp;
- bitCnt = (bitCnt - len) & 7;
- return h->symbol[index + (code - first)];
- }
- index += count;
- first += count;
- first <<= 1;
- code <<= 1;
- len++;
- }
- left = (MAXBITS+1) - len;
- if (left == 0)
- break;
- if (srcPos >= src.size())
- {
- error("premature end of input");
- dump();
- return -1;
- }
- bitTmp = src[srcPos++];
- if (left > 8)
- left = 8;
- }
-
- error("no end of block found");
- return -1;
-}
-
-/**
- *
- */
-bool Inflater::doCodes(Huffman *lencode, Huffman *distcode)
-{
- static const int lens[29] = { // Size base for length codes 257..285
- 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
- 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258};
- static const int lext[29] = { // Extra bits for length codes 257..285
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
- 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0};
- static const int dists[30] = { // Offset base for distance codes 0..29
- 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
- 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
- 8193, 12289, 16385, 24577};
- static const int dext[30] = { // Extra bits for distance codes 0..29
- 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
- 7, 7, 8, 8, 9, 9, 10, 10, 11, 11,
- 12, 12, 13, 13};
-
- //decode literals and length/distance pairs
- while (true)
- {
- int symbol = doDecode(lencode);
- if (symbol == 256)
- break;
- if (symbol < 0)
- {
- return false;
- }
- if (symbol < 256) //literal
- {
- dest.push_back(symbol);
- }
- else if (symbol > 256)//length
- {
- symbol -= 257;
- if (symbol >= 29)
- {
- error("invalid fixed code");
- return false;
- }
- int ret;
- if (!getBits(lext[symbol], &ret))
- return false;
- int len = lens[symbol] + ret;
-
- symbol = doDecode(distcode);//distance
- if (symbol < 0)
- {
- return false;
- }
-
- if (!getBits(dext[symbol], &ret))
- return false;
- unsigned int dist = dists[symbol] + ret;
- if (dist > dest.size())
- {
- error("distance too far back %d/%d", dist, dest.size());
- dump();
- //printf("pos:%d\n", srcPos);
- return false;
- }
-
- // copy length bytes from distance bytes back
- //dest.push_back('{');
- while (len--)
- {
- dest.push_back(dest[dest.size() - dist]);
- }
- //dest.push_back('}');
-
- }
- }
-
- return true;
-}
-
-/**
- */
-bool Inflater::doStored()
-{
- //trace("### stored ###");
-
- // clear bits from current byte
- bitBuf = 0;
- bitCnt = 0;
-
- // length
- if (srcPos + 4 > src.size())
- {
- error("not enough input");
- return false;
- }
-
- int len = src[srcPos++];
- len |= src[srcPos++] << 8;
- //trace("### len:%d", len);
- // check complement
- if (src[srcPos++] != (~len & 0xff) ||
- src[srcPos++] != ((~len >> 8) & 0xff))
- {
- error("twos complement for storage size do not match");
- return false;
- }
-
- // copy data
- if (srcPos + len > src.size())
- {
- error("Not enough input for stored block");
- return false;
- }
- while (len--)
- dest.push_back(src[srcPos++]);
-
- return true;
-}
-
-/**
- */
-bool Inflater::doFixed()
-{
- //trace("### fixed ###");
-
- static bool firstTime = true;
- static int lencnt[MAXBITS+1], lensym[FIXLCODES];
- static int distcnt[MAXBITS+1], distsym[MAXDCODES];
- static Huffman lencode = {lencnt, lensym};
- static Huffman distcode = {distcnt, distsym};
-
- if (firstTime)
- {
- firstTime = false;
-
- int lengths[FIXLCODES];
-
- // literal/length table
- int symbol = 0;
- for ( ; symbol < 144; symbol++)
- lengths[symbol] = 8;
- for ( ; symbol < 256; symbol++)
- lengths[symbol] = 9;
- for ( ; symbol < 280; symbol++)
- lengths[symbol] = 7;
- for ( ; symbol < FIXLCODES; symbol++)
- lengths[symbol] = 8;
- buildHuffman(&lencode, lengths, FIXLCODES);
-
- // distance table
- for (int symbol = 0; symbol < MAXDCODES; symbol++)
- lengths[symbol] = 5;
- buildHuffman(&distcode, lengths, MAXDCODES);
- }
-
- // decode data until end-of-block code
- bool ret = doCodes(&lencode, &distcode);
- return ret;
-}
-
-/**
- */
-bool Inflater::doDynamic()
-{
- //trace("### dynamic ###");
- int lengths[MAXCODES]; // descriptor code lengths
- int lencnt[MAXBITS+1], lensym[MAXLCODES]; // lencode memory
- int distcnt[MAXBITS+1], distsym[MAXDCODES]; // distcode memory
- Huffman lencode = {lencnt, lensym}; // length code
- Huffman distcode = {distcnt, distsym}; // distance code
- static const int order[19] = // permutation of code length codes
- {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
-
- // get number of lengths in each table, check lengths
- int ret;
- if (!getBits(5, &ret))
- return false;
- int nlen = ret + 257;
- if (!getBits(5, &ret))
- return false;
- int ndist = ret + 1;
- if (!getBits(4, &ret))
- return false;
- int ncode = ret + 4;
- if (nlen > MAXLCODES || ndist > MAXDCODES)
- {
- error("Bad codes");
- return false;
- }
-
- // get code length code lengths
- int index = 0;
- for ( ; index < ncode; index++)
- {
- if (!getBits(3, &ret))
- return false;
- lengths[order[index]] = ret;
- }
- for ( ; index < 19; index++)
- lengths[order[index]] = 0;
-
- // build huffman table for code lengths codes
- if (buildHuffman(&lencode, lengths, 19) != 0)
- return false;
-
- // read length/literal and distance code length tables
- index = 0;
- while (index < nlen + ndist)
- {
- int symbol = doDecode(&lencode);
- if (symbol < 16) // length in 0..15
- lengths[index++] = symbol;
- else
- { // repeat instruction
- int len = 0; // assume repeating zeros
- if (symbol == 16)
- { // repeat last length 3..6 times
- if (index == 0)
- {
- error("no last length");
- return false;
- }
- len = lengths[index - 1];// last length
- if (!getBits(2, &ret))
- return false;
- symbol = 3 + ret;
- }
- else if (symbol == 17) // repeat zero 3..10 times
- {
- if (!getBits(3, &ret))
- return false;
- symbol = 3 + ret;
- }
- else // == 18, repeat zero 11..138 times
- {
- if (!getBits(7, &ret))
- return false;
- symbol = 11 + ret;
- }
- if (index + symbol > nlen + ndist)
- {
- error("too many lengths");
- return false;
- }
- while (symbol--) // repeat last or zero symbol times
- lengths[index++] = len;
- }
- }
-
- // build huffman table for literal/length codes
- int err = buildHuffman(&lencode, lengths, nlen);
- if (err < 0 || (err > 0 && nlen - lencode.count[0] != 1))
- {
- error("incomplete length codes");
- //return false;
- }
- // build huffman table for distance codes
- err = buildHuffman(&distcode, lengths + nlen, ndist);
- if (err < 0 || (err > 0 && nlen - lencode.count[0] != 1))
- {
- error("incomplete dist codes");
- return false;
- }
-
- // decode data until end-of-block code
- bool retn = doCodes(&lencode, &distcode);
- return retn;
-}
-
-/**
- */
-bool Inflater::inflate(std::vector<unsigned char> &destination,
- std::vector<unsigned char> &source)
-{
- dest.clear();
- src = source;
- srcPos = 0;
- bitBuf = 0;
- bitCnt = 0;
-
- while (true)
- {
- int last; // one if last block
- if (!getBits(1, &last))
- return false;
- int type; // block type 0..3
- if (!getBits(2, &type))
- return false;
- switch (type)
- {
- case 0:
- if (!doStored())
- return false;
- break;
- case 1:
- if (!doFixed())
- return false;
- break;
- case 2:
- if (!doDynamic())
- return false;
- break;
- default:
- error("Unknown block type %d", type);
- return false;
- }
- if (last)
- break;
- }
-
- destination = dest;
-
- return true;
-}
-
-
-
-
-
-
-//########################################################################
-//# D E F L A T E R
-//########################################################################
-
-
-
-class Deflater
-{
-public:
-
- /**
- *
- */
- Deflater();
-
- /**
- *
- */
- virtual ~Deflater();
-
- /**
- *
- */
- virtual void reset();
-
- /**
- *
- */
- virtual bool update(int ch);
-
- /**
- *
- */
- virtual bool finish();
-
- /**
- *
- */
- virtual std::vector<unsigned char> &getCompressed();
-
- /**
- *
- */
- bool deflate(std::vector<unsigned char> &dest,
- const std::vector<unsigned char> &src);
-
- void encodeDistStatic(unsigned int len, unsigned int dist);
-
-private:
-
- //debug messages
- void error(char *fmt, ...);
- void trace(char *fmt, ...);
-
- bool compressWindow();
-
- bool compress();
-
- std::vector<unsigned char> uncompressed;
-
- std::vector<unsigned char> window;
-
- unsigned int windowPos;
-
- std::vector<unsigned char> compressed;
-
- //#### Output
- unsigned int outputBitBuf;
- unsigned int outputNrBits;
-
- void put(int ch);
-
- void putWord(int ch);
-
- void putFlush();
-
- void putBits(unsigned int ch, unsigned int bitsWanted);
-
- void putBitsR(unsigned int ch, unsigned int bitsWanted);
-
- //#### Huffman Encode
- void encodeLiteralStatic(unsigned int ch);
-
- unsigned char windowBuf[32768];
- //assume 32-bit ints
- unsigned int windowHashBuf[32768];
-};
-
-
-//########################################################################
-//# A P I
-//########################################################################
-
-
-/**
- *
- */
-Deflater::Deflater()
-{
- reset();
-}
-
-/**
- *
- */
-Deflater::~Deflater()
-{
-
-}
-
-/**
- *
- */
-void Deflater::reset()
-{
- outputBitBuf = 0;
- outputNrBits = 0;
- window.clear();
- compressed.clear();
- uncompressed.clear();
-}
-
-/**
- *
- */
-bool Deflater::update(int ch)
-{
- uncompressed.push_back((unsigned char)(ch & 0xff));
- return true;
-}
-
-/**
- *
- */
-bool Deflater::finish()
-{
- return compress();
-}
-
-/**
- *
- */
-std::vector<unsigned char> &Deflater::getCompressed()
-{
- return compressed;
-}
-
-
-/**
- *
- */
-bool Deflater::deflate(std::vector<unsigned char> &dest,
- const std::vector<unsigned char> &src)
-{
- reset();
- uncompressed = src;
- if (!compress())
- return false;
- dest = compressed;
- return true;
-}
-
-
-
-
-
-
-
-//########################################################################
-//# W O R K I N G C O D E
-//########################################################################
-
-
-//#############################
-//# M E S S A G E S
-//#############################
-
-/**
- * Print error messages
- */
-void Deflater::error(char *fmt, ...)
-{
- va_list args;
- va_start(args, fmt);
- fprintf(stdout, "Deflater error:");
- vfprintf(stdout, fmt, args);
- fprintf(stdout, "\n");
- va_end(args);
-}
-
-/**
- * Print trace messages
- */
-void Deflater::trace(char *fmt, ...)
-{
- va_list args;
- va_start(args, fmt);
- fprintf(stdout, "Deflater:");
- vfprintf(stdout, fmt, args);
- fprintf(stdout, "\n");
- va_end(args);
-}
-
-
-
-
-//#############################
-//# O U T P U T
-//#############################
-
-/**
- *
- */
-void Deflater::put(int ch)
-{
- compressed.push_back(ch);
- outputBitBuf = 0;
- outputNrBits = 0;
-}
-
-/**
- *
- */
-void Deflater::putWord(int ch)
-{
- int lo = (ch ) & 0xff;
- int hi = (ch>>8) & 0xff;
- put(lo);
- put(hi);
-}
-
-/**
- *
- */
-void Deflater::putFlush()
-{
- if (outputNrBits > 0)
- {
- put(outputBitBuf & 0xff);
- }
- outputBitBuf = 0;
- outputNrBits = 0;
-}
-
-/**
- *
- */
-void Deflater::putBits(unsigned int ch, unsigned int bitsWanted)
-{
- //trace("n:%4u, %d\n", ch, bitsWanted);
-
- while (bitsWanted--)
- {
- //add bits to position 7. shift right
- outputBitBuf = (outputBitBuf>>1) + (ch<<7 & 0x80);
- ch >>= 1;
- outputNrBits++;
- if (outputNrBits >= 8)
- {
- unsigned char b = outputBitBuf & 0xff;
- //printf("b:%02x\n", b);
- put(b);
- }
- }
-}
-
-static unsigned int bitReverse(unsigned int code, unsigned int nrBits)
-{
- unsigned int outb = 0;
- while (nrBits--)
- {
- outb = (outb << 1) | (code & 0x01);
- code >>= 1;
- }
- return outb;
-}
-
-
-/**
- *
- */
-void Deflater::putBitsR(unsigned int ch, unsigned int bitsWanted)
-{
- //trace("r:%4u, %d", ch, bitsWanted);
-
- unsigned int rcode = bitReverse(ch, bitsWanted);
-
- putBits(rcode, bitsWanted);
-
-}
-
-
-//#############################
-//# E N C O D E
-//#############################
-
-
-
-void Deflater::encodeLiteralStatic(unsigned int ch)
-{
- //trace("c: %d", ch);
-
- if (ch < 144)
- {
- putBitsR(ch + 0x0030 , 8); // 00110000
- }
- else if (ch < 256)
- {
- putBitsR(ch - 144 + 0x0190 , 9); // 110010000
- }
- else if (ch < 280)
- {
- putBitsR(ch - 256 + 0x0000 , 7); // 0000000
- }
- else if (ch < 288)
- {
- putBitsR(ch - 280 + 0x00c0 , 8); // 11000000
- }
- else //out of range
- {
- error("Literal out of range: %d", ch);
- }
-
-}
-
-
-typedef struct
-{
- unsigned int base;
- unsigned int range;
- unsigned int bits;
-} LenBase;
-
-LenBase lenBases[] =
-{
- { 3, 1, 0 },
- { 4, 1, 0 },
- { 5, 1, 0 },
- { 6, 1, 0 },
- { 7, 1, 0 },
- { 8, 1, 0 },
- { 9, 1, 0 },
- { 10, 1, 0 },
- { 11, 2, 1 },
- { 13, 2, 1 },
- { 15, 2, 1 },
- { 17, 2, 1 },
- { 19, 4, 2 },
- { 23, 4, 2 },
- { 27, 4, 2 },
- { 31, 4, 2 },
- { 35, 8, 3 },
- { 43, 8, 3 },
- { 51, 8, 3 },
- { 59, 8, 3 },
- { 67, 16, 4 },
- { 83, 16, 4 },
- { 99, 16, 4 },
- { 115, 16, 4 },
- { 131, 32, 5 },
- { 163, 32, 5 },
- { 195, 32, 5 },
- { 227, 32, 5 },
- { 258, 1, 0 }
-};
-
-typedef struct
-{
- unsigned int base;
- unsigned int range;
- unsigned int bits;
-} DistBase;
-
-DistBase distBases[] =
-{
- { 1, 1, 0 },
- { 2, 1, 0 },
- { 3, 1, 0 },
- { 4, 1, 0 },
- { 5, 2, 1 },
- { 7, 2, 1 },
- { 9, 4, 2 },
- { 13, 4, 2 },
- { 17, 8, 3 },
- { 25, 8, 3 },
- { 33, 16, 4 },
- { 49, 16, 4 },
- { 65, 32, 5 },
- { 97, 32, 5 },
- { 129, 64, 6 },
- { 193, 64, 6 },
- { 257, 128, 7 },
- { 385, 128, 7 },
- { 513, 256, 8 },
- { 769, 256, 8 },
- { 1025, 512, 9 },
- { 1537, 512, 9 },
- { 2049, 1024, 10 },
- { 3073, 1024, 10 },
- { 4097, 2048, 11 },
- { 6145, 2048, 11 },
- { 8193, 4096, 12 },
- { 12289, 4096, 12 },
- { 16385, 8192, 13 },
- { 24577, 8192, 13 }
-};
-
-void Deflater::encodeDistStatic(unsigned int len, unsigned int dist)
-{
-
- //## Output length
-
- if (len < 3 || len > 258)
- {
- error("Length out of range:%d", len);
- return;
- }
-
- bool found = false;
- for (int i=0 ; i<30 ; i++)
- {
- unsigned int base = lenBases[i].base;
- unsigned int range = lenBases[i].range;
- if (base + range > len)
- {
- unsigned int lenCode = 257 + i;
- unsigned int length = len - base;
- //trace("--- %d %d %d %d", len, base, range, length);
- encodeLiteralStatic(lenCode);
- putBits(length, lenBases[i].bits);
- found = true;
- break;
- }
- }
- if (!found)
- {
- error("Length not found in table:%d", len);
- return;
- }
-
- //## Output distance
-
- if (dist < 4 || dist > 32768)
- {
- error("Distance out of range:%d", dist);
- return;
- }
-
- found = false;
- for (int i=0 ; i<30 ; i++)
- {
- unsigned int base = distBases[i].base;
- unsigned int range = distBases[i].range;
- if (base + range > dist)
- {
- unsigned int distCode = i;
- unsigned int distance = dist - base;
- //error("--- %d %d %d %d", dist, base, range, distance);
- putBitsR(distCode, 5);
- putBits(distance, distBases[i].bits);
- found = true;
- break;
- }
- }
- if (!found)
- {
- error("Distance not found in table:%d", dist);
- return;
- }
-}
-
-
-//#############################
-//# C O M P R E S S
-//#############################
-
-
-/**
- * This method does the dirty work of dictionary
- * compression. Basically it looks for redundant
- * strings and has the current duplicate refer back
- * to the previous one.
- */
-bool Deflater::compressWindow()
-{
- windowPos = 0;
- unsigned int windowSize = window.size();
- //### Compress as much of the window as possible
-
- unsigned int hash = 0;
- //Have each value be a long with the byte at this position,
- //plus the 3 bytes after it in the window
- for (int i=windowSize-1 ; i>=0 ; i--)
- {
- unsigned char ch = window[i];
- windowBuf[i] = ch;
- hash = ((hash<<8) & 0xffffff00) | ch;
- windowHashBuf[i] = hash;
- }
-
- while (windowPos < windowSize - 3)
- {
- //### Find best match, if any
- unsigned int bestMatchLen = 0;
- unsigned int bestMatchDist = 0;
- if (windowPos >= 4)
- {
- for (unsigned int lookBack=0 ; lookBack<windowPos-4 ; lookBack++)
- {
- //Check 4-char hashes first, before continuing with string
- if (windowHashBuf[lookBack] == windowHashBuf[windowPos])
- {
- unsigned int lookAhead=4;
- unsigned int lookAheadMax = windowSize - 4 - windowPos;
- if (lookBack + lookAheadMax >= windowPos -4 )
- lookAheadMax = windowPos - 4 - lookBack;
- if (lookAheadMax > 258)
- lookAheadMax = 258;
- unsigned char *wp = &(windowBuf[windowPos+4]);
- unsigned char *lb = &(windowBuf[lookBack+4]);
- while (lookAhead<lookAheadMax)
- {
- if (*lb++ != *wp++)
- break;
- lookAhead++;
- }
- if (lookAhead > bestMatchLen)
- {
- bestMatchLen = lookAhead;
- bestMatchDist = windowPos - lookBack;
- }
- }
- }
- }
- if (bestMatchLen > 3)
- {
- //Distance encode
- //trace("### distance");
- /*
- printf("### 1 '");
- for (int i=0 ; i < bestMatchLen ; i++)
- fputc(window[windowPos+i], stdout);
- printf("'\n### 2 '");
- for (int i=0 ; i < bestMatchLen ; i++)
- fputc(window[windowPos-bestMatchDist+i], stdout);
- printf("'\n");
- */
- encodeDistStatic(bestMatchLen, bestMatchDist);
- windowPos += bestMatchLen;
- }
- else
- {
- //Literal encode
- //trace("### literal");
- encodeLiteralStatic(windowBuf[windowPos]);
- windowPos++;
- }
- }
-
- while (windowPos < windowSize)
- encodeLiteralStatic(windowBuf[windowPos++]);
-
- encodeLiteralStatic(256);
- return true;
-}
-
-
-/**
- *
- */
-bool Deflater::compress()
-{
- //trace("compress");
- unsigned long total = 0L;
- windowPos = 0;
- std::vector<unsigned char>::iterator iter;
- for (iter = uncompressed.begin(); iter != uncompressed.end() ; )
- {
- total += windowPos;
- trace("total:%ld", total);
- if (windowPos > window.size())
- windowPos = window.size();
- window.erase(window.begin() , window.begin()+windowPos);
- while (window.size() < 32768 && iter != uncompressed.end())
- {
- window.push_back(*iter);
- iter++;
- }
- if (window.size() >= 32768)
- putBits(0x00, 1); //0 -- more blocks
- else
- putBits(0x01, 1); //1 -- last block
- putBits(0x01, 2); //01 -- static trees
- if (!compressWindow())
- return false;
- }
- putFlush();
- return true;
-}
-
-
-
-
-
-//########################################################################
-//# G Z I P F I L E
-//########################################################################
-
-/**
- * Constructor
- */
-GzipFile::GzipFile()
-{
-}
-
-/**
- * Destructor
- */
-GzipFile::~GzipFile()
-{
-}
-
-/**
- * Print error messages
- */
-void GzipFile::error(char *fmt, ...)
-{
- va_list args;
- va_start(args, fmt);
- fprintf(stdout, "GzipFile error:");
- vfprintf(stdout, fmt, args);
- fprintf(stdout, "\n");
- va_end(args);
-}
-
-/**
- * Print trace messages
- */
-void GzipFile::trace(char *fmt, ...)
-{
- va_list args;
- va_start(args, fmt);
- fprintf(stdout, "GzipFile:");
- vfprintf(stdout, fmt, args);
- fprintf(stdout, "\n");
- va_end(args);
-}
-
-/**
- *
- */
-void GzipFile::put(unsigned char ch)
-{
- data.push_back(ch);
-}
-
-/**
- *
- */
-void GzipFile::setData(const std::vector<unsigned char> &str)
-{
- data = str;
-}
-
-/**
- *
- */
-void GzipFile::clearData()
-{
- data.clear();
-}
-
-/**
- *
- */
-std::vector<unsigned char> &GzipFile::getData()
-{
- return data;
-}
-
-/**
- *
- */
-std::string &GzipFile::getFileName()
-{
- return fileName;
-}
-
-/**
- *
- */
-void GzipFile::setFileName(const std::string &val)
-{
- fileName = val;
-}
-
-
-
-//#####################################
-//# U T I L I T Y
-//#####################################
-
-/**
- * Loads a new file into an existing GzipFile
- */
-bool GzipFile::loadFile(const std::string &fName)
-{
- FILE *f = fopen(fName.c_str() , "rb");
- if (!f)
- {
- error("Cannot open file %s", fName.c_str());
- return false;
- }
- while (true)
- {
- int ch = fgetc(f);
- if (ch < 0)
- break;
- data.push_back(ch);
- }
- fclose(f);
- setFileName(fName);
- return true;
-}
-
-
-
-//#####################################
-//# W R I T E
-//#####################################
-
-/**
- *
- */
-bool GzipFile::putByte(unsigned char ch)
-{
- fileBuf.push_back(ch);
- return true;
-}
-
-
-
-/**
- *
- */
-bool GzipFile::putLong(unsigned long val)
-{
- fileBuf.push_back( (unsigned char)((val ) & 0xff));
- fileBuf.push_back( (unsigned char)((val>> 8) & 0xff));
- fileBuf.push_back( (unsigned char)((val>>16) & 0xff));
- fileBuf.push_back( (unsigned char)((val>>24) & 0xff));
- return true;
-}
-
-
-
-/**
- *
- */
-bool GzipFile::write()
-{
- fileBuf.clear();
-
- putByte(0x1f); //magic
- putByte(0x8b); //magic
- putByte( 8); //compression method
- putByte(0x08); //flags. say we have a crc and file name
-
- unsigned long ltime = (unsigned long) time(NULL);
- putLong(ltime);
-
- //xfl
- putByte(0);
- //OS
- putByte(0);
-
- //file name
- for (unsigned int i=0 ; i<fileName.size() ; i++)
- putByte(fileName[i]);
- putByte(0);
-
-
- //compress
- std::vector<unsigned char> compBuf;
- Deflater deflater;
- if (!deflater.deflate(compBuf, data))
- {
- return false;
- }
-
- std::vector<unsigned char>::iterator iter;
- for (iter=compBuf.begin() ; iter!=compBuf.end() ; iter++)
- {
- unsigned char ch = *iter;
- putByte(ch);
- }
-
- Crc32 crcEngine;
- crcEngine.update(data);
- unsigned long crc = crcEngine.getValue();
- putLong(crc);
-
- putLong(data.size());
-
- return true;
-}
-
-
-/**
- *
- */
-bool GzipFile::writeBuffer(std::vector<unsigned char> &outBuf)
-{
- if (!write())
- return false;
- outBuf.clear();
- outBuf = fileBuf;
- return true;
-}
-
-
-/**
- *
- */
-bool GzipFile::writeFile(const std::string &fileName)
-{
- if (!write())
- return false;
- FILE *f = fopen(fileName.c_str(), "wb");
- if (!f)
- return false;
- std::vector<unsigned char>::iterator iter;
- for (iter=fileBuf.begin() ; iter!=fileBuf.end() ; iter++)
- {
- unsigned char ch = *iter;
- fputc(ch, f);
- }
- fclose(f);
- return true;
-}
-
-
-//#####################################
-//# R E A D
-//#####################################
-
-bool GzipFile::getByte(unsigned char *ch)
-{
- if (fileBufPos >= fileBuf.size())
- {
- error("unexpected end of data");
- return false;
- }
- *ch = fileBuf[fileBufPos++];
- return true;
-}
-
-/**
- *
- */
-bool GzipFile::getLong(unsigned long *val)
-{
- if (fileBuf.size() - fileBufPos < 4)
- return false;
- int ch1 = fileBuf[fileBufPos++];
- int ch2 = fileBuf[fileBufPos++];
- int ch3 = fileBuf[fileBufPos++];
- int ch4 = fileBuf[fileBufPos++];
- *val = ((ch4<<24) & 0xff000000L) |
- ((ch3<<16) & 0x00ff0000L) |
- ((ch2<< 8) & 0x0000ff00L) |
- ((ch1 ) & 0x000000ffL);
- return true;
-}
-
-bool GzipFile::read()
-{
- fileBufPos = 0;
-
- unsigned char ch;
-
- //magic cookie
- if (!getByte(&ch))
- return false;
- if (ch != 0x1f)
- {
- error("bad gzip header");
- return false;
- }
- if (!getByte(&ch))
- return false;
- if (ch != 0x8b)
- {
- error("bad gzip header");
- return false;
- }
-
- //## compression method
- if (!getByte(&ch))
- return false;
- compressionMethod = ch & 0xff;
-
- //## flags
- if (!getByte(&ch))
- return false;
- //bool ftext = ch & 0x01;
- bool fhcrc = ch & 0x02;
- bool fextra = ch & 0x04;
- bool fname = ch & 0x08;
- bool fcomment = ch & 0x10;
-
- //trace("cm:%d ftext:%d fhcrc:%d fextra:%d fname:%d fcomment:%d",
- // cm, ftext, fhcrc, fextra, fname, fcomment);
-
- //## file time
- unsigned long ltime;
- if (!getLong(&ltime))
- return false;
- //time_t mtime = (time_t)ltime;
-
- //## XFL
- if (!getByte(&ch))
- return false;
- //int xfl = ch;
-
- //## OS
- if (!getByte(&ch))
- return false;
- //int os = ch;
-
- //std::string timestr = ctime(&mtime);
- //trace("xfl:%d os:%d mtime:%s", xfl, os, timestr.c_str());
-
- if (fextra)
- {
- if (!getByte(&ch))
- return false;
- long xlen = ch;
- if (!getByte(&ch))
- return false;
- xlen = (xlen << 8) + ch;
- for (long l=0 ; l<xlen ; l++)
- {
- if (!getByte(&ch))
- return false;
- }
- }
-
- if (fname)
- {
- fileName = "";
- while (true)
- {
- if (!getByte(&ch))
- return false;
- if (ch==0)
- break;
- fileName.push_back(ch);
- }
- }
-
- if (fcomment)
- {
- while (true)
- {
- if (!getByte(&ch))
- return false;
- if (ch==0)
- break;
- }
- }
-
- if (fhcrc)
- {
- if (!getByte(&ch))
- return false;
- if (!getByte(&ch))
- return false;
- }
-
- //read remainder of stream
- //compressed data runs up until 8 bytes before end of buffer
- std::vector<unsigned char> compBuf;
- while (fileBufPos < fileBuf.size() - 8)
- {
- if (!getByte(&ch))
- return false;
- compBuf.push_back(ch);
- }
- //uncompress
- data.clear();
- Inflater inflater;
- if (!inflater.inflate(data, compBuf))
- {
- return false;
- }
-
- //Get the CRC and compare
- Crc32 crcEngine;
- crcEngine.update(data);
- unsigned long calcCrc = crcEngine.getValue();
- unsigned long givenCrc;
- if (!getLong(&givenCrc))
- return false;
- if (givenCrc != calcCrc)
- {
- error("Specified crc, %ud, not what received: %ud",
- givenCrc, calcCrc);
- return false;
- }
-
- //Get the file size and compare
- unsigned long givenFileSize;
- if (!getLong(&givenFileSize))
- return false;
- if (givenFileSize != data.size())
- {
- error("Specified data size, %ld, not what received: %ld",
- givenFileSize, data.size());
- return false;
- }
-
- return true;
-}
-
-
-
-/**
- *
- */
-bool GzipFile::readBuffer(const std::vector<unsigned char> &inbuf)
-{
- fileBuf = inbuf;
- if (!read())
- return false;
- return true;
-}
-
-
-/**
- *
- */
-bool GzipFile::readFile(const std::string &fileName)
-{
- fileBuf.clear();
- FILE *f = fopen(fileName.c_str(), "rb");
- if (!f)
- return false;
- while (true)
- {
- int ch = fgetc(f);
- if (ch < 0)
- break;
- fileBuf.push_back(ch);
- }
- fclose(f);
- if (!read())
- return false;
- return true;
-}
-
-
-
-
-
-
-
-
-//########################################################################
-//# Z I P F I L E
-//########################################################################
-
-/**
- * Constructor
- */
-ZipEntry::ZipEntry()
-{
- crc = 0L;
- compressionMethod = 8;
-}
-
-/**
- *
- */
-ZipEntry::ZipEntry(const std::string &fileNameArg,
- const std::string &commentArg)
-{
- crc = 0L;
- compressionMethod = 8;
- fileName = fileNameArg;
- comment = commentArg;
-}
-
-/**
- * Destructor
- */
-ZipEntry::~ZipEntry()
-{
-}
-
-
-/**
- *
- */
-std::string ZipEntry::getFileName()
-{
- return fileName;
-}
-
-/**
- *
- */
-void ZipEntry::setFileName(const std::string &val)
-{
- fileName = val;
-}
-
-/**
- *
- */
-std::string ZipEntry::getComment()
-{
- return comment;
-}
-
-/**
- *
- */
-void ZipEntry::setComment(const std::string &val)
-{
- comment = val;
-}
-
-/**
- *
- */
-unsigned long ZipEntry::getCompressedSize()
-{
- return (unsigned long)compressedData.size();
-}
-
-/**
- *
- */
-int ZipEntry::getCompressionMethod()
-{
- return compressionMethod;
-}
-
-/**
- *
- */
-void ZipEntry::setCompressionMethod(int val)
-{
- compressionMethod = val;
-}
-
-/**
- *
- */
-std::vector<unsigned char> &ZipEntry::getCompressedData()
-{
- return compressedData;
-}
-
-/**
- *
- */
-void ZipEntry::setCompressedData(const std::vector<unsigned char> &val)
-{
- compressedData = val;
-}
-
-/**
- *
- */
-unsigned long ZipEntry::getUncompressedSize()
-{
- return (unsigned long)uncompressedData.size();
-}
-
-/**
- *
- */
-std::vector<unsigned char> &ZipEntry::getUncompressedData()
-{
- return uncompressedData;
-}
-
-/**
- *
- */
-void ZipEntry::setUncompressedData(const std::vector<unsigned char> &val)
-{
- uncompressedData = val;
-}
-
-/**
- *
- */
-unsigned long ZipEntry::getCrc()
-{
- return crc;
-}
-
-/**
- *
- */
-void ZipEntry::setCrc(unsigned long val)
-{
- crc = val;
-}
-
-/**
- *
- */
-void ZipEntry::write(unsigned char ch)
-{
- uncompressedData.push_back(ch);
-}
-
-/**
- *
- */
-void ZipEntry::finish()
-{
- Crc32 c32;
- std::vector<unsigned char>::iterator iter;
- for (iter = uncompressedData.begin() ;
- iter!= uncompressedData.end() ; iter++)
- {
- unsigned char ch = *iter;
- c32.update(ch);
- }
- crc = c32.getValue();
- switch (compressionMethod)
- {
- case 0: //none
- {
- for (iter = uncompressedData.begin() ;
- iter!= uncompressedData.end() ; iter++)
- {
- unsigned char ch = *iter;
- compressedData.push_back(ch);
- }
- break;
- }
- case 8: //deflate
- {
- Deflater deflater;
- if (!deflater.deflate(compressedData, uncompressedData))
- {
- //some error
- }
- break;
- }
- default:
- {
- printf("error: unknown compression method %d\n",
- compressionMethod);
- }
- }
-}
-
-
-
-
-/**
- *
- */
-bool ZipEntry::readFile(const std::string &fileNameArg,
- const std::string &commentArg)
-{
- crc = 0L;
- uncompressedData.clear();
- fileName = fileNameArg;
- comment = commentArg;
- FILE *f = fopen(fileName.c_str(), "rb");
- if (!f)
- {
- return false;
- }
- while (true)
- {
- int ch = fgetc(f);
- if (ch < 0)
- break;
- uncompressedData.push_back((unsigned char)ch);
- }
- fclose(f);
- finish();
- return true;
-}
-
-
-/**
- *
- */
-void ZipEntry::setPosition(unsigned long val)
-{
- position = val;
-}
-
-/**
- *
- */
-unsigned long ZipEntry::getPosition()
-{
- return position;
-}
-
-
-
-
-
-
-
-/**
- * Constructor
- */
-ZipFile::ZipFile()
-{
-
-}
-
-/**
- * Destructor
- */
-ZipFile::~ZipFile()
-{
- std::vector<ZipEntry *>::iterator iter;
- for (iter=entries.begin() ; iter!=entries.end() ; iter++)
- {
- ZipEntry *entry = *iter;
- delete entry;
- }
- entries.clear();
-}
-
-/**
- *
- */
-void ZipFile::setComment(const std::string &val)
-{
- comment = val;
-}
-
-/**
- *
- */
-std::string ZipFile::getComment()
-{
- return comment;
-}
-
-
-/**
- *
- */
-std::vector<ZipEntry *> &ZipFile::getEntries()
-{
- return entries;
-}
-
-
-
-//#####################################
-//# M E S S A G E S
-//#####################################
-
-void ZipFile::error(char *fmt, ...)
-{
- va_list args;
- va_start(args, fmt);
- fprintf(stdout, "ZipFile error:");
- vfprintf(stdout, fmt, args);
- fprintf(stdout, "\n");
- va_end(args);
-}
-
-void ZipFile::trace(char *fmt, ...)
-{
- va_list args;
- va_start(args, fmt);
- fprintf(stdout, "ZipFile:");
- vfprintf(stdout, fmt, args);
- fprintf(stdout, "\n");
- va_end(args);
-}
-
-//#####################################
-//# U T I L I T Y
-//#####################################
-
-/**
- *
- */
-ZipEntry *ZipFile::addFile(const std::string &fileName,
- const std::string &comment)
-{
- ZipEntry *ze = new ZipEntry();
- if (!ze->readFile(fileName, comment))
- {
- return NULL;
- }
- entries.push_back(ze);
- return ze;
-}
-
-
-/**
- *
- */
-ZipEntry *ZipFile::newEntry(const std::string &fileName,
- const std::string &comment)
-{
- ZipEntry *ze = new ZipEntry(fileName, comment);
- entries.push_back(ze);
- return ze;
-}
-
-
-//#####################################
-//# W R I T E
-//#####################################
-
-/**
- *
- */
-bool ZipFile::putLong(unsigned long val)
-{
- fileBuf.push_back( ((int)(val )) & 0xff);
- fileBuf.push_back( ((int)(val>> 8)) & 0xff);
- fileBuf.push_back( ((int)(val>>16)) & 0xff);
- fileBuf.push_back( ((int)(val>>24)) & 0xff);
- return true;
-}
-
-
-/**
- *
- */
-bool ZipFile::putInt(unsigned int val)
-{
- fileBuf.push_back( (val ) & 0xff);
- fileBuf.push_back( (val>> 8) & 0xff);
- return true;
-}
-
-/**
- *
- */
-bool ZipFile::putByte(unsigned char val)
-{
- fileBuf.push_back(val);
- return true;
-}
-
-/**
- *
- */
-bool ZipFile::writeFileData()
-{
- std::vector<ZipEntry *>::iterator iter;
- for (iter = entries.begin() ; iter != entries.end() ; iter++)
- {
- ZipEntry *entry = *iter;
- entry->setPosition(fileBuf.size());
- //##### HEADER
- std::string fname = entry->getFileName();
- putLong(0x04034b50L);
- putInt(20); //versionNeeded
- putInt(0); //gpBitFlag
- //putInt(0); //compression method
- putInt(entry->getCompressionMethod()); //compression method
- putInt(0); //mod time
- putInt(0); //mod date
- putLong(entry->getCrc()); //crc32
- putLong(entry->getCompressedSize());
- putLong(entry->getUncompressedSize());
- putInt(fname.size());//fileName length
- putInt(8);//extra field length
- //file name
- for (unsigned int i=0 ; i<fname.size() ; i++)
- putByte((unsigned char)fname[i]);
- //extra field
- putInt(0x7855);
- putInt(4);
- putInt(100);
- putInt(100);
-
- //##### DATA
- std::vector<unsigned char> &buf = entry->getCompressedData();
- std::vector<unsigned char>::iterator iter;
- for (iter = buf.begin() ; iter != buf.end() ; iter++)
- {
- unsigned char ch = (unsigned char) *iter;
- putByte(ch);
- }
- }
- return true;
-}
-
-/**
- *
- */
-bool ZipFile::writeCentralDirectory()
-{
- unsigned long cdPosition = fileBuf.size();
- std::vector<ZipEntry *>::iterator iter;
- for (iter = entries.begin() ; iter != entries.end() ; iter++)
- {
- ZipEntry *entry = *iter;
- std::string fname = entry->getFileName();
- std::string ecomment = entry->getComment();
- putLong(0x02014b50L); //magic cookie
- putInt(2386); //versionMadeBy
- putInt(20); //versionNeeded
- putInt(0); //gpBitFlag
- putInt(entry->getCompressionMethod()); //compression method
- putInt(0); //mod time
- putInt(0); //mod date
- putLong(entry->getCrc()); //crc32
- putLong(entry->getCompressedSize());
- putLong(entry->getUncompressedSize());
- putInt(fname.size());//fileName length
- putInt(4);//extra field length
- putInt(ecomment.size());//comment length
- putInt(0); //disk number start
- putInt(0); //internal attributes
- putLong(0); //external attributes
- putLong(entry->getPosition());
-
- //file name
- for (unsigned int i=0 ; i<fname.size() ; i++)
- putByte((unsigned char)fname[i]);
- //extra field
- putInt(0x7855);
- putInt(0);
- //comment
- for (unsigned int i=0 ; i<ecomment.size() ; i++)
- putByte((unsigned char)ecomment[i]);
- }
- unsigned long cdSize = fileBuf.size() - cdPosition;
-
- putLong(0x06054b50L);
- putInt(0);//number of this disk
- putInt(0);//nr of disk with central dir
- putInt(entries.size()); //number of entries on this disk
- putInt(entries.size()); //number of entries total
- putLong(cdSize); //size of central dir
- putLong(cdPosition); //position of central dir
- putInt(comment.size());//comment size
- for (unsigned int i=0 ; i<comment.size() ; i++)
- putByte(comment[i]);
- return true;
-}
-
-
-
-/**
- *
- */
-bool ZipFile::write()
-{
- fileBuf.clear();
- if (!writeFileData())
- return false;
- if (!writeCentralDirectory())
- return false;
- return true;
-}
-
-
-/**
- *
- */
-bool ZipFile::writeBuffer(std::vector<unsigned char> &outBuf)
-{
- if (!write())
- return false;
- outBuf.clear();
- outBuf = fileBuf;
- return true;
-}
-
-
-/**
- *
- */
-bool ZipFile::writeFile(const std::string &fileName)
-{
- if (!write())
- return false;
- FILE *f = fopen(fileName.c_str(), "wb");
- if (!f)
- return false;
- std::vector<unsigned char>::iterator iter;
- for (iter=fileBuf.begin() ; iter!=fileBuf.end() ; iter++)
- {
- unsigned char ch = *iter;
- fputc(ch, f);
- }
- fclose(f);
- return true;
-}
-
-//#####################################
-//# R E A D
-//#####################################
-
-/**
- *
- */
-bool ZipFile::getLong(unsigned long *val)
-{
- if (fileBuf.size() - fileBufPos < 4)
- return false;
- int ch1 = fileBuf[fileBufPos++];
- int ch2 = fileBuf[fileBufPos++];
- int ch3 = fileBuf[fileBufPos++];
- int ch4 = fileBuf[fileBufPos++];
- *val = ((ch4<<24) & 0xff000000L) |
- ((ch3<<16) & 0x00ff0000L) |
- ((ch2<< 8) & 0x0000ff00L) |
- ((ch1 ) & 0x000000ffL);
- return true;
-}
-
-/**
- *
- */
-bool ZipFile::getInt(unsigned int *val)
-{
- if (fileBuf.size() - fileBufPos < 2)
- return false;
- int ch1 = fileBuf[fileBufPos++];
- int ch2 = fileBuf[fileBufPos++];
- *val = ((ch2<< 8) & 0xff00) |
- ((ch1 ) & 0x00ff);
- return true;
-}
-
-
-/**
- *
- */
-bool ZipFile::getByte(unsigned char *val)
-{
- if (fileBuf.size() <= fileBufPos)
- return false;
- *val = fileBuf[fileBufPos++];
- return true;
-}
-
-
-/**
- *
- */
-bool ZipFile::readFileData()
-{
- //printf("#################################################\n");
- //printf("###D A T A\n");
- //printf("#################################################\n");
- while (true)
- {
- unsigned long magicCookie;
- if (!getLong(&magicCookie))
- {
- error("magic cookie not found");
- break;
- }
- trace("###Cookie:%lx", magicCookie);
- if (magicCookie == 0x02014b50L) //central directory
- break;
- if (magicCookie != 0x04034b50L)
- {
- error("file header not found");
- return false;
- }
- unsigned int versionNeeded;
- if (!getInt(&versionNeeded))
- {
- error("bad version needed found");
- return false;
- }
- unsigned int gpBitFlag;
- if (!getInt(&gpBitFlag))
- {
- error("bad bit flag found");
- return false;
- }
- unsigned int compressionMethod;
- if (!getInt(&compressionMethod))
- {
- error("bad compressionMethod found");
- return false;
- }
- unsigned int modTime;
- if (!getInt(&modTime))
- {
- error("bad modTime found");
- return false;
- }
- unsigned int modDate;
- if (!getInt(&modDate))
- {
- error("bad modDate found");
- return false;
- }
- unsigned long crc32;
- if (!getLong(&crc32))
- {
- error("bad crc32 found");
- return false;
- }
- unsigned long compressedSize;
- if (!getLong(&compressedSize))
- {
- error("bad compressedSize found");
- return false;
- }
- unsigned long uncompressedSize;
- if (!getLong(&uncompressedSize))
- {
- error("bad uncompressedSize found");
- return false;
- }
- unsigned int fileNameLength;
- if (!getInt(&fileNameLength))
- {
- error("bad fileNameLength found");
- return false;
- }
- unsigned int extraFieldLength;
- if (!getInt(&extraFieldLength))
- {
- error("bad extraFieldLength found");
- return false;
- }
- std::string fileName;
- for (unsigned int i=0 ; i<fileNameLength ; i++)
- {
- unsigned char ch;
- if (!getByte(&ch))
- break;
- fileName.push_back(ch);
- }
- std::string extraField;
- for (unsigned int i=0 ; i<extraFieldLength ; i++)
- {
- unsigned char ch;
- if (!getByte(&ch))
- break;
- extraField.push_back(ch);
- }
- trace("######################### DATA");
- trace("FileName :%d:%s" , fileName.size(), fileName.c_str());
- trace("Extra field :%d:%s" , extraField.size(), extraField.c_str());
- trace("Version needed :%d" , versionNeeded);
- trace("Bitflag :%d" , gpBitFlag);
- trace("Compression Method :%d" , compressionMethod);
- trace("Mod time :%d" , modTime);
- trace("Mod date :%d" , modDate);
- trace("CRC :%lx", crc32);
- trace("Compressed size :%ld", compressedSize);
- trace("Uncompressed size :%ld", uncompressedSize);
-
- //#### Uncompress the data
- std::vector<unsigned char> compBuf;
- if (gpBitFlag & 0x8)//bit 3 was set. means we dont know compressed size
- {
- unsigned char c1, c2, c3, c4;
- c1 = c2 = c3 = c4 = 0;
- while (true)
- {
- unsigned char ch;
- if (!getByte(&ch))
- {
- error("premature end of data");
- break;
- }
- compBuf.push_back(ch);
- c1 = c2; c2 = c3; c3 = c4; c4 = ch;
- if (c1 == 0x50 && c2 == 0x4b && c3 == 0x07 && c4 == 0x08)
- {
- trace("found end of compressed data");
- //remove the cookie
- compBuf.erase(compBuf.end() -4, compBuf.end());
- break;
- }
- }
- }
- else
- {
- for (unsigned long bnr = 0 ; bnr < compressedSize ; bnr++)
- {
- unsigned char ch;
- if (!getByte(&ch))
- {
- error("premature end of data");
- break;
- }
- compBuf.push_back(ch);
- }
- }
-
- printf("### data: ");
- for (int i=0 ; i<10 ; i++)
- printf("%02x ", compBuf[i] & 0xff);
- printf("\n");
-
- if (gpBitFlag & 0x8)//only if bit 3 set
- {
- /* this cookie was read in the loop above
- unsigned long dataDescriptorSignature ;
- if (!getLong(&dataDescriptorSignature))
- break;
- if (dataDescriptorSignature != 0x08074b50L)
- {
- error("bad dataDescriptorSignature found");
- return false;
- }
- */
- unsigned long crc32;
- if (!getLong(&crc32))
- {
- error("bad crc32 found");
- return false;
- }
- unsigned long compressedSize;
- if (!getLong(&compressedSize))
- {
- error("bad compressedSize found");
- return false;
- }
- unsigned long uncompressedSize;
- if (!getLong(&uncompressedSize))
- {
- error("bad uncompressedSize found");
- return false;
- }
- }//bit 3 was set
- //break;
-
- std::vector<unsigned char> uncompBuf;
- switch (compressionMethod)
- {
- case 8: //deflate
- {
- Inflater inflater;
- if (!inflater.inflate(uncompBuf, compBuf))
- {
- return false;
- }
- break;
- }
- default:
- {
- error("Unimplemented compression method %d", compressionMethod);
- return false;
- }
- }
-
- if (uncompressedSize != uncompBuf.size())
- {
- error("Size mismatch. Expected %ld, received %ld",
- uncompressedSize, uncompBuf.size());
- return false;
- }
-
- Crc32 crcEngine;
- crcEngine.update(uncompBuf);
- unsigned long crc = crcEngine.getValue();
- if (crc != crc32)
- {
- error("Crc mismatch. Calculated %08ux, received %08ux", crc, crc32);
- return false;
- }
-
- ZipEntry *ze = new ZipEntry(fileName, comment);
- ze->setCompressionMethod(compressionMethod);
- ze->setCompressedData(compBuf);
- ze->setUncompressedData(uncompBuf);
- ze->setCrc(crc);
- entries.push_back(ze);
-
-
- }
- return true;
-}
-
-
-/**
- *
- */
-bool ZipFile::readCentralDirectory()
-{
- //printf("#################################################\n");
- //printf("###D I R E C T O R Y\n");
- //printf("#################################################\n");
- while (true)
- {
- //We start with a central directory cookie already
- //Check at the bottom of the loop.
- unsigned int version;
- if (!getInt(&version))
- {
- error("bad version found");
- return false;
- }
- unsigned int versionNeeded;
- if (!getInt(&versionNeeded))
- {
- error("bad version found");
- return false;
- }
- unsigned int gpBitFlag;
- if (!getInt(&gpBitFlag))
- {
- error("bad bit flag found");
- return false;
- }
- unsigned int compressionMethod;
- if (!getInt(&compressionMethod))
- {
- error("bad compressionMethod found");
- return false;
- }
- unsigned int modTime;
- if (!getInt(&modTime))
- {
- error("bad modTime found");
- return false;
- }
- unsigned int modDate;
- if (!getInt(&modDate))
- {
- error("bad modDate found");
- return false;
- }
- unsigned long crc32;
- if (!getLong(&crc32))
- {
- error("bad crc32 found");
- return false;
- }
- unsigned long compressedSize;
- if (!getLong(&compressedSize))
- {
- error("bad compressedSize found");
- return false;
- }
- unsigned long uncompressedSize;
- if (!getLong(&uncompressedSize))
- {
- error("bad uncompressedSize found");
- return false;
- }
- unsigned int fileNameLength;
- if (!getInt(&fileNameLength))
- {
- error("bad fileNameLength found");
- return false;
- }
- unsigned int extraFieldLength;
- if (!getInt(&extraFieldLength))
- {
- error("bad extraFieldLength found");
- return false;
- }
- unsigned int fileCommentLength;
- if (!getInt(&fileCommentLength))
- {
- error("bad fileCommentLength found");
- return false;
- }
- unsigned int diskNumberStart;
- if (!getInt(&diskNumberStart))
- {
- error("bad diskNumberStart found");
- return false;
- }
- unsigned int internalFileAttributes;
- if (!getInt(&internalFileAttributes))
- {
- error("bad internalFileAttributes found");
- return false;
- }
- unsigned long externalFileAttributes;
- if (!getLong(&externalFileAttributes))
- {
- error("bad externalFileAttributes found");
- return false;
- }
- unsigned long localHeaderOffset;
- if (!getLong(&localHeaderOffset))
- {
- error("bad localHeaderOffset found");
- return false;
- }
- std::string fileName;
- for (unsigned int i=0 ; i<fileNameLength ; i++)
- {
- unsigned char ch;
- if (!getByte(&ch))
- break;
- fileName.push_back(ch);
- }
- std::string extraField;
- for (unsigned int i=0 ; i<extraFieldLength ; i++)
- {
- unsigned char ch;
- if (!getByte(&ch))
- break;
- extraField.push_back(ch);
- }
- std::string fileComment;
- for (unsigned int i=0 ; i<fileCommentLength ; i++)
- {
- unsigned char ch;
- if (!getByte(&ch))
- break;
- fileComment.push_back(ch);
- }
- trace("######################### ENTRY");
- trace("FileName :%s" , fileName.c_str());
- trace("Extra field :%s" , extraField.c_str());
- trace("File comment :%s" , fileComment.c_str());
- trace("Version :%d" , version);
- trace("Version needed :%d" , versionNeeded);
- trace("Bitflag :%d" , gpBitFlag);
- trace("Compression Method :%d" , compressionMethod);
- trace("Mod time :%d" , modTime);
- trace("Mod date :%d" , modDate);
- trace("CRC :%lx", crc32);
- trace("Compressed size :%ld", compressedSize);
- trace("Uncompressed size :%ld", uncompressedSize);
- trace("Disk nr start :%ld", diskNumberStart);
- trace("Header offset :%ld", localHeaderOffset);
-
-
- unsigned long magicCookie;
- if (!getLong(&magicCookie))
- {
- error("magic cookie not found");
- return false;
- }
- trace("###Cookie:%lx", magicCookie);
- if (magicCookie == 0x06054b50L) //end of central directory
- break;
- else if (magicCookie == 0x05054b50L) //signature
- {
- //## Digital Signature
- unsigned int signatureSize;
- if (!getInt(&signatureSize))
- {
- error("bad signatureSize found");
- return false;
- }
- std::string digitalSignature;
- for (unsigned int i=0 ; i<signatureSize ; i++)
- {
- unsigned char ch;
- if (!getByte(&ch))
- break;
- digitalSignature.push_back(ch);
- }
- trace("######## SIGNATURE :'%s'" , digitalSignature.c_str());
- }
- else if (magicCookie != 0x02014b50L) //central directory
- {
- error("directory file header not found");
- return false;
- }
- }
-
- unsigned int diskNr;
- if (!getInt(&diskNr))
- {
- error("bad diskNr found");
- return false;
- }
- unsigned int diskWithCd;
- if (!getInt(&diskWithCd))
- {
- error("bad diskWithCd found");
- return false;
- }
- unsigned int nrEntriesDisk;
- if (!getInt(&nrEntriesDisk))
- {
- error("bad nrEntriesDisk found");
- return false;
- }
- unsigned int nrEntriesTotal;
- if (!getInt(&nrEntriesTotal))
- {
- error("bad nrEntriesTotal found");
- return false;
- }
- unsigned long cdSize;
- if (!getLong(&cdSize))
- {
- error("bad cdSize found");
- return false;
- }
- unsigned long cdPos;
- if (!getLong(&cdPos))
- {
- error("bad cdPos found");
- return false;
- }
- unsigned int commentSize;
- if (!getInt(&commentSize))
- {
- error("bad commentSize found");
- return false;
- }
- comment = "";
- for (unsigned int i=0 ; i<commentSize ; i++)
- {
- unsigned char ch;
- if (!getByte(&ch))
- break;
- comment.push_back(ch);
- }
- trace("######## Zip Comment :'%s'" , comment.c_str());
-
- return true;
-}
-
-
-/**
- *
- */
-bool ZipFile::read()
-{
- fileBufPos = 0;
- if (!readFileData())
- {
- return false;
- }
- if (!readCentralDirectory())
- {
- return false;
- }
- return true;
-}
-
-/**
- *
- */
-bool ZipFile::readBuffer(const std::vector<unsigned char> &inbuf)
-{
- fileBuf = inbuf;
- if (!read())
- return false;
- return true;
-}
-
-
-/**
- *
- */
-bool ZipFile::readFile(const std::string &fileName)
-{
- fileBuf.clear();
- FILE *f = fopen(fileName.c_str(), "rb");
- if (!f)
- return false;
- while (true)
- {
- int ch = fgetc(f);
- if (ch < 0)
- break;
- fileBuf.push_back(ch);
- }
- fclose(f);
- if (!read())
- return false;
- return true;
-}
-
-
-
-
-
-
-
-
-
-//########################################################################
-//# E N D O F F I L E
-//########################################################################
-
-
+/**
+ * This is intended to be a standalone, reduced capability
+ * implementation of Gzip and Zip functionality. Its
+ * targeted use case is for archiving and retrieving single files
+ * which use these encoding types. Being memory based and
+ * non-optimized, it is not useful in cases where very large
+ * archives are needed or where high performance is desired.
+ * However, it should hopefully work very well for smaller,
+ * one-at-a-time tasks. What you get in return is the ability
+ * to drop these files into your project and remove the dependencies
+ * on ZLib and Info-Zip. Enjoy.
+ *
+ * Authors:
+ * Bob Jamison
+ *
+ * Copyright (C) 2006 Bob Jamison
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <time.h>
+
+#include <string>
+
+#include "ziptool.h"
+
+
+
+
+
+
+//########################################################################
+//# A D L E R 3 2
+//########################################################################
+
+/**
+ * Constructor
+ */
+Adler32::Adler32()
+{
+ reset();
+}
+
+/**
+ * Destructor
+ */
+Adler32::~Adler32()
+{
+}
+
+/**
+ * Reset Adler-32 checksum to initial value.
+ */
+void Adler32::reset()
+{
+ value = 1;
+}
+
+// ADLER32_BASE is the largest prime number smaller than 65536
+#define ADLER32_BASE 65521
+
+void Adler32::update(unsigned char b)
+{
+ unsigned long s1 = value & 0xffff;
+ unsigned long s2 = (value >> 16) & 0xffff;
+ s1 += b & 0xff;
+ s2 += s1;
+ value = ((s2 % ADLER32_BASE) << 16) | (s1 % ADLER32_BASE);
+}
+
+void Adler32::update(char *str)
+{
+ if (str)
+ while (*str)
+ update((unsigned char)*str++);
+}
+
+
+/**
+ * Returns current checksum value.
+ */
+unsigned long Adler32::getValue()
+{
+ return value & 0xffffffffL;
+}
+
+
+
+//########################################################################
+//# C R C 3 2
+//########################################################################
+
+/**
+ * Constructor
+ */
+Crc32::Crc32()
+{
+ reset();
+}
+
+/**
+ * Destructor
+ */
+Crc32::~Crc32()
+{
+}
+
+static bool crc_table_ready = false;
+static unsigned long crc_table[256];
+
+/**
+ * make the table for a fast CRC.
+ */
+void makeCrcTable()
+{
+ if (crc_table_ready)
+ return;
+ for (int n = 0; n < 256; n++)
+ {
+ unsigned long c = n;
+ for (int k = 8; --k >= 0; )
+ {
+ if ((c & 1) != 0)
+ c = 0xedb88320 ^ (c >> 1);
+ else
+ c >>= 1;
+ }
+ crc_table[n] = c;
+ }
+ crc_table_ready = true;
+}
+
+
+/**
+ * Reset CRC-32 checksum to initial value.
+ */
+void Crc32::reset()
+{
+ value = 0;
+ makeCrcTable();
+}
+
+void Crc32::update(unsigned char b)
+{
+ unsigned long c = ~value;
+ c = crc_table[(c ^ b) & 0xff] ^ (c >> 8);
+ value = ~c;
+}
+
+
+void Crc32::update(char *str)
+{
+ if (str)
+ while (*str)
+ update((unsigned char)*str++);
+}
+
+void Crc32::update(const std::vector<unsigned char> &buf)
+{
+ std::vector<unsigned char>::const_iterator iter;
+ for (iter=buf.begin() ; iter!=buf.end() ; iter++)
+ {
+ unsigned char ch = *iter;
+ update(ch);
+ }
+}
+
+
+/**
+ * Returns current checksum value.
+ */
+unsigned long Crc32::getValue()
+{
+ return value & 0xffffffffL;
+}
+
+//########################################################################
+//# I N F L A T E R
+//########################################################################
+
+
+/**
+ *
+ */
+typedef struct
+{
+ int *count; // number of symbols of each length
+ int *symbol; // canonically ordered symbols
+} Huffman;
+
+/**
+ *
+ */
+class Inflater
+{
+public:
+
+ Inflater();
+
+ virtual ~Inflater();
+
+ static const int MAXBITS = 15; // max bits in a code
+ static const int MAXLCODES = 286; // max number of literal/length codes
+ static const int MAXDCODES = 30; // max number of distance codes
+ static const int MAXCODES = 316; // max codes lengths to read
+ static const int FIXLCODES = 288; // number of fixed literal/length codes
+
+ /**
+ *
+ */
+ bool inflate(std::vector<unsigned char> &destination,
+ std::vector<unsigned char> &source);
+
+private:
+
+ /**
+ *
+ */
+ void error(char *fmt, ...);
+
+ /**
+ *
+ */
+ void trace(char *fmt, ...);
+
+ /**
+ *
+ */
+ void dump();
+
+ /**
+ *
+ */
+ int buildHuffman(Huffman *h, int *length, int n);
+
+ /**
+ *
+ */
+ bool getBits(int need, int *oval);
+
+ /**
+ *
+ */
+ int doDecode(Huffman *h);
+
+ /**
+ *
+ */
+ bool doCodes(Huffman *lencode, Huffman *distcode);
+
+ /**
+ *
+ */
+ bool doStored();
+
+ /**
+ *
+ */
+ bool doFixed();
+
+ /**
+ *
+ */
+ bool doDynamic();
+
+
+ std::vector<unsigned char>dest;
+
+ std::vector<unsigned char>src;
+ unsigned long srcPos; //current read position
+ int bitBuf;
+ int bitCnt;
+
+};
+
+
+/**
+ *
+ */
+Inflater::Inflater()
+{
+}
+
+/**
+ *
+ */
+Inflater::~Inflater()
+{
+}
+
+/**
+ *
+ */
+void Inflater::error(char *fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+ fprintf(stdout, "Inflater error:");
+ vfprintf(stdout, fmt, args);
+ fprintf(stdout, "\n");
+ va_end(args);
+}
+
+/**
+ *
+ */
+void Inflater::trace(char *fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+ fprintf(stdout, "Inflater:");
+ vfprintf(stdout, fmt, args);
+ fprintf(stdout, "\n");
+ va_end(args);
+}
+
+
+/**
+ *
+ */
+void Inflater::dump()
+{
+ for (unsigned int i=0 ; i<dest.size() ; i++)
+ {
+ fputc(dest[i], stdout);
+ }
+}
+
+/**
+ *
+ */
+int Inflater::buildHuffman(Huffman *h, int *length, int n)
+{
+ // count number of codes of each length
+ for (int len = 0; len <= MAXBITS; len++)
+ h->count[len] = 0;
+ for (int symbol = 0; symbol < n; symbol++)
+ (h->count[length[symbol]])++; // assumes lengths are within bounds
+ if (h->count[0] == n) // no codes!
+ {
+ error("huffman tree will result in failed decode");
+ return -1;
+ }
+
+ // check for an over-subscribed or incomplete set of lengths
+ int left = 1; // number of possible codes left of current length
+ for (int len = 1; len <= MAXBITS; len++)
+ {
+ left <<= 1; // one more bit, double codes left
+ left -= h->count[len]; // deduct count from possible codes
+ if (left < 0)
+ {
+ error("huffman over subscribed");
+ return -1;
+ }
+ }
+
+ // generate offsets into symbol table for each length for sorting
+ int offs[MAXBITS+1]; //offsets in symbol table for each length
+ offs[1] = 0;
+ for (int len = 1; len < MAXBITS; len++)
+ offs[len + 1] = offs[len] + h->count[len];
+
+ /*
+ * put symbols in table sorted by length, by symbol order within each
+ * length
+ */
+ for (int symbol = 0; symbol < n; symbol++)
+ if (length[symbol] != 0)
+ h->symbol[offs[length[symbol]]++] = symbol;
+
+ // return zero for complete set, positive for incomplete set
+ return left;
+}
+
+
+/**
+ *
+ */
+bool Inflater::getBits(int requiredBits, int *oval)
+{
+ long val = bitBuf;
+
+ //add more bytes if needed
+ while (bitCnt < requiredBits)
+ {
+ if (srcPos >= src.size())
+ {
+ error("premature end of input");
+ return false;
+ }
+ val |= ((long)(src[srcPos++])) << bitCnt;
+ bitCnt += 8;
+ }
+
+ //update the buffer and return the data
+ bitBuf = (int)(val >> requiredBits);
+ bitCnt -= requiredBits;
+ *oval = (int)(val & ((1L << requiredBits) - 1));
+
+ return true;
+}
+
+
+/**
+ *
+ */
+int Inflater::doDecode(Huffman *h)
+{
+ int bitTmp = bitBuf;
+ int left = bitCnt;
+ int code = 0;
+ int first = 0;
+ int index = 0;
+ int len = 1;
+ int *next = h->count + 1;
+ while (true)
+ {
+ while (left--)
+ {
+ code |= bitTmp & 1;
+ bitTmp >>= 1;
+ int count = *next++;
+ if (code < first + count)
+ { /* if length len, return symbol */
+ bitBuf = bitTmp;
+ bitCnt = (bitCnt - len) & 7;
+ return h->symbol[index + (code - first)];
+ }
+ index += count;
+ first += count;
+ first <<= 1;
+ code <<= 1;
+ len++;
+ }
+ left = (MAXBITS+1) - len;
+ if (left == 0)
+ break;
+ if (srcPos >= src.size())
+ {
+ error("premature end of input");
+ dump();
+ return -1;
+ }
+ bitTmp = src[srcPos++];
+ if (left > 8)
+ left = 8;
+ }
+
+ error("no end of block found");
+ return -1;
+}
+
+/**
+ *
+ */
+bool Inflater::doCodes(Huffman *lencode, Huffman *distcode)
+{
+ static const int lens[29] = { // Size base for length codes 257..285
+ 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
+ 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258};
+ static const int lext[29] = { // Extra bits for length codes 257..285
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
+ 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0};
+ static const int dists[30] = { // Offset base for distance codes 0..29
+ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
+ 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
+ 8193, 12289, 16385, 24577};
+ static const int dext[30] = { // Extra bits for distance codes 0..29
+ 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
+ 7, 7, 8, 8, 9, 9, 10, 10, 11, 11,
+ 12, 12, 13, 13};
+
+ //decode literals and length/distance pairs
+ while (true)
+ {
+ int symbol = doDecode(lencode);
+ if (symbol == 256)
+ break;
+ if (symbol < 0)
+ {
+ return false;
+ }
+ if (symbol < 256) //literal
+ {
+ dest.push_back(symbol);
+ }
+ else if (symbol > 256)//length
+ {
+ symbol -= 257;
+ if (symbol >= 29)
+ {
+ error("invalid fixed code");
+ return false;
+ }
+ int ret;
+ if (!getBits(lext[symbol], &ret))
+ return false;
+ int len = lens[symbol] + ret;
+
+ symbol = doDecode(distcode);//distance
+ if (symbol < 0)
+ {
+ return false;
+ }
+
+ if (!getBits(dext[symbol], &ret))
+ return false;
+ unsigned int dist = dists[symbol] + ret;
+ if (dist > dest.size())
+ {
+ error("distance too far back %d/%d", dist, dest.size());
+ dump();
+ //printf("pos:%d\n", srcPos);
+ return false;
+ }
+
+ // copy length bytes from distance bytes back
+ //dest.push_back('{');
+ while (len--)
+ {
+ dest.push_back(dest[dest.size() - dist]);
+ }
+ //dest.push_back('}');
+
+ }
+ }
+
+ return true;
+}
+
+/**
+ */
+bool Inflater::doStored()
+{
+ //trace("### stored ###");
+
+ // clear bits from current byte
+ bitBuf = 0;
+ bitCnt = 0;
+
+ // length
+ if (srcPos + 4 > src.size())
+ {
+ error("not enough input");
+ return false;
+ }
+
+ int len = src[srcPos++];
+ len |= src[srcPos++] << 8;
+ //trace("### len:%d", len);
+ // check complement
+ if (src[srcPos++] != (~len & 0xff) ||
+ src[srcPos++] != ((~len >> 8) & 0xff))
+ {
+ error("twos complement for storage size do not match");
+ return false;
+ }
+
+ // copy data
+ if (srcPos + len > src.size())
+ {
+ error("Not enough input for stored block");
+ return false;
+ }
+ while (len--)
+ dest.push_back(src[srcPos++]);
+
+ return true;
+}
+
+/**
+ */
+bool Inflater::doFixed()
+{
+ //trace("### fixed ###");
+
+ static bool firstTime = true;
+ static int lencnt[MAXBITS+1], lensym[FIXLCODES];
+ static int distcnt[MAXBITS+1], distsym[MAXDCODES];
+ static Huffman lencode = {lencnt, lensym};
+ static Huffman distcode = {distcnt, distsym};
+
+ if (firstTime)
+ {
+ firstTime = false;
+
+ int lengths[FIXLCODES];
+
+ // literal/length table
+ int symbol = 0;
+ for ( ; symbol < 144; symbol++)
+ lengths[symbol] = 8;
+ for ( ; symbol < 256; symbol++)
+ lengths[symbol] = 9;
+ for ( ; symbol < 280; symbol++)
+ lengths[symbol] = 7;
+ for ( ; symbol < FIXLCODES; symbol++)
+ lengths[symbol] = 8;
+ buildHuffman(&lencode, lengths, FIXLCODES);
+
+ // distance table
+ for (int symbol = 0; symbol < MAXDCODES; symbol++)
+ lengths[symbol] = 5;
+ buildHuffman(&distcode, lengths, MAXDCODES);
+ }
+
+ // decode data until end-of-block code
+ bool ret = doCodes(&lencode, &distcode);
+ return ret;
+}
+
+/**
+ */
+bool Inflater::doDynamic()
+{
+ //trace("### dynamic ###");
+ int lengths[MAXCODES]; // descriptor code lengths
+ int lencnt[MAXBITS+1], lensym[MAXLCODES]; // lencode memory
+ int distcnt[MAXBITS+1], distsym[MAXDCODES]; // distcode memory
+ Huffman lencode = {lencnt, lensym}; // length code
+ Huffman distcode = {distcnt, distsym}; // distance code
+ static const int order[19] = // permutation of code length codes
+ {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
+
+ // get number of lengths in each table, check lengths
+ int ret;
+ if (!getBits(5, &ret))
+ return false;
+ int nlen = ret + 257;
+ if (!getBits(5, &ret))
+ return false;
+ int ndist = ret + 1;
+ if (!getBits(4, &ret))
+ return false;
+ int ncode = ret + 4;
+ if (nlen > MAXLCODES || ndist > MAXDCODES)
+ {
+ error("Bad codes");
+ return false;
+ }
+
+ // get code length code lengths
+ int index = 0;
+ for ( ; index < ncode; index++)
+ {
+ if (!getBits(3, &ret))
+ return false;
+ lengths[order[index]] = ret;
+ }
+ for ( ; index < 19; index++)
+ lengths[order[index]] = 0;
+
+ // build huffman table for code lengths codes
+ if (buildHuffman(&lencode, lengths, 19) != 0)
+ return false;
+
+ // read length/literal and distance code length tables
+ index = 0;
+ while (index < nlen + ndist)
+ {
+ int symbol = doDecode(&lencode);
+ if (symbol < 16) // length in 0..15
+ lengths[index++] = symbol;
+ else
+ { // repeat instruction
+ int len = 0; // assume repeating zeros
+ if (symbol == 16)
+ { // repeat last length 3..6 times
+ if (index == 0)
+ {
+ error("no last length");
+ return false;
+ }
+ len = lengths[index - 1];// last length
+ if (!getBits(2, &ret))
+ return false;
+ symbol = 3 + ret;
+ }
+ else if (symbol == 17) // repeat zero 3..10 times
+ {
+ if (!getBits(3, &ret))
+ return false;
+ symbol = 3 + ret;
+ }
+ else // == 18, repeat zero 11..138 times
+ {
+ if (!getBits(7, &ret))
+ return false;
+ symbol = 11 + ret;
+ }
+ if (index + symbol > nlen + ndist)
+ {
+ error("too many lengths");
+ return false;
+ }
+ while (symbol--) // repeat last or zero symbol times
+ lengths[index++] = len;
+ }
+ }
+
+ // build huffman table for literal/length codes
+ int err = buildHuffman(&lencode, lengths, nlen);
+ if (err < 0 || (err > 0 && nlen - lencode.count[0] != 1))
+ {
+ error("incomplete length codes");
+ //return false;
+ }
+ // build huffman table for distance codes
+ err = buildHuffman(&distcode, lengths + nlen, ndist);
+ if (err < 0 || (err > 0 && nlen - lencode.count[0] != 1))
+ {
+ error("incomplete dist codes");
+ return false;
+ }
+
+ // decode data until end-of-block code
+ bool retn = doCodes(&lencode, &distcode);
+ return retn;
+}
+
+/**
+ */
+bool Inflater::inflate(std::vector<unsigned char> &destination,
+ std::vector<unsigned char> &source)
+{
+ dest.clear();
+ src = source;
+ srcPos = 0;
+ bitBuf = 0;
+ bitCnt = 0;
+
+ while (true)
+ {
+ int last; // one if last block
+ if (!getBits(1, &last))
+ return false;
+ int type; // block type 0..3
+ if (!getBits(2, &type))
+ return false;
+ switch (type)
+ {
+ case 0:
+ if (!doStored())
+ return false;
+ break;
+ case 1:
+ if (!doFixed())
+ return false;
+ break;
+ case 2:
+ if (!doDynamic())
+ return false;
+ break;
+ default:
+ error("Unknown block type %d", type);
+ return false;
+ }
+ if (last)
+ break;
+ }
+
+ destination = dest;
+
+ return true;
+}
+
+
+
+
+
+
+//########################################################################
+//# D E F L A T E R
+//########################################################################
+
+
+
+class Deflater
+{
+public:
+
+ /**
+ *
+ */
+ Deflater();
+
+ /**
+ *
+ */
+ virtual ~Deflater();
+
+ /**
+ *
+ */
+ virtual void reset();
+
+ /**
+ *
+ */
+ virtual bool update(int ch);
+
+ /**
+ *
+ */
+ virtual bool finish();
+
+ /**
+ *
+ */
+ virtual std::vector<unsigned char> &getCompressed();
+
+ /**
+ *
+ */
+ bool deflate(std::vector<unsigned char> &dest,
+ const std::vector<unsigned char> &src);
+
+ void encodeDistStatic(unsigned int len, unsigned int dist);
+
+private:
+
+ //debug messages
+ void error(char *fmt, ...);
+ void trace(char *fmt, ...);
+
+ bool compressWindow();
+
+ bool compress();
+
+ std::vector<unsigned char> uncompressed;
+
+ std::vector<unsigned char> window;
+
+ unsigned int windowPos;
+
+ std::vector<unsigned char> compressed;
+
+ //#### Output
+ unsigned int outputBitBuf;
+ unsigned int outputNrBits;
+
+ void put(int ch);
+
+ void putWord(int ch);
+
+ void putFlush();
+
+ void putBits(unsigned int ch, unsigned int bitsWanted);
+
+ void putBitsR(unsigned int ch, unsigned int bitsWanted);
+
+ //#### Huffman Encode
+ void encodeLiteralStatic(unsigned int ch);
+
+ unsigned char windowBuf[32768];
+ //assume 32-bit ints
+ unsigned int windowHashBuf[32768];
+};
+
+
+//########################################################################
+//# A P I
+//########################################################################
+
+
+/**
+ *
+ */
+Deflater::Deflater()
+{
+ reset();
+}
+
+/**
+ *
+ */
+Deflater::~Deflater()
+{
+
+}
+
+/**
+ *
+ */
+void Deflater::reset()
+{
+ outputBitBuf = 0;
+ outputNrBits = 0;
+ window.clear();
+ compressed.clear();
+ uncompressed.clear();
+}
+
+/**
+ *
+ */
+bool Deflater::update(int ch)
+{
+ uncompressed.push_back((unsigned char)(ch & 0xff));
+ return true;
+}
+
+/**
+ *
+ */
+bool Deflater::finish()
+{
+ return compress();
+}
+
+/**
+ *
+ */
+std::vector<unsigned char> &Deflater::getCompressed()
+{
+ return compressed;
+}
+
+
+/**
+ *
+ */
+bool Deflater::deflate(std::vector<unsigned char> &dest,
+ const std::vector<unsigned char> &src)
+{
+ reset();
+ uncompressed = src;
+ if (!compress())
+ return false;
+ dest = compressed;
+ return true;
+}
+
+
+
+
+
+
+
+//########################################################################
+//# W O R K I N G C O D E
+//########################################################################
+
+
+//#############################
+//# M E S S A G E S
+//#############################
+
+/**
+ * Print error messages
+ */
+void Deflater::error(char *fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+ fprintf(stdout, "Deflater error:");
+ vfprintf(stdout, fmt, args);
+ fprintf(stdout, "\n");
+ va_end(args);
+}
+
+/**
+ * Print trace messages
+ */
+void Deflater::trace(char *fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+ fprintf(stdout, "Deflater:");
+ vfprintf(stdout, fmt, args);
+ fprintf(stdout, "\n");
+ va_end(args);
+}
+
+
+
+
+//#############################
+//# O U T P U T
+//#############################
+
+/**
+ *
+ */
+void Deflater::put(int ch)
+{
+ compressed.push_back(ch);
+ outputBitBuf = 0;
+ outputNrBits = 0;
+}
+
+/**
+ *
+ */
+void Deflater::putWord(int ch)
+{
+ int lo = (ch ) & 0xff;
+ int hi = (ch>>8) & 0xff;
+ put(lo);
+ put(hi);
+}
+
+/**
+ *
+ */
+void Deflater::putFlush()
+{
+ if (outputNrBits > 0)
+ {
+ put(outputBitBuf & 0xff);
+ }
+ outputBitBuf = 0;
+ outputNrBits = 0;
+}
+
+/**
+ *
+ */
+void Deflater::putBits(unsigned int ch, unsigned int bitsWanted)
+{
+ //trace("n:%4u, %d\n", ch, bitsWanted);
+
+ while (bitsWanted--)
+ {
+ //add bits to position 7. shift right
+ outputBitBuf = (outputBitBuf>>1) + (ch<<7 & 0x80);
+ ch >>= 1;
+ outputNrBits++;
+ if (outputNrBits >= 8)
+ {
+ unsigned char b = outputBitBuf & 0xff;
+ //printf("b:%02x\n", b);
+ put(b);
+ }
+ }
+}
+
+static unsigned int bitReverse(unsigned int code, unsigned int nrBits)
+{
+ unsigned int outb = 0;
+ while (nrBits--)
+ {
+ outb = (outb << 1) | (code & 0x01);
+ code >>= 1;
+ }
+ return outb;
+}
+
+
+/**
+ *
+ */
+void Deflater::putBitsR(unsigned int ch, unsigned int bitsWanted)
+{
+ //trace("r:%4u, %d", ch, bitsWanted);
+
+ unsigned int rcode = bitReverse(ch, bitsWanted);
+
+ putBits(rcode, bitsWanted);
+
+}
+
+
+//#############################
+//# E N C O D E
+//#############################
+
+
+
+void Deflater::encodeLiteralStatic(unsigned int ch)
+{
+ //trace("c: %d", ch);
+
+ if (ch < 144)
+ {
+ putBitsR(ch + 0x0030 , 8); // 00110000
+ }
+ else if (ch < 256)
+ {
+ putBitsR(ch - 144 + 0x0190 , 9); // 110010000
+ }
+ else if (ch < 280)
+ {
+ putBitsR(ch - 256 + 0x0000 , 7); // 0000000
+ }
+ else if (ch < 288)
+ {
+ putBitsR(ch - 280 + 0x00c0 , 8); // 11000000
+ }
+ else //out of range
+ {
+ error("Literal out of range: %d", ch);
+ }
+
+}
+
+
+typedef struct
+{
+ unsigned int base;
+ unsigned int range;
+ unsigned int bits;
+} LenBase;
+
+LenBase lenBases[] =
+{
+ { 3, 1, 0 },
+ { 4, 1, 0 },
+ { 5, 1, 0 },
+ { 6, 1, 0 },
+ { 7, 1, 0 },
+ { 8, 1, 0 },
+ { 9, 1, 0 },
+ { 10, 1, 0 },
+ { 11, 2, 1 },
+ { 13, 2, 1 },
+ { 15, 2, 1 },
+ { 17, 2, 1 },
+ { 19, 4, 2 },
+ { 23, 4, 2 },
+ { 27, 4, 2 },
+ { 31, 4, 2 },
+ { 35, 8, 3 },
+ { 43, 8, 3 },
+ { 51, 8, 3 },
+ { 59, 8, 3 },
+ { 67, 16, 4 },
+ { 83, 16, 4 },
+ { 99, 16, 4 },
+ { 115, 16, 4 },
+ { 131, 32, 5 },
+ { 163, 32, 5 },
+ { 195, 32, 5 },
+ { 227, 32, 5 },
+ { 258, 1, 0 }
+};
+
+typedef struct
+{
+ unsigned int base;
+ unsigned int range;
+ unsigned int bits;
+} DistBase;
+
+DistBase distBases[] =
+{
+ { 1, 1, 0 },
+ { 2, 1, 0 },
+ { 3, 1, 0 },
+ { 4, 1, 0 },
+ { 5, 2, 1 },
+ { 7, 2, 1 },
+ { 9, 4, 2 },
+ { 13, 4, 2 },
+ { 17, 8, 3 },
+ { 25, 8, 3 },
+ { 33, 16, 4 },
+ { 49, 16, 4 },
+ { 65, 32, 5 },
+ { 97, 32, 5 },
+ { 129, 64, 6 },
+ { 193, 64, 6 },
+ { 257, 128, 7 },
+ { 385, 128, 7 },
+ { 513, 256, 8 },
+ { 769, 256, 8 },
+ { 1025, 512, 9 },
+ { 1537, 512, 9 },
+ { 2049, 1024, 10 },
+ { 3073, 1024, 10 },
+ { 4097, 2048, 11 },
+ { 6145, 2048, 11 },
+ { 8193, 4096, 12 },
+ { 12289, 4096, 12 },
+ { 16385, 8192, 13 },
+ { 24577, 8192, 13 }
+};
+
+void Deflater::encodeDistStatic(unsigned int len, unsigned int dist)
+{
+
+ //## Output length
+
+ if (len < 3 || len > 258)
+ {
+ error("Length out of range:%d", len);
+ return;
+ }
+
+ bool found = false;
+ for (int i=0 ; i<30 ; i++)
+ {
+ unsigned int base = lenBases[i].base;
+ unsigned int range = lenBases[i].range;
+ if (base + range > len)
+ {
+ unsigned int lenCode = 257 + i;
+ unsigned int length = len - base;
+ //trace("--- %d %d %d %d", len, base, range, length);
+ encodeLiteralStatic(lenCode);
+ putBits(length, lenBases[i].bits);
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ {
+ error("Length not found in table:%d", len);
+ return;
+ }
+
+ //## Output distance
+
+ if (dist < 4 || dist > 32768)
+ {
+ error("Distance out of range:%d", dist);
+ return;
+ }
+
+ found = false;
+ for (int i=0 ; i<30 ; i++)
+ {
+ unsigned int base = distBases[i].base;
+ unsigned int range = distBases[i].range;
+ if (base + range > dist)
+ {
+ unsigned int distCode = i;
+ unsigned int distance = dist - base;
+ //error("--- %d %d %d %d", dist, base, range, distance);
+ putBitsR(distCode, 5);
+ putBits(distance, distBases[i].bits);
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ {
+ error("Distance not found in table:%d", dist);
+ return;
+ }
+}
+
+
+//#############################
+//# C O M P R E S S
+//#############################
+
+
+/**
+ * This method does the dirty work of dictionary
+ * compression. Basically it looks for redundant
+ * strings and has the current duplicate refer back
+ * to the previous one.
+ */
+bool Deflater::compressWindow()
+{
+ windowPos = 0;
+ unsigned int windowSize = window.size();
+ //### Compress as much of the window as possible
+
+ unsigned int hash = 0;
+ //Have each value be a long with the byte at this position,
+ //plus the 3 bytes after it in the window
+ for (int i=windowSize-1 ; i>=0 ; i--)
+ {
+ unsigned char ch = window[i];
+ windowBuf[i] = ch;
+ hash = ((hash<<8) & 0xffffff00) | ch;
+ windowHashBuf[i] = hash;
+ }
+
+ while (windowPos < windowSize - 3)
+ {
+ //### Find best match, if any
+ unsigned int bestMatchLen = 0;
+ unsigned int bestMatchDist = 0;
+ if (windowPos >= 4)
+ {
+ for (unsigned int lookBack=0 ; lookBack<windowPos-4 ; lookBack++)
+ {
+ //Check 4-char hashes first, before continuing with string
+ if (windowHashBuf[lookBack] == windowHashBuf[windowPos])
+ {
+ unsigned int lookAhead=4;
+ unsigned int lookAheadMax = windowSize - 4 - windowPos;
+ if (lookBack + lookAheadMax >= windowPos -4 )
+ lookAheadMax = windowPos - 4 - lookBack;
+ if (lookAheadMax > 258)
+ lookAheadMax = 258;
+ unsigned char *wp = &(windowBuf[windowPos+4]);
+ unsigned char *lb = &(windowBuf[lookBack+4]);
+ while (lookAhead<lookAheadMax)
+ {
+ if (*lb++ != *wp++)
+ break;
+ lookAhead++;
+ }
+ if (lookAhead > bestMatchLen)
+ {
+ bestMatchLen = lookAhead;
+ bestMatchDist = windowPos - lookBack;
+ }
+ }
+ }
+ }
+ if (bestMatchLen > 3)
+ {
+ //Distance encode
+ //trace("### distance");
+ /*
+ printf("### 1 '");
+ for (int i=0 ; i < bestMatchLen ; i++)
+ fputc(window[windowPos+i], stdout);
+ printf("'\n### 2 '");
+ for (int i=0 ; i < bestMatchLen ; i++)
+ fputc(window[windowPos-bestMatchDist+i], stdout);
+ printf("'\n");
+ */
+ encodeDistStatic(bestMatchLen, bestMatchDist);
+ windowPos += bestMatchLen;
+ }
+ else
+ {
+ //Literal encode
+ //trace("### literal");
+ encodeLiteralStatic(windowBuf[windowPos]);
+ windowPos++;
+ }
+ }
+
+ while (windowPos < windowSize)
+ encodeLiteralStatic(windowBuf[windowPos++]);
+
+ encodeLiteralStatic(256);
+ return true;
+}
+
+
+/**
+ *
+ */
+bool Deflater::compress()
+{
+ //trace("compress");
+ unsigned long total = 0L;
+ windowPos = 0;
+ std::vector<unsigned char>::iterator iter;
+ for (iter = uncompressed.begin(); iter != uncompressed.end() ; )
+ {
+ total += windowPos;
+ trace("total:%ld", total);
+ if (windowPos > window.size())
+ windowPos = window.size();
+ window.erase(window.begin() , window.begin()+windowPos);
+ while (window.size() < 32768 && iter != uncompressed.end())
+ {
+ window.push_back(*iter);
+ iter++;
+ }
+ if (window.size() >= 32768)
+ putBits(0x00, 1); //0 -- more blocks
+ else
+ putBits(0x01, 1); //1 -- last block
+ putBits(0x01, 2); //01 -- static trees
+ if (!compressWindow())
+ return false;
+ }
+ putFlush();
+ return true;
+}
+
+
+
+
+
+//########################################################################
+//# G Z I P F I L E
+//########################################################################
+
+/**
+ * Constructor
+ */
+GzipFile::GzipFile()
+{
+}
+
+/**
+ * Destructor
+ */
+GzipFile::~GzipFile()
+{
+}
+
+/**
+ * Print error messages
+ */
+void GzipFile::error(char *fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+ fprintf(stdout, "GzipFile error:");
+ vfprintf(stdout, fmt, args);
+ fprintf(stdout, "\n");
+ va_end(args);
+}
+
+/**
+ * Print trace messages
+ */
+void GzipFile::trace(char *fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+ fprintf(stdout, "GzipFile:");
+ vfprintf(stdout, fmt, args);
+ fprintf(stdout, "\n");
+ va_end(args);
+}
+
+/**
+ *
+ */
+void GzipFile::put(unsigned char ch)
+{
+ data.push_back(ch);
+}
+
+/**
+ *
+ */
+void GzipFile::setData(const std::vector<unsigned char> &str)
+{
+ data = str;
+}
+
+/**
+ *
+ */
+void GzipFile::clearData()
+{
+ data.clear();
+}
+
+/**
+ *
+ */
+std::vector<unsigned char> &GzipFile::getData()
+{
+ return data;
+}
+
+/**
+ *
+ */
+std::string &GzipFile::getFileName()
+{
+ return fileName;
+}
+
+/**
+ *
+ */
+void GzipFile::setFileName(const std::string &val)
+{
+ fileName = val;
+}
+
+
+
+//#####################################
+//# U T I L I T Y
+//#####################################
+
+/**
+ * Loads a new file into an existing GzipFile
+ */
+bool GzipFile::loadFile(const std::string &fName)
+{
+ FILE *f = fopen(fName.c_str() , "rb");
+ if (!f)
+ {
+ error("Cannot open file %s", fName.c_str());
+ return false;
+ }
+ while (true)
+ {
+ int ch = fgetc(f);
+ if (ch < 0)
+ break;
+ data.push_back(ch);
+ }
+ fclose(f);
+ setFileName(fName);
+ return true;
+}
+
+
+
+//#####################################
+//# W R I T E
+//#####################################
+
+/**
+ *
+ */
+bool GzipFile::putByte(unsigned char ch)
+{
+ fileBuf.push_back(ch);
+ return true;
+}
+
+
+
+/**
+ *
+ */
+bool GzipFile::putLong(unsigned long val)
+{
+ fileBuf.push_back( (unsigned char)((val ) & 0xff));
+ fileBuf.push_back( (unsigned char)((val>> 8) & 0xff));
+ fileBuf.push_back( (unsigned char)((val>>16) & 0xff));
+ fileBuf.push_back( (unsigned char)((val>>24) & 0xff));
+ return true;
+}
+
+
+
+/**
+ *
+ */
+bool GzipFile::write()
+{
+ fileBuf.clear();
+
+ putByte(0x1f); //magic
+ putByte(0x8b); //magic
+ putByte( 8); //compression method
+ putByte(0x08); //flags. say we have a crc and file name
+
+ unsigned long ltime = (unsigned long) time(NULL);
+ putLong(ltime);
+
+ //xfl
+ putByte(0);
+ //OS
+ putByte(0);
+
+ //file name
+ for (unsigned int i=0 ; i<fileName.size() ; i++)
+ putByte(fileName[i]);
+ putByte(0);
+
+
+ //compress
+ std::vector<unsigned char> compBuf;
+ Deflater deflater;
+ if (!deflater.deflate(compBuf, data))
+ {
+ return false;
+ }
+
+ std::vector<unsigned char>::iterator iter;
+ for (iter=compBuf.begin() ; iter!=compBuf.end() ; iter++)
+ {
+ unsigned char ch = *iter;
+ putByte(ch);
+ }
+
+ Crc32 crcEngine;
+ crcEngine.update(data);
+ unsigned long crc = crcEngine.getValue();
+ putLong(crc);
+
+ putLong(data.size());
+
+ return true;
+}
+
+
+/**
+ *
+ */
+bool GzipFile::writeBuffer(std::vector<unsigned char> &outBuf)
+{
+ if (!write())
+ return false;
+ outBuf.clear();
+ outBuf = fileBuf;
+ return true;
+}
+
+
+/**
+ *
+ */
+bool GzipFile::writeFile(const std::string &fileName)
+{
+ if (!write())
+ return false;
+ FILE *f = fopen(fileName.c_str(), "wb");
+ if (!f)
+ return false;
+ std::vector<unsigned char>::iterator iter;
+ for (iter=fileBuf.begin() ; iter!=fileBuf.end() ; iter++)
+ {
+ unsigned char ch = *iter;
+ fputc(ch, f);
+ }
+ fclose(f);
+ return true;
+}
+
+
+//#####################################
+//# R E A D
+//#####################################
+
+bool GzipFile::getByte(unsigned char *ch)
+{
+ if (fileBufPos >= fileBuf.size())
+ {
+ error("unexpected end of data");
+ return false;
+ }
+ *ch = fileBuf[fileBufPos++];
+ return true;
+}
+
+/**
+ *
+ */
+bool GzipFile::getLong(unsigned long *val)
+{
+ if (fileBuf.size() - fileBufPos < 4)
+ return false;
+ int ch1 = fileBuf[fileBufPos++];
+ int ch2 = fileBuf[fileBufPos++];
+ int ch3 = fileBuf[fileBufPos++];
+ int ch4 = fileBuf[fileBufPos++];
+ *val = ((ch4<<24) & 0xff000000L) |
+ ((ch3<<16) & 0x00ff0000L) |
+ ((ch2<< 8) & 0x0000ff00L) |
+ ((ch1 ) & 0x000000ffL);
+ return true;
+}
+
+bool GzipFile::read()
+{
+ fileBufPos = 0;
+
+ unsigned char ch;
+
+ //magic cookie
+ if (!getByte(&ch))
+ return false;
+ if (ch != 0x1f)
+ {
+ error("bad gzip header");
+ return false;
+ }
+ if (!getByte(&ch))
+ return false;
+ if (ch != 0x8b)
+ {
+ error("bad gzip header");
+ return false;
+ }
+
+ //## compression method
+ if (!getByte(&ch))
+ return false;
+ compressionMethod = ch & 0xff;
+
+ //## flags
+ if (!getByte(&ch))
+ return false;
+ //bool ftext = ch & 0x01;
+ bool fhcrc = ch & 0x02;
+ bool fextra = ch & 0x04;
+ bool fname = ch & 0x08;
+ bool fcomment = ch & 0x10;
+
+ //trace("cm:%d ftext:%d fhcrc:%d fextra:%d fname:%d fcomment:%d",
+ // cm, ftext, fhcrc, fextra, fname, fcomment);
+
+ //## file time
+ unsigned long ltime;
+ if (!getLong(&ltime))
+ return false;
+ //time_t mtime = (time_t)ltime;
+
+ //## XFL
+ if (!getByte(&ch))
+ return false;
+ //int xfl = ch;
+
+ //## OS
+ if (!getByte(&ch))
+ return false;
+ //int os = ch;
+
+ //std::string timestr = ctime(&mtime);
+ //trace("xfl:%d os:%d mtime:%s", xfl, os, timestr.c_str());
+
+ if (fextra)
+ {
+ if (!getByte(&ch))
+ return false;
+ long xlen = ch;
+ if (!getByte(&ch))
+ return false;
+ xlen = (xlen << 8) + ch;
+ for (long l=0 ; l<xlen ; l++)
+ {
+ if (!getByte(&ch))
+ return false;
+ }
+ }
+
+ if (fname)
+ {
+ fileName = "";
+ while (true)
+ {
+ if (!getByte(&ch))
+ return false;
+ if (ch==0)
+ break;
+ fileName.push_back(ch);
+ }
+ }
+
+ if (fcomment)
+ {
+ while (true)
+ {
+ if (!getByte(&ch))
+ return false;
+ if (ch==0)
+ break;
+ }
+ }
+
+ if (fhcrc)
+ {
+ if (!getByte(&ch))
+ return false;
+ if (!getByte(&ch))
+ return false;
+ }
+
+ //read remainder of stream
+ //compressed data runs up until 8 bytes before end of buffer
+ std::vector<unsigned char> compBuf;
+ while (fileBufPos < fileBuf.size() - 8)
+ {
+ if (!getByte(&ch))
+ return false;
+ compBuf.push_back(ch);
+ }
+ //uncompress
+ data.clear();
+ Inflater inflater;
+ if (!inflater.inflate(data, compBuf))
+ {
+ return false;
+ }
+
+ //Get the CRC and compare
+ Crc32 crcEngine;
+ crcEngine.update(data);
+ unsigned long calcCrc = crcEngine.getValue();
+ unsigned long givenCrc;
+ if (!getLong(&givenCrc))
+ return false;
+ if (givenCrc != calcCrc)
+ {
+ error("Specified crc, %ud, not what received: %ud",
+ givenCrc, calcCrc);
+ return false;
+ }
+
+ //Get the file size and compare
+ unsigned long givenFileSize;
+ if (!getLong(&givenFileSize))
+ return false;
+ if (givenFileSize != data.size())
+ {
+ error("Specified data size, %ld, not what received: %ld",
+ givenFileSize, data.size());
+ return false;
+ }
+
+ return true;
+}
+
+
+
+/**
+ *
+ */
+bool GzipFile::readBuffer(const std::vector<unsigned char> &inbuf)
+{
+ fileBuf = inbuf;
+ if (!read())
+ return false;
+ return true;
+}
+
+
+/**
+ *
+ */
+bool GzipFile::readFile(const std::string &fileName)
+{
+ fileBuf.clear();
+ FILE *f = fopen(fileName.c_str(), "rb");
+ if (!f)
+ return false;
+ while (true)
+ {
+ int ch = fgetc(f);
+ if (ch < 0)
+ break;
+ fileBuf.push_back(ch);
+ }
+ fclose(f);
+ if (!read())
+ return false;
+ return true;
+}
+
+
+
+
+
+
+
+
+//########################################################################
+//# Z I P F I L E
+//########################################################################
+
+/**
+ * Constructor
+ */
+ZipEntry::ZipEntry()
+{
+ crc = 0L;
+ compressionMethod = 8;
+}
+
+/**
+ *
+ */
+ZipEntry::ZipEntry(const std::string &fileNameArg,
+ const std::string &commentArg)
+{
+ crc = 0L;
+ compressionMethod = 8;
+ fileName = fileNameArg;
+ comment = commentArg;
+}
+
+/**
+ * Destructor
+ */
+ZipEntry::~ZipEntry()
+{
+}
+
+
+/**
+ *
+ */
+std::string ZipEntry::getFileName()
+{
+ return fileName;
+}
+
+/**
+ *
+ */
+void ZipEntry::setFileName(const std::string &val)
+{
+ fileName = val;
+}
+
+/**
+ *
+ */
+std::string ZipEntry::getComment()
+{
+ return comment;
+}
+
+/**
+ *
+ */
+void ZipEntry::setComment(const std::string &val)
+{
+ comment = val;
+}
+
+/**
+ *
+ */
+unsigned long ZipEntry::getCompressedSize()
+{
+ return (unsigned long)compressedData.size();
+}
+
+/**
+ *
+ */
+int ZipEntry::getCompressionMethod()
+{
+ return compressionMethod;
+}
+
+/**
+ *
+ */
+void ZipEntry::setCompressionMethod(int val)
+{
+ compressionMethod = val;
+}
+
+/**
+ *
+ */
+std::vector<unsigned char> &ZipEntry::getCompressedData()
+{
+ return compressedData;
+}
+
+/**
+ *
+ */
+void ZipEntry::setCompressedData(const std::vector<unsigned char> &val)
+{
+ compressedData = val;
+}
+
+/**
+ *
+ */
+unsigned long ZipEntry::getUncompressedSize()
+{
+ return (unsigned long)uncompressedData.size();
+}
+
+/**
+ *
+ */
+std::vector<unsigned char> &ZipEntry::getUncompressedData()
+{
+ return uncompressedData;
+}
+
+/**
+ *
+ */
+void ZipEntry::setUncompressedData(const std::vector<unsigned char> &val)
+{
+ uncompressedData = val;
+}
+
+/**
+ *
+ */
+unsigned long ZipEntry::getCrc()
+{
+ return crc;
+}
+
+/**
+ *
+ */
+void ZipEntry::setCrc(unsigned long val)
+{
+ crc = val;
+}
+
+/**
+ *
+ */
+void ZipEntry::write(unsigned char ch)
+{
+ uncompressedData.push_back(ch);
+}
+
+/**
+ *
+ */
+void ZipEntry::finish()
+{
+ Crc32 c32;
+ std::vector<unsigned char>::iterator iter;
+ for (iter = uncompressedData.begin() ;
+ iter!= uncompressedData.end() ; iter++)
+ {
+ unsigned char ch = *iter;
+ c32.update(ch);
+ }
+ crc = c32.getValue();
+ switch (compressionMethod)
+ {
+ case 0: //none
+ {
+ for (iter = uncompressedData.begin() ;
+ iter!= uncompressedData.end() ; iter++)
+ {
+ unsigned char ch = *iter;
+ compressedData.push_back(ch);
+ }
+ break;
+ }
+ case 8: //deflate
+ {
+ Deflater deflater;
+ if (!deflater.deflate(compressedData, uncompressedData))
+ {
+ //some error
+ }
+ break;
+ }
+ default:
+ {
+ printf("error: unknown compression method %d\n",
+ compressionMethod);
+ }
+ }
+}
+
+
+
+
+/**
+ *
+ */
+bool ZipEntry::readFile(const std::string &fileNameArg,
+ const std::string &commentArg)
+{
+ crc = 0L;
+ uncompressedData.clear();
+ fileName = fileNameArg;
+ comment = commentArg;
+ FILE *f = fopen(fileName.c_str(), "rb");
+ if (!f)
+ {
+ return false;
+ }
+ while (true)
+ {
+ int ch = fgetc(f);
+ if (ch < 0)
+ break;
+ uncompressedData.push_back((unsigned char)ch);
+ }
+ fclose(f);
+ finish();
+ return true;
+}
+
+
+/**
+ *
+ */
+void ZipEntry::setPosition(unsigned long val)
+{
+ position = val;
+}
+
+/**
+ *
+ */
+unsigned long ZipEntry::getPosition()
+{
+ return position;
+}
+
+
+
+
+
+
+
+/**
+ * Constructor
+ */
+ZipFile::ZipFile()
+{
+
+}
+
+/**
+ * Destructor
+ */
+ZipFile::~ZipFile()
+{
+ std::vector<ZipEntry *>::iterator iter;
+ for (iter=entries.begin() ; iter!=entries.end() ; iter++)
+ {
+ ZipEntry *entry = *iter;
+ delete entry;
+ }
+ entries.clear();
+}
+
+/**
+ *
+ */
+void ZipFile::setComment(const std::string &val)
+{
+ comment = val;
+}
+
+/**
+ *
+ */
+std::string ZipFile::getComment()
+{
+ return comment;
+}
+
+
+/**
+ *
+ */
+std::vector<ZipEntry *> &ZipFile::getEntries()
+{
+ return entries;
+}
+
+
+
+//#####################################
+//# M E S S A G E S
+//#####################################
+
+void ZipFile::error(char *fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+ fprintf(stdout, "ZipFile error:");
+ vfprintf(stdout, fmt, args);
+ fprintf(stdout, "\n");
+ va_end(args);
+}
+
+void ZipFile::trace(char *fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+ fprintf(stdout, "ZipFile:");
+ vfprintf(stdout, fmt, args);
+ fprintf(stdout, "\n");
+ va_end(args);
+}
+
+//#####################################
+//# U T I L I T Y
+//#####################################
+
+/**
+ *
+ */
+ZipEntry *ZipFile::addFile(const std::string &fileName,
+ const std::string &comment)
+{
+ ZipEntry *ze = new ZipEntry();
+ if (!ze->readFile(fileName, comment))
+ {
+ return NULL;
+ }
+ entries.push_back(ze);
+ return ze;
+}
+
+
+/**
+ *
+ */
+ZipEntry *ZipFile::newEntry(const std::string &fileName,
+ const std::string &comment)
+{
+ ZipEntry *ze = new ZipEntry(fileName, comment);
+ entries.push_back(ze);
+ return ze;
+}
+
+
+//#####################################
+//# W R I T E
+//#####################################
+
+/**
+ *
+ */
+bool ZipFile::putLong(unsigned long val)
+{
+ fileBuf.push_back( ((int)(val )) & 0xff);
+ fileBuf.push_back( ((int)(val>> 8)) & 0xff);
+ fileBuf.push_back( ((int)(val>>16)) & 0xff);
+ fileBuf.push_back( ((int)(val>>24)) & 0xff);
+ return true;
+}
+
+
+/**
+ *
+ */
+bool ZipFile::putInt(unsigned int val)
+{
+ fileBuf.push_back( (val ) & 0xff);
+ fileBuf.push_back( (val>> 8) & 0xff);
+ return true;
+}
+
+/**
+ *
+ */
+bool ZipFile::putByte(unsigned char val)
+{
+ fileBuf.push_back(val);
+ return true;
+}
+
+/**
+ *
+ */
+bool ZipFile::writeFileData()
+{
+ std::vector<ZipEntry *>::iterator iter;
+ for (iter = entries.begin() ; iter != entries.end() ; iter++)
+ {
+ ZipEntry *entry = *iter;
+ entry->setPosition(fileBuf.size());
+ //##### HEADER
+ std::string fname = entry->getFileName();
+ putLong(0x04034b50L);
+ putInt(20); //versionNeeded
+ putInt(0); //gpBitFlag
+ //putInt(0); //compression method
+ putInt(entry->getCompressionMethod()); //compression method
+ putInt(0); //mod time
+ putInt(0); //mod date
+ putLong(entry->getCrc()); //crc32
+ putLong(entry->getCompressedSize());
+ putLong(entry->getUncompressedSize());
+ putInt(fname.size());//fileName length
+ putInt(8);//extra field length
+ //file name
+ for (unsigned int i=0 ; i<fname.size() ; i++)
+ putByte((unsigned char)fname[i]);
+ //extra field
+ putInt(0x7855);
+ putInt(4);
+ putInt(100);
+ putInt(100);
+
+ //##### DATA
+ std::vector<unsigned char> &buf = entry->getCompressedData();
+ std::vector<unsigned char>::iterator iter;
+ for (iter = buf.begin() ; iter != buf.end() ; iter++)
+ {
+ unsigned char ch = (unsigned char) *iter;
+ putByte(ch);
+ }
+ }
+ return true;
+}
+
+/**
+ *
+ */
+bool ZipFile::writeCentralDirectory()
+{
+ unsigned long cdPosition = fileBuf.size();
+ std::vector<ZipEntry *>::iterator iter;
+ for (iter = entries.begin() ; iter != entries.end() ; iter++)
+ {
+ ZipEntry *entry = *iter;
+ std::string fname = entry->getFileName();
+ std::string ecomment = entry->getComment();
+ putLong(0x02014b50L); //magic cookie
+ putInt(2386); //versionMadeBy
+ putInt(20); //versionNeeded
+ putInt(0); //gpBitFlag
+ putInt(entry->getCompressionMethod()); //compression method
+ putInt(0); //mod time
+ putInt(0); //mod date
+ putLong(entry->getCrc()); //crc32
+ putLong(entry->getCompressedSize());
+ putLong(entry->getUncompressedSize());
+ putInt(fname.size());//fileName length
+ putInt(4);//extra field length
+ putInt(ecomment.size());//comment length
+ putInt(0); //disk number start
+ putInt(0); //internal attributes
+ putLong(0); //external attributes
+ putLong(entry->getPosition());
+
+ //file name
+ for (unsigned int i=0 ; i<fname.size() ; i++)
+ putByte((unsigned char)fname[i]);
+ //extra field
+ putInt(0x7855);
+ putInt(0);
+ //comment
+ for (unsigned int i=0 ; i<ecomment.size() ; i++)
+ putByte((unsigned char)ecomment[i]);
+ }
+ unsigned long cdSize = fileBuf.size() - cdPosition;
+
+ putLong(0x06054b50L);
+ putInt(0);//number of this disk
+ putInt(0);//nr of disk with central dir
+ putInt(entries.size()); //number of entries on this disk
+ putInt(entries.size()); //number of entries total
+ putLong(cdSize); //size of central dir
+ putLong(cdPosition); //position of central dir
+ putInt(comment.size());//comment size
+ for (unsigned int i=0 ; i<comment.size() ; i++)
+ putByte(comment[i]);
+ return true;
+}
+
+
+
+/**
+ *
+ */
+bool ZipFile::write()
+{
+ fileBuf.clear();
+ if (!writeFileData())
+ return false;
+ if (!writeCentralDirectory())
+ return false;
+ return true;
+}
+
+
+/**
+ *
+ */
+bool ZipFile::writeBuffer(std::vector<unsigned char> &outBuf)
+{
+ if (!write())
+ return false;
+ outBuf.clear();
+ outBuf = fileBuf;
+ return true;
+}
+
+
+/**
+ *
+ */
+bool ZipFile::writeFile(const std::string &fileName)
+{
+ if (!write())
+ return false;
+ FILE *f = fopen(fileName.c_str(), "wb");
+ if (!f)
+ return false;
+ std::vector<unsigned char>::iterator iter;
+ for (iter=fileBuf.begin() ; iter!=fileBuf.end() ; iter++)
+ {
+ unsigned char ch = *iter;
+ fputc(ch, f);
+ }
+ fclose(f);
+ return true;
+}
+
+//#####################################
+//# R E A D
+//#####################################
+
+/**
+ *
+ */
+bool ZipFile::getLong(unsigned long *val)
+{
+ if (fileBuf.size() - fileBufPos < 4)
+ return false;
+ int ch1 = fileBuf[fileBufPos++];
+ int ch2 = fileBuf[fileBufPos++];
+ int ch3 = fileBuf[fileBufPos++];
+ int ch4 = fileBuf[fileBufPos++];
+ *val = ((ch4<<24) & 0xff000000L) |
+ ((ch3<<16) & 0x00ff0000L) |
+ ((ch2<< 8) & 0x0000ff00L) |
+ ((ch1 ) & 0x000000ffL);
+ return true;
+}
+
+/**
+ *
+ */
+bool ZipFile::getInt(unsigned int *val)
+{
+ if (fileBuf.size() - fileBufPos < 2)
+ return false;
+ int ch1 = fileBuf[fileBufPos++];
+ int ch2 = fileBuf[fileBufPos++];
+ *val = ((ch2<< 8) & 0xff00) |
+ ((ch1 ) & 0x00ff);
+ return true;
+}
+
+
+/**
+ *
+ */
+bool ZipFile::getByte(unsigned char *val)
+{
+ if (fileBuf.size() <= fileBufPos)
+ return false;
+ *val = fileBuf[fileBufPos++];
+ return true;
+}
+
+
+/**
+ *
+ */
+bool ZipFile::readFileData()
+{
+ //printf("#################################################\n");
+ //printf("###D A T A\n");
+ //printf("#################################################\n");
+ while (true)
+ {
+ unsigned long magicCookie;
+ if (!getLong(&magicCookie))
+ {
+ error("magic cookie not found");
+ break;
+ }
+ trace("###Cookie:%lx", magicCookie);
+ if (magicCookie == 0x02014b50L) //central directory
+ break;
+ if (magicCookie != 0x04034b50L)
+ {
+ error("file header not found");
+ return false;
+ }
+ unsigned int versionNeeded;
+ if (!getInt(&versionNeeded))
+ {
+ error("bad version needed found");
+ return false;
+ }
+ unsigned int gpBitFlag;
+ if (!getInt(&gpBitFlag))
+ {
+ error("bad bit flag found");
+ return false;
+ }
+ unsigned int compressionMethod;
+ if (!getInt(&compressionMethod))
+ {
+ error("bad compressionMethod found");
+ return false;
+ }
+ unsigned int modTime;
+ if (!getInt(&modTime))
+ {
+ error("bad modTime found");
+ return false;
+ }
+ unsigned int modDate;
+ if (!getInt(&modDate))
+ {
+ error("bad modDate found");
+ return false;
+ }
+ unsigned long crc32;
+ if (!getLong(&crc32))
+ {
+ error("bad crc32 found");
+ return false;
+ }
+ unsigned long compressedSize;
+ if (!getLong(&compressedSize))
+ {
+ error("bad compressedSize found");
+ return false;
+ }
+ unsigned long uncompressedSize;
+ if (!getLong(&uncompressedSize))
+ {
+ error("bad uncompressedSize found");
+ return false;
+ }
+ unsigned int fileNameLength;
+ if (!getInt(&fileNameLength))
+ {
+ error("bad fileNameLength found");
+ return false;
+ }
+ unsigned int extraFieldLength;
+ if (!getInt(&extraFieldLength))
+ {
+ error("bad extraFieldLength found");
+ return false;
+ }
+ std::string fileName;
+ for (unsigned int i=0 ; i<fileNameLength ; i++)
+ {
+ unsigned char ch;
+ if (!getByte(&ch))
+ break;
+ fileName.push_back(ch);
+ }
+ std::string extraField;
+ for (unsigned int i=0 ; i<extraFieldLength ; i++)
+ {
+ unsigned char ch;
+ if (!getByte(&ch))
+ break;
+ extraField.push_back(ch);
+ }
+ trace("######################### DATA");
+ trace("FileName :%d:%s" , fileName.size(), fileName.c_str());
+ trace("Extra field :%d:%s" , extraField.size(), extraField.c_str());
+ trace("Version needed :%d" , versionNeeded);
+ trace("Bitflag :%d" , gpBitFlag);
+ trace("Compression Method :%d" , compressionMethod);
+ trace("Mod time :%d" , modTime);
+ trace("Mod date :%d" , modDate);
+ trace("CRC :%lx", crc32);
+ trace("Compressed size :%ld", compressedSize);
+ trace("Uncompressed size :%ld", uncompressedSize);
+
+ //#### Uncompress the data
+ std::vector<unsigned char> compBuf;
+ if (gpBitFlag & 0x8)//bit 3 was set. means we dont know compressed size
+ {
+ unsigned char c1, c2, c3, c4;
+ c1 = c2 = c3 = c4 = 0;
+ while (true)
+ {
+ unsigned char ch;
+ if (!getByte(&ch))
+ {
+ error("premature end of data");
+ break;
+ }
+ compBuf.push_back(ch);
+ c1 = c2; c2 = c3; c3 = c4; c4 = ch;
+ if (c1 == 0x50 && c2 == 0x4b && c3 == 0x07 && c4 == 0x08)
+ {
+ trace("found end of compressed data");
+ //remove the cookie
+ compBuf.erase(compBuf.end() -4, compBuf.end());
+ break;
+ }
+ }
+ }
+ else
+ {
+ for (unsigned long bnr = 0 ; bnr < compressedSize ; bnr++)
+ {
+ unsigned char ch;
+ if (!getByte(&ch))
+ {
+ error("premature end of data");
+ break;
+ }
+ compBuf.push_back(ch);
+ }
+ }
+
+ printf("### data: ");
+ for (int i=0 ; i<10 ; i++)
+ printf("%02x ", compBuf[i] & 0xff);
+ printf("\n");
+
+ if (gpBitFlag & 0x8)//only if bit 3 set
+ {
+ /* this cookie was read in the loop above
+ unsigned long dataDescriptorSignature ;
+ if (!getLong(&dataDescriptorSignature))
+ break;
+ if (dataDescriptorSignature != 0x08074b50L)
+ {
+ error("bad dataDescriptorSignature found");
+ return false;
+ }
+ */
+ unsigned long crc32;
+ if (!getLong(&crc32))
+ {
+ error("bad crc32 found");
+ return false;
+ }
+ unsigned long compressedSize;
+ if (!getLong(&compressedSize))
+ {
+ error("bad compressedSize found");
+ return false;
+ }
+ unsigned long uncompressedSize;
+ if (!getLong(&uncompressedSize))
+ {
+ error("bad uncompressedSize found");
+ return false;
+ }
+ }//bit 3 was set
+ //break;
+
+ std::vector<unsigned char> uncompBuf;
+ switch (compressionMethod)
+ {
+ case 8: //deflate
+ {
+ Inflater inflater;
+ if (!inflater.inflate(uncompBuf, compBuf))
+ {
+ return false;
+ }
+ break;
+ }
+ default:
+ {
+ error("Unimplemented compression method %d", compressionMethod);
+ return false;
+ }
+ }
+
+ if (uncompressedSize != uncompBuf.size())
+ {
+ error("Size mismatch. Expected %ld, received %ld",
+ uncompressedSize, uncompBuf.size());
+ return false;
+ }
+
+ Crc32 crcEngine;
+ crcEngine.update(uncompBuf);
+ unsigned long crc = crcEngine.getValue();
+ if (crc != crc32)
+ {
+ error("Crc mismatch. Calculated %08ux, received %08ux", crc, crc32);
+ return false;
+ }
+
+ ZipEntry *ze = new ZipEntry(fileName, comment);
+ ze->setCompressionMethod(compressionMethod);
+ ze->setCompressedData(compBuf);
+ ze->setUncompressedData(uncompBuf);
+ ze->setCrc(crc);
+ entries.push_back(ze);
+
+
+ }
+ return true;
+}
+
+
+/**
+ *
+ */
+bool ZipFile::readCentralDirectory()
+{
+ //printf("#################################################\n");
+ //printf("###D I R E C T O R Y\n");
+ //printf("#################################################\n");
+ while (true)
+ {
+ //We start with a central directory cookie already
+ //Check at the bottom of the loop.
+ unsigned int version;
+ if (!getInt(&version))
+ {
+ error("bad version found");
+ return false;
+ }
+ unsigned int versionNeeded;
+ if (!getInt(&versionNeeded))
+ {
+ error("bad version found");
+ return false;
+ }
+ unsigned int gpBitFlag;
+ if (!getInt(&gpBitFlag))
+ {
+ error("bad bit flag found");
+ return false;
+ }
+ unsigned int compressionMethod;
+ if (!getInt(&compressionMethod))
+ {
+ error("bad compressionMethod found");
+ return false;
+ }
+ unsigned int modTime;
+ if (!getInt(&modTime))
+ {
+ error("bad modTime found");
+ return false;
+ }
+ unsigned int modDate;
+ if (!getInt(&modDate))
+ {
+ error("bad modDate found");
+ return false;
+ }
+ unsigned long crc32;
+ if (!getLong(&crc32))
+ {
+ error("bad crc32 found");
+ return false;
+ }
+ unsigned long compressedSize;
+ if (!getLong(&compressedSize))
+ {
+ error("bad compressedSize found");
+ return false;
+ }
+ unsigned long uncompressedSize;
+ if (!getLong(&uncompressedSize))
+ {
+ error("bad uncompressedSize found");
+ return false;
+ }
+ unsigned int fileNameLength;
+ if (!getInt(&fileNameLength))
+ {
+ error("bad fileNameLength found");
+ return false;
+ }
+ unsigned int extraFieldLength;
+ if (!getInt(&extraFieldLength))
+ {
+ error("bad extraFieldLength found");
+ return false;
+ }
+ unsigned int fileCommentLength;
+ if (!getInt(&fileCommentLength))
+ {
+ error("bad fileCommentLength found");
+ return false;
+ }
+ unsigned int diskNumberStart;
+ if (!getInt(&diskNumberStart))
+ {
+ error("bad diskNumberStart found");
+ return false;
+ }
+ unsigned int internalFileAttributes;
+ if (!getInt(&internalFileAttributes))
+ {
+ error("bad internalFileAttributes found");
+ return false;
+ }
+ unsigned long externalFileAttributes;
+ if (!getLong(&externalFileAttributes))
+ {
+ error("bad externalFileAttributes found");
+ return false;
+ }
+ unsigned long localHeaderOffset;
+ if (!getLong(&localHeaderOffset))
+ {
+ error("bad localHeaderOffset found");
+ return false;
+ }
+ std::string fileName;
+ for (unsigned int i=0 ; i<fileNameLength ; i++)
+ {
+ unsigned char ch;
+ if (!getByte(&ch))
+ break;
+ fileName.push_back(ch);
+ }
+ std::string extraField;
+ for (unsigned int i=0 ; i<extraFieldLength ; i++)
+ {
+ unsigned char ch;
+ if (!getByte(&ch))
+ break;
+ extraField.push_back(ch);
+ }
+ std::string fileComment;
+ for (unsigned int i=0 ; i<fileCommentLength ; i++)
+ {
+ unsigned char ch;
+ if (!getByte(&ch))
+ break;
+ fileComment.push_back(ch);
+ }
+ trace("######################### ENTRY");
+ trace("FileName :%s" , fileName.c_str());
+ trace("Extra field :%s" , extraField.c_str());
+ trace("File comment :%s" , fileComment.c_str());
+ trace("Version :%d" , version);
+ trace("Version needed :%d" , versionNeeded);
+ trace("Bitflag :%d" , gpBitFlag);
+ trace("Compression Method :%d" , compressionMethod);
+ trace("Mod time :%d" , modTime);
+ trace("Mod date :%d" , modDate);
+ trace("CRC :%lx", crc32);
+ trace("Compressed size :%ld", compressedSize);
+ trace("Uncompressed size :%ld", uncompressedSize);
+ trace("Disk nr start :%ld", diskNumberStart);
+ trace("Header offset :%ld", localHeaderOffset);
+
+
+ unsigned long magicCookie;
+ if (!getLong(&magicCookie))
+ {
+ error("magic cookie not found");
+ return false;
+ }
+ trace("###Cookie:%lx", magicCookie);
+ if (magicCookie == 0x06054b50L) //end of central directory
+ break;
+ else if (magicCookie == 0x05054b50L) //signature
+ {
+ //## Digital Signature
+ unsigned int signatureSize;
+ if (!getInt(&signatureSize))
+ {
+ error("bad signatureSize found");
+ return false;
+ }
+ std::string digitalSignature;
+ for (unsigned int i=0 ; i<signatureSize ; i++)
+ {
+ unsigned char ch;
+ if (!getByte(&ch))
+ break;
+ digitalSignature.push_back(ch);
+ }
+ trace("######## SIGNATURE :'%s'" , digitalSignature.c_str());
+ }
+ else if (magicCookie != 0x02014b50L) //central directory
+ {
+ error("directory file header not found");
+ return false;
+ }
+ }
+
+ unsigned int diskNr;
+ if (!getInt(&diskNr))
+ {
+ error("bad diskNr found");
+ return false;
+ }
+ unsigned int diskWithCd;
+ if (!getInt(&diskWithCd))
+ {
+ error("bad diskWithCd found");
+ return false;
+ }
+ unsigned int nrEntriesDisk;
+ if (!getInt(&nrEntriesDisk))
+ {
+ error("bad nrEntriesDisk found");
+ return false;
+ }
+ unsigned int nrEntriesTotal;
+ if (!getInt(&nrEntriesTotal))
+ {
+ error("bad nrEntriesTotal found");
+ return false;
+ }
+ unsigned long cdSize;
+ if (!getLong(&cdSize))
+ {
+ error("bad cdSize found");
+ return false;
+ }
+ unsigned long cdPos;
+ if (!getLong(&cdPos))
+ {
+ error("bad cdPos found");
+ return false;
+ }
+ unsigned int commentSize;
+ if (!getInt(&commentSize))
+ {
+ error("bad commentSize found");
+ return false;
+ }
+ comment = "";
+ for (unsigned int i=0 ; i<commentSize ; i++)
+ {
+ unsigned char ch;
+ if (!getByte(&ch))
+ break;
+ comment.push_back(ch);
+ }
+ trace("######## Zip Comment :'%s'" , comment.c_str());
+
+ return true;
+}
+
+
+/**
+ *
+ */
+bool ZipFile::read()
+{
+ fileBufPos = 0;
+ if (!readFileData())
+ {
+ return false;
+ }
+ if (!readCentralDirectory())
+ {
+ return false;
+ }
+ return true;
+}
+
+/**
+ *
+ */
+bool ZipFile::readBuffer(const std::vector<unsigned char> &inbuf)
+{
+ fileBuf = inbuf;
+ if (!read())
+ return false;
+ return true;
+}
+
+
+/**
+ *
+ */
+bool ZipFile::readFile(const std::string &fileName)
+{
+ fileBuf.clear();
+ FILE *f = fopen(fileName.c_str(), "rb");
+ if (!f)
+ return false;
+ while (true)
+ {
+ int ch = fgetc(f);
+ if (ch < 0)
+ break;
+ fileBuf.push_back(ch);
+ }
+ fclose(f);
+ if (!read())
+ return false;
+ return true;
+}
+
+
+
+
+
+
+
+
+
+//########################################################################
+//# E N D O F F I L E
+//########################################################################
+
+
diff --git a/src/dom/util/ziptool.h b/src/dom/util/ziptool.h
index 71f982e1b..895f0ccb2 100644
--- a/src/dom/util/ziptool.h
+++ b/src/dom/util/ziptool.h
@@ -1,551 +1,551 @@
-#ifndef __ZIPTOOL_H__
-#define __ZIPTOOL_H__
-/**
- * This is intended to be a standalone, reduced capability
- * implementation of Gzip and Zip functionality. Its
- * targeted use case is for archiving and retrieving single files
- * which use these encoding types. Being memory based and
- * non-optimized, it is not useful in cases where very large
- * archives are needed or where high performance is desired.
- * However, it should hopefully work well for smaller,
- * one-at-a-time tasks. What you get in return is the ability
- * to drop these files into your project and remove the dependencies
- * on ZLib and Info-Zip. Enjoy.
- *
- * Authors:
- * Bob Jamison
- *
- * Copyright (C) 2006 Bob Jamison
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-#include <vector>
-#include <string>
-
-
-//########################################################################
-//# A D L E R 3 2
-//########################################################################
-
-class Adler32
-{
-public:
-
- Adler32();
-
- virtual ~Adler32();
-
- void reset();
-
- void update(unsigned char b);
-
- void update(char *str);
-
- unsigned long getValue();
-
-private:
-
- unsigned long value;
-
-};
-
-
-//########################################################################
-//# C R C 3 2
-//########################################################################
-
-class Crc32
-{
-public:
-
- Crc32();
-
- virtual ~Crc32();
-
- void reset();
-
- void update(unsigned char b);
-
- void update(char *str);
-
- void update(const std::vector<unsigned char> &buf);
-
- unsigned long getValue();
-
-private:
-
- unsigned long value;
-
-};
-
-
-
-
-
-
-//########################################################################
-//# G Z I P S T R E A M S
-//########################################################################
-
-class GzipFile
-{
-public:
-
- /**
- *
- */
- GzipFile();
-
- /**
- *
- */
- virtual ~GzipFile();
-
- /**
- *
- */
- virtual void put(unsigned char ch);
-
- /**
- *
- */
- virtual void setData(const std::vector<unsigned char> &str);
-
- /**
- *
- */
- virtual void clearData();
-
- /**
- *
- */
- virtual std::vector<unsigned char> &getData();
-
- /**
- *
- */
- virtual std::string &getFileName();
-
- /**
- *
- */
- virtual void setFileName(const std::string &val);
-
-
- //######################
- //# U T I L I T Y
- //######################
-
- /**
- *
- */
- virtual bool readFile(const std::string &fName);
-
- //######################
- //# W R I T E
- //######################
-
- /**
- *
- */
- virtual bool write();
-
- /**
- *
- */
- virtual bool writeBuffer(std::vector<unsigned char> &outbuf);
-
- /**
- *
- */
- virtual bool writeFile(const std::string &fileName);
-
-
- //######################
- //# R E A D
- //######################
-
-
- /**
- *
- */
- virtual bool read();
-
- /**
- *
- */
- virtual bool readBuffer(const std::vector<unsigned char> &inbuf);
-
- /**
- *
- */
- virtual bool loadFile(const std::string &fileName);
-
-
-
-private:
-
- std::vector<unsigned char> data;
- std::string fileName;
-
- //debug messages
- void error(char *fmt, ...);
- void trace(char *fmt, ...);
-
- unsigned long crc;
-
- std::vector<unsigned char> fileBuf;
- unsigned long fileBufPos;
-
- bool getByte(unsigned char *ch);
- bool getLong(unsigned long *val);
-
- bool putByte(unsigned char ch);
- bool putLong(unsigned long val);
-
- int compressionMethod;
-};
-
-
-
-
-//########################################################################
-//# Z I P F I L E
-//########################################################################
-
-
-/**
- *
- */
-class ZipEntry
-{
-public:
-
- /**
- *
- */
- ZipEntry();
-
- /**
- *
- */
- ZipEntry(const std::string &fileName,
- const std::string &comment);
-
- /**
- *
- */
- virtual ~ZipEntry();
-
- /**
- *
- */
- virtual std::string getFileName();
-
- /**
- *
- */
- virtual void setFileName(const std::string &val);
-
- /**
- *
- */
- virtual std::string getComment();
-
- /**
- *
- */
- virtual void setComment(const std::string &val);
-
- /**
- *
- */
- virtual unsigned long getCompressedSize();
-
- /**
- *
- */
- virtual int getCompressionMethod();
-
- /**
- *
- */
- virtual void setCompressionMethod(int val);
-
- /**
- *
- */
- virtual std::vector<unsigned char> &getCompressedData();
-
- /**
- *
- */
- virtual void setCompressedData(const std::vector<unsigned char> &val);
-
- /**
- *
- */
- virtual unsigned long getUncompressedSize();
-
- /**
- *
- */
- virtual std::vector<unsigned char> &getUncompressedData();
-
- /**
- *
- */
- virtual void setUncompressedData(const std::vector<unsigned char> &val);
-
- /**
- *
- */
- virtual void write(unsigned char ch);
-
- /**
- *
- */
- virtual void finish();
-
- /**
- *
- */
- virtual unsigned long getCrc();
-
- /**
- *
- */
- virtual void setCrc(unsigned long crc);
-
- /**
- *
- */
- virtual bool readFile(const std::string &fileNameArg,
- const std::string &commentArg);
-
- /**
- *
- */
- virtual void setPosition(unsigned long val);
-
- /**
- *
- */
- virtual unsigned long getPosition();
-
-private:
-
- unsigned long crc;
-
- std::string fileName;
- std::string comment;
-
- int compressionMethod;
-
- std::vector<unsigned char> compressedData;
- std::vector<unsigned char> uncompressedData;
-
- unsigned long position;
-};
-
-
-
-
-
-
-
-
-
-/**
- * This class sits over the zlib and gzip code to
- * implement a PKWare or Info-Zip .zip file reader and
- * writer
- */
-class ZipFile
-{
-public:
-
- /**
- *
- */
- ZipFile();
-
- /**
- *
- */
- virtual ~ZipFile();
-
- //######################
- //# V A R I A B L E S
- //######################
-
- /**
- *
- */
- virtual void setComment(const std::string &val);
-
- /**
- *
- */
- virtual std::string getComment();
-
- /**
- * Return the list of entries currently in this file
- */
- std::vector<ZipEntry *> &getEntries();
-
-
- //######################
- //# U T I L I T Y
- //######################
-
- /**
- *
- */
- virtual ZipEntry *addFile(const std::string &fileNameArg,
- const std::string &commentArg);
-
- /**
- *
- */
- virtual ZipEntry *newEntry(const std::string &fileNameArg,
- const std::string &commentArg);
-
- //######################
- //# W R I T E
- //######################
-
- /**
- *
- */
- virtual bool write();
-
- /**
- *
- */
- virtual bool writeBuffer(std::vector<unsigned char> &outbuf);
-
- /**
- *
- */
- virtual bool writeFile(const std::string &fileName);
-
-
- //######################
- //# R E A D
- //######################
-
-
- /**
- *
- */
- virtual bool read();
-
- /**
- *
- */
- virtual bool readBuffer(const std::vector<unsigned char> &inbuf);
-
- /**
- *
- */
- virtual bool readFile(const std::string &fileName);
-
-
-private:
-
- //debug messages
- void error(char *fmt, ...);
- void trace(char *fmt, ...);
-
- //# Private writing methods
-
- /**
- *
- */
- bool putLong(unsigned long val);
-
- /**
- *
- */
- bool putInt(unsigned int val);
-
-
- /**
- *
- */
- bool putByte(unsigned char val);
-
- /**
- *
- */
- bool writeFileData();
-
- /**
- *
- */
- bool writeCentralDirectory();
-
-
- //# Private reading methods
-
- /**
- *
- */
- bool getLong(unsigned long *val);
-
- /**
- *
- */
- bool getInt(unsigned int *val);
-
- /**
- *
- */
- bool getByte(unsigned char *val);
-
- /**
- *
- */
- bool readFileData();
-
- /**
- *
- */
- bool readCentralDirectory();
-
-
- std::vector<ZipEntry *> entries;
-
- std::vector<unsigned char> fileBuf;
- unsigned long fileBufPos;
-
- std::string comment;
-};
-
-
-
-
-
-
-#endif /* __ZIPTOOL_H__ */
-
-
-//########################################################################
-//# E N D O F F I L E
-//########################################################################
-
+#ifndef __ZIPTOOL_H__
+#define __ZIPTOOL_H__
+/**
+ * This is intended to be a standalone, reduced capability
+ * implementation of Gzip and Zip functionality. Its
+ * targeted use case is for archiving and retrieving single files
+ * which use these encoding types. Being memory based and
+ * non-optimized, it is not useful in cases where very large
+ * archives are needed or where high performance is desired.
+ * However, it should hopefully work well for smaller,
+ * one-at-a-time tasks. What you get in return is the ability
+ * to drop these files into your project and remove the dependencies
+ * on ZLib and Info-Zip. Enjoy.
+ *
+ * Authors:
+ * Bob Jamison
+ *
+ * Copyright (C) 2006 Bob Jamison
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+#include <vector>
+#include <string>
+
+
+//########################################################################
+//# A D L E R 3 2
+//########################################################################
+
+class Adler32
+{
+public:
+
+ Adler32();
+
+ virtual ~Adler32();
+
+ void reset();
+
+ void update(unsigned char b);
+
+ void update(char *str);
+
+ unsigned long getValue();
+
+private:
+
+ unsigned long value;
+
+};
+
+
+//########################################################################
+//# C R C 3 2
+//########################################################################
+
+class Crc32
+{
+public:
+
+ Crc32();
+
+ virtual ~Crc32();
+
+ void reset();
+
+ void update(unsigned char b);
+
+ void update(char *str);
+
+ void update(const std::vector<unsigned char> &buf);
+
+ unsigned long getValue();
+
+private:
+
+ unsigned long value;
+
+};
+
+
+
+
+
+
+//########################################################################
+//# G Z I P S T R E A M S
+//########################################################################
+
+class GzipFile
+{
+public:
+
+ /**
+ *
+ */
+ GzipFile();
+
+ /**
+ *
+ */
+ virtual ~GzipFile();
+
+ /**
+ *
+ */
+ virtual void put(unsigned char ch);
+
+ /**
+ *
+ */
+ virtual void setData(const std::vector<unsigned char> &str);
+
+ /**
+ *
+ */
+ virtual void clearData();
+
+ /**
+ *
+ */
+ virtual std::vector<unsigned char> &getData();
+
+ /**
+ *
+ */
+ virtual std::string &getFileName();
+
+ /**
+ *
+ */
+ virtual void setFileName(const std::string &val);
+
+
+ //######################
+ //# U T I L I T Y
+ //######################
+
+ /**
+ *
+ */
+ virtual bool readFile(const std::string &fName);
+
+ //######################
+ //# W R I T E
+ //######################
+
+ /**
+ *
+ */
+ virtual bool write();
+
+ /**
+ *
+ */
+ virtual bool writeBuffer(std::vector<unsigned char> &outbuf);
+
+ /**
+ *
+ */
+ virtual bool writeFile(const std::string &fileName);
+
+
+ //######################
+ //# R E A D
+ //######################
+
+
+ /**
+ *
+ */
+ virtual bool read();
+
+ /**
+ *
+ */
+ virtual bool readBuffer(const std::vector<unsigned char> &inbuf);
+
+ /**
+ *
+ */
+ virtual bool loadFile(const std::string &fileName);
+
+
+
+private:
+
+ std::vector<unsigned char> data;
+ std::string fileName;
+
+ //debug messages
+ void error(char *fmt, ...);
+ void trace(char *fmt, ...);
+
+ unsigned long crc;
+
+ std::vector<unsigned char> fileBuf;
+ unsigned long fileBufPos;
+
+ bool getByte(unsigned char *ch);
+ bool getLong(unsigned long *val);
+
+ bool putByte(unsigned char ch);
+ bool putLong(unsigned long val);
+
+ int compressionMethod;
+};
+
+
+
+
+//########################################################################
+//# Z I P F I L E
+//########################################################################
+
+
+/**
+ *
+ */
+class ZipEntry
+{
+public:
+
+ /**
+ *
+ */
+ ZipEntry();
+
+ /**
+ *
+ */
+ ZipEntry(const std::string &fileName,
+ const std::string &comment);
+
+ /**
+ *
+ */
+ virtual ~ZipEntry();
+
+ /**
+ *
+ */
+ virtual std::string getFileName();
+
+ /**
+ *
+ */
+ virtual void setFileName(const std::string &val);
+
+ /**
+ *
+ */
+ virtual std::string getComment();
+
+ /**
+ *
+ */
+ virtual void setComment(const std::string &val);
+
+ /**
+ *
+ */
+ virtual unsigned long getCompressedSize();
+
+ /**
+ *
+ */
+ virtual int getCompressionMethod();
+
+ /**
+ *
+ */
+ virtual void setCompressionMethod(int val);
+
+ /**
+ *
+ */
+ virtual std::vector<unsigned char> &getCompressedData();
+
+ /**
+ *
+ */
+ virtual void setCompressedData(const std::vector<unsigned char> &val);
+
+ /**
+ *
+ */
+ virtual unsigned long getUncompressedSize();
+
+ /**
+ *
+ */
+ virtual std::vector<unsigned char> &getUncompressedData();
+
+ /**
+ *
+ */
+ virtual void setUncompressedData(const std::vector<unsigned char> &val);
+
+ /**
+ *
+ */
+ virtual void write(unsigned char ch);
+
+ /**
+ *
+ */
+ virtual void finish();
+
+ /**
+ *
+ */
+ virtual unsigned long getCrc();
+
+ /**
+ *
+ */
+ virtual void setCrc(unsigned long crc);
+
+ /**
+ *
+ */
+ virtual bool readFile(const std::string &fileNameArg,
+ const std::string &commentArg);
+
+ /**
+ *
+ */
+ virtual void setPosition(unsigned long val);
+
+ /**
+ *
+ */
+ virtual unsigned long getPosition();
+
+private:
+
+ unsigned long crc;
+
+ std::string fileName;
+ std::string comment;
+
+ int compressionMethod;
+
+ std::vector<unsigned char> compressedData;
+ std::vector<unsigned char> uncompressedData;
+
+ unsigned long position;
+};
+
+
+
+
+
+
+
+
+
+/**
+ * This class sits over the zlib and gzip code to
+ * implement a PKWare or Info-Zip .zip file reader and
+ * writer
+ */
+class ZipFile
+{
+public:
+
+ /**
+ *
+ */
+ ZipFile();
+
+ /**
+ *
+ */
+ virtual ~ZipFile();
+
+ //######################
+ //# V A R I A B L E S
+ //######################
+
+ /**
+ *
+ */
+ virtual void setComment(const std::string &val);
+
+ /**
+ *
+ */
+ virtual std::string getComment();
+
+ /**
+ * Return the list of entries currently in this file
+ */
+ std::vector<ZipEntry *> &getEntries();
+
+
+ //######################
+ //# U T I L I T Y
+ //######################
+
+ /**
+ *
+ */
+ virtual ZipEntry *addFile(const std::string &fileNameArg,
+ const std::string &commentArg);
+
+ /**
+ *
+ */
+ virtual ZipEntry *newEntry(const std::string &fileNameArg,
+ const std::string &commentArg);
+
+ //######################
+ //# W R I T E
+ //######################
+
+ /**
+ *
+ */
+ virtual bool write();
+
+ /**
+ *
+ */
+ virtual bool writeBuffer(std::vector<unsigned char> &outbuf);
+
+ /**
+ *
+ */
+ virtual bool writeFile(const std::string &fileName);
+
+
+ //######################
+ //# R E A D
+ //######################
+
+
+ /**
+ *
+ */
+ virtual bool read();
+
+ /**
+ *
+ */
+ virtual bool readBuffer(const std::vector<unsigned char> &inbuf);
+
+ /**
+ *
+ */
+ virtual bool readFile(const std::string &fileName);
+
+
+private:
+
+ //debug messages
+ void error(char *fmt, ...);
+ void trace(char *fmt, ...);
+
+ //# Private writing methods
+
+ /**
+ *
+ */
+ bool putLong(unsigned long val);
+
+ /**
+ *
+ */
+ bool putInt(unsigned int val);
+
+
+ /**
+ *
+ */
+ bool putByte(unsigned char val);
+
+ /**
+ *
+ */
+ bool writeFileData();
+
+ /**
+ *
+ */
+ bool writeCentralDirectory();
+
+
+ //# Private reading methods
+
+ /**
+ *
+ */
+ bool getLong(unsigned long *val);
+
+ /**
+ *
+ */
+ bool getInt(unsigned int *val);
+
+ /**
+ *
+ */
+ bool getByte(unsigned char *val);
+
+ /**
+ *
+ */
+ bool readFileData();
+
+ /**
+ *
+ */
+ bool readCentralDirectory();
+
+
+ std::vector<ZipEntry *> entries;
+
+ std::vector<unsigned char> fileBuf;
+ unsigned long fileBufPos;
+
+ std::string comment;
+};
+
+
+
+
+
+
+#endif /* __ZIPTOOL_H__ */
+
+
+//########################################################################
+//# E N D O F F I L E
+//########################################################################
+
diff --git a/src/dom/work/testxpath.cpp b/src/dom/work/testxpath.cpp
index d724600a7..b8551f2de 100644
--- a/src/dom/work/testxpath.cpp
+++ b/src/dom/work/testxpath.cpp
@@ -1,1416 +1,1416 @@
-/**
- * Phoebe DOM Implementation.
- *
- * This is a C++ approximation of the W3C DOM model, which follows
- * fairly closely the specifications in the various .idl files, copies of
- * which are provided for reference. Most important is this one:
- *
- * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
- *
- * Authors:
- * Bob Jamison
- *
- * Copyright (C) 2005 Bob Jamison
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-
-#include "dom.h"
-#include "lsimpl.h"
-#include "xpathparser.h"
-
-#include <stdio.h>
-
-using namespace org::w3c::dom;
-using namespace org::w3c::dom::xpath;
-
-
-typedef struct
-{
- char *xpathStr;
- char *desc;
- char *xml;
-} XpathTest;
-
-XpathTest xpathTests[] =
-{
-
-{
-"/AAA",
-"Select the root element AAA",
-" <AAA>\n"
-" <BBB/>\n"
-" <CCC/>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <DDD>\n"
-" <BBB/>\n"
-" </DDD>\n"
-" <CCC/>\n"
-" </AAA>\n"
-},
-
-{
-"/AAA/CCC",
-"Select all elements CCC which are children of the root element AAA",
-" <AAA>\n"
-" <BBB/>\n"
-" <CCC/>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <DDD>\n"
-" <BBB/>\n"
-" </DDD>\n"
-" <CCC/>\n"
-" </AAA>\n"
-},
-
-{
-"/AAA/DDD/BBB",
-"Select all elements BBB which are children of DDD which are children of the root element AAA",
-" <AAA>\n"
-" <BBB/>\n"
-" <CCC/>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <DDD>\n"
-" <BBB/>\n"
-" </DDD>\n"
-" <CCC/>\n"
-" </AAA>\n"
-},
-
-{
-"//BBB",
-"Select all elements BBB",
-" <AAA>\n"
-" <BBB/>\n"
-" <CCC/>\n"
-" <BBB/>\n"
-" <DDD>\n"
-" <BBB/>\n"
-" </DDD>\n"
-" <CCC>\n"
-" <DDD>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" </DDD>\n"
-" </CCC>\n"
-" </AAA>\n"
-},
-
-{
-"//DDD/BBB",
-"Select all elements BBB which are children of DDD",
-" <AAA>\n"
-" <BBB/>\n"
-" <CCC/>\n"
-" <BBB/>\n"
-" <DDD>\n"
-" <BBB/>\n"
-" </DDD>\n"
-" <CCC>\n"
-" <DDD>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" </DDD>\n"
-" </CCC>\n"
-" </AAA>\n"
-},
-
-{
-"/AAA/CCC/DDD/*",
-"Select all elements enclosed by elements /AAA/CCC/DDD",
-" <AAA>\n"
-" <XXX>\n"
-" <DDD>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <EEE/>\n"
-" <FFF/>\n"
-" </DDD>\n"
-" </XXX>\n"
-" <CCC>\n"
-" <DDD>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <EEE/>\n"
-" <FFF/>\n"
-" </DDD>\n"
-" </CCC>\n"
-" <CCC>\n"
-" <BBB>\n"
-" <BBB>\n"
-" <BBB/>\n"
-" </BBB>\n"
-" </BBB>\n"
-" </CCC>\n"
-" </AAA>\n"
-},
-
-{
-"/*/*/*/BBB",
-"Select all elements BBB which have 3 ancestors",
-" <AAA>\n"
-" <XXX>\n"
-" <DDD>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <EEE/>\n"
-" <FFF/>\n"
-" </DDD>\n"
-" </XXX>\n"
-" <CCC>\n"
-" <DDD>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <EEE/>\n"
-" <FFF/>\n"
-" </DDD>\n"
-" </CCC>\n"
-" <CCC>\n"
-" <BBB>\n"
-" <BBB>\n"
-" <BBB/>\n"
-" </BBB>\n"
-" </BBB>\n"
-" </CCC>\n"
-" </AAA>\n"
-},
-
-{
-"//*",
-"Select all elements",
-" <AAA>\n"
-" <XXX>\n"
-" <DDD>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <EEE/>\n"
-" <FFF/>\n"
-" </DDD>\n"
-" </XXX>\n"
-" <CCC>\n"
-" <DDD>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <EEE/>\n"
-" <FFF/>\n"
-" </DDD>\n"
-" </CCC>\n"
-" <CCC>\n"
-" <BBB>\n"
-" <BBB>\n"
-" <BBB/>\n"
-" </BBB>\n"
-" </BBB>\n"
-" </CCC>\n"
-" </AAA>\n"
-},
-
-{
-"/AAA/BBB[1]",
-"Select the first BBB child of element AAA",
-" <AAA>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" </AAA>\n"
-},
-
-{
-"/AAA/BBB[last()]",
-"Select the last BBB child of element AAA",
-" <AAA>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" </AAA>\n"
-},
-
-{
-"//@id",
-"Select all attributes @id",
-" <AAA>\n"
-" <BBB id = 'b1'/>\n"
-" <BBB id = 'b2'/>\n"
-" <BBB name = 'bbb'/>\n"
-" <BBB/>\n"
-" </AAA>\n"
-},
-
-{
-"//BBB[@id]",
-"Select BBB elements which have attribute id",
-" <AAA>\n"
-" <BBB id = 'b1'/>\n"
-" <BBB id = 'b2'/>\n"
-" <BBB name = 'bbb'/>\n"
-" <BBB/>\n"
-" </AAA>\n"
-},
-
-{
-"//BBB[@name]",
-"Select BBB elements which have attribute name",
-" <AAA>\n"
-" <BBB id = 'b1'/>\n"
-" <BBB id = 'b2'/>\n"
-" <BBB name = 'bbb'/>\n"
-" <BBB/>\n"
-" </AAA>\n"
-},
-
-{
-"//BBB[@*]",
-"Select BBB elements which have any attribute",
-" <AAA>\n"
-" <BBB id = 'b1'/>\n"
-" <BBB id = 'b2'/>\n"
-" <BBB name = 'bbb'/>\n"
-" <BBB/>\n"
-" </AAA>\n"
-},
-
-{
-"//BBB[not(@*)]",
-"Select BBB elements without an attribute",
-" <AAA>\n"
-" <BBB id = 'b1'/>\n"
-" <BBB id = 'b2'/>\n"
-" <BBB name = 'bbb'/>\n"
-" <BBB/>\n"
-" </AAA>\n"
-},
-
-{
-"//BBB[@id='b1']",
-"Select BBB elements which have attribute id with value b1",
-" <AAA>\n"
-" <BBB id = 'b1'/>\n"
-" <BBB name = ' bbb '/>\n"
-" <BBB name = 'bbb'/>\n"
-" </AAA>\n"
-},
-
-{
-"//BBB[@name='bbb']",
-"Select BBB elements which have attribute name with value 'bbb'",
-" <AAA>\n"
-" <BBB id = 'b1'/>\n"
-" <BBB name = ' bbb '/>\n"
-" <BBB name = 'bbb'/>\n"
-" </AAA>\n"
-},
-
-{
-"//BBB[normalize-space(@name)='bbb']",
-"Select BBB elements which have attribute name with value bbb, leading and trailing spaces are removed before comparison",
-" <AAA>\n"
-" <BBB id = 'b1'/>\n"
-" <BBB name = ' bbb '/>\n"
-" <BBB name = 'bbb'/>\n"
-" </AAA>\n"
-},
-
-{
-"//*[count(BBB)=2]",
-"Select elements which have two children BBB",
-" <AAA>\n"
-" <CCC>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" </CCC>\n"
-" <DDD>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" </DDD>\n"
-" <EEE>\n"
-" <CCC/>\n"
-" <DDD/>\n"
-" </EEE>\n"
-" </AAA>\n"
-},
-
-{
-"//*[count(*)=2]",
-"Select elements which have 2 children",
-" <AAA>\n"
-" <CCC>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" </CCC>\n"
-" <DDD>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" </DDD>\n"
-" <EEE>\n"
-" <CCC/>\n"
-" <DDD/>\n"
-" </EEE>\n"
-" </AAA>\n"
-},
-
-{
-"//*[count(*)=3]",
-"Select elements which have 3 children",
-" <AAA>\n"
-" <CCC>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" </CCC>\n"
-" <DDD>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" </DDD>\n"
-" <EEE>\n"
-" <CCC/>\n"
-" <DDD/>\n"
-" </EEE>\n"
-" </AAA>\n"
-},
-
-{
-"//*[name()='BBB']",
-"Select all elements with name BBB, equivalent with //BBB",
-" <AAA>\n"
-" <BCC>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" </BCC>\n"
-" <DDB>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" </DDB>\n"
-" <BEC>\n"
-" <CCC/>\n"
-" <DBD/>\n"
-" </BEC>\n"
-" </AAA>\n"
-},
-
-{
-"//*[starts-with(name(),'B')]",
-"Select all elements name of which starts with letter B",
-" <AAA>\n"
-" <BCC>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" </BCC>\n"
-" <DDB>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" </DDB>\n"
-" <BEC>\n"
-" <CCC/>\n"
-" <DBD/>\n"
-" </BEC>\n"
-" </AAA>\n"
-},
-
-{
-"//*[contains(name(),'C')]",
-"Select all elements name of which contain letter C",
-" <AAA>\n"
-" <BCC>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" </BCC>\n"
-" <DDB>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" </DDB>\n"
-" <BEC>\n"
-" <CCC/>\n"
-" <DBD/>\n"
-" </BEC>\n"
-" </AAA>\n"
-},
-
-{
-"//*[string-length(name()) = 3]",
-"Select elements with three-letter name",
-" <AAA>\n"
-" <Q/>\n"
-" <SSSS/>\n"
-" <BB/>\n"
-" <CCC/>\n"
-" <DDDDDDDD/>\n"
-" <EEEE/>\n"
-" </AAA>\n"
-},
-
-{
-"//*[string-length(name()) < 3]",
-"Select elements name of which has one or two characters",
-" <AAA>\n"
-" <Q/>\n"
-" <SSSS/>\n"
-" <BB/>\n"
-" <CCC/>\n"
-" <DDDDDDDD/>\n"
-" <EEEE/>\n"
-" </AAA>\n"
-},
-
-{
-"//*[string-length(name()) > 3]",
-"Select elements with name longer than three characters",
-" <AAA>\n"
-" <Q/>\n"
-" <SSSS/>\n"
-" <BB/>\n"
-" <CCC/>\n"
-" <DDDDDDDD/>\n"
-" <EEEE/>\n"
-" </AAA>\n"
-},
-
-{
-"//CCC | //BBB",
-"Select all elements CCC and BBB",
-" <AAA>\n"
-" <BBB/>\n"
-" <CCC/>\n"
-" <DDD>\n"
-" <CCC/>\n"
-" </DDD>\n"
-" <EEE/>\n"
-" </AAA>\n"
-},
-
-{
-"/AAA/EEE | //BBB",
-"Select all elements BBB and elements EEE which are children of root element AAA",
-" <AAA>\n"
-" <BBB/>\n"
-" <CCC/>\n"
-" <DDD>\n"
-" <CCC/>\n"
-" </DDD>\n"
-" <EEE/>\n"
-" </AAA>\n"
-},
-
-{
-"/AAA/EEE | //DDD/CCC | /AAA | //BBB",
-"Number of combinations is not restricted",
-" <AAA>\n"
-" <BBB/>\n"
-" <CCC/>\n"
-" <DDD>\n"
-" <CCC/>\n"
-" </DDD>\n"
-" <EEE/>\n"
-" </AAA>\n"
-},
-
-{
-"/AAA",
-"Equivalent of /child::AAA",
-" <AAA>\n"
-" <BBB/>\n"
-" <CCC/>\n"
-" </AAA>\n"
-},
-
-{
-"/child::AAA",
-"Equivalent of /AAA",
-" <AAA>\n"
-" <BBB/>\n"
-" <CCC/>\n"
-" </AAA>\n"
-},
-
-{
-"/AAA/BBB",
-"Equivalent of /child::AAA/child::BBB",
-" <AAA>\n"
-" <BBB/>\n"
-" <CCC/>\n"
-" </AAA>\n"
-},
-
-{
-"/child::AAA/child::BBB",
-"Equivalent of /AAA/BBB",
-" <AAA>\n"
-" <BBB/>\n"
-" <CCC/>\n"
-" </AAA>\n"
-},
-
-{
-"/child::AAA/BBB",
-"Both possibilities can be combined",
-" <AAA>\n"
-" <BBB/>\n"
-" <CCC/>\n"
-" </AAA>\n"
-},
-
-{
-"/descendant::*",
-"Select all descendants of document root and therefore all elements",
-" <AAA>\n"
-" <BBB>\n"
-" <DDD>\n"
-" <CCC>\n"
-" <DDD/>\n"
-" <EEE/>\n"
-" </CCC>\n"
-" </DDD>\n"
-" </BBB>\n"
-" <CCC>\n"
-" <DDD>\n"
-" <EEE>\n"
-" <DDD>\n"
-" <FFF/>\n"
-" </DDD>\n"
-" </EEE>\n"
-" </DDD>\n"
-" </CCC>\n"
-" </AAA>\n"
-},
-
-{
-"/AAA/BBB/descendant::*",
-"Select all descendants of /AAA/BBB",
-" <AAA>\n"
-" <BBB>\n"
-" <DDD>\n"
-" <CCC>\n"
-" <DDD/>\n"
-" <EEE/>\n"
-" </CCC>\n"
-" </DDD>\n"
-" </BBB>\n"
-" <CCC>\n"
-" <DDD>\n"
-" <EEE>\n"
-" <DDD>\n"
-" <FFF/>\n"
-" </DDD>\n"
-" </EEE>\n"
-" </DDD>\n"
-" </CCC>\n"
-" </AAA>\n"
-},
-
-{
-"//CCC/descendant::*",
-"Select all elements which have CCC among its ancestors",
-" <AAA>\n"
-" <BBB>\n"
-" <DDD>\n"
-" <CCC>\n"
-" <DDD/>\n"
-" <EEE/>\n"
-" </CCC>\n"
-" </DDD>\n"
-" </BBB>\n"
-" <CCC>\n"
-" <DDD>\n"
-" <EEE>\n"
-" <DDD>\n"
-" <FFF/>\n"
-" </DDD>\n"
-" </EEE>\n"
-" </DDD>\n"
-" </CCC>\n"
-" </AAA>\n"
-},
-
-{
-"//CCC/descendant::DDD",
-"Select elements DDD which have CCC among its ancestors",
-" <AAA>\n"
-" <BBB>\n"
-" <DDD>\n"
-" <CCC>\n"
-" <DDD/>\n"
-" <EEE/>\n"
-" </CCC>\n"
-" </DDD>\n"
-" </BBB>\n"
-" <CCC>\n"
-" <DDD>\n"
-" <EEE>\n"
-" <DDD>\n"
-" <FFF/>\n"
-" </DDD>\n"
-" </EEE>\n"
-" </DDD>\n"
-" </CCC>\n"
-" </AAA>\n"
-},
-
-{
-"//DDD/parent::*",
-"Select all parents of DDD element",
-" <AAA>\n"
-" <BBB>\n"
-" <DDD>\n"
-" <CCC>\n"
-" <DDD/>\n"
-" <EEE/>\n"
-" </CCC>\n"
-" </DDD>\n"
-" </BBB>\n"
-" <CCC>\n"
-" <DDD>\n"
-" <EEE>\n"
-" <DDD>\n"
-" <FFF/>\n"
-" </DDD>\n"
-" </EEE>\n"
-" </DDD>\n"
-" </CCC>\n"
-" </AAA>\n"
-},
-
-{
-"/AAA/BBB/DDD/CCC/EEE/ancestor::*",
-"Select all elements given in this absolute path",
-" <AAA>\n"
-" <BBB>\n"
-" <DDD>\n"
-" <CCC>\n"
-" <DDD/>\n"
-" <EEE/>\n"
-" </CCC>\n"
-" </DDD>\n"
-" </BBB>\n"
-" <CCC>\n"
-" <DDD>\n"
-" <EEE>\n"
-" <DDD>\n"
-" <FFF/>\n"
-" </DDD>\n"
-" </EEE>\n"
-" </DDD>\n"
-" </CCC>\n"
-" </AAA>\n"
-},
-
-{
-"//FFF/ancestor::*",
-"Select ancestors of FFF element",
-" <AAA>\n"
-" <BBB>\n"
-" <DDD>\n"
-" <CCC>\n"
-" <DDD/>\n"
-" <EEE/>\n"
-" </CCC>\n"
-" </DDD>\n"
-" </BBB>\n"
-" <CCC>\n"
-" <DDD>\n"
-" <EEE>\n"
-" <DDD>\n"
-" <FFF/>\n"
-" </DDD>\n"
-" </EEE>\n"
-" </DDD>\n"
-" </CCC>\n"
-" </AAA>\n"
-},
-
-{
-"/AAA/BBB/following-sibling::*",
-"The following-sibling axis contains all the following siblings of the context node.",
-" <AAA>\n"
-" <BBB>\n"
-" <CCC/>\n"
-" <DDD/>\n"
-" </BBB>\n"
-" <XXX>\n"
-" <DDD>\n"
-" <EEE/>\n"
-" <DDD/>\n"
-" <CCC/>\n"
-" <FFF/>\n"
-" <FFF>\n"
-" <GGG/>\n"
-" </FFF>\n"
-" </DDD>\n"
-" </XXX>\n"
-" <CCC>\n"
-" <DDD/>\n"
-" </CCC>\n"
-" </AAA>\n"
-},
-
-{
-"//CCC/following-sibling::*",
-"The following-sibling axis contains all the following siblings of the context node.",
-" <AAA>\n"
-" <BBB>\n"
-" <CCC/>\n"
-" <DDD/>\n"
-" </BBB>\n"
-" <XXX>\n"
-" <DDD>\n"
-" <EEE/>\n"
-" <DDD/>\n"
-" <CCC/>\n"
-" <FFF/>\n"
-" <FFF>\n"
-" <GGG/>\n"
-" </FFF>\n"
-" </DDD>\n"
-" </XXX>\n"
-" <CCC>\n"
-" <DDD/>\n"
-" </CCC>\n"
-" </AAA>\n"
-},
-
-{
-"/AAA/XXX/preceding-sibling::*",
-"The preceding-sibling axis contains all the preceding siblings of the context node.",
-" <AAA>\n"
-" <BBB>\n"
-" <CCC/>\n"
-" <DDD/>\n"
-" </BBB>\n"
-" <XXX>\n"
-" <DDD>\n"
-" <EEE/>\n"
-" <DDD/>\n"
-" <CCC/>\n"
-" <FFF/>\n"
-" <FFF>\n"
-" <GGG/>\n"
-" </FFF>\n"
-" </DDD>\n"
-" </XXX>\n"
-" <CCC>\n"
-" <DDD/>\n"
-" </CCC>\n"
-" </AAA>\n"
-},
-
-{
-"//CCC/preceding-sibling::*",
-"The preceding-sibling axis contains all the preceding siblings of the context node",
-" <AAA>\n"
-" <BBB>\n"
-" <CCC/>\n"
-" <DDD/>\n"
-" </BBB>\n"
-" <XXX>\n"
-" <DDD>\n"
-" <EEE/>\n"
-" <DDD/>\n"
-" <CCC/>\n"
-" <FFF/>\n"
-" <FFF>\n"
-" <GGG/>\n"
-" </FFF>\n"
-" </DDD>\n"
-" </XXX>\n"
-" <CCC>\n"
-" <DDD/>\n"
-" </CCC>\n"
-" </AAA>\n"
-},
-
-{
-"/AAA/XXX/following::*",
-"The following axis contains all nodes in the same document as the context "
-"node that are after the context node in document order, "
-"excluding any descendants and excluding attribute nodes and namespace nodes.",
-" <AAA>\n"
-" <BBB>\n"
-" <CCC/>\n"
-" <ZZZ>\n"
-" <DDD/>\n"
-" <DDD>\n"
-" <EEE/>\n"
-" </DDD>\n"
-" </ZZZ>\n"
-" <FFF>\n"
-" <GGG/>\n"
-" </FFF>\n"
-" </BBB>\n"
-" <XXX>\n"
-" <DDD>\n"
-" <EEE/>\n"
-" <DDD/>\n"
-" <CCC/>\n"
-" <FFF/>\n"
-" <FFF>\n"
-" <GGG/>\n"
-" </FFF>\n"
-" </DDD>\n"
-" </XXX>\n"
-" <CCC>\n"
-" <DDD/>\n"
-" </CCC>\n"
-" </AAA>\n"
-},
-
-{
-"//ZZZ/following::*",
-"The following axis contains all nodes in the same document as the context "
-"node that are after the context node in document order, "
-"excluding any descendants and excluding attribute nodes and namespace nodes.",
-" <AAA>\n"
-" <BBB>\n"
-" <CCC/>\n"
-" <ZZZ>\n"
-" <DDD/>\n"
-" <DDD>\n"
-" <EEE/>\n"
-" </DDD>\n"
-" </ZZZ>\n"
-" <FFF>\n"
-" <GGG/>\n"
-" </FFF>\n"
-" </BBB>\n"
-" <XXX>\n"
-" <DDD>\n"
-" <EEE/>\n"
-" <DDD/>\n"
-" <CCC/>\n"
-" <FFF/>\n"
-" <FFF>\n"
-" <GGG/>\n"
-" </FFF>\n"
-" </DDD>\n"
-" </XXX>\n"
-" <CCC>\n"
-" <DDD/>\n"
-" </CCC>\n"
-" </AAA>\n"
-},
-
-{
-"/AAA/XXX/preceding::*",
-"The preceding axis contains all nodes in the same document as the "
-"context node that are before the context node in document order, "
-"excluding any ancestors and excluding attribute nodes and namespace nodes",
-" <AAA>\n"
-" <BBB>\n"
-" <CCC/>\n"
-" <ZZZ>\n"
-" <DDD/>\n"
-" </ZZZ>\n"
-" </BBB>\n"
-" <XXX>\n"
-" <DDD>\n"
-" <EEE/>\n"
-" <DDD/>\n"
-" <CCC/>\n"
-" <FFF/>\n"
-" <FFF>\n"
-" <GGG/>\n"
-" </FFF>\n"
-" </DDD>\n"
-" </XXX>\n"
-" <CCC>\n"
-" <DDD/>\n"
-" </CCC>\n"
-" </AAA>\n"
-},
-
-{
-"//GGG/preceding::*",
-"The preceding axis contains all nodes in the same document as the "
-"context node that are before the context node in document order, "
-"excluding any ancestors and excluding attribute nodes and namespace nodes",
-" <AAA>\n"
-" <BBB>\n"
-" <CCC/>\n"
-" <ZZZ>\n"
-" <DDD/>\n"
-" </ZZZ>\n"
-" </BBB>\n"
-" <XXX>\n"
-" <DDD>\n"
-" <EEE/>\n"
-" <DDD/>\n"
-" <CCC/>\n"
-" <FFF/>\n"
-" <FFF>\n"
-" <GGG/>\n"
-" </FFF>\n"
-" </DDD>\n"
-" </XXX>\n"
-" <CCC>\n"
-" <DDD/>\n"
-" </CCC>\n"
-" </AAA>\n"
-},
-
-{
-"/AAA/XXX/descendant-or-self::*",
-"The descendant-or-self axis contains the "
-"context node and the descendants of the context node",
-" <AAA>\n"
-" <BBB>\n"
-" <CCC/>\n"
-" <ZZZ>\n"
-" <DDD/>\n"
-" </ZZZ>\n"
-" </BBB>\n"
-" <XXX>\n"
-" <DDD>\n"
-" <EEE/>\n"
-" <DDD/>\n"
-" <CCC/>\n"
-" <FFF/>\n"
-" <FFF>\n"
-" <GGG/>\n"
-" </FFF>\n"
-" </DDD>\n"
-" </XXX>\n"
-" <CCC>\n"
-" <DDD/>\n"
-" </CCC>\n"
-" </AAA>\n"
-},
-
-{
-"//CCC/descendant-or-self::*",
-"The descendant-or-self axis contains the "
-"context node and the descendants of the context node",
-" <AAA>\n"
-" <BBB>\n"
-" <CCC/>\n"
-" <ZZZ>\n"
-" <DDD/>\n"
-" </ZZZ>\n"
-" </BBB>\n"
-" <XXX>\n"
-" <DDD>\n"
-" <EEE/>\n"
-" <DDD/>\n"
-" <CCC/>\n"
-" <FFF/>\n"
-" <FFF>\n"
-" <GGG/>\n"
-" </FFF>\n"
-" </DDD>\n"
-" </XXX>\n"
-" <CCC>\n"
-" <DDD/>\n"
-" </CCC>\n"
-" </AAA>\n"
-},
-
-{
-"/AAA/XXX/DDD/EEE/ancestor-or-self::*",
-"The ancestor-or-self axis contains the context node and the "
-"ancestors of the context node; thus, the ancestor-or-self axis "
-"will always include the root node.",
-" <AAA>\n"
-" <BBB>\n"
-" <CCC/>\n"
-" <ZZZ>\n"
-" <DDD/>\n"
-" </ZZZ>\n"
-" </BBB>\n"
-" <XXX>\n"
-" <DDD>\n"
-" <EEE/>\n"
-" <DDD/>\n"
-" <CCC/>\n"
-" <FFF/>\n"
-" <FFF>\n"
-" <GGG/>\n"
-" </FFF>\n"
-" </DDD>\n"
-" </XXX>\n"
-" <CCC>\n"
-" <DDD/>\n"
-" </CCC>\n"
-" </AAA>\n"
-},
-
-{
-"//GGG/ancestor-or-self::*",
-"The ancestor-or-self axis contains the context node and the "
-"ancestors of the context node; thus, the ancestor-or-self axis "
-"will always include the root node.",
-" <AAA>\n"
-" <BBB>\n"
-" <CCC/>\n"
-" <ZZZ>\n"
-" <DDD/>\n"
-" </ZZZ>\n"
-" </BBB>\n"
-" <XXX>\n"
-" <DDD>\n"
-" <EEE/>\n"
-" <DDD/>\n"
-" <CCC/>\n"
-" <FFF/>\n"
-" <FFF>\n"
-" <GGG/>\n"
-" </FFF>\n"
-" </DDD>\n"
-" </XXX>\n"
-" <CCC>\n"
-" <DDD/>\n"
-" </CCC>\n"
-" </AAA>\n"
-},
-
-{
-"//GGG/ancestor::*",
-"The ancestor, descendant, following, preceding and self axes partition a document",
-" <AAA>\n"
-" <BBB>\n"
-" <CCC/>\n"
-" <ZZZ/>\n"
-" </BBB>\n"
-" <XXX>\n"
-" <DDD>\n"
-" <EEE/>\n"
-" <FFF>\n"
-" <HHH/>\n"
-" <GGG>\n"
-" <JJJ>\n"
-" <QQQ/>\n"
-" </JJJ>\n"
-" <JJJ/>\n"
-" </GGG>\n"
-" <HHH/>\n"
-" </FFF>\n"
-" </DDD>\n"
-" </XXX>\n"
-" <CCC>\n"
-" <DDD/>\n"
-" </CCC>\n"
-" </AAA>\n"
-},
-
-{
-"//GGG/descendant::*",
-"The ancestor, descendant, following, preceding and self axes partition a document",
-" <AAA>\n"
-" <BBB>\n"
-" <CCC/>\n"
-" <ZZZ/>\n"
-" </BBB>\n"
-" <XXX>\n"
-" <DDD>\n"
-" <EEE/>\n"
-" <FFF>\n"
-" <HHH/>\n"
-" <GGG>\n"
-" <JJJ>\n"
-" <QQQ/>\n"
-" </JJJ>\n"
-" <JJJ/>\n"
-" </GGG>\n"
-" <HHH/>\n"
-" </FFF>\n"
-" </DDD>\n"
-" </XXX>\n"
-" <CCC>\n"
-" <DDD/>\n"
-" </CCC>\n"
-" </AAA>\n"
-},
-
-{
-"//GGG/following::*",
-"The ancestor, descendant, following, preceding and self axes partition a document",
-" <AAA>\n"
-" <BBB>\n"
-" <CCC/>\n"
-" <ZZZ/>\n"
-" </BBB>\n"
-" <XXX>\n"
-" <DDD>\n"
-" <EEE/>\n"
-" <FFF>\n"
-" <HHH/>\n"
-" <GGG>\n"
-" <JJJ>\n"
-" <QQQ/>\n"
-" </JJJ>\n"
-" <JJJ/>\n"
-" </GGG>\n"
-" <HHH/>\n"
-" </FFF>\n"
-" </DDD>\n"
-" </XXX>\n"
-" <CCC>\n"
-" <DDD/>\n"
-" </CCC>\n"
-" </AAA>\n"
-},
-
-{
-"//GGG/preceding::*",
-"The ancestor, descendant, following, preceding and self axes partition a document",
-" <AAA>\n"
-" <BBB>\n"
-" <CCC/>\n"
-" <ZZZ/>\n"
-" </BBB>\n"
-" <XXX>\n"
-" <DDD>\n"
-" <EEE/>\n"
-" <FFF>\n"
-" <HHH/>\n"
-" <GGG>\n"
-" <JJJ>\n"
-" <QQQ/>\n"
-" </JJJ>\n"
-" <JJJ/>\n"
-" </GGG>\n"
-" <HHH/>\n"
-" </FFF>\n"
-" </DDD>\n"
-" </XXX>\n"
-" <CCC>\n"
-" <DDD/>\n"
-" </CCC>\n"
-" </AAA>\n"
-},
-
-{
-"//GGG/self::*",
-"The ancestor, descendant, following, preceding and self axes partition a document",
-" <AAA>\n"
-" <BBB>\n"
-" <CCC/>\n"
-" <ZZZ/>\n"
-" </BBB>\n"
-" <XXX>\n"
-" <DDD>\n"
-" <EEE/>\n"
-" <FFF>\n"
-" <HHH/>\n"
-" <GGG>\n"
-" <JJJ>\n"
-" <QQQ/>\n"
-" </JJJ>\n"
-" <JJJ/>\n"
-" </GGG>\n"
-" <HHH/>\n"
-" </FFF>\n"
-" </DDD>\n"
-" </XXX>\n"
-" <CCC>\n"
-" <DDD/>\n"
-" </CCC>\n"
-" </AAA>\n"
-},
-
-{
-"//GGG/ancestor::* | //GGG/descendant::* | //GGG/following::* | //GGG/preceding::* | //GGG/self::*",
-"The ancestor, descendant, following, preceding and self axes partition a document",
-" <AAA>\n"
-" <BBB>\n"
-" <CCC/>\n"
-" <ZZZ/>\n"
-" </BBB>\n"
-" <XXX>\n"
-" <DDD>\n"
-" <EEE/>\n"
-" <FFF>\n"
-" <HHH/>\n"
-" <GGG>\n"
-" <JJJ>\n"
-" <QQQ/>\n"
-" </JJJ>\n"
-" <JJJ/>\n"
-" </GGG>\n"
-" <HHH/>\n"
-" </FFF>\n"
-" </DDD>\n"
-" </XXX>\n"
-" <CCC>\n"
-" <DDD/>\n"
-" </CCC>\n"
-" </AAA>\n"
-},
-
-{
-"//BBB[position() mod 2 = 0 ]",
-"Select even BBB elements",
-" <AAA>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <CCC/>\n"
-" <CCC/>\n"
-" <CCC/>\n"
-" </AAA>\n"
-},
-
-{
-"//BBB[ position() = floor(last() div 2 + 0.5) or position() = ceiling(last() div 2 + 0.5) ]",
-"Select middle BBB element(s)",
-" <AAA>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <CCC/>\n"
-" <CCC/>\n"
-" <CCC/>\n"
-" </AAA>\n"
-},
-
-{
-"//CCC[ position() = floor(last() div 2 + 0.5) or position() = ceiling(last() div 2 + 0.5) ]",
-"Select middle CCC element(s)",
-" <AAA>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <BBB/>\n"
-" <CCC/>\n"
-" <CCC/>\n"
-" <CCC/>\n"
-" </AAA>\n"
-},
-
-{ //end data
-NULL,
-NULL,
-NULL,
-}
-
-};
-
-
-
-bool doStringTest(char *str)
-{
- XPathParser xp;
- xp.setDebug(true);
-
- if (!xp.parse(str))
- return false;
-
-
- return true;
-}
-
-
-
-bool doStringTests()
-{
- for (XpathTest *xpt = xpathTests ; xpt->xpathStr ; xpt++)
- {
- if (!doStringTest(xpt->xpathStr))
- return false;
- }
- return true;
-}
-
-void dumpDoc(Document *doc)
-{
- ls::DOMImplementationLSImpl domImpl;
- ls::LSSerializer &serializer = domImpl.createLSSerializer();
- ls::LSOutput output = domImpl.createLSOutput();
- io::StdWriter writer;
- output.setCharacterStream(&writer);
- serializer.write(doc, output);
-}
-
-
-bool doXmlTest(XpathTest *xpt)
-{
- //### READ
- ls::DOMImplementationLSImpl domImpl;
- ls::LSInput input = domImpl.createLSInput();
- ls::LSParser &parser = domImpl.createLSParser(0, "");
- input.setStringData(xpt->xml);
- Document *doc = parser.parse(input);
-
- //### XPATH
- XPathParser xp;
- xp.setDebug(true);
-
- org::w3c::dom::NodeList list = xp.evaluate(doc, xpt->xpathStr);
- for (unsigned int i=0 ; i<list.getLength() ; i++)
- {
- org::w3c::dom::Node *n = list.item(i);
- }
-
- //dumpDoc(doc);
-
- delete doc;
- return true;
-}
-
-bool doXmlTests()
-{
- for (XpathTest *xpt = xpathTests ; xpt->xpathStr ; xpt++)
- {
- if (!doXmlTest(xpt))
- return false;
- }
- return true;
-}
-
-bool doTests()
-{
- /*
- if (!doStringTests())
- {
- printf("## Failed string tests\n");
- return false;
- }
- */
- if (!doXmlTests())
- {
- printf("## Failed xml tests\n");
- return false;
- }
- return true;
-}
-
-
-
-int main(int argc, char **argv)
-{
- doTests();
- return 0;
-}
+/**
+ * Phoebe DOM Implementation.
+ *
+ * This is a C++ approximation of the W3C DOM model, which follows
+ * fairly closely the specifications in the various .idl files, copies of
+ * which are provided for reference. Most important is this one:
+ *
+ * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
+ *
+ * Authors:
+ * Bob Jamison
+ *
+ * Copyright (C) 2005 Bob Jamison
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+
+#include "dom.h"
+#include "lsimpl.h"
+#include "xpathparser.h"
+
+#include <stdio.h>
+
+using namespace org::w3c::dom;
+using namespace org::w3c::dom::xpath;
+
+
+typedef struct
+{
+ char *xpathStr;
+ char *desc;
+ char *xml;
+} XpathTest;
+
+XpathTest xpathTests[] =
+{
+
+{
+"/AAA",
+"Select the root element AAA",
+" <AAA>\n"
+" <BBB/>\n"
+" <CCC/>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <DDD>\n"
+" <BBB/>\n"
+" </DDD>\n"
+" <CCC/>\n"
+" </AAA>\n"
+},
+
+{
+"/AAA/CCC",
+"Select all elements CCC which are children of the root element AAA",
+" <AAA>\n"
+" <BBB/>\n"
+" <CCC/>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <DDD>\n"
+" <BBB/>\n"
+" </DDD>\n"
+" <CCC/>\n"
+" </AAA>\n"
+},
+
+{
+"/AAA/DDD/BBB",
+"Select all elements BBB which are children of DDD which are children of the root element AAA",
+" <AAA>\n"
+" <BBB/>\n"
+" <CCC/>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <DDD>\n"
+" <BBB/>\n"
+" </DDD>\n"
+" <CCC/>\n"
+" </AAA>\n"
+},
+
+{
+"//BBB",
+"Select all elements BBB",
+" <AAA>\n"
+" <BBB/>\n"
+" <CCC/>\n"
+" <BBB/>\n"
+" <DDD>\n"
+" <BBB/>\n"
+" </DDD>\n"
+" <CCC>\n"
+" <DDD>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" </DDD>\n"
+" </CCC>\n"
+" </AAA>\n"
+},
+
+{
+"//DDD/BBB",
+"Select all elements BBB which are children of DDD",
+" <AAA>\n"
+" <BBB/>\n"
+" <CCC/>\n"
+" <BBB/>\n"
+" <DDD>\n"
+" <BBB/>\n"
+" </DDD>\n"
+" <CCC>\n"
+" <DDD>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" </DDD>\n"
+" </CCC>\n"
+" </AAA>\n"
+},
+
+{
+"/AAA/CCC/DDD/*",
+"Select all elements enclosed by elements /AAA/CCC/DDD",
+" <AAA>\n"
+" <XXX>\n"
+" <DDD>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <EEE/>\n"
+" <FFF/>\n"
+" </DDD>\n"
+" </XXX>\n"
+" <CCC>\n"
+" <DDD>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <EEE/>\n"
+" <FFF/>\n"
+" </DDD>\n"
+" </CCC>\n"
+" <CCC>\n"
+" <BBB>\n"
+" <BBB>\n"
+" <BBB/>\n"
+" </BBB>\n"
+" </BBB>\n"
+" </CCC>\n"
+" </AAA>\n"
+},
+
+{
+"/*/*/*/BBB",
+"Select all elements BBB which have 3 ancestors",
+" <AAA>\n"
+" <XXX>\n"
+" <DDD>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <EEE/>\n"
+" <FFF/>\n"
+" </DDD>\n"
+" </XXX>\n"
+" <CCC>\n"
+" <DDD>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <EEE/>\n"
+" <FFF/>\n"
+" </DDD>\n"
+" </CCC>\n"
+" <CCC>\n"
+" <BBB>\n"
+" <BBB>\n"
+" <BBB/>\n"
+" </BBB>\n"
+" </BBB>\n"
+" </CCC>\n"
+" </AAA>\n"
+},
+
+{
+"//*",
+"Select all elements",
+" <AAA>\n"
+" <XXX>\n"
+" <DDD>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <EEE/>\n"
+" <FFF/>\n"
+" </DDD>\n"
+" </XXX>\n"
+" <CCC>\n"
+" <DDD>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <EEE/>\n"
+" <FFF/>\n"
+" </DDD>\n"
+" </CCC>\n"
+" <CCC>\n"
+" <BBB>\n"
+" <BBB>\n"
+" <BBB/>\n"
+" </BBB>\n"
+" </BBB>\n"
+" </CCC>\n"
+" </AAA>\n"
+},
+
+{
+"/AAA/BBB[1]",
+"Select the first BBB child of element AAA",
+" <AAA>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" </AAA>\n"
+},
+
+{
+"/AAA/BBB[last()]",
+"Select the last BBB child of element AAA",
+" <AAA>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" </AAA>\n"
+},
+
+{
+"//@id",
+"Select all attributes @id",
+" <AAA>\n"
+" <BBB id = 'b1'/>\n"
+" <BBB id = 'b2'/>\n"
+" <BBB name = 'bbb'/>\n"
+" <BBB/>\n"
+" </AAA>\n"
+},
+
+{
+"//BBB[@id]",
+"Select BBB elements which have attribute id",
+" <AAA>\n"
+" <BBB id = 'b1'/>\n"
+" <BBB id = 'b2'/>\n"
+" <BBB name = 'bbb'/>\n"
+" <BBB/>\n"
+" </AAA>\n"
+},
+
+{
+"//BBB[@name]",
+"Select BBB elements which have attribute name",
+" <AAA>\n"
+" <BBB id = 'b1'/>\n"
+" <BBB id = 'b2'/>\n"
+" <BBB name = 'bbb'/>\n"
+" <BBB/>\n"
+" </AAA>\n"
+},
+
+{
+"//BBB[@*]",
+"Select BBB elements which have any attribute",
+" <AAA>\n"
+" <BBB id = 'b1'/>\n"
+" <BBB id = 'b2'/>\n"
+" <BBB name = 'bbb'/>\n"
+" <BBB/>\n"
+" </AAA>\n"
+},
+
+{
+"//BBB[not(@*)]",
+"Select BBB elements without an attribute",
+" <AAA>\n"
+" <BBB id = 'b1'/>\n"
+" <BBB id = 'b2'/>\n"
+" <BBB name = 'bbb'/>\n"
+" <BBB/>\n"
+" </AAA>\n"
+},
+
+{
+"//BBB[@id='b1']",
+"Select BBB elements which have attribute id with value b1",
+" <AAA>\n"
+" <BBB id = 'b1'/>\n"
+" <BBB name = ' bbb '/>\n"
+" <BBB name = 'bbb'/>\n"
+" </AAA>\n"
+},
+
+{
+"//BBB[@name='bbb']",
+"Select BBB elements which have attribute name with value 'bbb'",
+" <AAA>\n"
+" <BBB id = 'b1'/>\n"
+" <BBB name = ' bbb '/>\n"
+" <BBB name = 'bbb'/>\n"
+" </AAA>\n"
+},
+
+{
+"//BBB[normalize-space(@name)='bbb']",
+"Select BBB elements which have attribute name with value bbb, leading and trailing spaces are removed before comparison",
+" <AAA>\n"
+" <BBB id = 'b1'/>\n"
+" <BBB name = ' bbb '/>\n"
+" <BBB name = 'bbb'/>\n"
+" </AAA>\n"
+},
+
+{
+"//*[count(BBB)=2]",
+"Select elements which have two children BBB",
+" <AAA>\n"
+" <CCC>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" </CCC>\n"
+" <DDD>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" </DDD>\n"
+" <EEE>\n"
+" <CCC/>\n"
+" <DDD/>\n"
+" </EEE>\n"
+" </AAA>\n"
+},
+
+{
+"//*[count(*)=2]",
+"Select elements which have 2 children",
+" <AAA>\n"
+" <CCC>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" </CCC>\n"
+" <DDD>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" </DDD>\n"
+" <EEE>\n"
+" <CCC/>\n"
+" <DDD/>\n"
+" </EEE>\n"
+" </AAA>\n"
+},
+
+{
+"//*[count(*)=3]",
+"Select elements which have 3 children",
+" <AAA>\n"
+" <CCC>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" </CCC>\n"
+" <DDD>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" </DDD>\n"
+" <EEE>\n"
+" <CCC/>\n"
+" <DDD/>\n"
+" </EEE>\n"
+" </AAA>\n"
+},
+
+{
+"//*[name()='BBB']",
+"Select all elements with name BBB, equivalent with //BBB",
+" <AAA>\n"
+" <BCC>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" </BCC>\n"
+" <DDB>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" </DDB>\n"
+" <BEC>\n"
+" <CCC/>\n"
+" <DBD/>\n"
+" </BEC>\n"
+" </AAA>\n"
+},
+
+{
+"//*[starts-with(name(),'B')]",
+"Select all elements name of which starts with letter B",
+" <AAA>\n"
+" <BCC>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" </BCC>\n"
+" <DDB>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" </DDB>\n"
+" <BEC>\n"
+" <CCC/>\n"
+" <DBD/>\n"
+" </BEC>\n"
+" </AAA>\n"
+},
+
+{
+"//*[contains(name(),'C')]",
+"Select all elements name of which contain letter C",
+" <AAA>\n"
+" <BCC>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" </BCC>\n"
+" <DDB>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" </DDB>\n"
+" <BEC>\n"
+" <CCC/>\n"
+" <DBD/>\n"
+" </BEC>\n"
+" </AAA>\n"
+},
+
+{
+"//*[string-length(name()) = 3]",
+"Select elements with three-letter name",
+" <AAA>\n"
+" <Q/>\n"
+" <SSSS/>\n"
+" <BB/>\n"
+" <CCC/>\n"
+" <DDDDDDDD/>\n"
+" <EEEE/>\n"
+" </AAA>\n"
+},
+
+{
+"//*[string-length(name()) < 3]",
+"Select elements name of which has one or two characters",
+" <AAA>\n"
+" <Q/>\n"
+" <SSSS/>\n"
+" <BB/>\n"
+" <CCC/>\n"
+" <DDDDDDDD/>\n"
+" <EEEE/>\n"
+" </AAA>\n"
+},
+
+{
+"//*[string-length(name()) > 3]",
+"Select elements with name longer than three characters",
+" <AAA>\n"
+" <Q/>\n"
+" <SSSS/>\n"
+" <BB/>\n"
+" <CCC/>\n"
+" <DDDDDDDD/>\n"
+" <EEEE/>\n"
+" </AAA>\n"
+},
+
+{
+"//CCC | //BBB",
+"Select all elements CCC and BBB",
+" <AAA>\n"
+" <BBB/>\n"
+" <CCC/>\n"
+" <DDD>\n"
+" <CCC/>\n"
+" </DDD>\n"
+" <EEE/>\n"
+" </AAA>\n"
+},
+
+{
+"/AAA/EEE | //BBB",
+"Select all elements BBB and elements EEE which are children of root element AAA",
+" <AAA>\n"
+" <BBB/>\n"
+" <CCC/>\n"
+" <DDD>\n"
+" <CCC/>\n"
+" </DDD>\n"
+" <EEE/>\n"
+" </AAA>\n"
+},
+
+{
+"/AAA/EEE | //DDD/CCC | /AAA | //BBB",
+"Number of combinations is not restricted",
+" <AAA>\n"
+" <BBB/>\n"
+" <CCC/>\n"
+" <DDD>\n"
+" <CCC/>\n"
+" </DDD>\n"
+" <EEE/>\n"
+" </AAA>\n"
+},
+
+{
+"/AAA",
+"Equivalent of /child::AAA",
+" <AAA>\n"
+" <BBB/>\n"
+" <CCC/>\n"
+" </AAA>\n"
+},
+
+{
+"/child::AAA",
+"Equivalent of /AAA",
+" <AAA>\n"
+" <BBB/>\n"
+" <CCC/>\n"
+" </AAA>\n"
+},
+
+{
+"/AAA/BBB",
+"Equivalent of /child::AAA/child::BBB",
+" <AAA>\n"
+" <BBB/>\n"
+" <CCC/>\n"
+" </AAA>\n"
+},
+
+{
+"/child::AAA/child::BBB",
+"Equivalent of /AAA/BBB",
+" <AAA>\n"
+" <BBB/>\n"
+" <CCC/>\n"
+" </AAA>\n"
+},
+
+{
+"/child::AAA/BBB",
+"Both possibilities can be combined",
+" <AAA>\n"
+" <BBB/>\n"
+" <CCC/>\n"
+" </AAA>\n"
+},
+
+{
+"/descendant::*",
+"Select all descendants of document root and therefore all elements",
+" <AAA>\n"
+" <BBB>\n"
+" <DDD>\n"
+" <CCC>\n"
+" <DDD/>\n"
+" <EEE/>\n"
+" </CCC>\n"
+" </DDD>\n"
+" </BBB>\n"
+" <CCC>\n"
+" <DDD>\n"
+" <EEE>\n"
+" <DDD>\n"
+" <FFF/>\n"
+" </DDD>\n"
+" </EEE>\n"
+" </DDD>\n"
+" </CCC>\n"
+" </AAA>\n"
+},
+
+{
+"/AAA/BBB/descendant::*",
+"Select all descendants of /AAA/BBB",
+" <AAA>\n"
+" <BBB>\n"
+" <DDD>\n"
+" <CCC>\n"
+" <DDD/>\n"
+" <EEE/>\n"
+" </CCC>\n"
+" </DDD>\n"
+" </BBB>\n"
+" <CCC>\n"
+" <DDD>\n"
+" <EEE>\n"
+" <DDD>\n"
+" <FFF/>\n"
+" </DDD>\n"
+" </EEE>\n"
+" </DDD>\n"
+" </CCC>\n"
+" </AAA>\n"
+},
+
+{
+"//CCC/descendant::*",
+"Select all elements which have CCC among its ancestors",
+" <AAA>\n"
+" <BBB>\n"
+" <DDD>\n"
+" <CCC>\n"
+" <DDD/>\n"
+" <EEE/>\n"
+" </CCC>\n"
+" </DDD>\n"
+" </BBB>\n"
+" <CCC>\n"
+" <DDD>\n"
+" <EEE>\n"
+" <DDD>\n"
+" <FFF/>\n"
+" </DDD>\n"
+" </EEE>\n"
+" </DDD>\n"
+" </CCC>\n"
+" </AAA>\n"
+},
+
+{
+"//CCC/descendant::DDD",
+"Select elements DDD which have CCC among its ancestors",
+" <AAA>\n"
+" <BBB>\n"
+" <DDD>\n"
+" <CCC>\n"
+" <DDD/>\n"
+" <EEE/>\n"
+" </CCC>\n"
+" </DDD>\n"
+" </BBB>\n"
+" <CCC>\n"
+" <DDD>\n"
+" <EEE>\n"
+" <DDD>\n"
+" <FFF/>\n"
+" </DDD>\n"
+" </EEE>\n"
+" </DDD>\n"
+" </CCC>\n"
+" </AAA>\n"
+},
+
+{
+"//DDD/parent::*",
+"Select all parents of DDD element",
+" <AAA>\n"
+" <BBB>\n"
+" <DDD>\n"
+" <CCC>\n"
+" <DDD/>\n"
+" <EEE/>\n"
+" </CCC>\n"
+" </DDD>\n"
+" </BBB>\n"
+" <CCC>\n"
+" <DDD>\n"
+" <EEE>\n"
+" <DDD>\n"
+" <FFF/>\n"
+" </DDD>\n"
+" </EEE>\n"
+" </DDD>\n"
+" </CCC>\n"
+" </AAA>\n"
+},
+
+{
+"/AAA/BBB/DDD/CCC/EEE/ancestor::*",
+"Select all elements given in this absolute path",
+" <AAA>\n"
+" <BBB>\n"
+" <DDD>\n"
+" <CCC>\n"
+" <DDD/>\n"
+" <EEE/>\n"
+" </CCC>\n"
+" </DDD>\n"
+" </BBB>\n"
+" <CCC>\n"
+" <DDD>\n"
+" <EEE>\n"
+" <DDD>\n"
+" <FFF/>\n"
+" </DDD>\n"
+" </EEE>\n"
+" </DDD>\n"
+" </CCC>\n"
+" </AAA>\n"
+},
+
+{
+"//FFF/ancestor::*",
+"Select ancestors of FFF element",
+" <AAA>\n"
+" <BBB>\n"
+" <DDD>\n"
+" <CCC>\n"
+" <DDD/>\n"
+" <EEE/>\n"
+" </CCC>\n"
+" </DDD>\n"
+" </BBB>\n"
+" <CCC>\n"
+" <DDD>\n"
+" <EEE>\n"
+" <DDD>\n"
+" <FFF/>\n"
+" </DDD>\n"
+" </EEE>\n"
+" </DDD>\n"
+" </CCC>\n"
+" </AAA>\n"
+},
+
+{
+"/AAA/BBB/following-sibling::*",
+"The following-sibling axis contains all the following siblings of the context node.",
+" <AAA>\n"
+" <BBB>\n"
+" <CCC/>\n"
+" <DDD/>\n"
+" </BBB>\n"
+" <XXX>\n"
+" <DDD>\n"
+" <EEE/>\n"
+" <DDD/>\n"
+" <CCC/>\n"
+" <FFF/>\n"
+" <FFF>\n"
+" <GGG/>\n"
+" </FFF>\n"
+" </DDD>\n"
+" </XXX>\n"
+" <CCC>\n"
+" <DDD/>\n"
+" </CCC>\n"
+" </AAA>\n"
+},
+
+{
+"//CCC/following-sibling::*",
+"The following-sibling axis contains all the following siblings of the context node.",
+" <AAA>\n"
+" <BBB>\n"
+" <CCC/>\n"
+" <DDD/>\n"
+" </BBB>\n"
+" <XXX>\n"
+" <DDD>\n"
+" <EEE/>\n"
+" <DDD/>\n"
+" <CCC/>\n"
+" <FFF/>\n"
+" <FFF>\n"
+" <GGG/>\n"
+" </FFF>\n"
+" </DDD>\n"
+" </XXX>\n"
+" <CCC>\n"
+" <DDD/>\n"
+" </CCC>\n"
+" </AAA>\n"
+},
+
+{
+"/AAA/XXX/preceding-sibling::*",
+"The preceding-sibling axis contains all the preceding siblings of the context node.",
+" <AAA>\n"
+" <BBB>\n"
+" <CCC/>\n"
+" <DDD/>\n"
+" </BBB>\n"
+" <XXX>\n"
+" <DDD>\n"
+" <EEE/>\n"
+" <DDD/>\n"
+" <CCC/>\n"
+" <FFF/>\n"
+" <FFF>\n"
+" <GGG/>\n"
+" </FFF>\n"
+" </DDD>\n"
+" </XXX>\n"
+" <CCC>\n"
+" <DDD/>\n"
+" </CCC>\n"
+" </AAA>\n"
+},
+
+{
+"//CCC/preceding-sibling::*",
+"The preceding-sibling axis contains all the preceding siblings of the context node",
+" <AAA>\n"
+" <BBB>\n"
+" <CCC/>\n"
+" <DDD/>\n"
+" </BBB>\n"
+" <XXX>\n"
+" <DDD>\n"
+" <EEE/>\n"
+" <DDD/>\n"
+" <CCC/>\n"
+" <FFF/>\n"
+" <FFF>\n"
+" <GGG/>\n"
+" </FFF>\n"
+" </DDD>\n"
+" </XXX>\n"
+" <CCC>\n"
+" <DDD/>\n"
+" </CCC>\n"
+" </AAA>\n"
+},
+
+{
+"/AAA/XXX/following::*",
+"The following axis contains all nodes in the same document as the context "
+"node that are after the context node in document order, "
+"excluding any descendants and excluding attribute nodes and namespace nodes.",
+" <AAA>\n"
+" <BBB>\n"
+" <CCC/>\n"
+" <ZZZ>\n"
+" <DDD/>\n"
+" <DDD>\n"
+" <EEE/>\n"
+" </DDD>\n"
+" </ZZZ>\n"
+" <FFF>\n"
+" <GGG/>\n"
+" </FFF>\n"
+" </BBB>\n"
+" <XXX>\n"
+" <DDD>\n"
+" <EEE/>\n"
+" <DDD/>\n"
+" <CCC/>\n"
+" <FFF/>\n"
+" <FFF>\n"
+" <GGG/>\n"
+" </FFF>\n"
+" </DDD>\n"
+" </XXX>\n"
+" <CCC>\n"
+" <DDD/>\n"
+" </CCC>\n"
+" </AAA>\n"
+},
+
+{
+"//ZZZ/following::*",
+"The following axis contains all nodes in the same document as the context "
+"node that are after the context node in document order, "
+"excluding any descendants and excluding attribute nodes and namespace nodes.",
+" <AAA>\n"
+" <BBB>\n"
+" <CCC/>\n"
+" <ZZZ>\n"
+" <DDD/>\n"
+" <DDD>\n"
+" <EEE/>\n"
+" </DDD>\n"
+" </ZZZ>\n"
+" <FFF>\n"
+" <GGG/>\n"
+" </FFF>\n"
+" </BBB>\n"
+" <XXX>\n"
+" <DDD>\n"
+" <EEE/>\n"
+" <DDD/>\n"
+" <CCC/>\n"
+" <FFF/>\n"
+" <FFF>\n"
+" <GGG/>\n"
+" </FFF>\n"
+" </DDD>\n"
+" </XXX>\n"
+" <CCC>\n"
+" <DDD/>\n"
+" </CCC>\n"
+" </AAA>\n"
+},
+
+{
+"/AAA/XXX/preceding::*",
+"The preceding axis contains all nodes in the same document as the "
+"context node that are before the context node in document order, "
+"excluding any ancestors and excluding attribute nodes and namespace nodes",
+" <AAA>\n"
+" <BBB>\n"
+" <CCC/>\n"
+" <ZZZ>\n"
+" <DDD/>\n"
+" </ZZZ>\n"
+" </BBB>\n"
+" <XXX>\n"
+" <DDD>\n"
+" <EEE/>\n"
+" <DDD/>\n"
+" <CCC/>\n"
+" <FFF/>\n"
+" <FFF>\n"
+" <GGG/>\n"
+" </FFF>\n"
+" </DDD>\n"
+" </XXX>\n"
+" <CCC>\n"
+" <DDD/>\n"
+" </CCC>\n"
+" </AAA>\n"
+},
+
+{
+"//GGG/preceding::*",
+"The preceding axis contains all nodes in the same document as the "
+"context node that are before the context node in document order, "
+"excluding any ancestors and excluding attribute nodes and namespace nodes",
+" <AAA>\n"
+" <BBB>\n"
+" <CCC/>\n"
+" <ZZZ>\n"
+" <DDD/>\n"
+" </ZZZ>\n"
+" </BBB>\n"
+" <XXX>\n"
+" <DDD>\n"
+" <EEE/>\n"
+" <DDD/>\n"
+" <CCC/>\n"
+" <FFF/>\n"
+" <FFF>\n"
+" <GGG/>\n"
+" </FFF>\n"
+" </DDD>\n"
+" </XXX>\n"
+" <CCC>\n"
+" <DDD/>\n"
+" </CCC>\n"
+" </AAA>\n"
+},
+
+{
+"/AAA/XXX/descendant-or-self::*",
+"The descendant-or-self axis contains the "
+"context node and the descendants of the context node",
+" <AAA>\n"
+" <BBB>\n"
+" <CCC/>\n"
+" <ZZZ>\n"
+" <DDD/>\n"
+" </ZZZ>\n"
+" </BBB>\n"
+" <XXX>\n"
+" <DDD>\n"
+" <EEE/>\n"
+" <DDD/>\n"
+" <CCC/>\n"
+" <FFF/>\n"
+" <FFF>\n"
+" <GGG/>\n"
+" </FFF>\n"
+" </DDD>\n"
+" </XXX>\n"
+" <CCC>\n"
+" <DDD/>\n"
+" </CCC>\n"
+" </AAA>\n"
+},
+
+{
+"//CCC/descendant-or-self::*",
+"The descendant-or-self axis contains the "
+"context node and the descendants of the context node",
+" <AAA>\n"
+" <BBB>\n"
+" <CCC/>\n"
+" <ZZZ>\n"
+" <DDD/>\n"
+" </ZZZ>\n"
+" </BBB>\n"
+" <XXX>\n"
+" <DDD>\n"
+" <EEE/>\n"
+" <DDD/>\n"
+" <CCC/>\n"
+" <FFF/>\n"
+" <FFF>\n"
+" <GGG/>\n"
+" </FFF>\n"
+" </DDD>\n"
+" </XXX>\n"
+" <CCC>\n"
+" <DDD/>\n"
+" </CCC>\n"
+" </AAA>\n"
+},
+
+{
+"/AAA/XXX/DDD/EEE/ancestor-or-self::*",
+"The ancestor-or-self axis contains the context node and the "
+"ancestors of the context node; thus, the ancestor-or-self axis "
+"will always include the root node.",
+" <AAA>\n"
+" <BBB>\n"
+" <CCC/>\n"
+" <ZZZ>\n"
+" <DDD/>\n"
+" </ZZZ>\n"
+" </BBB>\n"
+" <XXX>\n"
+" <DDD>\n"
+" <EEE/>\n"
+" <DDD/>\n"
+" <CCC/>\n"
+" <FFF/>\n"
+" <FFF>\n"
+" <GGG/>\n"
+" </FFF>\n"
+" </DDD>\n"
+" </XXX>\n"
+" <CCC>\n"
+" <DDD/>\n"
+" </CCC>\n"
+" </AAA>\n"
+},
+
+{
+"//GGG/ancestor-or-self::*",
+"The ancestor-or-self axis contains the context node and the "
+"ancestors of the context node; thus, the ancestor-or-self axis "
+"will always include the root node.",
+" <AAA>\n"
+" <BBB>\n"
+" <CCC/>\n"
+" <ZZZ>\n"
+" <DDD/>\n"
+" </ZZZ>\n"
+" </BBB>\n"
+" <XXX>\n"
+" <DDD>\n"
+" <EEE/>\n"
+" <DDD/>\n"
+" <CCC/>\n"
+" <FFF/>\n"
+" <FFF>\n"
+" <GGG/>\n"
+" </FFF>\n"
+" </DDD>\n"
+" </XXX>\n"
+" <CCC>\n"
+" <DDD/>\n"
+" </CCC>\n"
+" </AAA>\n"
+},
+
+{
+"//GGG/ancestor::*",
+"The ancestor, descendant, following, preceding and self axes partition a document",
+" <AAA>\n"
+" <BBB>\n"
+" <CCC/>\n"
+" <ZZZ/>\n"
+" </BBB>\n"
+" <XXX>\n"
+" <DDD>\n"
+" <EEE/>\n"
+" <FFF>\n"
+" <HHH/>\n"
+" <GGG>\n"
+" <JJJ>\n"
+" <QQQ/>\n"
+" </JJJ>\n"
+" <JJJ/>\n"
+" </GGG>\n"
+" <HHH/>\n"
+" </FFF>\n"
+" </DDD>\n"
+" </XXX>\n"
+" <CCC>\n"
+" <DDD/>\n"
+" </CCC>\n"
+" </AAA>\n"
+},
+
+{
+"//GGG/descendant::*",
+"The ancestor, descendant, following, preceding and self axes partition a document",
+" <AAA>\n"
+" <BBB>\n"
+" <CCC/>\n"
+" <ZZZ/>\n"
+" </BBB>\n"
+" <XXX>\n"
+" <DDD>\n"
+" <EEE/>\n"
+" <FFF>\n"
+" <HHH/>\n"
+" <GGG>\n"
+" <JJJ>\n"
+" <QQQ/>\n"
+" </JJJ>\n"
+" <JJJ/>\n"
+" </GGG>\n"
+" <HHH/>\n"
+" </FFF>\n"
+" </DDD>\n"
+" </XXX>\n"
+" <CCC>\n"
+" <DDD/>\n"
+" </CCC>\n"
+" </AAA>\n"
+},
+
+{
+"//GGG/following::*",
+"The ancestor, descendant, following, preceding and self axes partition a document",
+" <AAA>\n"
+" <BBB>\n"
+" <CCC/>\n"
+" <ZZZ/>\n"
+" </BBB>\n"
+" <XXX>\n"
+" <DDD>\n"
+" <EEE/>\n"
+" <FFF>\n"
+" <HHH/>\n"
+" <GGG>\n"
+" <JJJ>\n"
+" <QQQ/>\n"
+" </JJJ>\n"
+" <JJJ/>\n"
+" </GGG>\n"
+" <HHH/>\n"
+" </FFF>\n"
+" </DDD>\n"
+" </XXX>\n"
+" <CCC>\n"
+" <DDD/>\n"
+" </CCC>\n"
+" </AAA>\n"
+},
+
+{
+"//GGG/preceding::*",
+"The ancestor, descendant, following, preceding and self axes partition a document",
+" <AAA>\n"
+" <BBB>\n"
+" <CCC/>\n"
+" <ZZZ/>\n"
+" </BBB>\n"
+" <XXX>\n"
+" <DDD>\n"
+" <EEE/>\n"
+" <FFF>\n"
+" <HHH/>\n"
+" <GGG>\n"
+" <JJJ>\n"
+" <QQQ/>\n"
+" </JJJ>\n"
+" <JJJ/>\n"
+" </GGG>\n"
+" <HHH/>\n"
+" </FFF>\n"
+" </DDD>\n"
+" </XXX>\n"
+" <CCC>\n"
+" <DDD/>\n"
+" </CCC>\n"
+" </AAA>\n"
+},
+
+{
+"//GGG/self::*",
+"The ancestor, descendant, following, preceding and self axes partition a document",
+" <AAA>\n"
+" <BBB>\n"
+" <CCC/>\n"
+" <ZZZ/>\n"
+" </BBB>\n"
+" <XXX>\n"
+" <DDD>\n"
+" <EEE/>\n"
+" <FFF>\n"
+" <HHH/>\n"
+" <GGG>\n"
+" <JJJ>\n"
+" <QQQ/>\n"
+" </JJJ>\n"
+" <JJJ/>\n"
+" </GGG>\n"
+" <HHH/>\n"
+" </FFF>\n"
+" </DDD>\n"
+" </XXX>\n"
+" <CCC>\n"
+" <DDD/>\n"
+" </CCC>\n"
+" </AAA>\n"
+},
+
+{
+"//GGG/ancestor::* | //GGG/descendant::* | //GGG/following::* | //GGG/preceding::* | //GGG/self::*",
+"The ancestor, descendant, following, preceding and self axes partition a document",
+" <AAA>\n"
+" <BBB>\n"
+" <CCC/>\n"
+" <ZZZ/>\n"
+" </BBB>\n"
+" <XXX>\n"
+" <DDD>\n"
+" <EEE/>\n"
+" <FFF>\n"
+" <HHH/>\n"
+" <GGG>\n"
+" <JJJ>\n"
+" <QQQ/>\n"
+" </JJJ>\n"
+" <JJJ/>\n"
+" </GGG>\n"
+" <HHH/>\n"
+" </FFF>\n"
+" </DDD>\n"
+" </XXX>\n"
+" <CCC>\n"
+" <DDD/>\n"
+" </CCC>\n"
+" </AAA>\n"
+},
+
+{
+"//BBB[position() mod 2 = 0 ]",
+"Select even BBB elements",
+" <AAA>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <CCC/>\n"
+" <CCC/>\n"
+" <CCC/>\n"
+" </AAA>\n"
+},
+
+{
+"//BBB[ position() = floor(last() div 2 + 0.5) or position() = ceiling(last() div 2 + 0.5) ]",
+"Select middle BBB element(s)",
+" <AAA>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <CCC/>\n"
+" <CCC/>\n"
+" <CCC/>\n"
+" </AAA>\n"
+},
+
+{
+"//CCC[ position() = floor(last() div 2 + 0.5) or position() = ceiling(last() div 2 + 0.5) ]",
+"Select middle CCC element(s)",
+" <AAA>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <BBB/>\n"
+" <CCC/>\n"
+" <CCC/>\n"
+" <CCC/>\n"
+" </AAA>\n"
+},
+
+{ //end data
+NULL,
+NULL,
+NULL,
+}
+
+};
+
+
+
+bool doStringTest(char *str)
+{
+ XPathParser xp;
+ xp.setDebug(true);
+
+ if (!xp.parse(str))
+ return false;
+
+
+ return true;
+}
+
+
+
+bool doStringTests()
+{
+ for (XpathTest *xpt = xpathTests ; xpt->xpathStr ; xpt++)
+ {
+ if (!doStringTest(xpt->xpathStr))
+ return false;
+ }
+ return true;
+}
+
+void dumpDoc(Document *doc)
+{
+ ls::DOMImplementationLSImpl domImpl;
+ ls::LSSerializer &serializer = domImpl.createLSSerializer();
+ ls::LSOutput output = domImpl.createLSOutput();
+ io::StdWriter writer;
+ output.setCharacterStream(&writer);
+ serializer.write(doc, output);
+}
+
+
+bool doXmlTest(XpathTest *xpt)
+{
+ //### READ
+ ls::DOMImplementationLSImpl domImpl;
+ ls::LSInput input = domImpl.createLSInput();
+ ls::LSParser &parser = domImpl.createLSParser(0, "");
+ input.setStringData(xpt->xml);
+ Document *doc = parser.parse(input);
+
+ //### XPATH
+ XPathParser xp;
+ xp.setDebug(true);
+
+ org::w3c::dom::NodeList list = xp.evaluate(doc, xpt->xpathStr);
+ for (unsigned int i=0 ; i<list.getLength() ; i++)
+ {
+ org::w3c::dom::Node *n = list.item(i);
+ }
+
+ //dumpDoc(doc);
+
+ delete doc;
+ return true;
+}
+
+bool doXmlTests()
+{
+ for (XpathTest *xpt = xpathTests ; xpt->xpathStr ; xpt++)
+ {
+ if (!doXmlTest(xpt))
+ return false;
+ }
+ return true;
+}
+
+bool doTests()
+{
+ /*
+ if (!doStringTests())
+ {
+ printf("## Failed string tests\n");
+ return false;
+ }
+ */
+ if (!doXmlTests())
+ {
+ printf("## Failed xml tests\n");
+ return false;
+ }
+ return true;
+}
+
+
+
+int main(int argc, char **argv)
+{
+ doTests();
+ return 0;
+}
diff --git a/src/dom/work/testzip.cpp b/src/dom/work/testzip.cpp
index 5a1f38960..9281d37ce 100644
--- a/src/dom/work/testzip.cpp
+++ b/src/dom/work/testzip.cpp
@@ -1,65 +1,65 @@
-/**
- * Phoebe DOM Implementation.
- *
- * This is a C++ approximation of the W3C DOM model, which follows
- * fairly closely the specifications in the various .idl files, copies of
- * which are provided for reference. Most important is this one:
- *
- * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
- *
- * Authors:
- * Bob Jamison
- *
- * Copyright (C) 2006 Bob Jamison
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdio.h>
-
-
-#include "io/uristream.h"
-#include "util/ziptool.h"
-
-
-
-bool doTest()
-{
- org::w3c::dom::io::UriInputStream ins("file:work/test.odg");
-
- std::vector<unsigned char>inbuf;
-
- while (true)
- {
- int ch = ins.get();
- if (ch < 0)
- break;
- inbuf.push_back(ch);
- }
- ZipFile zf;
- if (!zf.readBuffer(inbuf))
- {
- return false;
- }
- return true;
-}
-
-
-int main(int argc, char **argv)
-{
- doTest();
-}
-
-
+/**
+ * Phoebe DOM Implementation.
+ *
+ * This is a C++ approximation of the W3C DOM model, which follows
+ * fairly closely the specifications in the various .idl files, copies of
+ * which are provided for reference. Most important is this one:
+ *
+ * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
+ *
+ * Authors:
+ * Bob Jamison
+ *
+ * Copyright (C) 2006 Bob Jamison
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <stdio.h>
+
+
+#include "io/uristream.h"
+#include "util/ziptool.h"
+
+
+
+bool doTest()
+{
+ org::w3c::dom::io::UriInputStream ins("file:work/test.odg");
+
+ std::vector<unsigned char>inbuf;
+
+ while (true)
+ {
+ int ch = ins.get();
+ if (ch < 0)
+ break;
+ inbuf.push_back(ch);
+ }
+ ZipFile zf;
+ if (!zf.readBuffer(inbuf))
+ {
+ return false;
+ }
+ return true;
+}
+
+
+int main(int argc, char **argv)
+{
+ doTest();
+}
+
+
diff --git a/src/dom/work/xpathtests.cpp b/src/dom/work/xpathtests.cpp
index 65b832e71..f34c62c80 100644
--- a/src/dom/work/xpathtests.cpp
+++ b/src/dom/work/xpathtests.cpp
@@ -1,1290 +1,1290 @@
-/**
- * Phoebe DOM Implementation.
- *
- * This is a C++ approximation of the W3C DOM model, which follows
- * fairly closely the specifications in the various .idl files, copies of
- * which are provided for reference. Most important is this one:
- *
- * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
- *
- * Authors:
- * Bob Jamison
- *
- * Copyright (C) 2005 Bob Jamison
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-
-typedef struct
-{
- char *xpathStr;
- char *desc;
- char *xml;
-} XpathTest;
-
-XpathTest xpathTests[] =
-{
-
-{
-"/AAA",
-"Select the root element AAA",
-" <AAA>"
-" <BBB/>"
-" <CCC/>"
-" <BBB/>"
-" <BBB/>"
-" <DDD>"
-" <BBB/>"
-" </DDD>"
-" <CCC/>"
-" </AAA>"
-},
-
-{
-"/AAA/CCC",
-"Select all elements CCC which are children of the root element AAA",
-" <AAA>"
-" <BBB/>"
-" <CCC/>"
-" <BBB/>"
-" <BBB/>"
-" <DDD>"
-" <BBB/>"
-" </DDD>"
-" <CCC/>"
-" </AAA>"
-},
-
-{
-"/AAA/DDD/BBB",
-"Select all elements BBB which are children of DDD which are children of the root element AAA",
-" <AAA>"
-" <BBB/>"
-" <CCC/>"
-" <BBB/>"
-" <BBB/>"
-" <DDD>"
-" <BBB/>"
-" </DDD>"
-" <CCC/>"
-" </AAA>"
-"//BBB",
-},
-
-{
-"Select all elements BBB",
-" <AAA>"
-" <BBB/>"
-" <CCC/>"
-" <BBB/>"
-" <DDD>"
-" <BBB/>"
-" </DDD>"
-" <CCC>"
-" <DDD>"
-" <BBB/>"
-" <BBB/>"
-" </DDD>"
-" </CCC>"
-" </AAA>"
-},
-
-{
-"//DDD/BBB",
-"Select all elements BBB which are children of DDD",
-" <AAA>"
-" <BBB/>"
-" <CCC/>"
-" <BBB/>"
-" <DDD>"
-" <BBB/>"
-" </DDD>"
-" <CCC>"
-" <DDD>"
-" <BBB/>"
-" <BBB/>"
-" </DDD>"
-" </CCC>"
-" </AAA>"
-},
-
-{
-"/AAA/CCC/DDD/*",
-"Select all elements enclosed by elements /AAA/CCC/DDD",
-" <AAA>"
-" <XXX>"
-" <DDD>"
-" <BBB/>"
-" <BBB/>"
-" <EEE/>"
-" <FFF/>"
-" </DDD>"
-" </XXX>"
-" <CCC>"
-" <DDD>"
-" <BBB/>"
-" <BBB/>"
-" <EEE/>"
-" <FFF/>"
-" </DDD>"
-" </CCC>"
-" <CCC>"
-" <BBB>"
-" <BBB>"
-" <BBB/>"
-" </BBB>"
-" </BBB>"
-" </CCC>"
-" </AAA>"
-},
-
-{
-"/*/*/*/BBB",
-"Select all elements BBB which have 3 ancestors",
-" <AAA>"
-" <XXX>"
-" <DDD>"
-" <BBB/>"
-" <BBB/>"
-" <EEE/>"
-" <FFF/>"
-" </DDD>"
-" </XXX>"
-" <CCC>"
-" <DDD>"
-" <BBB/>"
-" <BBB/>"
-" <EEE/>"
-" <FFF/>"
-" </DDD>"
-" </CCC>"
-" <CCC>"
-" <BBB>"
-" <BBB>"
-" <BBB/>"
-" </BBB>"
-" </BBB>"
-" </CCC>"
-" </AAA>"
-},
-
-{
-"//*",
-"Select all elements",
-" <AAA>"
-" <XXX>"
-" <DDD>"
-" <BBB/>"
-" <BBB/>"
-" <EEE/>"
-" <FFF/>"
-" </DDD>"
-" </XXX>"
-" <CCC>"
-" <DDD>"
-" <BBB/>"
-" <BBB/>"
-" <EEE/>"
-" <FFF/>"
-" </DDD>"
-" </CCC>"
-" <CCC>"
-" <BBB>"
-" <BBB>"
-" <BBB/>"
-" </BBB>"
-" </BBB>"
-" </CCC>"
-" </AAA>"
-},
-
-{
-"/AAA/BBB[1]",
-"Select the first BBB child of element AAA",
-" <AAA>"
-" <BBB/>"
-" <BBB/>"
-" <BBB/>"
-" <BBB/>"
-" </AAA>"
-},
-
-{
-"/AAA/BBB[last()]",
-"Select the last BBB child of element AAA",
-" <AAA>"
-" <BBB/>"
-" <BBB/>"
-" <BBB/>"
-" <BBB/>"
-" </AAA>"
-},
-
-{
-"//@id",
-"Select all attributes @id",
-" <AAA>"
-" <BBB id = 'b1'/>"
-" <BBB id = 'b2'/>"
-" <BBB name = 'bbb'/>"
-" <BBB/>"
-" </AAA>"
-},
-
-{
-"//BBB[@id]",
-"Select BBB elements which have attribute id",
-" <AAA>"
-" <BBB id = 'b1'/>"
-" <BBB id = 'b2'/>"
-" <BBB name = 'bbb'/>"
-" <BBB/>"
-" </AAA>"
-},
-
-{
-"//BBB[@name]",
-"Select BBB elements which have attribute name",
-" <AAA>"
-" <BBB id = 'b1'/>"
-" <BBB id = 'b2'/>"
-" <BBB name = 'bbb'/>"
-" <BBB/>"
-" </AAA>"
-},
-
-{
-"//BBB[@*]",
-"Select BBB elements which have any attribute",
-" <AAA>"
-" <BBB id = 'b1'/>"
-" <BBB id = 'b2'/>"
-" <BBB name = 'bbb'/>"
-" <BBB/>"
-" </AAA>"
-},
-
-{
-"//BBB[not(@*)]",
-"Select BBB elements without an attribute",
-" <AAA>"
-" <BBB id = 'b1'/>"
-" <BBB id = 'b2'/>"
-" <BBB name = 'bbb'/>"
-" <BBB/>"
-" </AAA>"
-},
-
-{
-"//BBB[@id='b1']",
-"Select BBB elements which have attribute id with value b1",
-" <AAA>"
-" <BBB id = 'b1'/>"
-" <BBB name = ' bbb '/>"
-" <BBB name = 'bbb'/>"
-" </AAA>"
-},
-
-{
-"//BBB[@name='bbb']",
-"Select BBB elements which have attribute name with value 'bbb'",
-" <AAA>"
-" <BBB id = 'b1'/>"
-" <BBB name = ' bbb '/>"
-" <BBB name = 'bbb'/>"
-" </AAA>"
-},
-
-{
-"//BBB[normalize-space(@name)='bbb']",
-"Select BBB elements which have attribute name with value bbb, leading and trailing spaces are removed before comparison",
-" <AAA>"
-" <BBB id = 'b1'/>"
-" <BBB name = ' bbb '/>"
-" <BBB name = 'bbb'/>"
-" </AAA>"
-},
-
-{
-"//*[count(BBB)=2]",
-"Select elements which have two children BBB",
-" <AAA>"
-" <CCC>"
-" <BBB/>"
-" <BBB/>"
-" <BBB/>"
-" </CCC>"
-" <DDD>"
-" <BBB/>"
-" <BBB/>"
-" </DDD>"
-" <EEE>"
-" <CCC/>"
-" <DDD/>"
-" </EEE>"
-" </AAA>"
-},
-
-{
-"//*[count(*)=2]",
-"Select elements which have 2 children",
-" <AAA>"
-" <CCC>"
-" <BBB/>"
-" <BBB/>"
-" <BBB/>"
-" </CCC>"
-" <DDD>"
-" <BBB/>"
-" <BBB/>"
-" </DDD>"
-" <EEE>"
-" <CCC/>"
-" <DDD/>"
-" </EEE>"
-" </AAA>"
-},
-
-{
-"//*[count(*)=3]",
-"Select elements which have 3 children",
-" <AAA>"
-" <CCC>"
-" <BBB/>"
-" <BBB/>"
-" <BBB/>"
-" </CCC>"
-" <DDD>"
-" <BBB/>"
-" <BBB/>"
-" </DDD>"
-" <EEE>"
-" <CCC/>"
-" <DDD/>"
-" </EEE>"
-" </AAA>"
-},
-
-{
-"//*[name()='BBB']",
-"Select all elements with name BBB, equivalent with //BBB",
-" <AAA>"
-" <BCC>"
-" <BBB/>"
-" <BBB/>"
-" <BBB/>"
-" </BCC>"
-" <DDB>"
-" <BBB/>"
-" <BBB/>"
-" </DDB>"
-" <BEC>"
-" <CCC/>"
-" <DBD/>"
-" </BEC>"
-" </AAA>"
-},
-
-{
-"//*[starts-with(name(),'B')]",
-"Select all elements name of which starts with letter B",
-" <AAA>"
-" <BCC>"
-" <BBB/>"
-" <BBB/>"
-" <BBB/>"
-" </BCC>"
-" <DDB>"
-" <BBB/>"
-" <BBB/>"
-" </DDB>"
-" <BEC>"
-" <CCC/>"
-" <DBD/>"
-" </BEC>"
-" </AAA>"
-},
-
-{
-"//*[contains(name(),'C')]",
-"Select all elements name of which contain letter C",
-" <AAA>"
-" <BCC>"
-" <BBB/>"
-" <BBB/>"
-" <BBB/>"
-" </BCC>"
-" <DDB>"
-" <BBB/>"
-" <BBB/>"
-" </DDB>"
-" <BEC>"
-" <CCC/>"
-" <DBD/>"
-" </BEC>"
-" </AAA>"
-},
-
-{
-"//*[string-length(name()) = 3]",
-"Select elements with three-letter name",
-" <AAA>"
-" <Q/>"
-" <SSSS/>"
-" <BB/>"
-" <CCC/>"
-" <DDDDDDDD/>"
-" <EEEE/>"
-" </AAA>"
-},
-
-{
-"//*[string-length(name()) < 3]",
-"Select elements name of which has one or two characters",
-" <AAA>"
-" <Q/>"
-" <SSSS/>"
-" <BB/>"
-" <CCC/>"
-" <DDDDDDDD/>"
-" <EEEE/>"
-" </AAA>"
-},
-
-{
-"//*[string-length(name()) > 3]",
-"Select elements with name longer than three characters",
-" <AAA>"
-" <Q/>"
-" <SSSS/>"
-" <BB/>"
-" <CCC/>"
-" <DDDDDDDD/>"
-" <EEEE/>"
-" </AAA>"
-},
-
-{
-"//CCC | //BBB",
-"Select all elements CCC and BBB",
-" <AAA>"
-" <BBB/>"
-" <CCC/>"
-" <DDD>"
-" <CCC/>"
-" </DDD>"
-" <EEE/>"
-" </AAA>"
-},
-
-{
-"/AAA/EEE | //BBB",
-"Select all elements BBB and elements EEE which are children of root element AAA",
-" <AAA>"
-" <BBB/>"
-" <CCC/>"
-" <DDD>"
-" <CCC/>"
-" </DDD>"
-" <EEE/>"
-" </AAA>"
-},
-
-{
-"/AAA/EEE | //DDD/CCC | /AAA | //BBB",
-"Number of combinations is not restricted",
-" <AAA>"
-" <BBB/>"
-" <CCC/>"
-" <DDD>"
-" <CCC/>"
-" </DDD>"
-" <EEE/>"
-" </AAA>"
-},
-
-{
-"/AAA",
-"Equivalent of /child::AAA",
-" <AAA>"
-" <BBB/>"
-" <CCC/>"
-" </AAA>"
-},
-
-{
-"/child::AAA",
-"Equivalent of /AAA",
-" <AAA>"
-" <BBB/>"
-" <CCC/>"
-" </AAA>"
-},
-
-{
-"/AAA/BBB",
-"Equivalent of /child::AAA/child::BBB",
-" <AAA>"
-" <BBB/>"
-" <CCC/>"
-" </AAA>"
-},
-
-{
-"/child::AAA/child::BBB",
-"Equivalent of /AAA/BBB",
-" <AAA>"
-" <BBB/>"
-" <CCC/>"
-" </AAA>"
-},
-
-{
-"/child::AAA/BBB",
-"Both possibilities can be combined",
-" <AAA>"
-" <BBB/>"
-" <CCC/>"
-" </AAA>"
-},
-
-{
-"/descendant::*",
-"Select all descendants of document root and therefore all elements",
-" <AAA>"
-" <BBB>"
-" <DDD>"
-" <CCC>"
-" <DDD/>"
-" <EEE/>"
-" </CCC>"
-" </DDD>"
-" </BBB>"
-" <CCC>"
-" <DDD>"
-" <EEE>"
-" <DDD>"
-" <FFF/>"
-" </DDD>"
-" </EEE>"
-" </DDD>"
-" </CCC>"
-" </AAA>"
-},
-
-{
-"/AAA/BBB/descendant::*",
-"Select all descendants of /AAA/BBB",
-" <AAA>"
-" <BBB>"
-" <DDD>"
-" <CCC>"
-" <DDD/>"
-" <EEE/>"
-" </CCC>"
-" </DDD>"
-" </BBB>"
-" <CCC>"
-" <DDD>"
-" <EEE>"
-" <DDD>"
-" <FFF/>"
-" </DDD>"
-" </EEE>"
-" </DDD>"
-" </CCC>"
-" </AAA>"
-},
-
-{
-"//CCC/descendant::*",
-"Select all elements which have CCC among its ancestors",
-" <AAA>"
-" <BBB>"
-" <DDD>"
-" <CCC>"
-" <DDD/>"
-" <EEE/>"
-" </CCC>"
-" </DDD>"
-" </BBB>"
-" <CCC>"
-" <DDD>"
-" <EEE>"
-" <DDD>"
-" <FFF/>"
-" </DDD>"
-" </EEE>"
-" </DDD>"
-" </CCC>"
-" </AAA>"
-},
-
-{
-"//CCC/descendant::DDD",
-"Select elements DDD which have CCC among its ancestors",
-" <AAA>"
-" <BBB>"
-" <DDD>"
-" <CCC>"
-" <DDD/>"
-" <EEE/>"
-" </CCC>"
-" </DDD>"
-" </BBB>"
-" <CCC>"
-" <DDD>"
-" <EEE>"
-" <DDD>"
-" <FFF/>"
-" </DDD>"
-" </EEE>"
-" </DDD>"
-" </CCC>"
-" </AAA>"
-},
-
-{
-"//DDD/parent::*",
-"Select all parents of DDD element",
-" <AAA>"
-" <BBB>"
-" <DDD>"
-" <CCC>"
-" <DDD/>"
-" <EEE/>"
-" </CCC>"
-" </DDD>"
-" </BBB>"
-" <CCC>"
-" <DDD>"
-" <EEE>"
-" <DDD>"
-" <FFF/>"
-" </DDD>"
-" </EEE>"
-" </DDD>"
-" </CCC>"
-" </AAA>"
-},
-
-{
-"/AAA/BBB/DDD/CCC/EEE/ancestor::*",
-"Select all elements given in this absolute path",
-" <AAA>"
-" <BBB>"
-" <DDD>"
-" <CCC>"
-" <DDD/>"
-" <EEE/>"
-" </CCC>"
-" </DDD>"
-" </BBB>"
-" <CCC>"
-" <DDD>"
-" <EEE>"
-" <DDD>"
-" <FFF/>"
-" </DDD>"
-" </EEE>"
-" </DDD>"
-" </CCC>"
-" </AAA>"
-},
-
-{
-"//FFF/ancestor::*",
-"Select ancestors of FFF element",
-" <AAA>"
-" <BBB>"
-" <DDD>"
-" <CCC>"
-" <DDD/>"
-" <EEE/>"
-" </CCC>"
-" </DDD>"
-" </BBB>"
-" <CCC>"
-" <DDD>"
-" <EEE>"
-" <DDD>"
-" <FFF/>"
-" </DDD>"
-" </EEE>"
-" </DDD>"
-" </CCC>"
-" </AAA>"
-},
-
-{
-"/AAA/BBB/following-sibling::*",
-"The following-sibling axis contains all the following siblings of the context node.",
-" <AAA>"
-" <BBB>"
-" <CCC/>"
-" <DDD/>"
-" </BBB>"
-" <XXX>"
-" <DDD>"
-" <EEE/>"
-" <DDD/>"
-" <CCC/>"
-" <FFF/>"
-" <FFF>"
-" <GGG/>"
-" </FFF>"
-" </DDD>"
-" </XXX>"
-" <CCC>"
-" <DDD/>"
-" </CCC>"
-" </AAA>"
-},
-
-{
-"//CCC/following-sibling::*",
-"The following-sibling axis contains all the following siblings of the context node.",
-" <AAA>"
-" <BBB>"
-" <CCC/>"
-" <DDD/>"
-" </BBB>"
-" <XXX>"
-" <DDD>"
-" <EEE/>"
-" <DDD/>"
-" <CCC/>"
-" <FFF/>"
-" <FFF>"
-" <GGG/>"
-" </FFF>"
-" </DDD>"
-" </XXX>"
-" <CCC>"
-" <DDD/>"
-" </CCC>"
-" </AAA>"
-},
-
-{
-"/AAA/XXX/preceding-sibling::*",
-"The preceding-sibling axis contains all the preceding siblings of the context node.",
-" <AAA>"
-" <BBB>"
-" <CCC/>"
-" <DDD/>"
-" </BBB>"
-" <XXX>"
-" <DDD>"
-" <EEE/>"
-" <DDD/>"
-" <CCC/>"
-" <FFF/>"
-" <FFF>"
-" <GGG/>"
-" </FFF>"
-" </DDD>"
-" </XXX>"
-" <CCC>"
-" <DDD/>"
-" </CCC>"
-" </AAA>"
-},
-
-{
-"//CCC/preceding-sibling::*",
-" <AAA>"
-" <BBB>"
-" <CCC/>"
-" <DDD/>"
-" </BBB>"
-" <XXX>"
-" <DDD>"
-" <EEE/>"
-" <DDD/>"
-" <CCC/>"
-" <FFF/>"
-" <FFF>"
-" <GGG/>"
-" </FFF>"
-" </DDD>"
-" </XXX>"
-" <CCC>"
-" <DDD/>"
-" </CCC>"
-" </AAA>"
-},
-
-{
-"/AAA/XXX/following::*",
-"Description",
-" <AAA>"
-" <BBB>"
-" <CCC/>"
-" <ZZZ>"
-" <DDD/>"
-" <DDD>"
-" <EEE/>"
-" </DDD>"
-" </ZZZ>"
-" <FFF>"
-" <GGG/>"
-" </FFF>"
-" </BBB>"
-" <XXX>"
-" <DDD>"
-" <EEE/>"
-" <DDD/>"
-" <CCC/>"
-" <FFF/>"
-" <FFF>"
-" <GGG/>"
-" </FFF>"
-" </DDD>"
-" </XXX>"
-" <CCC>"
-" <DDD/>"
-" </CCC>"
-" </AAA>"
-},
-
-{
-"//ZZZ/following::*",
-"Description",
-" <AAA>"
-" <BBB>"
-" <CCC/>"
-" <ZZZ>"
-" <DDD/>"
-" <DDD>"
-" <EEE/>"
-" </DDD>"
-" </ZZZ>"
-" <FFF>"
-" <GGG/>"
-" </FFF>"
-" </BBB>"
-" <XXX>"
-" <DDD>"
-" <EEE/>"
-" <DDD/>"
-" <CCC/>"
-" <FFF/>"
-" <FFF>"
-" <GGG/>"
-" </FFF>"
-" </DDD>"
-" </XXX>"
-" <CCC>"
-" <DDD/>"
-" </CCC>"
-" </AAA>"
-},
-
-{
-"/AAA/XXX/preceding::*",
-"Description",
-" <AAA>"
-" <BBB>"
-" <CCC/>"
-" <ZZZ>"
-" <DDD/>"
-" </ZZZ>"
-" </BBB>"
-" <XXX>"
-" <DDD>"
-" <EEE/>"
-" <DDD/>"
-" <CCC/>"
-" <FFF/>"
-" <FFF>"
-" <GGG/>"
-" </FFF>"
-" </DDD>"
-" </XXX>"
-" <CCC>"
-" <DDD/>"
-" </CCC>"
-" </AAA>"
-},
-
-{
-"//GGG/preceding::*",
-"Description",
-" <AAA>"
-" <BBB>"
-" <CCC/>"
-" <ZZZ>"
-" <DDD/>"
-" </ZZZ>"
-" </BBB>"
-" <XXX>"
-" <DDD>"
-" <EEE/>"
-" <DDD/>"
-" <CCC/>"
-" <FFF/>"
-" <FFF>"
-" <GGG/>"
-" </FFF>"
-" </DDD>"
-" </XXX>"
-" <CCC>"
-" <DDD/>"
-" </CCC>"
-" </AAA>"
-},
-
-{
-"/AAA/XXX/descendant-or-self::*",
-"Description",
-" <AAA>"
-" <BBB>"
-" <CCC/>"
-" <ZZZ>"
-" <DDD/>"
-" </ZZZ>"
-" </BBB>"
-" <XXX>"
-" <DDD>"
-" <EEE/>"
-" <DDD/>"
-" <CCC/>"
-" <FFF/>"
-" <FFF>"
-" <GGG/>"
-" </FFF>"
-" </DDD>"
-" </XXX>"
-" <CCC>"
-" <DDD/>"
-" </CCC>"
-" </AAA>"
-},
-
-{
-"//CCC/descendant-or-self::*",
-"Description",
-" <AAA>"
-" <BBB>"
-" <CCC/>"
-" <ZZZ>"
-" <DDD/>"
-" </ZZZ>"
-" </BBB>"
-" <XXX>"
-" <DDD>"
-" <EEE/>"
-" <DDD/>"
-" <CCC/>"
-" <FFF/>"
-" <FFF>"
-" <GGG/>"
-" </FFF>"
-" </DDD>"
-" </XXX>"
-" <CCC>"
-" <DDD/>"
-" </CCC>"
-" </AAA>"
-},
-
-{
-"/AAA/XXX/DDD/EEE/ancestor-or-self::*",
-"Description",
-" <AAA>"
-" <BBB>"
-" <CCC/>"
-" <ZZZ>"
-" <DDD/>"
-" </ZZZ>"
-" </BBB>"
-" <XXX>"
-" <DDD>"
-" <EEE/>"
-" <DDD/>"
-" <CCC/>"
-" <FFF/>"
-" <FFF>"
-" <GGG/>"
-" </FFF>"
-" </DDD>"
-" </XXX>"
-" <CCC>"
-" <DDD/>"
-" </CCC>"
-" </AAA>"
-},
-
-{
-"//GGG/ancestor-or-self::*",
-"Description",
-" <AAA>"
-" <BBB>"
-" <CCC/>"
-" <ZZZ>"
-" <DDD/>"
-" </ZZZ>"
-" </BBB>"
-" <XXX>"
-" <DDD>"
-" <EEE/>"
-" <DDD/>"
-" <CCC/>"
-" <FFF/>"
-" <FFF>"
-" <GGG/>"
-" </FFF>"
-" </DDD>"
-" </XXX>"
-" <CCC>"
-" <DDD/>"
-" </CCC>"
-" </AAA>"
-},
-
-{
-"//GGG/ancestor::*",
-"Description",
-" <AAA>"
-" <BBB>"
-" <CCC/>"
-" <ZZZ/>"
-" </BBB>"
-" <XXX>"
-" <DDD>"
-" <EEE/>"
-" <FFF>"
-" <HHH/>"
-" <GGG>"
-" <JJJ>"
-" <QQQ/>"
-" </JJJ>"
-" <JJJ/>"
-" </GGG>"
-" <HHH/>"
-" </FFF>"
-" </DDD>"
-" </XXX>"
-" <CCC>"
-" <DDD/>"
-" </CCC>"
-" </AAA>"
-},
-
-{
-"//GGG/descendant::*",
-"Description",
-" <AAA>"
-" <BBB>"
-" <CCC/>"
-" <ZZZ/>"
-" </BBB>"
-" <XXX>"
-" <DDD>"
-" <EEE/>"
-" <FFF>"
-" <HHH/>"
-" <GGG>"
-" <JJJ>"
-" <QQQ/>"
-" </JJJ>"
-" <JJJ/>"
-" </GGG>"
-" <HHH/>"
-" </FFF>"
-" </DDD>"
-" </XXX>"
-" <CCC>"
-" <DDD/>"
-" </CCC>"
-" </AAA>"
-},
-
-{
-"//GGG/following::*",
-"Description",
-" <AAA>"
-" <BBB>"
-" <CCC/>"
-" <ZZZ/>"
-" </BBB>"
-" <XXX>"
-" <DDD>"
-" <EEE/>"
-" <FFF>"
-" <HHH/>"
-" <GGG>"
-" <JJJ>"
-" <QQQ/>"
-" </JJJ>"
-" <JJJ/>"
-" </GGG>"
-" <HHH/>"
-" </FFF>"
-" </DDD>"
-" </XXX>"
-" <CCC>"
-" <DDD/>"
-" </CCC>"
-" </AAA>"
-},
-
-{
-"//GGG/preceding::*",
-"Description",
-" <AAA>"
-" <BBB>"
-" <CCC/>"
-" <ZZZ/>"
-" </BBB>"
-" <XXX>"
-" <DDD>"
-" <EEE/>"
-" <FFF>"
-" <HHH/>"
-" <GGG>"
-" <JJJ>"
-" <QQQ/>"
-" </JJJ>"
-" <JJJ/>"
-" </GGG>"
-" <HHH/>"
-" </FFF>"
-" </DDD>"
-" </XXX>"
-" <CCC>"
-" <DDD/>"
-" </CCC>"
-" </AAA>"
-},
-
-{
-"//GGG/self::*",
-"Description",
-" <AAA>"
-" <BBB>"
-" <CCC/>"
-" <ZZZ/>"
-" </BBB>"
-" <XXX>"
-" <DDD>"
-" <EEE/>"
-" <FFF>"
-" <HHH/>"
-" <GGG>"
-" <JJJ>"
-" <QQQ/>"
-" </JJJ>"
-" <JJJ/>"
-" </GGG>"
-" <HHH/>"
-" </FFF>"
-" </DDD>"
-" </XXX>"
-" <CCC>"
-" <DDD/>"
-" </CCC>"
-" </AAA>"
-},
-
-{
-"//GGG/ancestor::* | //GGG/descendant::* | //GGG/following::* | //GGG/preceding::* | //GGG/self::*",
-"description",
-" <AAA>"
-" <BBB>"
-" <CCC/>"
-" <ZZZ/>"
-" </BBB>"
-" <XXX>"
-" <DDD>"
-" <EEE/>"
-" <FFF>"
-" <HHH/>"
-" <GGG>"
-" <JJJ>"
-" <QQQ/>"
-" </JJJ>"
-" <JJJ/>"
-" </GGG>"
-" <HHH/>"
-" </FFF>"
-" </DDD>"
-" </XXX>"
-" <CCC>"
-" <DDD/>"
-" </CCC>"
-" </AAA>"
-},
-
-{
-"//BBB[position() mod 2 = 0 ]",
-"Select even BBB elements",
-" <AAA>"
-" <BBB/>"
-" <BBB/>"
-" <BBB/>"
-" <BBB/>"
-" <BBB/>"
-" <BBB/>"
-" <BBB/>"
-" <BBB/>"
-" <CCC/>"
-" <CCC/>"
-" <CCC/>"
-" </AAA>"
-},
-
-{
-"//BBB[ position() = floor(last() div 2 + 0.5) or position() = ceiling(last() div 2 + 0.5) ]",
-"Select middle BBB element(s)",
-" <AAA>"
-" <BBB/>"
-" <BBB/>"
-" <BBB/>"
-" <BBB/>"
-" <BBB/>"
-" <BBB/>"
-" <BBB/>"
-" <BBB/>"
-" <CCC/>"
-" <CCC/>"
-" <CCC/>"
-" </AAA>"
-},
-
-{
-"//CCC[ position() = floor(last() div 2 + 0.5) or position() = ceiling(last() div 2 + 0.5) ]",
-"Select middle CCC element(s)",
-" <AAA>"
-" <BBB/>"
-" <BBB/>"
-" <BBB/>"
-" <BBB/>"
-" <BBB/>"
-" <BBB/>"
-" <BBB/>"
-" <BBB/>"
-" <CCC/>"
-" <CCC/>"
-" <CCC/>"
-" </AAA>"
-}
-
-}; //end
-
-
+/**
+ * Phoebe DOM Implementation.
+ *
+ * This is a C++ approximation of the W3C DOM model, which follows
+ * fairly closely the specifications in the various .idl files, copies of
+ * which are provided for reference. Most important is this one:
+ *
+ * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
+ *
+ * Authors:
+ * Bob Jamison
+ *
+ * Copyright (C) 2005 Bob Jamison
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+
+typedef struct
+{
+ char *xpathStr;
+ char *desc;
+ char *xml;
+} XpathTest;
+
+XpathTest xpathTests[] =
+{
+
+{
+"/AAA",
+"Select the root element AAA",
+" <AAA>"
+" <BBB/>"
+" <CCC/>"
+" <BBB/>"
+" <BBB/>"
+" <DDD>"
+" <BBB/>"
+" </DDD>"
+" <CCC/>"
+" </AAA>"
+},
+
+{
+"/AAA/CCC",
+"Select all elements CCC which are children of the root element AAA",
+" <AAA>"
+" <BBB/>"
+" <CCC/>"
+" <BBB/>"
+" <BBB/>"
+" <DDD>"
+" <BBB/>"
+" </DDD>"
+" <CCC/>"
+" </AAA>"
+},
+
+{
+"/AAA/DDD/BBB",
+"Select all elements BBB which are children of DDD which are children of the root element AAA",
+" <AAA>"
+" <BBB/>"
+" <CCC/>"
+" <BBB/>"
+" <BBB/>"
+" <DDD>"
+" <BBB/>"
+" </DDD>"
+" <CCC/>"
+" </AAA>"
+"//BBB",
+},
+
+{
+"Select all elements BBB",
+" <AAA>"
+" <BBB/>"
+" <CCC/>"
+" <BBB/>"
+" <DDD>"
+" <BBB/>"
+" </DDD>"
+" <CCC>"
+" <DDD>"
+" <BBB/>"
+" <BBB/>"
+" </DDD>"
+" </CCC>"
+" </AAA>"
+},
+
+{
+"//DDD/BBB",
+"Select all elements BBB which are children of DDD",
+" <AAA>"
+" <BBB/>"
+" <CCC/>"
+" <BBB/>"
+" <DDD>"
+" <BBB/>"
+" </DDD>"
+" <CCC>"
+" <DDD>"
+" <BBB/>"
+" <BBB/>"
+" </DDD>"
+" </CCC>"
+" </AAA>"
+},
+
+{
+"/AAA/CCC/DDD/*",
+"Select all elements enclosed by elements /AAA/CCC/DDD",
+" <AAA>"
+" <XXX>"
+" <DDD>"
+" <BBB/>"
+" <BBB/>"
+" <EEE/>"
+" <FFF/>"
+" </DDD>"
+" </XXX>"
+" <CCC>"
+" <DDD>"
+" <BBB/>"
+" <BBB/>"
+" <EEE/>"
+" <FFF/>"
+" </DDD>"
+" </CCC>"
+" <CCC>"
+" <BBB>"
+" <BBB>"
+" <BBB/>"
+" </BBB>"
+" </BBB>"
+" </CCC>"
+" </AAA>"
+},
+
+{
+"/*/*/*/BBB",
+"Select all elements BBB which have 3 ancestors",
+" <AAA>"
+" <XXX>"
+" <DDD>"
+" <BBB/>"
+" <BBB/>"
+" <EEE/>"
+" <FFF/>"
+" </DDD>"
+" </XXX>"
+" <CCC>"
+" <DDD>"
+" <BBB/>"
+" <BBB/>"
+" <EEE/>"
+" <FFF/>"
+" </DDD>"
+" </CCC>"
+" <CCC>"
+" <BBB>"
+" <BBB>"
+" <BBB/>"
+" </BBB>"
+" </BBB>"
+" </CCC>"
+" </AAA>"
+},
+
+{
+"//*",
+"Select all elements",
+" <AAA>"
+" <XXX>"
+" <DDD>"
+" <BBB/>"
+" <BBB/>"
+" <EEE/>"
+" <FFF/>"
+" </DDD>"
+" </XXX>"
+" <CCC>"
+" <DDD>"
+" <BBB/>"
+" <BBB/>"
+" <EEE/>"
+" <FFF/>"
+" </DDD>"
+" </CCC>"
+" <CCC>"
+" <BBB>"
+" <BBB>"
+" <BBB/>"
+" </BBB>"
+" </BBB>"
+" </CCC>"
+" </AAA>"
+},
+
+{
+"/AAA/BBB[1]",
+"Select the first BBB child of element AAA",
+" <AAA>"
+" <BBB/>"
+" <BBB/>"
+" <BBB/>"
+" <BBB/>"
+" </AAA>"
+},
+
+{
+"/AAA/BBB[last()]",
+"Select the last BBB child of element AAA",
+" <AAA>"
+" <BBB/>"
+" <BBB/>"
+" <BBB/>"
+" <BBB/>"
+" </AAA>"
+},
+
+{
+"//@id",
+"Select all attributes @id",
+" <AAA>"
+" <BBB id = 'b1'/>"
+" <BBB id = 'b2'/>"
+" <BBB name = 'bbb'/>"
+" <BBB/>"
+" </AAA>"
+},
+
+{
+"//BBB[@id]",
+"Select BBB elements which have attribute id",
+" <AAA>"
+" <BBB id = 'b1'/>"
+" <BBB id = 'b2'/>"
+" <BBB name = 'bbb'/>"
+" <BBB/>"
+" </AAA>"
+},
+
+{
+"//BBB[@name]",
+"Select BBB elements which have attribute name",
+" <AAA>"
+" <BBB id = 'b1'/>"
+" <BBB id = 'b2'/>"
+" <BBB name = 'bbb'/>"
+" <BBB/>"
+" </AAA>"
+},
+
+{
+"//BBB[@*]",
+"Select BBB elements which have any attribute",
+" <AAA>"
+" <BBB id = 'b1'/>"
+" <BBB id = 'b2'/>"
+" <BBB name = 'bbb'/>"
+" <BBB/>"
+" </AAA>"
+},
+
+{
+"//BBB[not(@*)]",
+"Select BBB elements without an attribute",
+" <AAA>"
+" <BBB id = 'b1'/>"
+" <BBB id = 'b2'/>"
+" <BBB name = 'bbb'/>"
+" <BBB/>"
+" </AAA>"
+},
+
+{
+"//BBB[@id='b1']",
+"Select BBB elements which have attribute id with value b1",
+" <AAA>"
+" <BBB id = 'b1'/>"
+" <BBB name = ' bbb '/>"
+" <BBB name = 'bbb'/>"
+" </AAA>"
+},
+
+{
+"//BBB[@name='bbb']",
+"Select BBB elements which have attribute name with value 'bbb'",
+" <AAA>"
+" <BBB id = 'b1'/>"
+" <BBB name = ' bbb '/>"
+" <BBB name = 'bbb'/>"
+" </AAA>"
+},
+
+{
+"//BBB[normalize-space(@name)='bbb']",
+"Select BBB elements which have attribute name with value bbb, leading and trailing spaces are removed before comparison",
+" <AAA>"
+" <BBB id = 'b1'/>"
+" <BBB name = ' bbb '/>"
+" <BBB name = 'bbb'/>"
+" </AAA>"
+},
+
+{
+"//*[count(BBB)=2]",
+"Select elements which have two children BBB",
+" <AAA>"
+" <CCC>"
+" <BBB/>"
+" <BBB/>"
+" <BBB/>"
+" </CCC>"
+" <DDD>"
+" <BBB/>"
+" <BBB/>"
+" </DDD>"
+" <EEE>"
+" <CCC/>"
+" <DDD/>"
+" </EEE>"
+" </AAA>"
+},
+
+{
+"//*[count(*)=2]",
+"Select elements which have 2 children",
+" <AAA>"
+" <CCC>"
+" <BBB/>"
+" <BBB/>"
+" <BBB/>"
+" </CCC>"
+" <DDD>"
+" <BBB/>"
+" <BBB/>"
+" </DDD>"
+" <EEE>"
+" <CCC/>"
+" <DDD/>"
+" </EEE>"
+" </AAA>"
+},
+
+{
+"//*[count(*)=3]",
+"Select elements which have 3 children",
+" <AAA>"
+" <CCC>"
+" <BBB/>"
+" <BBB/>"
+" <BBB/>"
+" </CCC>"
+" <DDD>"
+" <BBB/>"
+" <BBB/>"
+" </DDD>"
+" <EEE>"
+" <CCC/>"
+" <DDD/>"
+" </EEE>"
+" </AAA>"
+},
+
+{
+"//*[name()='BBB']",
+"Select all elements with name BBB, equivalent with //BBB",
+" <AAA>"
+" <BCC>"
+" <BBB/>"
+" <BBB/>"
+" <BBB/>"
+" </BCC>"
+" <DDB>"
+" <BBB/>"
+" <BBB/>"
+" </DDB>"
+" <BEC>"
+" <CCC/>"
+" <DBD/>"
+" </BEC>"
+" </AAA>"
+},
+
+{
+"//*[starts-with(name(),'B')]",
+"Select all elements name of which starts with letter B",
+" <AAA>"
+" <BCC>"
+" <BBB/>"
+" <BBB/>"
+" <BBB/>"
+" </BCC>"
+" <DDB>"
+" <BBB/>"
+" <BBB/>"
+" </DDB>"
+" <BEC>"
+" <CCC/>"
+" <DBD/>"
+" </BEC>"
+" </AAA>"
+},
+
+{
+"//*[contains(name(),'C')]",
+"Select all elements name of which contain letter C",
+" <AAA>"
+" <BCC>"
+" <BBB/>"
+" <BBB/>"
+" <BBB/>"
+" </BCC>"
+" <DDB>"
+" <BBB/>"
+" <BBB/>"
+" </DDB>"
+" <BEC>"
+" <CCC/>"
+" <DBD/>"
+" </BEC>"
+" </AAA>"
+},
+
+{
+"//*[string-length(name()) = 3]",
+"Select elements with three-letter name",
+" <AAA>"
+" <Q/>"
+" <SSSS/>"
+" <BB/>"
+" <CCC/>"
+" <DDDDDDDD/>"
+" <EEEE/>"
+" </AAA>"
+},
+
+{
+"//*[string-length(name()) < 3]",
+"Select elements name of which has one or two characters",
+" <AAA>"
+" <Q/>"
+" <SSSS/>"
+" <BB/>"
+" <CCC/>"
+" <DDDDDDDD/>"
+" <EEEE/>"
+" </AAA>"
+},
+
+{
+"//*[string-length(name()) > 3]",
+"Select elements with name longer than three characters",
+" <AAA>"
+" <Q/>"
+" <SSSS/>"
+" <BB/>"
+" <CCC/>"
+" <DDDDDDDD/>"
+" <EEEE/>"
+" </AAA>"
+},
+
+{
+"//CCC | //BBB",
+"Select all elements CCC and BBB",
+" <AAA>"
+" <BBB/>"
+" <CCC/>"
+" <DDD>"
+" <CCC/>"
+" </DDD>"
+" <EEE/>"
+" </AAA>"
+},
+
+{
+"/AAA/EEE | //BBB",
+"Select all elements BBB and elements EEE which are children of root element AAA",
+" <AAA>"
+" <BBB/>"
+" <CCC/>"
+" <DDD>"
+" <CCC/>"
+" </DDD>"
+" <EEE/>"
+" </AAA>"
+},
+
+{
+"/AAA/EEE | //DDD/CCC | /AAA | //BBB",
+"Number of combinations is not restricted",
+" <AAA>"
+" <BBB/>"
+" <CCC/>"
+" <DDD>"
+" <CCC/>"
+" </DDD>"
+" <EEE/>"
+" </AAA>"
+},
+
+{
+"/AAA",
+"Equivalent of /child::AAA",
+" <AAA>"
+" <BBB/>"
+" <CCC/>"
+" </AAA>"
+},
+
+{
+"/child::AAA",
+"Equivalent of /AAA",
+" <AAA>"
+" <BBB/>"
+" <CCC/>"
+" </AAA>"
+},
+
+{
+"/AAA/BBB",
+"Equivalent of /child::AAA/child::BBB",
+" <AAA>"
+" <BBB/>"
+" <CCC/>"
+" </AAA>"
+},
+
+{
+"/child::AAA/child::BBB",
+"Equivalent of /AAA/BBB",
+" <AAA>"
+" <BBB/>"
+" <CCC/>"
+" </AAA>"
+},
+
+{
+"/child::AAA/BBB",
+"Both possibilities can be combined",
+" <AAA>"
+" <BBB/>"
+" <CCC/>"
+" </AAA>"
+},
+
+{
+"/descendant::*",
+"Select all descendants of document root and therefore all elements",
+" <AAA>"
+" <BBB>"
+" <DDD>"
+" <CCC>"
+" <DDD/>"
+" <EEE/>"
+" </CCC>"
+" </DDD>"
+" </BBB>"
+" <CCC>"
+" <DDD>"
+" <EEE>"
+" <DDD>"
+" <FFF/>"
+" </DDD>"
+" </EEE>"
+" </DDD>"
+" </CCC>"
+" </AAA>"
+},
+
+{
+"/AAA/BBB/descendant::*",
+"Select all descendants of /AAA/BBB",
+" <AAA>"
+" <BBB>"
+" <DDD>"
+" <CCC>"
+" <DDD/>"
+" <EEE/>"
+" </CCC>"
+" </DDD>"
+" </BBB>"
+" <CCC>"
+" <DDD>"
+" <EEE>"
+" <DDD>"
+" <FFF/>"
+" </DDD>"
+" </EEE>"
+" </DDD>"
+" </CCC>"
+" </AAA>"
+},
+
+{
+"//CCC/descendant::*",
+"Select all elements which have CCC among its ancestors",
+" <AAA>"
+" <BBB>"
+" <DDD>"
+" <CCC>"
+" <DDD/>"
+" <EEE/>"
+" </CCC>"
+" </DDD>"
+" </BBB>"
+" <CCC>"
+" <DDD>"
+" <EEE>"
+" <DDD>"
+" <FFF/>"
+" </DDD>"
+" </EEE>"
+" </DDD>"
+" </CCC>"
+" </AAA>"
+},
+
+{
+"//CCC/descendant::DDD",
+"Select elements DDD which have CCC among its ancestors",
+" <AAA>"
+" <BBB>"
+" <DDD>"
+" <CCC>"
+" <DDD/>"
+" <EEE/>"
+" </CCC>"
+" </DDD>"
+" </BBB>"
+" <CCC>"
+" <DDD>"
+" <EEE>"
+" <DDD>"
+" <FFF/>"
+" </DDD>"
+" </EEE>"
+" </DDD>"
+" </CCC>"
+" </AAA>"
+},
+
+{
+"//DDD/parent::*",
+"Select all parents of DDD element",
+" <AAA>"
+" <BBB>"
+" <DDD>"
+" <CCC>"
+" <DDD/>"
+" <EEE/>"
+" </CCC>"
+" </DDD>"
+" </BBB>"
+" <CCC>"
+" <DDD>"
+" <EEE>"
+" <DDD>"
+" <FFF/>"
+" </DDD>"
+" </EEE>"
+" </DDD>"
+" </CCC>"
+" </AAA>"
+},
+
+{
+"/AAA/BBB/DDD/CCC/EEE/ancestor::*",
+"Select all elements given in this absolute path",
+" <AAA>"
+" <BBB>"
+" <DDD>"
+" <CCC>"
+" <DDD/>"
+" <EEE/>"
+" </CCC>"
+" </DDD>"
+" </BBB>"
+" <CCC>"
+" <DDD>"
+" <EEE>"
+" <DDD>"
+" <FFF/>"
+" </DDD>"
+" </EEE>"
+" </DDD>"
+" </CCC>"
+" </AAA>"
+},
+
+{
+"//FFF/ancestor::*",
+"Select ancestors of FFF element",
+" <AAA>"
+" <BBB>"
+" <DDD>"
+" <CCC>"
+" <DDD/>"
+" <EEE/>"
+" </CCC>"
+" </DDD>"
+" </BBB>"
+" <CCC>"
+" <DDD>"
+" <EEE>"
+" <DDD>"
+" <FFF/>"
+" </DDD>"
+" </EEE>"
+" </DDD>"
+" </CCC>"
+" </AAA>"
+},
+
+{
+"/AAA/BBB/following-sibling::*",
+"The following-sibling axis contains all the following siblings of the context node.",
+" <AAA>"
+" <BBB>"
+" <CCC/>"
+" <DDD/>"
+" </BBB>"
+" <XXX>"
+" <DDD>"
+" <EEE/>"
+" <DDD/>"
+" <CCC/>"
+" <FFF/>"
+" <FFF>"
+" <GGG/>"
+" </FFF>"
+" </DDD>"
+" </XXX>"
+" <CCC>"
+" <DDD/>"
+" </CCC>"
+" </AAA>"
+},
+
+{
+"//CCC/following-sibling::*",
+"The following-sibling axis contains all the following siblings of the context node.",
+" <AAA>"
+" <BBB>"
+" <CCC/>"
+" <DDD/>"
+" </BBB>"
+" <XXX>"
+" <DDD>"
+" <EEE/>"
+" <DDD/>"
+" <CCC/>"
+" <FFF/>"
+" <FFF>"
+" <GGG/>"
+" </FFF>"
+" </DDD>"
+" </XXX>"
+" <CCC>"
+" <DDD/>"
+" </CCC>"
+" </AAA>"
+},
+
+{
+"/AAA/XXX/preceding-sibling::*",
+"The preceding-sibling axis contains all the preceding siblings of the context node.",
+" <AAA>"
+" <BBB>"
+" <CCC/>"
+" <DDD/>"
+" </BBB>"
+" <XXX>"
+" <DDD>"
+" <EEE/>"
+" <DDD/>"
+" <CCC/>"
+" <FFF/>"
+" <FFF>"
+" <GGG/>"
+" </FFF>"
+" </DDD>"
+" </XXX>"
+" <CCC>"
+" <DDD/>"
+" </CCC>"
+" </AAA>"
+},
+
+{
+"//CCC/preceding-sibling::*",
+" <AAA>"
+" <BBB>"
+" <CCC/>"
+" <DDD/>"
+" </BBB>"
+" <XXX>"
+" <DDD>"
+" <EEE/>"
+" <DDD/>"
+" <CCC/>"
+" <FFF/>"
+" <FFF>"
+" <GGG/>"
+" </FFF>"
+" </DDD>"
+" </XXX>"
+" <CCC>"
+" <DDD/>"
+" </CCC>"
+" </AAA>"
+},
+
+{
+"/AAA/XXX/following::*",
+"Description",
+" <AAA>"
+" <BBB>"
+" <CCC/>"
+" <ZZZ>"
+" <DDD/>"
+" <DDD>"
+" <EEE/>"
+" </DDD>"
+" </ZZZ>"
+" <FFF>"
+" <GGG/>"
+" </FFF>"
+" </BBB>"
+" <XXX>"
+" <DDD>"
+" <EEE/>"
+" <DDD/>"
+" <CCC/>"
+" <FFF/>"
+" <FFF>"
+" <GGG/>"
+" </FFF>"
+" </DDD>"
+" </XXX>"
+" <CCC>"
+" <DDD/>"
+" </CCC>"
+" </AAA>"
+},
+
+{
+"//ZZZ/following::*",
+"Description",
+" <AAA>"
+" <BBB>"
+" <CCC/>"
+" <ZZZ>"
+" <DDD/>"
+" <DDD>"
+" <EEE/>"
+" </DDD>"
+" </ZZZ>"
+" <FFF>"
+" <GGG/>"
+" </FFF>"
+" </BBB>"
+" <XXX>"
+" <DDD>"
+" <EEE/>"
+" <DDD/>"
+" <CCC/>"
+" <FFF/>"
+" <FFF>"
+" <GGG/>"
+" </FFF>"
+" </DDD>"
+" </XXX>"
+" <CCC>"
+" <DDD/>"
+" </CCC>"
+" </AAA>"
+},
+
+{
+"/AAA/XXX/preceding::*",
+"Description",
+" <AAA>"
+" <BBB>"
+" <CCC/>"
+" <ZZZ>"
+" <DDD/>"
+" </ZZZ>"
+" </BBB>"
+" <XXX>"
+" <DDD>"
+" <EEE/>"
+" <DDD/>"
+" <CCC/>"
+" <FFF/>"
+" <FFF>"
+" <GGG/>"
+" </FFF>"
+" </DDD>"
+" </XXX>"
+" <CCC>"
+" <DDD/>"
+" </CCC>"
+" </AAA>"
+},
+
+{
+"//GGG/preceding::*",
+"Description",
+" <AAA>"
+" <BBB>"
+" <CCC/>"
+" <ZZZ>"
+" <DDD/>"
+" </ZZZ>"
+" </BBB>"
+" <XXX>"
+" <DDD>"
+" <EEE/>"
+" <DDD/>"
+" <CCC/>"
+" <FFF/>"
+" <FFF>"
+" <GGG/>"
+" </FFF>"
+" </DDD>"
+" </XXX>"
+" <CCC>"
+" <DDD/>"
+" </CCC>"
+" </AAA>"
+},
+
+{
+"/AAA/XXX/descendant-or-self::*",
+"Description",
+" <AAA>"
+" <BBB>"
+" <CCC/>"
+" <ZZZ>"
+" <DDD/>"
+" </ZZZ>"
+" </BBB>"
+" <XXX>"
+" <DDD>"
+" <EEE/>"
+" <DDD/>"
+" <CCC/>"
+" <FFF/>"
+" <FFF>"
+" <GGG/>"
+" </FFF>"
+" </DDD>"
+" </XXX>"
+" <CCC>"
+" <DDD/>"
+" </CCC>"
+" </AAA>"
+},
+
+{
+"//CCC/descendant-or-self::*",
+"Description",
+" <AAA>"
+" <BBB>"
+" <CCC/>"
+" <ZZZ>"
+" <DDD/>"
+" </ZZZ>"
+" </BBB>"
+" <XXX>"
+" <DDD>"
+" <EEE/>"
+" <DDD/>"
+" <CCC/>"
+" <FFF/>"
+" <FFF>"
+" <GGG/>"
+" </FFF>"
+" </DDD>"
+" </XXX>"
+" <CCC>"
+" <DDD/>"
+" </CCC>"
+" </AAA>"
+},
+
+{
+"/AAA/XXX/DDD/EEE/ancestor-or-self::*",
+"Description",
+" <AAA>"
+" <BBB>"
+" <CCC/>"
+" <ZZZ>"
+" <DDD/>"
+" </ZZZ>"
+" </BBB>"
+" <XXX>"
+" <DDD>"
+" <EEE/>"
+" <DDD/>"
+" <CCC/>"
+" <FFF/>"
+" <FFF>"
+" <GGG/>"
+" </FFF>"
+" </DDD>"
+" </XXX>"
+" <CCC>"
+" <DDD/>"
+" </CCC>"
+" </AAA>"
+},
+
+{
+"//GGG/ancestor-or-self::*",
+"Description",
+" <AAA>"
+" <BBB>"
+" <CCC/>"
+" <ZZZ>"
+" <DDD/>"
+" </ZZZ>"
+" </BBB>"
+" <XXX>"
+" <DDD>"
+" <EEE/>"
+" <DDD/>"
+" <CCC/>"
+" <FFF/>"
+" <FFF>"
+" <GGG/>"
+" </FFF>"
+" </DDD>"
+" </XXX>"
+" <CCC>"
+" <DDD/>"
+" </CCC>"
+" </AAA>"
+},
+
+{
+"//GGG/ancestor::*",
+"Description",
+" <AAA>"
+" <BBB>"
+" <CCC/>"
+" <ZZZ/>"
+" </BBB>"
+" <XXX>"
+" <DDD>"
+" <EEE/>"
+" <FFF>"
+" <HHH/>"
+" <GGG>"
+" <JJJ>"
+" <QQQ/>"
+" </JJJ>"
+" <JJJ/>"
+" </GGG>"
+" <HHH/>"
+" </FFF>"
+" </DDD>"
+" </XXX>"
+" <CCC>"
+" <DDD/>"
+" </CCC>"
+" </AAA>"
+},
+
+{
+"//GGG/descendant::*",
+"Description",
+" <AAA>"
+" <BBB>"
+" <CCC/>"
+" <ZZZ/>"
+" </BBB>"
+" <XXX>"
+" <DDD>"
+" <EEE/>"
+" <FFF>"
+" <HHH/>"
+" <GGG>"
+" <JJJ>"
+" <QQQ/>"
+" </JJJ>"
+" <JJJ/>"
+" </GGG>"
+" <HHH/>"
+" </FFF>"
+" </DDD>"
+" </XXX>"
+" <CCC>"
+" <DDD/>"
+" </CCC>"
+" </AAA>"
+},
+
+{
+"//GGG/following::*",
+"Description",
+" <AAA>"
+" <BBB>"
+" <CCC/>"
+" <ZZZ/>"
+" </BBB>"
+" <XXX>"
+" <DDD>"
+" <EEE/>"
+" <FFF>"
+" <HHH/>"
+" <GGG>"
+" <JJJ>"
+" <QQQ/>"
+" </JJJ>"
+" <JJJ/>"
+" </GGG>"
+" <HHH/>"
+" </FFF>"
+" </DDD>"
+" </XXX>"
+" <CCC>"
+" <DDD/>"
+" </CCC>"
+" </AAA>"
+},
+
+{
+"//GGG/preceding::*",
+"Description",
+" <AAA>"
+" <BBB>"
+" <CCC/>"
+" <ZZZ/>"
+" </BBB>"
+" <XXX>"
+" <DDD>"
+" <EEE/>"
+" <FFF>"
+" <HHH/>"
+" <GGG>"
+" <JJJ>"
+" <QQQ/>"
+" </JJJ>"
+" <JJJ/>"
+" </GGG>"
+" <HHH/>"
+" </FFF>"
+" </DDD>"
+" </XXX>"
+" <CCC>"
+" <DDD/>"
+" </CCC>"
+" </AAA>"
+},
+
+{
+"//GGG/self::*",
+"Description",
+" <AAA>"
+" <BBB>"
+" <CCC/>"
+" <ZZZ/>"
+" </BBB>"
+" <XXX>"
+" <DDD>"
+" <EEE/>"
+" <FFF>"
+" <HHH/>"
+" <GGG>"
+" <JJJ>"
+" <QQQ/>"
+" </JJJ>"
+" <JJJ/>"
+" </GGG>"
+" <HHH/>"
+" </FFF>"
+" </DDD>"
+" </XXX>"
+" <CCC>"
+" <DDD/>"
+" </CCC>"
+" </AAA>"
+},
+
+{
+"//GGG/ancestor::* | //GGG/descendant::* | //GGG/following::* | //GGG/preceding::* | //GGG/self::*",
+"description",
+" <AAA>"
+" <BBB>"
+" <CCC/>"
+" <ZZZ/>"
+" </BBB>"
+" <XXX>"
+" <DDD>"
+" <EEE/>"
+" <FFF>"
+" <HHH/>"
+" <GGG>"
+" <JJJ>"
+" <QQQ/>"
+" </JJJ>"
+" <JJJ/>"
+" </GGG>"
+" <HHH/>"
+" </FFF>"
+" </DDD>"
+" </XXX>"
+" <CCC>"
+" <DDD/>"
+" </CCC>"
+" </AAA>"
+},
+
+{
+"//BBB[position() mod 2 = 0 ]",
+"Select even BBB elements",
+" <AAA>"
+" <BBB/>"
+" <BBB/>"
+" <BBB/>"
+" <BBB/>"
+" <BBB/>"
+" <BBB/>"
+" <BBB/>"
+" <BBB/>"
+" <CCC/>"
+" <CCC/>"
+" <CCC/>"
+" </AAA>"
+},
+
+{
+"//BBB[ position() = floor(last() div 2 + 0.5) or position() = ceiling(last() div 2 + 0.5) ]",
+"Select middle BBB element(s)",
+" <AAA>"
+" <BBB/>"
+" <BBB/>"
+" <BBB/>"
+" <BBB/>"
+" <BBB/>"
+" <BBB/>"
+" <BBB/>"
+" <BBB/>"
+" <CCC/>"
+" <CCC/>"
+" <CCC/>"
+" </AAA>"
+},
+
+{
+"//CCC[ position() = floor(last() div 2 + 0.5) or position() = ceiling(last() div 2 + 0.5) ]",
+"Select middle CCC element(s)",
+" <AAA>"
+" <BBB/>"
+" <BBB/>"
+" <BBB/>"
+" <BBB/>"
+" <BBB/>"
+" <BBB/>"
+" <BBB/>"
+" <BBB/>"
+" <CCC/>"
+" <CCC/>"
+" <CCC/>"
+" </AAA>"
+}
+
+}; //end
+
+
diff --git a/src/dom/xmlreader.cpp b/src/dom/xmlreader.cpp
index c36eec961..fbacf48f4 100644
--- a/src/dom/xmlreader.cpp
+++ b/src/dom/xmlreader.cpp
@@ -1,987 +1,987 @@
-/**
- * Phoebe DOM Implementation.
- *
- * This is a C++ approximation of the W3C DOM model, which follows
- * fairly closely the specifications in the various .idl files, copies of
- * which are provided for reference. Most important is this one:
- *
- * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
- *
- * Authors:
- * Bob Jamison
- *
- * Copyright (C) 2005 Bob Jamison
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-
-#include "xmlreader.h"
-#include "charclass.h"
-#include "domimpl.h"
-#include "svg/svgimpl.h"
-
-#include <stdio.h>
-#include <stdarg.h>
-
-namespace org
-{
-namespace w3c
-{
-namespace dom
-{
-
-
-//#########################################################################
-//# E N T I T Y T A B L E
-//#########################################################################
-struct EntityInfo
-{
- char *escape;
- int escapeLength;
- char *value;
-};
-
-
-static EntityInfo entityTable[] =
-{
- { "&amp;" , 5 , "&" },
- { "&lt;" , 4 , "<" },
- { "&gt;" , 4 , ">" },
- { "&apos;" , 6 , "'" },
- { "&quot;" , 6 , "\"" },
- { NULL , 0 , "\0" }
-};
-
-
-
-//#########################################################################
-//# M E S S A G E S
-//#########################################################################
-
-
-/**
- *
- */
-void XmlReader::error(char *fmt, ...)
-{
- va_list args;
- fprintf(stderr, "XmlReader:error at line %d, column %d:", lineNr, colNr);
- va_start(args, fmt);
- vfprintf(stderr, fmt, args);
- va_end(args) ;
- fprintf(stderr, "\n");
-}
-
-
-
-//#########################################################################
-//# U T I L I T Y
-//#########################################################################
-
-static void trim(DOMString &str)
-{
- int len = str.size();
- if (len<1)
- return;
-
- int start = 0;
- int end = 0;
- for (start=0 ; start<len ; start++)
- {
- int ch = str[start];
- if (ch<=' ' || ch>126)
- break;
- }
- for (end=len-1 ; end>=0 ; end--)
- {
- int ch = str[end];
- if (ch<=' ' || ch>126)
- break;
- }
- if (start<end)
- {
- str = str.substr(start, end+1);
- }
-}
-
-//#########################################################################
-//# P A R S I N G
-//#########################################################################
-
-/**
- * Get the character at the position and record the fact
- */
-int XmlReader::get(int p)
-{
- if (p >= len)
- return -1;
- int ch = parsebuf[p];
- //printf("%c", ch);
- if (ch == '\n' || ch == '\r')
- {
- colNr = 0;
- lineNr++;
- }
- else
- colNr++;
- return ch;
-}
-
-/**
- * Look at the character at the position, but don't note the fact
- */
-int XmlReader::peek(int p)
-{
- if (p >= len)
- return -1;
- int ch = parsebuf[p];
- return ch;
-}
-
-
-/**
- * Test if the given substring exists at the given position
- * in parsebuf. Use peek() in case of out-of-bounds
- */
-bool XmlReader::match(int pos, char *str)
-{
- while (*str)
- {
- if (peek(pos++) != *str++)
- return false;
- }
- return true;
-}
-
-
-
-/**
- * Test if the given substring exists at the given position
- * in a given buffer
- */
-/*
-static bool bufMatch(const DOMString &buf, int pos, char *str)
-{
- while (*str)
- {
- if (buf[pos++] != *str++)
- return false;
- }
- return true;
-}
-*/
-
-
-/**
- *
- */
-int XmlReader::skipwhite(int p)
-{
- while (p < len)
- {
- int b = get(p);
- if (!isWhitespace(b))
- break;
- p++;
- }
- return p;
-}
-
-/**
- * modify this to allow all chars for an element or attribute name
- */
-int XmlReader::getWord(int p, DOMString &result)
-{
- while (p<len)
- {
- int b = get(p);
- if (b<=' ' || b=='/' || b=='>' || b=='=')
- break;
- result.push_back((XMLCh)b);
- p++;
- }
- return p;
-}
-
-/**
- * get a name and prefix, if any
- */
-int XmlReader::getPrefixedWord(int p, DOMString &prefix,
- DOMString &shortWord, DOMString &fullWord)
-{
- while (p<len)
- {
- int b = get(p);
- if (b<=' ' || b=='/' || b=='>' || b=='=')
- break;
- else if (b == ':')
- {
- prefix = shortWord;
- shortWord = "";
- }
- else
- shortWord.push_back((XMLCh)b);
- p++;
- }
- if (prefix.size() > 0)
- fullWord = prefix + ":" + shortWord;
- else
- fullWord = shortWord;
- return p;
-}
-
-
-/**
- * Assume that we are starting on a quote. Ends on the char
- * after the final '"'
- */
-int XmlReader::getQuoted(int p0, DOMString &result)
-{
-
- int p = p0;
-
- if (peek(p)!='"' && peek(p)!='\'')
- return p0;
-
- int b = get(p++); //go to next char
-
- DOMString buf;
-
- while (p<len )
- {
- b = get(p++);
- if (b=='"' || b=='\'')
- break;
- else if (b=='&')
- {
- p = parseEntity(p, result);
- if (p < 0)
- return p0;
- }
- else
- {
- buf.push_back((XMLCh)b);
- }
- }
-
- //printf("quoted text:'%s'\n", buf.c_str());
-
- result.append(buf);
-
- return p;
-}
-
-
-
-/**
- * Parse a <!xml> tag. Node may be null. Assumes current char is '<'
- * ends on char after '>'
- */
-int XmlReader::parseVersion(int p0)
-{
- int p = p0;
-
- if (!match(p, "<?xml"))
- return p0;
-
- p += 5;
- colNr += 5;
-
- bool quickCloseDummy;
- Node *node = new NodeImpl();
- int p2 = parseAttributes(p, node, &quickCloseDummy);
- if (p2 < p)
- {
- delete node;
- return p0;
- }
- p = p2;
-
- //get the attributes that we need
- NamedNodeMap attributes = node->getAttributes();
- Node *attr = attributes.getNamedItem("version");
- if (attr)
- document->setXmlVersion(attr->getNodeValue());
- attr = attributes.getNamedItem("encoding");
- if (attr)
- { /*document->setXmlEncoding(attr->getNodeValue());*/ }
- attr = attributes.getNamedItem("standalone");
- if (attr)
- document->setXmlStandalone((attr->getNodeValue() == "yes"));
- delete node;
-
- //#now we should be pointing at '?>'
- if (!match(p, "?>"))
- {
- return p0;
- }
-
- //skip over '?>'
- get(p++);
- get(p++);
-
- return p;
-}
-
-
-/**
- * Parse a <!DOCTYPE> tag. doctype may be null. Expects '<'
- * on start. Ends pointing at char after '>'
- */
-int XmlReader::parseDoctype(int p0)
-{
- int p = p0;
-
- if (!match(p, "<!DOCTYPE"))
- return p0;
-
- p += 9;
- colNr += 9;
-
- DocumentType *doctype = document->getDoctype();
- if (!doctype)
- return p0;
-
-
- //### get the root name of the document
- p = skipwhite(p);
- DOMString rootName;
- int p2 = getWord(p, rootName);
- if (p2 <= p)
- return p0;
- p = p2;
- //printf("doctype root '%s'\n", rootName.c_str());
-
-
- while (p < len)
- {
- p = skipwhite(p);
- if (peek(p) == '>')
- break;
- else if (peek(p) == '[') //just ignore 'internal' [] stuff
- {
- while (p < len)
- {
- int ch = get(p++);
- if (ch == ']')
- break;
- }
- p++;
- }
- else if (match(p, "PUBLIC"))
- {
- p += 6;
- colNr += 6;
- p = skipwhite(p);
- DOMString pubIdLiteral;
- int p2 = getQuoted(p, pubIdLiteral);
- if (p2 <= p)
- return p0;
- p = p2;
- p = skipwhite(p);
- DOMString systemLiteral;
- p2 = getQuoted(p, systemLiteral);
- if (p2 <= p)
- return p0;
- p = p2;
- //printf("PUBLIC \"%s\" \"%s\" \n",
- // pubIdLiteral.c_str(), systemLiteral.c_str());
- }
- else if (match(p, "SYSTEM"))
- {
- p += 6;
- colNr += 6;
- p = skipwhite(p);
- DOMString systemLiteral;
- int p2 = getQuoted(p, systemLiteral);
- if (p2 <= p)
- return p0;
- p = p2;
- //printf("SYSTEM \"%s\" \n", systemLiteral.c_str());
- }
- }
-
-
- //skip over '>'
- get(p++);
-
- return p;
-}
-
-
-
-/**
- * Expects '<' on startup, ends on char after '>'
- */
-int XmlReader::parseComment(int p0, Comment *comment)
-{
- int p = p0;
-
- if (!match(p, "<!--"))
- return p0;
-
- colNr += 4;
- p += 4;
-
- DOMString buf;
-
- while (p<len-3)
- {
- if (match(p, "-->"))
- {
- p += 3;
- colNr += 3;
- break;
- }
- int ch = get(p++);
- buf.push_back((XMLCh)ch);
- }
-
- comment->setNodeValue(buf);
-
- return p;
-}
-
-
-
-/**
- *
- */
-int XmlReader::parseCDATA(int p0, CDATASection *cdata)
-{
-
- int p = p0;
-
- if (!match(p, "<![CDATA["))
- return p0;
-
- colNr += 9;
- p += 9;
-
- DOMString buf;
-
- while (p<len)
- {
- if (match(p, "]]>"))
- {
- p +=3;
- colNr += 3;
- break;
- }
- int ch = get(p++);
- buf.push_back((XMLCh)ch);
- }
-
- /*printf("Got CDATA:%s\n",buf.c_str());*/
- cdata->setNodeValue(buf);
-
- return p;
-}
-
-
-
-/**
- *
- */
-int XmlReader::parseText(int p0, Text *text)
-{
-
- int p = p0;
-
- DOMString buf;
-
- while (p<len)
- {
- if (peek(p) == '&')
- {
- p = parseEntity(p, buf);
- if (p < 0) //error?
- return p0;
- }
- else if (peek(p) == '<')
- {
- break;
- }
- else
- {
- int ch = get(p++);
- buf.push_back((XMLCh)ch);
- }
- }
-
- /*printf("Got Text:%s\n",buf.c_str());*/
- text->setNodeValue(buf);
-
- return p;
-}
-
-
-
-
-
-/**
- * Parses attributes of a node. Should end pointing at either the
- * '?' of a version or doctype tag, or a '>' of a normal tag
- */
-int XmlReader::parseAttributes(int p0, Node *node, bool *quickClose)
-{
- *quickClose = false;
-
- int p = p0;
-
- NamedNodeMap attributes;
-
- while (p<len)
- {
- /*printf("ch:%c\n",ch);*/
- p = skipwhite(p);
- int ch = get(p);
-
- /*printf("ch:%c\n",ch);*/
- if (ch == '?' || ch == '>')//done
- break;
- else if (ch=='/' && p<len+1)
- {
- p++;
- p = skipwhite(p);
- ch = peek(p);
- if (ch == '>')
- {
- p++;
- *quickClose = true;
- /*printf("quick close\n");*/
- return p;
- }
- }
- DOMString shortName;
- DOMString prefix;
- DOMString qualifiedName;
- int p2 = getPrefixedWord(p, prefix, shortName, qualifiedName);
- if (p2 <= p)
- break;
-
- /*printf("name:%s",buf);*/
- p = p2;
- p = skipwhite(p);
- ch = get(p);
- /*printf("ch:%c\n",ch);*/
- if (ch != '=')
- break;
- p++;
- p = skipwhite(p);
- /*ch = parsebuf[p];*/
- /*printf("ch:%c\n",ch);*/
- DOMString attrValue;
- p2 = getQuoted(p, attrValue);
- p = p2;
- /*printf("name:'%s' value:'%s'\n",buf,buf2);*/
-
- DOMString namespaceURI = "";
- if (prefix == "xmlns" || shortName == "xmlns")
- namespaceURI = XMLNSNAME;
-
- //## Now let us make the attribute and give it to the node
- Attr *attr = document->createAttributeNS(namespaceURI, qualifiedName);
- attr->setValue(attrValue);
- node->getAttributes().setNamedItemNS(attr);
-
- }//while p<len
-
- return p;
-}
-
-/**
- * Appends the value of an entity to the buffer
- */
-int XmlReader::parseEntity(int p0, DOMString &buf)
-{
- int p = p0;
- for (EntityInfo *info = entityTable ; info->escape ; info++)
- {
- if (match(p, info->escape))
- {
- p += info->escapeLength;
- colNr += info->escapeLength;
- buf += info->value;
- return p;
- }
- }
-
- error("unterminated entity");
- return -1;
-}
-
-
-//#########################################################################
-//# P A R S E A N O D E
-//#########################################################################
-
-/**
- * Parse as a document, preserving the original structure as much as
- * possible
- */
-int XmlReader::parseNode(int p0, Node *node, int depth)
-{
-
- int p = p0;
-
-
- //### OPEN TAG
- int ch = get(p++);
- if (ch != '<')
- return p0;
-
- p = skipwhite(p);
- DOMString openTagName;
- DOMString openTagNamePrefix;
- DOMString openTagQualifiedName;
- int p2 = getPrefixedWord(p,openTagNamePrefix,
- openTagName, openTagQualifiedName);
- if (p2 <= p)
- return p0;
- p = p2;
- p = skipwhite(p);
-
- //printf("qualifiedName:%s\n", openTagQualifiedName.c_str());
- DOMString namespaceURI = node->lookupNamespaceURI(openTagNamePrefix);
- document->renameNode(node, namespaceURI, openTagQualifiedName);
-
- //### ATTRIBUTES
- bool quickClose;
- p = parseAttributes(p, node, &quickClose);
- if (quickClose) //trivial tag: <name/>
- return p;
-
- p++; //skip over '>'
-
-
- DOMString nodeValue;
-
- /* ### Get intervening data ### */
- while (p<len && keepGoing)
- {
- //### COMMENT
- if (match(p, "<!--"))
- {
- Comment *comment = document->createComment("");
- p2 = parseComment(p, comment);
- if (p2 <= p)
- return p0;
- p = p2;
- if (parseAsData)
- { //throw away
- delete comment;
- }
- else
- {
- node->appendChild(comment);
- }
- }
- //### VERSION
- else if (match(p, "<?xml"))
- {
- p2 = parseVersion(p);
- if (p2 <= p)
- return p0;
- }
- //### DOCTYPE
- else if (match(p, "<!DOCTYPE"))
- {
- p2 = parseDoctype(p);
- if (p2 <= p)
- return p0;
- }
- //### CDATA
- else if (match(p, "<![CDATA["))
- {
- CDATASection *cdata = document->createCDATASection("");
- p2 = parseCDATA(p, cdata);
- if (p2 <= p)
- return p0;
- p = p2;
- if (parseAsData)
- {
- nodeValue += cdata->getNodeValue();
- delete cdata;
- }
- else
- {
- node->appendChild(cdata);
- }
- }
- //### OPEN OR CLOSE TAG
- else if (peek(p) == '<')
- {
- p2 = skipwhite(p+1);
- if (peek(p2) =='/')
- {
- p = p2;
- break;
- }
- else
- {
- /*Add element to tree*/
- Element *elem = document->createElement(""); //fill in name later
- node->appendChild(elem);
- p2 = parseNode(p, elem, depth+1);
- if (p2 <= p)
- {
- /*printf("problem on element:%ls. p2:%d p:%d\n",n->name, p2, p);*/
- return p0;
- }
- p = p2;
- }
- }
- //### TEXT
- else
- {
- Text *text = document->createTextNode("");
- p2 = parseText(p, text);
- if (p2 <= p)
- return p0;
- p = p2;
- if (parseAsData)
- {
- nodeValue += text->getNodeValue();
- delete text;
- }
- else
- {
- node->appendChild(text);
- }
- }
-
- }//while (p<len)
-
- //printf("%d : nodeValue:'%s'\n", p, nodeValue.c_str());
- trim(nodeValue);
- node->setNodeValue(nodeValue);
-
- //### get close tag. we should be pointing at '/'
- p = skipwhite(p);
- ch = get(p);
- if (ch != '/')
- {
- error("no / on end tag");
- return p0;
- }
- p++;
-
- //### get word after '/'
- p = skipwhite(p);
- DOMString closeTagName;
- DOMString closeTagNamePrefix;
- DOMString closeTagQualifiedName;
- p = getPrefixedWord(p, closeTagNamePrefix, closeTagName,
- closeTagQualifiedName);
- if (openTagQualifiedName != closeTagQualifiedName)
- {
- error("Mismatched closing tag. Expected </%S>. Got '%S'.",
- openTagQualifiedName.c_str(), closeTagQualifiedName.c_str());
- return p0;
- }
- p = skipwhite(p);
- if (parsebuf[p] != '>')
- {
- error("no > on end tag");
- return p0;
- }
- p++;
- /*printf("close element:%ls\n",buf);*/
- return p;
-}
-
-
-/**
- *
- */
-org::w3c::dom::Document *
-XmlReader::parse(const DOMString &buf, int bufferOffset, int parseLen)
-{
- len = parseLen;
- parsebuf = buf;
-
- DOMImplementationSourceImpl source;
- DOMImplementation *domImpl = source.getDOMImplementation("");
-
- keepGoing = true;
-
- document = domImpl->createDocument("", "", NULL);
- //document = new svg::SVGDocumentImpl(domImpl, "", "", NULL);
-
- int p = bufferOffset;
- int p2 = 0;
-
- while (p<len && keepGoing)
- {
- p = skipwhite(p);
- //### COMMENT
- if (match(p, "<!--"))
- {
- Comment *comment = document->createComment("");
- p2 = parseComment(p, comment);
- if (p2 <= p)
- return document;
- p = p2;
- if (parseAsData)
- { //throw away
- delete comment;
- }
- else
- {
- document->appendChild(comment);
- }
- }
- //### VERSION
- else if (match(p, "<?xml"))
- {
- p2 = parseVersion(p);
- if (p2 <= p)
- return document;
- p = p2;
- }
- //### DOCTYPE
- else if (match(p, "<!DOCTYPE"))
- {
- p2 = parseDoctype(p);
- if (p2 <= p)
- return document;
- p = p2;
- }
- else
- {
- break;
- }
- }
-
- p = skipwhite(p);
- p = parseNode(p, document->getDocumentElement(), 0);
-
- keepGoing = false;
-
- return document;
-}
-
-
-/**
- *
- */
-org::w3c::dom::Document *
-XmlReader::parse(const DOMString &str)
-{
-
- Document *doc = parse(str, 0, str.size());
- doc->normalizeDocument();
-
- return doc;
-}
-
-/**
- *
- */
-org::w3c::dom::Document *
-XmlReader::parseFile(char *fileName)
-{
-
- DOMString buf = loadFile(fileName);
-
- Document *doc = parse(buf, 0, buf.size());
-
- return doc;
-}
-
-
-
-//#########################################################################
-//# S T R E A M R E A D I N G
-//#########################################################################
-
-/**
- *
- */
-org::w3c::dom::DOMString
-XmlReader::loadFile(char *fileName)
-{
-
- if (!fileName)
- return NULL;
- FILE *f = fopen(fileName, "rb");
- if (!f)
- return NULL;
-
- DOMString buf;
- while (!feof(f))
- {
- int ch = fgetc(f);
- if (ch<0)
- break;
- buf.push_back((XMLCh)ch);
- }
- fclose(f);
-
- return buf;
-}
-
-
-//#########################################################################
-//# C O N S T R U C T O R / D E S T R U C T O R
-//#########################################################################
-
-
-/**
- *
- */
-XmlReader::XmlReader()
-{
- len = 0;
- lineNr = 1;
- colNr = 0;
- parseAsData = false;
- keepGoing = false;
-}
-
-/**
- *
- */
-XmlReader::XmlReader(bool parseAsDataArg)
-{
- len = 0;
- lineNr = 1;
- colNr = 0;
- parseAsData = parseAsDataArg;
- keepGoing = false;
-}
-
-
-
-/**
- *
- */
-XmlReader::~XmlReader()
-{
-}
-
-
-} //namespace dom
-} //namespace w3c
-} //namespace org
-
-
-//#########################################################################
-//# E N D O F F I L E
-//#########################################################################
-
+/**
+ * Phoebe DOM Implementation.
+ *
+ * This is a C++ approximation of the W3C DOM model, which follows
+ * fairly closely the specifications in the various .idl files, copies of
+ * which are provided for reference. Most important is this one:
+ *
+ * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
+ *
+ * Authors:
+ * Bob Jamison
+ *
+ * Copyright (C) 2005 Bob Jamison
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+
+#include "xmlreader.h"
+#include "charclass.h"
+#include "domimpl.h"
+#include "svg/svgimpl.h"
+
+#include <stdio.h>
+#include <stdarg.h>
+
+namespace org
+{
+namespace w3c
+{
+namespace dom
+{
+
+
+//#########################################################################
+//# E N T I T Y T A B L E
+//#########################################################################
+struct EntityInfo
+{
+ char *escape;
+ int escapeLength;
+ char *value;
+};
+
+
+static EntityInfo entityTable[] =
+{
+ { "&amp;" , 5 , "&" },
+ { "&lt;" , 4 , "<" },
+ { "&gt;" , 4 , ">" },
+ { "&apos;" , 6 , "'" },
+ { "&quot;" , 6 , "\"" },
+ { NULL , 0 , "\0" }
+};
+
+
+
+//#########################################################################
+//# M E S S A G E S
+//#########################################################################
+
+
+/**
+ *
+ */
+void XmlReader::error(char *fmt, ...)
+{
+ va_list args;
+ fprintf(stderr, "XmlReader:error at line %d, column %d:", lineNr, colNr);
+ va_start(args, fmt);
+ vfprintf(stderr, fmt, args);
+ va_end(args) ;
+ fprintf(stderr, "\n");
+}
+
+
+
+//#########################################################################
+//# U T I L I T Y
+//#########################################################################
+
+static void trim(DOMString &str)
+{
+ int len = str.size();
+ if (len<1)
+ return;
+
+ int start = 0;
+ int end = 0;
+ for (start=0 ; start<len ; start++)
+ {
+ int ch = str[start];
+ if (ch<=' ' || ch>126)
+ break;
+ }
+ for (end=len-1 ; end>=0 ; end--)
+ {
+ int ch = str[end];
+ if (ch<=' ' || ch>126)
+ break;
+ }
+ if (start<end)
+ {
+ str = str.substr(start, end+1);
+ }
+}
+
+//#########################################################################
+//# P A R S I N G
+//#########################################################################
+
+/**
+ * Get the character at the position and record the fact
+ */
+int XmlReader::get(int p)
+{
+ if (p >= len)
+ return -1;
+ int ch = parsebuf[p];
+ //printf("%c", ch);
+ if (ch == '\n' || ch == '\r')
+ {
+ colNr = 0;
+ lineNr++;
+ }
+ else
+ colNr++;
+ return ch;
+}
+
+/**
+ * Look at the character at the position, but don't note the fact
+ */
+int XmlReader::peek(int p)
+{
+ if (p >= len)
+ return -1;
+ int ch = parsebuf[p];
+ return ch;
+}
+
+
+/**
+ * Test if the given substring exists at the given position
+ * in parsebuf. Use peek() in case of out-of-bounds
+ */
+bool XmlReader::match(int pos, char *str)
+{
+ while (*str)
+ {
+ if (peek(pos++) != *str++)
+ return false;
+ }
+ return true;
+}
+
+
+
+/**
+ * Test if the given substring exists at the given position
+ * in a given buffer
+ */
+/*
+static bool bufMatch(const DOMString &buf, int pos, char *str)
+{
+ while (*str)
+ {
+ if (buf[pos++] != *str++)
+ return false;
+ }
+ return true;
+}
+*/
+
+
+/**
+ *
+ */
+int XmlReader::skipwhite(int p)
+{
+ while (p < len)
+ {
+ int b = get(p);
+ if (!isWhitespace(b))
+ break;
+ p++;
+ }
+ return p;
+}
+
+/**
+ * modify this to allow all chars for an element or attribute name
+ */
+int XmlReader::getWord(int p, DOMString &result)
+{
+ while (p<len)
+ {
+ int b = get(p);
+ if (b<=' ' || b=='/' || b=='>' || b=='=')
+ break;
+ result.push_back((XMLCh)b);
+ p++;
+ }
+ return p;
+}
+
+/**
+ * get a name and prefix, if any
+ */
+int XmlReader::getPrefixedWord(int p, DOMString &prefix,
+ DOMString &shortWord, DOMString &fullWord)
+{
+ while (p<len)
+ {
+ int b = get(p);
+ if (b<=' ' || b=='/' || b=='>' || b=='=')
+ break;
+ else if (b == ':')
+ {
+ prefix = shortWord;
+ shortWord = "";
+ }
+ else
+ shortWord.push_back((XMLCh)b);
+ p++;
+ }
+ if (prefix.size() > 0)
+ fullWord = prefix + ":" + shortWord;
+ else
+ fullWord = shortWord;
+ return p;
+}
+
+
+/**
+ * Assume that we are starting on a quote. Ends on the char
+ * after the final '"'
+ */
+int XmlReader::getQuoted(int p0, DOMString &result)
+{
+
+ int p = p0;
+
+ if (peek(p)!='"' && peek(p)!='\'')
+ return p0;
+
+ int b = get(p++); //go to next char
+
+ DOMString buf;
+
+ while (p<len )
+ {
+ b = get(p++);
+ if (b=='"' || b=='\'')
+ break;
+ else if (b=='&')
+ {
+ p = parseEntity(p, result);
+ if (p < 0)
+ return p0;
+ }
+ else
+ {
+ buf.push_back((XMLCh)b);
+ }
+ }
+
+ //printf("quoted text:'%s'\n", buf.c_str());
+
+ result.append(buf);
+
+ return p;
+}
+
+
+
+/**
+ * Parse a <!xml> tag. Node may be null. Assumes current char is '<'
+ * ends on char after '>'
+ */
+int XmlReader::parseVersion(int p0)
+{
+ int p = p0;
+
+ if (!match(p, "<?xml"))
+ return p0;
+
+ p += 5;
+ colNr += 5;
+
+ bool quickCloseDummy;
+ Node *node = new NodeImpl();
+ int p2 = parseAttributes(p, node, &quickCloseDummy);
+ if (p2 < p)
+ {
+ delete node;
+ return p0;
+ }
+ p = p2;
+
+ //get the attributes that we need
+ NamedNodeMap attributes = node->getAttributes();
+ Node *attr = attributes.getNamedItem("version");
+ if (attr)
+ document->setXmlVersion(attr->getNodeValue());
+ attr = attributes.getNamedItem("encoding");
+ if (attr)
+ { /*document->setXmlEncoding(attr->getNodeValue());*/ }
+ attr = attributes.getNamedItem("standalone");
+ if (attr)
+ document->setXmlStandalone((attr->getNodeValue() == "yes"));
+ delete node;
+
+ //#now we should be pointing at '?>'
+ if (!match(p, "?>"))
+ {
+ return p0;
+ }
+
+ //skip over '?>'
+ get(p++);
+ get(p++);
+
+ return p;
+}
+
+
+/**
+ * Parse a <!DOCTYPE> tag. doctype may be null. Expects '<'
+ * on start. Ends pointing at char after '>'
+ */
+int XmlReader::parseDoctype(int p0)
+{
+ int p = p0;
+
+ if (!match(p, "<!DOCTYPE"))
+ return p0;
+
+ p += 9;
+ colNr += 9;
+
+ DocumentType *doctype = document->getDoctype();
+ if (!doctype)
+ return p0;
+
+
+ //### get the root name of the document
+ p = skipwhite(p);
+ DOMString rootName;
+ int p2 = getWord(p, rootName);
+ if (p2 <= p)
+ return p0;
+ p = p2;
+ //printf("doctype root '%s'\n", rootName.c_str());
+
+
+ while (p < len)
+ {
+ p = skipwhite(p);
+ if (peek(p) == '>')
+ break;
+ else if (peek(p) == '[') //just ignore 'internal' [] stuff
+ {
+ while (p < len)
+ {
+ int ch = get(p++);
+ if (ch == ']')
+ break;
+ }
+ p++;
+ }
+ else if (match(p, "PUBLIC"))
+ {
+ p += 6;
+ colNr += 6;
+ p = skipwhite(p);
+ DOMString pubIdLiteral;
+ int p2 = getQuoted(p, pubIdLiteral);
+ if (p2 <= p)
+ return p0;
+ p = p2;
+ p = skipwhite(p);
+ DOMString systemLiteral;
+ p2 = getQuoted(p, systemLiteral);
+ if (p2 <= p)
+ return p0;
+ p = p2;
+ //printf("PUBLIC \"%s\" \"%s\" \n",
+ // pubIdLiteral.c_str(), systemLiteral.c_str());
+ }
+ else if (match(p, "SYSTEM"))
+ {
+ p += 6;
+ colNr += 6;
+ p = skipwhite(p);
+ DOMString systemLiteral;
+ int p2 = getQuoted(p, systemLiteral);
+ if (p2 <= p)
+ return p0;
+ p = p2;
+ //printf("SYSTEM \"%s\" \n", systemLiteral.c_str());
+ }
+ }
+
+
+ //skip over '>'
+ get(p++);
+
+ return p;
+}
+
+
+
+/**
+ * Expects '<' on startup, ends on char after '>'
+ */
+int XmlReader::parseComment(int p0, Comment *comment)
+{
+ int p = p0;
+
+ if (!match(p, "<!--"))
+ return p0;
+
+ colNr += 4;
+ p += 4;
+
+ DOMString buf;
+
+ while (p<len-3)
+ {
+ if (match(p, "-->"))
+ {
+ p += 3;
+ colNr += 3;
+ break;
+ }
+ int ch = get(p++);
+ buf.push_back((XMLCh)ch);
+ }
+
+ comment->setNodeValue(buf);
+
+ return p;
+}
+
+
+
+/**
+ *
+ */
+int XmlReader::parseCDATA(int p0, CDATASection *cdata)
+{
+
+ int p = p0;
+
+ if (!match(p, "<![CDATA["))
+ return p0;
+
+ colNr += 9;
+ p += 9;
+
+ DOMString buf;
+
+ while (p<len)
+ {
+ if (match(p, "]]>"))
+ {
+ p +=3;
+ colNr += 3;
+ break;
+ }
+ int ch = get(p++);
+ buf.push_back((XMLCh)ch);
+ }
+
+ /*printf("Got CDATA:%s\n",buf.c_str());*/
+ cdata->setNodeValue(buf);
+
+ return p;
+}
+
+
+
+/**
+ *
+ */
+int XmlReader::parseText(int p0, Text *text)
+{
+
+ int p = p0;
+
+ DOMString buf;
+
+ while (p<len)
+ {
+ if (peek(p) == '&')
+ {
+ p = parseEntity(p, buf);
+ if (p < 0) //error?
+ return p0;
+ }
+ else if (peek(p) == '<')
+ {
+ break;
+ }
+ else
+ {
+ int ch = get(p++);
+ buf.push_back((XMLCh)ch);
+ }
+ }
+
+ /*printf("Got Text:%s\n",buf.c_str());*/
+ text->setNodeValue(buf);
+
+ return p;
+}
+
+
+
+
+
+/**
+ * Parses attributes of a node. Should end pointing at either the
+ * '?' of a version or doctype tag, or a '>' of a normal tag
+ */
+int XmlReader::parseAttributes(int p0, Node *node, bool *quickClose)
+{
+ *quickClose = false;
+
+ int p = p0;
+
+ NamedNodeMap attributes;
+
+ while (p<len)
+ {
+ /*printf("ch:%c\n",ch);*/
+ p = skipwhite(p);
+ int ch = get(p);
+
+ /*printf("ch:%c\n",ch);*/
+ if (ch == '?' || ch == '>')//done
+ break;
+ else if (ch=='/' && p<len+1)
+ {
+ p++;
+ p = skipwhite(p);
+ ch = peek(p);
+ if (ch == '>')
+ {
+ p++;
+ *quickClose = true;
+ /*printf("quick close\n");*/
+ return p;
+ }
+ }
+ DOMString shortName;
+ DOMString prefix;
+ DOMString qualifiedName;
+ int p2 = getPrefixedWord(p, prefix, shortName, qualifiedName);
+ if (p2 <= p)
+ break;
+
+ /*printf("name:%s",buf);*/
+ p = p2;
+ p = skipwhite(p);
+ ch = get(p);
+ /*printf("ch:%c\n",ch);*/
+ if (ch != '=')
+ break;
+ p++;
+ p = skipwhite(p);
+ /*ch = parsebuf[p];*/
+ /*printf("ch:%c\n",ch);*/
+ DOMString attrValue;
+ p2 = getQuoted(p, attrValue);
+ p = p2;
+ /*printf("name:'%s' value:'%s'\n",buf,buf2);*/
+
+ DOMString namespaceURI = "";
+ if (prefix == "xmlns" || shortName == "xmlns")
+ namespaceURI = XMLNSNAME;
+
+ //## Now let us make the attribute and give it to the node
+ Attr *attr = document->createAttributeNS(namespaceURI, qualifiedName);
+ attr->setValue(attrValue);
+ node->getAttributes().setNamedItemNS(attr);
+
+ }//while p<len
+
+ return p;
+}
+
+/**
+ * Appends the value of an entity to the buffer
+ */
+int XmlReader::parseEntity(int p0, DOMString &buf)
+{
+ int p = p0;
+ for (EntityInfo *info = entityTable ; info->escape ; info++)
+ {
+ if (match(p, info->escape))
+ {
+ p += info->escapeLength;
+ colNr += info->escapeLength;
+ buf += info->value;
+ return p;
+ }
+ }
+
+ error("unterminated entity");
+ return -1;
+}
+
+
+//#########################################################################
+//# P A R S E A N O D E
+//#########################################################################
+
+/**
+ * Parse as a document, preserving the original structure as much as
+ * possible
+ */
+int XmlReader::parseNode(int p0, Node *node, int depth)
+{
+
+ int p = p0;
+
+
+ //### OPEN TAG
+ int ch = get(p++);
+ if (ch != '<')
+ return p0;
+
+ p = skipwhite(p);
+ DOMString openTagName;
+ DOMString openTagNamePrefix;
+ DOMString openTagQualifiedName;
+ int p2 = getPrefixedWord(p,openTagNamePrefix,
+ openTagName, openTagQualifiedName);
+ if (p2 <= p)
+ return p0;
+ p = p2;
+ p = skipwhite(p);
+
+ //printf("qualifiedName:%s\n", openTagQualifiedName.c_str());
+ DOMString namespaceURI = node->lookupNamespaceURI(openTagNamePrefix);
+ document->renameNode(node, namespaceURI, openTagQualifiedName);
+
+ //### ATTRIBUTES
+ bool quickClose;
+ p = parseAttributes(p, node, &quickClose);
+ if (quickClose) //trivial tag: <name/>
+ return p;
+
+ p++; //skip over '>'
+
+
+ DOMString nodeValue;
+
+ /* ### Get intervening data ### */
+ while (p<len && keepGoing)
+ {
+ //### COMMENT
+ if (match(p, "<!--"))
+ {
+ Comment *comment = document->createComment("");
+ p2 = parseComment(p, comment);
+ if (p2 <= p)
+ return p0;
+ p = p2;
+ if (parseAsData)
+ { //throw away
+ delete comment;
+ }
+ else
+ {
+ node->appendChild(comment);
+ }
+ }
+ //### VERSION
+ else if (match(p, "<?xml"))
+ {
+ p2 = parseVersion(p);
+ if (p2 <= p)
+ return p0;
+ }
+ //### DOCTYPE
+ else if (match(p, "<!DOCTYPE"))
+ {
+ p2 = parseDoctype(p);
+ if (p2 <= p)
+ return p0;
+ }
+ //### CDATA
+ else if (match(p, "<![CDATA["))
+ {
+ CDATASection *cdata = document->createCDATASection("");
+ p2 = parseCDATA(p, cdata);
+ if (p2 <= p)
+ return p0;
+ p = p2;
+ if (parseAsData)
+ {
+ nodeValue += cdata->getNodeValue();
+ delete cdata;
+ }
+ else
+ {
+ node->appendChild(cdata);
+ }
+ }
+ //### OPEN OR CLOSE TAG
+ else if (peek(p) == '<')
+ {
+ p2 = skipwhite(p+1);
+ if (peek(p2) =='/')
+ {
+ p = p2;
+ break;
+ }
+ else
+ {
+ /*Add element to tree*/
+ Element *elem = document->createElement(""); //fill in name later
+ node->appendChild(elem);
+ p2 = parseNode(p, elem, depth+1);
+ if (p2 <= p)
+ {
+ /*printf("problem on element:%ls. p2:%d p:%d\n",n->name, p2, p);*/
+ return p0;
+ }
+ p = p2;
+ }
+ }
+ //### TEXT
+ else
+ {
+ Text *text = document->createTextNode("");
+ p2 = parseText(p, text);
+ if (p2 <= p)
+ return p0;
+ p = p2;
+ if (parseAsData)
+ {
+ nodeValue += text->getNodeValue();
+ delete text;
+ }
+ else
+ {
+ node->appendChild(text);
+ }
+ }
+
+ }//while (p<len)
+
+ //printf("%d : nodeValue:'%s'\n", p, nodeValue.c_str());
+ trim(nodeValue);
+ node->setNodeValue(nodeValue);
+
+ //### get close tag. we should be pointing at '/'
+ p = skipwhite(p);
+ ch = get(p);
+ if (ch != '/')
+ {
+ error("no / on end tag");
+ return p0;
+ }
+ p++;
+
+ //### get word after '/'
+ p = skipwhite(p);
+ DOMString closeTagName;
+ DOMString closeTagNamePrefix;
+ DOMString closeTagQualifiedName;
+ p = getPrefixedWord(p, closeTagNamePrefix, closeTagName,
+ closeTagQualifiedName);
+ if (openTagQualifiedName != closeTagQualifiedName)
+ {
+ error("Mismatched closing tag. Expected </%S>. Got '%S'.",
+ openTagQualifiedName.c_str(), closeTagQualifiedName.c_str());
+ return p0;
+ }
+ p = skipwhite(p);
+ if (parsebuf[p] != '>')
+ {
+ error("no > on end tag");
+ return p0;
+ }
+ p++;
+ /*printf("close element:%ls\n",buf);*/
+ return p;
+}
+
+
+/**
+ *
+ */
+org::w3c::dom::Document *
+XmlReader::parse(const DOMString &buf, int bufferOffset, int parseLen)
+{
+ len = parseLen;
+ parsebuf = buf;
+
+ DOMImplementationSourceImpl source;
+ DOMImplementation *domImpl = source.getDOMImplementation("");
+
+ keepGoing = true;
+
+ document = domImpl->createDocument("", "", NULL);
+ //document = new svg::SVGDocumentImpl(domImpl, "", "", NULL);
+
+ int p = bufferOffset;
+ int p2 = 0;
+
+ while (p<len && keepGoing)
+ {
+ p = skipwhite(p);
+ //### COMMENT
+ if (match(p, "<!--"))
+ {
+ Comment *comment = document->createComment("");
+ p2 = parseComment(p, comment);
+ if (p2 <= p)
+ return document;
+ p = p2;
+ if (parseAsData)
+ { //throw away
+ delete comment;
+ }
+ else
+ {
+ document->appendChild(comment);
+ }
+ }
+ //### VERSION
+ else if (match(p, "<?xml"))
+ {
+ p2 = parseVersion(p);
+ if (p2 <= p)
+ return document;
+ p = p2;
+ }
+ //### DOCTYPE
+ else if (match(p, "<!DOCTYPE"))
+ {
+ p2 = parseDoctype(p);
+ if (p2 <= p)
+ return document;
+ p = p2;
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ p = skipwhite(p);
+ p = parseNode(p, document->getDocumentElement(), 0);
+
+ keepGoing = false;
+
+ return document;
+}
+
+
+/**
+ *
+ */
+org::w3c::dom::Document *
+XmlReader::parse(const DOMString &str)
+{
+
+ Document *doc = parse(str, 0, str.size());
+ doc->normalizeDocument();
+
+ return doc;
+}
+
+/**
+ *
+ */
+org::w3c::dom::Document *
+XmlReader::parseFile(char *fileName)
+{
+
+ DOMString buf = loadFile(fileName);
+
+ Document *doc = parse(buf, 0, buf.size());
+
+ return doc;
+}
+
+
+
+//#########################################################################
+//# S T R E A M R E A D I N G
+//#########################################################################
+
+/**
+ *
+ */
+org::w3c::dom::DOMString
+XmlReader::loadFile(char *fileName)
+{
+
+ if (!fileName)
+ return NULL;
+ FILE *f = fopen(fileName, "rb");
+ if (!f)
+ return NULL;
+
+ DOMString buf;
+ while (!feof(f))
+ {
+ int ch = fgetc(f);
+ if (ch<0)
+ break;
+ buf.push_back((XMLCh)ch);
+ }
+ fclose(f);
+
+ return buf;
+}
+
+
+//#########################################################################
+//# C O N S T R U C T O R / D E S T R U C T O R
+//#########################################################################
+
+
+/**
+ *
+ */
+XmlReader::XmlReader()
+{
+ len = 0;
+ lineNr = 1;
+ colNr = 0;
+ parseAsData = false;
+ keepGoing = false;
+}
+
+/**
+ *
+ */
+XmlReader::XmlReader(bool parseAsDataArg)
+{
+ len = 0;
+ lineNr = 1;
+ colNr = 0;
+ parseAsData = parseAsDataArg;
+ keepGoing = false;
+}
+
+
+
+/**
+ *
+ */
+XmlReader::~XmlReader()
+{
+}
+
+
+} //namespace dom
+} //namespace w3c
+} //namespace org
+
+
+//#########################################################################
+//# E N D O F F I L E
+//#########################################################################
+
diff --git a/src/dom/xmlreader.h b/src/dom/xmlreader.h
index 755122fb1..4b80081e2 100644
--- a/src/dom/xmlreader.h
+++ b/src/dom/xmlreader.h
@@ -1,129 +1,129 @@
-#ifndef _XMLREADER_H_
-#define _XMLREADER_H_
-
-/**
- * Phoebe DOM Implementation.
- *
- * This is a C++ approximation of the W3C DOM model, which follows
- * fairly closely the specifications in the various .idl files, copies of
- * which are provided for reference. Most important is this one:
- *
- * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
- *
- * Authors:
- * Bob Jamison
- *
- * Copyright (C) 2005 Bob Jamison
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-#include "dom.h"
-
-namespace org
-{
-namespace w3c
-{
-namespace dom
-{
-
-
-
-class XmlReader
-{
-public:
-
- /**
- *
- */
- XmlReader();
-
- /**
- *
- */
- XmlReader(bool parseAsData);
-
- /**
- *
- */
- virtual ~XmlReader();
-
- /**
- *
- */
- org::w3c::dom::Document *parse(const DOMString &buf,
- int offset, int length);
-
- /**
- *
- */
- org::w3c::dom::Document *parse(const DOMString &buf);
-
- /**
- *
- */
- org::w3c::dom::Document *parseFile(char *fileName);
-
-
-protected:
-
- void error(char *format, ...);
-
- int get(int ch);
- int peek(int ch);
- bool match(int pos, char *str);
-
- int skipwhite(int ch);
- int getWord(int pos, DOMString &result);
- int getPrefixedWord(int pos,
- DOMString &prefix,
- DOMString &shortWord,
- DOMString &fullWord);
- int getQuoted(int p, DOMString &result);
-
- int parseVersion(int pos);
- int parseDoctype(int pos);
-
- int parseCDATA (int pos, CDATASection *cdata);
- int parseComment(int pos, Comment *comment);
- int parseText(int pos, Text *test);
-
- int parseEntity(int pos, DOMString &buf);
-
- int parseAttributes(int p0, Node *node, bool *quickClose);
-
- int parseNode(int p0, Node *node, int depth);
-
- bool keepGoing;
- bool parseAsData;
- int pos; //current parse position
- int len; //length of parsed region
- DOMString parsebuf;
-
- DOMString loadFile(char *fileName);
-
- int lineNr;
- int colNr;
-
- Document *document;
-
-};
-
-} //namespace dom
-} //namespace w3c
-} //namespace org
-
-#endif /*_XMLREADER_H_*/
+#ifndef _XMLREADER_H_
+#define _XMLREADER_H_
+
+/**
+ * Phoebe DOM Implementation.
+ *
+ * This is a C++ approximation of the W3C DOM model, which follows
+ * fairly closely the specifications in the various .idl files, copies of
+ * which are provided for reference. Most important is this one:
+ *
+ * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
+ *
+ * Authors:
+ * Bob Jamison
+ *
+ * Copyright (C) 2005 Bob Jamison
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+#include "dom.h"
+
+namespace org
+{
+namespace w3c
+{
+namespace dom
+{
+
+
+
+class XmlReader
+{
+public:
+
+ /**
+ *
+ */
+ XmlReader();
+
+ /**
+ *
+ */
+ XmlReader(bool parseAsData);
+
+ /**
+ *
+ */
+ virtual ~XmlReader();
+
+ /**
+ *
+ */
+ org::w3c::dom::Document *parse(const DOMString &buf,
+ int offset, int length);
+
+ /**
+ *
+ */
+ org::w3c::dom::Document *parse(const DOMString &buf);
+
+ /**
+ *
+ */
+ org::w3c::dom::Document *parseFile(char *fileName);
+
+
+protected:
+
+ void error(char *format, ...);
+
+ int get(int ch);
+ int peek(int ch);
+ bool match(int pos, char *str);
+
+ int skipwhite(int ch);
+ int getWord(int pos, DOMString &result);
+ int getPrefixedWord(int pos,
+ DOMString &prefix,
+ DOMString &shortWord,
+ DOMString &fullWord);
+ int getQuoted(int p, DOMString &result);
+
+ int parseVersion(int pos);
+ int parseDoctype(int pos);
+
+ int parseCDATA (int pos, CDATASection *cdata);
+ int parseComment(int pos, Comment *comment);
+ int parseText(int pos, Text *test);
+
+ int parseEntity(int pos, DOMString &buf);
+
+ int parseAttributes(int p0, Node *node, bool *quickClose);
+
+ int parseNode(int p0, Node *node, int depth);
+
+ bool keepGoing;
+ bool parseAsData;
+ int pos; //current parse position
+ int len; //length of parsed region
+ DOMString parsebuf;
+
+ DOMString loadFile(char *fileName);
+
+ int lineNr;
+ int colNr;
+
+ Document *document;
+
+};
+
+} //namespace dom
+} //namespace w3c
+} //namespace org
+
+#endif /*_XMLREADER_H_*/
diff --git a/src/dom/xpathparser.cpp b/src/dom/xpathparser.cpp
index cc6488eed..f0617795e 100644
--- a/src/dom/xpathparser.cpp
+++ b/src/dom/xpathparser.cpp
@@ -1,2047 +1,2047 @@
-/**
- * Phoebe DOM Implementation.
- *
- * This is a C++ approximation of the W3C DOM model, which follows
- * fairly closely the specifications in the various .idl files, copies of
- * which are provided for reference. Most important is this one:
- *
- * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
- *
- * Authors:
- * Bob Jamison
- *
- * Copyright (C) 2006 Bob Jamison
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-#include "charclass.h"
-#include "xpathparser.h"
-
-
-namespace org
-{
-namespace w3c
-{
-namespace dom
-{
-namespace xpath
-{
-
-
-//#########################################################################
-//# M E S S A G E S
-//#########################################################################
-
-
-
-void XPathParser::trace(const char *fmt, ...)
-{
- if (!debug)
- return;
-
- FILE *f = stdout;
-
- va_list args;
- va_start(args, fmt);
- fprintf(f, "XPathParser: ");
- vfprintf(f, fmt, args);
- fprintf(f, "\n");
- va_end(args);
-}
-
-
-
-void XPathParser::error(const char *fmt, ...)
-{
- FILE *f = stdout;
- va_list args;
- va_start(args, fmt);
- fprintf(f, "XPathParser ERROR: ");
- vfprintf(f, fmt, args);
- fprintf(f, "\n");
- va_end(args);
-
- //Print location in string
- fprintf(f, "%s\n", parsebuf);
- for (int i=0 ; i<position ; i++)
- fprintf(f, " ");
- fprintf(f, "^\n");
-}
-
-
-
-void XPathParser::traceStack(const char *name, int pos, int depth)
-{
- if (!debug)
- return;
- return;
- int indent = depth;
-
- for (int i=0 ; i<indent ; i++)
- fprintf(stdout, " ");
- fprintf(stdout, "%d %d %s\n", pos, depth, name);
-
-}
-
-
-//#########################################################################
-//# L E X I C A L S C A N N I N G
-//#########################################################################
-
-void XPathParser::lexTokAdd(int type, int loc)
-{
- LexTok tok(type, loc);
- lexicalTokens.push_back(tok);
-}
-
-void XPathParser::lexTokAdd(int type, int loc, const DOMString &val)
-{
- LexTok tok(type, loc, val);
- lexicalTokens.push_back(tok);
-}
-
-void XPathParser::lexTokAdd(int type, int loc, double val)
-{
- LexTok tok(type, loc, val);
- lexicalTokens.push_back(tok);
-}
-
-void XPathParser::lexTokAdd(int type, int loc, long val)
-{
- LexTok tok(type, loc, val);
- lexicalTokens.push_back(tok);
-}
-
-void XPathParser::lexicalTokenDump()
-{
- printf("####### LEXICAL TOKENS #######\n");
- for (unsigned int i=0 ; i<lexicalTokens.size() ; i++)
- {
- printf("%d : ", i);
- lexicalTokens[i].print();
- }
- printf("##### END LEXICAL TOKENS #####\n\n");
-}
-
-
-
-LexTok XPathParser::lexTok(int p)
-{
- if (p < 0 || p>=(int)lexicalTokens.size())
- {
- LexTok tok;
- return tok;
- }
- return lexicalTokens[p];
-}
-
-int XPathParser::lexTokType(int p)
-{
- if (p < 0 || p>=(int)lexicalTokens.size())
- return -1;
- return lexicalTokens[p].getType();
-}
-
-
-
-
-
-
-
-
-int XPathParser::peek(int p)
-{
- if (p >= parselen)
- return -1;
- position = p;
- return parsebuf[p] ;
-}
-
-
-int XPathParser::get(int p)
-{
- if (p >= parselen)
- return -1;
- position = p;
- return parsebuf[p];
-}
-
-int XPathParser::skipwhite(int p0)
-{
- int p = p0;
-
- while (p < parselen)
- {
- int ch = peek(p);
- if (!isWhitespace(ch))
- break;
- ch = get(p++);
- }
- return p;
-}
-
-int XPathParser::getword(int p0, DOMString &str)
-{
- int p = p0;
- while (p < parselen)
- {
- int ch = peek(p);
- if (!isLetterOrDigit(ch))
- break;
- ch = get(p++);
- str.push_back((XMLCh)ch);
- }
- return p;
-}
-
-int XPathParser::match(int p, const char *str)
-{
- while (*str)
- {
- if (p >= parselen)
- return -1;
- if (parsebuf[p] != *str)
- return -1;
- p++; str++;
- }
- return p;
-}
-
-
-
-
-int XPathParser::getNumber(int p0, double &dresult)
-{
- int p = p0;
- if (p >= parselen)
- return p0;/*need at least x*/
-
- bool isdouble = false;
- bool negative = false;
-
- int ch = parsebuf[p];
- if (ch=='-')
- {
- p++;
- negative = true;
- if (p >= parselen) return p0;
- }
-
- bool seen_dot = false;
- bool seen_e = false;
- bool seen_eminus = false;
-
- DOMString num;
-
- int i = p;
- while (i < parselen)
- {
- ch = parsebuf[i];
- if (ch=='.')
- {
- if (seen_dot)
- return p0;
- seen_dot = true;
- isdouble = true;
- }
- else if (ch=='e' || ch=='E')
- {
- if (seen_e || !seen_dot)
- return p0;
- seen_e = true;
- }
- else if (ch=='-' && seen_e)
- {
- if (seen_eminus || !seen_dot)
- return p0;
- seen_eminus = true;
- }
- else if (!isDigit(ch))
- break;
- num.push_back((XMLCh)ch);
- i++;
- }
-
- if (i == p)/*no digits*/
- return p0;
- if (isdouble)
- {
- const char *begin = num.c_str();
- char *end;
- dresult = strtod(begin,&end);
- if (!end)/*not a number?*/
- {
- error("Error formatting double: %s\n", num.c_str());
- return p0;
- }
- }
- else
- {
- const char *begin = num.c_str();
- char *end;
- dresult = (double)strtol(begin,&end,10);
- if (!end)/*not a number?*/
- {
- error("Error formatting integer: %s\n", num.c_str());
- return p0;
- }
- }
- p = i;
- return p;
-}
-
-
-
-int XPathParser::getLiteral(int p0, DOMString &result)
-{
- int p = p0;
- int ch = peek(p);
- int quotechar = 0;
- if (ch == '"' || ch == '\'')
- {
- quotechar = ch;
- }
- else
- return p0;
- p++;
- while (true)
- {
- if (p >= parselen)
- {
- error("Unterminated literal string");
- return -1;
- }
- ch = peek(p);
- if (ch == quotechar)
- break;
- result.push_back((XMLCh)ch);
- p++;
- }
- p++; //skip over closing "
- return p;
-}
-
-
-
-/**
- * NCName is a 'non-colonized' name
- */
-int XPathParser::getNCName(int p0, DOMString &result)
-{
- int p = p0;
- int ch = peek(p);
- if (ch != '_' && !isLetter(ch))
- return p0;
-
- result.push_back((XMLCh)ch);
- p++;
- while (p < parselen)
- {
- ch = peek(p);
- if ( isLetterOrDigit(ch) ||
- isCombiningChar(ch) ||
- isExtender(ch) ||
- ch == '.' || ch == '-' || ch == '_' )
- {
- result.push_back((XMLCh)ch);
- p++;
- }
- else
- break;
- }
- return p;
-}
-
-
-
-/**
- * Name parsing with post-parsing
- */
-int XPathParser::getNameTest(int p0, DOMString &result)
-{
- int p = p0;
- int ch = peek(p);
- if (ch == '*')
- {
- result.push_back((XMLCh)ch);
- p++;
- return p;
- }
-
- DOMString ncName;
- int p2 = getNCName(p, ncName);
- if (p2 <= p)
- return p0;
-
- result = ncName;
- p = p2;
-
- ch = peek(p);
- if (ch != ':' )//short name. we are done
- {
- return p;
- }
-
- if (peek(p+1) == ':') //was name:: which is ok
- return p;
-
- result.push_back(':');
-
- p++;
- ch = peek(p);
- if (ch == '*')
- {
- result.push_back((XMLCh)ch);
- p++;
- return p;
- }
-
- DOMString ncName2;
- p2 = getNCName(p, ncName2);
- if (p2 <= p)
- {
- if (peek(p) == ':') //was name:: which is ok
- return p0;
- error("Nothing after ':' in QName");
- return -1;
- }
-
- result.append(ncName2);
-
- p = p2;
-
- return p;
-}
-
-
-
-int XPathParser::lexicalScan()
-{
- lexicalTokens.clear();
-
- int p = 0;
- int p2 = p;
-
- while (p < parselen)
- {
- p2 = skipwhite(p);
- p = p2;
-
- //trace("nextChar:%c", peek(p));
- bool selected = false;
-
- //### LITERAL EXPR TOKENS
- for (int i=2 ; i<=10 ; i++)
- {
- p2 = match(p, exprTokenTable[i].sval);
- if (p2 > p)
- {
- lexTokAdd(exprTokenTable[i].ival, p);
- p = p2;
- selected = true;
- break;
- }
- }
- if (selected)
- continue;
-
- //### OPERATORS
- for (LookupEntry *entry = operatorTable; entry->sval ; entry++)
- {
- p2 = match(p, entry->sval);
- if (p2 > p)
- {
- long op = (long)entry->ival;
- //according to the disambiguating rule for * in the spec
- if (op == MULTIPLY && lexicalTokens.size() > 0)
- {
- int ltyp = lexTokType(lexicalTokens.size()-1);
- if (ltyp != AMPR && ltyp != DOUBLE_COLON &&
- ltyp != LPAREN && ltyp != RBRACKET &&
- ltyp != COMMA && ltyp != OPERATOR )
- {
- lexTokAdd(OPERATOR, p, (long)entry->ival);
- p = p2;
- selected = true;
- break;
- }
- }
- else
- {
- lexTokAdd(OPERATOR, p, (long)entry->ival);
- p = p2;
- selected = true;
- break;
- }
- }
- }
- if (selected)
- continue;
-
- //### NODE TYPES
- for (LookupEntry *entry = nodeTypeTable; entry->sval ; entry++)
- {
- p2 = match(p, entry->sval);
- if (p2 > p)
- {
- lexTokAdd(NODE_TYPE, p, (long)entry->ival);
- p = p2;
- selected = true;
- break;
- }
- }
- if (selected)
- continue;
-
- //### AXIS NAMES
- for (LookupEntry *entry = axisNameTable; entry->sval ; entry++)
- {
- p2 = match(p, entry->sval);
- if (p2 > p)
- {
- lexTokAdd(AXIS_NAME, p, (long)entry->ival);
- p = p2;
- selected = true;
- break;
- }
- }
- if (selected)
- continue;
-
- //### NAME TEST
- DOMString ntResult;
- p2 = getNameTest(p, ntResult);
- if (p2 > p)
- {
- int p3 = skipwhite(p2);
- if (peek(p3) == '(')
- lexTokAdd(FUNCTION_NAME, p, ntResult);
- else
- lexTokAdd(NAME_TEST, p, ntResult);
- p = p2;
- selected = true;
- }
- if (selected)
- continue;
-
- //### VARIABLE REFERENCE
- if (peek(p) == '$')
- {
- p++;
- DOMString qnResult;
- p2 = getNCName(p, qnResult);
- if (p2 > p)
- {
- lexTokAdd(VARIABLE_REFERENCE, p, qnResult);
- p = p2;
- selected = true;
- }
- else
- {
- error("Variable referenced with '$' requires a qualified name\n");
- return -1;
- }
- }
- if (selected)
- continue;
-
- //### NUMBER
- double numval;
- p2 = getNumber(p, numval);
- if (p2 > p)
- {
- lexTokAdd(NUMBER, p, numval);
- p = p2;
- selected = true;
- }
- if (selected)
- continue;
-
- //### LITERAL
- DOMString strval;
- p2 = getLiteral(p, strval);
- if (p2 > p)
- {
- lexTokAdd(LITERAL, p, strval);
- p = p2;
- selected = true;
- }
- if (selected)
- continue;
-
- //### CHAR (default, none of the above)
- lexTokAdd(CHAR, p, (long) peek(p));
- p++;
-
- }//while p
-
-
- return p;
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-//#########################################################################
-//# X P A T H G R A M M A R P A R S I N G
-//#########################################################################
-
-
-void XPathParser::tokAdd(Token *tok)
-{
- tokens.add(tok);
-}
-
-/**
- * [1] LocationPath ::=
- * RelativeLocationPath
- * | AbsoluteLocationPath
- */
-int XPathParser::getLocationPath(int p0, int depth)
-{
- traceStack("getLocationPath", p0, depth);
- int p = p0;
-
- p = skipwhite(p);
-
- int p2 = getAbsoluteLocationPath(p, depth+1);
- if (p2 > p)
- {
- tokens.add(new TokAbsolute());
- return p2;
- }
-
- p2 = getRelativeLocationPath(p, depth+1);
- if (p2 > p)
- {
- tokens.add(new TokRelative());
- return p2;
- }
-
- return p0;
-}
-
-
-/**
- * [2] AbsoluteLocationPath ::=
- * '/' RelativeLocationPath?
- * | AbbreviatedAbsoluteLocationPath
- */
-int XPathParser::getAbsoluteLocationPath(int p0, int depth)
-{
- traceStack("getAbsoluteLocationPath", p0, depth);
-
- int p = p0;
- LexTok t = lexTok(p);
- if (t.getType() == OPERATOR && t.getIntValue()==SLASH)
- {
- p++;
- int p2 = getRelativeLocationPath(p, depth+1);
- if (p2 <= p)
- {
- error("Relative path after '/'");
- return -1;
- }
- p = p2;
- return p;
- }
-
- //AbbreviatedAbsoluteLocationPath
- if (t.getType() == OPERATOR && t.getIntValue()==DOUBLE_SLASH)
- {
- p++;
- int p2 = getRelativeLocationPath(p, depth+1);
- if (p2 <= p)
- {
- error("Relative path after '//'");
- return -1;
- }
- p = p2;
- return p;
- }
-
-
- return p0;
-}
-
-
-/**
- * [3] RelativeLocationPath ::=
- * Step
- * | RelativeLocationPath '/' Step
- * | AbbreviatedRelativeLocationPath
- */
-int XPathParser::getRelativeLocationPath(int p0, int depth)
-{
- traceStack("getRelativeLocationPath", p0, depth);
- int p = p0;
- int p2 = getStep(p, depth+1);
- if (p2 < 0)
- return -1;
- if (p2 > p)
- {
- p = p2;
- LexTok t = lexTok(p);
- if (t.getType() == OPERATOR && t.getIntValue()==SLASH)
- {
- p++;
- p2 = getRelativeLocationPath(p, depth+1);
- if (p2 < 0)
- {
- error("Relative path after '/'");
- return -1;
- }
- p = p2;
- return p;
- }
- //AbbreviatedRelativeLocationPath
- if (t.getType() == OPERATOR && t.getIntValue()==DOUBLE_SLASH)
- {
- p++;
- // a '//' is an abbreviation for /descendant-or-self:node()/
- tokAdd(new TokAxisDescendantOrSelf());
- p2 = getRelativeLocationPath(p, depth+1);
- if (p2 < 0)
- {
- error("Relative path after '//'");
- return -1;
- }
- p = p2;
- return p;
- }
- return p;
- }
-
-
- return p0;
-}
-
-
-/**
- * [4] Step ::=
- * AxisSpecifier NodeTest Predicate*
- * | AbbreviatedStep
- */
-int XPathParser::getStep(int p0, int depth)
-{
- traceStack("getStep", p0, depth);
-
- int p = p0;
-
- lexTok(p).print();
-
- //This can be (and usually is) 0-length
- int p2 = getAxisSpecifier(p, depth+1);
- if (p2 < 0)
- {
- error("Axis specifier in step section");
- return -1;
- }
- p = p2;
- p2 = getNodeTest(p, depth+1);
- if (p2 < 0)
- {
- error("Node test in step section");
- return -1;
- }
-
- if (p2 > p)
- {
- p = p2;
- p2 = getPredicate(p, depth+1);
- if (p2 < 0)
- {
- error("Predicate in step section");
- return -1;
- }
- p = p2;
- return p;
- }
-
- //AbbreviatedStep
- if (lexTokType(p) == DOT)
- {
- p++;
- return p;
- }
-
- //AbbreviatedStep
- if (lexTokType(p) == DOUBLE_DOT)
- {
- p++;
- return p;
- }
-
- return p0;
-}
-
-
-/**
- * [5] AxisSpecifier ::=
- * AxisName '::'
- * | AbbreviatedAxisSpecifier
- */
-int XPathParser::getAxisSpecifier(int p0, int depth)
-{
- traceStack("getAxisSpecifier", p0, depth);
- int p = p0;
- if (lexTokType(p) == AXIS_NAME)
- {
- LexTok t = lexTok(p);
- int axisType = t.getIntValue();
- p++;
- if (lexTokType(p) != DOUBLE_COLON)
- {
- error("'::' required after axis name literal");
- return -1;
- }
- p++;
- switch (axisType)
- {
- case ANCESTOR_OR_SELF:
- tokAdd(new TokAxisAncestorOrSelf());
- case ANCESTOR:
- tokAdd(new TokAxisAncestor());
- case ATTRIBUTE:
- tokAdd(new TokAxisAttribute());
- case CHILD:
- tokAdd(new TokAxisChild());
- case DESCENDANT_OR_SELF:
- tokAdd(new TokAxisDescendantOrSelf());
- case DESCENDANT:
- tokAdd(new TokAxisDescendant());
- case FOLLOWING_SIBLING:
- tokAdd(new TokAxisFollowingSibling());
- case FOLLOWING:
- tokAdd(new TokAxisFollowing());
- case NAMESPACE:
- tokAdd(new TokAxisNamespace());
- case PARENT:
- tokAdd(new TokAxisParent());
- case PRECEDING_SIBLING:
- tokAdd(new TokAxisPrecedingSibling());
- case PRECEDING:
- tokAdd(new TokAxisPreceding());
- case SELF:
- tokAdd(new TokAxisSelf());
- default:
- {
- error("unknown axis type %d", axisType);
- return -1;
- }
- }
- return p;
- }
-
- //AbbreviatedAxisSpecifier
- if (lexTokType(p) == AMPR)
- {
- p++;
- return p;
- }
-
- return p0;
-}
-
-
-/**
- * [6] AxisName ::=
- * 'ancestor'
- * | 'ancestor-or-self'
- * | 'attribute'
- * | 'child'
- * | 'descendant'
- * | 'descendant-or-self'
- * | 'following'
- * | 'following-sibling'
- * | 'namespace'
- * | 'parent'
- * | 'preceding'
- * | 'preceding-sibling'
- * | 'self'
- * NOTE: This definition, and those at the bottom, is not
- * needed. Its functionality is handled by lexical scanning.
- * It is left here for reference.
- */
-int XPathParser::getAxisName(int p0, int depth)
-{
- traceStack("getAxisName", p0, depth);
- return p0;
-}
-
-
-/**
- * [7] NodeTest ::=
- * NameTest
- * | NodeType '(' ')'
- * | 'processing-instruction' '(' Literal ')'
- */
-int XPathParser::getNodeTest(int p0, int depth)
-{
- traceStack("getNodeTest", p0, depth);
- int p = p0;
-
- LexTok t = lexTok(p);
- if (t.getType() == NAME_TEST)
- {
- p++;
- tokAdd(new TokNameTest(t.getStringValue()));
- return p;
- }
- if (t.getType() == NODE_TYPE)
- {
- if (t.getIntValue() == PROCESSING_INSTRUCTION)
- {
- if (lexTokType(p) != LPAREN ||
- lexTokType(p+1) != LITERAL ||
- lexTokType(p+2) != RPAREN )
- {
- error("processing instruction requires (\"literal string\")");
- return -1;
- }
- p += 3;
- }
- else
- {
- if (lexTokType(p+1) != LPAREN ||
- lexTokType(p+2) != RPAREN )
- {
- error("processing instruction requires ()");
- return -1;
- }
- p += 2;
- }
- return p;
- }
-
- return p0;
-}
-
-
-/**
- * [8] Predicate ::=
- * '[' PredicateExpr ']'
- */
-int XPathParser::getPredicate(int p0, int depth)
-{
- traceStack("getPredicate", p0, depth);
-
- int p = p0;
- if (lexTokType(p) != LBRACKET)
- return p0;
-
- p++;
- int p2 = getPredicateExpr(p, depth+1);
- if (p2 <= p)
- {
- error("Predicate expression in predicate");
- return -1;
- }
-
- p = p2;
- lexTok(p).print();
- if (lexTokType(p) != RBRACKET)
- {
- error("Predicate expression requires closing ']'");
- return -1;
- }
- p++;
- return p;
-}
-
-
-/**
- * [9] PredicateExpr ::=
- * Expr
- */
-int XPathParser::getPredicateExpr(int p0, int depth)
-{
- traceStack("getPredicateExpr", p0, depth);
- int p = p0;
- int p2 = getExpr(p, depth+1);
- if (p2 < 0)
- {
- error("Expression in predicate expression");
- return -1;
- }
- p = p2;
- return p;
-}
-
-
-/**
- * [10] AbbreviatedAbsoluteLocationPath ::=
- * '//' RelativeLocationPath
- * NOTE: not used. handled in getAbsoluteLocationPath()
- */
-int XPathParser::getAbbreviatedAbsoluteLocationPath(int p0, int depth)
-{
- traceStack("getAbbreviatedAbsoluteLocationPath", p0, depth);
-
- return p0;
-}
-
-/**
- * [11] AbbreviatedRelativeLocationPath ::=
- * RelativeLocationPath '//' Step
- * NOTE: not used. handled in getRelativeLocationPath()
- */
-int XPathParser::getAbbreviatedRelativeLocationPath(int p0, int depth)
-{
- traceStack("getAbbreviatedRelativeLocationPath", p0, depth);
- return p0;
-}
-
-/**
- * [12] AbbreviatedStep ::=
- * '.'
- * | '..'
- * NOTE: not used. handled in getStep()
- */
-int XPathParser::getAbbreviatedStep(int p0, int depth)
-{
- traceStack("getAbbreviatedStep", p0, depth);
- return p0;
-}
-
-
-/**
- * [13] AbbreviatedAxisSpecifier ::=
- * '@'?
- * NOTE: not used. handled in getAxisSpecifier()
- */
-int XPathParser::getAbbreviatedAxisSpecifier(int p0, int depth)
-{
- traceStack("getAbbreviatedAxisSpecifier", p0, depth);
- return p0;
-}
-
-
-/**
- * [14] Expr ::=
- * OrExpr
- */
-int XPathParser::getExpr(int p0, int depth)
-{
- traceStack("getExpr", p0, depth);
-
- int p = p0;
-
- int p2 = getOrExpr(p, depth+1);
- if (p2 < 0)
- {
- error("OR expression in expression");
- return -1;
- }
- p = p2;
-
- return p;
-}
-
-
-/**
- * [15] PrimaryExpr ::=
- * VariableReference
- * | '(' Expr ')'
- * | Literal
- * | Number
- * | FunctionCall
- */
-int XPathParser::getPrimaryExpr(int p0, int depth)
-{
- traceStack("getPrimaryExpr", p0, depth);
- int p = p0;
- int p2 = p;
-
- if (lexTokType(p) == VARIABLE_REFERENCE)
- {
- p++;
- return p;
- }
-
- if (lexTokType(p) == LPAREN)
- {
- p++;
- p2 = getExpr(p, depth+1);
- if (p2 <= p)
- {
- error("Expression in primary expression");
- return -1;
- }
- p += p2;
- if (lexTokType(p) != RPAREN)
- {
- error("Primary expression requires closing ')'");
- return -1;
- }
- }
-
- if (lexTokType(p) == LITERAL)
- {
- tokens.add(new TokStr(lexTok(p).getStringValue()));
- p++;
- return p;
- }
-
- if (lexTokType(p) == NUMBER)
- {
- tokens.add(new TokFloat(lexTok(p).getDoubleValue()));
- p++;
- return p;
- }
-
- p2 = getFunctionCall(p, depth+1);
- if (p2 < 0)
- {
- error("Function call in primary expression");
- return -1;
- }
- if (p2 > p)
- {
- p = p2;
- return p;
- }
-
- return p0;
-}
-
-
-/**
- * [16] FunctionCall ::=
- * FunctionName '(' ( Argument ( ',' Argument )* )? ')'
- */
-int XPathParser::getFunctionCall(int p0, int depth)
-{
- traceStack("getFunctionCall", p0, depth);
- int p = p0;
-
- if (lexTokType(p) != FUNCTION_NAME)
- return p0;
-
- DOMString name = lexTok(p).getStringValue();
-
- p++;
-
- if (lexTokType(p) != LPAREN) //this makes a function
- return p0;
- p++;
-
- int argCount = 0;
-
- int p2 = getArgument(p, depth+1);
- if (p2 < 0)
- {
- error("Error in function argument");
- return -1;
- }
- if (p2 > p)
- {
- argCount++;
- p = p2;
- while (lexTokType(p) == COMMA)
- {
- p++;
- p2 = getArgument(p, depth+1);
- if (p2 <= p)
- {
- error("Error in function argument");
- return -1;
- }
- if (p2 > p)
- argCount++;
- //do we add a token here? i dont think so
- p = p2;
- }
- }
-
- if (lexTokType(p) != RPAREN) //mandatory
- {
- error("Function requires closing ')'");
- return -1;
- }
- p++;
-
- // Function names from http://www.w3.org/TR/xpath#NT-FunctionName
- if (name == "last")
- tokens.add(new TokFuncLast());
- else if (name == "position")
- tokens.add(new TokFuncPosition());
- else if (name == "count")
- tokens.add(new TokFuncCount());
- else if (name == "id")
- tokens.add(new TokFuncId());
- else if (name == "local-name")
- tokens.add(new TokFuncLocalName());
- else if (name == "namespace-uri")
- tokens.add(new TokFuncNamespaceUri());
- else if (name == "name")
- tokens.add(new TokFuncName());
- else if (name == "string")
- tokens.add(new TokFuncString());
- else if (name == "concat")
- tokens.add(new TokFuncConcat());
- else if (name == "starts-with")
- tokens.add(new TokFuncStartsWith());
- else if (name == "contains")
- tokens.add(new TokFuncContains());
- else if (name == "substring-before")
- tokens.add(new TokFuncSubstringBefore());
- else if (name == "substring-after")
- tokens.add(new TokFuncSubstringAfter());
- else if (name == "substring")
- tokens.add(new TokFuncSubstring());
- else if (name == "string-length")
- tokens.add(new TokFuncStringLength());
- else if (name == "normalize-space")
- tokens.add(new TokFuncNormalizeSpace());
- else if (name == "translate")
- tokens.add(new TokFuncTranslate());
- else if (name == "boolean")
- tokens.add(new TokFuncBoolean());
- else if (name == "not")
- tokens.add(new TokFuncNot());
- else if (name == "true")
- tokens.add(new TokFuncTrue());
- else if (name == "false")
- tokens.add(new TokFuncFalse());
- else if (name == "lang")
- tokens.add(new TokFuncLang());
- else if (name == "number")
- tokens.add(new TokFuncNumber());
- else if (name == "sum")
- tokens.add(new TokFuncSum());
- else if (name == "floor")
- tokens.add(new TokFuncFloor());
- else if (name == "ceiling")
- tokens.add(new TokFuncCeiling());
- else if (name == "round")
- tokens.add(new TokFuncRound());
- else
- {
- error("unknown function name:'%s'", name.c_str());
- return -1;
- }
- return p;
-}
-
-
-/**
- * [17] Argument ::=
- * Expr
- */
-int XPathParser::getArgument(int p0, int depth)
-{
- traceStack("getArgument", p0, depth);
- int p = p0;
- int p2 = getExpr(p, depth+1);
- if (p2 < 0)
- {
- error("Argument expression");
- return -1;
- }
- p = p2;
- return p;
-}
-
-
-/**
- * [18] UnionExpr ::=
- * PathExpr
- * | UnionExpr '|' PathExpr
- */
-int XPathParser::getUnionExpr(int p0, int depth)
-{
- traceStack("getUnionExpr", p0, depth);
- int p = p0;
- int p2 = getPathExpr(p, depth+1);
- if (p2 < 0)
- {
- error("Path expression for union");
- return -1;
- }
- p = p2;
- LexTok t = lexTok(p);
- if (t.getType() == OPERATOR && t.getIntValue() == PIPE)
- {
- p++;
- p2 = getUnionExpr(p, depth+1);
- if (p2 < 0)
- {
- error("OR (|) requires union expression on the left");
- return -1;
- }
- tokens.add(new TokUnion());
- p = p2;
- }
- return p;
-}
-
-
-/**
- * [19] PathExpr ::=
- * LocationPath
- * | FilterExpr
- * | FilterExpr '/' RelativeLocationPath
- * | FilterExpr '//' RelativeLocationPath
- */
-int XPathParser::getPathExpr(int p0, int depth)
-{
- traceStack("getPathExpr", p0, depth);
- int p = p0;
- int p2;
-
- p2 = getLocationPath(p, depth+1);
- if (p2 < 0)
- {
- error("Location path in path expression");
- return -1;
- }
- if (p2 > p)
- {
- p = p2;
- return p;
- }
-
- p2 = getFilterExpr(p, depth+1);
- if (p2 < 0)
- {
- error("Filter expression in path expression");
- return -1;
- }
- if (p2 <= p)
- return p0;
- p = p2;
-
- LexTok t = lexTok(p);
- if (t.getType() == OPERATOR && t.getIntValue() == SLASH)
- {
- p++;
- p2 = getRelativeLocationPath(p, depth+1);
- if (p2 < 0)
- {
- error("Relative location after / in path expression");
- return -1;
- }
- p = p2;
- return p;
- }
-
- if (t.getType() == OPERATOR && t.getIntValue() == DOUBLE_SLASH)
- {
- p++;
- p2 = getRelativeLocationPath(p, depth+1);
- if (p2 < 0)
- {
- error("Relative location after // in path expression");
- return -1;
- }
- p = p2;
- return p;
- }
- return p;
-}
-
-
-/**
- * [20] FilterExpr ::=
- * PrimaryExpr
- * | FilterExpr Predicate
- */
-int XPathParser::getFilterExpr(int p0, int depth)
-{
- traceStack("getFilterExpr", p0, depth);
- int p = p0;
-
- int p2 = getPrimaryExpr(p, depth+1);
- if (p2 < 0)
- {
- error("Primary expression in path expression");
- return -1;
- }
- if (p2 > p)
- {
- p = p2;
- while (true)
- {
- p2 = getPredicate(p, depth+1);
- if (p2 < 0)
- {
- error("Predicate in primary expression");
- return -1;
- }
- if (p2 > p)
- {
- p = p2;
- }
- else
- break;
- }
- return p;
- }
-
- return p0;
-}
-
-
-/**
- * [21] OrExpr ::=
- * AndExpr
- * | OrExpr 'or' AndExpr
- */
-int XPathParser::getOrExpr(int p0, int depth)
-{
- traceStack("getOrExpr", p0, depth);
- int p = p0;
- int p2 = getAndExpr(p, depth+1);
- if (p2 < 0)
- {
- error("AND expression in OR expression");
- return -1;
- }
- if (p2 > p)
- {
- p = p2;
- LexTok t = lexTok(p);
- if (t.getType() == OPERATOR && t.getIntValue() == OR)
- {
- p++;
- p2 = getAndExpr(p, depth+1);
- if (p2 <= p)
- {
- error("AND expression in OR expression");
- return -1;
- }
- p = p2;
- return p;
- }
- tokens.add(new TokOr());
- return p;
- }
-
- return p0;
-}
-
-
-/**
- * [22] AndExpr ::=
- * EqualityExpr
- * | AndExpr 'and' EqualityExpr
- */
-int XPathParser::getAndExpr(int p0, int depth)
-{
- traceStack("getAndExpr", p0, depth);
- int p = p0;
- int p2 = getEqualityExpr(p, depth+1);
- if (p2 < 0)
- {
- error("Equality expression in AND expression");
- return -1;
- }
- if (p2 > p)
- {
- p = p2;
- LexTok t = lexTok(p);
- if (t.getType() == OPERATOR && t.getIntValue() == AND)
- {
- p++;
- p2 = getAndExpr(p, depth+1);
- if (p2 <= p)
- {
- error("AND expression after 'and'");
- return -1;
- }
- p = p2;
- return p;
- }
- tokens.add(new TokAnd());
- return p;
- }
-
- return p0;
-}
-
-
-/**
- * [23] EqualityExpr ::=
- * RelationalExpr
- * | EqualityExpr '=' RelationalExpr
- * | EqualityExpr '!=' RelationalExpr
- */
-int XPathParser::getEqualityExpr(int p0, int depth)
-{
- traceStack("getEqualityExpr", p0, depth);
- int p = p0;
- int p2 = getRelationalExpr(p, depth+1);
- if (p2 < 0)
- {
- error("Relation expression in equality expression");
- return -1;
- }
- if (p2 > p)
- {
- p = p2;
- LexTok t = lexTok(p);
- if (t.getType() == OPERATOR && t.getIntValue() == EQUALS)
- {
- p++;
- p2 = getEqualityExpr(p, depth+1);
- if (p2 <= p)
- {
- error("Equality expression expected after ==");
- return -1;
- }
- tokens.add(new TokEquals());
- p = p2;
- return p;
- }
-
- if (t.getType() == OPERATOR && t.getIntValue() == NOT_EQUALS)
- {
- p++;
- p2 = getEqualityExpr(p, depth+1);
- if (p2 <= p)
- {
- error("Equality expression expected after !=");
- return -1;
- }
- tokens.add(new TokNotEquals());
- p = p2;
- return p;
- }
-
- return p;
- }
-
- return p0;
-}
-
-
-/**
- * [24] RelationalExpr ::=
- * AdditiveExpr
- * | RelationalExpr '<' AdditiveExpr
- * | RelationalExpr '>' AdditiveExpr
- * | RelationalExpr '<=' AdditiveExpr
- * | RelationalExpr '>=' AdditiveExpr
- */
-int XPathParser::getRelationalExpr(int p0, int depth)
-{
- traceStack("getRelationalExpr", p0, depth);
- int p = p0;
- int p2 = getAdditiveExpr(p, depth+1);
- if (p2 < 0)
- {
- error("Additive expression in relational expression");
- return -1;
- }
- if (p2 > p)
- {
- p = p2;
- LexTok t = lexTok(p);
-
- if (t.getType() == OPERATOR && t.getIntValue() == GREATER_THAN)
- {
- p++;
- p2 = getRelationalExpr(p, depth+1);
- if (p2 <= p)
- {
- error("Relational expression after '>'");
- return -1;
- }
- tokens.add(new TokGreaterThan());
- p = p2;
- return p;
- }
- if (t.getType() == OPERATOR && t.getIntValue() == LESS_THAN)
- {
- p++;
- p2 = getRelationalExpr(p, depth+1);
- if (p2 <= p)
- {
- error("Relational expression after '<'");
- return -1;
- }
- tokens.add(new TokLessThan());
- p = p2;
- return p;
- }
- if (t.getType() == OPERATOR && t.getIntValue() == GREATER_THAN_EQUALS)
- {
- p++;
- p2 = getRelationalExpr(p, depth+1);
- if (p2 <= p)
- {
- error("Relational expression after '>='");
- return -1;
- }
- tokens.add(new TokGreaterThanEquals());
- p = p2;
- return p;
- }
- if (t.getType() == OPERATOR && t.getIntValue() == LESS_THAN_EQUALS)
- {
- p++;
- p2 = getRelationalExpr(p, depth+1);
- if (p2 <= p)
- {
- error("Relational expression after '<='");
- return -1;
- }
- tokens.add(new TokLessThanEquals());
- p = p2;
- return p;
- }
-
-
- return p;
- }
-
- return p0;
-}
-
-
-/**
- * [25] AdditiveExp ::=
- * MultiplicativeExpr
- * | AdditiveExpr '+' MultiplicativeExpr
- * | AdditiveExpr '-' MultiplicativeExpr
- */
-int XPathParser::getAdditiveExpr(int p0, int depth)
-{
- traceStack("getAdditiveExpr", p0, depth);
- int p = p0;
- int p2 = getMultiplicativeExpr(p, depth+1);
- if (p2 < 0)
- {
- error("Multiplicative expression in additive expression");
- return -1;
- }
- if (p2 > p)
- {
- p = p2;
- LexTok t = lexTok(p);
-
- if (t.getType() == OPERATOR && t.getIntValue() == PLUS)
- {
- p++;
- p2 = getAdditiveExpr(p, depth+1);
- if (p2 <= p)
- {
- error("Additive expression after '+'");
- return -1;
- }
- tokens.add(new TokPlus());
- p = p2;
- return p;
- }
- if (t.getType() == OPERATOR && t.getIntValue() == MINUS)
- {
- p++;
- p2 = getAdditiveExpr(p, depth+1);
- if (p2 <= p)
- {
- error("Additive expression after '-'");
- return -1;
- }
- tokens.add(new TokMinus());
- p = p2;
- return p;
- }
-
-
- return p;
- }
-
- return p0;
-}
-
-
-/**
- * [26] MultiplicativeExpr ::=
- * UnaryExpr
- * | MultiplicativeExpr MultiplyOperator UnaryExpr
- * | MultiplicativeExpr 'div' UnaryExpr
- * | MultiplicativeExpr 'mod' UnaryExpr
- */
-int XPathParser::getMultiplicativeExpr(int p0, int depth)
-{
- traceStack("getMultiplicativeExpr", p0, depth);
- int p = p0;
- int p2 = getUnaryExpr(p, depth+1);
- if (p2 < 0)
- {
- error("Unary expression in multiplicative expression");
- return -1;
- }
- if (p2 > p)
- {
- p = p2;
- LexTok t = lexTok(p);
-
- if (t.getType() == OPERATOR && t.getIntValue() == MULTIPLY)
- {
- p++;
- p2 = getMultiplicativeExpr(p, depth+1);
- if (p2 <= p)
- {
- error("Multiplicative expression after '*'");
- return -1;
- }
- tokens.add(new TokMul());
- p = p2;
- return p;
- }
-
- if (t.getType() == OPERATOR && t.getIntValue() == DIV)
- {
- p++;
- p2 = getMultiplicativeExpr(p, depth+1);
- if (p2 <= p)
- {
- error("Multiplicative expression after 'div'");
- return -1;
- }
- tokens.add(new TokDiv());
- p = p2;
- return p;
- }
-
- if (t.getType() == OPERATOR && t.getIntValue() == MOD)
- {
- p++;
- p2 = getMultiplicativeExpr(p, depth+1);
- if (p2 <= p)
- {
- error("Multiplicative expression after 'mod'");
- return -1;
- }
- tokens.add(new TokMod());
- p = p2;
- return p;
- }
-
-
- return p;
- }
-
- return p0;
-}
-
-
-/**
- * [27] UnaryExpr ::=
- * UnionExpr
- * | '-' UnaryExpr
- */
-int XPathParser::getUnaryExpr(int p0, int depth)
-{
- traceStack("getUnaryExpr", p0, depth);
- int p = p0;
- int p2 = getUnionExpr(p, depth+1);
- if (p2 < 0)
- {
- error("Union expression in unary expression");
- return -1;
- }
- if (p2 > p)
- {
- p = p2;
- return p;
- }
-
- if (lexTokType(p) == '-')
- {
- p++;
- p2 = getUnaryExpr(p, depth+1);
- if (p2 < 0)
- {
- error("Unary expression after '-'");
- return -1;
- }
- tokens.add(new TokNeg());
- p = p2;
- return p;
- }
-
- return p0;
-}
-
-
-//######################################################
-//# NOT USED!!!
-//## The grammar definitions below are
-//## handled by lexical parsing, and will not be used
-//######################################################
-
-/**
- * [28] ExprToken ::=
- * '(' | ')' | '[' | ']' | '.' | '..' | '@' | ',' | '::'
- * | NameTest
- * | NodeType
- * | Operator
- * | FunctionName
- * | AxisName
- * | Literal
- * | Number
- * | VariableReference
- */
-int XPathParser::getExprToken(int p0, int depth)
-{
- traceStack("getExprToken", p0, depth);
- return p0;
-}
-
-
-/**
- * [29] Literal ::=
- * '"' [^"]* '"'
- * | "'" [^']* "'"
- */
-int XPathParser::getLiteral(int p0, int depth)
-{
- traceStack("getLiteral", p0, depth);
- return p0;
-}
-
-
-/**
- * [30] Number ::=
- * Digits ('.' Digits?)?
- * | '.' Digits
- */
-int XPathParser::getNumber(int p0, int depth)
-{
- traceStack("getNumber", p0, depth);
- return p0;
-}
-
-
-/**
- * [31] Digits ::=
- * [0-9]+
- */
-int XPathParser::getDigits(int p0, int depth)
-{
- traceStack("getDigits", p0, depth);
- return p0;
-}
-
-
-/**
- * [32] Operator ::=
- * OperatorName
- * | MultiplyOperator
- * | '/' | '//' | '|' | '+' | '-' | '='
- * | '!=' | '<' | '<=' | '>' | '>='
- */
-int XPathParser::getOperator(int p0, int depth)
-{
- traceStack("getOperator", p0, depth);
- return p0;
-}
-
-
-/**
- * [33] OperatorName ::=
- * 'and' | 'or' | 'mod' | 'div'
- */
-int XPathParser::getOperatorName(int p0, int depth)
-{
- traceStack("getOperatorName", p0, depth);
- return p0;
-}
-
-
-/**
- * [34] MultiplyOperator ::=
- * '*'
- */
-int XPathParser::getMultiplyOperator(int p0, int depth)
-{
- traceStack("getMultiplyOperator", p0, depth);
- return p0;
-}
-
-
-/**
- * [35] FunctionName ::=
- * QName - NodeType
- */
-int XPathParser::getFunctionName(int p0, int depth)
-{
- traceStack("getFunctionName", p0, depth);
- return p0;
-}
-
-
-/**
- * [36] VariableReference ::=
- * '$' QName
- */
-int XPathParser::getVariableReference(int p0, int depth)
-{
- traceStack("getVariableReference", p0, depth);
- return p0;
-}
-
-
-/**
- * [37] NameTest ::=
- * '*'
- * | NCName ':' '*'
- * | QName
- */
-int XPathParser::getNameTest(int p0, int depth)
-{
- traceStack("getNameTest", p0, depth);
- return p0;
-}
-
-
-/**
- * [38] NodeType ::=
- * 'comment'
- * | 'text'
- * | 'processing-instruction'
- * | 'node'
- */
-int XPathParser::getNodeType(int p0, int depth)
-{
- traceStack("getNodeType", p0, depth);
- return p0;
-}
-
-
-/**
- * [39] ExprWhitespace ::=
- * S
- */
-int XPathParser::getExprWhitespace(int p0, int depth)
-{
- traceStack("getExprWhitespace", p0, depth);
- return p0;
-}
-
-
-
-
-
-//#########################################################################
-//# H I G H L E V E L P A R S I N G
-//#########################################################################
-
-/**
- * Parse a candidate XPath string. Leave a copy in 'tokens.'
- */
-bool XPathParser::parse(const DOMString &xpathString)
-{
- int p0 = 0;
-
- DOMString str = xpathString;
-
- parsebuf = (char *)str.c_str();
- parselen = (int) str.size();
- position = 0;
-
- trace("## parsing string: '%s'", parsebuf);
-
- lexicalScan();
- lexicalTokenDump();
-
- tokens.clear();//Get ready to store new tokens
-
- int p = getLocationPath(p0, 0);
-
- parsebuf = NULL;
- parselen = 0;
-
- if (p <= p0)
- {
- //return false;
- }
-
- return true;
-}
-
-
-
-
-
-//#########################################################################
-//# E V A L U A T E
-//#########################################################################
-
-
-
-
-/**
- * This wraps the two-step call to parse(), then execute() to get a NodeList
- * of matching DOM nodes
- */
-NodeList XPathParser::evaluate(const Node *root,
- const DOMString &xpathString)
-{
- NodeList list;
-
- //### Maybe do caching for speed here
-
- //### Parse and execute
- //### Error message can be generated as a side effect
- if (!parse(xpathString))
- return list;
-
- if (debug)
- tokens.dump();
-
- //### Execute the token list
- TokenExecutor executor;
- list = executor.execute(tokens, root);
-
- return list;
-}
-
-
-
-} // namespace xpath
-} // namespace dom
-} // namespace w3c
-} // namespace org
-//#########################################################################
-//# E N D O F F I L E
-//#########################################################################
-
-
-
-
+/**
+ * Phoebe DOM Implementation.
+ *
+ * This is a C++ approximation of the W3C DOM model, which follows
+ * fairly closely the specifications in the various .idl files, copies of
+ * which are provided for reference. Most important is this one:
+ *
+ * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
+ *
+ * Authors:
+ * Bob Jamison
+ *
+ * Copyright (C) 2006 Bob Jamison
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+#include "charclass.h"
+#include "xpathparser.h"
+
+
+namespace org
+{
+namespace w3c
+{
+namespace dom
+{
+namespace xpath
+{
+
+
+//#########################################################################
+//# M E S S A G E S
+//#########################################################################
+
+
+
+void XPathParser::trace(const char *fmt, ...)
+{
+ if (!debug)
+ return;
+
+ FILE *f = stdout;
+
+ va_list args;
+ va_start(args, fmt);
+ fprintf(f, "XPathParser: ");
+ vfprintf(f, fmt, args);
+ fprintf(f, "\n");
+ va_end(args);
+}
+
+
+
+void XPathParser::error(const char *fmt, ...)
+{
+ FILE *f = stdout;
+ va_list args;
+ va_start(args, fmt);
+ fprintf(f, "XPathParser ERROR: ");
+ vfprintf(f, fmt, args);
+ fprintf(f, "\n");
+ va_end(args);
+
+ //Print location in string
+ fprintf(f, "%s\n", parsebuf);
+ for (int i=0 ; i<position ; i++)
+ fprintf(f, " ");
+ fprintf(f, "^\n");
+}
+
+
+
+void XPathParser::traceStack(const char *name, int pos, int depth)
+{
+ if (!debug)
+ return;
+ return;
+ int indent = depth;
+
+ for (int i=0 ; i<indent ; i++)
+ fprintf(stdout, " ");
+ fprintf(stdout, "%d %d %s\n", pos, depth, name);
+
+}
+
+
+//#########################################################################
+//# L E X I C A L S C A N N I N G
+//#########################################################################
+
+void XPathParser::lexTokAdd(int type, int loc)
+{
+ LexTok tok(type, loc);
+ lexicalTokens.push_back(tok);
+}
+
+void XPathParser::lexTokAdd(int type, int loc, const DOMString &val)
+{
+ LexTok tok(type, loc, val);
+ lexicalTokens.push_back(tok);
+}
+
+void XPathParser::lexTokAdd(int type, int loc, double val)
+{
+ LexTok tok(type, loc, val);
+ lexicalTokens.push_back(tok);
+}
+
+void XPathParser::lexTokAdd(int type, int loc, long val)
+{
+ LexTok tok(type, loc, val);
+ lexicalTokens.push_back(tok);
+}
+
+void XPathParser::lexicalTokenDump()
+{
+ printf("####### LEXICAL TOKENS #######\n");
+ for (unsigned int i=0 ; i<lexicalTokens.size() ; i++)
+ {
+ printf("%d : ", i);
+ lexicalTokens[i].print();
+ }
+ printf("##### END LEXICAL TOKENS #####\n\n");
+}
+
+
+
+LexTok XPathParser::lexTok(int p)
+{
+ if (p < 0 || p>=(int)lexicalTokens.size())
+ {
+ LexTok tok;
+ return tok;
+ }
+ return lexicalTokens[p];
+}
+
+int XPathParser::lexTokType(int p)
+{
+ if (p < 0 || p>=(int)lexicalTokens.size())
+ return -1;
+ return lexicalTokens[p].getType();
+}
+
+
+
+
+
+
+
+
+int XPathParser::peek(int p)
+{
+ if (p >= parselen)
+ return -1;
+ position = p;
+ return parsebuf[p] ;
+}
+
+
+int XPathParser::get(int p)
+{
+ if (p >= parselen)
+ return -1;
+ position = p;
+ return parsebuf[p];
+}
+
+int XPathParser::skipwhite(int p0)
+{
+ int p = p0;
+
+ while (p < parselen)
+ {
+ int ch = peek(p);
+ if (!isWhitespace(ch))
+ break;
+ ch = get(p++);
+ }
+ return p;
+}
+
+int XPathParser::getword(int p0, DOMString &str)
+{
+ int p = p0;
+ while (p < parselen)
+ {
+ int ch = peek(p);
+ if (!isLetterOrDigit(ch))
+ break;
+ ch = get(p++);
+ str.push_back((XMLCh)ch);
+ }
+ return p;
+}
+
+int XPathParser::match(int p, const char *str)
+{
+ while (*str)
+ {
+ if (p >= parselen)
+ return -1;
+ if (parsebuf[p] != *str)
+ return -1;
+ p++; str++;
+ }
+ return p;
+}
+
+
+
+
+int XPathParser::getNumber(int p0, double &dresult)
+{
+ int p = p0;
+ if (p >= parselen)
+ return p0;/*need at least x*/
+
+ bool isdouble = false;
+ bool negative = false;
+
+ int ch = parsebuf[p];
+ if (ch=='-')
+ {
+ p++;
+ negative = true;
+ if (p >= parselen) return p0;
+ }
+
+ bool seen_dot = false;
+ bool seen_e = false;
+ bool seen_eminus = false;
+
+ DOMString num;
+
+ int i = p;
+ while (i < parselen)
+ {
+ ch = parsebuf[i];
+ if (ch=='.')
+ {
+ if (seen_dot)
+ return p0;
+ seen_dot = true;
+ isdouble = true;
+ }
+ else if (ch=='e' || ch=='E')
+ {
+ if (seen_e || !seen_dot)
+ return p0;
+ seen_e = true;
+ }
+ else if (ch=='-' && seen_e)
+ {
+ if (seen_eminus || !seen_dot)
+ return p0;
+ seen_eminus = true;
+ }
+ else if (!isDigit(ch))
+ break;
+ num.push_back((XMLCh)ch);
+ i++;
+ }
+
+ if (i == p)/*no digits*/
+ return p0;
+ if (isdouble)
+ {
+ const char *begin = num.c_str();
+ char *end;
+ dresult = strtod(begin,&end);
+ if (!end)/*not a number?*/
+ {
+ error("Error formatting double: %s\n", num.c_str());
+ return p0;
+ }
+ }
+ else
+ {
+ const char *begin = num.c_str();
+ char *end;
+ dresult = (double)strtol(begin,&end,10);
+ if (!end)/*not a number?*/
+ {
+ error("Error formatting integer: %s\n", num.c_str());
+ return p0;
+ }
+ }
+ p = i;
+ return p;
+}
+
+
+
+int XPathParser::getLiteral(int p0, DOMString &result)
+{
+ int p = p0;
+ int ch = peek(p);
+ int quotechar = 0;
+ if (ch == '"' || ch == '\'')
+ {
+ quotechar = ch;
+ }
+ else
+ return p0;
+ p++;
+ while (true)
+ {
+ if (p >= parselen)
+ {
+ error("Unterminated literal string");
+ return -1;
+ }
+ ch = peek(p);
+ if (ch == quotechar)
+ break;
+ result.push_back((XMLCh)ch);
+ p++;
+ }
+ p++; //skip over closing "
+ return p;
+}
+
+
+
+/**
+ * NCName is a 'non-colonized' name
+ */
+int XPathParser::getNCName(int p0, DOMString &result)
+{
+ int p = p0;
+ int ch = peek(p);
+ if (ch != '_' && !isLetter(ch))
+ return p0;
+
+ result.push_back((XMLCh)ch);
+ p++;
+ while (p < parselen)
+ {
+ ch = peek(p);
+ if ( isLetterOrDigit(ch) ||
+ isCombiningChar(ch) ||
+ isExtender(ch) ||
+ ch == '.' || ch == '-' || ch == '_' )
+ {
+ result.push_back((XMLCh)ch);
+ p++;
+ }
+ else
+ break;
+ }
+ return p;
+}
+
+
+
+/**
+ * Name parsing with post-parsing
+ */
+int XPathParser::getNameTest(int p0, DOMString &result)
+{
+ int p = p0;
+ int ch = peek(p);
+ if (ch == '*')
+ {
+ result.push_back((XMLCh)ch);
+ p++;
+ return p;
+ }
+
+ DOMString ncName;
+ int p2 = getNCName(p, ncName);
+ if (p2 <= p)
+ return p0;
+
+ result = ncName;
+ p = p2;
+
+ ch = peek(p);
+ if (ch != ':' )//short name. we are done
+ {
+ return p;
+ }
+
+ if (peek(p+1) == ':') //was name:: which is ok
+ return p;
+
+ result.push_back(':');
+
+ p++;
+ ch = peek(p);
+ if (ch == '*')
+ {
+ result.push_back((XMLCh)ch);
+ p++;
+ return p;
+ }
+
+ DOMString ncName2;
+ p2 = getNCName(p, ncName2);
+ if (p2 <= p)
+ {
+ if (peek(p) == ':') //was name:: which is ok
+ return p0;
+ error("Nothing after ':' in QName");
+ return -1;
+ }
+
+ result.append(ncName2);
+
+ p = p2;
+
+ return p;
+}
+
+
+
+int XPathParser::lexicalScan()
+{
+ lexicalTokens.clear();
+
+ int p = 0;
+ int p2 = p;
+
+ while (p < parselen)
+ {
+ p2 = skipwhite(p);
+ p = p2;
+
+ //trace("nextChar:%c", peek(p));
+ bool selected = false;
+
+ //### LITERAL EXPR TOKENS
+ for (int i=2 ; i<=10 ; i++)
+ {
+ p2 = match(p, exprTokenTable[i].sval);
+ if (p2 > p)
+ {
+ lexTokAdd(exprTokenTable[i].ival, p);
+ p = p2;
+ selected = true;
+ break;
+ }
+ }
+ if (selected)
+ continue;
+
+ //### OPERATORS
+ for (LookupEntry *entry = operatorTable; entry->sval ; entry++)
+ {
+ p2 = match(p, entry->sval);
+ if (p2 > p)
+ {
+ long op = (long)entry->ival;
+ //according to the disambiguating rule for * in the spec
+ if (op == MULTIPLY && lexicalTokens.size() > 0)
+ {
+ int ltyp = lexTokType(lexicalTokens.size()-1);
+ if (ltyp != AMPR && ltyp != DOUBLE_COLON &&
+ ltyp != LPAREN && ltyp != RBRACKET &&
+ ltyp != COMMA && ltyp != OPERATOR )
+ {
+ lexTokAdd(OPERATOR, p, (long)entry->ival);
+ p = p2;
+ selected = true;
+ break;
+ }
+ }
+ else
+ {
+ lexTokAdd(OPERATOR, p, (long)entry->ival);
+ p = p2;
+ selected = true;
+ break;
+ }
+ }
+ }
+ if (selected)
+ continue;
+
+ //### NODE TYPES
+ for (LookupEntry *entry = nodeTypeTable; entry->sval ; entry++)
+ {
+ p2 = match(p, entry->sval);
+ if (p2 > p)
+ {
+ lexTokAdd(NODE_TYPE, p, (long)entry->ival);
+ p = p2;
+ selected = true;
+ break;
+ }
+ }
+ if (selected)
+ continue;
+
+ //### AXIS NAMES
+ for (LookupEntry *entry = axisNameTable; entry->sval ; entry++)
+ {
+ p2 = match(p, entry->sval);
+ if (p2 > p)
+ {
+ lexTokAdd(AXIS_NAME, p, (long)entry->ival);
+ p = p2;
+ selected = true;
+ break;
+ }
+ }
+ if (selected)
+ continue;
+
+ //### NAME TEST
+ DOMString ntResult;
+ p2 = getNameTest(p, ntResult);
+ if (p2 > p)
+ {
+ int p3 = skipwhite(p2);
+ if (peek(p3) == '(')
+ lexTokAdd(FUNCTION_NAME, p, ntResult);
+ else
+ lexTokAdd(NAME_TEST, p, ntResult);
+ p = p2;
+ selected = true;
+ }
+ if (selected)
+ continue;
+
+ //### VARIABLE REFERENCE
+ if (peek(p) == '$')
+ {
+ p++;
+ DOMString qnResult;
+ p2 = getNCName(p, qnResult);
+ if (p2 > p)
+ {
+ lexTokAdd(VARIABLE_REFERENCE, p, qnResult);
+ p = p2;
+ selected = true;
+ }
+ else
+ {
+ error("Variable referenced with '$' requires a qualified name\n");
+ return -1;
+ }
+ }
+ if (selected)
+ continue;
+
+ //### NUMBER
+ double numval;
+ p2 = getNumber(p, numval);
+ if (p2 > p)
+ {
+ lexTokAdd(NUMBER, p, numval);
+ p = p2;
+ selected = true;
+ }
+ if (selected)
+ continue;
+
+ //### LITERAL
+ DOMString strval;
+ p2 = getLiteral(p, strval);
+ if (p2 > p)
+ {
+ lexTokAdd(LITERAL, p, strval);
+ p = p2;
+ selected = true;
+ }
+ if (selected)
+ continue;
+
+ //### CHAR (default, none of the above)
+ lexTokAdd(CHAR, p, (long) peek(p));
+ p++;
+
+ }//while p
+
+
+ return p;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+//#########################################################################
+//# X P A T H G R A M M A R P A R S I N G
+//#########################################################################
+
+
+void XPathParser::tokAdd(Token *tok)
+{
+ tokens.add(tok);
+}
+
+/**
+ * [1] LocationPath ::=
+ * RelativeLocationPath
+ * | AbsoluteLocationPath
+ */
+int XPathParser::getLocationPath(int p0, int depth)
+{
+ traceStack("getLocationPath", p0, depth);
+ int p = p0;
+
+ p = skipwhite(p);
+
+ int p2 = getAbsoluteLocationPath(p, depth+1);
+ if (p2 > p)
+ {
+ tokens.add(new TokAbsolute());
+ return p2;
+ }
+
+ p2 = getRelativeLocationPath(p, depth+1);
+ if (p2 > p)
+ {
+ tokens.add(new TokRelative());
+ return p2;
+ }
+
+ return p0;
+}
+
+
+/**
+ * [2] AbsoluteLocationPath ::=
+ * '/' RelativeLocationPath?
+ * | AbbreviatedAbsoluteLocationPath
+ */
+int XPathParser::getAbsoluteLocationPath(int p0, int depth)
+{
+ traceStack("getAbsoluteLocationPath", p0, depth);
+
+ int p = p0;
+ LexTok t = lexTok(p);
+ if (t.getType() == OPERATOR && t.getIntValue()==SLASH)
+ {
+ p++;
+ int p2 = getRelativeLocationPath(p, depth+1);
+ if (p2 <= p)
+ {
+ error("Relative path after '/'");
+ return -1;
+ }
+ p = p2;
+ return p;
+ }
+
+ //AbbreviatedAbsoluteLocationPath
+ if (t.getType() == OPERATOR && t.getIntValue()==DOUBLE_SLASH)
+ {
+ p++;
+ int p2 = getRelativeLocationPath(p, depth+1);
+ if (p2 <= p)
+ {
+ error("Relative path after '//'");
+ return -1;
+ }
+ p = p2;
+ return p;
+ }
+
+
+ return p0;
+}
+
+
+/**
+ * [3] RelativeLocationPath ::=
+ * Step
+ * | RelativeLocationPath '/' Step
+ * | AbbreviatedRelativeLocationPath
+ */
+int XPathParser::getRelativeLocationPath(int p0, int depth)
+{
+ traceStack("getRelativeLocationPath", p0, depth);
+ int p = p0;
+ int p2 = getStep(p, depth+1);
+ if (p2 < 0)
+ return -1;
+ if (p2 > p)
+ {
+ p = p2;
+ LexTok t = lexTok(p);
+ if (t.getType() == OPERATOR && t.getIntValue()==SLASH)
+ {
+ p++;
+ p2 = getRelativeLocationPath(p, depth+1);
+ if (p2 < 0)
+ {
+ error("Relative path after '/'");
+ return -1;
+ }
+ p = p2;
+ return p;
+ }
+ //AbbreviatedRelativeLocationPath
+ if (t.getType() == OPERATOR && t.getIntValue()==DOUBLE_SLASH)
+ {
+ p++;
+ // a '//' is an abbreviation for /descendant-or-self:node()/
+ tokAdd(new TokAxisDescendantOrSelf());
+ p2 = getRelativeLocationPath(p, depth+1);
+ if (p2 < 0)
+ {
+ error("Relative path after '//'");
+ return -1;
+ }
+ p = p2;
+ return p;
+ }
+ return p;
+ }
+
+
+ return p0;
+}
+
+
+/**
+ * [4] Step ::=
+ * AxisSpecifier NodeTest Predicate*
+ * | AbbreviatedStep
+ */
+int XPathParser::getStep(int p0, int depth)
+{
+ traceStack("getStep", p0, depth);
+
+ int p = p0;
+
+ lexTok(p).print();
+
+ //This can be (and usually is) 0-length
+ int p2 = getAxisSpecifier(p, depth+1);
+ if (p2 < 0)
+ {
+ error("Axis specifier in step section");
+ return -1;
+ }
+ p = p2;
+ p2 = getNodeTest(p, depth+1);
+ if (p2 < 0)
+ {
+ error("Node test in step section");
+ return -1;
+ }
+
+ if (p2 > p)
+ {
+ p = p2;
+ p2 = getPredicate(p, depth+1);
+ if (p2 < 0)
+ {
+ error("Predicate in step section");
+ return -1;
+ }
+ p = p2;
+ return p;
+ }
+
+ //AbbreviatedStep
+ if (lexTokType(p) == DOT)
+ {
+ p++;
+ return p;
+ }
+
+ //AbbreviatedStep
+ if (lexTokType(p) == DOUBLE_DOT)
+ {
+ p++;
+ return p;
+ }
+
+ return p0;
+}
+
+
+/**
+ * [5] AxisSpecifier ::=
+ * AxisName '::'
+ * | AbbreviatedAxisSpecifier
+ */
+int XPathParser::getAxisSpecifier(int p0, int depth)
+{
+ traceStack("getAxisSpecifier", p0, depth);
+ int p = p0;
+ if (lexTokType(p) == AXIS_NAME)
+ {
+ LexTok t = lexTok(p);
+ int axisType = t.getIntValue();
+ p++;
+ if (lexTokType(p) != DOUBLE_COLON)
+ {
+ error("'::' required after axis name literal");
+ return -1;
+ }
+ p++;
+ switch (axisType)
+ {
+ case ANCESTOR_OR_SELF:
+ tokAdd(new TokAxisAncestorOrSelf());
+ case ANCESTOR:
+ tokAdd(new TokAxisAncestor());
+ case ATTRIBUTE:
+ tokAdd(new TokAxisAttribute());
+ case CHILD:
+ tokAdd(new TokAxisChild());
+ case DESCENDANT_OR_SELF:
+ tokAdd(new TokAxisDescendantOrSelf());
+ case DESCENDANT:
+ tokAdd(new TokAxisDescendant());
+ case FOLLOWING_SIBLING:
+ tokAdd(new TokAxisFollowingSibling());
+ case FOLLOWING:
+ tokAdd(new TokAxisFollowing());
+ case NAMESPACE:
+ tokAdd(new TokAxisNamespace());
+ case PARENT:
+ tokAdd(new TokAxisParent());
+ case PRECEDING_SIBLING:
+ tokAdd(new TokAxisPrecedingSibling());
+ case PRECEDING:
+ tokAdd(new TokAxisPreceding());
+ case SELF:
+ tokAdd(new TokAxisSelf());
+ default:
+ {
+ error("unknown axis type %d", axisType);
+ return -1;
+ }
+ }
+ return p;
+ }
+
+ //AbbreviatedAxisSpecifier
+ if (lexTokType(p) == AMPR)
+ {
+ p++;
+ return p;
+ }
+
+ return p0;
+}
+
+
+/**
+ * [6] AxisName ::=
+ * 'ancestor'
+ * | 'ancestor-or-self'
+ * | 'attribute'
+ * | 'child'
+ * | 'descendant'
+ * | 'descendant-or-self'
+ * | 'following'
+ * | 'following-sibling'
+ * | 'namespace'
+ * | 'parent'
+ * | 'preceding'
+ * | 'preceding-sibling'
+ * | 'self'
+ * NOTE: This definition, and those at the bottom, is not
+ * needed. Its functionality is handled by lexical scanning.
+ * It is left here for reference.
+ */
+int XPathParser::getAxisName(int p0, int depth)
+{
+ traceStack("getAxisName", p0, depth);
+ return p0;
+}
+
+
+/**
+ * [7] NodeTest ::=
+ * NameTest
+ * | NodeType '(' ')'
+ * | 'processing-instruction' '(' Literal ')'
+ */
+int XPathParser::getNodeTest(int p0, int depth)
+{
+ traceStack("getNodeTest", p0, depth);
+ int p = p0;
+
+ LexTok t = lexTok(p);
+ if (t.getType() == NAME_TEST)
+ {
+ p++;
+ tokAdd(new TokNameTest(t.getStringValue()));
+ return p;
+ }
+ if (t.getType() == NODE_TYPE)
+ {
+ if (t.getIntValue() == PROCESSING_INSTRUCTION)
+ {
+ if (lexTokType(p) != LPAREN ||
+ lexTokType(p+1) != LITERAL ||
+ lexTokType(p+2) != RPAREN )
+ {
+ error("processing instruction requires (\"literal string\")");
+ return -1;
+ }
+ p += 3;
+ }
+ else
+ {
+ if (lexTokType(p+1) != LPAREN ||
+ lexTokType(p+2) != RPAREN )
+ {
+ error("processing instruction requires ()");
+ return -1;
+ }
+ p += 2;
+ }
+ return p;
+ }
+
+ return p0;
+}
+
+
+/**
+ * [8] Predicate ::=
+ * '[' PredicateExpr ']'
+ */
+int XPathParser::getPredicate(int p0, int depth)
+{
+ traceStack("getPredicate", p0, depth);
+
+ int p = p0;
+ if (lexTokType(p) != LBRACKET)
+ return p0;
+
+ p++;
+ int p2 = getPredicateExpr(p, depth+1);
+ if (p2 <= p)
+ {
+ error("Predicate expression in predicate");
+ return -1;
+ }
+
+ p = p2;
+ lexTok(p).print();
+ if (lexTokType(p) != RBRACKET)
+ {
+ error("Predicate expression requires closing ']'");
+ return -1;
+ }
+ p++;
+ return p;
+}
+
+
+/**
+ * [9] PredicateExpr ::=
+ * Expr
+ */
+int XPathParser::getPredicateExpr(int p0, int depth)
+{
+ traceStack("getPredicateExpr", p0, depth);
+ int p = p0;
+ int p2 = getExpr(p, depth+1);
+ if (p2 < 0)
+ {
+ error("Expression in predicate expression");
+ return -1;
+ }
+ p = p2;
+ return p;
+}
+
+
+/**
+ * [10] AbbreviatedAbsoluteLocationPath ::=
+ * '//' RelativeLocationPath
+ * NOTE: not used. handled in getAbsoluteLocationPath()
+ */
+int XPathParser::getAbbreviatedAbsoluteLocationPath(int p0, int depth)
+{
+ traceStack("getAbbreviatedAbsoluteLocationPath", p0, depth);
+
+ return p0;
+}
+
+/**
+ * [11] AbbreviatedRelativeLocationPath ::=
+ * RelativeLocationPath '//' Step
+ * NOTE: not used. handled in getRelativeLocationPath()
+ */
+int XPathParser::getAbbreviatedRelativeLocationPath(int p0, int depth)
+{
+ traceStack("getAbbreviatedRelativeLocationPath", p0, depth);
+ return p0;
+}
+
+/**
+ * [12] AbbreviatedStep ::=
+ * '.'
+ * | '..'
+ * NOTE: not used. handled in getStep()
+ */
+int XPathParser::getAbbreviatedStep(int p0, int depth)
+{
+ traceStack("getAbbreviatedStep", p0, depth);
+ return p0;
+}
+
+
+/**
+ * [13] AbbreviatedAxisSpecifier ::=
+ * '@'?
+ * NOTE: not used. handled in getAxisSpecifier()
+ */
+int XPathParser::getAbbreviatedAxisSpecifier(int p0, int depth)
+{
+ traceStack("getAbbreviatedAxisSpecifier", p0, depth);
+ return p0;
+}
+
+
+/**
+ * [14] Expr ::=
+ * OrExpr
+ */
+int XPathParser::getExpr(int p0, int depth)
+{
+ traceStack("getExpr", p0, depth);
+
+ int p = p0;
+
+ int p2 = getOrExpr(p, depth+1);
+ if (p2 < 0)
+ {
+ error("OR expression in expression");
+ return -1;
+ }
+ p = p2;
+
+ return p;
+}
+
+
+/**
+ * [15] PrimaryExpr ::=
+ * VariableReference
+ * | '(' Expr ')'
+ * | Literal
+ * | Number
+ * | FunctionCall
+ */
+int XPathParser::getPrimaryExpr(int p0, int depth)
+{
+ traceStack("getPrimaryExpr", p0, depth);
+ int p = p0;
+ int p2 = p;
+
+ if (lexTokType(p) == VARIABLE_REFERENCE)
+ {
+ p++;
+ return p;
+ }
+
+ if (lexTokType(p) == LPAREN)
+ {
+ p++;
+ p2 = getExpr(p, depth+1);
+ if (p2 <= p)
+ {
+ error("Expression in primary expression");
+ return -1;
+ }
+ p += p2;
+ if (lexTokType(p) != RPAREN)
+ {
+ error("Primary expression requires closing ')'");
+ return -1;
+ }
+ }
+
+ if (lexTokType(p) == LITERAL)
+ {
+ tokens.add(new TokStr(lexTok(p).getStringValue()));
+ p++;
+ return p;
+ }
+
+ if (lexTokType(p) == NUMBER)
+ {
+ tokens.add(new TokFloat(lexTok(p).getDoubleValue()));
+ p++;
+ return p;
+ }
+
+ p2 = getFunctionCall(p, depth+1);
+ if (p2 < 0)
+ {
+ error("Function call in primary expression");
+ return -1;
+ }
+ if (p2 > p)
+ {
+ p = p2;
+ return p;
+ }
+
+ return p0;
+}
+
+
+/**
+ * [16] FunctionCall ::=
+ * FunctionName '(' ( Argument ( ',' Argument )* )? ')'
+ */
+int XPathParser::getFunctionCall(int p0, int depth)
+{
+ traceStack("getFunctionCall", p0, depth);
+ int p = p0;
+
+ if (lexTokType(p) != FUNCTION_NAME)
+ return p0;
+
+ DOMString name = lexTok(p).getStringValue();
+
+ p++;
+
+ if (lexTokType(p) != LPAREN) //this makes a function
+ return p0;
+ p++;
+
+ int argCount = 0;
+
+ int p2 = getArgument(p, depth+1);
+ if (p2 < 0)
+ {
+ error("Error in function argument");
+ return -1;
+ }
+ if (p2 > p)
+ {
+ argCount++;
+ p = p2;
+ while (lexTokType(p) == COMMA)
+ {
+ p++;
+ p2 = getArgument(p, depth+1);
+ if (p2 <= p)
+ {
+ error("Error in function argument");
+ return -1;
+ }
+ if (p2 > p)
+ argCount++;
+ //do we add a token here? i dont think so
+ p = p2;
+ }
+ }
+
+ if (lexTokType(p) != RPAREN) //mandatory
+ {
+ error("Function requires closing ')'");
+ return -1;
+ }
+ p++;
+
+ // Function names from http://www.w3.org/TR/xpath#NT-FunctionName
+ if (name == "last")
+ tokens.add(new TokFuncLast());
+ else if (name == "position")
+ tokens.add(new TokFuncPosition());
+ else if (name == "count")
+ tokens.add(new TokFuncCount());
+ else if (name == "id")
+ tokens.add(new TokFuncId());
+ else if (name == "local-name")
+ tokens.add(new TokFuncLocalName());
+ else if (name == "namespace-uri")
+ tokens.add(new TokFuncNamespaceUri());
+ else if (name == "name")
+ tokens.add(new TokFuncName());
+ else if (name == "string")
+ tokens.add(new TokFuncString());
+ else if (name == "concat")
+ tokens.add(new TokFuncConcat());
+ else if (name == "starts-with")
+ tokens.add(new TokFuncStartsWith());
+ else if (name == "contains")
+ tokens.add(new TokFuncContains());
+ else if (name == "substring-before")
+ tokens.add(new TokFuncSubstringBefore());
+ else if (name == "substring-after")
+ tokens.add(new TokFuncSubstringAfter());
+ else if (name == "substring")
+ tokens.add(new TokFuncSubstring());
+ else if (name == "string-length")
+ tokens.add(new TokFuncStringLength());
+ else if (name == "normalize-space")
+ tokens.add(new TokFuncNormalizeSpace());
+ else if (name == "translate")
+ tokens.add(new TokFuncTranslate());
+ else if (name == "boolean")
+ tokens.add(new TokFuncBoolean());
+ else if (name == "not")
+ tokens.add(new TokFuncNot());
+ else if (name == "true")
+ tokens.add(new TokFuncTrue());
+ else if (name == "false")
+ tokens.add(new TokFuncFalse());
+ else if (name == "lang")
+ tokens.add(new TokFuncLang());
+ else if (name == "number")
+ tokens.add(new TokFuncNumber());
+ else if (name == "sum")
+ tokens.add(new TokFuncSum());
+ else if (name == "floor")
+ tokens.add(new TokFuncFloor());
+ else if (name == "ceiling")
+ tokens.add(new TokFuncCeiling());
+ else if (name == "round")
+ tokens.add(new TokFuncRound());
+ else
+ {
+ error("unknown function name:'%s'", name.c_str());
+ return -1;
+ }
+ return p;
+}
+
+
+/**
+ * [17] Argument ::=
+ * Expr
+ */
+int XPathParser::getArgument(int p0, int depth)
+{
+ traceStack("getArgument", p0, depth);
+ int p = p0;
+ int p2 = getExpr(p, depth+1);
+ if (p2 < 0)
+ {
+ error("Argument expression");
+ return -1;
+ }
+ p = p2;
+ return p;
+}
+
+
+/**
+ * [18] UnionExpr ::=
+ * PathExpr
+ * | UnionExpr '|' PathExpr
+ */
+int XPathParser::getUnionExpr(int p0, int depth)
+{
+ traceStack("getUnionExpr", p0, depth);
+ int p = p0;
+ int p2 = getPathExpr(p, depth+1);
+ if (p2 < 0)
+ {
+ error("Path expression for union");
+ return -1;
+ }
+ p = p2;
+ LexTok t = lexTok(p);
+ if (t.getType() == OPERATOR && t.getIntValue() == PIPE)
+ {
+ p++;
+ p2 = getUnionExpr(p, depth+1);
+ if (p2 < 0)
+ {
+ error("OR (|) requires union expression on the left");
+ return -1;
+ }
+ tokens.add(new TokUnion());
+ p = p2;
+ }
+ return p;
+}
+
+
+/**
+ * [19] PathExpr ::=
+ * LocationPath
+ * | FilterExpr
+ * | FilterExpr '/' RelativeLocationPath
+ * | FilterExpr '//' RelativeLocationPath
+ */
+int XPathParser::getPathExpr(int p0, int depth)
+{
+ traceStack("getPathExpr", p0, depth);
+ int p = p0;
+ int p2;
+
+ p2 = getLocationPath(p, depth+1);
+ if (p2 < 0)
+ {
+ error("Location path in path expression");
+ return -1;
+ }
+ if (p2 > p)
+ {
+ p = p2;
+ return p;
+ }
+
+ p2 = getFilterExpr(p, depth+1);
+ if (p2 < 0)
+ {
+ error("Filter expression in path expression");
+ return -1;
+ }
+ if (p2 <= p)
+ return p0;
+ p = p2;
+
+ LexTok t = lexTok(p);
+ if (t.getType() == OPERATOR && t.getIntValue() == SLASH)
+ {
+ p++;
+ p2 = getRelativeLocationPath(p, depth+1);
+ if (p2 < 0)
+ {
+ error("Relative location after / in path expression");
+ return -1;
+ }
+ p = p2;
+ return p;
+ }
+
+ if (t.getType() == OPERATOR && t.getIntValue() == DOUBLE_SLASH)
+ {
+ p++;
+ p2 = getRelativeLocationPath(p, depth+1);
+ if (p2 < 0)
+ {
+ error("Relative location after // in path expression");
+ return -1;
+ }
+ p = p2;
+ return p;
+ }
+ return p;
+}
+
+
+/**
+ * [20] FilterExpr ::=
+ * PrimaryExpr
+ * | FilterExpr Predicate
+ */
+int XPathParser::getFilterExpr(int p0, int depth)
+{
+ traceStack("getFilterExpr", p0, depth);
+ int p = p0;
+
+ int p2 = getPrimaryExpr(p, depth+1);
+ if (p2 < 0)
+ {
+ error("Primary expression in path expression");
+ return -1;
+ }
+ if (p2 > p)
+ {
+ p = p2;
+ while (true)
+ {
+ p2 = getPredicate(p, depth+1);
+ if (p2 < 0)
+ {
+ error("Predicate in primary expression");
+ return -1;
+ }
+ if (p2 > p)
+ {
+ p = p2;
+ }
+ else
+ break;
+ }
+ return p;
+ }
+
+ return p0;
+}
+
+
+/**
+ * [21] OrExpr ::=
+ * AndExpr
+ * | OrExpr 'or' AndExpr
+ */
+int XPathParser::getOrExpr(int p0, int depth)
+{
+ traceStack("getOrExpr", p0, depth);
+ int p = p0;
+ int p2 = getAndExpr(p, depth+1);
+ if (p2 < 0)
+ {
+ error("AND expression in OR expression");
+ return -1;
+ }
+ if (p2 > p)
+ {
+ p = p2;
+ LexTok t = lexTok(p);
+ if (t.getType() == OPERATOR && t.getIntValue() == OR)
+ {
+ p++;
+ p2 = getAndExpr(p, depth+1);
+ if (p2 <= p)
+ {
+ error("AND expression in OR expression");
+ return -1;
+ }
+ p = p2;
+ return p;
+ }
+ tokens.add(new TokOr());
+ return p;
+ }
+
+ return p0;
+}
+
+
+/**
+ * [22] AndExpr ::=
+ * EqualityExpr
+ * | AndExpr 'and' EqualityExpr
+ */
+int XPathParser::getAndExpr(int p0, int depth)
+{
+ traceStack("getAndExpr", p0, depth);
+ int p = p0;
+ int p2 = getEqualityExpr(p, depth+1);
+ if (p2 < 0)
+ {
+ error("Equality expression in AND expression");
+ return -1;
+ }
+ if (p2 > p)
+ {
+ p = p2;
+ LexTok t = lexTok(p);
+ if (t.getType() == OPERATOR && t.getIntValue() == AND)
+ {
+ p++;
+ p2 = getAndExpr(p, depth+1);
+ if (p2 <= p)
+ {
+ error("AND expression after 'and'");
+ return -1;
+ }
+ p = p2;
+ return p;
+ }
+ tokens.add(new TokAnd());
+ return p;
+ }
+
+ return p0;
+}
+
+
+/**
+ * [23] EqualityExpr ::=
+ * RelationalExpr
+ * | EqualityExpr '=' RelationalExpr
+ * | EqualityExpr '!=' RelationalExpr
+ */
+int XPathParser::getEqualityExpr(int p0, int depth)
+{
+ traceStack("getEqualityExpr", p0, depth);
+ int p = p0;
+ int p2 = getRelationalExpr(p, depth+1);
+ if (p2 < 0)
+ {
+ error("Relation expression in equality expression");
+ return -1;
+ }
+ if (p2 > p)
+ {
+ p = p2;
+ LexTok t = lexTok(p);
+ if (t.getType() == OPERATOR && t.getIntValue() == EQUALS)
+ {
+ p++;
+ p2 = getEqualityExpr(p, depth+1);
+ if (p2 <= p)
+ {
+ error("Equality expression expected after ==");
+ return -1;
+ }
+ tokens.add(new TokEquals());
+ p = p2;
+ return p;
+ }
+
+ if (t.getType() == OPERATOR && t.getIntValue() == NOT_EQUALS)
+ {
+ p++;
+ p2 = getEqualityExpr(p, depth+1);
+ if (p2 <= p)
+ {
+ error("Equality expression expected after !=");
+ return -1;
+ }
+ tokens.add(new TokNotEquals());
+ p = p2;
+ return p;
+ }
+
+ return p;
+ }
+
+ return p0;
+}
+
+
+/**
+ * [24] RelationalExpr ::=
+ * AdditiveExpr
+ * | RelationalExpr '<' AdditiveExpr
+ * | RelationalExpr '>' AdditiveExpr
+ * | RelationalExpr '<=' AdditiveExpr
+ * | RelationalExpr '>=' AdditiveExpr
+ */
+int XPathParser::getRelationalExpr(int p0, int depth)
+{
+ traceStack("getRelationalExpr", p0, depth);
+ int p = p0;
+ int p2 = getAdditiveExpr(p, depth+1);
+ if (p2 < 0)
+ {
+ error("Additive expression in relational expression");
+ return -1;
+ }
+ if (p2 > p)
+ {
+ p = p2;
+ LexTok t = lexTok(p);
+
+ if (t.getType() == OPERATOR && t.getIntValue() == GREATER_THAN)
+ {
+ p++;
+ p2 = getRelationalExpr(p, depth+1);
+ if (p2 <= p)
+ {
+ error("Relational expression after '>'");
+ return -1;
+ }
+ tokens.add(new TokGreaterThan());
+ p = p2;
+ return p;
+ }
+ if (t.getType() == OPERATOR && t.getIntValue() == LESS_THAN)
+ {
+ p++;
+ p2 = getRelationalExpr(p, depth+1);
+ if (p2 <= p)
+ {
+ error("Relational expression after '<'");
+ return -1;
+ }
+ tokens.add(new TokLessThan());
+ p = p2;
+ return p;
+ }
+ if (t.getType() == OPERATOR && t.getIntValue() == GREATER_THAN_EQUALS)
+ {
+ p++;
+ p2 = getRelationalExpr(p, depth+1);
+ if (p2 <= p)
+ {
+ error("Relational expression after '>='");
+ return -1;
+ }
+ tokens.add(new TokGreaterThanEquals());
+ p = p2;
+ return p;
+ }
+ if (t.getType() == OPERATOR && t.getIntValue() == LESS_THAN_EQUALS)
+ {
+ p++;
+ p2 = getRelationalExpr(p, depth+1);
+ if (p2 <= p)
+ {
+ error("Relational expression after '<='");
+ return -1;
+ }
+ tokens.add(new TokLessThanEquals());
+ p = p2;
+ return p;
+ }
+
+
+ return p;
+ }
+
+ return p0;
+}
+
+
+/**
+ * [25] AdditiveExp ::=
+ * MultiplicativeExpr
+ * | AdditiveExpr '+' MultiplicativeExpr
+ * | AdditiveExpr '-' MultiplicativeExpr
+ */
+int XPathParser::getAdditiveExpr(int p0, int depth)
+{
+ traceStack("getAdditiveExpr", p0, depth);
+ int p = p0;
+ int p2 = getMultiplicativeExpr(p, depth+1);
+ if (p2 < 0)
+ {
+ error("Multiplicative expression in additive expression");
+ return -1;
+ }
+ if (p2 > p)
+ {
+ p = p2;
+ LexTok t = lexTok(p);
+
+ if (t.getType() == OPERATOR && t.getIntValue() == PLUS)
+ {
+ p++;
+ p2 = getAdditiveExpr(p, depth+1);
+ if (p2 <= p)
+ {
+ error("Additive expression after '+'");
+ return -1;
+ }
+ tokens.add(new TokPlus());
+ p = p2;
+ return p;
+ }
+ if (t.getType() == OPERATOR && t.getIntValue() == MINUS)
+ {
+ p++;
+ p2 = getAdditiveExpr(p, depth+1);
+ if (p2 <= p)
+ {
+ error("Additive expression after '-'");
+ return -1;
+ }
+ tokens.add(new TokMinus());
+ p = p2;
+ return p;
+ }
+
+
+ return p;
+ }
+
+ return p0;
+}
+
+
+/**
+ * [26] MultiplicativeExpr ::=
+ * UnaryExpr
+ * | MultiplicativeExpr MultiplyOperator UnaryExpr
+ * | MultiplicativeExpr 'div' UnaryExpr
+ * | MultiplicativeExpr 'mod' UnaryExpr
+ */
+int XPathParser::getMultiplicativeExpr(int p0, int depth)
+{
+ traceStack("getMultiplicativeExpr", p0, depth);
+ int p = p0;
+ int p2 = getUnaryExpr(p, depth+1);
+ if (p2 < 0)
+ {
+ error("Unary expression in multiplicative expression");
+ return -1;
+ }
+ if (p2 > p)
+ {
+ p = p2;
+ LexTok t = lexTok(p);
+
+ if (t.getType() == OPERATOR && t.getIntValue() == MULTIPLY)
+ {
+ p++;
+ p2 = getMultiplicativeExpr(p, depth+1);
+ if (p2 <= p)
+ {
+ error("Multiplicative expression after '*'");
+ return -1;
+ }
+ tokens.add(new TokMul());
+ p = p2;
+ return p;
+ }
+
+ if (t.getType() == OPERATOR && t.getIntValue() == DIV)
+ {
+ p++;
+ p2 = getMultiplicativeExpr(p, depth+1);
+ if (p2 <= p)
+ {
+ error("Multiplicative expression after 'div'");
+ return -1;
+ }
+ tokens.add(new TokDiv());
+ p = p2;
+ return p;
+ }
+
+ if (t.getType() == OPERATOR && t.getIntValue() == MOD)
+ {
+ p++;
+ p2 = getMultiplicativeExpr(p, depth+1);
+ if (p2 <= p)
+ {
+ error("Multiplicative expression after 'mod'");
+ return -1;
+ }
+ tokens.add(new TokMod());
+ p = p2;
+ return p;
+ }
+
+
+ return p;
+ }
+
+ return p0;
+}
+
+
+/**
+ * [27] UnaryExpr ::=
+ * UnionExpr
+ * | '-' UnaryExpr
+ */
+int XPathParser::getUnaryExpr(int p0, int depth)
+{
+ traceStack("getUnaryExpr", p0, depth);
+ int p = p0;
+ int p2 = getUnionExpr(p, depth+1);
+ if (p2 < 0)
+ {
+ error("Union expression in unary expression");
+ return -1;
+ }
+ if (p2 > p)
+ {
+ p = p2;
+ return p;
+ }
+
+ if (lexTokType(p) == '-')
+ {
+ p++;
+ p2 = getUnaryExpr(p, depth+1);
+ if (p2 < 0)
+ {
+ error("Unary expression after '-'");
+ return -1;
+ }
+ tokens.add(new TokNeg());
+ p = p2;
+ return p;
+ }
+
+ return p0;
+}
+
+
+//######################################################
+//# NOT USED!!!
+//## The grammar definitions below are
+//## handled by lexical parsing, and will not be used
+//######################################################
+
+/**
+ * [28] ExprToken ::=
+ * '(' | ')' | '[' | ']' | '.' | '..' | '@' | ',' | '::'
+ * | NameTest
+ * | NodeType
+ * | Operator
+ * | FunctionName
+ * | AxisName
+ * | Literal
+ * | Number
+ * | VariableReference
+ */
+int XPathParser::getExprToken(int p0, int depth)
+{
+ traceStack("getExprToken", p0, depth);
+ return p0;
+}
+
+
+/**
+ * [29] Literal ::=
+ * '"' [^"]* '"'
+ * | "'" [^']* "'"
+ */
+int XPathParser::getLiteral(int p0, int depth)
+{
+ traceStack("getLiteral", p0, depth);
+ return p0;
+}
+
+
+/**
+ * [30] Number ::=
+ * Digits ('.' Digits?)?
+ * | '.' Digits
+ */
+int XPathParser::getNumber(int p0, int depth)
+{
+ traceStack("getNumber", p0, depth);
+ return p0;
+}
+
+
+/**
+ * [31] Digits ::=
+ * [0-9]+
+ */
+int XPathParser::getDigits(int p0, int depth)
+{
+ traceStack("getDigits", p0, depth);
+ return p0;
+}
+
+
+/**
+ * [32] Operator ::=
+ * OperatorName
+ * | MultiplyOperator
+ * | '/' | '//' | '|' | '+' | '-' | '='
+ * | '!=' | '<' | '<=' | '>' | '>='
+ */
+int XPathParser::getOperator(int p0, int depth)
+{
+ traceStack("getOperator", p0, depth);
+ return p0;
+}
+
+
+/**
+ * [33] OperatorName ::=
+ * 'and' | 'or' | 'mod' | 'div'
+ */
+int XPathParser::getOperatorName(int p0, int depth)
+{
+ traceStack("getOperatorName", p0, depth);
+ return p0;
+}
+
+
+/**
+ * [34] MultiplyOperator ::=
+ * '*'
+ */
+int XPathParser::getMultiplyOperator(int p0, int depth)
+{
+ traceStack("getMultiplyOperator", p0, depth);
+ return p0;
+}
+
+
+/**
+ * [35] FunctionName ::=
+ * QName - NodeType
+ */
+int XPathParser::getFunctionName(int p0, int depth)
+{
+ traceStack("getFunctionName", p0, depth);
+ return p0;
+}
+
+
+/**
+ * [36] VariableReference ::=
+ * '$' QName
+ */
+int XPathParser::getVariableReference(int p0, int depth)
+{
+ traceStack("getVariableReference", p0, depth);
+ return p0;
+}
+
+
+/**
+ * [37] NameTest ::=
+ * '*'
+ * | NCName ':' '*'
+ * | QName
+ */
+int XPathParser::getNameTest(int p0, int depth)
+{
+ traceStack("getNameTest", p0, depth);
+ return p0;
+}
+
+
+/**
+ * [38] NodeType ::=
+ * 'comment'
+ * | 'text'
+ * | 'processing-instruction'
+ * | 'node'
+ */
+int XPathParser::getNodeType(int p0, int depth)
+{
+ traceStack("getNodeType", p0, depth);
+ return p0;
+}
+
+
+/**
+ * [39] ExprWhitespace ::=
+ * S
+ */
+int XPathParser::getExprWhitespace(int p0, int depth)
+{
+ traceStack("getExprWhitespace", p0, depth);
+ return p0;
+}
+
+
+
+
+
+//#########################################################################
+//# H I G H L E V E L P A R S I N G
+//#########################################################################
+
+/**
+ * Parse a candidate XPath string. Leave a copy in 'tokens.'
+ */
+bool XPathParser::parse(const DOMString &xpathString)
+{
+ int p0 = 0;
+
+ DOMString str = xpathString;
+
+ parsebuf = (char *)str.c_str();
+ parselen = (int) str.size();
+ position = 0;
+
+ trace("## parsing string: '%s'", parsebuf);
+
+ lexicalScan();
+ lexicalTokenDump();
+
+ tokens.clear();//Get ready to store new tokens
+
+ int p = getLocationPath(p0, 0);
+
+ parsebuf = NULL;
+ parselen = 0;
+
+ if (p <= p0)
+ {
+ //return false;
+ }
+
+ return true;
+}
+
+
+
+
+
+//#########################################################################
+//# E V A L U A T E
+//#########################################################################
+
+
+
+
+/**
+ * This wraps the two-step call to parse(), then execute() to get a NodeList
+ * of matching DOM nodes
+ */
+NodeList XPathParser::evaluate(const Node *root,
+ const DOMString &xpathString)
+{
+ NodeList list;
+
+ //### Maybe do caching for speed here
+
+ //### Parse and execute
+ //### Error message can be generated as a side effect
+ if (!parse(xpathString))
+ return list;
+
+ if (debug)
+ tokens.dump();
+
+ //### Execute the token list
+ TokenExecutor executor;
+ list = executor.execute(tokens, root);
+
+ return list;
+}
+
+
+
+} // namespace xpath
+} // namespace dom
+} // namespace w3c
+} // namespace org
+//#########################################################################
+//# E N D O F F I L E
+//#########################################################################
+
+
+
+
diff --git a/src/dom/xpathparser.h b/src/dom/xpathparser.h
index 4b4e79fcc..25001016e 100644
--- a/src/dom/xpathparser.h
+++ b/src/dom/xpathparser.h
@@ -1,791 +1,791 @@
-#ifndef __XPATHPARSER_H__
-#define __XPATHPARSER_H__
-
-/**
- * Phoebe DOM Implementation.
- *
- * This is a C++ approximation of the W3C DOM model, which follows
- * fairly closely the specifications in the various .idl files, copies of
- * which are provided for reference. Most important is this one:
- *
- * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
- *
- * Authors:
- * Bob Jamison
- *
- * Copyright (C) 2005 Bob Jamison
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-#include <stdio.h>
-#include <stdarg.h>
-
-#include <string>
-#include <vector>
-
-#include "dom.h"
-#include "xpathtoken.h"
-
-namespace org
-{
-namespace w3c
-{
-namespace dom
-{
-namespace xpath
-{
-
-typedef dom::DOMString DOMString;
-typedef dom::Node Node;
-typedef dom::NodeList NodeList;
-
-
-
-//########################################################################
-//# L E X I C A L D E F I N I T I O N S
-//########################################################################
-
-
-typedef struct
-{
- int ival;
- char *sval;
-} LookupEntry;
-
-
-
-//Note: in the following definitions, where the starts of
-//strings are similar, put the longer definitions first
-
-/**
- *
- */
-typedef enum
-{
- COMMENT,
- TEXT,
- PROCESSING_INSTRUCTION,
- NODE
-} NodeType;
-
-
-static LookupEntry nodeTypeTable [] =
-{
- { COMMENT, "comment" },
- { TEXT, "text" },
- { PROCESSING_INSTRUCTION, "processing-instruction" },
- { NODE, "node" },
- { -1, NULL }
-};
-
-
-/**
- *
- */
-typedef enum
-{
- ANCESTOR_OR_SELF,
- ANCESTOR,
- ATTRIBUTE,
- CHILD,
- DESCENDANT_OR_SELF,
- DESCENDANT,
- FOLLOWING_SIBLING,
- FOLLOWING,
- NAMESPACE,
- PARENT,
- PRECEDING_SIBLING,
- PRECEDING,
- SELF
-} AxisNameType;
-
-
-static LookupEntry axisNameTable [] =
-{
- { ANCESTOR_OR_SELF, "ancestor-or-self" },
- { ANCESTOR, "ancestor" },
- { ATTRIBUTE, "attribute" },
- { CHILD, "child" },
- { DESCENDANT_OR_SELF, "descendant-or-self"},
- { DESCENDANT, "descendant" },
- { FOLLOWING_SIBLING, "following-sibling" },
- { FOLLOWING, "following" },
- { NAMESPACE, "namespace" },
- { PARENT, "parent" },
- { PRECEDING_SIBLING, "preceding-sibling" },
- { PRECEDING, "preceding" },
- { SELF, "self" },
- { -1, NULL }
-};
-
-
-/**
- *
- */
-typedef enum
-{
- NONE = 0,
- CHAR, //default if none of the below
- //Expr tokens
- LPAREN,
- RPAREN,
- LBRACKET,
- RBRACKET,
- DOUBLE_DOT,
- DOT,
- AMPR,
- COMMA,
- DOUBLE_COLON,
- NAME_TEST,
- NODE_TYPE,
- OPERATOR,
- FUNCTION_NAME,
- AXIS_NAME,
- LITERAL,
- NUMBER,
- VARIABLE_REFERENCE,
- //Operator tokens
- AND,
- OR,
- MOD,
- DIV,
- MULTIPLY,
- DOUBLE_SLASH,
- SLASH,
- PIPE,
- PLUS,
- MINUS,
- EQUALS,
- NOT_EQUALS,
- LESS_THAN_EQUALS,
- LESS_THAN,
- GREATER_THAN_EQUALS,
- GREATER_THAN
-} LexTokType;
-
-
-/*
-* Be VERY careful that this table matches the LexicalTokenType enum
-* declaration above.
-*/
-static LookupEntry exprTokenTable [] =
-{
- { NONE, "xxNONExx" },
- { CHAR, "CHAR" },
- //Expr tokens
- { LPAREN, "(" },
- { RPAREN, ")" },
- { LBRACKET, "[" },
- { RBRACKET, "]" },
- { DOUBLE_DOT, ".." },
- { DOT, "." },
- { AMPR, "@" },
- { COMMA, "," },
- { DOUBLE_COLON, "::" },
- { NAME_TEST, "NameTest" },
- { NODE_TYPE, "NodeType" },
- { OPERATOR, "Operator" },
- { FUNCTION_NAME, "FunctionName" },
- { AXIS_NAME, "AxisName" },
- { LITERAL, "Literal" },
- { NUMBER, "Number" },
- { VARIABLE_REFERENCE, "VariableReference" },
- { -1, NULL }
-};
-
-static LookupEntry operatorTable [] =
-{
- { NONE, "xxNONExx" },
- //Operator tokens
- { AND, "and" },
- { OR, "or" },
- { MOD, "mod" },
- { DIV, "div" },
- { MULTIPLY, "*" },
- { DOUBLE_SLASH, "//" },
- { SLASH, "/" },
- { PIPE, "|" },
- { PLUS, "+" },
- { MINUS, "-" },
- { EQUALS, "=" },
- { NOT_EQUALS, "!=" },
- { LESS_THAN_EQUALS, "<=" },
- { LESS_THAN, "<" },
- { GREATER_THAN_EQUALS, ">=" },
- { GREATER_THAN, ">" },
- { -1, NULL }
-};
-
-
-/**
- *
- */
-class LexTok
-{
-public:
- LexTok(const LexTok &tok)
- {
- type = tok.type;
- location = tok.location;
- sval = tok.sval;
- dval = tok.dval;
- ival = tok.ival;
- }
- LexTok()
- { init(); }
- LexTok(int theType, int loc)
- { init(); type = theType; location = loc;}
- LexTok(int theType, int loc, const DOMString &val)
- { init(); type = theType; location = loc; sval = val; }
- LexTok(int theType, int loc, double val)
- { init(); type = theType; location = loc; dval = val; }
- LexTok(int theType, int loc, long val)
- { init(); type = theType; location = loc; ival = val; }
-
- void print()
- {
- if (type == OPERATOR)
- {
- char *tokenStr = "unknown";
- for (LookupEntry *entry = operatorTable; entry->sval ; entry++)
- {
- if (entry->ival == ival)
- {
- tokenStr = entry->sval;
- break;
- }
- }
- printf("(%s)\n", tokenStr);
- }
- else if (type == NODE_TYPE)
- {
- char *tokenStr = "unknown";
- for (LookupEntry *entry = nodeTypeTable; entry->sval ; entry++)
- {
- if (entry->ival == ival)
- {
- tokenStr = entry->sval;
- break;
- }
- }
- printf("{{%s}}\n", tokenStr);
- }
- else if (type == AXIS_NAME)
- {
- char *tokenStr = "unknown";
- for (LookupEntry *entry = axisNameTable; entry->sval ; entry++)
- {
- if (entry->ival == ival)
- {
- tokenStr = entry->sval;
- break;
- }
- }
- printf("{%s}\n", tokenStr);
- }
- else if (type == CHAR)
- printf("'%c'\n", (char)ival);
- else if (type == NAME_TEST)
- printf("\"%s\"\n", sval.c_str());
- else if (type == LITERAL)
- printf("L'%s'\n", sval.c_str());
- else if (type == FUNCTION_NAME)
- printf("%s()\n", sval.c_str());
- else if (type == NUMBER)
- printf("#%f\n", dval);
- else
- {
- char *tokenStr = "unknown";
- for (LookupEntry *entry = exprTokenTable; entry->sval ; entry++)
- {
- if (entry->ival == type)
- {
- tokenStr = entry->sval;
- break;
- }
- }
- printf("%s\n", tokenStr);
- //printf("%s [%s/%f/%ld]\n", tokenStr, sval.c_str(), dval, ival);
- }
- }
-
- int getType()
- { return type; }
- int getLocation()
- { return location; }
- DOMString &getStringValue()
- { return sval; }
- double getDoubleValue()
- { return dval; }
- long getIntValue()
- { return ival; }
-
-private:
- void init()
- {
- type = NONE;
- location = 0;
- dval = 0.0;
- ival = 0;
- }
-
- int type;
- int location;
- DOMString sval;
- double dval;
- long ival;
-};
-
-
-
-
-
-//########################################################################
-//# P A R S E R
-//########################################################################
-
-class XPathParser
-{
-public:
-
- //#################################
- //# CONSTRUCTOR
- //#################################
-
- /**
- *
- */
- XPathParser()
- {
- debug = false;
- }
-
- /**
- *
- */
- ~XPathParser() {}
-
- /**
- *
- */
- bool getDebug()
- { return debug; }
-
- /**
- *
- */
- void setDebug(bool val)
- { debug = val; }
-
-
-
- /**
- * Normally not called directly unless for string parsing testing
- */
- bool parse(const DOMString &str);
-
- /**
- * This is the big one. Called by the xpath-dom api to fetch
- * nodes from a DOM tree.
- */
- NodeList evaluate(const Node *root, const DOMString &str);
-
-
-
-private:
-
- //#################################
- //# MESSAGES
- //#################################
-
- /**
- *
- */
- void trace(const char *fmt, ...);
-
- /**
- *
- */
- void traceStack(const char *name, int pos, int depth);
-
- /**
- *
- */
- void error(const char *fmt, ...);
-
- //#################################
- //# LEXICAL SCANNING
- //#################################
-
- /**
- * Add a lexical token of a given type to the list
- */
- void lexTokAdd(int type, int loc);
- void lexTokAdd(int type, int loc, const DOMString &val);
- void lexTokAdd(int type, int loc, double val);
- void lexTokAdd(int type, int loc, long val);
-
- /**
- *
- */
- void lexicalTokenDump();
-
- /**
- *
- */
- LexTok lexTok(int p);
-
- /**
- *
- */
- int lexTokType(int p);
-
- /**
- *
- */
- int peek(int p);
-
- /**
- *
- */
- int get(int p);
-
- /**
- *
- */
- int getword(int p, DOMString &str);
-
- /**
- *
- */
- int match(int p, const char *str);
-
- /**
- *
- */
- int skipwhite(int p);
-
- /**
- *
- */
- int getNumber(int p, double &dresult);
-
- /**
- *
- */
- int getLiteral(int p, DOMString &result);
-
- /**
- *
- */
- int getNameTest(int p0, DOMString &result);
-
- /**
- *
- */
- int getNCName(int p0, DOMString &result);
-
-
-
-
- /**
- *
- */
- int lexicalScan();
-
-
- //#################################
- //# GRAMMAR PARSING
- //#################################
-
- /**
- * Add a newly derived token to the token list;
- */
- void tokAdd(Token *token);
-
- /**
- * The grammar definitions marked [1]-[39] are directly
- * from the W3C XPath grammar spacification.
- */
-
- /**
- * [1]
- */
- int getLocationPath(int p0, int depth);
-
- /**
- * [2]
- */
- int getAbsoluteLocationPath(int p0, int depth);
-
- /**
- * [3]
- */
- int getRelativeLocationPath(int p0, int depth);
-
- /**
- * [4]
- */
- int getStep(int p0, int depth);
-
- /**
- * [5]
- */
- int getAxisSpecifier(int p0, int depth);
-
- /**
- * [6]
- */
- int getAxisName(int p0, int depth);
-
- /**
- * [7]
- */
- int getNodeTest(int p0, int depth);
-
- /**
- * [8]
- */
- int getPredicate(int p0, int depth);
-
- /**
- * [9]
- */
- int getPredicateExpr(int p0, int depth);
-
- /**
- * [10]
- */
- int getAbbreviatedAbsoluteLocationPath(int p0, int depth);
- /**
- * [11]
- */
- int getAbbreviatedRelativeLocationPath(int p0, int depth);
- /**
- * [12]
- */
- int getAbbreviatedStep(int p0, int depth);
-
- /**
- * [13]
- */
- int getAbbreviatedAxisSpecifier(int p0, int depth);
-
- /**
- * [14]
- */
- int getExpr(int p0, int depth);
-
- /**
- * [15]
- */
- int getPrimaryExpr(int p0, int depth);
-
- /**
- * [16]
- */
- int getFunctionCall(int p0, int depth);
-
- /**
- * [17]
- */
- int getArgument(int p0, int depth);
-
- /**
- * [18]
- */
- int getUnionExpr(int p0, int depth);
-
- /**
- * [19]
- */
- int getPathExpr(int p0, int depth);
-
- /**
- * [20]
- */
- int getFilterExpr(int p0, int depth);
-
- /**
- * [21]
- */
- int getOrExpr(int p0, int depth);
-
- /**
- * [22]
- */
- int getAndExpr(int p0, int depth);
-
- /**
- * [23]
- */
- int getEqualityExpr(int p0, int depth);
-
- /**
- * [24]
- */
- int getRelationalExpr(int p0, int depth);
-
- /**
- * [25]
- */
- int getAdditiveExpr(int p0, int depth);
-
- /**
- * [26]
- */
- int getMultiplicativeExpr(int p0, int depth);
-
- /**
- * [27]
- */
- int getUnaryExpr(int p0, int depth);
-
- /**
- * [28]
- */
- int getExprToken(int p0, int depth);
-
- /**
- * [29]
- */
- int getLiteral(int p0, int depth);
-
- /**
- * [30]
- */
- int getNumber(int p0, int depth);
-
- /**
- * [31]
- */
- int getDigits(int p0, int depth);
-
- /**
- * [32]
- */
- int getOperator(int p0, int depth);
-
- /**
- * [33]
- */
- int getOperatorName(int p0, int depth);
-
- /**
- * [34]
- */
- int getMultiplyOperator(int p0, int depth);
-
- /**
- * [35]
- */
- int getFunctionName(int p0, int depth);
-
- /**
- * [36]
- */
- int getVariableReference(int p0, int depth);
-
- /**
- * [37]
- */
- int getNameTest(int p0, int depth);
-
- /**
- * [38]
- */
- int getNodeType(int p0, int depth);
-
- /**
- * [39]
- */
- int getExprWhitespace(int p0, int depth);
-
-
-
- //#################################
- //# DATA ITEMS
- //#################################
-
- /**
- *
- */
- bool debug;
-
- /**
- *
- */
- char *parsebuf;
-
- /**
- *
- */
- int parselen;
-
- /**
- *
- */
- int position;
-
- /**
- *
- */
- DOMString numberString;
-
- /**
- *
- */
- double number;
-
-
- /**
- * The result of the first lexical scan
- */
- std::vector<LexTok> lexicalTokens;
-
- /**
- * The result of parsing. If parsing was successful, then
- * this is executable via execute()
- */
- TokenList tokens;
-
-
-
-
-};
-
-
-
-
-
-
-} // namespace xpath
-} // namespace dom
-} // namespace w3c
-} // namespace org
-#endif /* __XPATHPARSER_H__ */
-//#########################################################################
-//# E N D O F F I L E
-//#########################################################################
-
-
-
-
-
-
-
-
+#ifndef __XPATHPARSER_H__
+#define __XPATHPARSER_H__
+
+/**
+ * Phoebe DOM Implementation.
+ *
+ * This is a C++ approximation of the W3C DOM model, which follows
+ * fairly closely the specifications in the various .idl files, copies of
+ * which are provided for reference. Most important is this one:
+ *
+ * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
+ *
+ * Authors:
+ * Bob Jamison
+ *
+ * Copyright (C) 2005 Bob Jamison
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+#include <stdio.h>
+#include <stdarg.h>
+
+#include <string>
+#include <vector>
+
+#include "dom.h"
+#include "xpathtoken.h"
+
+namespace org
+{
+namespace w3c
+{
+namespace dom
+{
+namespace xpath
+{
+
+typedef dom::DOMString DOMString;
+typedef dom::Node Node;
+typedef dom::NodeList NodeList;
+
+
+
+//########################################################################
+//# L E X I C A L D E F I N I T I O N S
+//########################################################################
+
+
+typedef struct
+{
+ int ival;
+ char *sval;
+} LookupEntry;
+
+
+
+//Note: in the following definitions, where the starts of
+//strings are similar, put the longer definitions first
+
+/**
+ *
+ */
+typedef enum
+{
+ COMMENT,
+ TEXT,
+ PROCESSING_INSTRUCTION,
+ NODE
+} NodeType;
+
+
+static LookupEntry nodeTypeTable [] =
+{
+ { COMMENT, "comment" },
+ { TEXT, "text" },
+ { PROCESSING_INSTRUCTION, "processing-instruction" },
+ { NODE, "node" },
+ { -1, NULL }
+};
+
+
+/**
+ *
+ */
+typedef enum
+{
+ ANCESTOR_OR_SELF,
+ ANCESTOR,
+ ATTRIBUTE,
+ CHILD,
+ DESCENDANT_OR_SELF,
+ DESCENDANT,
+ FOLLOWING_SIBLING,
+ FOLLOWING,
+ NAMESPACE,
+ PARENT,
+ PRECEDING_SIBLING,
+ PRECEDING,
+ SELF
+} AxisNameType;
+
+
+static LookupEntry axisNameTable [] =
+{
+ { ANCESTOR_OR_SELF, "ancestor-or-self" },
+ { ANCESTOR, "ancestor" },
+ { ATTRIBUTE, "attribute" },
+ { CHILD, "child" },
+ { DESCENDANT_OR_SELF, "descendant-or-self"},
+ { DESCENDANT, "descendant" },
+ { FOLLOWING_SIBLING, "following-sibling" },
+ { FOLLOWING, "following" },
+ { NAMESPACE, "namespace" },
+ { PARENT, "parent" },
+ { PRECEDING_SIBLING, "preceding-sibling" },
+ { PRECEDING, "preceding" },
+ { SELF, "self" },
+ { -1, NULL }
+};
+
+
+/**
+ *
+ */
+typedef enum
+{
+ NONE = 0,
+ CHAR, //default if none of the below
+ //Expr tokens
+ LPAREN,
+ RPAREN,
+ LBRACKET,
+ RBRACKET,
+ DOUBLE_DOT,
+ DOT,
+ AMPR,
+ COMMA,
+ DOUBLE_COLON,
+ NAME_TEST,
+ NODE_TYPE,
+ OPERATOR,
+ FUNCTION_NAME,
+ AXIS_NAME,
+ LITERAL,
+ NUMBER,
+ VARIABLE_REFERENCE,
+ //Operator tokens
+ AND,
+ OR,
+ MOD,
+ DIV,
+ MULTIPLY,
+ DOUBLE_SLASH,
+ SLASH,
+ PIPE,
+ PLUS,
+ MINUS,
+ EQUALS,
+ NOT_EQUALS,
+ LESS_THAN_EQUALS,
+ LESS_THAN,
+ GREATER_THAN_EQUALS,
+ GREATER_THAN
+} LexTokType;
+
+
+/*
+* Be VERY careful that this table matches the LexicalTokenType enum
+* declaration above.
+*/
+static LookupEntry exprTokenTable [] =
+{
+ { NONE, "xxNONExx" },
+ { CHAR, "CHAR" },
+ //Expr tokens
+ { LPAREN, "(" },
+ { RPAREN, ")" },
+ { LBRACKET, "[" },
+ { RBRACKET, "]" },
+ { DOUBLE_DOT, ".." },
+ { DOT, "." },
+ { AMPR, "@" },
+ { COMMA, "," },
+ { DOUBLE_COLON, "::" },
+ { NAME_TEST, "NameTest" },
+ { NODE_TYPE, "NodeType" },
+ { OPERATOR, "Operator" },
+ { FUNCTION_NAME, "FunctionName" },
+ { AXIS_NAME, "AxisName" },
+ { LITERAL, "Literal" },
+ { NUMBER, "Number" },
+ { VARIABLE_REFERENCE, "VariableReference" },
+ { -1, NULL }
+};
+
+static LookupEntry operatorTable [] =
+{
+ { NONE, "xxNONExx" },
+ //Operator tokens
+ { AND, "and" },
+ { OR, "or" },
+ { MOD, "mod" },
+ { DIV, "div" },
+ { MULTIPLY, "*" },
+ { DOUBLE_SLASH, "//" },
+ { SLASH, "/" },
+ { PIPE, "|" },
+ { PLUS, "+" },
+ { MINUS, "-" },
+ { EQUALS, "=" },
+ { NOT_EQUALS, "!=" },
+ { LESS_THAN_EQUALS, "<=" },
+ { LESS_THAN, "<" },
+ { GREATER_THAN_EQUALS, ">=" },
+ { GREATER_THAN, ">" },
+ { -1, NULL }
+};
+
+
+/**
+ *
+ */
+class LexTok
+{
+public:
+ LexTok(const LexTok &tok)
+ {
+ type = tok.type;
+ location = tok.location;
+ sval = tok.sval;
+ dval = tok.dval;
+ ival = tok.ival;
+ }
+ LexTok()
+ { init(); }
+ LexTok(int theType, int loc)
+ { init(); type = theType; location = loc;}
+ LexTok(int theType, int loc, const DOMString &val)
+ { init(); type = theType; location = loc; sval = val; }
+ LexTok(int theType, int loc, double val)
+ { init(); type = theType; location = loc; dval = val; }
+ LexTok(int theType, int loc, long val)
+ { init(); type = theType; location = loc; ival = val; }
+
+ void print()
+ {
+ if (type == OPERATOR)
+ {
+ char *tokenStr = "unknown";
+ for (LookupEntry *entry = operatorTable; entry->sval ; entry++)
+ {
+ if (entry->ival == ival)
+ {
+ tokenStr = entry->sval;
+ break;
+ }
+ }
+ printf("(%s)\n", tokenStr);
+ }
+ else if (type == NODE_TYPE)
+ {
+ char *tokenStr = "unknown";
+ for (LookupEntry *entry = nodeTypeTable; entry->sval ; entry++)
+ {
+ if (entry->ival == ival)
+ {
+ tokenStr = entry->sval;
+ break;
+ }
+ }
+ printf("{{%s}}\n", tokenStr);
+ }
+ else if (type == AXIS_NAME)
+ {
+ char *tokenStr = "unknown";
+ for (LookupEntry *entry = axisNameTable; entry->sval ; entry++)
+ {
+ if (entry->ival == ival)
+ {
+ tokenStr = entry->sval;
+ break;
+ }
+ }
+ printf("{%s}\n", tokenStr);
+ }
+ else if (type == CHAR)
+ printf("'%c'\n", (char)ival);
+ else if (type == NAME_TEST)
+ printf("\"%s\"\n", sval.c_str());
+ else if (type == LITERAL)
+ printf("L'%s'\n", sval.c_str());
+ else if (type == FUNCTION_NAME)
+ printf("%s()\n", sval.c_str());
+ else if (type == NUMBER)
+ printf("#%f\n", dval);
+ else
+ {
+ char *tokenStr = "unknown";
+ for (LookupEntry *entry = exprTokenTable; entry->sval ; entry++)
+ {
+ if (entry->ival == type)
+ {
+ tokenStr = entry->sval;
+ break;
+ }
+ }
+ printf("%s\n", tokenStr);
+ //printf("%s [%s/%f/%ld]\n", tokenStr, sval.c_str(), dval, ival);
+ }
+ }
+
+ int getType()
+ { return type; }
+ int getLocation()
+ { return location; }
+ DOMString &getStringValue()
+ { return sval; }
+ double getDoubleValue()
+ { return dval; }
+ long getIntValue()
+ { return ival; }
+
+private:
+ void init()
+ {
+ type = NONE;
+ location = 0;
+ dval = 0.0;
+ ival = 0;
+ }
+
+ int type;
+ int location;
+ DOMString sval;
+ double dval;
+ long ival;
+};
+
+
+
+
+
+//########################################################################
+//# P A R S E R
+//########################################################################
+
+class XPathParser
+{
+public:
+
+ //#################################
+ //# CONSTRUCTOR
+ //#################################
+
+ /**
+ *
+ */
+ XPathParser()
+ {
+ debug = false;
+ }
+
+ /**
+ *
+ */
+ ~XPathParser() {}
+
+ /**
+ *
+ */
+ bool getDebug()
+ { return debug; }
+
+ /**
+ *
+ */
+ void setDebug(bool val)
+ { debug = val; }
+
+
+
+ /**
+ * Normally not called directly unless for string parsing testing
+ */
+ bool parse(const DOMString &str);
+
+ /**
+ * This is the big one. Called by the xpath-dom api to fetch
+ * nodes from a DOM tree.
+ */
+ NodeList evaluate(const Node *root, const DOMString &str);
+
+
+
+private:
+
+ //#################################
+ //# MESSAGES
+ //#################################
+
+ /**
+ *
+ */
+ void trace(const char *fmt, ...);
+
+ /**
+ *
+ */
+ void traceStack(const char *name, int pos, int depth);
+
+ /**
+ *
+ */
+ void error(const char *fmt, ...);
+
+ //#################################
+ //# LEXICAL SCANNING
+ //#################################
+
+ /**
+ * Add a lexical token of a given type to the list
+ */
+ void lexTokAdd(int type, int loc);
+ void lexTokAdd(int type, int loc, const DOMString &val);
+ void lexTokAdd(int type, int loc, double val);
+ void lexTokAdd(int type, int loc, long val);
+
+ /**
+ *
+ */
+ void lexicalTokenDump();
+
+ /**
+ *
+ */
+ LexTok lexTok(int p);
+
+ /**
+ *
+ */
+ int lexTokType(int p);
+
+ /**
+ *
+ */
+ int peek(int p);
+
+ /**
+ *
+ */
+ int get(int p);
+
+ /**
+ *
+ */
+ int getword(int p, DOMString &str);
+
+ /**
+ *
+ */
+ int match(int p, const char *str);
+
+ /**
+ *
+ */
+ int skipwhite(int p);
+
+ /**
+ *
+ */
+ int getNumber(int p, double &dresult);
+
+ /**
+ *
+ */
+ int getLiteral(int p, DOMString &result);
+
+ /**
+ *
+ */
+ int getNameTest(int p0, DOMString &result);
+
+ /**
+ *
+ */
+ int getNCName(int p0, DOMString &result);
+
+
+
+
+ /**
+ *
+ */
+ int lexicalScan();
+
+
+ //#################################
+ //# GRAMMAR PARSING
+ //#################################
+
+ /**
+ * Add a newly derived token to the token list;
+ */
+ void tokAdd(Token *token);
+
+ /**
+ * The grammar definitions marked [1]-[39] are directly
+ * from the W3C XPath grammar spacification.
+ */
+
+ /**
+ * [1]
+ */
+ int getLocationPath(int p0, int depth);
+
+ /**
+ * [2]
+ */
+ int getAbsoluteLocationPath(int p0, int depth);
+
+ /**
+ * [3]
+ */
+ int getRelativeLocationPath(int p0, int depth);
+
+ /**
+ * [4]
+ */
+ int getStep(int p0, int depth);
+
+ /**
+ * [5]
+ */
+ int getAxisSpecifier(int p0, int depth);
+
+ /**
+ * [6]
+ */
+ int getAxisName(int p0, int depth);
+
+ /**
+ * [7]
+ */
+ int getNodeTest(int p0, int depth);
+
+ /**
+ * [8]
+ */
+ int getPredicate(int p0, int depth);
+
+ /**
+ * [9]
+ */
+ int getPredicateExpr(int p0, int depth);
+
+ /**
+ * [10]
+ */
+ int getAbbreviatedAbsoluteLocationPath(int p0, int depth);
+ /**
+ * [11]
+ */
+ int getAbbreviatedRelativeLocationPath(int p0, int depth);
+ /**
+ * [12]
+ */
+ int getAbbreviatedStep(int p0, int depth);
+
+ /**
+ * [13]
+ */
+ int getAbbreviatedAxisSpecifier(int p0, int depth);
+
+ /**
+ * [14]
+ */
+ int getExpr(int p0, int depth);
+
+ /**
+ * [15]
+ */
+ int getPrimaryExpr(int p0, int depth);
+
+ /**
+ * [16]
+ */
+ int getFunctionCall(int p0, int depth);
+
+ /**
+ * [17]
+ */
+ int getArgument(int p0, int depth);
+
+ /**
+ * [18]
+ */
+ int getUnionExpr(int p0, int depth);
+
+ /**
+ * [19]
+ */
+ int getPathExpr(int p0, int depth);
+
+ /**
+ * [20]
+ */
+ int getFilterExpr(int p0, int depth);
+
+ /**
+ * [21]
+ */
+ int getOrExpr(int p0, int depth);
+
+ /**
+ * [22]
+ */
+ int getAndExpr(int p0, int depth);
+
+ /**
+ * [23]
+ */
+ int getEqualityExpr(int p0, int depth);
+
+ /**
+ * [24]
+ */
+ int getRelationalExpr(int p0, int depth);
+
+ /**
+ * [25]
+ */
+ int getAdditiveExpr(int p0, int depth);
+
+ /**
+ * [26]
+ */
+ int getMultiplicativeExpr(int p0, int depth);
+
+ /**
+ * [27]
+ */
+ int getUnaryExpr(int p0, int depth);
+
+ /**
+ * [28]
+ */
+ int getExprToken(int p0, int depth);
+
+ /**
+ * [29]
+ */
+ int getLiteral(int p0, int depth);
+
+ /**
+ * [30]
+ */
+ int getNumber(int p0, int depth);
+
+ /**
+ * [31]
+ */
+ int getDigits(int p0, int depth);
+
+ /**
+ * [32]
+ */
+ int getOperator(int p0, int depth);
+
+ /**
+ * [33]
+ */
+ int getOperatorName(int p0, int depth);
+
+ /**
+ * [34]
+ */
+ int getMultiplyOperator(int p0, int depth);
+
+ /**
+ * [35]
+ */
+ int getFunctionName(int p0, int depth);
+
+ /**
+ * [36]
+ */
+ int getVariableReference(int p0, int depth);
+
+ /**
+ * [37]
+ */
+ int getNameTest(int p0, int depth);
+
+ /**
+ * [38]
+ */
+ int getNodeType(int p0, int depth);
+
+ /**
+ * [39]
+ */
+ int getExprWhitespace(int p0, int depth);
+
+
+
+ //#################################
+ //# DATA ITEMS
+ //#################################
+
+ /**
+ *
+ */
+ bool debug;
+
+ /**
+ *
+ */
+ char *parsebuf;
+
+ /**
+ *
+ */
+ int parselen;
+
+ /**
+ *
+ */
+ int position;
+
+ /**
+ *
+ */
+ DOMString numberString;
+
+ /**
+ *
+ */
+ double number;
+
+
+ /**
+ * The result of the first lexical scan
+ */
+ std::vector<LexTok> lexicalTokens;
+
+ /**
+ * The result of parsing. If parsing was successful, then
+ * this is executable via execute()
+ */
+ TokenList tokens;
+
+
+
+
+};
+
+
+
+
+
+
+} // namespace xpath
+} // namespace dom
+} // namespace w3c
+} // namespace org
+#endif /* __XPATHPARSER_H__ */
+//#########################################################################
+//# E N D O F F I L E
+//#########################################################################
+
+
+
+
+
+
+
+
diff --git a/src/dom/xpathtoken.cpp b/src/dom/xpathtoken.cpp
index c9d4898d7..41b7ad39d 100644
--- a/src/dom/xpathtoken.cpp
+++ b/src/dom/xpathtoken.cpp
@@ -1,515 +1,515 @@
-/**
- * Phoebe DOM Implementation.
- *
- * This is a C++ approximation of the W3C DOM model, which follows
- * fairly closely the specifications in the various .idl files, copies of
- * which are provided for reference. Most important is this one:
- *
- * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
- *
- * Authors:
- * Bob Jamison
- *
- * Copyright (C) 2006 Bob Jamison
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-#include "xpathtoken.h"
-#include <stdio.h>
-
-
-
-namespace org
-{
-namespace w3c
-{
-namespace dom
-{
-namespace xpath
-{
-
-//########################################################################
-//# X P A T H T O K E N
-//########################################################################
-
-typedef struct
-{
- int ival;
- char *sval;
-} TokenStringPair;
-
-static TokenStringPair tokenStrings[] =
-{
- //primitives
- { Token::TOK_NOP, "nop" },
- { Token::TOK_STR, "str" },
- { Token::TOK_INT, "int" },
- { Token::TOK_FLOAT, "float" },
- //operators
- { Token::TOK_AND, "and" },
- { Token::TOK_OR, "or" },
- { Token::TOK_MOD, "mod" },
- { Token::TOK_DIV, "div" },
- { Token::TOK_MULTIPLY, "multiply" },
- { Token::TOK_DOUBLE_SLASH, "double-slash" },
- { Token::TOK_SLASH, "slash" },
- { Token::TOK_PIPE, "pipe" },
- { Token::TOK_PLUS, "plus" },
- { Token::TOK_MINUS, "minus" },
- { Token::TOK_NEG, "neg" },
- { Token::TOK_EQUALS, "equals" },
- { Token::TOK_NOT_EQUALS, "not-equals" },
- { Token::TOK_LESS_THAN_EQUALS, "less-than-equals" },
- { Token::TOK_LESS_THAN, "less-than" },
- { Token::TOK_GREATER_THAN_EQUALS, "greater-than-equals" },
- { Token::TOK_GREATER_THAN, "greater-than" },
- //path types
- { Token::TOK_ABSOLUTE, "absolute" },
- { Token::TOK_RELATIVE, "relative" },
- { Token::TOK_STEP, "step" },
- { Token::TOK_NAME_TEST, "name-test" },
- { Token::TOK_EXPR, "expr" },
- { Token::TOK_UNION, "union" },
- //axis types
- { Token::TOK_AXIS_ANCESTOR_OR_SELF, "axis-ancestor-or-self" },
- { Token::TOK_AXIS_ANCESTOR, "axis-ancestor" },
- { Token::TOK_AXIS_ATTRIBUTE, "axis-attribute" },
- { Token::TOK_AXIS_CHILD, "axis-child" },
- { Token::TOK_AXIS_DESCENDANT_OR_SELF, "axis-descendant-or-self" },
- { Token::TOK_AXIS_DESCENDANT, "axis-descendant" },
- { Token::TOK_AXIS_FOLLOWING_SIBLING, "axis-following-sibling" },
- { Token::TOK_AXIS_FOLLOWING, "axis-following" },
- { Token::TOK_AXIS_NAMESPACE, "axis-namespace" },
- { Token::TOK_AXIS_PARENT, "axis-parent" },
- { Token::TOK_AXIS_PRECEDING_SIBLING, "axis-preceding-sibling" },
- { Token::TOK_AXIS_PRECEDING, "axis-preceding" },
- { Token::TOK_AXIS_SELF, "axis-self" },
- //function types
- { Token::TOK_FUNC_LAST, "func-last" },
- { Token::TOK_FUNC_POSITION, "func-position" },
- { Token::TOK_FUNC_COUNT, "func-count" },
- { Token::TOK_FUNC_ID, "func-id" },
- { Token::TOK_FUNC_LOCAL_NAME, "func-local-name" },
- { Token::TOK_FUNC_NAMESPACE_URI, "func-namespace-uri" },
- { Token::TOK_FUNC_NAME, "func-name" },
- { Token::TOK_FUNC_STRING, "func-string" },
- { Token::TOK_FUNC_CONCAT, "func-concat" },
- { Token::TOK_FUNC_STARTS_WITH, "func-starts-with" },
- { Token::TOK_FUNC_CONTAINS, "func-contains" },
- { Token::TOK_FUNC_SUBSTRING_BEFORE, "func-substring-before" },
- { Token::TOK_FUNC_SUBSTRING_AFTER, "func-substring-after" },
- { Token::TOK_FUNC_SUBSTRING, "func-substring" },
- { Token::TOK_FUNC_STRING_LENGTH, "func-string-length" },
- { Token::TOK_FUNC_NORMALIZE_SPACE, "func-normalize-space" },
- { Token::TOK_FUNC_TRANSLATE, "func-translate" },
- { Token::TOK_FUNC_BOOLEAN, "func-boolean" },
- { Token::TOK_FUNC_NOT, "func-not" },
- { Token::TOK_FUNC_TRUE, "func-true" },
- { Token::TOK_FUNC_FALSE, "func-false" },
- { Token::TOK_FUNC_LANG, "func-lang" },
- { Token::TOK_FUNC_NUMBER, "func-number" },
- { Token::TOK_FUNC_SUM, "func-sum" },
- { Token::TOK_FUNC_FLOOR, "func-floor" },
- { Token::TOK_FUNC_CEILING, "func-ceiling" },
- { Token::TOK_FUNC_ROUND, "func-round" },
- { -1, (char *)0 }
-};
-
-
-/**
- * Return the string TokenType of this token
- * (in the .cpp file)
- */
-DOMString Token::getTypeString()
-{
- DOMString ret = "unknown";
- for (TokenStringPair *pair = tokenStrings ; pair->sval ; pair++)
- {
- if (pair->ival == type)
- {
- ret = pair->sval;
- break;
- }
- }
- return ret;
-}
-
-
-
-//########################################################################
-//# X P A T H A X I S
-//########################################################################
-
-/**
- *
- */
-Axis::Axis()
-{
- init();
-}
-
-
-/**
- *
- */
-Axis::Axis(int tokPos)
-{
- init();
- tokenPosition = tokPos;
-}
-
-
-/**
- *
- */
-Axis::Axis(const Axis &other)
-{
- init();
- assign(other);
-}
-
-
-/**
- *
- */
-Axis::~Axis()
-{
-}
-
-
-/**
- *
- */
-Axis &Axis::operator=(const Axis &other)
-{
- assign(other);
- return *this;
-}
-
-/**
- *
- */
-void Axis::init()
-{
- tokenPosition = 0;
-}
-
-/**
- *
- */
-void Axis::assign(const Axis &other)
-{
- tokenPosition = other.tokenPosition;
-}
-
-/**
- *
- */
-void Axis::setPosition(unsigned int val)
-{
- tokenPosition = val;
-}
-
-/**
- *
- */
-unsigned int Axis::getPosition()
-{
- return tokenPosition;
-}
-
-/**
- *
- */
-void Axis::setNode(const Node *val)
-{
- node = (Node *)val;
-}
-
-/**
- *
- */
-Node *Axis::getNode()
-{
- return node;
-}
-
-//########################################################################
-//# X P A T H S T A C K I T E M
-//########################################################################
-
-/**
- *
- */
-StackItem::StackItem()
-{
- ival = 0L;
- dval = 0.0;
-}
-
-
-/**
- *
- */
-StackItem::StackItem(const StackItem &other)
-{
- assign(other);
-}
-
-
-/**
- *
- */
-StackItem::~StackItem()
-{
-}
-
-
-/**
- *
- */
-StackItem &StackItem::operator=(const StackItem &other)
-{
- assign(other);
- return *this;
-}
-
-/**
- *
- */
-void StackItem::assign(const StackItem &other)
-{
- sval = other.sval;
- ival = other.ival;
- dval = other.dval;
-}
-
-
-//########################################################################
-//# T O K E N L I S T
-//########################################################################
-
-/**
- *
- */
-TokenList::TokenList()
-{
-}
-
-
-/**
- *
- */
-TokenList::TokenList(const TokenList &other)
-{
- assign(other);
-}
-
-/**
- *
- */
-TokenList &TokenList::operator=(const TokenList &other)
-{
- assign(other);
- return *this;
-}
-
-/**
- *
- */
-void TokenList::assign(const TokenList &other)
-{
- tokens = other.tokens;
-}
-
-/**
- *
- */
-TokenList::~TokenList()
-{
- clear();
-}
-
-/**
- *
- */
-void TokenList::clear()
-{
- std::vector<Token *>::iterator iter;
- for (iter = tokens.begin() ; iter!= tokens.end() ; iter++)
- {
- delete (*iter);
- }
- tokens.clear();
-}
-
-/**
- *
- */
-void TokenList::add(Token *tok)
-{
- tokens.push_back(tok);
-}
-
-
-/**
- *
- */
-unsigned int TokenList::size() const
-{
- return (unsigned int)tokens.size();
-}
-
-
-/**
- *
- */
-void TokenList::dump()
-{
- std::vector<Token *>::iterator iter;
- printf("############# TOKENS\n");
- for (iter = tokens.begin() ; iter != tokens.end() ; iter++)
- {
- Token *tok = *iter;
- tok->dump();
- }
-}
-
-
-//########################################################################
-//# X P A T H E X E C U T O R
-//########################################################################
-
-/**
- *
- */
-TokenExecutor::TokenExecutor()
-{
- reset();
-}
-
-
-/**
- *
- */
-TokenExecutor::TokenExecutor(const TokenExecutor &other)
-{
- reset();
- assign(other);
-}
-
-
-/**
- *
- */
-TokenExecutor::~TokenExecutor()
-{
-}
-
-
-/**
- *
- */
-void TokenExecutor::assign(const TokenExecutor &other)
-{
- axis = other.axis;
- axisStack = other.axisStack;
- stackSize = other.stackSize;
- for (int i=0 ; i<stackSize ; i++)
- stack[i] = other.stack[i];
-}
-
-
-/**
- *
- */
-void TokenExecutor::reset()
-{
- axis.setPosition(0);
- axis.setNode(NULL);
- stackSize = 0;
-}
-
-
-
-
-/**
- * Set the root node
- */
-NodeList TokenExecutor::execute(const TokenList &tokens, const Node *node)
-{
-
- axis.setPosition(0);
- axis.setNode(node);
-
- nodeList.clear();
-
- while (axis.getPosition() < tokens.size())
- {
- }
-
- return nodeList;
-}
-
-
-
-
-
-/**
- *
- */
-void TokenExecutor::push(StackItem &item)
-{
- if (stackSize>=STACK_SIZE)
- {
- return;
- }
- stack[stackSize++] = item;
-}
-
-/**
- *
- */
-StackItem TokenExecutor::pop()
-{
- if (stackSize<1)
- {
- StackItem item;
- return item;
- }
- return stack[--stackSize];
-}
-
-
-
-
-
-
-
-
-
-
-} // namespace xpath
-} // namespace dom
-} // namespace w3c
-} // namespace org
-//########################################################################
-//# E N D O F F I L E
-//########################################################################
-
-
-
+/**
+ * Phoebe DOM Implementation.
+ *
+ * This is a C++ approximation of the W3C DOM model, which follows
+ * fairly closely the specifications in the various .idl files, copies of
+ * which are provided for reference. Most important is this one:
+ *
+ * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
+ *
+ * Authors:
+ * Bob Jamison
+ *
+ * Copyright (C) 2006 Bob Jamison
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+#include "xpathtoken.h"
+#include <stdio.h>
+
+
+
+namespace org
+{
+namespace w3c
+{
+namespace dom
+{
+namespace xpath
+{
+
+//########################################################################
+//# X P A T H T O K E N
+//########################################################################
+
+typedef struct
+{
+ int ival;
+ char *sval;
+} TokenStringPair;
+
+static TokenStringPair tokenStrings[] =
+{
+ //primitives
+ { Token::TOK_NOP, "nop" },
+ { Token::TOK_STR, "str" },
+ { Token::TOK_INT, "int" },
+ { Token::TOK_FLOAT, "float" },
+ //operators
+ { Token::TOK_AND, "and" },
+ { Token::TOK_OR, "or" },
+ { Token::TOK_MOD, "mod" },
+ { Token::TOK_DIV, "div" },
+ { Token::TOK_MULTIPLY, "multiply" },
+ { Token::TOK_DOUBLE_SLASH, "double-slash" },
+ { Token::TOK_SLASH, "slash" },
+ { Token::TOK_PIPE, "pipe" },
+ { Token::TOK_PLUS, "plus" },
+ { Token::TOK_MINUS, "minus" },
+ { Token::TOK_NEG, "neg" },
+ { Token::TOK_EQUALS, "equals" },
+ { Token::TOK_NOT_EQUALS, "not-equals" },
+ { Token::TOK_LESS_THAN_EQUALS, "less-than-equals" },
+ { Token::TOK_LESS_THAN, "less-than" },
+ { Token::TOK_GREATER_THAN_EQUALS, "greater-than-equals" },
+ { Token::TOK_GREATER_THAN, "greater-than" },
+ //path types
+ { Token::TOK_ABSOLUTE, "absolute" },
+ { Token::TOK_RELATIVE, "relative" },
+ { Token::TOK_STEP, "step" },
+ { Token::TOK_NAME_TEST, "name-test" },
+ { Token::TOK_EXPR, "expr" },
+ { Token::TOK_UNION, "union" },
+ //axis types
+ { Token::TOK_AXIS_ANCESTOR_OR_SELF, "axis-ancestor-or-self" },
+ { Token::TOK_AXIS_ANCESTOR, "axis-ancestor" },
+ { Token::TOK_AXIS_ATTRIBUTE, "axis-attribute" },
+ { Token::TOK_AXIS_CHILD, "axis-child" },
+ { Token::TOK_AXIS_DESCENDANT_OR_SELF, "axis-descendant-or-self" },
+ { Token::TOK_AXIS_DESCENDANT, "axis-descendant" },
+ { Token::TOK_AXIS_FOLLOWING_SIBLING, "axis-following-sibling" },
+ { Token::TOK_AXIS_FOLLOWING, "axis-following" },
+ { Token::TOK_AXIS_NAMESPACE, "axis-namespace" },
+ { Token::TOK_AXIS_PARENT, "axis-parent" },
+ { Token::TOK_AXIS_PRECEDING_SIBLING, "axis-preceding-sibling" },
+ { Token::TOK_AXIS_PRECEDING, "axis-preceding" },
+ { Token::TOK_AXIS_SELF, "axis-self" },
+ //function types
+ { Token::TOK_FUNC_LAST, "func-last" },
+ { Token::TOK_FUNC_POSITION, "func-position" },
+ { Token::TOK_FUNC_COUNT, "func-count" },
+ { Token::TOK_FUNC_ID, "func-id" },
+ { Token::TOK_FUNC_LOCAL_NAME, "func-local-name" },
+ { Token::TOK_FUNC_NAMESPACE_URI, "func-namespace-uri" },
+ { Token::TOK_FUNC_NAME, "func-name" },
+ { Token::TOK_FUNC_STRING, "func-string" },
+ { Token::TOK_FUNC_CONCAT, "func-concat" },
+ { Token::TOK_FUNC_STARTS_WITH, "func-starts-with" },
+ { Token::TOK_FUNC_CONTAINS, "func-contains" },
+ { Token::TOK_FUNC_SUBSTRING_BEFORE, "func-substring-before" },
+ { Token::TOK_FUNC_SUBSTRING_AFTER, "func-substring-after" },
+ { Token::TOK_FUNC_SUBSTRING, "func-substring" },
+ { Token::TOK_FUNC_STRING_LENGTH, "func-string-length" },
+ { Token::TOK_FUNC_NORMALIZE_SPACE, "func-normalize-space" },
+ { Token::TOK_FUNC_TRANSLATE, "func-translate" },
+ { Token::TOK_FUNC_BOOLEAN, "func-boolean" },
+ { Token::TOK_FUNC_NOT, "func-not" },
+ { Token::TOK_FUNC_TRUE, "func-true" },
+ { Token::TOK_FUNC_FALSE, "func-false" },
+ { Token::TOK_FUNC_LANG, "func-lang" },
+ { Token::TOK_FUNC_NUMBER, "func-number" },
+ { Token::TOK_FUNC_SUM, "func-sum" },
+ { Token::TOK_FUNC_FLOOR, "func-floor" },
+ { Token::TOK_FUNC_CEILING, "func-ceiling" },
+ { Token::TOK_FUNC_ROUND, "func-round" },
+ { -1, (char *)0 }
+};
+
+
+/**
+ * Return the string TokenType of this token
+ * (in the .cpp file)
+ */
+DOMString Token::getTypeString()
+{
+ DOMString ret = "unknown";
+ for (TokenStringPair *pair = tokenStrings ; pair->sval ; pair++)
+ {
+ if (pair->ival == type)
+ {
+ ret = pair->sval;
+ break;
+ }
+ }
+ return ret;
+}
+
+
+
+//########################################################################
+//# X P A T H A X I S
+//########################################################################
+
+/**
+ *
+ */
+Axis::Axis()
+{
+ init();
+}
+
+
+/**
+ *
+ */
+Axis::Axis(int tokPos)
+{
+ init();
+ tokenPosition = tokPos;
+}
+
+
+/**
+ *
+ */
+Axis::Axis(const Axis &other)
+{
+ init();
+ assign(other);
+}
+
+
+/**
+ *
+ */
+Axis::~Axis()
+{
+}
+
+
+/**
+ *
+ */
+Axis &Axis::operator=(const Axis &other)
+{
+ assign(other);
+ return *this;
+}
+
+/**
+ *
+ */
+void Axis::init()
+{
+ tokenPosition = 0;
+}
+
+/**
+ *
+ */
+void Axis::assign(const Axis &other)
+{
+ tokenPosition = other.tokenPosition;
+}
+
+/**
+ *
+ */
+void Axis::setPosition(unsigned int val)
+{
+ tokenPosition = val;
+}
+
+/**
+ *
+ */
+unsigned int Axis::getPosition()
+{
+ return tokenPosition;
+}
+
+/**
+ *
+ */
+void Axis::setNode(const Node *val)
+{
+ node = (Node *)val;
+}
+
+/**
+ *
+ */
+Node *Axis::getNode()
+{
+ return node;
+}
+
+//########################################################################
+//# X P A T H S T A C K I T E M
+//########################################################################
+
+/**
+ *
+ */
+StackItem::StackItem()
+{
+ ival = 0L;
+ dval = 0.0;
+}
+
+
+/**
+ *
+ */
+StackItem::StackItem(const StackItem &other)
+{
+ assign(other);
+}
+
+
+/**
+ *
+ */
+StackItem::~StackItem()
+{
+}
+
+
+/**
+ *
+ */
+StackItem &StackItem::operator=(const StackItem &other)
+{
+ assign(other);
+ return *this;
+}
+
+/**
+ *
+ */
+void StackItem::assign(const StackItem &other)
+{
+ sval = other.sval;
+ ival = other.ival;
+ dval = other.dval;
+}
+
+
+//########################################################################
+//# T O K E N L I S T
+//########################################################################
+
+/**
+ *
+ */
+TokenList::TokenList()
+{
+}
+
+
+/**
+ *
+ */
+TokenList::TokenList(const TokenList &other)
+{
+ assign(other);
+}
+
+/**
+ *
+ */
+TokenList &TokenList::operator=(const TokenList &other)
+{
+ assign(other);
+ return *this;
+}
+
+/**
+ *
+ */
+void TokenList::assign(const TokenList &other)
+{
+ tokens = other.tokens;
+}
+
+/**
+ *
+ */
+TokenList::~TokenList()
+{
+ clear();
+}
+
+/**
+ *
+ */
+void TokenList::clear()
+{
+ std::vector<Token *>::iterator iter;
+ for (iter = tokens.begin() ; iter!= tokens.end() ; iter++)
+ {
+ delete (*iter);
+ }
+ tokens.clear();
+}
+
+/**
+ *
+ */
+void TokenList::add(Token *tok)
+{
+ tokens.push_back(tok);
+}
+
+
+/**
+ *
+ */
+unsigned int TokenList::size() const
+{
+ return (unsigned int)tokens.size();
+}
+
+
+/**
+ *
+ */
+void TokenList::dump()
+{
+ std::vector<Token *>::iterator iter;
+ printf("############# TOKENS\n");
+ for (iter = tokens.begin() ; iter != tokens.end() ; iter++)
+ {
+ Token *tok = *iter;
+ tok->dump();
+ }
+}
+
+
+//########################################################################
+//# X P A T H E X E C U T O R
+//########################################################################
+
+/**
+ *
+ */
+TokenExecutor::TokenExecutor()
+{
+ reset();
+}
+
+
+/**
+ *
+ */
+TokenExecutor::TokenExecutor(const TokenExecutor &other)
+{
+ reset();
+ assign(other);
+}
+
+
+/**
+ *
+ */
+TokenExecutor::~TokenExecutor()
+{
+}
+
+
+/**
+ *
+ */
+void TokenExecutor::assign(const TokenExecutor &other)
+{
+ axis = other.axis;
+ axisStack = other.axisStack;
+ stackSize = other.stackSize;
+ for (int i=0 ; i<stackSize ; i++)
+ stack[i] = other.stack[i];
+}
+
+
+/**
+ *
+ */
+void TokenExecutor::reset()
+{
+ axis.setPosition(0);
+ axis.setNode(NULL);
+ stackSize = 0;
+}
+
+
+
+
+/**
+ * Set the root node
+ */
+NodeList TokenExecutor::execute(const TokenList &tokens, const Node *node)
+{
+
+ axis.setPosition(0);
+ axis.setNode(node);
+
+ nodeList.clear();
+
+ while (axis.getPosition() < tokens.size())
+ {
+ }
+
+ return nodeList;
+}
+
+
+
+
+
+/**
+ *
+ */
+void TokenExecutor::push(StackItem &item)
+{
+ if (stackSize>=STACK_SIZE)
+ {
+ return;
+ }
+ stack[stackSize++] = item;
+}
+
+/**
+ *
+ */
+StackItem TokenExecutor::pop()
+{
+ if (stackSize<1)
+ {
+ StackItem item;
+ return item;
+ }
+ return stack[--stackSize];
+}
+
+
+
+
+
+
+
+
+
+
+} // namespace xpath
+} // namespace dom
+} // namespace w3c
+} // namespace org
+//########################################################################
+//# E N D O F F I L E
+//########################################################################
+
+
+
diff --git a/src/dom/xpathtoken.h b/src/dom/xpathtoken.h
index d595ad43c..6c44e639d 100644
--- a/src/dom/xpathtoken.h
+++ b/src/dom/xpathtoken.h
@@ -1,1452 +1,1452 @@
-#ifndef __XPATHTOKEN_H__
-#define __XPATHTOKEN_H__
-
-/**
- * Phoebe DOM Implementation.
- *
- * This is a C++ approximation of the W3C DOM model, which follows
- * fairly closely the specifications in the various .idl files, copies of
- * which are provided for reference. Most important is this one:
- *
- * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
- *
- * Authors:
- * Bob Jamison
- *
- * Copyright (C) 2006 Bob Jamison
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-#include "dom.h"
-
-#include <math.h>
-
-#include <vector>
-
-namespace org
-{
-namespace w3c
-{
-namespace dom
-{
-namespace xpath
-{
-
-typedef org::w3c::dom::DOMString DOMString;
-
-class Axis
-{
-public:
- /**
- * Constructor
- */
- Axis();
-
- /**
- * Constructor
- */
- Axis(int tokPos);
-
- /**
- * Copy constructor
- */
- Axis(const Axis &other);
-
- /**
- * Destructor
- */
- virtual ~Axis();
-
- /**
- *
- */
- Axis &operator=(const Axis &other);
-
- /**
- *
- */
- void init();
-
- /**
- *
- */
- void assign(const Axis &other);
-
- /**
- *
- */
- void setPosition(unsigned int val);
-
- /**
- *
- */
- unsigned int getPosition();
-
- /**
- *
- */
- void setNode(const Node *node);
-
- /**
- *
- */
- Node *getNode();
-
-private:
-
- int tokenPosition;
-
- Node *node;
-};
-
-
-/**
- * This represents a single value on the evaluation stack
- */
-class StackItem
-{
-public:
-
- /**
- * Constructor
- */
- StackItem();
-
- /**
- * Copy constructor
- */
- StackItem(const StackItem &other);
-
- /**
- * Destructor
- */
- virtual ~StackItem();
-
- /**
- *
- */
- StackItem &operator=(const StackItem &other);
-
- /**
- *
- */
- void assign(const StackItem &other);
-
-
- //treat the stack item like an union of string, integer, and double
-
- /**
- * String value
- */
- DOMString sval;
-
- /**
- * Integer value
- */
- long ival;
-
- /**
- * Double value;
- */
- double dval;
-
-};
-
-class TokenList;
-
-//########################################################################
-//# T O K E N E X E C U T O R
-//########################################################################
-
-#define STACK_SIZE 1024
-
-/**
- * A token evaluator, with stack and axis context
- */
-class TokenExecutor
-{
-public:
-
- /**
- * Constructor
- */
- TokenExecutor();
-
- /**
- * Copy constructor
- */
- TokenExecutor(const TokenExecutor &other);
-
- /**
- * Destructor
- */
- virtual ~TokenExecutor();
-
- /**
- * Assign our values to those of the other
- */
- virtual void assign(const TokenExecutor &other);
-
- /**
- * Reset the stack to its original settings
- */
- virtual void reset();
-
- /**
- * Push a stack item onto the stack
- */
- virtual void push(StackItem &item);
-
- /**
- * Pop a stack item from the stack
- */
- virtual StackItem pop();
-
- /**
- * Execute a token list on the stack
- */
- NodeList execute(const TokenList &list, const Node *node);
-
- /**
- *
- */
- Axis axis;
-
- /**
- *
- */
- std::vector<Axis> axisStack;
-
-private:
-
- /**
- * Contains the StackItem stack;
- */
- StackItem stack[STACK_SIZE];
-
- /**
- * Marks the head of the stack, for push() and pop()
- */
- int stackSize;
-
- /**
- * Current list of nodes found by the expression
- */
- NodeList nodeList;
-
-
-};
-
-
-
-//########################################################################
-//# X P A T H T O K E N
-//########################################################################
-
-
-
-/**
- * This is a pseudocode-type class that executes itself on a stack,
- * much like stack-oriented languages such as FORTH or Postscript.
- * Each token can pop zero or more tokens off the stack, and push
- * zero or one token back onto it. When a list of tokens is completed,
- * a single stack value should be left on the stack.
- */
-class Token
-{
-public:
-
- /**
- * Token types. Look in xpathtoken.cpp's function table
- * to see how these types map to their respective
- * functionalities
- */
- typedef enum
- {
- //primitives
- TOK_NOP = 0,
- TOK_STR,
- TOK_INT,
- TOK_FLOAT,
- //operators
- TOK_AND,
- TOK_OR,
- TOK_MOD,
- TOK_DIV,
- TOK_MULTIPLY,
- TOK_DOUBLE_SLASH,
- TOK_SLASH,
- TOK_PIPE,
- TOK_PLUS,
- TOK_MINUS,
- TOK_NEG,
- TOK_EQUALS,
- TOK_NOT_EQUALS,
- TOK_LESS_THAN_EQUALS,
- TOK_LESS_THAN,
- TOK_GREATER_THAN_EQUALS,
- TOK_GREATER_THAN,
- //path types
- TOK_ABSOLUTE,
- TOK_RELATIVE,
- TOK_STEP,
- TOK_NAME_TEST,
- TOK_EXPR,
- TOK_UNION,
- //axis types
- TOK_AXIS_ANCESTOR_OR_SELF,
- TOK_AXIS_ANCESTOR,
- TOK_AXIS_ATTRIBUTE,
- TOK_AXIS_CHILD,
- TOK_AXIS_DESCENDANT_OR_SELF,
- TOK_AXIS_DESCENDANT,
- TOK_AXIS_FOLLOWING_SIBLING,
- TOK_AXIS_FOLLOWING,
- TOK_AXIS_NAMESPACE,
- TOK_AXIS_PARENT,
- TOK_AXIS_PRECEDING_SIBLING,
- TOK_AXIS_PRECEDING,
- TOK_AXIS_SELF,
- //function types
- TOK_FUNC_LAST,
- TOK_FUNC_POSITION,
- TOK_FUNC_COUNT,
- TOK_FUNC_ID,
- TOK_FUNC_LOCAL_NAME,
- TOK_FUNC_NAMESPACE_URI,
- TOK_FUNC_NAME,
- TOK_FUNC_STRING,
- TOK_FUNC_CONCAT,
- TOK_FUNC_STARTS_WITH,
- TOK_FUNC_CONTAINS,
- TOK_FUNC_SUBSTRING_BEFORE,
- TOK_FUNC_SUBSTRING_AFTER,
- TOK_FUNC_SUBSTRING,
- TOK_FUNC_STRING_LENGTH,
- TOK_FUNC_NORMALIZE_SPACE,
- TOK_FUNC_TRANSLATE,
- TOK_FUNC_BOOLEAN,
- TOK_FUNC_NOT,
- TOK_FUNC_TRUE,
- TOK_FUNC_FALSE,
- TOK_FUNC_LANG,
- TOK_FUNC_NUMBER,
- TOK_FUNC_SUM,
- TOK_FUNC_FLOOR,
- TOK_FUNC_CEILING,
- TOK_FUNC_ROUND,
- } TokenType;
-
-
-
-
- /**
- * Constructor with a NOP default type
- */
- Token()
- {
- type = TOK_NOP;
- ival = 0L;
- dval = 0.0;
- }
-
- /**
- * Copy constructor
- */
- Token(const Token &other)
- {
- type = other.type;
- sval = other.sval;
- ival = other.ival;
- dval = other.dval;
- }
-
- /**
- * Destructor
- */
- virtual ~Token()
- {}
-
- /**
- * Return the enumerated TokenType of this token
- */
- virtual int getType()
- { return type; }
- /**
- * Return the string TokenType of this token
- */
- virtual DOMString getTypeString();
-
- /**
- * Let this token execute itself on the given stack,
- * possibly adding Nodes to the node list.
- */
- virtual bool execute(TokenExecutor &stack)
- { return true; }
-
- /**
- * Print the contents of this token
- */
- virtual void dump()
- {
- printf("%s %s %f %ld\n",
- getTypeString().c_str(), sval.c_str(), dval, ival);
- }
-
- //treat the token like an union of string, integer, and double
-
- /**
- * String value
- */
- DOMString sval;
-
- /**
- * Integer value
- */
- long ival;
-
- /**
- * Double value;
- */
- double dval;
-
-protected:
-
- /**
- * The enmerated token type
- */
- int type;
-
-
-private:
-
-
-};
-
-
-//########################################################################
-//# X P A T H T O K E N T Y P E S
-//########################################################################
-
-
-
-//###########################
-//# V A L U E S
-//###########################
-
-class TokStr : public Token
-{
-public:
- TokStr(const DOMString &val)
- {
- type = TOK_STR;
- sval = val;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- StackItem item;
- item.sval = sval;
- exec.push(item);
- return true;
- }
-};
-
-class TokFloat : public Token
-{
-public:
- TokFloat(double val)
- {
- type = TOK_FLOAT;
- dval = val;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- StackItem item;
- item.dval = dval;
- exec.push(item);
- return true;
- }
-};
-
-class TokInt : public Token
-{
-public:
- TokInt(long val)
- {
- type = TOK_INT;
- ival = val;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- StackItem item;
- item.ival = ival;
- exec.push(item);
- return true;
- }
-};
-
-class TokAnd : public Token
-{
-public:
- TokAnd()
- {
- type = TOK_AND;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- StackItem item1 = exec.pop();
- StackItem item2 = exec.pop();
- item1.ival = item1.ival && item2.ival;
- exec.push(item1);
- return true;
- }
-};
-
-class TokOr : public Token
-{
-public:
- TokOr()
- {
- type = TOK_OR;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- StackItem item1 = exec.pop();
- StackItem item2 = exec.pop();
- item1.ival = item1.ival || item2.ival;
- exec.push(item1);
- return true;
- }
-};
-
-class TokMod : public Token
-{
-public:
- TokMod()
- {
- type = TOK_MOD;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- StackItem item1 = exec.pop();
- StackItem item2 = exec.pop();
- item1.dval = fmod(item1.dval, item2.dval);
- exec.push(item1);
- return true;
- }
-};
-
-class TokDiv : public Token
-{
-public:
- TokDiv()
- {
- type = TOK_DIV;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- StackItem item1 = exec.pop();
- StackItem item2 = exec.pop();
- item1.dval /= item2.dval;
- exec.push(item1);
- return true;
- }
-};
-
-class TokMul : public Token
-{
-public:
- TokMul()
- {
- type = TOK_MULTIPLY;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- StackItem item1 = exec.pop();
- StackItem item2 = exec.pop();
- item1.dval *= item2.dval;
- exec.push(item1);
- return true;
- }
-};
-
-class TokPlus : public Token
-{
-public:
- TokPlus()
- {
- type = TOK_PLUS;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- StackItem item1 = exec.pop();
- StackItem item2 = exec.pop();
- item1.dval += item2.dval;
- exec.push(item1);
- return true;
- }
-};
-
-class TokMinus : public Token
-{
-public:
- TokMinus()
- {
- type = TOK_MINUS;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- StackItem item1 = exec.pop();
- StackItem item2 = exec.pop();
- item1.dval -= item2.dval;
- exec.push(item1);
- return true;
- }
-};
-
-class TokNeg : public Token
-{
-public:
- TokNeg()
- {
- type = TOK_NEG;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- StackItem item = exec.pop();
- item.dval = -item.dval;
- item.ival = -item.ival;
- exec.push(item);
- return true;
- }
-};
-
-class TokEquals : public Token
-{
-public:
- TokEquals()
- {
- type = TOK_EQUALS;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- StackItem item1 = exec.pop();
- StackItem item2 = exec.pop();
- item1.ival = (item1.dval == item2.dval);
- exec.push(item1);
- return true;
- }
-};
-
-class TokNotEquals : public Token
-{
-public:
- TokNotEquals()
- {
- type = TOK_NOT_EQUALS;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- StackItem item1 = exec.pop();
- StackItem item2 = exec.pop();
- item1.ival = (item1.dval != item2.dval);
- exec.push(item1);
- return true;
- }
-};
-
-class TokLessThanEquals : public Token
-{
-public:
- TokLessThanEquals()
- {
- type = TOK_LESS_THAN_EQUALS;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- StackItem item1 = exec.pop();
- StackItem item2 = exec.pop();
- item1.ival = (item1.dval <= item2.dval);
- exec.push(item1);
- return true;
- }
-};
-
-class TokLessThan : public Token
-{
-public:
- TokLessThan()
- {
- type = TOK_LESS_THAN;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- StackItem item1 = exec.pop();
- StackItem item2 = exec.pop();
- item1.ival = (item1.dval < item2.dval);
- exec.push(item1);
- return true;
- }
-};
-
-class TokGreaterThanEquals : public Token
-{
-public:
- TokGreaterThanEquals()
- {
- type = TOK_GREATER_THAN_EQUALS;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- StackItem item1 = exec.pop();
- StackItem item2 = exec.pop();
- item1.ival = (item1.dval >= item2.dval);
- exec.push(item1);
- return true;
- }
-};
-
-class TokGreaterThan : public Token
-{
-public:
- TokGreaterThan()
- {
- type = TOK_GREATER_THAN;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- StackItem item1 = exec.pop();
- StackItem item2 = exec.pop();
- item1.ival = (item1.dval > item2.dval);
- exec.push(item1);
- return true;
- }
-};
-
-
-//###########################
-//# X P A T H I T E M S
-//###########################
-
-class TokAbsolute : public Token
-{
-public:
- TokAbsolute()
- {
- type = TOK_ABSOLUTE;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- Node *n = exec.axis.getNode();
- while (n->getParentNode())
- n = n->getParentNode();
- exec.axis.setNode(n);
- return true;
- }
-};
-
-class TokRelative : public Token
-{
-public:
- TokRelative()
- {
- type = TOK_RELATIVE;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- ///exec.axis.currentNode = stack.rootNode;
- return true;
- }
-};
-
-class TokStep : public Token
-{
-public:
- TokStep()
- {
- type = TOK_STEP;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokNameTest : public Token
-{
-public:
- TokNameTest(const DOMString &name)
- {
- type = TOK_NAME_TEST;
- sval = name;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokExpr : public Token
-{
-public:
- TokExpr()
- {
- type = TOK_EXPR;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokUnion : public Token
-{
-public:
- TokUnion()
- {
- type = TOK_UNION;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-
-
-
-//###########################
-//# A X I S
-//###########################
-
-
-class TokAxisAncestorOrSelf : public Token
-{
-public:
- TokAxisAncestorOrSelf()
- {
- type = TOK_AXIS_ANCESTOR_OR_SELF;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokAxisAncestor : public Token
-{
-public:
- TokAxisAncestor()
- {
- type = TOK_AXIS_ANCESTOR;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokAxisAttribute : public Token
-{
-public:
- TokAxisAttribute()
- {
- type = TOK_AXIS_ATTRIBUTE;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokAxisChild : public Token
-{
-public:
- TokAxisChild()
- {
- type = TOK_AXIS_CHILD;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokAxisDescendantOrSelf : public Token
-{
-public:
- TokAxisDescendantOrSelf()
- {
- type = TOK_AXIS_DESCENDANT_OR_SELF;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokAxisDescendant : public Token
-{
-public:
- TokAxisDescendant()
- {
- type = TOK_AXIS_DESCENDANT;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokAxisFollowingSibling : public Token
-{
-public:
- TokAxisFollowingSibling()
- {
- type = TOK_AXIS_FOLLOWING_SIBLING;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokAxisFollowing : public Token
-{
-public:
- TokAxisFollowing()
- {
- type = TOK_AXIS_FOLLOWING;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokAxisNamespace : public Token
-{
-public:
- TokAxisNamespace()
- {
- type = TOK_AXIS_NAMESPACE;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokAxisParent : public Token
-{
-public:
- TokAxisParent()
- {
- type = TOK_AXIS_PARENT;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokAxisPrecedingSibling : public Token
-{
-public:
- TokAxisPrecedingSibling()
- {
- type = TOK_AXIS_PRECEDING_SIBLING;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokAxisPreceding : public Token
-{
-public:
- TokAxisPreceding()
- {
- type = TOK_AXIS_PRECEDING;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokAxisSelf : public Token
-{
-public:
- TokAxisSelf()
- {
- type = TOK_AXIS_SELF;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-
-
-//###########################
-//# F U N C T I O N S
-//###########################
-
-class TokFuncLast : public Token
-{
-public:
- TokFuncLast()
- {
- type = TOK_FUNC_LAST;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokFuncPosition : public Token
-{
-public:
- TokFuncPosition()
- {
- type = TOK_FUNC_POSITION;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokFuncCount : public Token
-{
-public:
- TokFuncCount()
- {
- type = TOK_FUNC_COUNT;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokFuncId : public Token
-{
-public:
- TokFuncId()
- {
- type = TOK_FUNC_ID;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokFuncLocalName : public Token
-{
-public:
- TokFuncLocalName()
- {
- type = TOK_FUNC_LOCAL_NAME;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokFuncNamespaceUri : public Token
-{
-public:
- TokFuncNamespaceUri()
- {
- type = TOK_FUNC_NAMESPACE_URI;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokFuncName : public Token
-{
-public:
- TokFuncName()
- {
- type = TOK_FUNC_NAME;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokFuncString : public Token
-{
-public:
- TokFuncString()
- {
- type = TOK_FUNC_STRING;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokFuncConcat : public Token
-{
-public:
- TokFuncConcat()
- {
- type = TOK_FUNC_CONCAT;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokFuncStartsWith : public Token
-{
-public:
- TokFuncStartsWith()
- {
- type = TOK_FUNC_STARTS_WITH;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokFuncContains : public Token
-{
-public:
- TokFuncContains()
- {
- type = TOK_FUNC_CONTAINS;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokFuncSubstringBefore : public Token
-{
-public:
- TokFuncSubstringBefore()
- {
- type = TOK_FUNC_SUBSTRING_BEFORE;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokFuncSubstringAfter : public Token
-{
-public:
- TokFuncSubstringAfter()
- {
- type = TOK_FUNC_SUBSTRING_AFTER;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokFuncSubstring : public Token
-{
-public:
- TokFuncSubstring()
- {
- type = TOK_FUNC_SUBSTRING;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokFuncStringLength : public Token
-{
-public:
- TokFuncStringLength()
- {
- type = TOK_FUNC_STRING_LENGTH;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokFuncNormalizeSpace : public Token
-{
-public:
- TokFuncNormalizeSpace()
- {
- type = TOK_FUNC_NORMALIZE_SPACE;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokFuncTranslate : public Token
-{
-public:
- TokFuncTranslate()
- {
- type = TOK_FUNC_TRANSLATE;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokFuncBoolean : public Token
-{
-public:
- TokFuncBoolean()
- {
- type = TOK_FUNC_BOOLEAN;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokFuncNot : public Token
-{
-public:
- TokFuncNot()
- {
- type = TOK_FUNC_NOT;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokFuncTrue : public Token
-{
-public:
- TokFuncTrue()
- {
- type = TOK_FUNC_TRUE;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokFuncFalse : public Token
-{
-public:
- TokFuncFalse()
- {
- type = TOK_FUNC_FALSE;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokFuncLang : public Token
-{
-public:
- TokFuncLang()
- {
- type = TOK_FUNC_LANG;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokFuncNumber : public Token
-{
-public:
- TokFuncNumber()
- {
- type = TOK_FUNC_NUMBER;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokFuncSum : public Token
-{
-public:
- TokFuncSum()
- {
- type = TOK_FUNC_SUM;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokFuncFloor : public Token
-{
-public:
- TokFuncFloor()
- {
- type = TOK_FUNC_FLOOR;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokFuncCeiling : public Token
-{
-public:
- TokFuncCeiling()
- {
- type = TOK_FUNC_CEILING;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-class TokFuncRound : public Token
-{
-public:
- TokFuncRound()
- {
- type = TOK_FUNC_ROUND;
- }
- virtual bool execute(TokenExecutor &exec)
- {
- return true;
- }
-};
-
-
-
-
-
-
-//########################################################################
-//# T O K E N L I S T
-//########################################################################
-
-/**
- *
- */
-class TokenList
-{
-public:
-
- /**
- *
- */
- TokenList();
-
- /**
- *
- */
- TokenList(const TokenList &other);
-
- /**
- *
- */
- TokenList &operator=(const TokenList &other);
-
- /**
- *
- */
- void assign(const TokenList &other);
-
- /**
- *
- */
- virtual ~TokenList();
-
- /**
- *
- */
- virtual void clear();
-
- /**
- *
- */
- virtual void add(Token *tok);
-
- /**
- *
- */
- virtual unsigned int size() const;
-
- /**
- *
- */
- virtual void dump();
-
-private:
-
-
- std::vector<Token *> tokens;
-
-
-};
-
-
-
-
-
-
-
-} // namespace xpath
-} // namespace dom
-} // namespace w3c
-} // namespace org
-
-
-
-
-
-
-#endif /* __XPATHTOKEN_H__ */
-//########################################################################
-//# E N D O F F I L E
-//########################################################################
-
+#ifndef __XPATHTOKEN_H__
+#define __XPATHTOKEN_H__
+
+/**
+ * Phoebe DOM Implementation.
+ *
+ * This is a C++ approximation of the W3C DOM model, which follows
+ * fairly closely the specifications in the various .idl files, copies of
+ * which are provided for reference. Most important is this one:
+ *
+ * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
+ *
+ * Authors:
+ * Bob Jamison
+ *
+ * Copyright (C) 2006 Bob Jamison
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+#include "dom.h"
+
+#include <math.h>
+
+#include <vector>
+
+namespace org
+{
+namespace w3c
+{
+namespace dom
+{
+namespace xpath
+{
+
+typedef org::w3c::dom::DOMString DOMString;
+
+class Axis
+{
+public:
+ /**
+ * Constructor
+ */
+ Axis();
+
+ /**
+ * Constructor
+ */
+ Axis(int tokPos);
+
+ /**
+ * Copy constructor
+ */
+ Axis(const Axis &other);
+
+ /**
+ * Destructor
+ */
+ virtual ~Axis();
+
+ /**
+ *
+ */
+ Axis &operator=(const Axis &other);
+
+ /**
+ *
+ */
+ void init();
+
+ /**
+ *
+ */
+ void assign(const Axis &other);
+
+ /**
+ *
+ */
+ void setPosition(unsigned int val);
+
+ /**
+ *
+ */
+ unsigned int getPosition();
+
+ /**
+ *
+ */
+ void setNode(const Node *node);
+
+ /**
+ *
+ */
+ Node *getNode();
+
+private:
+
+ int tokenPosition;
+
+ Node *node;
+};
+
+
+/**
+ * This represents a single value on the evaluation stack
+ */
+class StackItem
+{
+public:
+
+ /**
+ * Constructor
+ */
+ StackItem();
+
+ /**
+ * Copy constructor
+ */
+ StackItem(const StackItem &other);
+
+ /**
+ * Destructor
+ */
+ virtual ~StackItem();
+
+ /**
+ *
+ */
+ StackItem &operator=(const StackItem &other);
+
+ /**
+ *
+ */
+ void assign(const StackItem &other);
+
+
+ //treat the stack item like an union of string, integer, and double
+
+ /**
+ * String value
+ */
+ DOMString sval;
+
+ /**
+ * Integer value
+ */
+ long ival;
+
+ /**
+ * Double value;
+ */
+ double dval;
+
+};
+
+class TokenList;
+
+//########################################################################
+//# T O K E N E X E C U T O R
+//########################################################################
+
+#define STACK_SIZE 1024
+
+/**
+ * A token evaluator, with stack and axis context
+ */
+class TokenExecutor
+{
+public:
+
+ /**
+ * Constructor
+ */
+ TokenExecutor();
+
+ /**
+ * Copy constructor
+ */
+ TokenExecutor(const TokenExecutor &other);
+
+ /**
+ * Destructor
+ */
+ virtual ~TokenExecutor();
+
+ /**
+ * Assign our values to those of the other
+ */
+ virtual void assign(const TokenExecutor &other);
+
+ /**
+ * Reset the stack to its original settings
+ */
+ virtual void reset();
+
+ /**
+ * Push a stack item onto the stack
+ */
+ virtual void push(StackItem &item);
+
+ /**
+ * Pop a stack item from the stack
+ */
+ virtual StackItem pop();
+
+ /**
+ * Execute a token list on the stack
+ */
+ NodeList execute(const TokenList &list, const Node *node);
+
+ /**
+ *
+ */
+ Axis axis;
+
+ /**
+ *
+ */
+ std::vector<Axis> axisStack;
+
+private:
+
+ /**
+ * Contains the StackItem stack;
+ */
+ StackItem stack[STACK_SIZE];
+
+ /**
+ * Marks the head of the stack, for push() and pop()
+ */
+ int stackSize;
+
+ /**
+ * Current list of nodes found by the expression
+ */
+ NodeList nodeList;
+
+
+};
+
+
+
+//########################################################################
+//# X P A T H T O K E N
+//########################################################################
+
+
+
+/**
+ * This is a pseudocode-type class that executes itself on a stack,
+ * much like stack-oriented languages such as FORTH or Postscript.
+ * Each token can pop zero or more tokens off the stack, and push
+ * zero or one token back onto it. When a list of tokens is completed,
+ * a single stack value should be left on the stack.
+ */
+class Token
+{
+public:
+
+ /**
+ * Token types. Look in xpathtoken.cpp's function table
+ * to see how these types map to their respective
+ * functionalities
+ */
+ typedef enum
+ {
+ //primitives
+ TOK_NOP = 0,
+ TOK_STR,
+ TOK_INT,
+ TOK_FLOAT,
+ //operators
+ TOK_AND,
+ TOK_OR,
+ TOK_MOD,
+ TOK_DIV,
+ TOK_MULTIPLY,
+ TOK_DOUBLE_SLASH,
+ TOK_SLASH,
+ TOK_PIPE,
+ TOK_PLUS,
+ TOK_MINUS,
+ TOK_NEG,
+ TOK_EQUALS,
+ TOK_NOT_EQUALS,
+ TOK_LESS_THAN_EQUALS,
+ TOK_LESS_THAN,
+ TOK_GREATER_THAN_EQUALS,
+ TOK_GREATER_THAN,
+ //path types
+ TOK_ABSOLUTE,
+ TOK_RELATIVE,
+ TOK_STEP,
+ TOK_NAME_TEST,
+ TOK_EXPR,
+ TOK_UNION,
+ //axis types
+ TOK_AXIS_ANCESTOR_OR_SELF,
+ TOK_AXIS_ANCESTOR,
+ TOK_AXIS_ATTRIBUTE,
+ TOK_AXIS_CHILD,
+ TOK_AXIS_DESCENDANT_OR_SELF,
+ TOK_AXIS_DESCENDANT,
+ TOK_AXIS_FOLLOWING_SIBLING,
+ TOK_AXIS_FOLLOWING,
+ TOK_AXIS_NAMESPACE,
+ TOK_AXIS_PARENT,
+ TOK_AXIS_PRECEDING_SIBLING,
+ TOK_AXIS_PRECEDING,
+ TOK_AXIS_SELF,
+ //function types
+ TOK_FUNC_LAST,
+ TOK_FUNC_POSITION,
+ TOK_FUNC_COUNT,
+ TOK_FUNC_ID,
+ TOK_FUNC_LOCAL_NAME,
+ TOK_FUNC_NAMESPACE_URI,
+ TOK_FUNC_NAME,
+ TOK_FUNC_STRING,
+ TOK_FUNC_CONCAT,
+ TOK_FUNC_STARTS_WITH,
+ TOK_FUNC_CONTAINS,
+ TOK_FUNC_SUBSTRING_BEFORE,
+ TOK_FUNC_SUBSTRING_AFTER,
+ TOK_FUNC_SUBSTRING,
+ TOK_FUNC_STRING_LENGTH,
+ TOK_FUNC_NORMALIZE_SPACE,
+ TOK_FUNC_TRANSLATE,
+ TOK_FUNC_BOOLEAN,
+ TOK_FUNC_NOT,
+ TOK_FUNC_TRUE,
+ TOK_FUNC_FALSE,
+ TOK_FUNC_LANG,
+ TOK_FUNC_NUMBER,
+ TOK_FUNC_SUM,
+ TOK_FUNC_FLOOR,
+ TOK_FUNC_CEILING,
+ TOK_FUNC_ROUND,
+ } TokenType;
+
+
+
+
+ /**
+ * Constructor with a NOP default type
+ */
+ Token()
+ {
+ type = TOK_NOP;
+ ival = 0L;
+ dval = 0.0;
+ }
+
+ /**
+ * Copy constructor
+ */
+ Token(const Token &other)
+ {
+ type = other.type;
+ sval = other.sval;
+ ival = other.ival;
+ dval = other.dval;
+ }
+
+ /**
+ * Destructor
+ */
+ virtual ~Token()
+ {}
+
+ /**
+ * Return the enumerated TokenType of this token
+ */
+ virtual int getType()
+ { return type; }
+ /**
+ * Return the string TokenType of this token
+ */
+ virtual DOMString getTypeString();
+
+ /**
+ * Let this token execute itself on the given stack,
+ * possibly adding Nodes to the node list.
+ */
+ virtual bool execute(TokenExecutor &stack)
+ { return true; }
+
+ /**
+ * Print the contents of this token
+ */
+ virtual void dump()
+ {
+ printf("%s %s %f %ld\n",
+ getTypeString().c_str(), sval.c_str(), dval, ival);
+ }
+
+ //treat the token like an union of string, integer, and double
+
+ /**
+ * String value
+ */
+ DOMString sval;
+
+ /**
+ * Integer value
+ */
+ long ival;
+
+ /**
+ * Double value;
+ */
+ double dval;
+
+protected:
+
+ /**
+ * The enmerated token type
+ */
+ int type;
+
+
+private:
+
+
+};
+
+
+//########################################################################
+//# X P A T H T O K E N T Y P E S
+//########################################################################
+
+
+
+//###########################
+//# V A L U E S
+//###########################
+
+class TokStr : public Token
+{
+public:
+ TokStr(const DOMString &val)
+ {
+ type = TOK_STR;
+ sval = val;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ StackItem item;
+ item.sval = sval;
+ exec.push(item);
+ return true;
+ }
+};
+
+class TokFloat : public Token
+{
+public:
+ TokFloat(double val)
+ {
+ type = TOK_FLOAT;
+ dval = val;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ StackItem item;
+ item.dval = dval;
+ exec.push(item);
+ return true;
+ }
+};
+
+class TokInt : public Token
+{
+public:
+ TokInt(long val)
+ {
+ type = TOK_INT;
+ ival = val;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ StackItem item;
+ item.ival = ival;
+ exec.push(item);
+ return true;
+ }
+};
+
+class TokAnd : public Token
+{
+public:
+ TokAnd()
+ {
+ type = TOK_AND;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ StackItem item1 = exec.pop();
+ StackItem item2 = exec.pop();
+ item1.ival = item1.ival && item2.ival;
+ exec.push(item1);
+ return true;
+ }
+};
+
+class TokOr : public Token
+{
+public:
+ TokOr()
+ {
+ type = TOK_OR;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ StackItem item1 = exec.pop();
+ StackItem item2 = exec.pop();
+ item1.ival = item1.ival || item2.ival;
+ exec.push(item1);
+ return true;
+ }
+};
+
+class TokMod : public Token
+{
+public:
+ TokMod()
+ {
+ type = TOK_MOD;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ StackItem item1 = exec.pop();
+ StackItem item2 = exec.pop();
+ item1.dval = fmod(item1.dval, item2.dval);
+ exec.push(item1);
+ return true;
+ }
+};
+
+class TokDiv : public Token
+{
+public:
+ TokDiv()
+ {
+ type = TOK_DIV;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ StackItem item1 = exec.pop();
+ StackItem item2 = exec.pop();
+ item1.dval /= item2.dval;
+ exec.push(item1);
+ return true;
+ }
+};
+
+class TokMul : public Token
+{
+public:
+ TokMul()
+ {
+ type = TOK_MULTIPLY;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ StackItem item1 = exec.pop();
+ StackItem item2 = exec.pop();
+ item1.dval *= item2.dval;
+ exec.push(item1);
+ return true;
+ }
+};
+
+class TokPlus : public Token
+{
+public:
+ TokPlus()
+ {
+ type = TOK_PLUS;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ StackItem item1 = exec.pop();
+ StackItem item2 = exec.pop();
+ item1.dval += item2.dval;
+ exec.push(item1);
+ return true;
+ }
+};
+
+class TokMinus : public Token
+{
+public:
+ TokMinus()
+ {
+ type = TOK_MINUS;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ StackItem item1 = exec.pop();
+ StackItem item2 = exec.pop();
+ item1.dval -= item2.dval;
+ exec.push(item1);
+ return true;
+ }
+};
+
+class TokNeg : public Token
+{
+public:
+ TokNeg()
+ {
+ type = TOK_NEG;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ StackItem item = exec.pop();
+ item.dval = -item.dval;
+ item.ival = -item.ival;
+ exec.push(item);
+ return true;
+ }
+};
+
+class TokEquals : public Token
+{
+public:
+ TokEquals()
+ {
+ type = TOK_EQUALS;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ StackItem item1 = exec.pop();
+ StackItem item2 = exec.pop();
+ item1.ival = (item1.dval == item2.dval);
+ exec.push(item1);
+ return true;
+ }
+};
+
+class TokNotEquals : public Token
+{
+public:
+ TokNotEquals()
+ {
+ type = TOK_NOT_EQUALS;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ StackItem item1 = exec.pop();
+ StackItem item2 = exec.pop();
+ item1.ival = (item1.dval != item2.dval);
+ exec.push(item1);
+ return true;
+ }
+};
+
+class TokLessThanEquals : public Token
+{
+public:
+ TokLessThanEquals()
+ {
+ type = TOK_LESS_THAN_EQUALS;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ StackItem item1 = exec.pop();
+ StackItem item2 = exec.pop();
+ item1.ival = (item1.dval <= item2.dval);
+ exec.push(item1);
+ return true;
+ }
+};
+
+class TokLessThan : public Token
+{
+public:
+ TokLessThan()
+ {
+ type = TOK_LESS_THAN;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ StackItem item1 = exec.pop();
+ StackItem item2 = exec.pop();
+ item1.ival = (item1.dval < item2.dval);
+ exec.push(item1);
+ return true;
+ }
+};
+
+class TokGreaterThanEquals : public Token
+{
+public:
+ TokGreaterThanEquals()
+ {
+ type = TOK_GREATER_THAN_EQUALS;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ StackItem item1 = exec.pop();
+ StackItem item2 = exec.pop();
+ item1.ival = (item1.dval >= item2.dval);
+ exec.push(item1);
+ return true;
+ }
+};
+
+class TokGreaterThan : public Token
+{
+public:
+ TokGreaterThan()
+ {
+ type = TOK_GREATER_THAN;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ StackItem item1 = exec.pop();
+ StackItem item2 = exec.pop();
+ item1.ival = (item1.dval > item2.dval);
+ exec.push(item1);
+ return true;
+ }
+};
+
+
+//###########################
+//# X P A T H I T E M S
+//###########################
+
+class TokAbsolute : public Token
+{
+public:
+ TokAbsolute()
+ {
+ type = TOK_ABSOLUTE;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ Node *n = exec.axis.getNode();
+ while (n->getParentNode())
+ n = n->getParentNode();
+ exec.axis.setNode(n);
+ return true;
+ }
+};
+
+class TokRelative : public Token
+{
+public:
+ TokRelative()
+ {
+ type = TOK_RELATIVE;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ ///exec.axis.currentNode = stack.rootNode;
+ return true;
+ }
+};
+
+class TokStep : public Token
+{
+public:
+ TokStep()
+ {
+ type = TOK_STEP;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokNameTest : public Token
+{
+public:
+ TokNameTest(const DOMString &name)
+ {
+ type = TOK_NAME_TEST;
+ sval = name;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokExpr : public Token
+{
+public:
+ TokExpr()
+ {
+ type = TOK_EXPR;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokUnion : public Token
+{
+public:
+ TokUnion()
+ {
+ type = TOK_UNION;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+
+
+
+//###########################
+//# A X I S
+//###########################
+
+
+class TokAxisAncestorOrSelf : public Token
+{
+public:
+ TokAxisAncestorOrSelf()
+ {
+ type = TOK_AXIS_ANCESTOR_OR_SELF;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokAxisAncestor : public Token
+{
+public:
+ TokAxisAncestor()
+ {
+ type = TOK_AXIS_ANCESTOR;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokAxisAttribute : public Token
+{
+public:
+ TokAxisAttribute()
+ {
+ type = TOK_AXIS_ATTRIBUTE;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokAxisChild : public Token
+{
+public:
+ TokAxisChild()
+ {
+ type = TOK_AXIS_CHILD;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokAxisDescendantOrSelf : public Token
+{
+public:
+ TokAxisDescendantOrSelf()
+ {
+ type = TOK_AXIS_DESCENDANT_OR_SELF;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokAxisDescendant : public Token
+{
+public:
+ TokAxisDescendant()
+ {
+ type = TOK_AXIS_DESCENDANT;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokAxisFollowingSibling : public Token
+{
+public:
+ TokAxisFollowingSibling()
+ {
+ type = TOK_AXIS_FOLLOWING_SIBLING;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokAxisFollowing : public Token
+{
+public:
+ TokAxisFollowing()
+ {
+ type = TOK_AXIS_FOLLOWING;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokAxisNamespace : public Token
+{
+public:
+ TokAxisNamespace()
+ {
+ type = TOK_AXIS_NAMESPACE;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokAxisParent : public Token
+{
+public:
+ TokAxisParent()
+ {
+ type = TOK_AXIS_PARENT;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokAxisPrecedingSibling : public Token
+{
+public:
+ TokAxisPrecedingSibling()
+ {
+ type = TOK_AXIS_PRECEDING_SIBLING;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokAxisPreceding : public Token
+{
+public:
+ TokAxisPreceding()
+ {
+ type = TOK_AXIS_PRECEDING;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokAxisSelf : public Token
+{
+public:
+ TokAxisSelf()
+ {
+ type = TOK_AXIS_SELF;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+
+
+//###########################
+//# F U N C T I O N S
+//###########################
+
+class TokFuncLast : public Token
+{
+public:
+ TokFuncLast()
+ {
+ type = TOK_FUNC_LAST;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokFuncPosition : public Token
+{
+public:
+ TokFuncPosition()
+ {
+ type = TOK_FUNC_POSITION;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokFuncCount : public Token
+{
+public:
+ TokFuncCount()
+ {
+ type = TOK_FUNC_COUNT;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokFuncId : public Token
+{
+public:
+ TokFuncId()
+ {
+ type = TOK_FUNC_ID;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokFuncLocalName : public Token
+{
+public:
+ TokFuncLocalName()
+ {
+ type = TOK_FUNC_LOCAL_NAME;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokFuncNamespaceUri : public Token
+{
+public:
+ TokFuncNamespaceUri()
+ {
+ type = TOK_FUNC_NAMESPACE_URI;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokFuncName : public Token
+{
+public:
+ TokFuncName()
+ {
+ type = TOK_FUNC_NAME;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokFuncString : public Token
+{
+public:
+ TokFuncString()
+ {
+ type = TOK_FUNC_STRING;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokFuncConcat : public Token
+{
+public:
+ TokFuncConcat()
+ {
+ type = TOK_FUNC_CONCAT;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokFuncStartsWith : public Token
+{
+public:
+ TokFuncStartsWith()
+ {
+ type = TOK_FUNC_STARTS_WITH;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokFuncContains : public Token
+{
+public:
+ TokFuncContains()
+ {
+ type = TOK_FUNC_CONTAINS;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokFuncSubstringBefore : public Token
+{
+public:
+ TokFuncSubstringBefore()
+ {
+ type = TOK_FUNC_SUBSTRING_BEFORE;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokFuncSubstringAfter : public Token
+{
+public:
+ TokFuncSubstringAfter()
+ {
+ type = TOK_FUNC_SUBSTRING_AFTER;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokFuncSubstring : public Token
+{
+public:
+ TokFuncSubstring()
+ {
+ type = TOK_FUNC_SUBSTRING;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokFuncStringLength : public Token
+{
+public:
+ TokFuncStringLength()
+ {
+ type = TOK_FUNC_STRING_LENGTH;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokFuncNormalizeSpace : public Token
+{
+public:
+ TokFuncNormalizeSpace()
+ {
+ type = TOK_FUNC_NORMALIZE_SPACE;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokFuncTranslate : public Token
+{
+public:
+ TokFuncTranslate()
+ {
+ type = TOK_FUNC_TRANSLATE;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokFuncBoolean : public Token
+{
+public:
+ TokFuncBoolean()
+ {
+ type = TOK_FUNC_BOOLEAN;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokFuncNot : public Token
+{
+public:
+ TokFuncNot()
+ {
+ type = TOK_FUNC_NOT;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokFuncTrue : public Token
+{
+public:
+ TokFuncTrue()
+ {
+ type = TOK_FUNC_TRUE;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokFuncFalse : public Token
+{
+public:
+ TokFuncFalse()
+ {
+ type = TOK_FUNC_FALSE;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokFuncLang : public Token
+{
+public:
+ TokFuncLang()
+ {
+ type = TOK_FUNC_LANG;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokFuncNumber : public Token
+{
+public:
+ TokFuncNumber()
+ {
+ type = TOK_FUNC_NUMBER;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokFuncSum : public Token
+{
+public:
+ TokFuncSum()
+ {
+ type = TOK_FUNC_SUM;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokFuncFloor : public Token
+{
+public:
+ TokFuncFloor()
+ {
+ type = TOK_FUNC_FLOOR;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokFuncCeiling : public Token
+{
+public:
+ TokFuncCeiling()
+ {
+ type = TOK_FUNC_CEILING;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+class TokFuncRound : public Token
+{
+public:
+ TokFuncRound()
+ {
+ type = TOK_FUNC_ROUND;
+ }
+ virtual bool execute(TokenExecutor &exec)
+ {
+ return true;
+ }
+};
+
+
+
+
+
+
+//########################################################################
+//# T O K E N L I S T
+//########################################################################
+
+/**
+ *
+ */
+class TokenList
+{
+public:
+
+ /**
+ *
+ */
+ TokenList();
+
+ /**
+ *
+ */
+ TokenList(const TokenList &other);
+
+ /**
+ *
+ */
+ TokenList &operator=(const TokenList &other);
+
+ /**
+ *
+ */
+ void assign(const TokenList &other);
+
+ /**
+ *
+ */
+ virtual ~TokenList();
+
+ /**
+ *
+ */
+ virtual void clear();
+
+ /**
+ *
+ */
+ virtual void add(Token *tok);
+
+ /**
+ *
+ */
+ virtual unsigned int size() const;
+
+ /**
+ *
+ */
+ virtual void dump();
+
+private:
+
+
+ std::vector<Token *> tokens;
+
+
+};
+
+
+
+
+
+
+
+} // namespace xpath
+} // namespace dom
+} // namespace w3c
+} // namespace org
+
+
+
+
+
+
+#endif /* __XPATHTOKEN_H__ */
+//########################################################################
+//# E N D O F F I L E
+//########################################################################
+