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();
}
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
// fmt to that string if it exists.

View File

@ -28,7 +28,7 @@ public:
protected:
//! Get a human readable string describing the exception
virtual std::string getWhat() const throw()
virtual std::string getWhat() const noexcept
{
return "";
}
@ -39,7 +39,7 @@ protected:
no format can be found, then replaces positional parameters in
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:
mutable std::string m_what;

View File

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

View File

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

View File

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

View File

@ -36,18 +36,18 @@ public:
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;
//! @name accessors
//@{
//! Get the error code
EError getError() const throw();
EError getError() const noexcept;
//! Get the hostname
std::string getHostname() const throw();
std::string getHostname() const noexcept;
//! Get the port
int getPort() const throw();
int getPort() const noexcept;
//@}