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