Skip to content

Commit c8ffc5e

Browse files
author
Kjell Ahlstedt
committed
Add some noexcept
1 parent a1d74cf commit c8ffc5e

40 files changed

+102
-107
lines changed

libxml++/attributedeclaration.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ Glib::ustring AttributeDeclaration::get_value() const
2525
return (const char*)cobj()->defaultValue;
2626
}
2727

28-
xmlAttribute* AttributeDeclaration::cobj()
28+
xmlAttribute* AttributeDeclaration::cobj() noexcept
2929
{
3030
// An XML_ATTRIBUTE_DECL is represented by an xmlAttribute struct. Reinterpret
3131
// the xmlNode pointer stored in the base class as an xmlAttribute pointer.
3232
return reinterpret_cast<xmlAttribute*>(Node::cobj());
3333
}
3434

35-
const xmlAttribute* AttributeDeclaration::cobj() const
35+
const xmlAttribute* AttributeDeclaration::cobj() const noexcept
3636
{
3737
// An XML_ATTRIBUTE_DECL is represented by an xmlAttribute struct. Reinterpret
3838
// the xmlNode pointer stored in the base class as an xmlAttribute pointer.

libxml++/attributedeclaration.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ class AttributeDeclaration : public Attribute
3737
Glib::ustring get_value() const override;
3838

3939
///Access the underlying libxml implementation.
40-
_xmlAttribute* cobj();
40+
_xmlAttribute* cobj() noexcept;
4141

4242
///Access the underlying libxml implementation.
43-
const _xmlAttribute* cobj() const;
43+
const _xmlAttribute* cobj() const noexcept;
4444
};
4545

4646
} // namespace xmlpp

libxml++/attributenode.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ void AttributeNode::set_value(const Glib::ustring& value)
4242
xmlSetProp(cobj()->parent, cobj()->name, (const xmlChar*)value.c_str());
4343
}
4444

45-
xmlAttr* AttributeNode::cobj()
45+
xmlAttr* AttributeNode::cobj() noexcept
4646
{
4747
// An XML_ATTRIBUTE_NODE is represented by an xmlAttr struct. Reinterpret
4848
// the xmlNode pointer stored in the base class as an xmlAttr pointer.
4949
return reinterpret_cast<xmlAttr*>(Node::cobj());
5050
}
5151

52-
const xmlAttr* AttributeNode::cobj() const
52+
const xmlAttr* AttributeNode::cobj() const noexcept
5353
{
5454
// An XML_ATTRIBUTE_NODE is represented by an xmlAttr struct. Reinterpret
5555
// the xmlNode pointer stored in the base class as an xmlAttr pointer.

libxml++/attributenode.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ class AttributeNode : public Attribute
4747
*
4848
* @newin{3,0} Replaces Attribute::cobj()
4949
*/
50-
_xmlAttr* cobj();
50+
_xmlAttr* cobj() noexcept;
5151

5252
/** Access the underlying libxml implementation.
5353
*
5454
* @newin{3,0} Replaces Attribute::cobj() const
5555
*/
56-
const _xmlAttr* cobj() const;
56+
const _xmlAttr* cobj() const noexcept;
5757
};
5858

5959
} // namespace xmlpp

libxml++/document.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ Document::Init::Init()
152152
xmlInitParser(); //Not always necessary, but necessary for thread safety.
153153
}
154154

155-
Document::Init::~Init()
155+
Document::Init::~Init() noexcept
156156
{
157157
//We don't call this because it breaks libxml generally and should only be
158158
//called at the very end of a process, such as at the end of a main().
@@ -470,12 +470,12 @@ _xmlEntity* Document::get_entity(const Glib::ustring& name)
470470
return xmlGetDocEntity(impl_, (const xmlChar*) name.c_str());
471471
}
472472

473-
_xmlDoc* Document::cobj()
473+
_xmlDoc* Document::cobj() noexcept
474474
{
475475
return impl_;
476476
}
477477

478-
const _xmlDoc* Document::cobj() const
478+
const _xmlDoc* Document::cobj() const noexcept
479479
{
480480
return impl_;
481481
}

libxml++/document.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class Document : public NonCopyable
6969
{
7070
public:
7171
Init();
72-
~Init();
72+
~Init() noexcept;
7373
};
7474

7575
friend class SaxParser;
@@ -252,10 +252,10 @@ class Document : public NonCopyable
252252
int process_xinclude(bool generate_xinclude_nodes = true);
253253

254254
///Access the underlying libxml implementation.
255-
_xmlDoc* cobj();
255+
_xmlDoc* cobj() noexcept;
256256

257257
///Access the underlying libxml implementation.
258-
const _xmlDoc* cobj() const;
258+
const _xmlDoc* cobj() const noexcept;
259259

