зеркало из https://github.com/mozilla/gecko-dev.git
Removing DOMString/Cleaning up some whitespace. Not part of build yet. a=leaf.
This commit is contained in:
Родитель
dc21256609
Коммит
b50dd527d6
|
@ -21,14 +21,14 @@
|
|||
* Keith Visco, kvisco@ziplink.net
|
||||
* -- original author.
|
||||
*
|
||||
* $Id: CommandLineUtils.cpp,v 1.2 1999/11/15 07:12:38 nisheeth%netscape.com Exp $
|
||||
* $Id: CommandLineUtils.cpp,v 1.3 2000/06/11 11:41:52 Peter.VanderBeken%pandora.be Exp $
|
||||
*/
|
||||
|
||||
#include "CommandLineUtils.h"
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:kvisco@ziplink.net">Keith Visco</a>
|
||||
* @version $Revision: 1.2 $ $Date: 1999/11/15 07:12:38 $
|
||||
* @version $Revision: 1.3 $ $Date: 2000/06/11 11:41:52 $
|
||||
**/
|
||||
void CommandLineUtils::getOptions
|
||||
(NamedMap& options, int argc, char** argv, StringList& flags)
|
||||
|
@ -41,43 +41,43 @@ void CommandLineUtils::getOptions
|
|||
|
||||
if ((arg.length()>0) && (arg.charAt(0) == '-')) {
|
||||
|
||||
// clean up previous flag
|
||||
// clean up previous flag
|
||||
if (flag.length()>0) {
|
||||
options.put(flag, new String(arg));
|
||||
flag.clear();
|
||||
}
|
||||
// get next flag
|
||||
}
|
||||
// get next flag
|
||||
arg.subString(1,flag);
|
||||
|
||||
//-- check full flag, otherwise try to find
|
||||
//-- flag within string
|
||||
if (!flags.contains(flag)) {
|
||||
//-- check full flag, otherwise try to find
|
||||
//-- flag within string
|
||||
if (!flags.contains(flag)) {
|
||||
Int32 idx = 1;
|
||||
String tmpFlag;
|
||||
while(idx <= flag.length()) {
|
||||
while(idx <= flag.length()) {
|
||||
flag.subString(0,idx, tmpFlag);
|
||||
if (flags.contains(tmpFlag)) {
|
||||
if (idx < flag.length()) {
|
||||
if (idx < flag.length()) {
|
||||
String* value = new String();
|
||||
flag.subString(idx, *value);
|
||||
options.put(tmpFlag,value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (idx == flag.length()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (idx == flag.length()) {
|
||||
cout << "invalid option: -" << flag << endl;
|
||||
}
|
||||
++idx;
|
||||
}// end while
|
||||
}
|
||||
}
|
||||
++idx;
|
||||
}// end while
|
||||
}
|
||||
}// if flag char '-'
|
||||
else {
|
||||
// Store both flag key and number key
|
||||
else {
|
||||
// Store both flag key and number key
|
||||
if (flag.length() > 0) options.put(flag, new String(arg));
|
||||
flag.clear();
|
||||
}
|
||||
}
|
||||
|
||||
}// end for
|
||||
}// end for
|
||||
if (flag.length()>0) options.put(flag, new String("no value"));
|
||||
} //-- getOptions
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
//
|
||||
//Construct an Attribute object using the specified name and document owner
|
||||
//
|
||||
Attr::Attr(const DOMString& name, Document* owner):
|
||||
Attr::Attr(const String& name, Document* owner):
|
||||
NodeDefinition(Node::ATTRIBUTE_NODE, name, NULL_STRING, owner)
|
||||
{
|
||||
specified = MB_FALSE;
|
||||
|
@ -44,7 +44,7 @@ Attr::Attr(const DOMString& name, Document* owner):
|
|||
//
|
||||
//Retrieve the name of the attribute from the nodeName data member
|
||||
//
|
||||
const DOMString& Attr::getName() const
|
||||
const String& Attr::getName() const
|
||||
{
|
||||
return nodeName;
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ MBool Attr::getSpecified() const
|
|||
//Retrieve the value of the attribute. This is a comma-deliminated string
|
||||
//representation of the Attribute's children.
|
||||
//
|
||||
const DOMString& Attr::getValue()
|
||||
const String& Attr::getValue()
|
||||
{
|
||||
Int32 valueLoop;
|
||||
nodeValue = NULL_STRING;
|
||||
|
@ -85,7 +85,7 @@ const DOMString& Attr::getValue()
|
|||
//Create a new Text node and add it to the Attribute's list of children. Also
|
||||
//set the Specified flag to true.
|
||||
//
|
||||
void Attr::setValue(const DOMString& newValue)
|
||||
void Attr::setValue(const String& newValue)
|
||||
{
|
||||
NodeDefinition::DeleteChildren();
|
||||
|
||||
|
@ -97,21 +97,21 @@ void Attr::setValue(const DOMString& newValue)
|
|||
|
||||
//
|
||||
//Override the set node value member function to create a new TEXT node with
|
||||
//the DOMString and to add it as the Attribute's child.
|
||||
//the String and to add it as the Attribute's child.
|
||||
// NOTE: Not currently impemented, just execute the default setNodeValue
|
||||
//
|
||||
void Attr::setNodeValue(const DOMString& nodeValue)
|
||||
void Attr::setNodeValue(const String& nodeValue)
|
||||
{
|
||||
setValue(nodeValue);
|
||||
}
|
||||
|
||||
//
|
||||
//Return a DOMString represening the value of this node. If the value is an
|
||||
//Return a String represening the value of this node. If the value is an
|
||||
//Entity Reference then return the value of the reference. Otherwise, it is a
|
||||
//simple conversion of the text value.
|
||||
// NOTE: Not currently implemented, just execute the default getNodeValue
|
||||
//
|
||||
const DOMString& Attr::getNodeValue()
|
||||
const String& Attr::getNodeValue()
|
||||
{
|
||||
return getValue();
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
//
|
||||
//Construct a text object with the specified document owner and data
|
||||
//
|
||||
CDATASection::CDATASection(const DOMString& theData, Document* owner) :
|
||||
CDATASection::CDATASection(const String& theData, Document* owner) :
|
||||
Text(Node::CDATA_SECTION_NODE, "#cdata-section", theData, owner)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -33,8 +33,8 @@
|
|||
//
|
||||
//Protected constructor. Just pass parameters onto NodeDefinition.
|
||||
//
|
||||
CharacterData::CharacterData(NodeType type, const DOMString& name,
|
||||
const DOMString& value, Document* owner) :
|
||||
CharacterData::CharacterData(NodeType type, const String& name,
|
||||
const String& value, Document* owner) :
|
||||
NodeDefinition(type, name, value, owner)
|
||||
{
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ CharacterData::CharacterData(NodeType type, const DOMString& name,
|
|||
//
|
||||
//Return a constant reference to the data stored by this object.
|
||||
//
|
||||
const DOMString& CharacterData::getData() const
|
||||
const String& CharacterData::getData() const
|
||||
{
|
||||
return nodeValue;
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ const DOMString& CharacterData::getData() const
|
|||
//
|
||||
//Set the data stored by this object to the string represented by "source".
|
||||
//
|
||||
void CharacterData::setData(const DOMString& source)
|
||||
void CharacterData::setData(const String& source)
|
||||
{
|
||||
nodeValue = source;
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ Int32 CharacterData::getLength() const
|
|||
//characters away.
|
||||
// NOTE: An empty string will be returned in the event of an error.
|
||||
//
|
||||
DOMString& CharacterData::substringData(Int32 offset, Int32 count, DOMString& dest)
|
||||
String& CharacterData::substringData(Int32 offset, Int32 count, String& dest)
|
||||
{
|
||||
if ((offset >= 0) && (offset < nodeValue.length()) && (count > 0))
|
||||
return nodeValue.subString(offset, offset+count, dest);
|
||||
|
@ -79,12 +79,12 @@ DOMString& CharacterData::substringData(Int32 offset, Int32 count, DOMString& de
|
|||
}
|
||||
}
|
||||
|
||||
void CharacterData::appendData(const DOMString& arg)
|
||||
void CharacterData::appendData(const String& arg)
|
||||
{
|
||||
nodeValue.append(arg);
|
||||
}
|
||||
|
||||
void CharacterData::insertData(Int32 offset, const DOMString& arg)
|
||||
void CharacterData::insertData(Int32 offset, const String& arg)
|
||||
{
|
||||
if ((offset >= 0) && (offset < nodeValue.length()))
|
||||
nodeValue.insert(offset, arg);
|
||||
|
@ -96,9 +96,9 @@ void CharacterData::deleteData(Int32 offset, Int32 count)
|
|||
nodeValue.deleteChars(offset, count);
|
||||
}
|
||||
|
||||
void CharacterData::replaceData(Int32 offset, Int32 count, const DOMString& arg)
|
||||
void CharacterData::replaceData(Int32 offset, Int32 count, const String& arg)
|
||||
{
|
||||
DOMString tempString;
|
||||
String tempString;
|
||||
|
||||
if ((offset >= 0) && (offset < nodeValue.length()) && (count > 0))
|
||||
{
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
//
|
||||
//Construct a text object with the specified document owner and data
|
||||
//
|
||||
Comment::Comment(const DOMString& theData, Document* owner) :
|
||||
Comment::Comment(const String& theData, Document* owner) :
|
||||
CharacterData(Node::COMMENT_NODE, "#comment", theData, owner)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -44,8 +44,8 @@ DOMImplementation::~DOMImplementation()
|
|||
//Perform a case insensitive comparison between "feature" and the
|
||||
//functionality of this DOM implementation/version.
|
||||
//
|
||||
MBool DOMImplementation::hasFeature(DOMString feature,
|
||||
const DOMString& version) const
|
||||
MBool DOMImplementation::hasFeature(String feature,
|
||||
const String& version) const
|
||||
{
|
||||
feature.toUpperCase();
|
||||
|
||||
|
|
|
@ -202,7 +202,7 @@ DocumentFragment* Document::createDocumentFragment()
|
|||
//Construct an element with the specified tag name.
|
||||
// NOTE: The caller is responsible for cleaning up the element's menory
|
||||
//
|
||||
Element* Document::createElement(const DOMString& tagName)
|
||||
Element* Document::createElement(const String& tagName)
|
||||
{
|
||||
return new Element(tagName, this);
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ Element* Document::createElement(const DOMString& tagName)
|
|||
//
|
||||
//Construct an attribute with the specified name
|
||||
//
|
||||
Attr* Document::createAttribute(const DOMString& name)
|
||||
Attr* Document::createAttribute(const String& name)
|
||||
{
|
||||
return new Attr(name, this);
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ Attr* Document::createAttribute(const DOMString& name)
|
|||
//
|
||||
//Construct a text node with the given data
|
||||
//
|
||||
Text* Document::createTextNode(const DOMString& theData)
|
||||
Text* Document::createTextNode(const String& theData)
|
||||
{
|
||||
return new Text(theData, this);
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ Text* Document::createTextNode(const DOMString& theData)
|
|||
//
|
||||
//Construct a comment node with the given data
|
||||
//
|
||||
Comment* Document::createComment(const DOMString& theData)
|
||||
Comment* Document::createComment(const String& theData)
|
||||
{
|
||||
return new Comment(theData, this);
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ Comment* Document::createComment(const DOMString& theData)
|
|||
//
|
||||
//Construct a CDATASection node with the given data
|
||||
//
|
||||
CDATASection* Document::createCDATASection(const DOMString& theData)
|
||||
CDATASection* Document::createCDATASection(const String& theData)
|
||||
{
|
||||
return new CDATASection(theData, this);
|
||||
}
|
||||
|
@ -243,8 +243,8 @@ CDATASection* Document::createCDATASection(const DOMString& theData)
|
|||
//Construct a ProcessingInstruction node with the given targe and data.
|
||||
//
|
||||
ProcessingInstruction*
|
||||
Document::createProcessingInstruction(const DOMString& target,
|
||||
const DOMString& data)
|
||||
Document::createProcessingInstruction(const String& target,
|
||||
const String& data)
|
||||
{
|
||||
return new ProcessingInstruction(target, data, this);
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ ProcessingInstruction*
|
|||
//
|
||||
//Construct an EntityReference with the given name
|
||||
//
|
||||
EntityReference* Document::createEntityReference(const DOMString& name)
|
||||
EntityReference* Document::createEntityReference(const String& name)
|
||||
{
|
||||
return new EntityReference(name, this);
|
||||
}
|
||||
|
|
|
@ -35,8 +35,8 @@
|
|||
//Construct a DocumentFragment with the specified name and value. Call the
|
||||
//constructor for NodeDefinition and specify the DocumentFragment Type.
|
||||
//
|
||||
DocumentFragment::DocumentFragment(const DOMString& name,
|
||||
const DOMString& value, Document* owner) :
|
||||
DocumentFragment::DocumentFragment(const String& name,
|
||||
const String& value, Document* owner) :
|
||||
NodeDefinition(Node::DOCUMENT_FRAGMENT_NODE, name, value, owner)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
//
|
||||
//Construct a text object with the specified document owner and data
|
||||
//
|
||||
DocumentType::DocumentType(const DOMString& name, NamedNodeMap* theEntities,
|
||||
DocumentType::DocumentType(const String& name, NamedNodeMap* theEntities,
|
||||
NamedNodeMap* theNotations) :
|
||||
NodeDefinition(Node::DOCUMENT_TYPE_NODE, name, NULL_STRING, NULL)
|
||||
{
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
//Simply call the constructor for NodeDefinition, and specify the proper node
|
||||
//type.
|
||||
//
|
||||
Element::Element(const DOMString& tagName, Document* owner) :
|
||||
Element::Element(const String& tagName, Document* owner) :
|
||||
NodeDefinition(Node::ELEMENT_NODE, tagName, NULL_STRING, owner)
|
||||
{
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ Node* Element::insertBefore(Node* newChild, Node* refChild)
|
|||
//
|
||||
//Return the tagName for this element. This is simply the nodeName.
|
||||
//
|
||||
const DOMString& Element::getTagName()
|
||||
const String& Element::getTagName()
|
||||
{
|
||||
return nodeName;
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ const DOMString& Element::getTagName()
|
|||
//Retreive an attribute's value by name. If the attribute does not exist,
|
||||
//return a reference to the pre-created, constatnt "NULL STRING".
|
||||
//
|
||||
const DOMString& Element::getAttribute(const DOMString& name)
|
||||
const String& Element::getAttribute(const String& name)
|
||||
{
|
||||
Node* tempNode = attributes.getNamedItem(name);
|
||||
|
||||
|
@ -96,7 +96,7 @@ const DOMString& Element::getAttribute(const DOMString& name)
|
|||
//name and value specified. Then add the Attr to the the Element's
|
||||
//attributes NamedNodeMap.
|
||||
//
|
||||
void Element::setAttribute(const DOMString& name, const DOMString& value)
|
||||
void Element::setAttribute(const String& name, const String& value)
|
||||
{
|
||||
Attr* tempAttribute;
|
||||
|
||||
|
@ -117,7 +117,7 @@ void Element::setAttribute(const DOMString& name, const DOMString& value)
|
|||
//Remove an attribute from the attributes NamedNodeMap, and free its memory.
|
||||
// NOTE: How do default values enter into this picture
|
||||
//
|
||||
void Element::removeAttribute(const DOMString& name)
|
||||
void Element::removeAttribute(const String& name)
|
||||
{
|
||||
delete attributes.removeNamedItem(name);
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ void Element::removeAttribute(const DOMString& name)
|
|||
//
|
||||
//Return the attribute specified by name
|
||||
//
|
||||
Attr* Element::getAttributeNode(const DOMString& name)
|
||||
Attr* Element::getAttributeNode(const String& name)
|
||||
{
|
||||
return (Attr*)attributes.getNamedItem(name);
|
||||
}
|
||||
|
@ -152,9 +152,9 @@ Attr* Element::removeAttributeNode(Attr* oldAttr)
|
|||
return (Attr*)attributes.removeNamedItem(oldAttr->getNodeName());
|
||||
}
|
||||
|
||||
NodeList* Element::getElementsByTagName(const DOMString& name)
|
||||
NodeList* Element::getElementsByTagName(const String& name)
|
||||
{
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Element::normalize()
|
||||
|
|
|
@ -35,8 +35,8 @@
|
|||
//
|
||||
//Construct a text object with the specified document owner and data
|
||||
//
|
||||
Entity::Entity(const DOMString& name, const DOMString& pubID,
|
||||
const DOMString& sysID, const DOMString& notName) :
|
||||
Entity::Entity(const String& name, const String& pubID,
|
||||
const String& sysID, const String& notName) :
|
||||
NodeDefinition(Node::ENTITY_NODE, name, NULL_STRING, NULL)
|
||||
{
|
||||
publicId = pubID;
|
||||
|
@ -47,7 +47,7 @@ Entity::Entity(const DOMString& name, const DOMString& pubID,
|
|||
//
|
||||
//Return the Public ID of the Entity
|
||||
//
|
||||
const DOMString& Entity::getPublicId() const
|
||||
const String& Entity::getPublicId() const
|
||||
{
|
||||
return publicId;
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ const DOMString& Entity::getPublicId() const
|
|||
//
|
||||
//Return the System ID of the Entity
|
||||
//
|
||||
const DOMString& Entity::getSystemId() const
|
||||
const String& Entity::getSystemId() const
|
||||
{
|
||||
return systemId;
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ const DOMString& Entity::getSystemId() const
|
|||
//
|
||||
//Return the Notation Name of the Entity
|
||||
//
|
||||
const DOMString& Entity::getNotationName() const
|
||||
const String& Entity::getNotationName() const
|
||||
{
|
||||
return notationName;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
//
|
||||
//Construct a text object with the specified document owner and data
|
||||
//
|
||||
EntityReference::EntityReference(const DOMString& name, Document* owner) :
|
||||
EntityReference::EntityReference(const String& name, Document* owner) :
|
||||
NodeDefinition(Node::ENTITY_REFERENCE_NODE, name, NULL_STRING, owner)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -47,8 +47,6 @@
|
|||
typedef 0 NULL;
|
||||
#endif
|
||||
|
||||
|
||||
typedef String DOMString;
|
||||
typedef UNICODE_CHAR DOM_CHAR;
|
||||
|
||||
class NodeList;
|
||||
|
@ -72,11 +70,11 @@ class DOMImplementation
|
|||
DOMImplementation();
|
||||
~DOMImplementation();
|
||||
|
||||
MBool hasFeature(DOMString feature, const DOMString& version) const;
|
||||
MBool hasFeature(String feature, const String& version) const;
|
||||
|
||||
private:
|
||||
DOMString implFeature;
|
||||
DOMString implVersion;
|
||||
String implFeature;
|
||||
String implVersion;
|
||||
};
|
||||
|
||||
//
|
||||
|
@ -106,9 +104,9 @@ class Node
|
|||
virtual ~Node() {}
|
||||
|
||||
//Read functions
|
||||
virtual const DOMString& getNodeName() const = 0;
|
||||
virtual const DOMString& getNodeValue() const = 0;
|
||||
virtual const DOMString& getNodeValue() = 0;
|
||||
virtual const String& getNodeName() const = 0;
|
||||
virtual const String& getNodeValue() const = 0;
|
||||
virtual const String& getNodeValue() = 0;
|
||||
virtual unsigned short getNodeType() const = 0;
|
||||
virtual Node* getParentNode() const = 0;
|
||||
virtual NodeList* getChildNodes() = 0;
|
||||
|
@ -120,7 +118,7 @@ class Node
|
|||
virtual Document* getOwnerDocument() const = 0;
|
||||
|
||||
//Write functions
|
||||
virtual void setNodeValue(const DOMString& nodeValue) = 0;
|
||||
virtual void setNodeValue(const String& nodeValue) = 0;
|
||||
|
||||
//Node manipulation functions
|
||||
virtual Node* insertBefore(Node* newChild, Node* refChild) = 0;
|
||||
|
@ -191,12 +189,12 @@ class NamedNodeMap : public NodeListDefinition
|
|||
NamedNodeMap();
|
||||
~NamedNodeMap();
|
||||
|
||||
Node* getNamedItem(const DOMString& name);
|
||||
Node* getNamedItem(const String& name);
|
||||
Node* setNamedItem(Node* arg);
|
||||
Node* removeNamedItem(const DOMString& name);
|
||||
Node* removeNamedItem(const String& name);
|
||||
|
||||
private:
|
||||
NodeListDefinition::ListItem* findListItemByName(const DOMString& name);
|
||||
NodeListDefinition::ListItem* findListItemByName(const String& name);
|
||||
};
|
||||
|
||||
//
|
||||
|
@ -208,14 +206,14 @@ class NamedNodeMap : public NodeListDefinition
|
|||
class NodeDefinition : public Node, public NodeList
|
||||
{
|
||||
public:
|
||||
NodeDefinition(NodeType type, const DOMString& name,
|
||||
const DOMString& value, Document* owner);
|
||||
NodeDefinition(NodeType type, const String& name,
|
||||
const String& 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();
|
||||
const String& getNodeName() const;
|
||||
virtual const String& getNodeValue() const;
|
||||
virtual const String& getNodeValue();
|
||||
unsigned short getNodeType() const;
|
||||
Node* getParentNode() const;
|
||||
NodeList* getChildNodes();
|
||||
|
@ -227,7 +225,7 @@ class NodeDefinition : public Node, public NodeList
|
|||
Document* getOwnerDocument() const;
|
||||
|
||||
//Write functions
|
||||
virtual void setNodeValue(const DOMString& nodeValue);
|
||||
virtual void setNodeValue(const String& nodeValue);
|
||||
|
||||
//Child node manipulation functions
|
||||
virtual Node* insertBefore(Node* newChild, Node* refChild);
|
||||
|
@ -246,8 +244,8 @@ class NodeDefinition : public Node, public NodeList
|
|||
//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;
|
||||
String nodeName;
|
||||
String nodeValue;
|
||||
NamedNodeMap attributes;
|
||||
|
||||
void DeleteChildren();
|
||||
|
@ -279,7 +277,7 @@ class NodeDefinition : public Node, public NodeList
|
|||
class DocumentFragment : public NodeDefinition
|
||||
{
|
||||
public:
|
||||
DocumentFragment(const DOMString& name, const DOMString& value, Document* owner);
|
||||
DocumentFragment(const String& name, const String& value, Document* owner);
|
||||
|
||||
//Override insertBefore to limit Elements to having only certain nodes as
|
||||
//children
|
||||
|
@ -300,14 +298,14 @@ class Document : public NodeDefinition
|
|||
|
||||
//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);
|
||||
Element* createElement(const String& tagName);
|
||||
Attr* createAttribute(const String& name);
|
||||
Text* createTextNode(const String& theData);
|
||||
Comment* createComment(const String& theData);
|
||||
CDATASection* createCDATASection(const String& theData);
|
||||
ProcessingInstruction* createProcessingInstruction(const String& target,
|
||||
const String& data);
|
||||
EntityReference* createEntityReference(const String& name);
|
||||
|
||||
//Override functions to enforce the One Element rule for documents, as well
|
||||
//as limit documents to certain types of nodes.
|
||||
|
@ -327,20 +325,20 @@ class Document : public NodeDefinition
|
|||
class Element : public NodeDefinition
|
||||
{
|
||||
public:
|
||||
Element(const DOMString& tagName, Document* owner);
|
||||
Element(const String& 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);
|
||||
const String& getTagName();
|
||||
const String& getAttribute(const String& name);
|
||||
void setAttribute(const String& name, const String& value);
|
||||
void removeAttribute(const String& name);
|
||||
Attr* getAttributeNode(const String& name);
|
||||
Attr* setAttributeNode(Attr* newAttr);
|
||||
Attr* removeAttributeNode(Attr* oldAttr);
|
||||
NodeList* getElementsByTagName(const DOMString& name);
|
||||
NodeList* getElementsByTagName(const String& name);
|
||||
void normalize();
|
||||
};
|
||||
|
||||
|
@ -352,17 +350,17 @@ class Element : public NodeDefinition
|
|||
class Attr : public NodeDefinition
|
||||
{
|
||||
public:
|
||||
Attr(const DOMString& name, Document* owner);
|
||||
Attr(const String& name, Document* owner);
|
||||
|
||||
const DOMString& getName() const;
|
||||
const String& getName() const;
|
||||
MBool getSpecified() const;
|
||||
const DOMString& getValue();
|
||||
void setValue(const DOMString& newValue);
|
||||
const String& getValue();
|
||||
void setValue(const String& 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();
|
||||
void setNodeValue(const String& nodeValue);
|
||||
const String& getNodeValue();
|
||||
|
||||
//Override insertBefore to limit Attr to having only certain nodes as
|
||||
//children
|
||||
|
@ -380,19 +378,19 @@ class Attr : public NodeDefinition
|
|||
class CharacterData : public NodeDefinition
|
||||
{
|
||||
public:
|
||||
const DOMString& getData() const;
|
||||
void setData(const DOMString& source);
|
||||
const String& getData() const;
|
||||
void setData(const String& source);
|
||||
Int32 getLength() const;
|
||||
|
||||
DOMString& substringData(Int32 offset, Int32 count, DOMString& dest);
|
||||
void appendData(const DOMString& arg);
|
||||
void insertData(Int32 offset, const DOMString& arg);
|
||||
String& substringData(Int32 offset, Int32 count, String& dest);
|
||||
void appendData(const String& arg);
|
||||
void insertData(Int32 offset, const String& arg);
|
||||
void deleteData(Int32 offset, Int32 count);
|
||||
void replaceData(Int32 offset, Int32 count, const DOMString& arg);
|
||||
void replaceData(Int32 offset, Int32 count, const String& arg);
|
||||
|
||||
protected:
|
||||
CharacterData(NodeType type, const DOMString& name,
|
||||
const DOMString& value, Document* owner);
|
||||
CharacterData(NodeType type, const String& name,
|
||||
const String& value, Document* owner);
|
||||
};
|
||||
|
||||
//
|
||||
|
@ -402,7 +400,7 @@ class CharacterData : public NodeDefinition
|
|||
class Text : public CharacterData
|
||||
{
|
||||
public:
|
||||
Text(const DOMString& theData, Document* owner);
|
||||
Text(const String& theData, Document* owner);
|
||||
|
||||
Text* splitText(Int32 offset);
|
||||
|
||||
|
@ -414,7 +412,7 @@ class Text : public CharacterData
|
|||
Node* appendChild(Node* newChild);
|
||||
|
||||
protected:
|
||||
Text(NodeType type, const DOMString& name, const DOMString& value,
|
||||
Text(NodeType type, const String& name, const String& value,
|
||||
Document* owner);
|
||||
};
|
||||
|
||||
|
@ -425,7 +423,7 @@ class Text : public CharacterData
|
|||
class Comment : public CharacterData
|
||||
{
|
||||
public:
|
||||
Comment(const DOMString& theData, Document* owner);
|
||||
Comment(const String& theData, Document* owner);
|
||||
|
||||
//Override "child manipulation" function since Comment Nodes can not have
|
||||
//any children.
|
||||
|
@ -442,7 +440,7 @@ class Comment : public CharacterData
|
|||
class CDATASection : public Text
|
||||
{
|
||||
public:
|
||||
CDATASection(const DOMString& theData, Document* owner);
|
||||
CDATASection(const String& theData, Document* owner);
|
||||
|
||||
//Override "child manipulation" function since CDATASection Nodes can not
|
||||
//have any children.
|
||||
|
@ -463,13 +461,13 @@ class CDATASection : public Text
|
|||
class ProcessingInstruction : public NodeDefinition
|
||||
{
|
||||
public:
|
||||
ProcessingInstruction(const DOMString& theTarget, const DOMString& theData,
|
||||
ProcessingInstruction(const String& theTarget, const String& theData,
|
||||
Document* owner);
|
||||
|
||||
const DOMString& getTarget() const;
|
||||
const DOMString& getData() const;
|
||||
const String& getTarget() const;
|
||||
const String& getData() const;
|
||||
|
||||
void setData(const DOMString& theData);
|
||||
void setData(const String& theData);
|
||||
|
||||
//Override "child manipulation" function since ProcessingInstruction Nodes
|
||||
//can not have any children.
|
||||
|
@ -486,11 +484,11 @@ class ProcessingInstruction : public NodeDefinition
|
|||
class Notation : public NodeDefinition
|
||||
{
|
||||
public:
|
||||
Notation(const DOMString& name, const DOMString& pubID,
|
||||
const DOMString& sysID);
|
||||
Notation(const String& name, const String& pubID,
|
||||
const String& sysID);
|
||||
|
||||
const DOMString& getPublicId() const;
|
||||
const DOMString& getSystemId() const;
|
||||
const String& getPublicId() const;
|
||||
const String& getSystemId() const;
|
||||
|
||||
//Override "child manipulation" function since Notation Nodes
|
||||
//can not have any children.
|
||||
|
@ -500,8 +498,8 @@ class Notation : public NodeDefinition
|
|||
Node* appendChild(Node* newChild);
|
||||
|
||||
private:
|
||||
DOMString publicId;
|
||||
DOMString systemId;
|
||||
String publicId;
|
||||
String systemId;
|
||||
};
|
||||
|
||||
//
|
||||
|
@ -510,21 +508,21 @@ class Notation : public NodeDefinition
|
|||
class Entity : public NodeDefinition
|
||||
{
|
||||
public:
|
||||
Entity(const DOMString& name, const DOMString& pubID,
|
||||
const DOMString& sysID, const DOMString& notName);
|
||||
Entity(const String& name, const String& pubID,
|
||||
const String& sysID, const String& notName);
|
||||
|
||||
const DOMString& getPublicId() const;
|
||||
const DOMString& getSystemId() const;
|
||||
const DOMString& getNotationName() const;
|
||||
const String& getPublicId() const;
|
||||
const String& getSystemId() const;
|
||||
const String& 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;
|
||||
String publicId;
|
||||
String systemId;
|
||||
String notationName;
|
||||
};
|
||||
|
||||
//
|
||||
|
@ -533,7 +531,7 @@ class Entity : public NodeDefinition
|
|||
class EntityReference : public NodeDefinition
|
||||
{
|
||||
public:
|
||||
EntityReference(const DOMString& name, Document* owner);
|
||||
EntityReference(const String& name, Document* owner);
|
||||
|
||||
//Override insertBefore to limit EntityReference to having only certain
|
||||
//nodes as children
|
||||
|
@ -546,7 +544,7 @@ class EntityReference : public NodeDefinition
|
|||
class DocumentType : public NodeDefinition
|
||||
{
|
||||
public:
|
||||
DocumentType(const DOMString& name, NamedNodeMap* theEntities,
|
||||
DocumentType(const String& name, NamedNodeMap* theEntities,
|
||||
NamedNodeMap* theNotations);
|
||||
~DocumentType();
|
||||
|
||||
|
@ -567,7 +565,7 @@ class DocumentType : public NodeDefinition
|
|||
|
||||
//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;
|
||||
const String NULL_STRING;
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -19,13 +19,13 @@
|
|||
* Keith Visco, kvisco@ziplink.net
|
||||
* -- original author.
|
||||
*
|
||||
* $Id: DOMHelper.cpp,v 1.2 2000/04/19 10:31:23 kvisco%ziplink.net Exp $
|
||||
* $Id: DOMHelper.cpp,v 1.3 2000/06/11 11:42:20 Peter.VanderBeken%pandora.be Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
* A class used to overcome DOM 1.0 deficiencies
|
||||
* @author <a href="mailto:kvisco@ziplink.net">Keith Visco</a>
|
||||
* @version $Revision: 1.2 $ $Date: 2000/04/19 10:31:23 $
|
||||
* @version $Revision: 1.3 $ $Date: 2000/06/11 11:42:20 $
|
||||
**/
|
||||
|
||||
#include "DOMHelper.h"
|
||||
|
@ -156,8 +156,6 @@ void DOMHelper::addParentReference(Node* child, Node* parent) {
|
|||
void DOMHelper::continueIndexing(Node* node) {
|
||||
if (!node) return;
|
||||
|
||||
|
||||
|
||||
MITREObjectWrapper* wrapper = 0;
|
||||
|
||||
//-- get indexing information
|
||||
|
@ -167,7 +165,7 @@ void DOMHelper::continueIndexing(Node* node) {
|
|||
while (iter->hasNext()) {
|
||||
idxState = (IndexState*)iter->next();
|
||||
if (idxState->document == doc) break;
|
||||
idxState = 0;
|
||||
idxState = 0;
|
||||
}
|
||||
|
||||
if (!idxState) {
|
||||
|
@ -175,7 +173,7 @@ void DOMHelper::continueIndexing(Node* node) {
|
|||
indexes.add(idxState);
|
||||
idxState->document = doc;
|
||||
idxState->next = doc->getDocumentElement();
|
||||
if (!idxState->next) idxState->done = MB_TRUE;
|
||||
if (!idxState->next) idxState->done = MB_TRUE;
|
||||
}
|
||||
|
||||
if (idxState->done) return;
|
||||
|
@ -188,36 +186,36 @@ void DOMHelper::continueIndexing(Node* node) {
|
|||
if (!idxState->next) {
|
||||
idxState->done = MB_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!alreadyProcessed) {
|
||||
//-- index attributes
|
||||
if (idxState->next->getNodeType() == Node::ELEMENT_NODE) {
|
||||
Element* element = (Element*)idxState->next;
|
||||
//-- index attributes
|
||||
if (idxState->next->getNodeType() == Node::ELEMENT_NODE) {
|
||||
Element* element = (Element*)idxState->next;
|
||||
NamedNodeMap* atts = element->getAttributes();
|
||||
if (atts) {
|
||||
for (int i = 0; i < atts->getLength(); i++) {
|
||||
Node* tmpNode = atts->item(i);
|
||||
if (atts) {
|
||||
for (int i = 0; i < atts->getLength(); i++) {
|
||||
Node* tmpNode = atts->item(i);
|
||||
addParentReference(tmpNode, element);
|
||||
if (node == tmpNode) found = MB_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-- set next node to check
|
||||
if ((!alreadyProcessed) && (idxState->next->hasChildNodes())) {
|
||||
Node* child = idxState->next->getFirstChild();
|
||||
Node* child = idxState->next->getFirstChild();
|
||||
idxState->next = child;
|
||||
}
|
||||
}
|
||||
else if (idxState->next->getNextSibling()) {
|
||||
idxState->next = idxState->next->getNextSibling();
|
||||
idxState->next = idxState->next->getNextSibling();
|
||||
alreadyProcessed = MB_FALSE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
idxState->next = getParentNode(idxState->next);
|
||||
idxState->next = getParentNode(idxState->next);
|
||||
alreadyProcessed = MB_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} //-- continueIndexing
|
||||
|
@ -240,11 +238,11 @@ int DOMHelper::getChildNumber(Node* node) {
|
|||
int c = 0;
|
||||
Node* tmp = node;
|
||||
switch (node->getNodeType()) {
|
||||
case Node::DOCUMENT_NODE:
|
||||
case Node::ATTRIBUTE_NODE:
|
||||
break;
|
||||
default:
|
||||
while (tmp = tmp->getPreviousSibling()) ++c;
|
||||
case Node::DOCUMENT_NODE:
|
||||
case Node::ATTRIBUTE_NODE:
|
||||
break;
|
||||
default:
|
||||
while (tmp = tmp->getPreviousSibling()) ++c;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -266,15 +264,15 @@ OrderInfo* DOMHelper::getDocumentOrder(Node* node) {
|
|||
OrderInfo* orderInfo = (OrderInfo*)orders.retrieve(key);
|
||||
|
||||
if (!orderInfo) {
|
||||
if (node->getNodeType() == Node::DOCUMENT_NODE) {
|
||||
orderInfo = new OrderInfo();
|
||||
if (node->getNodeType() == Node::DOCUMENT_NODE) {
|
||||
orderInfo = new OrderInfo();
|
||||
orderInfo->size = 1;
|
||||
orderInfo->order = new int[1];
|
||||
orderInfo->order[0] = 0;
|
||||
}
|
||||
else {
|
||||
Node* parent = getParentNode(node);
|
||||
OrderInfo* parentOrder = getDocumentOrder(parent);
|
||||
Node* parent = getParentNode(node);
|
||||
OrderInfo* parentOrder = getDocumentOrder(parent);
|
||||
orderInfo = new OrderInfo();
|
||||
|
||||
if (parentOrder) {
|
||||
|
@ -282,15 +280,15 @@ OrderInfo* DOMHelper::getDocumentOrder(Node* node) {
|
|||
orderInfo->order = new int[orderInfo->size];
|
||||
int c = 0;
|
||||
for ( ; c < parentOrder->size; c++)
|
||||
orderInfo->order[c] = parentOrder->order[c];
|
||||
orderInfo->order[c] = parentOrder->order[c];
|
||||
orderInfo->order[c] = getChildNumber(node);
|
||||
}
|
||||
else {
|
||||
orderInfo->size = 1;
|
||||
orderInfo->order = new int[1];
|
||||
orderInfo->order[0] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
orders.add(orderInfo, key);
|
||||
}
|
||||
|
||||
|
@ -347,7 +345,7 @@ int OrderInfo::compareTo(OrderInfo* orderInfo) {
|
|||
|
||||
int c = 0;
|
||||
while ( (c < size) && (c < orderInfo->size)) {
|
||||
if (order[c] < orderInfo->order[c]) return -1;
|
||||
if (order[c] < orderInfo->order[c]) return -1;
|
||||
else if (order[c] > orderInfo->order[c]) return 1;
|
||||
++c;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
* Keith Visco, kvisco@ziplink.net
|
||||
* -- original author.
|
||||
*
|
||||
* $Id: DOMHelper.h,v 1.3 2000/04/19 10:31:32 kvisco%ziplink.net Exp $
|
||||
* $Id: DOMHelper.h,v 1.4 2000/06/11 11:42:23 Peter.VanderBeken%pandora.be Exp $
|
||||
*/
|
||||
|
||||
#ifndef TRANSFRMX_DOMHELPER_H
|
||||
|
@ -59,7 +59,7 @@ class OrderInfo : public MITREObject {
|
|||
/**
|
||||
* A class used to overcome DOM 1.0 deficiencies
|
||||
* @author <a href="mailto:kvisco@ziplink.net">Keith Visco</a>
|
||||
* @version $Revision: 1.3 $ $Date: 2000/04/19 10:31:32 $
|
||||
* @version $Revision: 1.4 $ $Date: 2000/06/11 11:42:23 $
|
||||
**/
|
||||
class DOMHelper {
|
||||
|
||||
|
@ -72,7 +72,7 @@ public:
|
|||
|
||||
/**
|
||||
* Deletes this DOMHelper
|
||||
**/
|
||||
**/
|
||||
virtual ~DOMHelper();
|
||||
|
||||
/**
|
||||
|
@ -115,8 +115,8 @@ private:
|
|||
|
||||
|
||||
/**
|
||||
* Adds the given child/parent mapping to the list of parents
|
||||
**/
|
||||
* Adds the given child/parent mapping to the list of parents
|
||||
**/
|
||||
void addParentReference(Node* child, Node* parent);
|
||||
|
||||
/**
|
||||
|
@ -131,7 +131,7 @@ private:
|
|||
* DocumentOrder of
|
||||
* @return the DocumentOrder for the given Node
|
||||
**/
|
||||
OrderInfo* getDocumentOrder(Node* node);
|
||||
OrderInfo* getDocumentOrder(Node* node);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -141,7 +141,7 @@ private:
|
|||
|
||||
/**
|
||||
* A Hashtable of Node/OrderInfo mappings
|
||||
**/
|
||||
**/
|
||||
HashTable orders;
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
* Marina Mechtcheriakova, mmarina@mindspring.com
|
||||
* -- added lang() implementation
|
||||
*
|
||||
* $Id: BooleanFunctionCall.cpp,v 1.4 2000/05/23 08:24:33 kvisco%ziplink.net Exp $
|
||||
* $Id: BooleanFunctionCall.cpp,v 1.5 2000/06/11 11:41:34 Peter.VanderBeken%pandora.be Exp $
|
||||
*/
|
||||
|
||||
#include "FunctionLib.h"
|
||||
|
@ -32,7 +32,7 @@
|
|||
/**
|
||||
* Creates a default BooleanFunctionCall, which always evaluates to False
|
||||
* @author <A HREF="mailto:kvisco@ziplink.net">Keith Visco</A>
|
||||
* @version $Revision: 1.4 $ $Date: 2000/05/23 08:24:33 $
|
||||
* @version $Revision: 1.5 $ $Date: 2000/06/11 11:41:34 $
|
||||
**/
|
||||
BooleanFunctionCall::BooleanFunctionCall() : FunctionCall(XPathNames::FALSE_FN) {
|
||||
this->type = TX_FALSE;
|
||||
|
@ -48,8 +48,8 @@ BooleanFunctionCall::BooleanFunctionCall(short type) : FunctionCall()
|
|||
FunctionCall::setName(XPathNames::BOOLEAN_FN);
|
||||
break;
|
||||
case TX_LANG:
|
||||
FunctionCall::setName(XPathNames::LANG_FN);
|
||||
break;
|
||||
FunctionCall::setName(XPathNames::LANG_FN);
|
||||
break;
|
||||
case TX_NOT :
|
||||
FunctionCall::setName(XPathNames::NOT_FN);
|
||||
break;
|
||||
|
@ -93,11 +93,11 @@ ExprResult* BooleanFunctionCall::evaluate(Node* context, ContextState* cs) {
|
|||
String arg1, lang;
|
||||
evaluateToString((Expr*)iter->next(),context, cs, arg1);
|
||||
lang = ((Element*)context)->getAttribute(LANG_ATTR);
|
||||
arg1.toUpperCase(); // case-insensitive comparison
|
||||
lang.toUpperCase();
|
||||
arg1.toUpperCase(); // case-insensitive comparison
|
||||
lang.toUpperCase();
|
||||
result->setValue((MBool)(lang.indexOf(arg1) == 0));
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case TX_NOT :
|
||||
if ( requireParams(1,1,cs) ) {
|
||||
param = (Expr*)iter->next();
|
||||
|
|
|
@ -21,13 +21,13 @@
|
|||
* Keith Visco, kvisco@ziplink.net
|
||||
* -- original author.
|
||||
*
|
||||
* $Id: BooleanResult.cpp,v 1.4 2000/04/13 14:14:02 Peter.VanderBeken%pandora.be Exp $
|
||||
* $Id: BooleanResult.cpp,v 1.5 2000/06/11 11:41:38 Peter.VanderBeken%pandora.be Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Boolean Expression result
|
||||
* @author <A href="mailto:kvisco@ziplink.net">Keith Visco</A>
|
||||
* @version $Revision: 1.4 $ $Date: 2000/04/13 14:14:02 $
|
||||
* @version $Revision: 1.5 $ $Date: 2000/06/11 11:41:38 $
|
||||
**/
|
||||
|
||||
#include "ExprResult.h"
|
||||
|
@ -83,7 +83,7 @@ short BooleanResult::getResultType() {
|
|||
return ExprResult::BOOLEAN;
|
||||
} //-- getResultType
|
||||
|
||||
void BooleanResult::stringValue(DOMString& str) {
|
||||
void BooleanResult::stringValue(String& str) {
|
||||
if ( value ) str.append("true");
|
||||
else str.append("false");
|
||||
} //-- toString
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
* - changed constant short declarations in many of the classes
|
||||
* with enumerations, commented with //--LF
|
||||
*
|
||||
* $Id: Expr.h,v 1.4 2000/04/19 10:35:49 kvisco%ziplink.net Exp $
|
||||
* $Id: Expr.h,v 1.5 2000/06/11 11:42:46 Peter.VanderBeken%pandora.be Exp $
|
||||
*/
|
||||
|
||||
|
||||
|
@ -44,7 +44,7 @@
|
|||
/*
|
||||
XPath class definitions.
|
||||
Much of this code was ported from XSL:P.
|
||||
@version $Revision: 1.4 $ $Date: 2000/04/19 10:35:49 $
|
||||
@version $Revision: 1.5 $ $Date: 2000/06/11 11:42:46 $
|
||||
*/
|
||||
|
||||
#ifndef TRANSFRMX_EXPR_H
|
||||
|
@ -100,7 +100,7 @@ public:
|
|||
* @param nodes the NodeSet to sort
|
||||
* <BR />
|
||||
* <B>Note:</B> I will be moving this functionality elsewhere soon
|
||||
**/
|
||||
**/
|
||||
virtual void sortByDocumentOrder(NodeSet* nodes) = 0;
|
||||
|
||||
}; //-- ContextState
|
||||
|
|
|
@ -29,13 +29,13 @@
|
|||
* -- Fixed bug in parse method so that we make sure we check for
|
||||
* axis identifier wild cards, such as ancestor::*
|
||||
*
|
||||
* $Id: ExprLexer.cpp,v 1.4 2000/05/16 09:34:00 kvisco%ziplink.net Exp $
|
||||
* $Id: ExprLexer.cpp,v 1.5 2000/06/11 11:42:57 Peter.VanderBeken%pandora.be Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Lexical analyzer for XPath expressions
|
||||
* @author <a href="mailto:kvisco@ziplink.net">Keith Visco</a>
|
||||
* @version $Revision: 1.4 $ $Date: 2000/05/16 09:34:00 $
|
||||
* @version $Revision: 1.5 $ $Date: 2000/06/11 11:42:57 $
|
||||
**/
|
||||
|
||||
#include <iostream.h>
|
||||
|
@ -564,7 +564,7 @@ void ExprLexer::parse(const String& pattern) {
|
|||
case TX_LF:
|
||||
break;
|
||||
case S_QUOTE :
|
||||
case D_QUOTE :
|
||||
case D_QUOTE :
|
||||
matchToken(tokenBuffer, ch);
|
||||
inLiteral = ch;
|
||||
break;
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
* -- fixed bug in ::parsePredicates,
|
||||
* made sure we continue looking for more predicates.
|
||||
*
|
||||
* $Id: ExprParser.cpp,v 1.5 2000/05/23 08:30:09 kvisco%ziplink.net Exp $
|
||||
* $Id: ExprParser.cpp,v 1.6 2000/06/11 11:43:02 Peter.VanderBeken%pandora.be Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -38,7 +38,7 @@
|
|||
* This class is used to parse XSL Expressions
|
||||
* @author <A HREF="mailto:kvisco@ziplink.net">Keith Visco</A>
|
||||
* @see ExprLexer
|
||||
* @version $Revision: 1.5 $ $Date: 2000/05/23 08:30:09 $
|
||||
* @version $Revision: 1.6 $ $Date: 2000/06/11 11:43:02 $
|
||||
**/
|
||||
|
||||
#include "ExprParser.h"
|
||||
|
@ -676,11 +676,11 @@ PathExpr* ExprParser::createPathExpr(ExprLexer& lexer) {
|
|||
case Token::R_PAREN:
|
||||
case Token::R_BRACKET:
|
||||
case Token::UNION_OP:
|
||||
//Marina, addition start
|
||||
// When parsing a list of parameters for a function comma should signal a spot
|
||||
// without it further processing pathExpr was causing "invalid token" error
|
||||
case Token::COMMA:
|
||||
// Marina, addition ends
|
||||
//Marina, addition start
|
||||
// When parsing a list of parameters for a function comma should signal a spot
|
||||
// without it further processing pathExpr was causing "invalid token" error
|
||||
case Token::COMMA:
|
||||
// Marina, addition ends
|
||||
lexer.pushBack();
|
||||
return pathExpr;
|
||||
case Token::ANCESTOR_OP :
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
* Larry Fitzpatrick, OpenText, lef@opentext.com
|
||||
* -- changed constant short result types to enum
|
||||
*
|
||||
* $Id: ExprResult.h,v 1.5 2000/04/13 23:41:43 Peter.VanderBeken%pandora.be Exp $
|
||||
* $Id: ExprResult.h,v 1.6 2000/06/11 11:43:07 Peter.VanderBeken%pandora.be Exp $
|
||||
*/
|
||||
|
||||
#include "MITREObject.h"
|
||||
|
@ -42,7 +42,7 @@
|
|||
* <BR/>
|
||||
* Note: for NodeSet, see NodeSet.h <BR />
|
||||
* @author <A HREF="mailto:kvisco@ziplink.net">Keith Visco</A>
|
||||
* @version $Revision: 1.5 $ $Date: 2000/04/13 23:41:43 $
|
||||
* @version $Revision: 1.6 $ $Date: 2000/06/11 11:43:07 $
|
||||
*/
|
||||
|
||||
class ExprResult : public MITREObject {
|
||||
|
@ -69,7 +69,7 @@ public:
|
|||
* Creates a String representation of this ExprResult
|
||||
* @param str the destination string to append the String representation to.
|
||||
**/
|
||||
virtual void stringValue(DOMString& str) = 0;
|
||||
virtual void stringValue(String& str) = 0;
|
||||
|
||||
/**
|
||||
* Converts this ExprResult to a Boolean (MBool) value
|
||||
|
@ -100,7 +100,7 @@ public:
|
|||
void setValue(const BooleanResult& boolResult);
|
||||
|
||||
virtual short getResultType();
|
||||
virtual void stringValue(DOMString& str);
|
||||
virtual void stringValue(String& str);
|
||||
virtual MBool booleanValue();
|
||||
virtual double numberValue();
|
||||
|
||||
|
@ -125,7 +125,7 @@ public:
|
|||
MBool isNaN() const;
|
||||
|
||||
virtual short getResultType();
|
||||
virtual void stringValue(DOMString& str);
|
||||
virtual void stringValue(String& str);
|
||||
virtual MBool booleanValue();
|
||||
virtual double numberValue();
|
||||
|
||||
|
@ -148,7 +148,7 @@ public:
|
|||
void setValue(const String& str);
|
||||
|
||||
virtual short getResultType();
|
||||
virtual void stringValue(DOMString& str);
|
||||
virtual void stringValue(String& str);
|
||||
virtual MBool booleanValue();
|
||||
virtual double numberValue();
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* Marina Mechtcheriakova
|
||||
* -- added support for lang function
|
||||
*
|
||||
* $Id: FunctionLib.h,v 1.6 2000/05/23 08:17:42 kvisco%ziplink.net Exp $
|
||||
* $Id: FunctionLib.h,v 1.7 2000/06/11 11:43:12 Peter.VanderBeken%pandora.be Exp $
|
||||
*/
|
||||
|
||||
#include "TxString.h"
|
||||
|
@ -345,9 +345,9 @@ public:
|
|||
|
||||
enum numberFunctions {
|
||||
NUMBER = 1, //-- number()
|
||||
ROUND, //-- round()
|
||||
FLOOR, //-- floor()
|
||||
CEILING //-- ceiling()
|
||||
ROUND, //-- round()
|
||||
FLOOR, //-- floor()
|
||||
CEILING //-- ceiling()
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
**/
|
||||
DocumentFunctionCall::DocumentFunctionCall(Document* xslDocument) : FunctionCall(DOCUMENT_FN)
|
||||
{
|
||||
this->xslDocument = xslDocument;
|
||||
this->xslDocument = xslDocument;
|
||||
} //-- DocumentFunctionCall
|
||||
|
||||
|
||||
|
@ -63,58 +63,58 @@ ExprResult* DocumentFunctionCall::evaluate(Node* context, ContextState* cs) {
|
|||
|
||||
//-- document( object, node-set? )
|
||||
if ( requireParams(1, 2, cs) ) {
|
||||
ListIterator* iter = params.iterator();
|
||||
Expr* param1 = (Expr*) iter->next();
|
||||
ExprResult* exprResult1 = param1->evaluate(context, cs);
|
||||
NodeSet* nodeSet2 = 0;
|
||||
ListIterator* iter = params.iterator();
|
||||
Expr* param1 = (Expr*) iter->next();
|
||||
ExprResult* exprResult1 = param1->evaluate(context, cs);
|
||||
NodeSet* nodeSet2 = 0;
|
||||
|
||||
if (iter->hasNext()) {
|
||||
// we have 2 arguments, make sure the second is a NodeSet
|
||||
Expr* param2 = (Expr*) iter->next();
|
||||
ExprResult* exprResult2 = param2->evaluate(context, cs);
|
||||
if ( exprResult2->getResultType() != ExprResult::NODESET ) {
|
||||
String err("node-set expected as second argument to document()");
|
||||
cs->recieveError(err);
|
||||
delete exprResult2;
|
||||
}
|
||||
else {
|
||||
nodeSet2 = (NodeSet*) exprResult2;
|
||||
}
|
||||
}
|
||||
if (iter->hasNext()) {
|
||||
// we have 2 arguments, make sure the second is a NodeSet
|
||||
Expr* param2 = (Expr*) iter->next();
|
||||
ExprResult* exprResult2 = param2->evaluate(context, cs);
|
||||
if ( exprResult2->getResultType() != ExprResult::NODESET ) {
|
||||
String err("node-set expected as second argument to document()");
|
||||
cs->recieveError(err);
|
||||
delete exprResult2;
|
||||
}
|
||||
else {
|
||||
nodeSet2 = (NodeSet*) exprResult2;
|
||||
}
|
||||
}
|
||||
|
||||
if ( exprResult1->getResultType() == ExprResult::NODESET ) {
|
||||
// The first argument is a NodeSet, iterate on its nodes
|
||||
NodeSet* nodeSet1 = (NodeSet*) exprResult1;
|
||||
for (int i=0; i<nodeSet1->size(); i++) {
|
||||
Node* node = nodeSet1->get(i);
|
||||
DOMString uriStr;
|
||||
XMLDOMUtils::getNodeValue(node, &uriStr);
|
||||
if (nodeSet2) {
|
||||
// if the second argument was specified, use it
|
||||
String baseUriStr;
|
||||
// TODO: retrieve the base URI of the first node of nodeSet2 in document order
|
||||
retrieveDocument(uriStr, baseUriStr, *nodeSet, cs);
|
||||
}
|
||||
else {
|
||||
// otherwise, use the base URI of the node itself
|
||||
String baseUriStr;
|
||||
// TODO: retrieve the base URI of node
|
||||
retrieveDocument(uriStr, baseUriStr, *nodeSet, cs);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( exprResult1->getResultType() == ExprResult::NODESET ) {
|
||||
// The first argument is a NodeSet, iterate on its nodes
|
||||
NodeSet* nodeSet1 = (NodeSet*) exprResult1;
|
||||
for (int i=0; i<nodeSet1->size(); i++) {
|
||||
Node* node = nodeSet1->get(i);
|
||||
String uriStr;
|
||||
XMLDOMUtils::getNodeValue(node, &uriStr);
|
||||
if (nodeSet2) {
|
||||
// if the second argument was specified, use it
|
||||
String baseUriStr;
|
||||
// TODO: retrieve the base URI of the first node of nodeSet2 in document order
|
||||
retrieveDocument(uriStr, baseUriStr, *nodeSet, cs);
|
||||
}
|
||||
else {
|
||||
// otherwise, use the base URI of the node itself
|
||||
String baseUriStr;
|
||||
// TODO: retrieve the base URI of node
|
||||
retrieveDocument(uriStr, baseUriStr, *nodeSet, cs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
// The first argument is not a NodeSet
|
||||
String uriStr;
|
||||
evaluateToString(param1, context, cs, uriStr);
|
||||
String baseUriStr;
|
||||
// TODO: retrieve the base URI of the first node of nodeSet2 in document order
|
||||
retrieveDocument(uriStr, baseUriStr, *nodeSet, cs);
|
||||
}
|
||||
delete exprResult1;
|
||||
delete nodeSet2;
|
||||
delete iter;
|
||||
else {
|
||||
// The first argument is not a NodeSet
|
||||
String uriStr;
|
||||
evaluateToString(param1, context, cs, uriStr);
|
||||
String baseUriStr;
|
||||
// TODO: retrieve the base URI of the first node of nodeSet2 in document order
|
||||
retrieveDocument(uriStr, baseUriStr, *nodeSet, cs);
|
||||
}
|
||||
delete exprResult1;
|
||||
delete nodeSet2;
|
||||
delete iter;
|
||||
}
|
||||
|
||||
return nodeSet;
|
||||
|
@ -134,34 +134,34 @@ ExprResult* DocumentFunctionCall::evaluate(Node* context, ContextState* cs) {
|
|||
*/
|
||||
void DocumentFunctionCall::retrieveDocument(String& uri, String& baseUri, NodeSet& resultNodeSet, ContextState* cs)
|
||||
{
|
||||
if (uri.length() == 0) {
|
||||
// if uri is the empty String, the document is the stylesheet itself
|
||||
resultNodeSet.add(xslDocument);
|
||||
return;
|
||||
}
|
||||
if (uri.length() == 0) {
|
||||
// if uri is the empty String, the document is the stylesheet itself
|
||||
resultNodeSet.add(xslDocument);
|
||||
return;
|
||||
}
|
||||
|
||||
// open URI
|
||||
String errMsg("error: ");
|
||||
istream* xmlInput = URIUtils::getInputStream(uri, baseUri, errMsg);
|
||||
if (!xmlInput) {
|
||||
String err("in document() function: failed to open URI: ");
|
||||
err.append(uri);
|
||||
cs->recieveError(err);
|
||||
return;
|
||||
}
|
||||
// open URI
|
||||
String errMsg("error: ");
|
||||
istream* xmlInput = URIUtils::getInputStream(uri, baseUri, errMsg);
|
||||
if (!xmlInput) {
|
||||
String err("in document() function: failed to open URI: ");
|
||||
err.append(uri);
|
||||
cs->recieveError(err);
|
||||
return;
|
||||
}
|
||||
|
||||
// parse document
|
||||
XMLParser xmlParser;
|
||||
Document* xmlDoc = xmlParser.parse(*xmlInput);
|
||||
if (!xmlDoc) {
|
||||
String err("in document() function: ");
|
||||
err.append(xmlParser.getErrorString());
|
||||
cs->recieveError(err);
|
||||
return;
|
||||
}
|
||||
// parse document
|
||||
XMLParser xmlParser;
|
||||
Document* xmlDoc = xmlParser.parse(*xmlInput);
|
||||
if (!xmlDoc) {
|
||||
String err("in document() function: ");
|
||||
err.append(xmlParser.getErrorString());
|
||||
cs->recieveError(err);
|
||||
return;
|
||||
}
|
||||
|
||||
// append the to resultNodeSet
|
||||
resultNodeSet.add(xmlDoc);
|
||||
// append the to resultNodeSet
|
||||
resultNodeSet.add(xmlDoc);
|
||||
}
|
||||
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче