Commit 11353eaf authored by Kjell Ahlstedt's avatar Kjell Ahlstedt

Still more use of nullptr instead of 0

parent f213e683
// -*- C++ -*-
/* exception.h
*
* Copyright (C) 2002 The libxml++ development team
......@@ -57,7 +55,7 @@ private:
*
* @newin{2,36}
*
* @param error Pointer to an _xmlError struct or <tt>0</tt>. If <tt>0</tt>,
* @param error Pointer to an _xmlError struct or <tt>nullptr</tt>. If <tt>nullptr</tt>,
* the error returned by xmlGetLastError() is used.
* @returns A formatted text string. If the error struct does not contain an
* error (error->code == XML_ERR_OK), an empty string is returned.
......
/* document.h
/* parserinputbuffer.cc
* this file is part of libxml++
*
* copyright (C) 2003 by libxml++ developer's team
......@@ -39,7 +39,7 @@ namespace xmlpp
&ParserInputBufferCallback::on_close,
static_cast<void*>(this),
XML_CHAR_ENCODING_NONE);
if(impl_ == 0)
if (!impl_)
{
throw internal_error("Cannot initialise underlying xmlParserInputBuffer");
}
......@@ -54,7 +54,7 @@ namespace xmlpp
bool result = do_close();
// the underlying structure is being freed by libxml, the pointer will soon be
// invalid.
impl_ = 0;
impl_ = nullptr;
return result;
}
......
......@@ -138,11 +138,11 @@ void DomParser::parse_stream(std::istream& in)
xmlResetLastError();
context_ = xmlCreatePushParserCtxt(
0, // Setting those two parameters to 0 force the parser
0, // to create a document while parsing.
0, // chunk
0, // size
0); // no filename for fetching external entities
nullptr, // Setting those two parameters to nullptr force the parser
nullptr, // to create a document while parsing.
nullptr, // chunk
0, // size
nullptr); // no filename for fetching external entities
if(!context_)
{
......@@ -169,7 +169,7 @@ void DomParser::parse_stream(std::istream& in)
firstParseError = parseError;
}
const int parseError = xmlParseChunk(context_, 0, 0, 1 /* last chunk */);
const int parseError = xmlParseChunk(context_, nullptr, 0, 1 /* last chunk */);
if (parseError != XML_ERR_OK && firstParseError == XML_ERR_OK)
firstParseError = parseError;
......
......@@ -80,12 +80,12 @@ public:
operator bool() const;
/** Get the parsed document.
* @returns A pointer to the parsed document, or <tt>0</tt>.
* @returns A pointer to the parsed document, or <tt>nullptr</tt>.
*/
Document* get_document();
/** Get the parsed document.
* @returns A pointer to the parsed document, or <tt>0</tt>.
* @returns A pointer to the parsed document, or <tt>nullptr</tt>.
*/
const Document* get_document() const;
......
......@@ -44,37 +44,37 @@ SaxParser::SaxParser(bool use_get_entity)
{
xmlSAXHandler temp = {
SaxParserCallback::internal_subset,
0, // isStandalone
0, // hasInternalSubset
0, // hasExternalSubset
0, // resolveEntity
use_get_entity ? SaxParserCallback::get_entity : 0, // getEntity
nullptr, // isStandalone
nullptr, // hasInternalSubset
nullptr, // hasExternalSubset
nullptr, // resolveEntity
use_get_entity ? SaxParserCallback::get_entity : nullptr, // getEntity
SaxParserCallback::entity_decl, // entityDecl
0, // notationDecl
0, // attributeDecl
0, // elementDecl
0, // unparsedEntityDecl
0, // setDocumentLocator
nullptr, // notationDecl
nullptr, // attributeDecl
nullptr, // elementDecl
nullptr, // unparsedEntityDecl
nullptr, // setDocumentLocator
SaxParserCallback::start_document, // startDocument
SaxParserCallback::end_document, // endDocument
SaxParserCallback::start_element, // startElement
SaxParserCallback::end_element, // endElement
0, // reference
nullptr, // reference
SaxParserCallback::characters, // characters
0, // ignorableWhitespace
0, // processingInstruction
nullptr, // ignorableWhitespace
nullptr, // processingInstruction
SaxParserCallback::comment, // comment
SaxParserCallback::warning, // warning
SaxParserCallback::error, // error
SaxParserCallback::fatal_error, // fatalError
0, // getParameterEntity
nullptr, // getParameterEntity
SaxParserCallback::cdata_block, // cdataBlock
0, // externalSubset
0, // initialized
0, // private
0, // startElementNs
0, // endElementNs
0, // serror
nullptr, // externalSubset
0, // initialized
nullptr, // private
nullptr, // startElementNs
nullptr, // endElementNs
nullptr, // serror
};
*sax_handler_ = temp;
}
......@@ -227,10 +227,10 @@ void SaxParser::parse_stream(std::istream& in)
context_ = xmlCreatePushParserCtxt(
sax_handler_.get(),
0, // user_data
0, // chunk
0, // size
0); // no filename for fetching external entities
nullptr, // user_data
nullptr, // chunk
0, // size
nullptr); // no filename for fetching external entities
if(!context_)
{
......@@ -262,7 +262,7 @@ void SaxParser::parse_stream(std::istream& in)
if( ! exception_ )
{
//This is called just to terminate parsing.
const int parseError = xmlParseChunk(context_, 0 /* chunk */, 0 /* size */, 1 /* terminate (1 or 0) */);
const int parseError = xmlParseChunk(context_, nullptr /* chunk */, 0 /* size */, 1 /* terminate (1 or 0) */);
if (parseError != XML_ERR_OK && firstParseError == XML_ERR_OK)
firstParseError = parseError;
......@@ -296,10 +296,10 @@ void SaxParser::parse_chunk_raw(const unsigned char* contents, size_type bytes_c
{
context_ = xmlCreatePushParserCtxt(
sax_handler_.get(),
0, // user_data
0, // chunk
0, // size
0); // no filename for fetching external entities
nullptr, // user_data
nullptr, // chunk
0, // size
nullptr); // no filename for fetching external entities
if(!context_)
{
......@@ -337,10 +337,10 @@ void SaxParser::finish_chunk_parsing()
{
context_ = xmlCreatePushParserCtxt(
sax_handler_.get(),
0, // this, // user_data
0, // chunk
0, // size
0); // no filename for fetching external entities
nullptr, // user_data
nullptr, // chunk
0, // size
nullptr); // no filename for fetching external entities
if(!context_)
{
......@@ -354,7 +354,7 @@ void SaxParser::finish_chunk_parsing()
int parseError = XML_ERR_OK;
if(!exception_)
//This is called just to terminate parsing.
parseError = xmlParseChunk(context_, 0 /* chunk */, 0 /* size */, 1 /* terminate (1 or 0) */);
parseError = xmlParseChunk(context_, nullptr /* chunk */, 0 /* size */, 1 /* terminate (1 or 0) */);
auto error_str = format_xml_parser_error(context_);
if (error_str.empty() && parseError != XML_ERR_OK)
......
......@@ -196,7 +196,7 @@ protected:
* Unlike the DomParser, the SaxParser will also tell you about entity references for the 5 predefined entities.
*
* @param name The entity reference name.
* @returns The resolved xmlEntity for the entity reference, or <tt>0</tt> if not found.
* @returns The resolved xmlEntity for the entity reference, or <tt>nullptr</tt> if not found.
* You must include libxml/parser.h in order to use this C struct.
* This instance will not be freed by the caller.
*/
......
......@@ -91,7 +91,7 @@ void RelaxNGSchema::parse_memory(const Glib::ustring& contents)
void RelaxNGSchema::parse_document(const Document* document)
{
if (!document)
throw parse_error("RelaxNGSchema::parse_document(): document must not be 0.");
throw parse_error("RelaxNGSchema::parse_document(): document must not be nullptr.");
// xmlRelaxNGNewDocParserCtxt() takes a copy of the xmlDoc.
parse_context(xmlRelaxNGNewDocParserCtxt(const_cast<xmlDoc*>(document->cobj())));
......
......@@ -104,7 +104,7 @@ void Schema::release_underlying()
Document* Schema::get_document()
{
if (!(impl_ && impl_->doc))
return 0;
return nullptr;
if (!impl_->doc->_private) // Possible if *this was created with Schema(xmlSchema* schema).
new Document(impl_->doc); // Sets impl_->doc->_private
......
......@@ -38,14 +38,14 @@ public:
explicit Schema(_xmlSchema* schema);
/** Create a schema from an XML document.
* @param document XMLSchema document, 0 to create an empty schema document.
* @param document XMLSchema document, <tt>nullptr</tt> to create an empty schema document.
* @param embed If true, the document will be deleted when
* the schema is deleted or another document is set.
* @throws xmlpp::parse_error
* @throws xmlpp::internal_error If an empty schema document can't be created.
* @deprecated Use XsdSchema instead.
*/
explicit Schema(Document* document = 0, bool embed = false);
explicit Schema(Document* document = nullptr, bool embed = false);
~Schema();
//TODO: Remove virtual when we can break ABI?
......@@ -53,13 +53,13 @@ public:
/** Set a new document to the schema.
* If the old schema document is owned by the schema (embed == true), the old
* schema document and all its nodes are deleted.
* @param document XMLSchema document, 0 to create an empty schema document.
* @param document XMLSchema document, <tt>nullptr</tt> to create an empty schema document.
* @param embed If true, the document will be deleted when the schema is deleted or another document is set.
* @throws xmlpp::parse_error
* @throws xmlpp::internal_error If an empty schema document can't be created.
* @deprecated Use XsdSchema::parse_document() instead.
*/
virtual void set_document(Document* document = 0, bool embed = false);
virtual void set_document(Document* document = nullptr, bool embed = false);
/** @deprecated There is no replacement.
*/
......@@ -74,13 +74,13 @@ public:
Glib::ustring get_version() const;
/** Get the schema document.
* @returns A pointer to the schema document, or <tt>0</tt> if none exists.
* @returns A pointer to the schema document, or <tt>nullptr</tt> if none exists.
* @deprecated There is no replacement.
*/
Document* get_document();
/** Get the schema document.
* @returns A pointer to the schema document, or <tt>0</tt> if none exists.
* @returns A pointer to the schema document, or <tt>nullptr</tt> if none exists.
* @deprecated There is no replacement.
*/
const Document* get_document() const;
......
......@@ -55,8 +55,8 @@ void DtdValidator::parse_subset(const Glib::ustring& external,const Glib::ustrin
xmlResetLastError();
auto dtd = xmlParseDTD(
external.empty() ? 0 : (const xmlChar *)external.c_str(),
system.empty() ? 0 : (const xmlChar *)system.c_str());
external.empty() ? nullptr : (const xmlChar *)external.c_str(),
system.empty() ? nullptr : (const xmlChar *)system.c_str());
if (!dtd)
{
......@@ -82,7 +82,7 @@ void DtdValidator::parse_stream(std::istream& in)
IStreamParserInputBuffer ibuff( in );
auto dtd = xmlIOParseDTD( 0, ibuff.cobj(), XML_CHAR_ENCODING_UTF8 );
auto dtd = xmlIOParseDTD(nullptr, ibuff.cobj(), XML_CHAR_ENCODING_UTF8);
if (!dtd)
{
......@@ -125,7 +125,7 @@ bool DtdValidator::validate(const Document* doc)
{
if (!doc)
{
throw internal_error("Document pointer cannot be 0.");
throw internal_error("Document pointer cannot be nullptr.");
}
if (!dtd_)
......
......@@ -73,12 +73,12 @@ public:
operator bool() const;
/** Get the parsed DTD.
* @returns A pointer to the parsed DTD, or <tt>0</tt>.
* @returns A pointer to the parsed DTD, or <tt>nullptr</tt>.
*/
Dtd* get_dtd();
/** Get the parsed DTD.
* @returns A pointer to the parsed DTD, or <tt>0</tt>.
* @returns A pointer to the parsed DTD, or <tt>nullptr</tt>.
*/
const Dtd* get_dtd() const;
......
......@@ -132,7 +132,7 @@ void RelaxNGValidator::initialize_valid()
void RelaxNGValidator::validate(const Document* document)
{
if (!document)
throw internal_error("RelaxNGValidator::validate(): document must not be 0.");
throw internal_error("RelaxNGValidator::validate(): document must not be nullptr.");
if (!*this)
throw internal_error("RelaxNGValidator::validate(): Must have a schema to validate document");
......
......@@ -126,12 +126,12 @@ public:
virtual operator BoolExpr() const;
/** Get the schema.
* @returns A pointer to the schema, or <tt>0</tt>.
* @returns A pointer to the schema, or <tt>nullptr</tt>.
*/
RelaxNGSchema* get_schema();
/** Get the schema.
* @returns A pointer to the schema, or <tt>0</tt>.
* @returns A pointer to the schema, or <tt>nullptr</tt>.
*/
const RelaxNGSchema* get_schema() const;
......
......@@ -130,7 +130,7 @@ void XsdValidator::initialize_valid()
void XsdValidator::validate(const Document* document)
{
if (!document)
throw internal_error("XsdValidator::validate(): document must not be 0.");
throw internal_error("XsdValidator::validate(): document must not be nullptr.");
if (!*this)
throw internal_error("XsdValidator::validate(): Must have a schema to validate document");
......
......@@ -117,12 +117,12 @@ public:
virtual operator BoolExpr() const;
/** Get the schema.
* @returns A pointer to the schema, or <tt>0</tt>.
* @returns A pointer to the schema, or <tt>nullptr</tt>.
*/
XsdSchema* get_schema();
/** Get the schema.
* @returns A pointer to the schema, or <tt>0</tt>.
* @returns A pointer to the schema, or <tt>nullptr</tt>.
*/
const XsdSchema* get_schema() const;
......
......@@ -94,7 +94,7 @@ void XsdSchema::parse_memory(const Glib::ustring& contents)
void XsdSchema::parse_document(const Document* document)
{
if (!document)
throw parse_error("XsdSchema::parse_document(): document must not be 0.");
throw parse_error("XsdSchema::parse_document(): document must not be nullptr.");
xmlResetLastError();
release_underlying();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment