diff --git a/include/sdf/Error.hh b/include/sdf/Error.hh index 9ae088e9c..3c059563e 100644 --- a/include/sdf/Error.hh +++ b/include/sdf/Error.hh @@ -171,14 +171,8 @@ namespace sdf /// \param[in,out] _out The output stream. /// \param[in] _err The error to output. /// \return Reference to the given output stream - public: friend std::ostream &operator<<(std::ostream &_out, - const sdf::Error &_err) - { - _out << "Error Code " - << static_cast::type>(_err.Code()) - << " Msg: " << _err.Message(); - return _out; - } + public: friend SDFORMAT_VISIBLE std::ostream &operator<<( + std::ostream &_out, const sdf::Error &_err); /// \brief The error code value. private: ErrorCode code = ErrorCode::NONE; diff --git a/src/Error.cc b/src/Error.cc index 4a262e833..1793ff238 100644 --- a/src/Error.cc +++ b/src/Error.cc @@ -51,3 +51,20 @@ bool Error::operator==(const bool _value) const return ((this->code != ErrorCode::NONE) && _value) || ((this->code == ErrorCode::NONE) && !_value); } + +namespace sdf +{ +// Inline bracket to help doxygen filtering. +inline namespace SDF_VERSION_NAMESPACE { + +///////////////////////////////////////////////// +// cppcheck-suppress unusedFunction +std::ostream &operator<<(std::ostream &_out, const sdf::Error &_err) +{ + _out << "Error Code " + << static_cast::type>(_err.Code()) + << " Msg: " << _err.Message(); + return _out; +} +} +}