diff --git a/.travis.yml b/.travis.yml index 7bf39ee..9665a6a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,8 +9,8 @@ env: # - CXX_STANDARD=c++14 compiler: -# - clang - gcc + - clang before_install: - CMAKE_URL="https://cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.tar.gz" @@ -29,6 +29,6 @@ before_install: script: - mkdir build/cmake - cd build/cmake - - cmake -G "Unix Makefiles" ../.. + - cmake ../.. - make - ctest diff --git a/src/libraries/xeumeuleu/bridges/xerces/detail/import.hpp b/src/libraries/xeumeuleu/bridges/xerces/detail/import.hpp index 225514b..ccf56cf 100644 --- a/src/libraries/xeumeuleu/bridges/xerces/detail/import.hpp +++ b/src/libraries/xeumeuleu/bridges/xerces/detail/import.hpp @@ -54,7 +54,7 @@ namespace detail XERCES_CPP_NAMESPACE::DOMNode& to ) { xerces_ptr< XERCES_CPP_NAMESPACE::DOMNode > child( document.importNode( const_cast< XERCES_CPP_NAMESPACE::DOMNode* >( &from ), false ) ); - *to.appendChild( child.get() ); + to.appendChild( child.get() ); return child.release(); } } diff --git a/src/libraries/xeumeuleu/bridges/xerces/detail/locator_handler.hpp b/src/libraries/xeumeuleu/bridges/xerces/detail/locator_handler.hpp index 56e6fed..ffdd58e 100644 --- a/src/libraries/xeumeuleu/bridges/xerces/detail/locator_handler.hpp +++ b/src/libraries/xeumeuleu/bridges/xerces/detail/locator_handler.hpp @@ -76,10 +76,14 @@ class locator_handler : public XERCES_CPP_NAMESPACE::DOMUserDataHandler break; case NODE_CLONED: case NODE_IMPORTED: + { const locator* l = static_cast< locator* >( src->getUserData( key ) ); delete static_cast< locator* >( dst->getUserData( key ) ); dst->setUserData( key, l ? new locator( *l ) : 0, this ); break; + } + default: + break; } } //@} diff --git a/src/libraries/xeumeuleu/streams/id.hpp b/src/libraries/xeumeuleu/streams/id.hpp index 6fa4e24..30db8c6 100644 --- a/src/libraries/xeumeuleu/streams/id.hpp +++ b/src/libraries/xeumeuleu/streams/id.hpp @@ -45,7 +45,7 @@ namespace xml */ // Created: MAT 2014-12-04 // ============================================================================= - class id +class id { public: //! @name Constructors/Destructor diff --git a/src/libraries/xeumeuleu/streams/xistringstream.hpp b/src/libraries/xeumeuleu/streams/xistringstream.hpp index 54e7254..2c171b1 100644 --- a/src/libraries/xeumeuleu/streams/xistringstream.hpp +++ b/src/libraries/xeumeuleu/streams/xistringstream.hpp @@ -60,12 +60,22 @@ class xistringstream : private document, public xistream public: //! @name Constructors/Destructor //@{ - xistringstream( const std::string& data, const grammar& grammar = null_grammar(), const id& id = id() ) + explicit xistringstream( const std::string& data, const grammar& grammar = null_grammar() ) + : document( data.c_str(), data.size(), 0, grammar, id() ) + , xistream( input_ ) + , input_( *document_ ) + {} + xistringstream( const std::string& data, const grammar& grammar, const id& id ) : document( data.c_str(), data.size(), 0, grammar, id ) , xistream( input_ ) , input_( *document_ ) {} - xistringstream( const std::string& data, const encoding& encoding, const grammar& grammar = null_grammar(), const id& id = id() ) + xistringstream( const std::string& data, const encoding& encoding, const grammar& grammar = null_grammar() ) + : document( data.c_str(), data.size(), &encoding, grammar, id() ) + , xistream( input_ ) + , input_( *document_ ) + {} + xistringstream( const std::string& data, const encoding& encoding, const grammar& grammar, const id& id ) : document( data.c_str(), data.size(), &encoding, grammar, id ) , xistream( input_ ) , input_( *document_ ) diff --git a/src/libraries/xeumeuleu/streams/xisubstream.hpp b/src/libraries/xeumeuleu/streams/xisubstream.hpp index b470d27..a2b7173 100644 --- a/src/libraries/xeumeuleu/streams/xisubstream.hpp +++ b/src/libraries/xeumeuleu/streams/xisubstream.hpp @@ -76,14 +76,6 @@ class xisubstream : private xi_base_member, public xistream virtual ~xisubstream() {} //@} - - //! @name Operators - //@{ - operator xistream&() const - { - return const_cast< xisubstream& >( *this ); - } - //@} }; } diff --git a/src/libraries/xeumeuleu/streams/xofstream.hpp b/src/libraries/xeumeuleu/streams/xofstream.hpp index 06aeb02..d4f244c 100644 --- a/src/libraries/xeumeuleu/streams/xofstream.hpp +++ b/src/libraries/xeumeuleu/streams/xofstream.hpp @@ -61,7 +61,14 @@ class xofstream : private document, private flushable, public xostream public: //! @name Constructors/Destructor //@{ - explicit xofstream( const std::string& filename, const encoding& encoding = encoding() ) + explicit xofstream( const std::string& filename ) + : xostream( output_ ) + , output_ ( *document_, *document_, *this ) + , filename_( filename ) + , encoding_( encoding() ) + , flushed_ ( false ) + {} + xofstream( const std::string& filename, const encoding& encoding ) : xostream( output_ ) , output_ ( *document_, *document_, *this ) , filename_( filename ) diff --git a/src/libraries/xeumeuleu/streams/xostreamstream.hpp b/src/libraries/xeumeuleu/streams/xostreamstream.hpp index 4afeb71..5315f8b 100644 --- a/src/libraries/xeumeuleu/streams/xostreamstream.hpp +++ b/src/libraries/xeumeuleu/streams/xostreamstream.hpp @@ -58,7 +58,14 @@ class xostreamstream : private document, private flushable, public xostream public: //! @name Constructors/Destructor //@{ - explicit xostreamstream( std::basic_ostream< char >& stream, const encoding& encoding = encoding() ) + explicit xostreamstream( std::basic_ostream< char >& stream ) + : xostream( output_ ) + , output_ ( *document_, *document_, *this ) + , stream_ ( stream ) + , encoding_( encoding() ) + , flushed_ ( false ) + {} + xostreamstream( std::basic_ostream< char >& stream, const encoding& encoding ) : xostream( output_ ) , output_ ( *document_, *document_, *this ) , stream_ ( stream ) diff --git a/src/libraries/xeumeuleu/streams/xostringstream.hpp b/src/libraries/xeumeuleu/streams/xostringstream.hpp index fdcbae4..2afa5d7 100644 --- a/src/libraries/xeumeuleu/streams/xostringstream.hpp +++ b/src/libraries/xeumeuleu/streams/xostringstream.hpp @@ -58,7 +58,12 @@ class xostringstream : private document, public xostream public: //! @name Constructors/Destructor //@{ - explicit xostringstream( const encoding& encoding = encoding() ) + xostringstream() + : xostream( output_ ) + , output_ ( *document_, *document_ ) + , encoding_( encoding() ) + {} + explicit xostringstream( const encoding& encoding ) : xostream( output_ ) , output_ ( *document_, *document_ ) , encoding_( encoding ) diff --git a/src/libraries/xeumeuleu/streams/xosubstream.hpp b/src/libraries/xeumeuleu/streams/xosubstream.hpp index be55b3e..b9c3d1f 100644 --- a/src/libraries/xeumeuleu/streams/xosubstream.hpp +++ b/src/libraries/xeumeuleu/streams/xosubstream.hpp @@ -75,14 +75,6 @@ class xosubstream : private xo_base_member, public xostream {} //@} - //! @name Operators - //@{ - operator xostream&() const - { - return const_cast< xosubstream& >( *this ); - } - //@} - private: //! @name Operations //@{ diff --git a/src/tests/xeumeuleu_test/attribute_test.cpp b/src/tests/xeumeuleu_test/attribute_test.cpp index 35cd388..ced71a5 100644 --- a/src/tests/xeumeuleu_test/attribute_test.cpp +++ b/src/tests/xeumeuleu_test/attribute_test.cpp @@ -324,7 +324,7 @@ BOOST_AUTO_TEST_CASE( writing_attribute_pointer_equal_to_nullptr_fallback_value_ BOOST_AUTO_TEST_CASE( writing_attribute_pointer_different_from_nullptr_fallback_value_writes_it ) { xml::xostringstream xos; - const user_type t; + const user_type t = user_type(); xos << xml::start( "root" ) << xml::attribute( "attribute", &t, nullptr ); const std::string expected = "\n"