mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-13 10:32:57 +01:00
chore(XML): modernization: use nullptr instead of 0
This commit is contained in:
parent
3b4a8ea6e7
commit
ce9c08a2d8
@ -51,8 +51,8 @@ AbstractContainerNode::~AbstractContainerNode()
|
|||||||
{
|
{
|
||||||
AbstractNode* pDelNode = pChild;
|
AbstractNode* pDelNode = pChild;
|
||||||
pChild = pChild->_pNext;
|
pChild = pChild->_pNext;
|
||||||
pDelNode->_pNext = 0;
|
pDelNode->_pNext = nullptr;
|
||||||
pDelNode->_pParent = 0;
|
pDelNode->_pParent = nullptr;
|
||||||
pDelNode->release();
|
pDelNode->release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -89,8 +89,8 @@ Node* AbstractContainerNode::insertBefore(Node* newChild, Node* refChild)
|
|||||||
if (this == newChild)
|
if (this == newChild)
|
||||||
throw DOMException(DOMException::HIERARCHY_REQUEST_ERR);
|
throw DOMException(DOMException::HIERARCHY_REQUEST_ERR);
|
||||||
|
|
||||||
AbstractNode* pFirst = 0;
|
AbstractNode* pFirst = nullptr;
|
||||||
AbstractNode* pLast = 0;
|
AbstractNode* pLast = nullptr;
|
||||||
if (newChild->nodeType() == Node::DOCUMENT_FRAGMENT_NODE)
|
if (newChild->nodeType() == Node::DOCUMENT_FRAGMENT_NODE)
|
||||||
{
|
{
|
||||||
AbstractContainerNode* pFrag = static_cast<AbstractContainerNode*>(newChild);
|
AbstractContainerNode* pFrag = static_cast<AbstractContainerNode*>(newChild);
|
||||||
@ -105,7 +105,7 @@ Node* AbstractContainerNode::insertBefore(Node* newChild, Node* refChild)
|
|||||||
}
|
}
|
||||||
pLast->_pParent = this;
|
pLast->_pParent = this;
|
||||||
}
|
}
|
||||||
pFrag->_pFirstChild = 0;
|
pFrag->_pFirstChild = nullptr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -165,8 +165,8 @@ Node* AbstractContainerNode::insertAfterNP(Node* newChild, Node* refChild)
|
|||||||
if (this == newChild)
|
if (this == newChild)
|
||||||
throw DOMException(DOMException::HIERARCHY_REQUEST_ERR);
|
throw DOMException(DOMException::HIERARCHY_REQUEST_ERR);
|
||||||
|
|
||||||
AbstractNode* pFirst = 0;
|
AbstractNode* pFirst = nullptr;
|
||||||
AbstractNode* pLast = 0;
|
AbstractNode* pLast = nullptr;
|
||||||
if (newChild->nodeType() == Node::DOCUMENT_FRAGMENT_NODE)
|
if (newChild->nodeType() == Node::DOCUMENT_FRAGMENT_NODE)
|
||||||
{
|
{
|
||||||
AbstractContainerNode* pFrag = static_cast<AbstractContainerNode*>(newChild);
|
AbstractContainerNode* pFrag = static_cast<AbstractContainerNode*>(newChild);
|
||||||
@ -181,7 +181,7 @@ Node* AbstractContainerNode::insertAfterNP(Node* newChild, Node* refChild)
|
|||||||
}
|
}
|
||||||
pLast->_pParent = this;
|
pLast->_pParent = this;
|
||||||
}
|
}
|
||||||
pFrag->_pFirstChild = 0;
|
pFrag->_pFirstChild = nullptr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -259,8 +259,8 @@ Node* AbstractContainerNode::replaceChild(Node* newChild, Node* oldChild)
|
|||||||
}
|
}
|
||||||
static_cast<AbstractNode*>(newChild)->_pNext = static_cast<AbstractNode*>(oldChild)->_pNext;
|
static_cast<AbstractNode*>(newChild)->_pNext = static_cast<AbstractNode*>(oldChild)->_pNext;
|
||||||
static_cast<AbstractNode*>(newChild)->_pParent = this;
|
static_cast<AbstractNode*>(newChild)->_pParent = this;
|
||||||
_pFirstChild->_pNext = 0;
|
_pFirstChild->_pNext = nullptr;
|
||||||
_pFirstChild->_pParent = 0;
|
_pFirstChild->_pParent = nullptr;
|
||||||
_pFirstChild = static_cast<AbstractNode*>(newChild);
|
_pFirstChild = static_cast<AbstractNode*>(newChild);
|
||||||
if (doEvents)
|
if (doEvents)
|
||||||
{
|
{
|
||||||
@ -283,8 +283,8 @@ Node* AbstractContainerNode::replaceChild(Node* newChild, Node* oldChild)
|
|||||||
}
|
}
|
||||||
static_cast<AbstractNode*>(newChild)->_pNext = static_cast<AbstractNode*>(oldChild)->_pNext;
|
static_cast<AbstractNode*>(newChild)->_pNext = static_cast<AbstractNode*>(oldChild)->_pNext;
|
||||||
static_cast<AbstractNode*>(newChild)->_pParent = this;
|
static_cast<AbstractNode*>(newChild)->_pParent = this;
|
||||||
static_cast<AbstractNode*>(oldChild)->_pNext = 0;
|
static_cast<AbstractNode*>(oldChild)->_pNext = nullptr;
|
||||||
static_cast<AbstractNode*>(oldChild)->_pParent = 0;
|
static_cast<AbstractNode*>(oldChild)->_pParent = nullptr;
|
||||||
pCur->_pNext = static_cast<AbstractNode*>(newChild);
|
pCur->_pNext = static_cast<AbstractNode*>(newChild);
|
||||||
if (doEvents)
|
if (doEvents)
|
||||||
{
|
{
|
||||||
@ -315,8 +315,8 @@ Node* AbstractContainerNode::removeChild(Node* oldChild)
|
|||||||
static_cast<AbstractNode*>(oldChild)->dispatchNodeRemovedFromDocument();
|
static_cast<AbstractNode*>(oldChild)->dispatchNodeRemovedFromDocument();
|
||||||
}
|
}
|
||||||
_pFirstChild = _pFirstChild->_pNext;
|
_pFirstChild = _pFirstChild->_pNext;
|
||||||
static_cast<AbstractNode*>(oldChild)->_pNext = 0;
|
static_cast<AbstractNode*>(oldChild)->_pNext = nullptr;
|
||||||
static_cast<AbstractNode*>(oldChild)->_pParent = 0;
|
static_cast<AbstractNode*>(oldChild)->_pParent = nullptr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -330,8 +330,8 @@ Node* AbstractContainerNode::removeChild(Node* oldChild)
|
|||||||
static_cast<AbstractNode*>(oldChild)->dispatchNodeRemovedFromDocument();
|
static_cast<AbstractNode*>(oldChild)->dispatchNodeRemovedFromDocument();
|
||||||
}
|
}
|
||||||
pCur->_pNext = pCur->_pNext->_pNext;
|
pCur->_pNext = pCur->_pNext->_pNext;
|
||||||
static_cast<AbstractNode*>(oldChild)->_pNext = 0;
|
static_cast<AbstractNode*>(oldChild)->_pNext = nullptr;
|
||||||
static_cast<AbstractNode*>(oldChild)->_pParent = 0;
|
static_cast<AbstractNode*>(oldChild)->_pParent = nullptr;
|
||||||
}
|
}
|
||||||
else throw DOMException(DOMException::NOT_FOUND_ERR);
|
else throw DOMException(DOMException::NOT_FOUND_ERR);
|
||||||
}
|
}
|
||||||
@ -373,7 +373,7 @@ void AbstractContainerNode::dispatchNodeInsertedIntoDocument()
|
|||||||
|
|
||||||
bool AbstractContainerNode::hasChildNodes() const
|
bool AbstractContainerNode::hasChildNodes() const
|
||||||
{
|
{
|
||||||
return _pFirstChild != 0;
|
return _pFirstChild != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -516,7 +516,7 @@ const Node* AbstractContainerNode::findNode(XMLString::const_iterator& it, const
|
|||||||
while (it != end && *it != '/' && *it != '[') key += *it++;
|
while (it != end && *it != '/' && *it != '[') key += *it++;
|
||||||
|
|
||||||
XMLString::const_iterator itStart(it);
|
XMLString::const_iterator itStart(it);
|
||||||
const Node* pFound = 0;
|
const Node* pFound = nullptr;
|
||||||
const Node* pElem = findElement(key, pNode->firstChild(), pNSMap);
|
const Node* pElem = findElement(key, pNode->firstChild(), pNSMap);
|
||||||
while (!pFound && pElem)
|
while (!pFound && pElem)
|
||||||
{
|
{
|
||||||
|
@ -74,9 +74,9 @@ Document* DOMBuilder::parse(const XMLString& uri)
|
|||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
_pDocument->release();
|
_pDocument->release();
|
||||||
_pDocument = 0;
|
_pDocument = nullptr;
|
||||||
_pParent = 0;
|
_pParent = nullptr;
|
||||||
_pPrevious = 0;
|
_pPrevious = nullptr;
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
_pDocument->resumeEvents();
|
_pDocument->resumeEvents();
|
||||||
@ -96,9 +96,9 @@ Document* DOMBuilder::parse(InputSource* pInputSource)
|
|||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
_pDocument->release();
|
_pDocument->release();
|
||||||
_pDocument = 0;
|
_pDocument = nullptr;
|
||||||
_pParent = 0;
|
_pParent = nullptr;
|
||||||
_pPrevious = 0;
|
_pPrevious = nullptr;
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
_pDocument->resumeEvents();
|
_pDocument->resumeEvents();
|
||||||
@ -118,9 +118,9 @@ Document* DOMBuilder::parseMemoryNP(const char* xml, std::size_t size)
|
|||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
_pDocument->release();
|
_pDocument->release();
|
||||||
_pDocument = 0;
|
_pDocument = nullptr;
|
||||||
_pParent = 0;
|
_pParent = nullptr;
|
||||||
_pPrevious = 0;
|
_pPrevious = nullptr;
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
_pDocument->resumeEvents();
|
_pDocument->resumeEvents();
|
||||||
@ -133,7 +133,7 @@ void DOMBuilder::setupParse()
|
|||||||
{
|
{
|
||||||
_pDocument = new Document(_pNamePool);
|
_pDocument = new Document(_pNamePool);
|
||||||
_pParent = _pDocument;
|
_pParent = _pDocument;
|
||||||
_pPrevious = 0;
|
_pPrevious = nullptr;
|
||||||
_inCDATA = false;
|
_inCDATA = false;
|
||||||
_namespaces = _xmlReader.getFeature(XMLReader::FEATURE_NAMESPACES);
|
_namespaces = _xmlReader.getFeature(XMLReader::FEATURE_NAMESPACES);
|
||||||
}
|
}
|
||||||
@ -197,7 +197,7 @@ void DOMBuilder::startElement(const XMLString& uri, const XMLString& localName,
|
|||||||
AutoPtr<Element> pElem = _namespaces ? _pDocument->createElementNS(uri, qname.empty() ? localName : qname) : _pDocument->createElement(qname);
|
AutoPtr<Element> pElem = _namespaces ? _pDocument->createElementNS(uri, qname.empty() ? localName : qname) : _pDocument->createElement(qname);
|
||||||
|
|
||||||
const AttributesImpl& attrs = dynamic_cast<const AttributesImpl&>(attributes);
|
const AttributesImpl& attrs = dynamic_cast<const AttributesImpl&>(attributes);
|
||||||
Attr* pPrevAttr = 0;
|
Attr* pPrevAttr = nullptr;
|
||||||
for (const auto& attr: attrs)
|
for (const auto& attr: attrs)
|
||||||
{
|
{
|
||||||
AutoPtr<Attr> pAttr = new Attr(_pDocument, 0, attr.namespaceURI, attr.localName, attr.qname, attr.value, attr.specified);
|
AutoPtr<Attr> pAttr = new Attr(_pDocument, 0, attr.namespaceURI, attr.localName, attr.qname, attr.value, attr.specified);
|
||||||
|
@ -143,8 +143,8 @@ Attr* Element::removeAttributeNode(Attr* oldAttr)
|
|||||||
else throw DOMException(DOMException::NOT_FOUND_ERR);
|
else throw DOMException(DOMException::NOT_FOUND_ERR);
|
||||||
}
|
}
|
||||||
else _pFirstAttr = static_cast<Attr*>(_pFirstAttr->_pNext);
|
else _pFirstAttr = static_cast<Attr*>(_pFirstAttr->_pNext);
|
||||||
oldAttr->_pNext = 0;
|
oldAttr->_pNext = nullptr;
|
||||||
oldAttr->_pParent = 0;
|
oldAttr->_pParent = nullptr;
|
||||||
oldAttr->autoRelease();
|
oldAttr->autoRelease();
|
||||||
|
|
||||||
return oldAttr;
|
return oldAttr;
|
||||||
@ -298,13 +298,13 @@ Attr* Element::setAttributeNodeNS(Attr* newAttr)
|
|||||||
|
|
||||||
bool Element::hasAttribute(const XMLString& name) const
|
bool Element::hasAttribute(const XMLString& name) const
|
||||||
{
|
{
|
||||||
return getAttributeNode(name) != 0;
|
return getAttributeNode(name) != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Element::hasAttributeNS(const XMLString& namespaceURI, const XMLString& localName) const
|
bool Element::hasAttributeNS(const XMLString& namespaceURI, const XMLString& localName) const
|
||||||
{
|
{
|
||||||
return getAttributeNodeNS(namespaceURI, localName) != 0;
|
return getAttributeNodeNS(namespaceURI, localName) != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -328,7 +328,7 @@ const XMLString& Element::localName() const
|
|||||||
|
|
||||||
bool Element::hasAttributes() const
|
bool Element::hasAttributes() const
|
||||||
{
|
{
|
||||||
return _pFirstAttr != 0;
|
return _pFirstAttr != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ void EventDispatcher::removeEventListener(const XMLString& type, EventListener*
|
|||||||
{
|
{
|
||||||
if (it->type == type && it->pListener == listener && it->useCapture == useCapture)
|
if (it->type == type && it->pListener == listener && it->useCapture == useCapture)
|
||||||
{
|
{
|
||||||
it->pListener = 0;
|
it->pListener = nullptr;
|
||||||
}
|
}
|
||||||
if (!_inDispatch && !it->pListener)
|
if (!_inDispatch && !it->pListener)
|
||||||
{
|
{
|
||||||
|
@ -60,7 +60,7 @@ void NodeAppender::appendChild(Node* newChild)
|
|||||||
pChild->_pParent = _pParent;
|
pChild->_pParent = _pParent;
|
||||||
pChild = pChild->_pNext;
|
pChild = pChild->_pNext;
|
||||||
}
|
}
|
||||||
pFrag->_pFirstChild = 0;
|
pFrag->_pFirstChild = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -88,8 +88,8 @@ Node* NodeIterator::previousNode()
|
|||||||
|
|
||||||
void NodeIterator::detach()
|
void NodeIterator::detach()
|
||||||
{
|
{
|
||||||
_pRoot = 0;
|
_pRoot = nullptr;
|
||||||
_pCurrent = 0;
|
_pCurrent = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ Node* NodeIterator::previous() const
|
|||||||
Node* NodeIterator::last()
|
Node* NodeIterator::last()
|
||||||
{
|
{
|
||||||
_pCurrent = _pRoot;
|
_pCurrent = _pRoot;
|
||||||
Node* pLast = 0;
|
Node* pLast = nullptr;
|
||||||
while (_pCurrent)
|
while (_pCurrent)
|
||||||
{
|
{
|
||||||
pLast = _pCurrent;
|
pLast = _pCurrent;
|
||||||
|
@ -748,8 +748,8 @@ int ParserEngine::handleExternalEntityRef(XML_Parser parser, const XML_Char* con
|
|||||||
if (!context && !pThis->_externalParameterEntities) return XML_STATUS_ERROR;
|
if (!context && !pThis->_externalParameterEntities) return XML_STATUS_ERROR;
|
||||||
if (context && !pThis->_externalGeneralEntities) return XML_STATUS_ERROR;
|
if (context && !pThis->_externalGeneralEntities) return XML_STATUS_ERROR;
|
||||||
|
|
||||||
InputSource* pInputSource = 0;
|
InputSource* pInputSource = nullptr;
|
||||||
EntityResolver* pEntityResolver = 0;
|
EntityResolver* pEntityResolver = nullptr;
|
||||||
EntityResolverImpl defaultResolver;
|
EntityResolverImpl defaultResolver;
|
||||||
|
|
||||||
XMLString sysId(systemId);
|
XMLString sysId(systemId);
|
||||||
@ -798,7 +798,7 @@ int ParserEngine::handleUnknownEncoding(void* encodingHandlerData, const XML_Cha
|
|||||||
ParserEngine* pThis = reinterpret_cast<ParserEngine*>(encodingHandlerData);
|
ParserEngine* pThis = reinterpret_cast<ParserEngine*>(encodingHandlerData);
|
||||||
|
|
||||||
XMLString encoding(name);
|
XMLString encoding(name);
|
||||||
TextEncoding* knownEncoding = 0;
|
TextEncoding* knownEncoding = nullptr;
|
||||||
|
|
||||||
EncodingMap::const_iterator it = pThis->_encodings.find(encoding);
|
EncodingMap::const_iterator it = pThis->_encodings.find(encoding);
|
||||||
if (it != pThis->_encodings.end())
|
if (it != pThis->_encodings.end())
|
||||||
|
@ -73,7 +73,7 @@ Node* TreeWalker::parentNode()
|
|||||||
if (pParent && accept(pParent) == NodeFilter::FILTER_ACCEPT)
|
if (pParent && accept(pParent) == NodeFilter::FILTER_ACCEPT)
|
||||||
_pCurrent = pParent;
|
_pCurrent = pParent;
|
||||||
else
|
else
|
||||||
pParent = 0;
|
pParent = nullptr;
|
||||||
return pParent;
|
return pParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ NamePoolTest::~NamePoolTest()
|
|||||||
void NamePoolTest::testNamePool()
|
void NamePoolTest::testNamePool()
|
||||||
{
|
{
|
||||||
AutoPtr<NamePool> pool = new NamePool;
|
AutoPtr<NamePool> pool = new NamePool;
|
||||||
const Name* pName = 0;
|
const Name* pName = nullptr;
|
||||||
Name name("pre:local", "http://www.appinf.com");
|
Name name("pre:local", "http://www.appinf.com");
|
||||||
|
|
||||||
pName = &pool->insert(name);
|
pName = &pool->insert(name);
|
||||||
|
Loading…
Reference in New Issue
Block a user