aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-08-31 12:57:38 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-08-31 12:57:38 +0200
commit665b6242fc338bb21ee8ac5131012cf6d230ed1e (patch)
tree7eee3cfa76277eb395e46ee07047860a0d881fd5
parent77bc33bcdf611d0f5c703d3d8e20d6f5aff8814c (diff)
Work around symbol exporting issues, throw() deprecation
-rw-r--r--xml/details/config.hxx26
-rw-r--r--xml/parser13
-rw-r--r--xml/parser.cxx29
-rw-r--r--xml/parser.ixx24
-rw-r--r--xml/serializer15
-rw-r--r--xml/serializer.cxx23
-rw-r--r--xml/serializer.ixx18
7 files changed, 82 insertions, 66 deletions
diff --git a/xml/details/config.hxx b/xml/details/config.hxx
index da76390..656880a 100644
--- a/xml/details/config.hxx
+++ b/xml/details/config.hxx
@@ -5,6 +5,32 @@
#ifndef XML_DETAILS_CONFIG_HXX
#define XML_DETAILS_CONFIG_HXX
+// C++11 support.
+//
+#ifdef _MSC_VER
+# if _MSC_VER >= 1900
+# define STUDXML_CXX11_NOEXCEPT
+# endif
+#else
+# if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L
+# ifdef __clang__ // Pretends to be a really old __GNUC__ on some platforms.
+# define STUDXML_CXX11_NOEXCEPT
+# elif defined(__GNUC__)
+# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4
+# define STUDXML_CXX11_NOEXCEPT
+# endif
+# else
+# define STUDXML_CXX11_NOEXCEPT
+# endif
+# endif
+#endif
+
+#ifdef STUDXML_CXX11_NOEXCEPT
+# define STUDXML_NOTHROW_NOEXCEPT noexcept
+#else
+# define STUDXML_NOTHROW_NOEXCEPT throw()
+#endif
+
// Note: the same in expat/config.h
//
#ifdef LIBSTUDXML_BUILD2
diff --git a/xml/parser b/xml/parser
index d891c3e..5a8fac9 100644
--- a/xml/parser
+++ b/xml/parser
@@ -13,7 +13,8 @@
#include <iosfwd>
#include <cstddef> // std::size_t
-#include <xml/details/config.hxx> // LIBSTUDXML_EXTERNAL_EXPAT
+#include <xml/details/config.hxx> // STUDXML_NOTHROW_NOEXCEPT,
+ // LIBSTUDXML_EXTERNAL_EXPAT
#ifndef LIBSTUDXML_EXTERNAL_EXPAT
# include <xml/details/expat/expat.h>
@@ -36,18 +37,18 @@
namespace xml
{
- class LIBSTUDXML_EXPORT parsing: public exception
+ class parsing: public exception
{
public:
virtual
- ~parsing () throw ();
+ ~parsing () STUDXML_NOTHROW_NOEXCEPT {}
parsing (const std::string& name,
unsigned long long line,
unsigned long long column,
const std::string& description);
- parsing (const parser&, const std::string& description);
+ parsing (const parser& p, const std::string& description);
const std::string&
name () const {return name_;}
@@ -62,10 +63,10 @@ namespace xml
description () const {return description_;}
virtual const char*
- what () const throw ();
+ what () const STUDXML_NOTHROW_NOEXCEPT {return what_.c_str ();}
private:
- void
+ LIBSTUDXML_EXPORT void
init ();
private:
diff --git a/xml/parser.cxx b/xml/parser.cxx
index 8cec4a1..cadbd6d 100644
--- a/xml/parser.cxx
+++ b/xml/parser.cxx
@@ -17,29 +17,6 @@ namespace xml
{
// parsing
//
- parsing::
- ~parsing () throw () {}
-
- parsing::
- parsing (const string& n,
- unsigned long long l,
- unsigned long long c,
- const string& d)
- : name_ (n), line_ (l), column_ (c), description_ (d)
- {
- init ();
- }
-
- parsing::
- parsing (const parser& p, const std::string& d)
- : name_ (p.input_name ()),
- line_ (p.line ()),
- column_ (p.column ()),
- description_ (d)
- {
- init ();
- }
-
void parsing::
init ()
{
@@ -50,12 +27,6 @@ namespace xml
what_ = os.str ();
}
- char const* parsing::
- what () const throw ()
- {
- return what_.c_str ();
- }
-
// parser::event_type
//
static const char* parser_event_str[] =
diff --git a/xml/parser.ixx b/xml/parser.ixx
index b0bffab..f531fca 100644
--- a/xml/parser.ixx
+++ b/xml/parser.ixx
@@ -8,6 +8,30 @@
namespace xml
{
+ // parsing
+ //
+ inline parsing::
+ parsing (const std::string& n,
+ unsigned long long l,
+ unsigned long long c,
+ const std::string& d)
+ : name_ (n), line_ (l), column_ (c), description_ (d)
+ {
+ init ();
+ }
+
+ inline parsing::
+ parsing (const parser& p, const std::string& d)
+ : name_ (p.input_name ()),
+ line_ (p.line ()),
+ column_ (p.column ()),
+ description_ (d)
+ {
+ init ();
+ }
+
+ // parser
+ //
inline parser::
parser (std::istream& is, const std::string& iname, feature_type f)
: size_ (0), iname_ (iname), feature_ (f)
diff --git a/xml/serializer b/xml/serializer
index 8068176..03727d5 100644
--- a/xml/serializer
+++ b/xml/serializer
@@ -17,20 +17,19 @@
#include <xml/qname>
#include <xml/exception>
+#include <xml/details/config.hxx> // STUDXML_NOTHROW_NOEXCEPT
#include <xml/details/export.hxx>
namespace xml
{
- class LIBSTUDXML_EXPORT serialization: public exception
+ class serialization: public exception
{
public:
virtual
- ~serialization () throw ();
+ ~serialization () STUDXML_NOTHROW_NOEXCEPT {}
- serialization (const std::string& name,
- const std::string& description);
-
- serialization (const serializer&, const std::string& description);
+ serialization (const std::string& name, const std::string& description);
+ serialization (const serializer& s, const std::string& description);
const std::string&
name () const {return name_;}
@@ -39,10 +38,10 @@ namespace xml
description () const {return description_;}
virtual const char*
- what () const throw ();
+ what () const STUDXML_NOTHROW_NOEXCEPT {return what_.c_str ();}
private:
- void
+ LIBSTUDXML_EXPORT void
init ();
private:
diff --git a/xml/serializer.cxx b/xml/serializer.cxx
index 700243f..082f62d 100644
--- a/xml/serializer.cxx
+++ b/xml/serializer.cxx
@@ -13,23 +13,6 @@ namespace xml
{
// serialization
//
- serialization::
- ~serialization () throw () {}
-
- serialization::
- serialization (const string& n, const string& d)
- : name_ (n), description_ (d)
- {
- init ();
- }
-
- serialization::
- serialization (const serializer& s, const std::string& d)
- : name_ (s.output_name ()), description_ (d)
- {
- init ();
- }
-
void serialization::
init ()
{
@@ -43,12 +26,6 @@ namespace xml
what_ += description_;
}
- char const* serialization::
- what () const throw ()
- {
- return what_.c_str ();
- }
-
// serializer
//
extern "C" genxStatus
diff --git a/xml/serializer.ixx b/xml/serializer.ixx
index 59d329f..5336c3f 100644
--- a/xml/serializer.ixx
+++ b/xml/serializer.ixx
@@ -6,6 +6,24 @@
namespace xml
{
+ // serialization
+ //
+ inline serialization::
+ serialization (const std::string& name, const std::string& d)
+ : name_ (name), description_ (d)
+ {
+ init ();
+ }
+
+ inline serialization::
+ serialization (const serializer& s, const std::string& d)
+ : name_ (s.output_name ()), description_ (d)
+ {
+ init ();
+ }
+
+ // serializer
+ //
inline void serializer::
start_element (const qname_type& qname)
{