|
|
@@ -1,31 +1,43 @@
|
|
|
#include <string>
|
|
|
#include "jsonException.hh"
|
|
|
|
|
|
-JsonException::JsonException(const std::string &wh, unsigned long long pos, WrappedBuffer<char, ERROR_HISTORY_LEN> &h): offset(pos), history(h), _what(wh)
|
|
|
+JsonException::JsonException(const std::string &wh, unsigned long long pos, LinearHistory &h): offset(pos), history(h), _what(wh)
|
|
|
{ }
|
|
|
|
|
|
-JsonFormatException::JsonFormatException(unsigned long long pos, WrappedBuffer<char, ERROR_HISTORY_LEN> &h):
|
|
|
+JsonHexvalueException::JsonHexvalueException(const std::string &what, unsigned long long o, LinearHistory &h): JsonException(what, o, h)
|
|
|
+{ }
|
|
|
+
|
|
|
+JsonHexvalueException::JsonHexvalueException(char c, unsigned long long o, LinearHistory &h): JsonException(JsonHexvalueException::msg(c), o, h)
|
|
|
+{ }
|
|
|
+
|
|
|
+JsonFormatException::JsonFormatException(unsigned long long pos, LinearHistory &h):
|
|
|
JsonException("invalid value", pos, h)
|
|
|
{ }
|
|
|
|
|
|
-JsonNotJsonException::JsonNotJsonException(unsigned long long pos, WrappedBuffer<char, ERROR_HISTORY_LEN> &h):
|
|
|
+JsonNotJsonException::JsonNotJsonException(unsigned long long pos, LinearHistory &h):
|
|
|
JsonException("expected json entry, got token", pos, h)
|
|
|
{ }
|
|
|
|
|
|
-JsonEscapedException::JsonEscapedException(char ch, unsigned long long pos, WrappedBuffer<char, ERROR_HISTORY_LEN> &h):
|
|
|
+JsonEscapedException::JsonEscapedException(char ch, unsigned long long pos, LinearHistory &h):
|
|
|
JsonException("unexpected escaped char " +c, pos, h), c(ch)
|
|
|
{ }
|
|
|
|
|
|
-JsonUnexpectedException::JsonUnexpectedException(const char expected, unsigned long long offset, WrappedBuffer<char, ERROR_HISTORY_LEN> &h): JsonException("expected " +expected, offset, h)
|
|
|
+JsonUnexpectedException::JsonUnexpectedException(const char expected, unsigned long long offset, LinearHistory &h): JsonException("expected " +expected, offset, h)
|
|
|
{ }
|
|
|
|
|
|
-std::string JsonException::getHistory() const
|
|
|
+std::string JsonHexvalueException::msg(char c)
|
|
|
{
|
|
|
- return history.toString();
|
|
|
+ std::string what = "invalid hex value '";
|
|
|
+ what += c + '\'';
|
|
|
+ return what;
|
|
|
}
|
|
|
|
|
|
+unsigned int JsonException::currentLine() const
|
|
|
+{ return history.currentLine(); }
|
|
|
+
|
|
|
+std::string JsonException::getHistory() const
|
|
|
+{ return history.toString(); }
|
|
|
+
|
|
|
const char *JsonException::what() const noexcept
|
|
|
-{
|
|
|
- return _what.c_str();
|
|
|
-}
|
|
|
+{ return _what.c_str(); }
|
|
|
|