mirror of
https://github.com/tristanpenman/valijson.git
synced 2024-12-12 10:13:51 +01:00
Minor suggestions from clangtidy
This commit is contained in:
parent
a527564b10
commit
7f01c39116
@ -35,7 +35,7 @@ public:
|
||||
* @brief Virtual destructor defined to ensure deletion via base-class
|
||||
* pointers is safe.
|
||||
*/
|
||||
virtual ~Adapter() { };
|
||||
virtual ~Adapter() = default;;
|
||||
|
||||
/**
|
||||
* @brief Apply a callback function to each value in an array.
|
||||
|
@ -13,7 +13,7 @@ namespace constraints {
|
||||
class ConstraintBuilder
|
||||
{
|
||||
public:
|
||||
virtual ~ConstraintBuilder() {}
|
||||
virtual ~ConstraintBuilder() = default;
|
||||
|
||||
virtual constraints::Constraint * make(const adapters::Adapter &) const = 0;
|
||||
};
|
||||
|
@ -365,6 +365,7 @@ public:
|
||||
m_enumValues.push_back(value);
|
||||
} catch (...) {
|
||||
delete value;
|
||||
value = nullptr;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ struct Constraint
|
||||
/**
|
||||
* @brief Virtual destructor.
|
||||
*/
|
||||
virtual ~Constraint() { }
|
||||
virtual ~Constraint() = default;
|
||||
|
||||
/**
|
||||
* @brief Perform an action on the constraint using the visitor pattern.
|
||||
|
@ -36,7 +36,7 @@ class UniqueItemsConstraint;
|
||||
class ConstraintVisitor
|
||||
{
|
||||
protected:
|
||||
virtual ~ConstraintVisitor() {}
|
||||
virtual ~ConstraintVisitor() = default;
|
||||
|
||||
// Shorten type names for derived classes outside of this namespace
|
||||
typedef constraints::AllOfConstraint AllOfConstraint;
|
||||
|
@ -50,7 +50,7 @@ inline char decodePercentEncodedChar(const std::string &digits)
|
||||
|
||||
errno = 0;
|
||||
const char *begin = digits.c_str();
|
||||
char *end = NULL;
|
||||
char *end = nullptr;
|
||||
const unsigned long value = strtoul(begin, &end, 16);
|
||||
if (end != begin && *end != '\0') {
|
||||
throw std::runtime_error("Failed to decode %-encoded character '" +
|
||||
@ -178,7 +178,7 @@ inline AdapterType resolveJsonPointer(
|
||||
return resolveJsonPointer(node, jsonPointer, jsonPointerNext);
|
||||
|
||||
} else if (node.isArray()) {
|
||||
if (referenceToken.compare("-") == 0) {
|
||||
if (referenceToken == "-") {
|
||||
throw std::runtime_error("Hyphens cannot be used as array indices "
|
||||
"since the requested array element does not yet exist");
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ namespace json_reference {
|
||||
inline opt::optional<std::string> getJsonReferenceUri(
|
||||
const std::string &jsonRef)
|
||||
{
|
||||
const size_t ptrPos = jsonRef.find("#");
|
||||
const size_t ptrPos = jsonRef.find('#');
|
||||
if (ptrPos == 0) {
|
||||
// The JSON Reference does not contain a URI, but might contain a
|
||||
// JSON Pointer that refers to the current document
|
||||
@ -47,7 +47,7 @@ inline opt::optional<std::string> getJsonReferencePointer(
|
||||
// Attempt to extract JSON Pointer if '#' character is present. Note
|
||||
// that a valid pointer would contain at least a leading forward
|
||||
// slash character.
|
||||
const size_t ptrPos = jsonRef.find("#");
|
||||
const size_t ptrPos = jsonRef.find('#');
|
||||
if (ptrPos != std::string::npos) {
|
||||
return jsonRef.substr(ptrPos + 1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user