diff --git a/mozilla/extensions/transformiix/build/makefile.win b/mozilla/extensions/transformiix/build/makefile.win index 66595384dd1..fae29a5656e 100644 --- a/mozilla/extensions/transformiix/build/makefile.win +++ b/mozilla/extensions/transformiix/build/makefile.win @@ -19,7 +19,7 @@ # # Contributor(s): -DEPTH=..\..\..\.. +DEPTH=..\..\.. include <$(DEPTH)/config/config.mak> DEFINES=-DMOZILLA diff --git a/mozilla/extensions/transformiix/docs/changes.txt b/mozilla/extensions/transformiix/docs/changes.txt index acb9df37eea..e625f25ddc1 100755 --- a/mozilla/extensions/transformiix/docs/changes.txt +++ b/mozilla/extensions/transformiix/docs/changes.txt @@ -46,7 +46,7 @@ Build 20000322 Build 20000318 -- Added Olivier's implementation of the XPath Number functions --- Added missing prototype to String.h (Peter Van der Beken) +-- Added missing prototype to TxString.h (Peter Van der Beken) Build 20000222 -- Added Attribute parent mapping since DOM 1.0 doesn't support it diff --git a/mozilla/extensions/transformiix/makefile.win b/mozilla/extensions/transformiix/makefile.win index 728a6d01c8b..0720b266a18 100644 --- a/mozilla/extensions/transformiix/makefile.win +++ b/mozilla/extensions/transformiix/makefile.win @@ -19,7 +19,7 @@ # # Contributor(s): -DEPTH=..\..\.. +DEPTH=..\.. DIRS=source build diff --git a/mozilla/extensions/transformiix/source/base/ErrorObserver.h b/mozilla/extensions/transformiix/source/base/ErrorObserver.h index d66058eb680..5a0d1abb9b2 100644 --- a/mozilla/extensions/transformiix/source/base/ErrorObserver.h +++ b/mozilla/extensions/transformiix/source/base/ErrorObserver.h @@ -21,20 +21,20 @@ * Keith Visco, kvisco@ziplink.net * -- original author. * - * $Id: ErrorObserver.h,v 1.2 1999-11-15 07:12:39 nisheeth%netscape.com Exp $ + * $Id: ErrorObserver.h,v 1.3 2000-04-12 22:30:37 nisheeth%netscape.com Exp $ */ #ifndef MITRE_ERROROBSERVER_H #define MITRE_ERROROBSERVER_H #include "baseutils.h" -#include "String.h" +#include "TxString.h" #include "iostream.h" /** * A simple interface for observing errors * @author Keith Visco - * @version $Revision: 1.2 $ $Date: 1999-11-15 07:12:39 $ + * @version $Revision: 1.3 $ $Date: 2000-04-12 22:30:37 $ **/ class ErrorObserver { diff --git a/mozilla/extensions/transformiix/source/base/Makefile b/mozilla/extensions/transformiix/source/base/Makefile index 9f827857dc6..70ac9f04632 100644 --- a/mozilla/extensions/transformiix/source/base/Makefile +++ b/mozilla/extensions/transformiix/source/base/Makefile @@ -14,7 +14,7 @@ BASE_OBJS = ArrayList.o \ NamedMap.o \ SimpleErrorObserver.o \ Stack.o \ - String.o \ + TxString.o \ StringComparator.o \ StringList.o \ Tokenizer.o @@ -48,22 +48,22 @@ Map.o: Map.h Map.cpp MITREObjectWrapper.o: MITREObject.h MITREObjectWrapper.cpp $(CC) -c MITREObjectWrapper.cpp -NamedMap.o: String.h NamedMap.h NamedMap.cpp +NamedMap.o: TxString.h NamedMap.h NamedMap.cpp $(CC) -c NamedMap.cpp -SimpleErrorObserver.o: String.h baseutils.h ErrorObserver.h SimpleErrorObserver.cpp +SimpleErrorObserver.o: TxString.h baseutils.h ErrorObserver.h SimpleErrorObserver.cpp $(CC) -c SimpleErrorObserver.cpp Stack.o: List.h Stack.h Stack.cpp $(CC) -c Stack.cpp -String.o: String.h String.cpp - $(CC) -c String.cpp +TxString.o: TxString.h TxString.cpp + $(CC) -c TxString.cpp StringComparator.o: StringComparator.h StringComparator.cpp $(CC) -c StringComparator.cpp -StringList.o: String.h StringList.h StringList.cpp +StringList.o: TxString.h StringList.h StringList.cpp $(CC) -c StringList.cpp Tokenizer.o: Tokenizer.h Tokenizer.cpp diff --git a/mozilla/extensions/transformiix/source/base/MozillaString.cpp b/mozilla/extensions/transformiix/source/base/MozillaString.cpp index d5bf3d4b1dc..08161c51012 100644 --- a/mozilla/extensions/transformiix/source/base/MozillaString.cpp +++ b/mozilla/extensions/transformiix/source/base/MozillaString.cpp @@ -1,751 +1,1491 @@ -/* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. - * - */ - -// Tom Kneeland (12/03/1999) -// -// Wrapper class to convert nsString, into a MITRE/TransforMIIX compatiable -// string. -// -// Modification History: -// Who When What -// TK 01/13/2000 Added a means to retrieve the nsString object. This -// provides an efficient way to retreive nsString data from -// Mozilla functions expecting nsString references as -// destination objects (like nsIDOMNode::GetNodeName) - -#include -#include -#include "MozillaString.h" -#include - -// -//Default constructor ( nsString() ) -// -MozillaString::MozillaString() -{ - ptrNSString = new nsString(); -} - -// -//Create an nsString with the specified size -// -MozillaString::MozillaString(Int32 initSize) -{ - ptrNSString = new nsString(); - ptrNSString->SetCapacity(initSize); -} - -// -//Create an nsString from the provided String object -//Use the Unicode representation to perform the copy -// (nsString(source, length(source)) ) -MozillaString::MozillaString(const String& source) -{ - ptrNSString = new nsString(source.toUnicode(), source.length()); -} - -// -//Create a new sting by assuming control of the provided nsString -// -MozillaString::MozillaString(nsString* theNSString) -{ - ptrNSString = theNSString; -} - -// -//Create a copy of the source string -// -MozillaString::MozillaString(const MozillaString& source) -{ - ptrNSString = new nsString(*source.ptrNSString); -} - -// -//Create a string from the characters ( nsString(source, -1) ) -// NOTE: Since, by definition, this C Style string is null terminated, simply -// accept the default length (-1) to the nsString constructor, and let -// it calculate its length. -// -// -MozillaString::MozillaString(const char* source) -{ - ptrNSString = new nsString(source); -} - -// -//Create a string from the Unicode Characters -//( nsString(source, length(source)) ) -// NOTE: The length passed to this constructor does not include the NULL -// terminator (in C fashion). -// -MozillaString::MozillaString(const UNICODE_CHAR* source, Int32 srcLength) -{ - ptrNSString = new nsString(source, srcLength); -} - - -// -//Destroy the nsString, and free memory -// -MozillaString::~MozillaString() -{ - delete ptrNSString; -} - -// -//Overloaded '=' operator to assign the value of the source string to this -//string. Only use String's public interface to ensure compatibility with -//String, MozillaString, and any other object derrived from the String -//interface. ( nsString::Assign(PRUnichar*, PRInt32) ) -// -String& MozillaString::operator=(const String& source) -{ - //Assign the Unicode Char buffer to the nsString - ptrNSString->Assign(source.toUnicode(), source.length()); -} - -// -//Overloaded '=' operator to assigne the value of a MozillaString to this -//MozillaString. ( nsString::Assign(const nsString) ) -String& MozillaString::operator=(const MozillaString& source) -{ - ptrNSString->Assign(source.toUnicode(), source.length()); -} - -// -//Overloaded '=' operator to assign the value of the source C string to this -//string. ( nsString::Assign(const char*, PRInt32) ) -// -String& MozillaString::operator=(const char* source) -{ - ptrNSString->Assign(source); -} - -// -//Overloaded '=' operator to assign an integer to this string. -// -String& MozillaString::operator=(Int32 source) -{ - //Since String::ConvertInt only uses String's public interface, use it to - //convert "source", and store it in this object - return ConvertInt(source, *this); -} //-- operator= - -// -//Append the source character ( nsString::Append(PRUnichar) ) -// -void MozillaString::append(UNICODE_CHAR source) -{ - ptrNSString->Append(source); -} - -// -//Append a character to the string (nsString::Append(char) ) -// -void MozillaString::append(char source) -{ - ptrNSString->Append(source); -} - -// -//Append String. Only use String's public interface to ensure compatibility -//with all classes derrived from String. -//Ultimately use ( nsString::Append(const PRUnichar*, PRInt32) ) or -// ( nsString::Append(const nsString&) ) -// -void MozillaString::append(const String& source) -{ - //There are issues if we try to append a string to itself using its unicode - //buffer! So if the provided source object is equal to this, then we are - //appending this MozillaString to itself, so cast source to a MozillaString - //object, and go after its nsString implementation. - if (this == &source) - ptrNSString->Append(*((MozillaString)source).ptrNSString); - else - ptrNSString->Append(source.toUnicode(), source.length()); -} - - //Need to provide a means to append one mozstring to another. This seems - //to be necessary because nsString seems to get confused if its own - //Unicode buffer is passed itself for appending (ie a MozString is appended - //to itself using on the functions provided by the public String - //interface). -void MozillaString::append(const MozillaString& source) -{ - ptrNSString->Append(*source.ptrNSString); -} - -// -//Append a string of characters (null terminated arry of chars) -//( nsString::Append(const char*, PRInt32) ) -// -void MozillaString::append(const char* source) -{ - ptrNSString->Append(source); -} - -// -//Append a string of unicode chars (null terminated array of Unicode chars) -//( nsString::Append(const PRUnichar*, PRInt32) ) -// -void MozillaString::append(const UNICODE_CHAR* source) -{ - ptrNSString->Append(source, UnicodeLength(source)); -} - -// -//Append a string of DOM Characters whose length is also defined -//( nsString::Append(const PRUnichar*, PRInt32) ) -// -void MozillaString::append(const UNICODE_CHAR* source, Int32 length) -{ - ptrNSString->Append(source, length); -} - -// -//Convert source from an integer to a string, and append it to the current -//string. ( nsString::Append(PRInt32, PRInt32 aRadix=10) ) -// -void MozillaString::append(Int32 source) -{ - ptrNSString->Append(source); -} - -// -//Insert a single UNICODE_CHAR into the string starting at offset -//( nsString::Insert(PRUnichar, PRUint32) ) -// -void MozillaString::insert(Int32 offset, const UNICODE_CHAR source) -{ - ptrNSString->Insert(source, offset); -} - -// -//Insert a single C type character into the string starting at offset -//nsString does not seem to support the insertion of a char (it seems to be -//commented out) so just use nsString::Insert(PRUnichar, PRUint32). -// -void MozillaString::insert(Int32 offset, const char source) -{ - ptrNSString->Insert((PRUnichar)source, offset); -} - -// -//Insert the source string starting at the current offset -//Only use the public interface of source, since we must support all classes -//derrived from String. -//( nsString::Insert(const PRUnichar*, PRuint32, PRInt32) ) -// -void MozillaString::insert(Int32 offset, const String& source) -{ - //There are issues if we try to insert a string into itself using its unicode - //buffer! So if the provided source object is equal to this, then we are - //appending this MozillaString to itself, so cast source to a MozillaString - //object, and go after its nsString implementation. - if (this == &source) - ptrNSString->Insert(*((MozillaString)source).ptrNSString, offset); - else - ptrNSString->Insert(source.toUnicode(), offset, source.length()); -} - -// -//Insert the source "C" type string into this string starting at offset. -//( nsString::Insert(const char*, PRUint32, PrInt32) ) -// -void MozillaString::insert(Int32 offset, const char* source) -{ - ptrNSString->Insert(source, offset); -} - -// -//Insert the source UNICODE_CHAR type string into this string starting at -//offset. Note that the source is Null Terminated. -//( nsString::Insert(const PRUnichar*, PRuint32, PRInt32) ) -// -void MozillaString::insert(Int32 offset, const UNICODE_CHAR* source) -{ - ptrNSString->Insert(source, offset, UnicodeLength(source)); -} - -// -//Insert the source UNICODE_CHAR type string into this string starting at -//offset. Note that the array is not null terminated, so the lenght must be -//provided. -// -void MozillaString::insert(Int32 offset, const UNICODE_CHAR* source, - Int32 srcLength) -{ - ptrNSString->Insert(source, offset, srcLength); -} - -// -//Convert source from an integer to a string, and then insert. -// -void MozillaString::insert(Int32 offset, Int32 source) -{ - String convertString; - - insert(offset, ConvertInt(source, convertString)); -} - -// -//Replace the character specified by offset with the UNICODE_CHAR source -// -void MozillaString::replace(Int32 offset, const UNICODE_CHAR source) -{ - replace(offset, &source, 1); -} - -// -//Replace the character specified by offset with the C style character source -// -void MozillaString::replace(Int32 offset, const char source) -{ - replace(offset, (UNICODE_CHAR)source); -} - -// -//Replace the substring starting at offset with the String specified by source. -// -void MozillaString::replace(Int32 offset, const String& source) -{ - Int32 numToCut = 0; - - //There are issues if we try to replace a string using a portion of itself - //using its unicode buffer! So to try and be efficient, if source is equal - //to this, we will insert source at offset+source.length, then we will cut - //out the portion of the current string from offset to source.length - if (this == &source) - { - numToCut = (offset + source.length() > length()) ? length() - offset : - source.length(); - ptrNSString->Insert(*((MozillaString)source).ptrNSString , - offset + source.length()); - ptrNSString->Cut(offset, numToCut); - } - else - replace(offset, source.toUnicode(), source.length()); -} - -// -//Replace the substring starting at offset with the "C" style character string. -//See replace for a Unicode String of a specified lenght below for details -void MozillaString::replace(Int32 offset, const char* source) -{ - Int32 srcLength = strlen(source); - ptrNSString->Cut(offset, srcLength); - ptrNSString->Insert(source, offset, srcLength); -} - -// -//Replace the substring starting at offset with the Unicode string. -// -void MozillaString::replace(Int32 offset, const UNICODE_CHAR* source) -{ - replace(offset, source, UnicodeLength(source)); -} - -//Replace the substring starting at offset witht he Unicode string of specified -//length. -//nsString does not appear to provide direct support for replacing a -//character by another. So we will break the operation into pieces. -//( nsString::Cut(PRUint32, PRInt32) ) - Remove piece being replaced -//( nsString::Insert(PRUnichar*, PRInt32) ) - Insert the new piece -void MozillaString::replace(Int32 offset, const UNICODE_CHAR* source, - Int32 srcLength) -{ - ptrNSString->Cut(offset, srcLength); - ptrNSString->Insert(source, offset, srcLength); -} - -// -//Convert source from an integer to a String, and perform a replacement. -// -void MozillaString::replace(Int32 offset, Int32 source) -{ - String convertString; - - replace(offset, ConvertInt(source, convertString)); -} - -// -//Delete the "substring" starting at "offset" and proceeding for "count" number -//of characters (or until the end of the string, whichever comes first). -// -void MozillaString::deleteChars(Int32 offset, Int32 count) -{ - ptrNSString->Cut(offset, count); -} - -//Retreive the character stored at "index" (starting from 0) -//( PRUnichar nsString::CharAt(PRUint32) ) -UNICODE_CHAR MozillaString::charAt(Int32 index) const -{ - return ptrNSString->CharAt(index); -} - -// -//Clear out the string by simply setting the length to zero. The buffer is -//left intact. Apparently ( nsString::Truncate() ), by default, will clear all -//chars from the string. -// -void MozillaString::clear() -{ - ptrNSString->Truncate(); -} - -// -//Make sure the nsString has room for 'capacity' characters. -//( nsString::SetCapacity(PRUint32) ) -// -void MozillaString::ensureCapacity(Int32 capacity) -{ - ptrNSString->SetCapacity(capacity); -} - -/** - * Performs a CASE SENSITIVE search of the string for the first occurence - * of 'data'. If found return the index, else return NOT_FOUND. - * -- changed by kvisco to call indexOf(UNICODE_CHAR, Int32) -**/ -Int32 MozillaString::indexOf(UNICODE_CHAR data) const -{ - return indexOf(data, 0); -} //-- indexOf - -// -//Starting at 'offset' perform a CASE SENSITIVE search of the string looking -//for the first occurence of 'data'. If found return the index, else return -//NOT_FOUND. If the offset is less than zero, then start at zero. -//( nsString::FindChar(PRUnichar, PRBool, PRInt32) ) -// -Int32 MozillaString::indexOf(UNICODE_CHAR data, Int32 offset) const -{ - Int32 searchIndex = offset < 0 ? searchIndex = 0 : searchIndex = offset; - - return ptrNSString->FindChar(data, PR_FALSE, searchIndex); -} //-- indexOf - -// -//Returns the index of the first occurence of data. -// -Int32 MozillaString::indexOf(const String& data) const -{ - indexOf(data, 0); -} - -// -//Returns the index of the first occurrence of data starting at offset. -//Unfortunately there is no mention of how nsString determins the length of a -//PRUnichar* array, all other member functions that take such a data type also -//take a length. So we will play it safe, and construct an nsString from -//data's strBuffer, and use that to perform the search. -//( nsString::Find(const nsString&, PRBool, PRInt32) ) -// -Int32 MozillaString::indexOf(const String& data, Int32 offset) const -{ - Int32 searchIndex = offset < 0 ? searchIndex = 0 : searchIndex = offset; - - nsString nsStrData(data.toUnicode()); - - return ptrNSString->Find(nsStrData, PR_FALSE, searchIndex); -} - -// -//Check for equality between this string, and data. -//( nsString::Equals(const PRUnichar*, PRBool, PRInt32) ) -// -MBool MozillaString::isEqual(const String& data) const -{ - if (this == &data) - return MB_TRUE; - else if (ptrNSString->Length() != data.length()) - return MB_FALSE; - else - { - if (ptrNSString->Equals(data.toUnicode(), - PR_FALSE, data.length()) == PR_TRUE) - return MB_TRUE; - else - return MB_FALSE; - } -} - -/** - * Returns index of last occurrence of data - *
- * Added implementation 19990729 (kvisco) -**/ -Int32 MozillaString::lastIndexOf(UNICODE_CHAR data) const -{ - return ptrNSString->RFindChar(data); -} //-- lastIndexOf - -/** - * Returns the index of the last occurrence of data starting at offset. - * NOTE: offset start counting from the LEFT, just like nsString expects. - * ( nsString::RFindChar(PRUnichar, PRBool, PRInt32) ) - *
- * Added implementation 19990729 (kvisco) -**/ -Int32 MozillaString::lastIndexOf(UNICODE_CHAR data, Int32 offset) const -{ - return ptrNSString->RFindChar(data, PR_FALSE, offset); -} //-- lastIndexOf - -/** - * Returns the index of the last occurrence of data - *
- * Added implementation 19990729 (kvisco) -**/ -Int32 MozillaString::lastIndexOf(const String& data) const -{ - return lastIndexOf(data, data.length()); -} //-- lastIndexOf - -/** - * Returns the index of the last occurrence of data starting at offset. - * Since nsString::RFind does not describe how it determins the length of a - * PRUnichar* array, we will take the safe road by converting our String - * object into an nsString, and then using that for the search. - * ( nsString::RFind(const nsString&, PRBool, PRInt32) ) - *
- * Added implementation 19990729 (kvisco) -**/ -Int32 MozillaString::lastIndexOf(const String& data, Int32 offset) const -{ - nsString nsData(data.toUnicode(), data.length()); - - return ptrNSString->RFind(nsData, PR_FALSE, offset); -} - -//Retreive the length of this string ( PrInt32 nsString::Length() ) -Int32 MozillaString::length() const -{ - return ptrNSString->Length(); -} - -/** - * Sets the Length of this String, if length is less than 0, it will - * be set to 0; if length > current length, the string will be extended - * and padded with '\0' null characters. Otherwise the String - * will be truncated -**/ -void MozillaString::setLength(Int32 length) { - setLength(length, '\0'); -} //-- setLength - -/** - * Sets the Length of this String, if length is less than 0, it will - * be set to 0; if length > current length, the string will be extended - * and padded with given pad character. Otherwise the String - * will be truncated. - * It is not clear what nsString::Truncate(PRInt32) will do if it is presented - * with a length larger than the current string size. It is clear how ever - * that nsString does not support padding the string with a specified - * character, so this function will need to be broken into a couple of - * pieces. One if a simple truncation is taking place, and another if - * the stirng is being lengthened and padded. -**/ -void MozillaString::setLength(Int32 length, UNICODE_CHAR padChar) -{ - Int32 strLength = ptrNSString->Length(); - - if (length < strLength) - { - ptrNSString->Truncate(length); - } - else if (length > strLength) - { - ptrNSString->SetCapacity(length); - for(Int32 i=strLength; i < length; i++) - ptrNSString->Append(padChar); - } -} //-- setLength - -// -//Returns a subString starting at start -// -String& MozillaString::subString(Int32 start, String& dest) const -{ - subString(start, ptrNSString->Length(), dest); -} - -/** - * Returns the subString starting at start and ending at end - * Note: the dest String is cleared before use - * For efficiency we will simply retreive characters from our nsString object - * with nsString::CharAt(PRInt32). Storage in dest will be through String's - * public interface, to ensure compatiability with all classes derrived from - * String. -**/ -String& MozillaString::subString(Int32 start, Int32 end, String& dest) const -{ - Int32 srcLoop; - Int32 strLength = ptrNSString->Length(); - - start = start < 0? 0 : start; - end = end > strLength? strLength : end; - - dest.clear(); - if ((start < end)) - { - dest.ensureCapacity(end - start); - for (srcLoop=start;srcLoopCharAt(srcLoop)); - } - - return dest; -} - -/** - * Instantiate a new character buffer (remembering the null terminator) and pass - * it to toChar(char*). -**/ -char* MozillaString::toCharArray() const -{ - char* tmpBuffer = new char[ptrNSString->Length()+1]; - - return toCharArray(tmpBuffer); -} - -/** - * Convert the internally represented string to a character buffer. Store - * the resultant character array in the buffer provided by the caller. A - * null terminator will be placed at the end of the array, make sure - * space has been provided. - * Use ( nsString::GetUnicode() ) to retreive the nsString's buffer, then - * copy it to dest. -**/ -char* MozillaString::toCharArray(char* dest) const -{ - Int32 copyLoop; - Int32 strLength = ptrNSString->Length(); - const char* strBuffer = ptrNSString->GetBuffer(); - - for (copyLoop=0;copyLoopLength(); - const UNICODE_CHAR* strBuffer = ptrNSString->GetUnicode(); - - for (copyLoop=0;copyLoopGetUnicode(); -} - -// -//Convert String to lowercase ( nsString::ToLowerCase() ) -// -void MozillaString::toLowerCase() -{ - ptrNSString->ToLowerCase(); -} - -// -//Convert String to uppercase ( nsString::ToUpperCase() ) -// -void MozillaString::toUpperCase() -{ - ptrNSString->ToUpperCase(); -} - -// -//Trim whitespace from both ends of String -//( nsString::Trim(const char*, PRBool, PRBool) ) -//Currently we trim only spaces! -// -void MozillaString::trim() -{ - ptrNSString->Trim(" \n\t\r"); -} - -// -//Cause the string to reverse itself -//nsString does not appear to have a reversal method, so we will use -//nsString::CharAt(PRUint32) and nsString::SetCharAt(PRUnichar, PRUint32) like -//in Stirng. -// -void MozillaString::reverse() -{ - Int32 reverseLoop; - Int32 strLength = ptrNSString->Length(); - UNICODE_CHAR tempChar; - - for (reverseLoop=0;reverseLoop<(strLength/2); reverseLoop++) - { - tempChar = ptrNSString->CharAt(reverseLoop); - ptrNSString->SetCharAt(ptrNSString->CharAt(strLength - reverseLoop - 1), - reverseLoop); - ptrNSString->SetCharAt(tempChar, strLength - reverseLoop - 1); - } -} - -// -//Retrieve a reference to the nsString object -// -nsString& MozillaString::getNSString() -{ - return *ptrNSString; -} - -// -//Retrieve a const reference to the nsString object -// -const nsString& MozillaString::getConstNSString() const -{ - return *ptrNSString; -} - -// -//String copies itself to the destination -// -//void MozillaString::copyString(SPECIAL_CHAR* dest) -//{ -//} - +/* + + * (C) Copyright The MITRE Corporation 1999 All rights reserved. + + * + + * The contents of this file are subject to the Mozilla Public License + + * Version 1.0 (the "License"); you may not use this file except in + + * compliance with the License. You may obtain a copy of the License at + + * http://www.mozilla.org/MPL/ + + * + + * The program provided "as is" without any warranty express or + + * implied, including the warranty of non-infringement and the implied + + * warranties of merchantibility and fitness for a particular purpose. + + * The Copyright owner will not be liable for any damages suffered by + + * you as a result of using the Program. In no event will the Copyright + + * owner be liable for any special, indirect or consequential damages or + + * lost profits even if the Copyright owner has been advised of the + + * possibility of their occurrence. + + * + + * Please see release.txt distributed with this file for more information. + + * + + */ + + + +// Tom Kneeland (12/03/1999) + +// + +// Wrapper class to convert nsString, into a MITRE/TransforMIIX compatiable + +// string. + +// + +// Modification History: + +// Who When What + +// TK 01/13/2000 Added a means to retrieve the nsString object. This + +// provides an efficient way to retreive nsString data from + +// Mozilla functions expecting nsString references as + +// destination objects (like nsIDOMNode::GetNodeName) + + + +#include + +#include + +#include "MozillaString.h" + +#include + + + +// + +//Default constructor ( nsString() ) + +// + +MozillaString::MozillaString() + +{ + + ptrNSString = new nsString(); + +} + + + +// + +//Create an nsString with the specified size + +// + +MozillaString::MozillaString(Int32 initSize) + +{ + + ptrNSString = new nsString(); + + ptrNSString->SetCapacity(initSize); + +} + + + +// + +//Create an nsString from the provided String object + +//Use the Unicode representation to perform the copy + +// (nsString(source, length(source)) ) + +MozillaString::MozillaString(const String& source) + +{ + ptrNSString = new nsString(source.toUnicode(), source.length()); +} + + +// +//Create a new sting by assuming control of the provided nsString +// + +MozillaString::MozillaString(nsString* theNSString) + +{ + + ptrNSString = theNSString; + +} + + + +// + +//Create a copy of the source string + +// + +MozillaString::MozillaString(const MozillaString& source) + +{ + + ptrNSString = new nsString(*source.ptrNSString); + +} + + + +// + +//Create a string from the characters ( nsString(source, -1) ) + +// NOTE: Since, by definition, this C Style string is null terminated, simply + +// accept the default length (-1) to the nsString constructor, and let + +// it calculate its length. + +// + +// + +MozillaString::MozillaString(const char* source) + +{ + + ptrNSString = new nsString(source); + +} + + + +// + +//Create a string from the Unicode Characters + +//( nsString(source, length(source)) ) + +// NOTE: The length passed to this constructor does not include the NULL + +// terminator (in C fashion). + +// + +MozillaString::MozillaString(const UNICODE_CHAR* source, Int32 srcLength) + +{ + + ptrNSString = new nsString(source, srcLength); + +} + + + + + +// + +//Destroy the nsString, and free memory + +// + +MozillaString::~MozillaString() + +{ + + delete ptrNSString; + +} + + + +// + +//Overloaded '=' operator to assign the value of the source string to this + +//string. Only use String's public interface to ensure compatibility with + +//String, MozillaString, and any other object derrived from the String + +//interface. ( nsString::Assign(PRUnichar*, PRInt32) ) + +// + +String& MozillaString::operator=(const String& source) + +{ + + //Assign the Unicode Char buffer to the nsString + + ptrNSString->Assign(source.toUnicode(), source.length()); + + return *this; +} + + +// + +//Overloaded '=' operator to assigne the value of a MozillaString to this + +//MozillaString. ( nsString::Assign(const nsString) ) + +String& MozillaString::operator=(const MozillaString& source) + +{ + + ptrNSString->Assign(source.toUnicode(), source.length()); + + return *this; +} + + + +// + +//Overloaded '=' operator to assign the value of the source C string to this + +//string. ( nsString::Assign(const char*, PRInt32) ) + +// + +String& MozillaString::operator=(const char* source) + +{ + + ptrNSString->Assign(source); + + return *this; +} + + + +// + +//Overloaded '=' operator to assign an integer to this string. + +// + +String& MozillaString::operator=(Int32 source) + +{ + + //Since String::ConvertInt only uses String's public interface, use it to + + //convert "source", and store it in this object + + return ConvertInt(source, *this); + +} //-- operator= + + + +// + +//Append the source character ( nsString::Append(PRUnichar) ) + +// + +void MozillaString::append(UNICODE_CHAR source) + +{ + + ptrNSString->Append(source); + +} + + + +// + +//Append a character to the string (nsString::Append(char) ) + +// + +void MozillaString::append(char source) + +{ + + ptrNSString->Append(source); + +} + + + +// + +//Append String. Only use String's public interface to ensure compatibility + +//with all classes derrived from String. + +//Ultimately use ( nsString::Append(const PRUnichar*, PRInt32) ) or + +// ( nsString::Append(const nsString&) ) + +// + +void MozillaString::append(const String& source) + +{ + + //There are issues if we try to append a string to itself using its unicode + + //buffer! So if the provided source object is equal to this, then we are + + //appending this MozillaString to itself, so cast source to a MozillaString + + //object, and go after its nsString implementation. + + if (this == &source) + + ptrNSString->Append(*((MozillaString)source).ptrNSString); + + else + + ptrNSString->Append(source.toUnicode(), source.length()); + +} + + + + //Need to provide a means to append one mozstring to another. This seems + + //to be necessary because nsString seems to get confused if its own + + //Unicode buffer is passed itself for appending (ie a MozString is appended + + //to itself using on the functions provided by the public String + + //interface). + +void MozillaString::append(const MozillaString& source) + +{ + + ptrNSString->Append(*source.ptrNSString); + +} + + + +// + +//Append a string of characters (null terminated arry of chars) + +//( nsString::Append(const char*, PRInt32) ) + +// + +void MozillaString::append(const char* source) + +{ + + ptrNSString->Append(source); + +} + + + +// + +//Append a string of unicode chars (null terminated array of Unicode chars) + +//( nsString::Append(const PRUnichar*, PRInt32) ) + +// + +void MozillaString::append(const UNICODE_CHAR* source) + +{ + + ptrNSString->Append(source, UnicodeLength(source)); + +} + + + +// + +//Append a string of DOM Characters whose length is also defined + +//( nsString::Append(const PRUnichar*, PRInt32) ) + +// + +void MozillaString::append(const UNICODE_CHAR* source, Int32 length) + +{ + + ptrNSString->Append(source, length); + +} + + + +// + +//Convert source from an integer to a string, and append it to the current + +//string. ( nsString::Append(PRInt32, PRInt32 aRadix=10) ) + +// + +void MozillaString::append(Int32 source) + +{ + + ptrNSString->Append(source); + +} + + + +// + +//Insert a single UNICODE_CHAR into the string starting at offset + +//( nsString::Insert(PRUnichar, PRUint32) ) + +// + +void MozillaString::insert(Int32 offset, const UNICODE_CHAR source) + +{ + + ptrNSString->Insert(source, offset); + +} + +// +//Insert a single C type character into the string starting at offset + +//nsString does not seem to support the insertion of a char (it seems to be + +//commented out) so just use nsString::Insert(PRUnichar, PRUint32). + +// + +void MozillaString::insert(Int32 offset, const char source) + +{ + + ptrNSString->Insert((PRUnichar)source, offset); + +} + + + +// + +//Insert the source string starting at the current offset + +//Only use the public interface of source, since we must support all classes + +//derrived from String. + +//( nsString::Insert(const PRUnichar*, PRuint32, PRInt32) ) + +// + +void MozillaString::insert(Int32 offset, const String& source) + +{ + + //There are issues if we try to insert a string into itself using its unicode + + //buffer! So if the provided source object is equal to this, then we are + + //appending this MozillaString to itself, so cast source to a MozillaString + + //object, and go after its nsString implementation. + + if (this == &source) + + ptrNSString->Insert(*((MozillaString)source).ptrNSString, offset); + + else + + ptrNSString->Insert(source.toUnicode(), offset, source.length()); + +} + + + +// + +//Insert the source "C" type string into this string starting at offset. + +//( nsString::Insert(const char*, PRUint32, PrInt32) ) + +// + +void MozillaString::insert(Int32 offset, const char* source) + +{ + + ptrNSString->Insert(source, offset); + +} + + + +// + +//Insert the source UNICODE_CHAR type string into this string starting at + +//offset. Note that the source is Null Terminated. + +//( nsString::Insert(const PRUnichar*, PRuint32, PRInt32) ) + +// + +void MozillaString::insert(Int32 offset, const UNICODE_CHAR* source) + +{ + + ptrNSString->Insert(source, offset, UnicodeLength(source)); + +} + + + +// + +//Insert the source UNICODE_CHAR type string into this string starting at + +//offset. Note that the array is not null terminated, so the lenght must be + +//provided. + +// + +void MozillaString::insert(Int32 offset, const UNICODE_CHAR* source, + + Int32 srcLength) + +{ + + ptrNSString->Insert(source, offset, srcLength); + +} + + + +// + +//Convert source from an integer to a string, and then insert. + +// + +void MozillaString::insert(Int32 offset, Int32 source) + +{ + + String convertString; + + + + insert(offset, ConvertInt(source, convertString)); + +} + + + +// + +//Replace the character specified by offset with the UNICODE_CHAR source + +// + +void MozillaString::replace(Int32 offset, const UNICODE_CHAR source) + +{ + + replace(offset, &source, 1); + +} + + + +// + +//Replace the character specified by offset with the C style character source + +// + +void MozillaString::replace(Int32 offset, const char source) + +{ + + replace(offset, (UNICODE_CHAR)source); + +} + + + +// + +//Replace the substring starting at offset with the String specified by source. + +// + +void MozillaString::replace(Int32 offset, const String& source) + +{ + + Int32 numToCut = 0; + + + + //There are issues if we try to replace a string using a portion of itself + + //using its unicode buffer! So to try and be efficient, if source is equal + + //to this, we will insert source at offset+source.length, then we will cut + + //out the portion of the current string from offset to source.length + + if (this == &source) + + { + + numToCut = (offset + source.length() > length()) ? length() - offset : + + source.length(); + + ptrNSString->Insert(*((MozillaString)source).ptrNSString , + + offset + source.length()); + + ptrNSString->Cut(offset, numToCut); + + } + + else + + replace(offset, source.toUnicode(), source.length()); + +} + + + +// + +//Replace the substring starting at offset with the "C" style character string. + +//See replace for a Unicode String of a specified lenght below for details + +void MozillaString::replace(Int32 offset, const char* source) + +{ + + Int32 srcLength = strlen(source); + + ptrNSString->Cut(offset, srcLength); + + ptrNSString->Insert(source, offset, srcLength); + +} + + + +// + +//Replace the substring starting at offset with the Unicode string. + +// + +void MozillaString::replace(Int32 offset, const UNICODE_CHAR* source) + +{ + + replace(offset, source, UnicodeLength(source)); + +} + + + +//Replace the substring starting at offset witht he Unicode string of specified + +//length. + +//nsString does not appear to provide direct support for replacing a + +//character by another. So we will break the operation into pieces. + +//( nsString::Cut(PRUint32, PRInt32) ) - Remove piece being replaced + +//( nsString::Insert(PRUnichar*, PRInt32) ) - Insert the new piece + +void MozillaString::replace(Int32 offset, const UNICODE_CHAR* source, + + Int32 srcLength) + +{ + + ptrNSString->Cut(offset, srcLength); + + ptrNSString->Insert(source, offset, srcLength); + +} + + + +// + +//Convert source from an integer to a String, and perform a replacement. + +// + +void MozillaString::replace(Int32 offset, Int32 source) + +{ + + String convertString; + + + + replace(offset, ConvertInt(source, convertString)); + +} + + + +// + +//Delete the "substring" starting at "offset" and proceeding for "count" number + +//of characters (or until the end of the string, whichever comes first). + +// + +void MozillaString::deleteChars(Int32 offset, Int32 count) + +{ + + ptrNSString->Cut(offset, count); + +} + + + +//Retreive the character stored at "index" (starting from 0) + +//( PRUnichar nsString::CharAt(PRUint32) ) + +UNICODE_CHAR MozillaString::charAt(Int32 index) const + +{ + + return ptrNSString->CharAt(index); + +} + + + +// + +//Clear out the string by simply setting the length to zero. The buffer is + +//left intact. Apparently ( nsString::Truncate() ), by default, will clear all + +//chars from the string. + +// + +void MozillaString::clear() + +{ + + ptrNSString->Truncate(); + +} + + + +// + +//Make sure the nsString has room for 'capacity' characters. + +//( nsString::SetCapacity(PRUint32) ) + +// + +void MozillaString::ensureCapacity(Int32 capacity) + +{ + + ptrNSString->SetCapacity(capacity); + +} + + + +/** + + * Performs a CASE SENSITIVE search of the string for the first occurence + + * of 'data'. If found return the index, else return NOT_FOUND. + + * -- changed by kvisco to call indexOf(UNICODE_CHAR, Int32) + +**/ + +Int32 MozillaString::indexOf(UNICODE_CHAR data) const + +{ + + return indexOf(data, 0); + +} //-- indexOf + + + +// + +//Starting at 'offset' perform a CASE SENSITIVE search of the string looking + +//for the first occurence of 'data'. If found return the index, else return + +//NOT_FOUND. If the offset is less than zero, then start at zero. + +//( nsString::FindChar(PRUnichar, PRBool, PRInt32) ) + +// + +Int32 MozillaString::indexOf(UNICODE_CHAR data, Int32 offset) const + +{ + + Int32 searchIndex = offset < 0 ? searchIndex = 0 : searchIndex = offset; + + + + return ptrNSString->FindChar(data, PR_FALSE, searchIndex); + +} //-- indexOf + + + +// + +//Returns the index of the first occurence of data. + +// + +Int32 MozillaString::indexOf(const String& data) const + +{ + + return indexOf(data, 0); + +} + + + +// + +//Returns the index of the first occurrence of data starting at offset. + +//Unfortunately there is no mention of how nsString determins the length of a + +//PRUnichar* array, all other member functions that take such a data type also + +//take a length. So we will play it safe, and construct an nsString from + +//data's strBuffer, and use that to perform the search. + +//( nsString::Find(const nsString&, PRBool, PRInt32) ) + +// + +Int32 MozillaString::indexOf(const String& data, Int32 offset) const + +{ + + Int32 searchIndex = offset < 0 ? searchIndex = 0 : searchIndex = offset; + + + + nsString nsStrData(data.toUnicode()); + + + + return ptrNSString->Find(nsStrData, PR_FALSE, searchIndex); + +} + + + +// + +//Check for equality between this string, and data. + +//( nsString::Equals(const PRUnichar*, PRBool, PRInt32) ) + +// + +MBool MozillaString::isEqual(const String& data) const + +{ + + if (this == &data) + return MB_TRUE; + else if (ptrNSString->Length() != data.length()) + return MB_FALSE; + else + { + + if (ptrNSString->Equals(data.toUnicode(), + + PR_FALSE, data.length()) == PR_TRUE) + + return MB_TRUE; + + else + + return MB_FALSE; + + } + +} + + + +/** + + * Returns index of last occurrence of data + + *
+ + * Added implementation 19990729 (kvisco) + +**/ + +Int32 MozillaString::lastIndexOf(UNICODE_CHAR data) const + +{ + + return ptrNSString->RFindChar(data); + +} //-- lastIndexOf + + + +/** + + * Returns the index of the last occurrence of data starting at offset. + + * NOTE: offset start counting from the LEFT, just like nsString expects. + + * ( nsString::RFindChar(PRUnichar, PRBool, PRInt32) ) + + *
+ + * Added implementation 19990729 (kvisco) + +**/ + +Int32 MozillaString::lastIndexOf(UNICODE_CHAR data, Int32 offset) const + +{ + + return ptrNSString->RFindChar(data, PR_FALSE, offset); + +} //-- lastIndexOf + + + +/** + + * Returns the index of the last occurrence of data + + *
+ + * Added implementation 19990729 (kvisco) + +**/ + +Int32 MozillaString::lastIndexOf(const String& data) const + +{ + + return lastIndexOf(data, data.length()); + +} //-- lastIndexOf + + + +/** + + * Returns the index of the last occurrence of data starting at offset. + + * Since nsString::RFind does not describe how it determins the length of a + + * PRUnichar* array, we will take the safe road by converting our String + + * object into an nsString, and then using that for the search. + + * ( nsString::RFind(const nsString&, PRBool, PRInt32) ) + + *
+ + * Added implementation 19990729 (kvisco) + +**/ + +Int32 MozillaString::lastIndexOf(const String& data, Int32 offset) const + +{ + + nsString nsData(data.toUnicode(), data.length()); + + + + return ptrNSString->RFind(nsData, PR_FALSE, offset); + +} + + + +//Retreive the length of this string ( PrInt32 nsString::Length() ) + +Int32 MozillaString::length() const + +{ + + return ptrNSString->Length(); + +} + + + +/** + + * Sets the Length of this String, if length is less than 0, it will + + * be set to 0; if length > current length, the string will be extended + + * and padded with '\0' null characters. Otherwise the String + + * will be truncated + +**/ + +void MozillaString::setLength(Int32 length) { + + setLength(length, '\0'); + +} //-- setLength + + + +/** + + * Sets the Length of this String, if length is less than 0, it will + + * be set to 0; if length > current length, the string will be extended + + * and padded with given pad character. Otherwise the String + + * will be truncated. + + * It is not clear what nsString::Truncate(PRInt32) will do if it is presented + + * with a length larger than the current string size. It is clear how ever + + * that nsString does not support padding the string with a specified + + * character, so this function will need to be broken into a couple of + + * pieces. One if a simple truncation is taking place, and another if + + * the stirng is being lengthened and padded. + +**/ + +void MozillaString::setLength(Int32 length, UNICODE_CHAR padChar) + +{ + + Int32 strLength = ptrNSString->Length(); + + + + if (length < strLength) + + { + + ptrNSString->Truncate(length); + + } + + else if (length > strLength) + + { + + ptrNSString->SetCapacity(length); + + for(Int32 i=strLength; i < length; i++) + + ptrNSString->Append(padChar); + + } + +} //-- setLength + + + +// + +//Returns a subString starting at start + +// + +String& MozillaString::subString(Int32 start, String& dest) const + +{ + + return subString(start, ptrNSString->Length(), dest); + +} + + + +/** + + * Returns the subString starting at start and ending at end + + * Note: the dest String is cleared before use + + * For efficiency we will simply retreive characters from our nsString object + + * with nsString::CharAt(PRInt32). Storage in dest will be through String's + + * public interface, to ensure compatiability with all classes derrived from + + * String. + +**/ + +String& MozillaString::subString(Int32 start, Int32 end, String& dest) const + +{ + + Int32 srcLoop; + + Int32 strLength = ptrNSString->Length(); + + + + start = start < 0? 0 : start; + + end = end > strLength? strLength : end; + + + + dest.clear(); + + if ((start < end)) + + { + + dest.ensureCapacity(end - start); + + for (srcLoop=start;srcLoopCharAt(srcLoop)); + + } + + + + return dest; + +} + + + +/** + + * Instantiate a new character buffer (remembering the null terminator) and pass + + * it to toChar(char*). + +**/ + +char* MozillaString::toCharArray() const + +{ + + char* tmpBuffer = new char[ptrNSString->Length()+1]; + + + + return toCharArray(tmpBuffer); + +} + + + +/** + + * Convert the internally represented string to a character buffer. Store + + * the resultant character array in the buffer provided by the caller. A + + * null terminator will be placed at the end of the array, make sure + + * space has been provided. + + * Use ( nsString::GetUnicode() ) to retreive the nsString's buffer, then + + * copy it to dest. + +**/ + +char* MozillaString::toCharArray(char* dest) const + +{ + + Int32 copyLoop; + + Int32 strLength = ptrNSString->Length(); + + const char* strBuffer = ptrNSString->GetBuffer(); + + + + for (copyLoop=0;copyLoopLength(); + + const UNICODE_CHAR* strBuffer = ptrNSString->GetUnicode(); + + + + for (copyLoop=0;copyLoopGetUnicode(); + +} + + + +// + +//Convert String to lowercase ( nsString::ToLowerCase() ) + +// + +void MozillaString::toLowerCase() + +{ + + ptrNSString->ToLowerCase(); + +} + + + +// + +//Convert String to uppercase ( nsString::ToUpperCase() ) + +// + +void MozillaString::toUpperCase() + +{ + + ptrNSString->ToUpperCase(); + +} + + + +// + +//Trim whitespace from both ends of String + +//( nsString::Trim(const char*, PRBool, PRBool) ) + +//Currently we trim only spaces! + +// + +void MozillaString::trim() + +{ + + ptrNSString->Trim(" \n\t\r"); + +} + + + +// + +//Cause the string to reverse itself + +//nsString does not appear to have a reversal method, so we will use + +//nsString::CharAt(PRUint32) and nsString::SetCharAt(PRUnichar, PRUint32) like + +//in Stirng. + +// + +void MozillaString::reverse() + +{ + + Int32 reverseLoop; + + Int32 strLength = ptrNSString->Length(); + + UNICODE_CHAR tempChar; + + + + for (reverseLoop=0;reverseLoop<(strLength/2); reverseLoop++) + + { + + tempChar = ptrNSString->CharAt(reverseLoop); + + ptrNSString->SetCharAt(ptrNSString->CharAt(strLength - reverseLoop - 1), + + reverseLoop); + + ptrNSString->SetCharAt(tempChar, strLength - reverseLoop - 1); + + } + +} + + + +// + +//Retrieve a reference to the nsString object + +// + +nsString& MozillaString::getNSString() + +{ + + return *ptrNSString; + +} + + + +// + +//Retrieve a const reference to the nsString object + +// + +const nsString& MozillaString::getConstNSString() const + +{ + + return *ptrNSString; + +} + + + +// + +//String copies itself to the destination + +// + +//void MozillaString::copyString(SPECIAL_CHAR* dest) + +//{ + +//} + + + diff --git a/mozilla/extensions/transformiix/source/base/MozillaString.h b/mozilla/extensions/transformiix/source/base/MozillaString.h index fd95f406c1a..9f3eaa4cd3c 100644 --- a/mozilla/extensions/transformiix/source/base/MozillaString.h +++ b/mozilla/extensions/transformiix/source/base/MozillaString.h @@ -39,7 +39,7 @@ #ifndef MITRE_MOZILLA_STRING #define MITRE_MOZILLA_STRING -#include "String.h" +#include "TxString.h" #include "MITREObject.h" #include "baseutils.h" #include "nsString.h" diff --git a/mozilla/extensions/transformiix/source/base/NamedMap.h b/mozilla/extensions/transformiix/source/base/NamedMap.h index c67e6ee6eed..58a1d0bdb21 100644 --- a/mozilla/extensions/transformiix/source/base/NamedMap.h +++ b/mozilla/extensions/transformiix/source/base/NamedMap.h @@ -21,19 +21,19 @@ * Keith Visco, kvisco@ziplink.net * -- original author. * - * $Id: NamedMap.h,v 1.3 2000-02-22 11:10:00 kvisco%ziplink.net Exp $ + * $Id: NamedMap.h,v 1.4 2000-04-12 22:30:54 nisheeth%netscape.com Exp $ */ /** * A Named Map for MITREObjects * @author Keith Visco - * @version $Revision: 1.3 $ $Date: 2000-02-22 11:10:00 $ + * @version $Revision: 1.4 $ $Date: 2000-04-12 22:30:54 $ **/ #ifndef TRANSFRMX_NAMEDMAP_H #define TRANSFRMX_NAMEDMAP_H -#include "String.h" +#include "TxString.h" #include "baseutils.h" #include "MITREObject.h" #include "StringList.h" diff --git a/mozilla/extensions/transformiix/source/base/StringComparator.h b/mozilla/extensions/transformiix/source/base/StringComparator.h index a0981d473b8..91f1b84b347 100644 --- a/mozilla/extensions/transformiix/source/base/StringComparator.h +++ b/mozilla/extensions/transformiix/source/base/StringComparator.h @@ -20,10 +20,10 @@ * Keith Visco, kvisco@ziplink.net * -- original author. * - * $Id: StringComparator.h,v 1.1 2000-04-12 10:49:39 kvisco%ziplink.net Exp $ + * $Id: StringComparator.h,v 1.2 2000-04-12 22:30:54 nisheeth%netscape.com Exp $ */ - #include "String.h" + #include "TxString.h" #include "TxObject.h" #ifndef TRANSFRMX_STRING_COMPARATOR_H diff --git a/mozilla/extensions/transformiix/source/base/StringList.h b/mozilla/extensions/transformiix/source/base/StringList.h index 9dac148f750..a162507db57 100644 --- a/mozilla/extensions/transformiix/source/base/StringList.h +++ b/mozilla/extensions/transformiix/source/base/StringList.h @@ -23,16 +23,16 @@ * Bob Miller, kbob@oblix.com * -- plugged core leak. * - * $Id: StringList.h,v 1.7 2000-04-07 08:58:55 kvisco%ziplink.net Exp $ + * $Id: StringList.h,v 1.8 2000-04-12 22:30:57 nisheeth%netscape.com Exp $ */ /** * A class for keeping an ordered list of Strings * @author Keith Visco - * @version $Revision: 1.7 $ $Date: 2000-04-07 08:58:55 $ + * @version $Revision: 1.8 $ $Date: 2000-04-12 22:30:57 $ **/ -#include "String.h" +#include "TxString.h" #include "baseutils.h" #ifndef TRANSFRMX_STRINGLIST_H diff --git a/mozilla/extensions/transformiix/source/base/Tokenizer.h b/mozilla/extensions/transformiix/source/base/Tokenizer.h index c2ee0b329ac..b8c718799ef 100644 --- a/mozilla/extensions/transformiix/source/base/Tokenizer.h +++ b/mozilla/extensions/transformiix/source/base/Tokenizer.h @@ -25,19 +25,19 @@ * Larry Fitzpatrick, OpenText, lef@opentext.com * -- 19990806, added void return type declaration for ::nextToken() * - * $Id: Tokenizer.h,v 1.2 1999-11-15 07:12:42 nisheeth%netscape.com Exp $ + * $Id: Tokenizer.h,v 1.3 2000-04-12 22:31:03 nisheeth%netscape.com Exp $ */ /** * Tokenizer * A simple String tokenizer * @author Keith Visco - * @version $Revision: 1.2 $ $Date: 1999-11-15 07:12:42 $ + * @version $Revision: 1.3 $ $Date: 2000-04-12 22:31:03 $ **/ #include "baseutils.h" -#include "String.h" +#include "TxString.h" #ifndef MITRE_TOKENIZER_H diff --git a/mozilla/extensions/transformiix/source/base/makefile.win b/mozilla/extensions/transformiix/source/base/makefile.win index c65570c8754..5652977ed45 100644 --- a/mozilla/extensions/transformiix/source/base/makefile.win +++ b/mozilla/extensions/transformiix/source/base/makefile.win @@ -19,7 +19,7 @@ # # Contributor(s): -DEPTH=..\..\..\..\.. +DEPTH=..\..\..\.. LIBRARY_NAME=transformix_base MODULE=transformix @@ -28,29 +28,39 @@ REQUIRES=xpcom raptor DEFINES=-DMOZILLA CPPSRCS= \ + ArrayList.cpp \ CommandLineUtils.cpp \ + DefaultStringComparator.cpp \ Double.cpp \ + HashTable.cpp \ Integer.cpp \ List.cpp \ MITREObjectWrapper.cpp \ + MozillaString.cpp \ NamedMap.cpp \ SimpleErrorObserver.cpp \ Stack.cpp \ - String.cpp \ + TxString.cpp \ + StringComparator.cpp \ StringList.cpp \ Tokenizer.cpp \ $(NULL) CPP_OBJS= \ + .\$(OBJDIR)\ArrayList.obj \ .\$(OBJDIR)\CommandLineUtils.obj \ + .\$(OBJDIR)\DefaultStringComparator.obj \ .\$(OBJDIR)\Double.obj \ + .\$(OBJDIR)\HashTable.obj \ .\$(OBJDIR)\Integer.obj \ .\$(OBJDIR)\List.obj \ .\$(OBJDIR)\MITREObjectWrapper.obj \ + .\$(OBJDIR)\MozillaString.obj \ .\$(OBJDIR)\NamedMap.obj \ .\$(OBJDIR)\SimpleErrorObserver.obj \ .\$(OBJDIR)\Stack.obj \ - .\$(OBJDIR)\String.obj \ + .\$(OBJDIR)\TxString.obj \ + .\$(OBJDIR)\StringComparator.obj \ .\$(OBJDIR)\StringList.obj \ .\$(OBJDIR)\Tokenizer.obj \ $(NULL) diff --git a/mozilla/extensions/transformiix/source/base/primitives.h b/mozilla/extensions/transformiix/source/base/primitives.h index d6821f4ef90..4ddc2e8b130 100644 --- a/mozilla/extensions/transformiix/source/base/primitives.h +++ b/mozilla/extensions/transformiix/source/base/primitives.h @@ -28,7 +28,7 @@ * Eric Du, duxy@leyou.com.cn * -- added fix for FreeBSD * - * $Id: primitives.h,v 1.4 2000-04-06 22:36:39 Peter.VanderBeken%pandora.be Exp $ + * $Id: primitives.h,v 1.5 2000-04-12 22:31:09 nisheeth%netscape.com Exp $ */ @@ -37,7 +37,7 @@ #include "MITREObject.h" #include "baseutils.h" -#include "String.h" +#include "TxString.h" #include #ifdef WIN32 diff --git a/mozilla/extensions/transformiix/source/makefile.win b/mozilla/extensions/transformiix/source/makefile.win index a3e43c7caa1..98800def9a0 100644 --- a/mozilla/extensions/transformiix/source/makefile.win +++ b/mozilla/extensions/transformiix/source/makefile.win @@ -19,8 +19,8 @@ # # Contributor(s): -DEPTH=..\..\..\.. +DEPTH=..\..\.. -DIRS=base main net xml xpath xslt +DIRS=base xml xpath xslt include <$(DEPTH)\config\rules.mak> diff --git a/mozilla/extensions/transformiix/source/net/URIUtils.h b/mozilla/extensions/transformiix/source/net/URIUtils.h index c40d2cdd13e..b855f2b29d9 100644 --- a/mozilla/extensions/transformiix/source/net/URIUtils.h +++ b/mozilla/extensions/transformiix/source/net/URIUtils.h @@ -31,10 +31,10 @@ * -- 20000326 * -- added Mozilla integration code * - * $Id: URIUtils.h,v 1.3 2000-03-27 07:12:10 kvisco%ziplink.net Exp $ + * $Id: URIUtils.h,v 1.4 2000-04-12 22:31:17 nisheeth%netscape.com Exp $ */ -#include "String.h" +#include "TxString.h" #include "baseutils.h" #include #include @@ -53,7 +53,7 @@ static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); * A utility class for URI handling * Not yet finished, only handles file URI at this point * @author Keith Visco - * @version $Revision: 1.3 $ $Date: 2000-03-27 07:12:10 $ + * @version $Revision: 1.4 $ $Date: 2000-04-12 22:31:17 $ * **/ diff --git a/mozilla/extensions/transformiix/source/xml/DocumentHandler.h b/mozilla/extensions/transformiix/source/xml/DocumentHandler.h index 951061d1656..9fa7baeb83a 100755 --- a/mozilla/extensions/transformiix/source/xml/DocumentHandler.h +++ b/mozilla/extensions/transformiix/source/xml/DocumentHandler.h @@ -19,7 +19,7 @@ * Keith Visco, kvisco@ziplink.net * -- original author. * - * $Id: DocumentHandler.h,v 1.1 1999-11-25 03:03:04 kvisco%ziplink.net Exp $ + * $Id: DocumentHandler.h,v 1.2 2000-04-12 22:31:33 nisheeth%netscape.com Exp $ */ @@ -27,7 +27,7 @@ #define TRANSFRMX_DOCUMENT_HANDLER_H -#include "String.h" +#include "TxString.h" #ifndef UNICODE_CHAR @@ -41,7 +41,7 @@ typedef unsigned short UNICODE_CHAR * I apologize for not throwing SAXExceptions, I am trying * to follow Mozilla.org's guidelines for writing portable C++. * @author Keith Visco - * @version $Revision: 1.1 $ $Date: 1999-11-25 03:03:04 $ + * @version $Revision: 1.2 $ $Date: 2000-04-12 22:31:33 $ **/ class DocumentHandler { diff --git a/mozilla/extensions/transformiix/source/xml/XMLUtils.h b/mozilla/extensions/transformiix/source/xml/XMLUtils.h index 9647a5cf369..5b12a70cae2 100644 --- a/mozilla/extensions/transformiix/source/xml/XMLUtils.h +++ b/mozilla/extensions/transformiix/source/xml/XMLUtils.h @@ -21,7 +21,7 @@ * Keith Visco, kvisco@ziplink.net * -- original author. * - * $Id: XMLUtils.h,v 1.2 1999-11-15 07:12:49 nisheeth%netscape.com Exp $ + * $Id: XMLUtils.h,v 1.3 2000-04-12 22:31:34 nisheeth%netscape.com Exp $ */ /** @@ -29,7 +29,7 @@ * @author Keith Visco **/ -#include "String.h" +#include "TxString.h" #include "baseutils.h" #ifndef MITRE_XMLUTILS_H diff --git a/mozilla/extensions/transformiix/source/xml/dom/dom.h b/mozilla/extensions/transformiix/source/xml/dom/dom.h index 9f7ff124f83..dae6de920c2 100644 --- a/mozilla/extensions/transformiix/source/xml/dom/dom.h +++ b/mozilla/extensions/transformiix/source/xml/dom/dom.h @@ -1,567 +1,1134 @@ -/* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. - * - */ -// Tom Kneeland (3/29/99) -// -// Implementation of the Document Object Model Level 1 Core -// -// Modification History: -// Who When What -// TK 03/29/99 Created -// LF 08/06/1999 Changed static const short NodeType to enum -// Added "friend NamedNodeMap"; to NodeListDefinition -// - -#ifndef MITRE_DOM -#define MITRE_DOM - -#ifdef __BORLANDC__ -#include -#endif - -#include "String.h" -#include "baseutils.h" -#ifndef NULL -typedef 0 NULL; -#endif - - -typedef String DOMString; -typedef UNICODE_CHAR DOM_CHAR; - -class NodeList; -class NamedNodeMap; -class Document; -class Element; -class Attr; -class Text; -class Comment; -class CDATASection; -class ProcessingInstruction; -class EntityReference; -class DocumentType; - -// -//Definition and Implementation the DOMImplementation class -// -class DOMImplementation -{ - public: - DOMImplementation(); - ~DOMImplementation(); - - MBool hasFeature(DOMString feature, const DOMString& version) const; - - private: - DOMString implFeature; - DOMString implVersion; -}; - -// -// Abstract Class defining the interface for a Node. See NodeDefinition below -// for the actual implementation of the WC3 node. -// -class Node -{ - public: - //Node type constants - //-- LF - changed to enum - enum NodeType { - ELEMENT_NODE = 1, - ATTRIBUTE_NODE, - TEXT_NODE, - CDATA_SECTION_NODE, - ENTITY_REFERENCE_NODE, - ENTITY_NODE, - PROCESSING_INSTRUCTION_NODE, - COMMENT_NODE, - DOCUMENT_NODE, - DOCUMENT_TYPE_NODE, - DOCUMENT_FRAGMENT_NODE, - NOTATION_NODE - }; - - virtual ~Node() {} - - //Read functions - virtual const DOMString& getNodeName() const = 0; - virtual const DOMString& getNodeValue() const = 0; - virtual const DOMString& getNodeValue() = 0; - virtual unsigned short getNodeType() const = 0; - virtual Node* getParentNode() const = 0; - virtual NodeList* getChildNodes() = 0; - virtual Node* getFirstChild() const = 0; - virtual Node* getLastChild() const = 0; - virtual Node* getPreviousSibling() const = 0; - virtual Node* getNextSibling() const = 0; - virtual NamedNodeMap* getAttributes() = 0; - virtual Document* getOwnerDocument() const = 0; - - //Write functions - virtual void setNodeValue(const DOMString& nodeValue) = 0; - - //Node manipulation functions - virtual Node* insertBefore(Node* newChild, Node* refChild) = 0; - virtual Node* replaceChild(Node* newChild, Node* oldChild) = 0; - virtual Node* removeChild(Node* oldChild) = 0; - virtual Node* appendChild(Node* newChild) = 0; - virtual Node* cloneNode(MBool deep, Node* dest) = 0; - - virtual MBool hasChildNodes() const = 0; -}; - -// -// Abstract class containing the Interface for a NodeList. See NodeDefinition -// below for the actual implementation of a WC3 NodeList as it applies to the -// getChildNodes Node function. Also see NodeListDefinition for the -// implementation of a NodeList as it applies to such functions as -// getElementByTagName. -// -class NodeList -{ - public: - virtual Node* item(Int32 index) = 0; - virtual Int32 getLength() = 0; - protected: - Int32 length; -}; - -// -//Definition of the implementation of a NodeList. This class maintains a -//linked list of pointers to Nodes. "Friends" of the class can add and remove -//pointers to Nodes as needed. -// *** NOTE: Is there any need for someone to "remove" a node from the -// list? -// -class NodeListDefinition : public NodeList -{ - friend NamedNodeMap; //-- LF - public: - NodeListDefinition(); - ~NodeListDefinition(); - - void append(Node& newNode); - void append(Node* newNode); - - //Inherited from NodeList - Node* item(Int32 index); - Int32 getLength(); - - protected: - struct ListItem { - ListItem* next; - ListItem* prev; - Node* node; - }; - - ListItem* firstItem; - ListItem* lastItem; -}; - -// -//Definition of a NamedNodeMap. For the time being it builds off the -//NodeListDefinition class. This will probably change when NamedNodeMap needs -//to move to a more efficient search algorithm for attributes. -// -class NamedNodeMap : public NodeListDefinition -{ - public: - NamedNodeMap(); - ~NamedNodeMap(); - - Node* getNamedItem(const DOMString& name); - Node* setNamedItem(Node* arg); - Node* removeNamedItem(const DOMString& name); - - private: - NodeListDefinition::ListItem* findListItemByName(const DOMString& name); -}; - -// -// Definition and Implementation of Node and NodeList functionality. This is -// the central class, from which all other DOM classes (objects) are derrived. -// Users of this DOM should work strictly with the Node interface and NodeList -// interface (see above for those definitions) -// -class NodeDefinition : public Node, public NodeList -{ - public: - NodeDefinition(NodeType type, const DOMString& name, - const DOMString& value, Document* owner); - virtual ~NodeDefinition(); //Destructor, delete all children of node - - //Read functions - const DOMString& getNodeName() const; - virtual const DOMString& getNodeValue() const; - virtual const DOMString& getNodeValue(); - unsigned short getNodeType() const; - Node* getParentNode() const; - NodeList* getChildNodes(); - Node* getFirstChild() const; - Node* getLastChild() const; - Node* getPreviousSibling() const; - Node* getNextSibling() const; - NamedNodeMap* getAttributes(); - Document* getOwnerDocument() const; - - //Write functions - virtual void setNodeValue(const DOMString& nodeValue); - - //Child node manipulation functions - virtual Node* insertBefore(Node* newChild, Node* refChild); - virtual Node* replaceChild(Node* newChild, Node* oldChild); - virtual Node* removeChild(Node* oldChild); - virtual Node* appendChild(Node* newChild); - Node* cloneNode(MBool deep, Node* dest); - - MBool hasChildNodes() const; - - //Inherrited from NodeList - Node* item(Int32 index); - Int32 getLength(); - - protected: - //Name, value, and attributes for this node. Available to derrived - //classes, since those derrived classes have a better idea how to use them, - //than the generic node does. - DOMString nodeName; - DOMString nodeValue; - NamedNodeMap attributes; - - void DeleteChildren(); - - Node* implInsertBefore(NodeDefinition* newChild, NodeDefinition* refChild); - private: - //Type of node this is - NodeType nodeType; - - //Data members for linking this Node to its parent and siblings - NodeDefinition* parentNode; - NodeDefinition* previousSibling; - NodeDefinition* nextSibling; - - //Pointer to the node's document - Document* ownerDocument; - - //Data members for maintaining a list of child nodes - NodeDefinition* firstChild; - NodeDefinition* lastChild; - -}; - -// -//Definition and Implementation of a Document Fragment. All functionality is -//inherrited directly from NodeDefinition. We just need to make sure the Type -//of the node set to Node::DOCUMENT_FRAGMENT_NODE. -// -class DocumentFragment : public NodeDefinition -{ - public: - DocumentFragment(const DOMString& name, const DOMString& value, Document* owner); - - //Override insertBefore to limit Elements to having only certain nodes as - //children - Node* insertBefore(Node* newChild, Node* refChild); -}; - -// -//Definition and Implementation of a Document. -// -class Document : public NodeDefinition -{ - public: - Document(DocumentType* theDoctype = NULL); - - Element* getDocumentElement(); - DocumentType* getDoctype(); - const DOMImplementation& getImplementation(); - - //Factory functions for various node types - DocumentFragment* createDocumentFragment(); - Element* createElement(const DOMString& tagName); - Attr* createAttribute(const DOMString& name); - Text* createTextNode(const DOMString& theData); - Comment* createComment(const DOMString& theData); - CDATASection* createCDATASection(const DOMString& theData); - ProcessingInstruction* createProcessingInstruction(const DOMString& target, - const DOMString& data); - EntityReference* createEntityReference(const DOMString& name); - - //Override functions to enforce the One Element rule for documents, as well - //as limit documents to certain types of nodes. - Node* insertBefore(Node* newChild, Node* refChild); - Node* replaceChild(Node* newChild, Node* oldChild); - Node* removeChild(Node* oldChild); - - private: - Element* documentElement; - DocumentType* doctype; - DOMImplementation implementation; -}; - -// -//Definition and Implementation of an Element -// -class Element : public NodeDefinition -{ - public: - Element(const DOMString& tagName, Document* owner); - - //Override insertBefore to limit Elements to having only certain nodes as - //children - Node* insertBefore(Node* newChild, Node* refChild); - - const DOMString& getTagName(); - const DOMString& getAttribute(const DOMString& name); - void setAttribute(const DOMString& name, const DOMString& value); - void removeAttribute(const DOMString& name); - Attr* getAttributeNode(const DOMString& name); - Attr* setAttributeNode(Attr* newAttr); - Attr* removeAttributeNode(Attr* oldAttr); - NodeList* getElementsByTagName(const DOMString& name); - void normalize(); -}; - -// -//Definition and Implementation of a Attr -// NOTE: For the time bing use just the default functionality found in the -// NodeDefinition class -// -class Attr : public NodeDefinition -{ - public: - Attr(const DOMString& name, Document* owner); - - const DOMString& getName() const; - MBool getSpecified() const; - const DOMString& getValue(); - void setValue(const DOMString& newValue); - - //Override the set and get member functions for a node's value to create a - //new TEXT node when set, and to interpret its children when read. - void setNodeValue(const DOMString& nodeValue); - const DOMString& getNodeValue(); - - //Override insertBefore to limit Attr to having only certain nodes as - //children - Node* insertBefore(Node* newChild, Node* refChild); - - private: - MBool specified; -}; - -// -//Definition and Implementation of CharacterData. This class mearly provides -//the interface and some default implementation. It is not intended to be -//instantiated by users of the DOM -// -class CharacterData : public NodeDefinition -{ - public: - const DOMString& getData() const; - void setData(const DOMString& source); - Int32 getLength() const; - - DOMString& substringData(Int32 offset, Int32 count, DOMString& dest); - void appendData(const DOMString& arg); - void insertData(Int32 offset, const DOMString& arg); - void deleteData(Int32 offset, Int32 count); - void replaceData(Int32 offset, Int32 count, const DOMString& arg); - - protected: - CharacterData(NodeType type, const DOMString& name, - const DOMString& value, Document* owner); -}; - -// -//Definition and Implementation of a Text node. The bulk of the functionality -//comes from CharacterData and NodeDefinition. -// -class Text : public CharacterData -{ - public: - Text(const DOMString& theData, Document* owner); - - Text* splitText(Int32 offset); - - //Override "child manipulation" function since Text Nodes can not have - //any children. - Node* insertBefore(Node* newChild, Node* refChild); - Node* replaceChild(Node* newChild, Node* oldChild); - Node* removeChild(Node* oldChild); - Node* appendChild(Node* newChild); - - protected: - Text(NodeType type, const DOMString& name, const DOMString& value, - Document* owner); -}; - -// -//Definition and Implementation of a Comment node. All of the functionality is -//inherrited from CharacterData and NodeDefinition. -// -class Comment : public CharacterData -{ - public: - Comment(const DOMString& theData, Document* owner); - - //Override "child manipulation" function since Comment Nodes can not have - //any children. - Node* insertBefore(Node* newChild, Node* refChild); - Node* replaceChild(Node* newChild, Node* oldChild); - Node* removeChild(Node* oldChild); - Node* appendChild(Node* newChild); -}; - -// -//Definition and Implementation of a CDATASection node. All of the -//functionality is inherrited from Text, CharacterData, and NodeDefinition -// -class CDATASection : public Text -{ - public: - CDATASection(const DOMString& theData, Document* owner); - - //Override "child manipulation" function since CDATASection Nodes can not - //have any children. - Node* insertBefore(Node* newChild, Node* refChild); - Node* replaceChild(Node* newChild, Node* oldChild); - Node* removeChild(Node* oldChild); - Node* appendChild(Node* newChild); -}; - -// -//Definition and Implemention of a ProcessingInstruction node. Most -//functionality is inherrited from NodeDefinition. -// The Target of a processing instruction is stored in the nodeName datamember -// inherrited from NodeDefinition. -// The Data of a processing instruction is stored in the nodeValue datamember -// inherrited from NodeDefinition -// -class ProcessingInstruction : public NodeDefinition -{ - public: - ProcessingInstruction(const DOMString& theTarget, const DOMString& theData, - Document* owner); - - const DOMString& getTarget() const; - const DOMString& getData() const; - - void setData(const DOMString& theData); - - //Override "child manipulation" function since ProcessingInstruction Nodes - //can not have any children. - Node* insertBefore(Node* newChild, Node* refChild); - Node* replaceChild(Node* newChild, Node* oldChild); - Node* removeChild(Node* oldChild); - Node* appendChild(Node* newChild); -}; - -// -//Definition and Implementation of a Notation. Most functionality is inherrited -//from NodeDefinition. -// -class Notation : public NodeDefinition -{ - public: - Notation(const DOMString& name, const DOMString& pubID, - const DOMString& sysID); - - const DOMString& getPublicId() const; - const DOMString& getSystemId() const; - - //Override "child manipulation" function since Notation Nodes - //can not have any children. - Node* insertBefore(Node* newChild, Node* refChild); - Node* replaceChild(Node* newChild, Node* oldChild); - Node* removeChild(Node* oldChild); - Node* appendChild(Node* newChild); - - private: - DOMString publicId; - DOMString systemId; -}; - -// -//Definition and Implementation of an Entity -// -class Entity : public NodeDefinition -{ - public: - Entity(const DOMString& name, const DOMString& pubID, - const DOMString& sysID, const DOMString& notName); - - const DOMString& getPublicId() const; - const DOMString& getSystemId() const; - const DOMString& getNotationName() const; - - //Override insertBefore to limit Entity to having only certain nodes as - //children - Node* insertBefore(Node* newChild, Node* refChild); - - private: - DOMString publicId; - DOMString systemId; - DOMString notationName; -}; - -// -//Definition and Implementation of an EntityReference -// -class EntityReference : public NodeDefinition -{ - public: - EntityReference(const DOMString& name, Document* owner); - - //Override insertBefore to limit EntityReference to having only certain - //nodes as children - Node* insertBefore(Node* newChild, Node* refChild); -}; - -// -//Definition and Implementation of the DocumentType -// -class DocumentType : public NodeDefinition -{ - public: - DocumentType(const DOMString& name, NamedNodeMap* theEntities, - NamedNodeMap* theNotations); - ~DocumentType(); - - NamedNodeMap* getEntities(); - NamedNodeMap* getNotations(); - - //Override "child manipulation" function since Notation Nodes - //can not have any children. - Node* insertBefore(Node* newChild, Node* refChild); - Node* replaceChild(Node* newChild, Node* oldChild); - Node* removeChild(Node* oldChild); - Node* appendChild(Node* newChild); - - private: - NamedNodeMap* entities; - NamedNodeMap* notations; -}; - -//NULL string for use by Element::getAttribute() for when the attribute -//spcified by "name" does not exist, and therefore shoud be "NULL". -const DOMString NULL_STRING; - -#endif +/* + + * (C) Copyright The MITRE Corporation 1999 All rights reserved. + + * + + * The contents of this file are subject to the Mozilla Public License + + * Version 1.0 (the "License"); you may not use this file except in + + * compliance with the License. You may obtain a copy of the License at + + * http://www.mozilla.org/MPL/ + + * + + * The program provided "as is" without any warranty express or + + * implied, including the warranty of non-infringement and the implied + + * warranties of merchantibility and fitness for a particular purpose. + + * The Copyright owner will not be liable for any damages suffered by + + * you as a result of using the Program. In no event will the Copyright + + * owner be liable for any special, indirect or consequential damages or + + * lost profits even if the Copyright owner has been advised of the + + * possibility of their occurrence. + + * + + * Please see release.txt distributed with this file for more information. + + * + + */ + +// Tom Kneeland (3/29/99) + +// + +// Implementation of the Document Object Model Level 1 Core + +// + +// Modification History: + +// Who When What + +// TK 03/29/99 Created + +// LF 08/06/1999 Changed static const short NodeType to enum + +// Added "friend NamedNodeMap"; to NodeListDefinition + +// + + + +#ifndef MITRE_DOM + +#define MITRE_DOM + + + +#ifdef __BORLANDC__ + +#include + +#endif + + + +#include "TxString.h" + +#include "baseutils.h" + +#ifndef NULL + +typedef 0 NULL; + +#endif + + + + + +typedef String DOMString; + +typedef UNICODE_CHAR DOM_CHAR; + + + +class NodeList; + +class NamedNodeMap; + +class Document; + +class Element; + +class Attr; + +class Text; + +class Comment; + +class CDATASection; + +class ProcessingInstruction; + +class EntityReference; + +class DocumentType; + + + +// + +//Definition and Implementation the DOMImplementation class + +// + +class DOMImplementation + +{ + + public: + + DOMImplementation(); + + ~DOMImplementation(); + + + + MBool hasFeature(DOMString feature, const DOMString& version) const; + + + + private: + + DOMString implFeature; + + DOMString implVersion; + +}; + + + +// + +// Abstract Class defining the interface for a Node. See NodeDefinition below + +// for the actual implementation of the WC3 node. + +// + +class Node + +{ + + public: + + //Node type constants + + //-- LF - changed to enum + + enum NodeType { + + ELEMENT_NODE = 1, + + ATTRIBUTE_NODE, + + TEXT_NODE, + + CDATA_SECTION_NODE, + + ENTITY_REFERENCE_NODE, + + ENTITY_NODE, + + PROCESSING_INSTRUCTION_NODE, + + COMMENT_NODE, + + DOCUMENT_NODE, + + DOCUMENT_TYPE_NODE, + + DOCUMENT_FRAGMENT_NODE, + + NOTATION_NODE + + }; + + + + virtual ~Node() {} + + + + //Read functions + + virtual const DOMString& getNodeName() const = 0; + + virtual const DOMString& getNodeValue() const = 0; + + virtual const DOMString& getNodeValue() = 0; + + virtual unsigned short getNodeType() const = 0; + + virtual Node* getParentNode() const = 0; + + virtual NodeList* getChildNodes() = 0; + + virtual Node* getFirstChild() const = 0; + + virtual Node* getLastChild() const = 0; + + virtual Node* getPreviousSibling() const = 0; + + virtual Node* getNextSibling() const = 0; + + virtual NamedNodeMap* getAttributes() = 0; + + virtual Document* getOwnerDocument() const = 0; + + + + //Write functions + + virtual void setNodeValue(const DOMString& nodeValue) = 0; + + + + //Node manipulation functions + + virtual Node* insertBefore(Node* newChild, Node* refChild) = 0; + + virtual Node* replaceChild(Node* newChild, Node* oldChild) = 0; + + virtual Node* removeChild(Node* oldChild) = 0; + + virtual Node* appendChild(Node* newChild) = 0; + + virtual Node* cloneNode(MBool deep, Node* dest) = 0; + + + + virtual MBool hasChildNodes() const = 0; + +}; + + + +// + +// Abstract class containing the Interface for a NodeList. See NodeDefinition + +// below for the actual implementation of a WC3 NodeList as it applies to the + +// getChildNodes Node function. Also see NodeListDefinition for the + +// implementation of a NodeList as it applies to such functions as + +// getElementByTagName. + +// + +class NodeList + +{ + + public: + + virtual Node* item(Int32 index) = 0; + + virtual Int32 getLength() = 0; + + protected: + + Int32 length; + +}; + + + +// + +//Definition of the implementation of a NodeList. This class maintains a + +//linked list of pointers to Nodes. "Friends" of the class can add and remove + +//pointers to Nodes as needed. + +// *** NOTE: Is there any need for someone to "remove" a node from the + +// list? + +// + +class NodeListDefinition : public NodeList + +{ + + friend NamedNodeMap; //-- LF + + public: + + NodeListDefinition(); + + ~NodeListDefinition(); + + + + void append(Node& newNode); + + void append(Node* newNode); + + + + //Inherited from NodeList + + Node* item(Int32 index); + + Int32 getLength(); + + + + protected: + + struct ListItem { + + ListItem* next; + + ListItem* prev; + + Node* node; + + }; + + + + ListItem* firstItem; + + ListItem* lastItem; + +}; + + + +// + +//Definition of a NamedNodeMap. For the time being it builds off the + +//NodeListDefinition class. This will probably change when NamedNodeMap needs + +//to move to a more efficient search algorithm for attributes. + +// + +class NamedNodeMap : public NodeListDefinition + +{ + + public: + + NamedNodeMap(); + + ~NamedNodeMap(); + + + + Node* getNamedItem(const DOMString& name); + + Node* setNamedItem(Node* arg); + + Node* removeNamedItem(const DOMString& name); + + + + private: + + NodeListDefinition::ListItem* findListItemByName(const DOMString& name); + +}; + + + +// + +// Definition and Implementation of Node and NodeList functionality. This is + +// the central class, from which all other DOM classes (objects) are derrived. + +// Users of this DOM should work strictly with the Node interface and NodeList + +// interface (see above for those definitions) + +// + +class NodeDefinition : public Node, public NodeList + +{ + + public: + + NodeDefinition(NodeType type, const DOMString& name, + + const DOMString& value, Document* owner); + + virtual ~NodeDefinition(); //Destructor, delete all children of node + + + + //Read functions + + const DOMString& getNodeName() const; + + virtual const DOMString& getNodeValue() const; + + virtual const DOMString& getNodeValue(); + + unsigned short getNodeType() const; + + Node* getParentNode() const; + + NodeList* getChildNodes(); + + Node* getFirstChild() const; + + Node* getLastChild() const; + + Node* getPreviousSibling() const; + + Node* getNextSibling() const; + + NamedNodeMap* getAttributes(); + + Document* getOwnerDocument() const; + + + + //Write functions + + virtual void setNodeValue(const DOMString& nodeValue); + + + + //Child node manipulation functions + + virtual Node* insertBefore(Node* newChild, Node* refChild); + + virtual Node* replaceChild(Node* newChild, Node* oldChild); + + virtual Node* removeChild(Node* oldChild); + + virtual Node* appendChild(Node* newChild); + + Node* cloneNode(MBool deep, Node* dest); + + + + MBool hasChildNodes() const; + + + + //Inherrited from NodeList + + Node* item(Int32 index); + + Int32 getLength(); + + + + protected: + + //Name, value, and attributes for this node. Available to derrived + + //classes, since those derrived classes have a better idea how to use them, + + //than the generic node does. + + DOMString nodeName; + + DOMString nodeValue; + + NamedNodeMap attributes; + + + + void DeleteChildren(); + + + + Node* implInsertBefore(NodeDefinition* newChild, NodeDefinition* refChild); + + private: + + //Type of node this is + + NodeType nodeType; + + + + //Data members for linking this Node to its parent and siblings + + NodeDefinition* parentNode; + + NodeDefinition* previousSibling; + + NodeDefinition* nextSibling; + + + + //Pointer to the node's document + + Document* ownerDocument; + + + + //Data members for maintaining a list of child nodes + + NodeDefinition* firstChild; + + NodeDefinition* lastChild; + + + +}; + + + +// + +//Definition and Implementation of a Document Fragment. All functionality is + +//inherrited directly from NodeDefinition. We just need to make sure the Type + +//of the node set to Node::DOCUMENT_FRAGMENT_NODE. + +// + +class DocumentFragment : public NodeDefinition + +{ + + public: + + DocumentFragment(const DOMString& name, const DOMString& value, Document* owner); + + + + //Override insertBefore to limit Elements to having only certain nodes as + + //children + + Node* insertBefore(Node* newChild, Node* refChild); + +}; + + + +// + +//Definition and Implementation of a Document. + +// + +class Document : public NodeDefinition + +{ + + public: + + Document(DocumentType* theDoctype = NULL); + + + + Element* getDocumentElement(); + + DocumentType* getDoctype(); + + const DOMImplementation& getImplementation(); + + + + //Factory functions for various node types + + DocumentFragment* createDocumentFragment(); + + Element* createElement(const DOMString& tagName); + + Attr* createAttribute(const DOMString& name); + + Text* createTextNode(const DOMString& theData); + + Comment* createComment(const DOMString& theData); + + CDATASection* createCDATASection(const DOMString& theData); + + ProcessingInstruction* createProcessingInstruction(const DOMString& target, + + const DOMString& data); + + EntityReference* createEntityReference(const DOMString& name); + + + + //Override functions to enforce the One Element rule for documents, as well + + //as limit documents to certain types of nodes. + + Node* insertBefore(Node* newChild, Node* refChild); + + Node* replaceChild(Node* newChild, Node* oldChild); + + Node* removeChild(Node* oldChild); + + + + private: + + Element* documentElement; + + DocumentType* doctype; + + DOMImplementation implementation; + +}; + + + +// + +//Definition and Implementation of an Element + +// + +class Element : public NodeDefinition + +{ + + public: + + Element(const DOMString& tagName, Document* owner); + + + + //Override insertBefore to limit Elements to having only certain nodes as + + //children + + Node* insertBefore(Node* newChild, Node* refChild); + + + + const DOMString& getTagName(); + + const DOMString& getAttribute(const DOMString& name); + + void setAttribute(const DOMString& name, const DOMString& value); + + void removeAttribute(const DOMString& name); + + Attr* getAttributeNode(const DOMString& name); + + Attr* setAttributeNode(Attr* newAttr); + + Attr* removeAttributeNode(Attr* oldAttr); + + NodeList* getElementsByTagName(const DOMString& name); + + void normalize(); + +}; + + + +// + +//Definition and Implementation of a Attr + +// NOTE: For the time bing use just the default functionality found in the + +// NodeDefinition class + +// + +class Attr : public NodeDefinition + +{ + + public: + + Attr(const DOMString& name, Document* owner); + + + + const DOMString& getName() const; + + MBool getSpecified() const; + + const DOMString& getValue(); + + void setValue(const DOMString& newValue); + + + + //Override the set and get member functions for a node's value to create a + + //new TEXT node when set, and to interpret its children when read. + + void setNodeValue(const DOMString& nodeValue); + + const DOMString& getNodeValue(); + + + + //Override insertBefore to limit Attr to having only certain nodes as + + //children + + Node* insertBefore(Node* newChild, Node* refChild); + + + + private: + + MBool specified; + +}; + + + +// + +//Definition and Implementation of CharacterData. This class mearly provides + +//the interface and some default implementation. It is not intended to be + +//instantiated by users of the DOM + +// + +class CharacterData : public NodeDefinition + +{ + + public: + + const DOMString& getData() const; + + void setData(const DOMString& source); + + Int32 getLength() const; + + + + DOMString& substringData(Int32 offset, Int32 count, DOMString& dest); + + void appendData(const DOMString& arg); + + void insertData(Int32 offset, const DOMString& arg); + + void deleteData(Int32 offset, Int32 count); + + void replaceData(Int32 offset, Int32 count, const DOMString& arg); + + + + protected: + + CharacterData(NodeType type, const DOMString& name, + + const DOMString& value, Document* owner); + +}; + + + +// + +//Definition and Implementation of a Text node. The bulk of the functionality + +//comes from CharacterData and NodeDefinition. + +// + +class Text : public CharacterData + +{ + + public: + + Text(const DOMString& theData, Document* owner); + + + + Text* splitText(Int32 offset); + + + + //Override "child manipulation" function since Text Nodes can not have + + //any children. + + Node* insertBefore(Node* newChild, Node* refChild); + + Node* replaceChild(Node* newChild, Node* oldChild); + + Node* removeChild(Node* oldChild); + + Node* appendChild(Node* newChild); + + + + protected: + + Text(NodeType type, const DOMString& name, const DOMString& value, + + Document* owner); + +}; + + + +// + +//Definition and Implementation of a Comment node. All of the functionality is + +//inherrited from CharacterData and NodeDefinition. + +// + +class Comment : public CharacterData + +{ + + public: + + Comment(const DOMString& theData, Document* owner); + + + + //Override "child manipulation" function since Comment Nodes can not have + + //any children. + + Node* insertBefore(Node* newChild, Node* refChild); + + Node* replaceChild(Node* newChild, Node* oldChild); + + Node* removeChild(Node* oldChild); + + Node* appendChild(Node* newChild); + +}; + + + +// + +//Definition and Implementation of a CDATASection node. All of the + +//functionality is inherrited from Text, CharacterData, and NodeDefinition + +// + +class CDATASection : public Text + +{ + + public: + + CDATASection(const DOMString& theData, Document* owner); + + + + //Override "child manipulation" function since CDATASection Nodes can not + + //have any children. + + Node* insertBefore(Node* newChild, Node* refChild); + + Node* replaceChild(Node* newChild, Node* oldChild); + + Node* removeChild(Node* oldChild); + + Node* appendChild(Node* newChild); + +}; + + + +// + +//Definition and Implemention of a ProcessingInstruction node. Most + +//functionality is inherrited from NodeDefinition. + +// The Target of a processing instruction is stored in the nodeName datamember + +// inherrited from NodeDefinition. + +// The Data of a processing instruction is stored in the nodeValue datamember + +// inherrited from NodeDefinition + +// + +class ProcessingInstruction : public NodeDefinition + +{ + + public: + + ProcessingInstruction(const DOMString& theTarget, const DOMString& theData, + + Document* owner); + + + + const DOMString& getTarget() const; + + const DOMString& getData() const; + + + + void setData(const DOMString& theData); + + + + //Override "child manipulation" function since ProcessingInstruction Nodes + + //can not have any children. + + Node* insertBefore(Node* newChild, Node* refChild); + + Node* replaceChild(Node* newChild, Node* oldChild); + + Node* removeChild(Node* oldChild); + + Node* appendChild(Node* newChild); + +}; + + + +// + +//Definition and Implementation of a Notation. Most functionality is inherrited + +//from NodeDefinition. + +// + +class Notation : public NodeDefinition + +{ + + public: + + Notation(const DOMString& name, const DOMString& pubID, + + const DOMString& sysID); + + + + const DOMString& getPublicId() const; + + const DOMString& getSystemId() const; + + + + //Override "child manipulation" function since Notation Nodes + + //can not have any children. + + Node* insertBefore(Node* newChild, Node* refChild); + + Node* replaceChild(Node* newChild, Node* oldChild); + + Node* removeChild(Node* oldChild); + + Node* appendChild(Node* newChild); + + + + private: + + DOMString publicId; + + DOMString systemId; + +}; + + + +// + +//Definition and Implementation of an Entity + +// + +class Entity : public NodeDefinition + +{ + + public: + + Entity(const DOMString& name, const DOMString& pubID, + + const DOMString& sysID, const DOMString& notName); + + + + const DOMString& getPublicId() const; + + const DOMString& getSystemId() const; + + const DOMString& getNotationName() const; + + + + //Override insertBefore to limit Entity to having only certain nodes as + + //children + + Node* insertBefore(Node* newChild, Node* refChild); + + + + private: + + DOMString publicId; + + DOMString systemId; + + DOMString notationName; + +}; + + + +// + +//Definition and Implementation of an EntityReference + +// + +class EntityReference : public NodeDefinition + +{ + + public: + + EntityReference(const DOMString& name, Document* owner); + + + + //Override insertBefore to limit EntityReference to having only certain + + //nodes as children + + Node* insertBefore(Node* newChild, Node* refChild); + +}; + + + +// + +//Definition and Implementation of the DocumentType + +// + +class DocumentType : public NodeDefinition + +{ + + public: + + DocumentType(const DOMString& name, NamedNodeMap* theEntities, + + NamedNodeMap* theNotations); + + ~DocumentType(); + + + + NamedNodeMap* getEntities(); + + NamedNodeMap* getNotations(); + + + + //Override "child manipulation" function since Notation Nodes + + //can not have any children. + + Node* insertBefore(Node* newChild, Node* refChild); + + Node* replaceChild(Node* newChild, Node* oldChild); + + Node* removeChild(Node* oldChild); + + Node* appendChild(Node* newChild); + + + + private: + + NamedNodeMap* entities; + + NamedNodeMap* notations; + +}; + + + +//NULL string for use by Element::getAttribute() for when the attribute + +//spcified by "name" does not exist, and therefore shoud be "NULL". + +const DOMString NULL_STRING; + + + +#endif + diff --git a/mozilla/extensions/transformiix/source/xml/dom/makefile.win b/mozilla/extensions/transformiix/source/xml/dom/makefile.win index ddbc8850f2e..5d58efe7020 100644 --- a/mozilla/extensions/transformiix/source/xml/dom/makefile.win +++ b/mozilla/extensions/transformiix/source/xml/dom/makefile.win @@ -19,7 +19,7 @@ # # Contributor(s): -DEPTH=..\..\..\..\..\.. +DEPTH=..\..\..\..\.. DIRS=mozImpl diff --git a/mozilla/extensions/transformiix/source/xml/dom/mozImpl/makefile.win b/mozilla/extensions/transformiix/source/xml/dom/mozImpl/makefile.win index 32eb22078c5..e2a9687f04d 100644 --- a/mozilla/extensions/transformiix/source/xml/dom/mozImpl/makefile.win +++ b/mozilla/extensions/transformiix/source/xml/dom/mozImpl/makefile.win @@ -19,50 +19,50 @@ # # Contributor(s): -DEPTH=..\..\..\..\..\..\.. +DEPTH=..\..\..\..\..\.. LIBRARY_NAME=transformix_xml_dom_mozImpl MODULE=transformix REQUIRES=xpcom raptor CPPSRCS= \ - Attr.cpp \ - CDATASection.cpp \ - CharacterData.cpp \ - Comment.cpp \ - Document.cpp \ - DocumentFragment.cpp \ - DocumentType.cpp \ - DOMImplementation.cpp \ - Element.cpp \ - Entity.cpp \ - EntityReference.cpp \ - NamedNodeMap.cpp \ - NodeDefinition.cpp \ - NodeListDefinition.cpp \ - Notation.cpp \ - ProcessingInstruction.cpp \ - Text.cpp \ + MozillaAttr.cpp \ + MozillaCDATASection.cpp \ + MozillaCharacterData.cpp \ + MozillaComment.cpp \ + MozillaDocument.cpp \ + MozillaDocumentFragment.cpp \ + MozillaDocumentType.cpp \ + MozillaDOMImplementation.cpp \ + MozillaElement.cpp \ + MozillaEntity.cpp \ + MozillaEntityReference.cpp \ + MozillaNamedNodeMap.cpp \ + MozillaNode.cpp \ + MozillaNodeList.cpp \ + MozillaNotation.cpp \ + MozillaProcInstruction.cpp \ + MozillaText.cpp \ $(NULL) CPP_OBJS= \ - .\$(OBJDIR)\Attr.obj \ - .\$(OBJDIR)\CDATASection.obj \ - .\$(OBJDIR)\CharacterData.obj \ - .\$(OBJDIR)\Comment.obj \ - .\$(OBJDIR)\Document.obj \ - .\$(OBJDIR)\DocumentFragment.obj \ - .\$(OBJDIR)\DocumentType.obj \ - .\$(OBJDIR)\DOMImplementation.obj \ - .\$(OBJDIR)\Element.obj \ - .\$(OBJDIR)\Entity.obj \ - .\$(OBJDIR)\EntityReference.obj \ - .\$(OBJDIR)\NamedNodeMap.obj \ - .\$(OBJDIR)\NodeDefinition.obj \ - .\$(OBJDIR)\NodeListDefinition.obj \ - .\$(OBJDIR)\Notation.obj \ - .\$(OBJDIR)\ProcessingInstruction.obj \ - .\$(OBJDIR)\Text.obj \ + .\$(OBJDIR)\MozillaAttr.obj \ + .\$(OBJDIR)\MozillaCDATASection.obj \ + .\$(OBJDIR)\MozillaCharacterData.obj \ + .\$(OBJDIR)\MozillaComment.obj \ + .\$(OBJDIR)\MozillaDocument.obj \ + .\$(OBJDIR)\MozillaDocumentFragment.obj \ + .\$(OBJDIR)\MozillaDocumentType.obj \ + .\$(OBJDIR)\MozillaDOMImplementation.obj \ + .\$(OBJDIR)\MozillaElement.obj \ + .\$(OBJDIR)\MozillaEntity.obj \ + .\$(OBJDIR)\MozillaEntityReference.obj \ + .\$(OBJDIR)\MozillaNamedNodeMap.obj \ + .\$(OBJDIR)\MozillaNode.obj \ + .\$(OBJDIR)\MozillaNodeList.obj \ + .\$(OBJDIR)\MozillaNotation.obj \ + .\$(OBJDIR)\MozillaProcInstruction.obj \ + .\$(OBJDIR)\MozillaText.obj \ $(NULL) EXPORTS = \ diff --git a/mozilla/extensions/transformiix/source/xml/dom/mozImpl/mozilladom.h b/mozilla/extensions/transformiix/source/xml/dom/mozImpl/mozilladom.h index 403a8859288..263f1ebf402 100644 --- a/mozilla/extensions/transformiix/source/xml/dom/mozImpl/mozilladom.h +++ b/mozilla/extensions/transformiix/source/xml/dom/mozImpl/mozilladom.h @@ -1,4 +1,5 @@ -/* +/* + * (C) Copyright The MITRE Corporation 1999 All rights reserved. * * The contents of this file are subject to the Mozilla Public License @@ -43,13 +44,13 @@ // TK 02/11/2000 Added a default constructor for the Document class. Simply // create an nsXMLDocument object is one is not provided. -#ifndef MOZILLA_MITRE_DOM -#define MOZILLA_MITRE_DOM - +#ifndef MOZILLA_MITRE_DOM +#define MOZILLA_MITRE_DOM + #ifdef __BORLANDC__ #include #endif - + #include "MozillaString.h" #include "baseutils.h" #include "HashTable.h" @@ -72,7 +73,7 @@ #include "nsIDOMEntity.h" #include "nsIDOMNamedNodeMap.h" #include "nsIDOMCharacterData.h" - + #ifndef NULL typedef 0 NULL; #endif diff --git a/mozilla/extensions/transformiix/source/xml/makefile.win b/mozilla/extensions/transformiix/source/xml/makefile.win index f7e34487507..5bbad6f8f78 100644 --- a/mozilla/extensions/transformiix/source/xml/makefile.win +++ b/mozilla/extensions/transformiix/source/xml/makefile.win @@ -19,7 +19,7 @@ # # Contributor(s): -DEPTH=..\..\..\..\.. +DEPTH=..\..\..\.. DIRS=dom diff --git a/mozilla/extensions/transformiix/source/xml/printer/printers.h b/mozilla/extensions/transformiix/source/xml/printer/printers.h index dbe99cda2e0..219c38df0dd 100755 --- a/mozilla/extensions/transformiix/source/xml/printer/printers.h +++ b/mozilla/extensions/transformiix/source/xml/printer/printers.h @@ -23,12 +23,12 @@ * Bob Miller, kbob@oblix.com * -- plugged core leak. * - * $Id: printers.h,v 1.3 1999-11-25 03:03:05 kvisco%ziplink.net Exp $ + * $Id: printers.h,v 1.4 2000-04-12 22:32:13 nisheeth%netscape.com Exp $ */ #include "dom.h" -#include "String.h" +#include "TxString.h" #include "baseutils.h" #include "NamedMap.h" #include @@ -41,7 +41,7 @@ * A class for printing XML nodes. * This class was ported from XSL:P Java source * @author Keith Visco - * @version $Revision: 1.3 $ $Date: 1999-11-25 03:03:05 $ + * @version $Revision: 1.4 $ $Date: 2000-04-12 22:32:13 $ **/ class XMLPrinter { @@ -244,7 +244,7 @@ private: * A class for printing an XML node as non-well-formed HTML * This class was ported from XSL:P Java source * @author Keith Visco (kvisco@ziplink.net) - * @version $Revision: 1.3 $ $Date: 1999-11-25 03:03:05 $ + * @version $Revision: 1.4 $ $Date: 2000-04-12 22:32:13 $ **/ class HTMLPrinter : public XMLPrinter { diff --git a/mozilla/extensions/transformiix/source/xml/util/DOMHelper.h b/mozilla/extensions/transformiix/source/xml/util/DOMHelper.h index 6985aec78e5..264d52ade49 100644 --- a/mozilla/extensions/transformiix/source/xml/util/DOMHelper.h +++ b/mozilla/extensions/transformiix/source/xml/util/DOMHelper.h @@ -19,14 +19,14 @@ * Keith Visco, kvisco@ziplink.net * -- original author. * - * $Id: DOMHelper.h,v 1.1 2000-02-22 11:12:57 kvisco%ziplink.net Exp $ + * $Id: DOMHelper.h,v 1.2 2000-04-12 22:32:17 nisheeth%netscape.com Exp $ */ #ifndef TRANSFRMX_DOMHELPER_H #define TRANSFRMX_DOMHELPER_H #include "baseutils.h" -#include "String.h" +#include "TxString.h" #include "List.h" #include "dom.h" #include "HashTable.h" @@ -59,7 +59,7 @@ class OrderInfo : public MITREObject { /** * A class used to overcome DOM 1.0 deficiencies * @author Keith Visco - * @version $Revision: 1.1 $ $Date: 2000-02-22 11:12:57 $ + * @version $Revision: 1.2 $ $Date: 2000-04-12 22:32:17 $ **/ class DOMHelper { diff --git a/mozilla/extensions/transformiix/source/xpath/Expr.h b/mozilla/extensions/transformiix/source/xpath/Expr.h index 365de070edb..380e1254d1d 100644 --- a/mozilla/extensions/transformiix/source/xpath/Expr.h +++ b/mozilla/extensions/transformiix/source/xpath/Expr.h @@ -25,21 +25,21 @@ * - changed constant short declarations in many of the classes * with enumerations, commented with //--LF * - * $Id: Expr.h,v 1.2 2000-04-06 22:34:02 Peter.VanderBeken%pandora.be Exp $ + * $Id: Expr.h,v 1.3 2000-04-12 22:32:25 nisheeth%netscape.com Exp $ */ /** * XSL expression class definitions. * Much of this code was ported from XSL:P.
* @author Keith Visco - * @version $Revision: 1.2 $ $Date: 2000-04-06 22:34:02 $ + * @version $Revision: 1.3 $ $Date: 2000-04-12 22:32:25 $ **/ #ifndef TRANSFRMX_EXPR_H #define TRANSFRMX_EXPR_H #include -#include "String.h" +#include "TxString.h" #include "ErrorObserver.h" #include "NodeSet.h" #include "List.h" diff --git a/mozilla/extensions/transformiix/source/xpath/ExprLexer.h b/mozilla/extensions/transformiix/source/xpath/ExprLexer.h index 82eb28c75ef..d969e014c0c 100644 --- a/mozilla/extensions/transformiix/source/xpath/ExprLexer.h +++ b/mozilla/extensions/transformiix/source/xpath/ExprLexer.h @@ -25,14 +25,14 @@ * -- changed constant short declarations in Token and ExprLexer to * enumerations, commented with //--LF * - * $Id: ExprLexer.h,v 1.1 2000-04-06 07:45:29 kvisco%ziplink.net Exp $ + * $Id: ExprLexer.h,v 1.2 2000-04-12 22:32:45 nisheeth%netscape.com Exp $ */ #ifndef MITREXSL_EXPRLEXER_H #define MITREXSL_EXPRLEXER_H -#include "String.h" +#include "TxString.h" #include "baseutils.h" #include @@ -42,7 +42,7 @@ * This class was ported from XSL:P, an open source Java based * XSLT processor, written by yours truly. * @author Keith Visco - * @version $Revision: 1.1 $ $Date: 2000-04-06 07:45:29 $ + * @version $Revision: 1.2 $ $Date: 2000-04-12 22:32:45 $ **/ class Token { diff --git a/mozilla/extensions/transformiix/source/xpath/ExprParser.h b/mozilla/extensions/transformiix/source/xpath/ExprParser.h index 780ea5bdab7..b78cef4edc4 100644 --- a/mozilla/extensions/transformiix/source/xpath/ExprParser.h +++ b/mozilla/extensions/transformiix/source/xpath/ExprParser.h @@ -21,21 +21,21 @@ * Keith Visco, kvisco@ziplink.net * -- original author. * - * $Id: ExprParser.h,v 1.1 2000-04-06 07:45:30 kvisco%ziplink.net Exp $ + * $Id: ExprParser.h,v 1.2 2000-04-12 22:32:58 nisheeth%netscape.com Exp $ */ /** * ExprParser * This class is used to parse XSL Expressions * @author Keith Visco - * @version $Revision: 1.1 $ $Date: 2000-04-06 07:45:30 $ + * @version $Revision: 1.2 $ $Date: 2000-04-12 22:32:58 $ * @see ExprLexer **/ #ifndef MITREXSL_EXPRPARSER_H #define MITREXSL_EXPRPARSER_H -#include "String.h" +#include "TxString.h" #include "ExprLexer.h" #include "Expr.h" #include "FunctionLib.h" diff --git a/mozilla/extensions/transformiix/source/xpath/FunctionLib.h b/mozilla/extensions/transformiix/source/xpath/FunctionLib.h index 8d9712f4746..18230b862a5 100644 --- a/mozilla/extensions/transformiix/source/xpath/FunctionLib.h +++ b/mozilla/extensions/transformiix/source/xpath/FunctionLib.h @@ -24,7 +24,7 @@ * Olivier Gerardin, ogerardin@vo.lu * -- added number functions * - * $Id: FunctionLib.h,v 1.2 2000-04-06 22:35:20 Peter.VanderBeken%pandora.be Exp $ + * $Id: FunctionLib.h,v 1.3 2000-04-12 22:33:21 nisheeth%netscape.com Exp $ */ @@ -32,7 +32,7 @@ #ifndef MITREXSL_FUNCTIONLIB_H #define MITREXSL_FUNCTIONLIB_H -#include "String.h" +#include "TxString.h" #include "primitives.h" #include "NodeSet.h" #include "List.h" diff --git a/mozilla/extensions/transformiix/source/xpath/Parser.cpp b/mozilla/extensions/transformiix/source/xpath/Parser.cpp index 06452776e3e..3bde3be8ad2 100644 --- a/mozilla/extensions/transformiix/source/xpath/Parser.cpp +++ b/mozilla/extensions/transformiix/source/xpath/Parser.cpp @@ -21,17 +21,17 @@ * Keith Visco, kvisco@ziplink.net * -- original author. * - * $Id: Parser.cpp,v 1.1 2000-04-06 07:45:36 kvisco%ziplink.net Exp $ + * $Id: Parser.cpp,v 1.2 2000-04-12 22:33:30 nisheeth%netscape.com Exp $ */ /** * Test App for Expressions * @author Keith Visco - * @version $Revision: 1.1 $ $Date: 2000-04-06 07:45:36 $ + * @version $Revision: 1.2 $ $Date: 2000-04-12 22:33:30 $ **/ #include -#include "String.h" +#include "TxString.h" #include "Expr.h" #include "ExprLexer.h" #include "ExprParser.h" diff --git a/mozilla/extensions/transformiix/source/xpath/makefile.win b/mozilla/extensions/transformiix/source/xpath/makefile.win index 72a201e66c7..f1beb1c18b8 100644 --- a/mozilla/extensions/transformiix/source/xpath/makefile.win +++ b/mozilla/extensions/transformiix/source/xpath/makefile.win @@ -19,7 +19,7 @@ # # Contributor(s): -DEPTH=..\..\..\..\.. +DEPTH=..\..\..\.. LIBRARY_NAME=transformix_xpath MODULE=transformix @@ -98,8 +98,8 @@ CPP_OBJS= \ EXPORTS = \ $(NULL) -LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor -I..\..\base -I..\util -I..\..\xml\dom \ - -I..\..\xml -I ..\..\xsl +LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor -I..\base -I..\util -I..\xml\dom \ + -I..\xml -I ..\xslt LCFLAGS = \ $(LCFLAGS) \ diff --git a/mozilla/extensions/transformiix/source/xslt/Names.h b/mozilla/extensions/transformiix/source/xslt/Names.h index 7b448dc4313..6721338e346 100644 --- a/mozilla/extensions/transformiix/source/xslt/Names.h +++ b/mozilla/extensions/transformiix/source/xslt/Names.h @@ -21,10 +21,10 @@ * Keith Visco, kvisco@ziplink.net * -- original author. * - * $Id: Names.h,v 1.2 2000-04-12 11:00:36 kvisco%ziplink.net Exp $ + * $Id: Names.h,v 1.3 2000-04-12 22:33:33 nisheeth%netscape.com Exp $ */ -#include "String.h" +#include "TxString.h" #ifndef TRANSFRMX_NAMES_H #define TRANSFRMX_NAMES_H diff --git a/mozilla/extensions/transformiix/source/xslt/Numbering.h b/mozilla/extensions/transformiix/source/xslt/Numbering.h index fac6267ed75..8bc81c8f76f 100644 --- a/mozilla/extensions/transformiix/source/xslt/Numbering.h +++ b/mozilla/extensions/transformiix/source/xslt/Numbering.h @@ -21,20 +21,20 @@ * Keith Visco, kvisco@ziplink.net * -- original author. * - * $Id: Numbering.h,v 1.1 2000-04-06 07:46:34 kvisco%ziplink.net Exp $ + * $Id: Numbering.h,v 1.2 2000-04-12 22:33:34 nisheeth%netscape.com Exp $ */ /** * Numbering methods * @author Keith Visco - * @version $Revision: 1.1 $ $Date: 2000-04-06 07:46:34 $ + * @version $Revision: 1.2 $ $Date: 2000-04-12 22:33:34 $ **/ #ifndef MITREXSL_NUMBERING_H #define MITREXSL_NUMBERING_H #include "baseutils.h" -#include "String.h" +#include "TxString.h" #include "dom.h" #include "ProcessorState.h" #include "Expr.h" diff --git a/mozilla/extensions/transformiix/source/xslt/OutputFormat.h b/mozilla/extensions/transformiix/source/xslt/OutputFormat.h index fbd252b21fe..806d54d7f2d 100644 --- a/mozilla/extensions/transformiix/source/xslt/OutputFormat.h +++ b/mozilla/extensions/transformiix/source/xslt/OutputFormat.h @@ -19,19 +19,19 @@ * Keith Visco, kvisco@ziplink.net * -- original author. * - * $Id: OutputFormat.h,v 1.1 2000-04-06 07:46:40 kvisco%ziplink.net Exp $ + * $Id: OutputFormat.h,v 1.2 2000-04-12 22:33:34 nisheeth%netscape.com Exp $ */ #ifndef TRANSFRMX_OUTPUTFORMAT_H #define TRANSFRMX_OUTPUTFORMAT_H -#include "String.h" +#include "TxString.h" #include "baseutils.h" /** * @author Keith Visco - * @version $Revision: 1.1 $ $Date: 2000-04-06 07:46:40 $ + * @version $Revision: 1.2 $ $Date: 2000-04-12 22:33:34 $ **/ class OutputFormat { diff --git a/mozilla/extensions/transformiix/source/xslt/VariableBinding.h b/mozilla/extensions/transformiix/source/xslt/VariableBinding.h index 30649a09412..25795e90a4e 100644 --- a/mozilla/extensions/transformiix/source/xslt/VariableBinding.h +++ b/mozilla/extensions/transformiix/source/xslt/VariableBinding.h @@ -21,20 +21,20 @@ * Keith Visco, kvisco@ziplink.net * -- original author. * - * $Id: VariableBinding.h,v 1.1 2000-04-06 07:46:55 kvisco%ziplink.net Exp $ + * $Id: VariableBinding.h,v 1.2 2000-04-12 22:33:34 nisheeth%netscape.com Exp $ */ #ifndef MITREXSL_VARIABLE_H #define MITREXSL_VARIABLE_H #include "MITREObject.h" -#include "String.h" +#include "TxString.h" #include "baseutils.h" #include "ExprResult.h" /** * @author Keith Visco - * @version $Revision: 1.1 $ $Date: 2000-04-06 07:46:55 $ + * @version $Revision: 1.2 $ $Date: 2000-04-12 22:33:34 $ **/ class VariableBinding : public MITREObject { diff --git a/mozilla/extensions/transformiix/source/xslt/XSLTProcessor.h b/mozilla/extensions/transformiix/source/xslt/XSLTProcessor.h index e8c7f224cdb..736be2dee92 100644 --- a/mozilla/extensions/transformiix/source/xslt/XSLTProcessor.h +++ b/mozilla/extensions/transformiix/source/xslt/XSLTProcessor.h @@ -21,7 +21,7 @@ * Keith Visco, kvisco@ziplink.net * -- original author. * - * $Id: XSLTProcessor.h,v 1.5 2000-04-12 11:00:56 kvisco%ziplink.net Exp $ + * $Id: XSLTProcessor.h,v 1.6 2000-04-12 22:33:43 nisheeth%netscape.com Exp $ */ @@ -53,7 +53,7 @@ #include "Names.h" #include "NodeSet.h" #include "ProcessorState.h" -#include "String.h" +#include "TxString.h" #include "Tokenizer.h" #include "ErrorObserver.h" #include "List.h" @@ -75,7 +75,7 @@ /** * A class for Processing XSL Stylesheets * @author Keith Visco - * @version $Revision: 1.5 $ $Date: 2000-04-12 11:00:56 $ + * @version $Revision: 1.6 $ $Date: 2000-04-12 22:33:43 $ **/ class XSLTProcessor #ifdef MOZILLA diff --git a/mozilla/extensions/transformiix/source/xslt/makefile.win b/mozilla/extensions/transformiix/source/xslt/makefile.win index 56afc55c9b2..6ca287f15dd 100644 --- a/mozilla/extensions/transformiix/source/xslt/makefile.win +++ b/mozilla/extensions/transformiix/source/xslt/makefile.win @@ -19,7 +19,7 @@ # # Contributor(s): -DEPTH=..\..\..\..\.. +DEPTH=..\..\..\.. DIRS=util @@ -30,7 +30,7 @@ REQUIRES=xpcom raptor DEFINES=-DMOZILLA CPPSRCS= \ - XSLProcessor.cpp \ + XSLTProcessor.cpp \ ProcessorState.cpp \ Names.cpp \ $(NULL) @@ -42,7 +42,7 @@ CPP_OBJS= \ $(NULL) EXPORTS = \ - XSLProcessor.h \ + XSLTProcessor.h \ $(NULL) LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor -I.\expr -I.\util -I..\xml\dom \ diff --git a/mozilla/extensions/transformiix/source/xslt/util/NodeSorter.h b/mozilla/extensions/transformiix/source/xslt/util/NodeSorter.h index 937822f185d..668492f4a7e 100644 --- a/mozilla/extensions/transformiix/source/xslt/util/NodeSorter.h +++ b/mozilla/extensions/transformiix/source/xslt/util/NodeSorter.h @@ -20,11 +20,11 @@ * Keith Visco, kvisco@ziplink.net * -- original author. * - * $Id: NodeSorter.h,v 1.1 2000-04-12 10:55:55 kvisco%ziplink.net Exp $ + * $Id: NodeSorter.h,v 1.2 2000-04-12 22:33:55 nisheeth%netscape.com Exp $ */ -#include "String.h" +#include "TxString.h" #include "StringComparator.h" #include "NamedMap.h" #include "dom.h" diff --git a/mozilla/extensions/transformiix/source/xslt/util/makefile.win b/mozilla/extensions/transformiix/source/xslt/util/makefile.win index f0bf63683fc..313bc535333 100644 --- a/mozilla/extensions/transformiix/source/xslt/util/makefile.win +++ b/mozilla/extensions/transformiix/source/xslt/util/makefile.win @@ -19,7 +19,7 @@ # # Contributor(s): -DEPTH=..\..\..\..\..\.. +DEPTH=..\..\..\..\.. LIBRARY_NAME=transformix_xslt_util MODULE=transformix @@ -27,17 +27,19 @@ REQUIRES=xpcom raptor CPPSRCS= \ NodeStack.cpp \ + NodeSorter.cpp \ $(NULL) CPP_OBJS= \ .\$(OBJDIR)\NodeStack.obj \ + .\$(OBJDIR)\NodeSorter.obj \ $(NULL) EXPORTS = \ $(NULL) LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor -I..\..\base -I..\..\xml\dom \ - -I..\expr -I..\..\xml + -I..\..\xpath -I..\..\xml -I..\ -I..\..\xml\util LCFLAGS = \ $(LCFLAGS) \