src.dualinventive.com/dinet/libdipp/include/di/JsonDiff.h

44 lines
848 B
C++

/**
* @file JsonDiff.h
* @brief Differs JSON objects
* @date Jul 22, 2015
* @author R.W.A. van der Heijden
* @copyright 2015 Dual Inventive Technology Centre B.V.
*
* Compares two JSON objects or arrays with each other.
*/
#ifndef INCLUDE_DI_JSONDIFF_H_
#define INCLUDE_DI_JSONDIFF_H_
#include <memory>
#include <cstdint>
namespace Di {
class Json;
/**
* @class JsonDiff
*
* JSON difference checker
*/
class JsonDiff {
public:
void setEpsilon(double epsilon);
bool diff(std::shared_ptr<Json> from, std::shared_ptr<Json> to);
JsonDiff() : _epsilon(0.001) {
}
protected:
bool _iseq(double a, double b);
bool _diffObject(std::shared_ptr<Json> from, std::shared_ptr<Json> to);
bool _diffArray(std::shared_ptr<Json> from, std::shared_ptr<Json> to);
double _epsilon;
};
} // namespace Di
#endif // INCLUDE_DI_JSONDIFF_H_