Removing DOMString/Cleaning up some whitespace. Not part of build yet. a=leaf.
git-svn-id: svn://10.0.0.236/trunk@183437 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
|
||||
#include "dom.h"
|
||||
|
||||
NodeDefinition::NodeDefinition(NodeType type, const DOMString& name,
|
||||
const DOMString& value, Document* owner)
|
||||
NodeDefinition::NodeDefinition(NodeType type, const String& name,
|
||||
const String& value, Document* owner)
|
||||
{
|
||||
|
||||
nodeName = name;
|
||||
@@ -84,17 +84,17 @@ void NodeDefinition::DeleteChildren()
|
||||
lastChild = NULL;
|
||||
}
|
||||
|
||||
const DOMString& NodeDefinition::getNodeName() const
|
||||
const String& NodeDefinition::getNodeName() const
|
||||
{
|
||||
return nodeName;
|
||||
}
|
||||
|
||||
const DOMString& NodeDefinition::getNodeValue() const
|
||||
const String& NodeDefinition::getNodeValue() const
|
||||
{
|
||||
return nodeValue;
|
||||
}
|
||||
|
||||
const DOMString& NodeDefinition::getNodeValue()
|
||||
const String& NodeDefinition::getNodeValue()
|
||||
{
|
||||
return nodeValue;
|
||||
}
|
||||
@@ -165,7 +165,7 @@ Int32 NodeDefinition::getLength()
|
||||
return length;
|
||||
}
|
||||
|
||||
void NodeDefinition::setNodeValue(const DOMString& newNodeValue)
|
||||
void NodeDefinition::setNodeValue(const String& newNodeValue)
|
||||
{
|
||||
nodeValue = newNodeValue;
|
||||
}
|
||||
@@ -344,7 +344,7 @@ Node* NodeDefinition::appendChild(Node* newChild)
|
||||
|
||||
Node* NodeDefinition::cloneNode(MBool deep, Node* dest)
|
||||
{
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
MBool NodeDefinition::hasChildNodes() const
|
||||
|
||||
@@ -33,8 +33,8 @@
|
||||
//
|
||||
//Construct a text object with the specified document owner and data
|
||||
//
|
||||
ProcessingInstruction::ProcessingInstruction(const DOMString& theTarget,
|
||||
const DOMString& theData,
|
||||
ProcessingInstruction::ProcessingInstruction(const String& theTarget,
|
||||
const String& theData,
|
||||
Document* owner) :
|
||||
NodeDefinition(Node::PROCESSING_INSTRUCTION_NODE,
|
||||
theTarget, theData, owner)
|
||||
@@ -45,7 +45,7 @@ ProcessingInstruction::ProcessingInstruction(const DOMString& theTarget,
|
||||
//Return the Target of the processing instruction. This is simply the
|
||||
//nodeName.
|
||||
//
|
||||
const DOMString& ProcessingInstruction::getTarget() const
|
||||
const String& ProcessingInstruction::getTarget() const
|
||||
{
|
||||
return nodeName;
|
||||
}
|
||||
@@ -54,14 +54,14 @@ const DOMString& ProcessingInstruction::getTarget() const
|
||||
//Return the Data of the processing instruction. This is simply the value
|
||||
//of the node, "nodeValue"
|
||||
//
|
||||
const DOMString& ProcessingInstruction::getData() const
|
||||
const String& ProcessingInstruction::getData() const
|
||||
{
|
||||
return nodeValue;
|
||||
}
|
||||
|
||||
//
|
||||
//Set the Data element of the processing instruction.
|
||||
void ProcessingInstruction::setData(const DOMString& theData)
|
||||
void ProcessingInstruction::setData(const String& theData)
|
||||
{
|
||||
nodeValue = theData;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
* Marina Mechtcheriakova, mmarina@mindspring.com
|
||||
* -- added lang() implementation
|
||||
*
|
||||
* $Id: txBooleanFunctionCall.cpp,v 1.4 2005-11-02 07:33:37 kvisco%ziplink.net Exp $
|
||||
* $Id: txBooleanFunctionCall.cpp,v 1.5 2005-11-02 07:33:38 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: 2005-11-02 07:33:37 $
|
||||
* @version $Revision: 1.5 $ $Date: 2005-11-02 07:33:38 $
|
||||
**/
|
||||
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: txBooleanResult.cpp,v 1.4 2005-11-02 07:33:49 Peter.VanderBeken%pandora.be Exp $
|
||||
* $Id: txBooleanResult.cpp,v 1.5 2005-11-02 07:33:50 Peter.VanderBeken%pandora.be Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Boolean Expression result
|
||||
* @author <A href="mailto:kvisco@ziplink.net">Keith Visco</A>
|
||||
* @version $Revision: 1.4 $ $Date: 2005-11-02 07:33:49 $
|
||||
* @version $Revision: 1.5 $ $Date: 2005-11-02 07:33:50 $
|
||||
**/
|
||||
|
||||
#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: txExpr.h,v 1.4 2005-11-02 07:33:29 kvisco%ziplink.net Exp $
|
||||
* $Id: txExpr.h,v 1.5 2005-11-02 07:33:30 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: 2005-11-02 07:33:29 $
|
||||
@version $Revision: 1.5 $ $Date: 2005-11-02 07:33:30 $
|
||||
*/
|
||||
|
||||
#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: txExprLexer.cpp,v 1.4 2005-11-02 07:33:43 kvisco%ziplink.net Exp $
|
||||
* $Id: txExprLexer.cpp,v 1.5 2005-11-02 07:33:44 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: 2005-11-02 07:33:43 $
|
||||
* @version $Revision: 1.5 $ $Date: 2005-11-02 07:33:44 $
|
||||
**/
|
||||
|
||||
#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: txExprParser.cpp,v 1.5 2005-11-02 07:33:29 kvisco%ziplink.net Exp $
|
||||
* $Id: txExprParser.cpp,v 1.6 2005-11-02 07:33:30 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: 2005-11-02 07:33:29 $
|
||||
* @version $Revision: 1.6 $ $Date: 2005-11-02 07:33:30 $
|
||||
**/
|
||||
|
||||
#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: txExprResult.h,v 1.5 2005-11-02 07:33:47 Peter.VanderBeken%pandora.be Exp $
|
||||
* $Id: txExprResult.h,v 1.6 2005-11-02 07:33:48 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: 2005-11-02 07:33:47 $
|
||||
* @version $Revision: 1.6 $ $Date: 2005-11-02 07:33:48 $
|
||||
*/
|
||||
|
||||
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: txFunctionLib.h,v 1.6 2005-11-02 07:33:48 kvisco%ziplink.net Exp $
|
||||
* $Id: txFunctionLib.h,v 1.7 2005-11-02 07:33:49 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()
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
* Nisheeth Ranjan, nisheeth@netscape.com
|
||||
* -- implemented rint function, which was not available on Windows.
|
||||
*
|
||||
* $Id: txNumberFunctionCall.cpp,v 1.5 2005-11-02 07:33:40 kvisco%ziplink.net Exp $
|
||||
* $Id: txNumberFunctionCall.cpp,v 1.6 2005-11-02 07:33:41 Peter.VanderBeken%pandora.be Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -50,18 +50,18 @@ NumberFunctionCall::NumberFunctionCall(short type) : FunctionCall() {
|
||||
this->type = type;
|
||||
switch ( type ) {
|
||||
case ROUND :
|
||||
FunctionCall::setName(XPathNames::ROUND_FN);
|
||||
break;
|
||||
FunctionCall::setName(XPathNames::ROUND_FN);
|
||||
break;
|
||||
case CEILING :
|
||||
FunctionCall::setName(XPathNames::CEILING_FN);
|
||||
break;
|
||||
FunctionCall::setName(XPathNames::CEILING_FN);
|
||||
break;
|
||||
case FLOOR :
|
||||
FunctionCall::setName(XPathNames::FLOOR_FN);
|
||||
break;
|
||||
FunctionCall::setName(XPathNames::FLOOR_FN);
|
||||
break;
|
||||
case NUMBER :
|
||||
default :
|
||||
FunctionCall::setName(XPathNames::NUMBER_FN);
|
||||
break;
|
||||
FunctionCall::setName(XPathNames::NUMBER_FN);
|
||||
break;
|
||||
}
|
||||
} //-- NumberFunctionCall
|
||||
|
||||
@@ -72,7 +72,7 @@ static double rint(double r)
|
||||
double fraction = 0;
|
||||
fraction = modf(r, &integerPart);
|
||||
if (fraction >= 0.5)
|
||||
integerPart++;
|
||||
integerPart++;
|
||||
|
||||
return integerPart;
|
||||
}
|
||||
@@ -94,69 +94,69 @@ ExprResult* NumberFunctionCall::evaluate(Node* context, ContextState* cs) {
|
||||
|
||||
switch ( type ) {
|
||||
case CEILING :
|
||||
if ( requireParams(1, 1, cs) ) {
|
||||
double dbl = evaluateToNumber((Expr*)iter->next(), context, cs);
|
||||
result->setValue(ceil(dbl));
|
||||
}
|
||||
else {
|
||||
result->setValue(0.0);
|
||||
}
|
||||
break;
|
||||
if ( requireParams(1, 1, cs) ) {
|
||||
double dbl = evaluateToNumber((Expr*)iter->next(), context, cs);
|
||||
result->setValue(ceil(dbl));
|
||||
}
|
||||
else {
|
||||
result->setValue(0.0);
|
||||
}
|
||||
break;
|
||||
|
||||
case FLOOR :
|
||||
if ( requireParams(1, 1, cs) ) {
|
||||
double dbl = evaluateToNumber((Expr*)iter->next(), context, cs);
|
||||
result->setValue(floor(dbl));
|
||||
}
|
||||
else {
|
||||
result->setValue(0.0);
|
||||
}
|
||||
break;
|
||||
if ( requireParams(1, 1, cs) ) {
|
||||
double dbl = evaluateToNumber((Expr*)iter->next(), context, cs);
|
||||
result->setValue(floor(dbl));
|
||||
}
|
||||
else {
|
||||
result->setValue(0.0);
|
||||
}
|
||||
break;
|
||||
|
||||
case ROUND :
|
||||
if ( requireParams(1, 1, cs) ) {
|
||||
double dbl = evaluateToNumber((Expr*)iter->next(), context, cs);
|
||||
double res = rint(dbl);
|
||||
if ((dbl>0.0) && (res == dbl-0.5)) {
|
||||
// fix for native round function from math library (rint()) which does not
|
||||
// match the XPath spec for positive half values
|
||||
result->setValue(res+1.0);
|
||||
}
|
||||
else {
|
||||
result->setValue(res);
|
||||
}
|
||||
break;
|
||||
}
|
||||
else result->setValue(0.0);
|
||||
break;
|
||||
if ( requireParams(1, 1, cs) ) {
|
||||
double dbl = evaluateToNumber((Expr*)iter->next(), context, cs);
|
||||
double res = rint(dbl);
|
||||
if ((dbl>0.0) && (res == dbl-0.5)) {
|
||||
// fix for native round function from math library (rint()) which does not
|
||||
// match the XPath spec for positive half values
|
||||
result->setValue(res+1.0);
|
||||
}
|
||||
else {
|
||||
result->setValue(res);
|
||||
}
|
||||
break;
|
||||
}
|
||||
else result->setValue(0.0);
|
||||
break;
|
||||
|
||||
case NUMBER :
|
||||
default : //-- number( object? )
|
||||
if ( requireParams(0, 1, cs) ) {
|
||||
if (iter->hasNext()) {
|
||||
param = (Expr*) iter->next();
|
||||
ExprResult* exprResult = param->evaluate(context, cs);
|
||||
result->setValue(exprResult->numberValue());
|
||||
delete exprResult;
|
||||
}
|
||||
else {
|
||||
String resultStr;
|
||||
DOMString temp;
|
||||
XMLDOMUtils::getNodeValue(context, &temp);
|
||||
if ( cs->isStripSpaceAllowed(context) ) {
|
||||
XMLUtils::stripSpace(temp, resultStr);
|
||||
}
|
||||
else {
|
||||
resultStr.append(temp);
|
||||
}
|
||||
Double dbl(resultStr);
|
||||
result->setValue(dbl.doubleValue());
|
||||
}
|
||||
}
|
||||
else {
|
||||
result = new NumberResult(0.0);
|
||||
}
|
||||
break;
|
||||
if ( requireParams(0, 1, cs) ) {
|
||||
if (iter->hasNext()) {
|
||||
param = (Expr*) iter->next();
|
||||
ExprResult* exprResult = param->evaluate(context, cs);
|
||||
result->setValue(exprResult->numberValue());
|
||||
delete exprResult;
|
||||
}
|
||||
else {
|
||||
String resultStr;
|
||||
String temp;
|
||||
XMLDOMUtils::getNodeValue(context, &temp);
|
||||
if ( cs->isStripSpaceAllowed(context) ) {
|
||||
XMLUtils::stripSpace(temp, resultStr);
|
||||
}
|
||||
else {
|
||||
resultStr.append(temp);
|
||||
}
|
||||
Double dbl(resultStr);
|
||||
result->setValue(dbl.doubleValue());
|
||||
}
|
||||
}
|
||||
else {
|
||||
result = new NumberResult(0.0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
delete iter;
|
||||
return result;
|
||||
|
||||
@@ -21,14 +21,14 @@
|
||||
* Keith Visco, kvisco@ziplink.net
|
||||
* -- original author.
|
||||
*
|
||||
* $Id: txNumberResult.cpp,v 1.4 2005-11-02 07:33:59 Peter.VanderBeken%pandora.be Exp $
|
||||
* $Id: txNumberResult.cpp,v 1.5 2005-11-02 07:34:00 Peter.VanderBeken%pandora.be Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
* NumberResult
|
||||
* Represents the a number as the result of evaluating an Expr
|
||||
* @author <A HREF="mailto:kvisco@ziplink.net">Keith Visco</A>
|
||||
* @version $Revision: 1.4 $ $Date: 2005-11-02 07:33:59 $
|
||||
* @version $Revision: 1.5 $ $Date: 2005-11-02 07:34:00 $
|
||||
**/
|
||||
|
||||
#include "ExprResult.h"
|
||||
@@ -90,7 +90,7 @@ short NumberResult::getResultType() {
|
||||
return ExprResult::NUMBER;
|
||||
} //-- getResultType
|
||||
|
||||
void NumberResult::stringValue(DOMString& str) {
|
||||
void NumberResult::stringValue(String& str) {
|
||||
int intVal = (int)value;
|
||||
if (intVal == value) { //-- no fraction
|
||||
Integer::toString(intVal, str);
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
* Keith Visco, kvisco@ziplink.net
|
||||
* -- original author.
|
||||
*
|
||||
* $Id: txRelationalExpr.cpp,v 1.2 2005-11-02 07:33:45 Peter.VanderBeken%pandora.be Exp $
|
||||
* $Id: txRelationalExpr.cpp,v 1.3 2005-11-02 07:33:46 Peter.VanderBeken%pandora.be Exp $
|
||||
*/
|
||||
|
||||
#include "Expr.h"
|
||||
@@ -62,7 +62,7 @@ MBool RelationalExpr::compareResults(ExprResult* left, ExprResult* right) {
|
||||
if (ltype == ExprResult::NODESET) {
|
||||
NodeSet* nodeSet = (NodeSet*)left;
|
||||
for ( int i = 0; i < nodeSet->size(); i++) {
|
||||
DOMString str;
|
||||
String str;
|
||||
Node* node = nodeSet->get(i);
|
||||
XMLDOMUtils::getNodeValue(node, &str);
|
||||
StringResult strResult(str);
|
||||
@@ -74,7 +74,7 @@ MBool RelationalExpr::compareResults(ExprResult* left, ExprResult* right) {
|
||||
else if ( rtype == ExprResult::NODESET) {
|
||||
NodeSet* nodeSet = (NodeSet*)right;
|
||||
for ( int i = 0; i < nodeSet->size(); i++) {
|
||||
DOMString str;
|
||||
String str;
|
||||
Node* node = nodeSet->get(i);
|
||||
XMLDOMUtils::getNodeValue(node, &str);
|
||||
StringResult strResult(str);
|
||||
@@ -101,7 +101,7 @@ MBool RelationalExpr::compareResults(ExprResult* left, ExprResult* right) {
|
||||
right->stringValue(rStr);
|
||||
result = !lStr.isEqual(rStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( op == EQUAL) {
|
||||
|
||||
if ((ltype == ExprResult::BOOLEAN)
|
||||
|
||||
@@ -21,14 +21,14 @@
|
||||
* Keith Visco, kvisco@ziplink.net
|
||||
* -- original author.
|
||||
*
|
||||
* $Id: txStringFunctionCall.cpp,v 1.3 2005-11-02 07:33:38 kvisco%ziplink.net Exp $
|
||||
* $Id: txStringFunctionCall.cpp,v 1.4 2005-11-02 07:33:39 Peter.VanderBeken%pandora.be Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
* StringFunctionCall
|
||||
* A representation of the XPath String funtions
|
||||
* @author <A HREF="mailto:kvisco@ziplink.net">Keith Visco</A>
|
||||
* @version $Revision: 1.3 $ $Date: 2005-11-02 07:33:38 $
|
||||
* @version $Revision: 1.4 $ $Date: 2005-11-02 07:33:39 $
|
||||
**/
|
||||
|
||||
#include "FunctionLib.h"
|
||||
@@ -121,7 +121,7 @@ ExprResult* StringFunctionCall::evaluate(Node* context, ContextState* cs) {
|
||||
break;
|
||||
case STRING_LENGTH:
|
||||
if ( requireParams(0, 1, cs) ) {
|
||||
DOMString resultStr;
|
||||
String resultStr;
|
||||
if ( argc == 1) {
|
||||
evaluateToString((Expr*)iter->next(),context, cs, resultStr);
|
||||
}
|
||||
@@ -226,7 +226,7 @@ ExprResult* StringFunctionCall::evaluate(Node* context, ContextState* cs) {
|
||||
evaluateToString((Expr*)iter->next(),context, cs, resultStr);
|
||||
}
|
||||
else {
|
||||
DOMString temp;
|
||||
String temp;
|
||||
XMLDOMUtils::getNodeValue(context, &temp);
|
||||
if ( cs->isStripSpaceAllowed(context) ) {
|
||||
XMLUtils::stripSpace(temp, resultStr);
|
||||
|
||||
@@ -21,14 +21,14 @@
|
||||
* Keith Visco, kvisco@ziplink.net
|
||||
* -- original author.
|
||||
*
|
||||
* $Id: txStringResult.cpp,v 1.4 2005-11-02 07:33:55 Peter.VanderBeken%pandora.be Exp $
|
||||
* $Id: txStringResult.cpp,v 1.5 2005-11-02 07:33:56 Peter.VanderBeken%pandora.be Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
* StringResult
|
||||
* Represents a String as a Result of evaluating an Expr
|
||||
* @author <a href="mailto:kvisco@ziplink.net">Keith Visco</a>
|
||||
* @version $Revision: 1.4 $ $Date: 2005-11-02 07:33:55 $
|
||||
* @version $Revision: 1.5 $ $Date: 2005-11-02 07:33:56 $
|
||||
**/
|
||||
#include "ExprResult.h"
|
||||
|
||||
@@ -81,7 +81,7 @@ short StringResult::getResultType() {
|
||||
return ExprResult::STRING;
|
||||
} //-- getResultType
|
||||
|
||||
void StringResult::stringValue(DOMString& str) {
|
||||
void StringResult::stringValue(String& str) {
|
||||
str.append(this->value);
|
||||
} //-- stringValue
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user