Skip to content

File json_traverse.hpp

File List > backends > cxx > include > zmbt > core > json_traverse.hpp

Go to the documentation of this file

#ifndef ZMBT_CORE_JSON_TRAVERSE_HPP_
#define ZMBT_CORE_JSON_TRAVERSE_HPP_

#include <functional>
#include <string>
#include "boost/json.hpp"



namespace zmbt {



class JsonTraverse
{
    void traverse(boost::json::value const& v, std::string const jptr) const;
public:

    typedef std::function<bool(boost::json::value const&, std::string const)> visitor_fn;

    JsonTraverse(visitor_fn visit) : visit_{visit} {}

    void operator()(boost::json::value const& v) const
    {
        return traverse(v, "");
    }
private:
    visitor_fn const visit_;
};

}

#endif // ZMBT_CORE_JSON_TRAVERSE_HPP_