defs.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #include "defs.h"
  2. using namespace NJson;
  3. TJsonCallbacks::~TJsonCallbacks() {
  4. }
  5. bool TJsonCallbacks::OnNull() {
  6. return true;
  7. }
  8. bool TJsonCallbacks::OnBoolean(bool) {
  9. return true;
  10. }
  11. bool TJsonCallbacks::OnInteger(long long) {
  12. return true;
  13. }
  14. bool TJsonCallbacks::OnUInteger(unsigned long long) {
  15. return true;
  16. }
  17. bool TJsonCallbacks::OnDouble(double) {
  18. return true;
  19. }
  20. bool TJsonCallbacks::OnString(const TStringBuf&) {
  21. return true;
  22. }
  23. bool TJsonCallbacks::OnOpenMap() {
  24. return true;
  25. }
  26. bool TJsonCallbacks::OnMapKey(const TStringBuf&) {
  27. return true;
  28. }
  29. bool TJsonCallbacks::OnCloseMap() {
  30. return true;
  31. }
  32. bool TJsonCallbacks::OnOpenArray() {
  33. return true;
  34. }
  35. bool TJsonCallbacks::OnCloseArray() {
  36. return true;
  37. }
  38. bool TJsonCallbacks::OnStringNoCopy(const TStringBuf& s) {
  39. return OnString(s);
  40. }
  41. bool TJsonCallbacks::OnMapKeyNoCopy(const TStringBuf& s) {
  42. return OnMapKey(s);
  43. }
  44. bool TJsonCallbacks::OnEnd() {
  45. return true;
  46. }
  47. void TJsonCallbacks::OnError(size_t off, TStringBuf reason) {
  48. HaveErrors = true;
  49. if (ThrowException) {
  50. ythrow TJsonException() << "JSON error at offset " << off << " (" << reason << ")";
  51. }
  52. }