260260
protected:
261261
/** Retrieve an Entity.

libxml++/dtd.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace xmlpp
1515

1616
struct Dtd::Impl
1717
{
18-
Impl() : dtd(nullptr), is_dtd_owner(false) {}
18+
Impl() noexcept : dtd(nullptr), is_dtd_owner(false) {}
1919

2020
_xmlDtd* dtd;
2121
bool is_dtd_owner;
@@ -120,12 +120,12 @@ Glib::ustring Dtd::get_system_id() const
120120
return (pimpl_->dtd && pimpl_->dtd->SystemID) ? (const char*)pimpl_->dtd->SystemID : "";
121121
}
122122

123-
_xmlDtd* Dtd::cobj()
123+
_xmlDtd* Dtd::cobj() noexcept
124124
{
125125
return pimpl_->dtd;
126126
}
127127

128-
const _xmlDtd* Dtd::cobj() const
128+
const _xmlDtd* Dtd::cobj() const noexcept
129129
{
130130
return pimpl_->dtd;
131131
}

libxml++/dtd.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,11 @@ class Dtd : public NonCopyable
117117

118118
/** Access the underlying libxml implementation.
119119
*/
120-
_xmlDtd* cobj();
120+
_xmlDtd* cobj() noexcept;
121121

122122
/** Access the underlying libxml implementation.
123123
*/
124-
const _xmlDtd* cobj() const;
124+
const _xmlDtd* cobj() const noexcept;
125125

126126
protected:
127127
void release_underlying();

libxml++/io/outputbuffer.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,12 @@ namespace xmlpp
9393
return true;
9494
}
9595

96-
_xmlOutputBuffer* OutputBuffer::cobj()
96+
_xmlOutputBuffer* OutputBuffer::cobj() noexcept
9797
{
9898
return impl_;
9999
}
100100

101-
const _xmlOutputBuffer* OutputBuffer::cobj() const
101+
const _xmlOutputBuffer* OutputBuffer::cobj() const noexcept
102102
{
103103
return impl_;
104104
}

libxml++/io/outputbuffer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ namespace xmlpp
4646
public:
4747
/** gives an access to the underlying libxml structure to the children
4848
*/
49-
_xmlOutputBuffer* cobj();
49+
_xmlOutputBuffer* cobj() noexcept;
5050

5151
/** gives an access to the underlying libxml structure to the children
5252
*/
53-
const _xmlOutputBuffer* cobj() const;
53+
const _xmlOutputBuffer* cobj() const noexcept;
5454

5555
private:
5656
bool on_write(const char * buffer, int len);

libxml++/io/parserinputbuffer.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ namespace xmlpp
7171
return true;
7272
}
7373

74-
_xmlParserInputBuffer* ParserInputBuffer::cobj()
74+
_xmlParserInputBuffer* ParserInputBuffer::cobj() noexcept
7575
{
7676
return impl_;
7777
}
7878

79-
const _xmlParserInputBuffer* ParserInputBuffer::cobj() const
79+
const _xmlParserInputBuffer* ParserInputBuffer::cobj() const noexcept
8080
{
8181
return impl_;
8282
}

libxml++/io/parserinputbuffer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ namespace xmlpp
3737
public:
3838
/** gives an access to the underlying libxml structure to the children
3939
*/
40-
_xmlParserInputBuffer* cobj();
40+
_xmlParserInputBuffer* cobj() noexcept;
4141

4242
/** gives an access to the underlying libxml structure to the children
4343
*/
44-
const _xmlParserInputBuffer* cobj() const;
44+
const _xmlParserInputBuffer* cobj() const noexcept;
4545

4646
private:
4747
int on_read(char * buffer, int len);

libxml++/keepblanks.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,19 @@
1111

1212
namespace xmlpp
1313
{
14-
1514
#if _MSC_VER == 1200 // detect MSVC 6.0
1615
const bool KeepBlanks::Default = true;
1716
#endif
1817

19-
KeepBlanks::KeepBlanks(bool value)
18+
KeepBlanks::KeepBlanks(bool value) noexcept
2019
{
2120
oldIndentTreeOutput_ = xmlIndentTreeOutput;
2221
oldKeepBlanksDefault_ = xmlKeepBlanksDefault( value?1:0 );
2322
}
2423

25-
KeepBlanks::~KeepBlanks()
24+
KeepBlanks::~KeepBlanks() noexcept
2625
{
2726
xmlKeepBlanksDefault(oldKeepBlanksDefault_);
2827
xmlIndentTreeOutput = oldIndentTreeOutput_;
2928
}
3029
}
31-

libxml++/keepblanks.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@
1010

