I've noticed in some places string assignments first clone the right hand
side and in other places they don't.  I don't know if this is intentional,
an artifact of the derivation from XML4J, or just an unnecessary bit of
overhead.  If someone could enlighten me, I'd appreciate it.

For example:

This constructor clones nothing:

NodeImpl::NodeImpl(DocumentImpl *ownerDoc,
                   const DOMString &nam,  short nTyp,
                   bool isLeafNod, const DOMString &initValue)
{
    // Do we want to add isLeafNode to this? How about initial value?
    this->ownerDocument=ownerDoc;
    this->namespaceURI=null;    //DOM Level 2
    this->prefix=null;          //DOM Level 2
    this->localName=nam;        //DOM Level 2
    this->name=nam;
    this->nType=nTyp;
    this->isLeafNode=isLeafNod;
    this->value=initValue;

while this constructor clones everything

NodeImpl::NodeImpl(const NodeImpl &other, bool deep) {
    this->nType = other.nType;
    this->namespaceURI = other.namespaceURI.clone();    //DOM Level 2
    this->prefix = other.prefix.clone();                //DOM Level 2
    this->localName = other.localName.clone();          //DOM Level 2
    this->name  = other.name.clone();
    this->value = other.value.clone();
    this->isLeafNode = other.isLeafNode;
    this->readOnly = false;

Reply via email to