#pragma once #include "jsonElement.hh" template class JSonPrimitive: public JSonElement { public: JSonPrimitive(JSonContainer *parent, T const &v); virtual ~JSonPrimitive(); T getValue() const; virtual std::string stringify() const; bool operator<(const JSonPrimitive &other) const; bool operator==(const JSonPrimitive &other) const; protected: const T value; }; template JSonPrimitive::JSonPrimitive(JSonContainer *parent, T const &v): JSonElement(parent), value(v) { } template T JSonPrimitive::getValue() const { return value; } template bool JSonPrimitive::operator<(const JSonPrimitive &other) const { return value < other.value; } template bool JSonPrimitive::operator==(const JSonPrimitive &other) const { return value == other.value; }