1111
namespace xmlpp
1212
{
13-
14-
/**
15-
* This class set KeepBlanksDefault and IndentTreeOutput of libxmlpp
16-
* and restore their initial value in its destructor. As a consequence
13+
/** This class sets KeepBlanksDefault and IndentTreeOutput of libxmlpp
14+
* and restores their initial values in its destructor. As a consequence
1715
* the wanted setting is kept during instance lifetime.
1816
*/
1917
class KeepBlanks {
@@ -25,14 +23,13 @@ namespace xmlpp
2523
#endif
2624

2725
public:
28-
KeepBlanks(bool value);
29-
~KeepBlanks();
26+
KeepBlanks(bool value) noexcept;
27+
~KeepBlanks() noexcept;
3028

3129
private:
3230
int oldKeepBlanksDefault_;
3331
int oldIndentTreeOutput_;
3432
};
35-
3633
}
3734

3835
#endif // __LIBXMLPP_KEEPBLANKS_H

libxml++/nodes/entitydeclaration.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ Glib::ustring EntityDeclaration::get_original_text() const
2727
return cobj()->orig ? (const char*)cobj()->orig : "";
2828
}
2929

30-
xmlEntity* EntityDeclaration::cobj()
30+
xmlEntity* EntityDeclaration::cobj() noexcept
3131
{
3232
// An XML_ENTITY_DECL is represented by an xmlEntity struct. Reinterpret
3333
// the xmlNode pointer stored in the base class as an xmlEntity pointer.
3434
return reinterpret_cast<xmlEntity*>(Node::cobj());
3535
}
3636

37-
const xmlEntity* EntityDeclaration::cobj() const
37+
const xmlEntity* EntityDeclaration::cobj() const noexcept
3838
{
3939
// An XML_ENTITY_DECL is represented by an xmlEntity struct. Reinterpret
4040
// the xmlNode pointer stored in the base class as an xmlEntity pointer.

libxml++/nodes/entitydeclaration.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ class EntityDeclaration : public ContentNode
4343
Glib::ustring get_original_text() const;
4444

4545
///Access the underlying libxml implementation.
46-
_xmlEntity* cobj();
46+
_xmlEntity* cobj() noexcept;
4747

4848
///Access the underlying libxml implementation.
49-
const _xmlEntity* cobj() const;
49+
const _xmlEntity* cobj() const noexcept;
5050
};
5151

5252
} // namespace xmlpp

libxml++/nodes/node.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,12 +376,12 @@ int Node::get_line() const
376376
}
377377

378378

379-
xmlNode* Node::cobj()
379+
xmlNode* Node::cobj() noexcept
380380
{
381381
return impl_;
382382
}
383383

384-
const xmlNode* Node::cobj() const
384+
const xmlNode* Node::cobj() const noexcept
385385
{
386386
return impl_;
387387
}

libxml++/nodes/node.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,10 +316,10 @@ class Node : public NonCopyable
316316
XPathResultType* result_type = nullptr) const;
317317

318318
///Access the underlying libxml implementation.
319-
_xmlNode* cobj();
319+
_xmlNode* cobj() noexcept;
320320

321321
///Access the underlying libxml implementation.
322-
const _xmlNode* cobj() const;
322+
const _xmlNode* cobj() const noexcept;
323323

324324
/** Construct the correct C++ instance for a given libxml C struct instance.
325325
*

libxml++/noncopyable.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
namespace xmlpp
1111
{
1212

13-
NonCopyable::NonCopyable()
13+
NonCopyable::NonCopyable() noexcept
1414
{
1515
}
1616

libxml++/noncopyable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace xmlpp
1717
class NonCopyable
1818
{
1919
protected:
20-
NonCopyable();
20+
NonCopyable() noexcept;
2121
virtual ~NonCopyable();
2222

2323
NonCopyable(const NonCopyable&) = delete;

libxml++/parsers/domparser.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,17 +218,17 @@ void DomParser::release_underlying()
218218
Parser::release_underlying();
219219
}
220220

221-
DomParser::operator bool() const
221+
DomParser::operator bool() const noexcept
222222
{
223223
return doc_ != nullptr;
224224
}
225225

226-
Document* DomParser::get_document()
226+
Document* DomParser::get_document() noexcept
227227
{
228228
return doc_;
229229
}
230230

231-
const Document* DomParser::get_document() const
231+
const Document* DomParser::get_document() const noexcept
232232
{
233233
return doc_;
234234
}

libxml++/parsers/domparser.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,17 @@ class DomParser : public Parser
7676

7777
/** Test whether a document has been parsed.
7878
*/
79-
operator bool() const;
79+
operator bool() const noexcept;
8080

8181
/** Get the parsed document.
8282
* @returns A pointer to the parsed document, or <tt>nullptr</tt>.
8383
*/
84-
Document* get_document();
84+
Document* get_document() noexcept;
8585

8686
/** Get the parsed document.
8787
* @returns A pointer to the parsed document, or <tt>nullptr</tt>.
8888
*/
89-
const Document* get_document() const;
89+
const Document* get_document() const noexcept;
9090

9191
protected:
9292
void parse_context();

0 commit comments

Comments
 (0)