aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/utils/exceptn.h
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-03-05 13:10:30 -0500
committerJack Lloyd <[email protected]>2016-03-05 13:10:30 -0500
commita3ce0bd1e9e018ea69741c4380bf065cccedec93 (patch)
tree71eac335b7bdc3a845b1d6599b78e337ad00433c /src/lib/utils/exceptn.h
parent2467ccccd48fc502ee3e04d847d514e88d88b144 (diff)
parentc3540ae668a523c0155677c4ee4c9099910110bc (diff)
Make almost all single argument constructors `explicit`
GH #444
Diffstat (limited to 'src/lib/utils/exceptn.h')
-rw-r--r--src/lib/utils/exceptn.h34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/lib/utils/exceptn.h b/src/lib/utils/exceptn.h
index 1e9cd68d5..b6797f0f6 100644
--- a/src/lib/utils/exceptn.h
+++ b/src/lib/utils/exceptn.h
@@ -21,7 +21,7 @@ namespace Botan {
class BOTAN_DLL Exception : public std::exception
{
public:
- Exception(const std::string& msg) : m_msg(msg) {}
+ explicit Exception(const std::string& msg) : m_msg(msg) {}
Exception(const char* prefix, const std::string& msg) : m_msg(std::string(prefix) + " " + msg) {}
const char* what() const BOTAN_NOEXCEPT override { return m_msg.c_str(); }
private:
@@ -34,7 +34,7 @@ class BOTAN_DLL Exception : public std::exception
class BOTAN_DLL Invalid_Argument : public Exception
{
public:
- Invalid_Argument(const std::string& msg) :
+ explicit Invalid_Argument(const std::string& msg) :
Exception("Invalid argument", msg) {}
};
@@ -46,7 +46,7 @@ class BOTAN_DLL Invalid_Argument : public Exception
*/
struct BOTAN_DLL Unsupported_Argument : public Invalid_Argument
{
- Unsupported_Argument(const std::string& msg) : Invalid_Argument(msg) {}
+ explicit Unsupported_Argument(const std::string& msg) : Invalid_Argument(msg) {}
};
/**
@@ -54,7 +54,7 @@ struct BOTAN_DLL Unsupported_Argument : public Invalid_Argument
*/
struct BOTAN_DLL Invalid_State : public Exception
{
- Invalid_State(const std::string& err) :
+ explicit Invalid_State(const std::string& err) :
Exception(err)
{}
};
@@ -64,7 +64,7 @@ struct BOTAN_DLL Invalid_State : public Exception
*/
struct BOTAN_DLL Lookup_Error : public Exception
{
- Lookup_Error(const std::string& err) :
+ explicit Lookup_Error(const std::string& err) :
Exception(err)
{}
};
@@ -74,7 +74,7 @@ struct BOTAN_DLL Lookup_Error : public Exception
*/
struct BOTAN_DLL Internal_Error : public Exception
{
- Internal_Error(const std::string& err) :
+ explicit Internal_Error(const std::string& err) :
Exception("Internal error: " + err)
{}
};
@@ -106,7 +106,7 @@ struct BOTAN_DLL Invalid_IV_Length : public Invalid_Argument
*/
struct BOTAN_DLL PRNG_Unseeded : public Invalid_State
{
- PRNG_Unseeded(const std::string& algo) :
+ explicit PRNG_Unseeded(const std::string& algo) :
Invalid_State("PRNG not seeded: " + algo)
{}
};
@@ -116,7 +116,7 @@ struct BOTAN_DLL PRNG_Unseeded : public Invalid_State
*/
struct BOTAN_DLL Policy_Violation : public Invalid_State
{
- Policy_Violation(const std::string& err) :
+ explicit Policy_Violation(const std::string& err) :
Invalid_State("Policy violation: " + err)
{}
};
@@ -126,7 +126,7 @@ struct BOTAN_DLL Policy_Violation : public Invalid_State
*/
struct BOTAN_DLL Algorithm_Not_Found : public Lookup_Error
{
- Algorithm_Not_Found(const std::string& name) :
+ explicit Algorithm_Not_Found(const std::string& name) :
Lookup_Error("Could not find any algorithm named \"" + name + "\"")
{}
};
@@ -136,7 +136,7 @@ struct BOTAN_DLL Algorithm_Not_Found : public Lookup_Error
*/
struct BOTAN_DLL No_Provider_Found : public Exception
{
- No_Provider_Found(const std::string& name) :
+ explicit No_Provider_Found(const std::string& name) :
Exception("Could not find any provider for algorithm named \"" + name + "\"")
{}
};
@@ -146,7 +146,7 @@ struct BOTAN_DLL No_Provider_Found : public Exception
*/
struct BOTAN_DLL Invalid_Algorithm_Name : public Invalid_Argument
{
- Invalid_Algorithm_Name(const std::string& name):
+ explicit Invalid_Algorithm_Name(const std::string& name):
Invalid_Argument("Invalid algorithm name: " + name)
{}
};
@@ -156,7 +156,7 @@ struct BOTAN_DLL Invalid_Algorithm_Name : public Invalid_Argument
*/
struct BOTAN_DLL Encoding_Error : public Invalid_Argument
{
- Encoding_Error(const std::string& name) :
+ explicit Encoding_Error(const std::string& name) :
Invalid_Argument("Encoding error: " + name) {}
};
@@ -165,7 +165,7 @@ struct BOTAN_DLL Encoding_Error : public Invalid_Argument
*/
struct BOTAN_DLL Decoding_Error : public Invalid_Argument
{
- Decoding_Error(const std::string& name) :
+ explicit Decoding_Error(const std::string& name) :
Invalid_Argument("Decoding error: " + name) {}
};
@@ -174,7 +174,7 @@ struct BOTAN_DLL Decoding_Error : public Invalid_Argument
*/
struct BOTAN_DLL Integrity_Failure : public Exception
{
- Integrity_Failure(const std::string& msg) :
+ explicit Integrity_Failure(const std::string& msg) :
Exception("Integrity failure: " + msg) {}
};
@@ -183,7 +183,7 @@ struct BOTAN_DLL Integrity_Failure : public Exception
*/
struct BOTAN_DLL Invalid_OID : public Decoding_Error
{
- Invalid_OID(const std::string& oid) :
+ explicit Invalid_OID(const std::string& oid) :
Decoding_Error("Invalid ASN.1 OID: " + oid) {}
};
@@ -192,7 +192,7 @@ struct BOTAN_DLL Invalid_OID : public Decoding_Error
*/
struct BOTAN_DLL Stream_IO_Error : public Exception
{
- Stream_IO_Error(const std::string& err) :
+ explicit Stream_IO_Error(const std::string& err) :
Exception("I/O error: " + err)
{}
};
@@ -210,7 +210,7 @@ struct BOTAN_DLL No_Filesystem_Access : public Exception
*/
struct BOTAN_DLL Self_Test_Failure : public Internal_Error
{
- Self_Test_Failure(const std::string& err) :
+ explicit Self_Test_Failure(const std::string& err) :
Internal_Error("Self test failed: " + err)
{}
};