diff options
Diffstat (limited to 'src/dom')
| -rw-r--r-- | src/dom/CMakeLists.txt | 10 | ||||
| -rw-r--r-- | src/dom/Makefile_insert | 10 | ||||
| -rw-r--r-- | src/dom/domimpl.cpp | 34 | ||||
| -rw-r--r-- | src/dom/domimpl.h | 14 | ||||
| -rw-r--r-- | src/dom/events.h | 48 | ||||
| -rw-r--r-- | src/dom/io/base64stream.cpp | 341 | ||||
| -rw-r--r-- | src/dom/io/base64stream.h | 148 | ||||
| -rw-r--r-- | src/dom/io/domstream.h | 11 | ||||
| -rw-r--r-- | src/dom/io/gzipstream.cpp | 245 | ||||
| -rw-r--r-- | src/dom/io/gzipstream.h | 126 | ||||
| -rw-r--r-- | src/dom/lsimpl.cpp | 2 | ||||
| -rw-r--r-- | src/dom/odf/odfdocument.cpp | 165 | ||||
| -rw-r--r-- | src/dom/odf/odfdocument.h | 150 | ||||
| -rw-r--r-- | src/dom/smil.h | 28 | ||||
| -rw-r--r-- | src/dom/svgimpl.h | 9 | ||||
| -rw-r--r-- | src/dom/svgtypes.h | 239 | ||||
| -rw-r--r-- | src/dom/traversal.h | 18 | ||||
| -rw-r--r-- | src/dom/util/thread.cpp | 126 | ||||
| -rw-r--r-- | src/dom/util/thread.h | 156 | ||||
| -rw-r--r-- | src/dom/xpathparser.cpp | 2 | ||||
| -rw-r--r-- | src/dom/xpathtoken.cpp | 20 | ||||
| -rw-r--r-- | src/dom/xpathtoken.h | 6 |
22 files changed, 240 insertions, 1668 deletions
diff --git a/src/dom/CMakeLists.txt b/src/dom/CMakeLists.txt index df2411b13..5d761e649 100644 --- a/src/dom/CMakeLists.txt +++ b/src/dom/CMakeLists.txt @@ -19,17 +19,12 @@ set(dom_SRC xpathparser.cpp xpathtoken.cpp - io/base64stream.cpp io/bufferstream.cpp io/domstream.cpp - io/gzipstream.cpp io/stringstream.cpp io/uristream.cpp - odf/odfdocument.cpp - util/digest.cpp - util/thread.cpp util/ziptool.cpp @@ -64,17 +59,12 @@ set(dom_SRC xpathparser.h xpathtoken.h - odf/odfdocument.h - - io/base64stream.h io/bufferstream.h io/domstream.h - io/gzipstream.h io/stringstream.h io/uristream.h util/digest.h - util/thread.h util/ziptool.h ) diff --git a/src/dom/Makefile_insert b/src/dom/Makefile_insert index ace53b4a2..91c91eeac 100644 --- a/src/dom/Makefile_insert +++ b/src/dom/Makefile_insert @@ -50,26 +50,16 @@ dom_libdom_a_SOURCES = \ dom/xpathparser.h \ dom/xpathtoken.h \ dom/xpathtoken.cpp \ - dom/io/base64stream.cpp \ - dom/io/base64stream.h \ dom/io/bufferstream.cpp \ dom/io/bufferstream.h \ dom/io/domstream.cpp \ dom/io/domstream.h \ - dom/io/gzipstream.cpp \ - dom/io/gzipstream.h \ - dom/io/gzipstream.cpp \ - dom/io/gzipstream.h \ dom/io/stringstream.cpp \ dom/io/stringstream.h \ dom/io/uristream.cpp \ dom/io/uristream.h \ - dom/odf/odfdocument.cpp \ - dom/odf/odfdocument.h \ dom/util/digest.h \ dom/util/digest.cpp \ - dom/util/thread.h \ - dom/util/thread.cpp \ dom/util/ziptool.h \ dom/util/ziptool.cpp diff --git a/src/dom/domimpl.cpp b/src/dom/domimpl.cpp index 9f25cb3be..3d9a29592 100644 --- a/src/dom/domimpl.cpp +++ b/src/dom/domimpl.cpp @@ -1701,7 +1701,6 @@ void ElementImpl::normalizeNamespaces() if (attrNode->getNodeType() != Node::ATTRIBUTE_NODE) continue; AttrImplPtr attr = reinterpret_cast<AttrImpl *>(attrNode.get()); - DOMString attrNS = attr->getNamespaceURI(); DOMString attrName = attr->getLocalName(); DOMString attrPrefix = attr->getPrefix(); DOMString attrValue = attr->getNodeValue(); @@ -1826,7 +1825,6 @@ void ElementImpl::normalizeNamespaces() AttrPtr attr = reinterpret_cast<Attr *>(attrNode.get()); DOMString attrNS = attr->getNamespaceURI(); DOMString attrPrefix = attr->getPrefix(); - DOMString attrValue = attr->getNodeValue(); if (attrNS == XMLNSNAME) continue; @@ -2360,12 +2358,15 @@ CDATASectionImpl::~CDATASectionImpl() DocumentTypeImpl::DocumentTypeImpl(const DOMString& theName, const DOMString& thePublicId, const DOMString& theSystemId) - : NodeImpl() + : NodeImpl(), + name(), //what with this variable? + publicId(thePublicId), + systemId(theSystemId), + entities(), + notations() { - nodeType = DOCUMENT_TYPE_NODE; - nodeName = theName; - publicId = thePublicId; - systemId = theSystemId; + nodeType = DOCUMENT_TYPE_NODE;//of class NodeImpl + nodeName = theName;//of class NodeImpl } /** @@ -3017,19 +3018,22 @@ NodePtr DocumentImpl::renameNode(const NodePtr node, DocumentImpl::DocumentImpl(const DOMImplementation *domImpl, const DOMString &/*theNamespaceURI*/, const DOMString &theQualifiedName, - const DocumentTypePtr theDoctype) : NodeImpl() -{ - nodeType = DOCUMENT_NODE; - nodeName = "#document"; - parent = const_cast<DOMImplementation *>(domImpl); - //documentURI = stringCache(theNamespaceURI); - qualifiedName = theQualifiedName; + const DocumentTypePtr theDoctype) + : NodeImpl(), + namespaceIndex(0), + parent(const_cast<DOMImplementation *>(domImpl)), + qualifiedName(theQualifiedName), + xmlStandalone(false), + strictErrorChecking(false), + domConfig(NULL) +{ + nodeType = DOCUMENT_NODE;//of class NodeImpl + nodeName = "#document";//of class NodeImpl if (theDoctype.get()) //only assign if not null. doctype = theDoctype; else doctype = new DocumentTypeImpl("", "", ""); documentElement = new ElementImpl(this, "root"); - namespaceIndex = 0; } diff --git a/src/dom/domimpl.h b/src/dom/domimpl.h index 5fe508076..df586f35e 100644 --- a/src/dom/domimpl.h +++ b/src/dom/domimpl.h @@ -526,11 +526,11 @@ protected: UserDataEntry(const DOMString &theKey, const DOMUserData *theData, const UserDataHandler *theHandler) + : next(NULL), + key(theKey), + data(const_cast<DOMUserData *>(theData)), + handler(const_cast<UserDataHandler *>(theHandler)) { - next = NULL; - key = theKey; - data = const_cast<DOMUserData *>(theData); - handler = const_cast<UserDataHandler *>(theHandler); } virtual ~UserDataEntry() @@ -1967,10 +1967,10 @@ protected: next = NULL; } NamedElementItem(const DOMString &nameArg, ElementPtr elemArg) + : next (NULL), + name (nameArg), + elem (elemArg) { - next = NULL; - name = nameArg; - elem = elemArg; } ~NamedElementItem() { diff --git a/src/dom/events.h b/src/dom/events.h index 9f44fe591..59d83afcf 100644 --- a/src/dom/events.h +++ b/src/dom/events.h @@ -643,8 +643,8 @@ public: * */ EventTarget(const EventTarget &other) + : listeners (other.listeners) { - listeners = other.listeners; } /** @@ -704,7 +704,9 @@ public: /** * */ - DocumentEvent() {} + DocumentEvent() + : dispatchable(false) + {} /** * @@ -791,7 +793,10 @@ public: /** * */ - CustomEvent() {} + CustomEvent() + : propagationStopped(false), + immediatePropagationStopped(false) + {} /** * @@ -884,15 +889,19 @@ public: /** * */ - UIEvent() {} + UIEvent() + : view(), + detail(0) + {} /** * */ - UIEvent(const UIEvent &other) : Event(other) + UIEvent(const UIEvent &other) + : Event(other), + view(other.view), + detail(other.detail) { - view = other.view; - detail = other.detail; } /** @@ -1152,7 +1161,18 @@ public: /** * */ - MouseEvent() {} + MouseEvent() + : screenX(0), + screenY(0), + clientX(0), + clientY(0), + ctrlKey(false), + shiftKey(false), + altKey(false), + metaKey(false), + button(0), + relatedTarget(NULL) + {} /** * @@ -1322,7 +1342,14 @@ public: /** * */ - KeyboardEvent() {} + KeyboardEvent() + : keyIdentifier(), + keyLocation(0), + ctrlKey(false), + shiftKey(false), + altKey(false), + metaKey(false) + {} /** * @@ -1472,8 +1499,9 @@ public: * */ MutationEvent() + : relatedNodePtr (NULL), + attrChange(0) { - relatedNodePtr = NULL; } /** diff --git a/src/dom/io/base64stream.cpp b/src/dom/io/base64stream.cpp deleted file mode 100644 index 433675e18..000000000 --- a/src/dom/io/base64stream.cpp +++ /dev/null @@ -1,341 +0,0 @@ -/* - * 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 const *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. - */ -int Base64OutputStream::put(XMLCh ch) -{ - if (closed) - { - //probably throw an exception here - return -1; - } - - 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; - } - - return 1; -} - - - -} //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 deleted file mode 100644 index 93bb5c7e5..000000000 --- a/src/dom/io/base64stream.h +++ /dev/null @@ -1,148 +0,0 @@ -#ifndef SEEN_DOM_IO_BASE64STREAM_H -#define SEEN_DOM_IO_BASE64STREAM_H - -/** - * @file - * 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 int 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 // SEEN_DOM_IO_BASE64STREAM_H diff --git a/src/dom/io/domstream.h b/src/dom/io/domstream.h index b2e308653..1a93e73b2 100644 --- a/src/dom/io/domstream.h +++ b/src/dom/io/domstream.h @@ -51,7 +51,8 @@ class StreamException public: StreamException(const DOMString &theReason) throw() - { reason = theReason; } + : reason(theReason) + {} virtual ~StreamException() throw() { } char const *what() @@ -576,7 +577,13 @@ protected: Writer *destination; BasicWriter() - { destination = NULL; } + { + destination = NULL; + for(int k=0;k<2048;++k) + { + formatBuf[k]=0; + } + } //Used for printf() or other things that might //require formatting before sending down the stream diff --git a/src/dom/io/gzipstream.cpp b/src/dom/io/gzipstream.cpp deleted file mode 100644 index e1f9f9a60..000000000 --- a/src/dom/io/gzipstream.cpp +++ /dev/null @@ -1,245 +0,0 @@ -/* - * 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-2007 Bob Jamison - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * 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. - */ -int GzipOutputStream::put(XMLCh ch) -{ - if (closed) - { - //probably throw an exception here - return -1; - } - - //Add char to buffer - buffer.push_back(ch); - return 1; -} - - - -} // 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 deleted file mode 100644 index 6e82c3531..000000000 --- a/src/dom/io/gzipstream.h +++ /dev/null @@ -1,126 +0,0 @@ -#ifndef SEEN_GZIPSTREAM_H -#define SEEN_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-2007 Bob Jamison - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * 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 int put(XMLCh ch); - -private: - - std::vector<unsigned char> buffer; - - -}; // class GzipOutputStream - - - - - - - -} // namespace io -} // namespace dom -} // namespace w3c -} // namespace org - - -#endif // SEEN_GZIPSTREAM_H diff --git a/src/dom/lsimpl.cpp b/src/dom/lsimpl.cpp index 94b0adeb7..d4da0d5ce 100644 --- a/src/dom/lsimpl.cpp +++ b/src/dom/lsimpl.cpp @@ -227,7 +227,7 @@ bool LSSerializerImpl::writeToURI(const NodePtr nodeArg, DOMString uri = uriArg; char *fileName = (char *) uri.c_str(); //temporary hack - FILE *f = fopen(fileName, "rb"); + FILE *f = fopen(fileName, "wb"); if (!f) return false; for (unsigned int i=0 ; i<outbuf.size() ; i++) diff --git a/src/dom/odf/odfdocument.cpp b/src/dom/odf/odfdocument.cpp deleted file mode 100644 index 1e7a61e4e..000000000 --- a/src/dom/odf/odfdocument.cpp +++ /dev/null @@ -1,165 +0,0 @@ -/* - * - * This class contains an ODF Document. - * Initially, we are just concerned with .odg content.xml + resources - * - * --------------------------------------------------------------------- - * - * Copyright (C) 2006-2008 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 2 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 - * - * RWJ : 080207: Changed to GPL2 by me - * - */ - -#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() : - content(0), - images() -{ -} - - -/** - * - */ -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 deleted file mode 100644 index 168df11c7..000000000 --- a/src/dom/odf/odfdocument.h +++ /dev/null @@ -1,150 +0,0 @@ -#ifndef SEEN_ODF_DOCUMENT_H -#define SEEN_ODF_DOCUMENT_H -/* - * 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 2 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 - * - * RWJ : 080207: Changed to GPL2 by me - */ - -#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 -//######################################################################## - - -/** - * - * This class contains an ODF Document. - * Initially, we are just concerned with .odg content.xml + resources - */ -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 // SEEN_ODF_DOCUMENT_H - -//######################################################################## -//# E N D O F F I L E -//######################################################################## - diff --git a/src/dom/smil.h b/src/dom/smil.h index 15bc361ac..14870a4e4 100644 --- a/src/dom/smil.h +++ b/src/dom/smil.h @@ -193,7 +193,12 @@ public: /** * */ - ElementLayout() {} + ElementLayout() : + title(), + backgroundColor(), + height(0), + width(0) + {} /** * @@ -274,8 +279,9 @@ public: /** * */ - SMILRegionInterface(const SMILRegionInterface &other) - { regionElement = other.regionElement; } + SMILRegionInterface(const SMILRegionInterface &other) : + regionElement (other.regionElement) + {} /** * @@ -542,9 +548,9 @@ public: /** * */ - TimeList(const TimeList &other) + TimeList(const TimeList &other) : + items (other.items) { - items = other.items; } /** @@ -1586,7 +1592,15 @@ public: /** * */ - ElementTest() + ElementTest() : + systemBitrate (0), + systemCaptions (false), + systemLanguage (), + systemRequired (false), + systemScreenSize (false), + systemScreenDepth (false), + systemOverdubOrSubtitle (), + systemAudioDesc (false) { } @@ -1629,8 +1643,6 @@ public: protected: - - long systemBitrate; bool systemCaptions; DOMString systemLanguage; diff --git a/src/dom/svgimpl.h b/src/dom/svgimpl.h index 83d56fa22..2ee5c8bc7 100644 --- a/src/dom/svgimpl.h +++ b/src/dom/svgimpl.h @@ -980,7 +980,14 @@ public: /** * */ - SVGSVGElementImpl() : SVGElementImpl() + SVGSVGElementImpl() : SVGElementImpl(), + pixelUnitToMillimeterX(0), + pixelUnitToMillimeterY(0), + screenPixelToMillimeterX(0), + screenPixelToMillimeterY(0), + useCurrentView(false), + currentScale(0), + currentTime(0) {} diff --git a/src/dom/svgtypes.h b/src/dom/svgtypes.h index 41b4de307..bb828571f 100644 --- a/src/dom/svgtypes.h +++ b/src/dom/svgtypes.h @@ -645,20 +645,20 @@ public: /** * */ - SVGTransform() + SVGTransform() : + type (SVG_TRANSFORM_UNKNOWN), + angle (0.0) { - type = SVG_TRANSFORM_UNKNOWN; - angle = 0.0; } /** * */ - SVGTransform(const SVGTransform &other) + SVGTransform(const SVGTransform &other) : + type (other.type), + angle (other.angle), + matrix (other.matrix) { - type = other.type; - angle = other.angle; - matrix = other.matrix; } /** @@ -834,9 +834,9 @@ public: /** * */ - SVGTransformList(const SVGTransformList &other) + SVGTransformList(const SVGTransformList &other) : + items (other.items) { - items = other.items; } /** @@ -893,10 +893,10 @@ public: /** * */ - SVGAnimatedTransformList(const SVGAnimatedTransformList &other) + SVGAnimatedTransformList(const SVGAnimatedTransformList &other) : + baseVal (other.baseVal), + animVal (other.animVal) { - baseVal = other.baseVal; - animVal = other.animVal; } /** @@ -1181,9 +1181,9 @@ public: /** * */ - SVGStringList(const SVGStringList &other) + SVGStringList(const SVGStringList &other) : + items (other.items) { - items = other.items; } /** @@ -1657,9 +1657,9 @@ public: /** * */ - SVGNumberList(const SVGNumberList &other) + SVGNumberList(const SVGNumberList &other) : + items (other.items) { - items = other.items; } /** @@ -1719,10 +1719,10 @@ public: /** * */ - SVGAnimatedNumberList(const SVGAnimatedNumberList &other) + SVGAnimatedNumberList(const SVGAnimatedNumberList &other) : + baseVal (other.baseVal), + animVal (other.animVal) { - baseVal = other.baseVal; - animVal = other.animVal; } /** @@ -1934,10 +1934,10 @@ public: /** * */ - SVGAnimatedLength(const SVGAnimatedLength &other) + SVGAnimatedLength(const SVGAnimatedLength &other) : + baseVal (other.baseVal), + animVal (other.animVal) { - baseVal = other.baseVal; - animVal = other.animVal; } /** @@ -2085,9 +2085,9 @@ public: /** * */ - SVGLengthList(const SVGLengthList &other) + SVGLengthList(const SVGLengthList &other) : + items (other.items) { - items = other.items; } /** @@ -2147,10 +2147,10 @@ public: /** * */ - SVGAnimatedLengthList(const SVGAnimatedLengthList &other) + SVGAnimatedLengthList(const SVGAnimatedLengthList &other) : + baseVal (other.baseVal), + animVal (other.animVal) { - baseVal = other.baseVal; - animVal = other.animVal; } /** @@ -2357,16 +2357,17 @@ public: /** * */ - SVGAnimatedAngle(const SVGAngle &angle) - { baseVal = angle; } + SVGAnimatedAngle(const SVGAngle &angle) : + baseVal (angle) + {} /** * */ - SVGAnimatedAngle(const SVGAnimatedAngle &other) + SVGAnimatedAngle(const SVGAnimatedAngle &other) : + baseVal (other.baseVal), + animVal (other.animVal) { - baseVal = other.baseVal; - animVal = other.animVal; } /** @@ -2434,10 +2435,10 @@ public: /** * */ - SVGICCColor(const SVGICCColor &other) + SVGICCColor(const SVGICCColor &other) : + colorProfile (other.colorProfile), + colors (other.colors) { - colorProfile = other.colorProfile; - colors = other.colors; } /** @@ -2448,7 +2449,6 @@ public: protected: DOMString colorProfile; - SVGNumberList colors; }; @@ -2732,10 +2732,10 @@ public: /** * */ - SVGAnimatedRect(const SVGAnimatedRect &other) + SVGAnimatedRect(const SVGAnimatedRect &other) : + baseVal (other.baseVal), + animVal (other.animVal) { - baseVal = other.baseVal; - animVal = other.animVal; } /** @@ -2956,9 +2956,9 @@ public: /** * */ - SVGPointList(const SVGPointList &other) + SVGPointList(const SVGPointList &other) : + items (other.items) { - items = other.items; } @@ -3071,10 +3071,10 @@ public: /** * */ - SVGStylable(const SVGStylable &other) + SVGStylable(const SVGStylable &other) : + className (other.className), + style (other.style) { - className = other.className; - style = other.style; } /** @@ -3168,7 +3168,10 @@ public: /** * */ - SVGLocatable(const SVGLocatable &/*other*/) + SVGLocatable(const SVGLocatable &/*other*/) : + bbox(), + ctm(), + screenCtm() { } @@ -3224,9 +3227,9 @@ public: /** * */ - SVGTransformable(const SVGTransformable &other) : SVGLocatable(other) + SVGTransformable(const SVGTransformable &other) : SVGLocatable(other), + transforms (other.transforms) { - transforms = other.transforms; } /** @@ -3303,11 +3306,11 @@ public: /** * */ - SVGTests(const SVGTests &other) + SVGTests(const SVGTests &other) : + requiredFeatures (other.requiredFeatures), + requiredExtensions (other.requiredExtensions), + systemLanguage (other.systemLanguage) { - requiredFeatures = other.requiredFeatures; - requiredExtensions = other.requiredExtensions; - systemLanguage = other.systemLanguage; } /** @@ -3445,9 +3448,9 @@ public: /** * */ - SVGExternalResourcesRequired(const SVGExternalResourcesRequired &other) + SVGExternalResourcesRequired(const SVGExternalResourcesRequired &other) : + required (other.required) { - required = other.required; } /** @@ -3611,10 +3614,10 @@ public: /** * */ - SVGAnimatedPreserveAspectRatio(const SVGAnimatedPreserveAspectRatio &other) + SVGAnimatedPreserveAspectRatio(const SVGAnimatedPreserveAspectRatio &other) : + baseVal (other.baseVal), + animVal (other.animVal) { - baseVal = other.baseVal; - baseVal = other.animVal; } /** @@ -3671,10 +3674,10 @@ public: * */ - SVGFitToViewBox(const SVGFitToViewBox &other) + SVGFitToViewBox(const SVGFitToViewBox &other) : + viewBox (other.viewBox), + preserveAspectRatio (other.preserveAspectRatio) { - viewBox = other.viewBox; - preserveAspectRatio = other.preserveAspectRatio; } /** @@ -3685,7 +3688,6 @@ public: protected: SVGAnimatedRect viewBox; - SVGAnimatedPreserveAspectRatio preserveAspectRatio; }; @@ -3828,18 +3830,19 @@ public: /** * */ - SVGViewSpec() + SVGViewSpec() : + viewTarget (NULL), + transform () { - viewTarget = NULL; } /** * */ - SVGViewSpec(const SVGViewSpec &other) : SVGZoomAndPan(other), SVGFitToViewBox(other) + SVGViewSpec(const SVGViewSpec &other) : SVGZoomAndPan(other), SVGFitToViewBox(other), + viewTarget (other.viewTarget), + transform (other.transform) { - viewTarget = other.viewTarget; - transform = other.transform; } /** @@ -3884,14 +3887,16 @@ public: /** * */ - SVGURIReference() {} + SVGURIReference() : + href () + {} /** * */ - SVGURIReference(const SVGURIReference &other) + SVGURIReference(const SVGURIReference &other) : + href (other.href) { - href = other.href; } /** @@ -6135,9 +6140,9 @@ public: /** * */ - SVGPathSegList(const SVGPathSegList &other) + SVGPathSegList(const SVGPathSegList &other) : + items (other.items) { - items = other.items; } @@ -6272,10 +6277,10 @@ public: /** * */ - SVGAnimatedPoints(const SVGAnimatedPoints &other) + SVGAnimatedPoints(const SVGAnimatedPoints &other) : + points (other.points), + animatedPoints (other.animatedPoints) { - points = other.points; - animatedPoints = other.animatedPoints; } /** @@ -6366,19 +6371,19 @@ public: /** * */ - SVGPaint() + SVGPaint() : + paintType (SVG_PAINTTYPE_UNKNOWN), + uri ("") { - uri = ""; - paintType = SVG_PAINTTYPE_UNKNOWN; } /** * */ - SVGPaint(const SVGPaint &other) : css::CSSValue(other), SVGColor(other) + SVGPaint(const SVGPaint &other) : css::CSSValue(other), SVGColor(other), + paintType (SVG_PAINTTYPE_UNKNOWN), + uri ("") { - uri = ""; - paintType = SVG_PAINTTYPE_UNKNOWN; } /** @@ -6452,17 +6457,19 @@ public: /** * */ - SVGColorProfileRule() {} + SVGColorProfileRule() : + renderingIntent(0) + {} /** * */ SVGColorProfileRule(const SVGColorProfileRule &other) - : SVGCSSRule(other), SVGRenderingIntent(other) + : SVGCSSRule(other), SVGRenderingIntent(other), + renderingIntent (other.renderingIntent), + src (other.src), + name (other.name) { - renderingIntent = other.renderingIntent; - src = other.src; - name = other.name; } /** @@ -6540,13 +6547,13 @@ public: * */ SVGFilterPrimitiveStandardAttributes(const SVGFilterPrimitiveStandardAttributes &other) - : SVGStylable(other) + : SVGStylable(other), + x (other.x), + y (other.y), + width (other.width), + height (other.height), + result (other.result) { - x = other.x; - y = other.y; - width = other.width; - height = other.height; - result = other.result; } /** @@ -6567,13 +6574,6 @@ protected: - - - - - - - /*######################################################################### ## SVGEvent #########################################################################*/ @@ -6660,20 +6660,26 @@ public: /** * */ - SVGZoomEvent() + SVGZoomEvent(): + zoomRectScreen(), + previousScale(0), + previousTranslate(), + newScale(0), + newTranslate() {} /** * */ - SVGZoomEvent(const SVGZoomEvent &other) : events::Event(other), - events::UIEvent(other) + 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) { - zoomRectScreen = other.zoomRectScreen; - previousScale = other.previousScale; - previousTranslate = other.previousTranslate; - newScale = other.newScale; - newTranslate = other.newTranslate; } /** @@ -6776,13 +6782,18 @@ public: /** * */ - SVGElementInstance() {} + SVGElementInstance() : + correspondingElement(NULL), + correspondingUseElement(NULL) + {} /** * */ SVGElementInstance(const SVGElementInstance &other) - : events::EventTarget(other) + : events::EventTarget(other), + correspondingElement(NULL), + correspondingUseElement(NULL) { } @@ -6858,9 +6869,9 @@ public: /** * */ - SVGElementInstanceList(const SVGElementInstanceList &other) + SVGElementInstanceList(const SVGElementInstanceList &other) : + items (other.items) { - items = other.items; } /** @@ -6877,16 +6888,6 @@ protected: - - - - - - - - - - } //namespace svg } //namespace dom } //namespace w3c diff --git a/src/dom/traversal.h b/src/dom/traversal.h index 13850f78e..302ac2b1f 100644 --- a/src/dom/traversal.h +++ b/src/dom/traversal.h @@ -295,11 +295,11 @@ public: /** * */ - NodeIterator(const NodeIterator &other) + NodeIterator(const NodeIterator &other) : + whatToShow (other.whatToShow), + filter (other.filter), + expandEntityReferences (other.expandEntityReferences) { - whatToShow = other.whatToShow; - filter = other.filter; - expandEntityReferences = other.expandEntityReferences; } /** @@ -499,12 +499,12 @@ public: /** * */ - TreeWalker(const TreeWalker &other) + TreeWalker(const TreeWalker &other) : + whatToShow (other.whatToShow), + filter (other.filter), + expandEntityReferences (other.expandEntityReferences), + currentNode (other.currentNode) { - whatToShow = other.whatToShow; - filter = other.filter; - expandEntityReferences = other.expandEntityReferences; - currentNode = other.currentNode; } /** diff --git a/src/dom/util/thread.cpp b/src/dom/util/thread.cpp deleted file mode 100644 index d5368ef59..000000000 --- a/src/dom/util/thread.cpp +++ /dev/null @@ -1,126 +0,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) 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 = static_cast<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 = static_cast<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 deleted file mode 100644 index 1408cd78f..000000000 --- a/src/dom/util/thread.h +++ /dev/null @@ -1,156 +0,0 @@ -#ifndef SEEN_DOM_THREAD_H -#define SEEN_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 // SEEN_DOM_THREAD_H -//######################################################################### -//# E N D O F F I L E -//######################################################################### - - diff --git a/src/dom/xpathparser.cpp b/src/dom/xpathparser.cpp index 393c12cda..b19975966 100644 --- a/src/dom/xpathparser.cpp +++ b/src/dom/xpathparser.cpp @@ -131,7 +131,7 @@ void XPathParser::lexicalTokenDump() printf("####### LEXICAL TOKENS #######\n"); for (unsigned int i=0 ; i<lexicalTokens.size() ; i++) { - printf("%d : ", i); + printf("%u : ", i); lexicalTokens[i].print(); } printf("##### END LEXICAL TOKENS #####\n\n"); diff --git a/src/dom/xpathtoken.cpp b/src/dom/xpathtoken.cpp index 79948e55e..216c7a069 100644 --- a/src/dom/xpathtoken.cpp +++ b/src/dom/xpathtoken.cpp @@ -937,19 +937,21 @@ Token Token::create(int type, long ival, /** * */ -TokenExecutor::TokenExecutor() +TokenExecutor::TokenExecutor() : + tokenList (), + nodeList () { - reset(); } /** * */ -TokenExecutor::TokenExecutor(const TokenExecutor &other) +TokenExecutor::TokenExecutor(const TokenExecutor &other) : + tokenList (other.tokenList), + nodeList () { - reset(); - assign(other); + // assign(other); } @@ -970,14 +972,6 @@ void TokenExecutor::assign(const TokenExecutor &other) } -/** - * - */ -void TokenExecutor::reset() -{ -} - - /** diff --git a/src/dom/xpathtoken.h b/src/dom/xpathtoken.h index 5bb87917b..cfd54298e 100644 --- a/src/dom/xpathtoken.h +++ b/src/dom/xpathtoken.h @@ -457,7 +457,7 @@ public: */ StackItem pop() { - if (stackItems.size() < 1) + if (stackItems.empty()) { //TODO: error here StackItem item; @@ -619,10 +619,6 @@ public: */ virtual void assign(const TokenExecutor &other); - /** - * Reset the stack to its original settings - */ - virtual void reset(); /** * Execute a list upon a given node. For each Axis encountered, |
