diff --git a/include/valijson/schema_parser.hpp b/include/valijson/schema_parser.hpp index 999a662..b89c774 100644 --- a/include/valijson/schema_parser.hpp +++ b/include/valijson/schema_parser.hpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -72,10 +73,10 @@ public: DocumentType; /// Templated function pointer type for fetching remote documents - typedef const DocumentType * (*FetchDoc)(const std::string &uri); + typedef std::function< const DocumentType* (const std::string &uri) > FetchDoc ; /// Templated function pointer type for freeing fetched documents - typedef void (*FreeDoc)(const DocumentType *); + typedef std::function< void (const DocumentType *)> FreeDoc ; }; /** @@ -118,10 +119,10 @@ public: void populateSchema( const AdapterType &node, Schema &schema, - typename FunctionPtrs::FetchDoc fetchDoc = NULL, - typename FunctionPtrs::FreeDoc freeDoc = NULL) + typename FunctionPtrs::FetchDoc fetchDoc = nullptr , + typename FunctionPtrs::FreeDoc freeDoc = nullptr ) { - if ((fetchDoc == NULL) ^ (freeDoc == NULL)) { + if ((fetchDoc == nullptr ) ^ (freeDoc == nullptr)) { throw std::runtime_error( "Remote document fetching cannot be enabled without both " "fetch and free functions");