refactor: replace throw() with noexcept in cases where execeptions are not possible

This commit is contained in:
sithlord48 2025-07-07 21:45:40 -04:00 committed by Chris Rizzitello
parent 77bdde5434
commit fc58688bb0
6 changed files with 21 additions and 21 deletions

View file

@ -34,7 +34,7 @@ const char *XBase::what() const throw()
return m_what.c_str(); return m_what.c_str();
} }
std::string XBase::format(const char * /*id*/, const char *fmt, ...) const throw() std::string XBase::format(const char * /*id*/, const char *fmt, ...) const noexcept
{ {
// FIXME -- lookup message string using id as an index. set // FIXME -- lookup message string using id as an index. set
// fmt to that string if it exists. // fmt to that string if it exists.

View file

@ -28,7 +28,7 @@ public:
protected: protected:
//! Get a human readable string describing the exception //! Get a human readable string describing the exception
virtual std::string getWhat() const throw() virtual std::string getWhat() const noexcept
{ {
return ""; return "";
} }
@ -39,7 +39,7 @@ protected:
no format can be found, then replaces positional parameters in no format can be found, then replaces positional parameters in
the format string and returns the result. the format string and returns the result.
*/ */
virtual std::string format(const char *id, const char *defaultFormat, ...) const throw(); virtual std::string format(const char *id, const char *defaultFormat, ...) const noexcept;
private: private:
mutable std::string m_what; mutable std::string m_what;

View file

@ -35,12 +35,12 @@ XIncompatibleClient::XIncompatibleClient(int major, int minor) : m_major(major),
// do nothing // do nothing
} }
int XIncompatibleClient::getMajor() const throw() int XIncompatibleClient::getMajor() const noexcept
{ {
return m_major; return m_major;
} }
int XIncompatibleClient::getMinor() const throw() int XIncompatibleClient::getMinor() const noexcept
{ {
return m_minor; return m_minor;
} }
@ -62,7 +62,7 @@ XDuplicateClient::XDuplicateClient(const std::string &name) : m_name(name)
// do nothing // do nothing
} }
const std::string &XDuplicateClient::getName() const throw() const std::string &XDuplicateClient::getName() const noexcept
{ {
return m_name; return m_name;
} }
@ -81,7 +81,7 @@ XUnknownClient::XUnknownClient(const std::string &name) : m_name(name)
// do nothing // do nothing
} }
const std::string &XUnknownClient::getName() const throw() const std::string &XUnknownClient::getName() const noexcept
{ {
return m_name; return m_name;
} }
@ -100,7 +100,7 @@ XExitApp::XExitApp(int code) : m_code(code)
// do nothing // do nothing
} }
int XExitApp::getCode() const throw() int XExitApp::getCode() const noexcept
{ {
return m_code; return m_code;
} }

View file

@ -52,9 +52,9 @@ public:
//@{ //@{
//! Get client's major version number //! Get client's major version number
int getMajor() const throw(); int getMajor() const noexcept;
//! Get client's minor version number //! Get client's minor version number
int getMinor() const throw(); int getMinor() const noexcept;
//@} //@}
@ -81,7 +81,7 @@ public:
//@{ //@{
//! Get client's name //! Get client's name
virtual const std::string &getName() const throw(); virtual const std::string &getName() const noexcept;
//@} //@}
@ -107,7 +107,7 @@ public:
//@{ //@{
//! Get the client's name //! Get the client's name
virtual const std::string &getName() const throw(); virtual const std::string &getName() const noexcept;
//@} //@}
@ -131,7 +131,7 @@ public:
~XExitApp() throw() override = default; ~XExitApp() throw() override = default;
//! Get the exit code //! Get the exit code
int getCode() const throw(); int getCode() const noexcept;
protected: protected:
std::string getWhat() const throw() override; std::string getWhat() const throw() override;

View file

@ -12,7 +12,7 @@
// XSocketAddress // XSocketAddress
// //
XSocketAddress::XSocketAddress(EError error, const std::string &hostname, int port) throw() XSocketAddress::XSocketAddress(EError error, const std::string &hostname, int port) noexcept
: m_error(error), : m_error(error),
m_hostname(hostname), m_hostname(hostname),
m_port(port) m_port(port)
@ -20,17 +20,17 @@ XSocketAddress::XSocketAddress(EError error, const std::string &hostname, int po
// do nothing // do nothing
} }
XSocketAddress::EError XSocketAddress::getError() const throw() XSocketAddress::EError XSocketAddress::getError() const noexcept
{ {
return m_error; return m_error;
} }
std::string XSocketAddress::getHostname() const throw() std::string XSocketAddress::getHostname() const noexcept
{ {
return m_hostname; return m_hostname;
} }
int XSocketAddress::getPort() const throw() int XSocketAddress::getPort() const noexcept
{ {
return m_port; return m_port;
} }

View file

@ -36,18 +36,18 @@ public:
kBadPort //!< The port is invalid kBadPort //!< The port is invalid
}; };
XSocketAddress(EError, const std::string &hostname, int port) throw(); XSocketAddress(EError, const std::string &hostname, int port) noexcept;
~XSocketAddress() throw() override = default; ~XSocketAddress() throw() override = default;
//! @name accessors //! @name accessors
//@{ //@{
//! Get the error code //! Get the error code
EError getError() const throw(); EError getError() const noexcept;
//! Get the hostname //! Get the hostname
std::string getHostname() const throw(); std::string getHostname() const noexcept;
//! Get the port //! Get the port
int getPort() const throw(); int getPort() const noexcept;
//@} //@}