Skip to content

Commit 511ef20

Browse files
committed
Make constructors explicit
Most constructors were not marked as explicit. With many constructors now taking a single Error object as argument this would allow them to be implicitly created from an Error object. Since this would be confusing we now mark the constructors as explicit. The old behaviour can be restored by defining the preprocessor value CRYPTOLENS_20190701_ALLOW_IMPLICIT_CONSTRUCTORS.
1 parent 371f6df commit 511ef20

19 files changed

+57
-0
lines changed

include/cryptolens/LicenseKeyChecker.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ class LicenseKeyChecker {
1313
LicenseKeyInformation const* key_;
1414

1515
public:
16+
#ifndef CRYPTOLENS_20190701_ALLOW_IMPLICIT_CONSTRUCTORS
17+
explicit
18+
#endif
1619
LicenseKeyChecker(LicenseKeyInformation const* license_key);
1720

1821
explicit operator bool() const;

include/cryptolens/MachineCodeComputer_COM.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ namespace MachineCodeComputer_COM_Recompute {}
2727
class MachineCodeComputer_COM_Recompute
2828
{
2929
public:
30+
#ifndef CRYPTOLENS_20190701_ALLOW_IMPLICIT_CONSTRUCTORS
31+
explicit
32+
#endif
3033
MachineCodeComputer_COM_Recompute(basic_Error & e) {}
3134

3235
std::string

include/cryptolens/MachineCodeComputer_caching.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ template<typename MachineCodeComputer>
2020
class MachineCodeComputer_caching
2121
{
2222
public:
23+
#ifndef CRYPTOLENS_20190701_ALLOW_IMPLICIT_CONSTRUCTORS
24+
explicit
25+
#endif
2326
MachineCodeComputer_caching(basic_Error & e)
2427
: machine_code_()
2528
{

include/cryptolens/MachineCodeComputer_static.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ namespace MachineCodeComputer_static {}
1919
class MachineCodeComputer_static
2020
{
2121
public:
22+
#ifndef CRYPTOLENS_20190701_ALLOW_IMPLICIT_CONSTRUCTORS
23+
explicit
24+
#endif
2225
MachineCodeComputer_static(basic_Error & e) {}
2326

2427
void

include/cryptolens/RequestHandler_WinHTTP.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ class RequestHandler_WinHTTP_PostBuilder {
6161
class RequestHandler_WinHTTP
6262
{
6363
public:
64+
#ifndef CRYPTOLENS_20190701_ALLOW_IMPLICIT_CONSTRUCTORS
65+
explicit
66+
#endif
6467
RequestHandler_WinHTTP(basic_Error & e);
6568
#ifndef CRYPTOLENS_ENABLE_DANGEROUS_COPY_MOVE_CONSTRUCTOR
6669
RequestHandler_WinHTTP(RequestHandler_WinHTTP const&) = delete;

include/cryptolens/RequestHandler_curl.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ class RequestHandler_curl_PostBuilder {
5858
class RequestHandler_curl
5959
{
6060
public:
61+
#ifndef CRYPTOLENS_20190701_ALLOW_IMPLICIT_CONSTRUCTORS
62+
explicit
63+
#endif
6164
RequestHandler_curl(basic_Error & e);
6265
#ifndef CRYPTOLENS_ENABLE_DANGEROUS_COPY_MOVE_CONSTRUCTOR
6366
RequestHandler_curl(RequestHandler_curl const&) = delete;

include/cryptolens/RequestHandler_v20190401_to_v20180502.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ template<typename RequestHandler>
1212
class RequestHandler_v20190401_to_v20180502
1313
{
1414
public:
15+
#ifndef CRYPTOLENS_20190701_ALLOW_IMPLICIT_CONSTRUCTORS
16+
explicit
17+
#endif
1518
RequestHandler_v20190401_to_v20180502();
1619

1720
template<typename Map>

include/cryptolens/ResponseParser_ArduinoJson5.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ class ResponseParser_ArduinoJson5 {
1818
* a custom ResponseParser.
1919
*/
2020
public:
21+
#ifndef CRYPTOLENS_20190701_ALLOW_IMPLICIT_CONSTRUCTORS
22+
explicit
23+
#endif
2124
ResponseParser_ArduinoJson5(basic_Error & e) {}
2225

2326
optional<LicenseKeyInformation> make_license_key_information(basic_Error & e, RawLicenseKey const& raw_license_key) const;

include/cryptolens/SignatureVerifier_CryptoAPI.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ namespace v20190401 {
2626
class SignatureVerifier_CryptoAPI
2727
{
2828
public:
29+
#ifndef CRYPTOLENS_20190701_ALLOW_IMPLICIT_CONSTRUCTORS
30+
explicit
31+
#endif
2932
SignatureVerifier_CryptoAPI(basic_Error & e);
3033
#ifndef CRYPTOLENS_ENABLE_DANGEROUS_COPY_MOVE_CONSTRUCTOR
3134
SignatureVerifier_CryptoAPI(SignatureVerifier_CryptoAPI const&) = delete;

include/cryptolens/SignatureVerifier_OpenSSL.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ namespace v20190401 {
2525
class SignatureVerifier_OpenSSL
2626
{
2727
public:
28+
#ifndef CRYPTOLENS_20190701_ALLOW_IMPLICIT_CONSTRUCTORS
29+
explicit
30+
#endif
2831
SignatureVerifier_OpenSSL(basic_Error & e);
2932
#ifndef CRYPTOLENS_ENABLE_DANGEROUS_COPY_MOVE_CONSTRUCTOR
3033
SignatureVerifier_OpenSSL(SignatureVerifier_OpenSSL const&) = delete;

0 commit comments

Comments
 (0)