Skip to content
Permalink
Browse files

Merge pull request #9832 from elpaso/qjson-nlohmann

Fast (and beautiful) json serializing
  • Loading branch information
elpaso committed May 10, 2019
2 parents 8969360 + 0081ad0 commit 9a612d4e19eb9e85901a1640f08580ffb92e068c
Showing with 22,221 additions and 929 deletions.
  1. +49 −0 external/nlohmann/adl_serializer.hpp
  2. +370 −0 external/nlohmann/detail/conversions/from_json.hpp
  3. +1,097 −0 external/nlohmann/detail/conversions/to_chars.hpp
  4. +344 −0 external/nlohmann/detail/conversions/to_json.hpp
  5. +349 −0 external/nlohmann/detail/exceptions.hpp
  6. +1,986 −0 external/nlohmann/detail/input/binary_reader.hpp
  7. +439 −0 external/nlohmann/detail/input/input_adapters.hpp
  8. +700 −0 external/nlohmann/detail/input/json_sax.hpp
  9. +1,504 −0 external/nlohmann/detail/input/lexer.hpp
  10. +496 −0 external/nlohmann/detail/input/parser.hpp
  11. +27 −0 external/nlohmann/detail/input/position_t.hpp
  12. +25 −0 external/nlohmann/detail/iterators/internal_iterator.hpp
  13. +613 −0 external/nlohmann/detail/iterators/iter_impl.hpp
  14. +170 −0 external/nlohmann/detail/iterators/iteration_proxy.hpp
  15. +49 −0 external/nlohmann/detail/iterators/iterator_traits.hpp
  16. +119 −0 external/nlohmann/detail/iterators/json_reverse_iterator.hpp
  17. +120 −0 external/nlohmann/detail/iterators/primitive_iterator.hpp
  18. +939 −0 external/nlohmann/detail/json_pointer.hpp
  19. +69 −0 external/nlohmann/detail/json_ref.hpp
  20. +151 −0 external/nlohmann/detail/macro_scope.hpp
  21. +23 −0 external/nlohmann/detail/macro_unscope.hpp
  22. +63 −0 external/nlohmann/detail/meta/cpp_future.hpp
  23. +58 −0 external/nlohmann/detail/meta/detected.hpp
  24. +142 −0 external/nlohmann/detail/meta/is_sax.hpp
  25. +348 −0 external/nlohmann/detail/meta/type_traits.hpp
  26. +13 −0 external/nlohmann/detail/meta/void_t.hpp
  27. +1,335 −0 external/nlohmann/detail/output/binary_writer.hpp
  28. +119 −0 external/nlohmann/detail/output/output_adapters.hpp
  29. +840 −0 external/nlohmann/detail/output/serializer.hpp
  30. +77 −0 external/nlohmann/detail/value_t.hpp
  31. +8,053 −0 external/nlohmann/json.hpp
  32. +64 −0 external/nlohmann/json_fwd.hpp
  33. +1 −0 python/CMakeLists.txt
  34. +8 −2 python/core/auto_generated/geometry/qgsabstractgeometry.sip.in
  35. +0 −3 python/core/auto_generated/geometry/qgscircularstring.sip.in
  36. +0 −2 python/core/auto_generated/geometry/qgscompoundcurve.sip.in
  37. +0 −2 python/core/auto_generated/geometry/qgscurvepolygon.sip.in
  38. +2 −1 python/core/auto_generated/geometry/qgsgeometry.sip.in
  39. +0 −2 python/core/auto_generated/geometry/qgsgeometrycollection.sip.in
  40. +1 −0 python/core/auto_generated/geometry/qgsgeometryutils.sip.in
  41. +0 −2 python/core/auto_generated/geometry/qgslinestring.sip.in
  42. +0 −2 python/core/auto_generated/geometry/qgsmulticurve.sip.in
  43. +0 −2 python/core/auto_generated/geometry/qgsmultilinestring.sip.in
  44. +0 −2 python/core/auto_generated/geometry/qgsmultipoint.sip.in
  45. +0 −2 python/core/auto_generated/geometry/qgsmultipolygon.sip.in
  46. +0 −2 python/core/auto_generated/geometry/qgsmultisurface.sip.in
  47. +0 −2 python/core/auto_generated/geometry/qgspoint.sip.in
  48. +15 −2 python/core/auto_generated/qgsjsonutils.sip.in
  49. +1 −0 src/3d/CMakeLists.txt
  50. +1 −0 src/analysis/CMakeLists.txt
  51. +2 −0 src/app/CMakeLists.txt
  52. +3 −0 src/core/CMakeLists.txt
  53. +11 −0 src/core/geometry/qgsabstractgeometry.cpp
  54. +22 −2 src/core/geometry/qgsabstractgeometry.h
  55. +5 −3 src/core/geometry/qgscircularstring.cpp
  56. +1 −2 src/core/geometry/qgscircularstring.h
  57. +4 −3 src/core/geometry/qgscompoundcurve.cpp
  58. +1 −1 src/core/geometry/qgscompoundcurve.h
  59. +13 −12 src/core/geometry/qgscurvepolygon.cpp
  60. +1 −1 src/core/geometry/qgscurvepolygon.h
  61. +10 −2 src/core/geometry/qgsgeometry.cpp
  62. +13 −1 src/core/geometry/qgsgeometry.h
  63. +9 −9 src/core/geometry/qgsgeometrycollection.cpp
  64. +1 −1 src/core/geometry/qgsgeometrycollection.h
  65. +20 −0 src/core/geometry/qgsgeometryutils.cpp
  66. +7 −0 src/core/geometry/qgsgeometryutils.h
  67. +8 −3 src/core/geometry/qgslinestring.cpp
  68. +1 −1 src/core/geometry/qgslinestring.h
  69. +10 −10 src/core/geometry/qgsmulticurve.cpp
  70. +1 −1 src/core/geometry/qgsmulticurve.h
  71. +10 −8 src/core/geometry/qgsmultilinestring.cpp
  72. +1 −1 src/core/geometry/qgsmultilinestring.h
  73. +19 −13 src/core/geometry/qgsmultipoint.cpp
  74. +1 −1 src/core/geometry/qgsmultipoint.h
  75. +13 −19 src/core/geometry/qgsmultipolygon.cpp
  76. +1 −1 src/core/geometry/qgsmultipolygon.h
  77. +13 −20 src/core/geometry/qgsmultisurface.cpp
  78. +1 −1 src/core/geometry/qgsmultisurface.h
  79. +22 −9 src/core/geometry/qgspoint.cpp
  80. +1 −1 src/core/geometry/qgspoint.h
  81. +119 −71 src/core/qgsjsonutils.cpp
  82. +49 −2 src/core/qgsjsonutils.h
  83. +1 −0 src/gui/CMakeLists.txt
  84. +1 −0 src/plugins/coordinate_capture/CMakeLists.txt
  85. +1 −0 src/plugins/evis/CMakeLists.txt
  86. +1 −0 src/plugins/geometry_checker/CMakeLists.txt
  87. +1 −0 src/plugins/georeferencer/CMakeLists.txt
  88. +1 −0 src/plugins/globe/CMakeLists.txt
  89. +1 −0 src/plugins/gps_importer/CMakeLists.txt
  90. +1 −0 src/plugins/grass/CMakeLists.txt
  91. +1 −0 src/plugins/offline_editing/CMakeLists.txt
  92. +1 −0 src/plugins/topology/CMakeLists.txt
  93. +2 −1 src/providers/arcgisrest/CMakeLists.txt
  94. +1 −0 src/providers/db2/CMakeLists.txt
  95. +1 −0 src/providers/delimitedtext/CMakeLists.txt
  96. +1 −0 src/providers/gdal/CMakeLists.txt
  97. +1 −0 src/providers/geonode/CMakeLists.txt
  98. +1 −0 src/providers/gpx/CMakeLists.txt
  99. +1 −0 src/providers/grass/CMakeLists.txt
  100. +1 −0 src/providers/mdal/CMakeLists.txt
  101. +1 −0 src/providers/mssql/CMakeLists.txt
  102. +1 −0 src/providers/ogr/CMakeLists.txt
  103. +1 −0 src/providers/oracle/CMakeLists.txt
  104. +1 −0 src/providers/ows/CMakeLists.txt
  105. +1 −0 src/providers/postgres/CMakeLists.txt
  106. +3 −0 src/providers/spatialite/CMakeLists.txt
  107. +1 −0 src/providers/virtual/CMakeLists.txt
  108. +1 −0 src/providers/wcs/CMakeLists.txt
  109. +1 −0 src/providers/wfs/CMakeLists.txt
  110. +1 −0 src/providers/wms/CMakeLists.txt
  111. +1 −0 src/quickgui/CMakeLists.txt
  112. +1 −0 src/server/CMakeLists.txt
  113. +1 −0 src/server/services/DummyService/CMakeLists.txt
  114. +1 −0 src/server/services/wcs/CMakeLists.txt
  115. +1 −0 src/server/services/wfs/CMakeLists.txt
  116. +1 −0 src/server/services/wms/CMakeLists.txt
  117. +22 −29 src/server/services/wms/qgswmsrenderer.cpp
  118. +1 −0 src/server/services/wmts/CMakeLists.txt
  119. +1 −0 tests/bench/CMakeLists.txt
  120. +1 −0 tests/src/3d/CMakeLists.txt
  121. +1 −0 tests/src/analysis/CMakeLists.txt
  122. +1 −0 tests/src/app/CMakeLists.txt
  123. +6 −19 tests/src/app/testqgisappclipboard.cpp
  124. +1 −0 tests/src/core/CMakeLists.txt
  125. +44 −44 tests/src/core/testqgsgeometry.cpp
  126. +116 −0 tests/src/core/testqgsjsonutils.cpp
  127. +1 −0 tests/src/geometry_checker/CMakeLists.txt
  128. +1 −0 tests/src/gui/CMakeLists.txt
  129. +1 −0 tests/src/providers/CMakeLists.txt
  130. +402 −282 tests/src/python/test_qgsjsonutils.py
  131. +15 −1 tests/src/python/test_qgsserver_wms.py
  132. +38 −19 tests/src/python/test_qgsserver_wms_getfeatureinfo.py
  133. +2 −0 tests/src/quickgui/CMakeLists.txt
  134. +1 −0 tests/src/server/wms/CMakeLists.txt
  135. +14 −11 tests/testdata/qgis_server/wms_getfeatureinfo_alias_json.txt
  136. +13 −10 tests/testdata/qgis_server/wms_getfeatureinfo_exclude_attribute_json.txt
  137. +14 −11 tests/testdata/qgis_server/wms_getfeatureinfo_geojson.txt
  138. +20 −12 tests/testdata/qgis_server/wms_getfeatureinfo_geometry_json.txt
  139. +34 −31 tests/testdata/qgis_server/wms_getfeatureinfo_group_name_areas.txt
  140. +47 −43 tests/testdata/qgis_server/wms_getfeatureinfo_group_name_areas_cities.txt
  141. +86 −79 tests/testdata/qgis_server/wms_getfeatureinfo_group_name_top.txt
  142. +33 −30 tests/testdata/qgis_server/wms_getfeatureinfo_group_query_child.txt
  143. +14 −11 tests/testdata/qgis_server/wms_getfeatureinfo_json.txt
  144. +62 −54 tests/testdata/qgis_server/wms_getfeatureinfo_multiple_json.txt
  145. +19 −15 tests/testdata/qgis_server/wms_getfeatureinfo_raster_json.txt
@@ -0,0 +1,49 @@
#pragma once

#include <utility>

#include <nlohmann/detail/conversions/from_json.hpp>
#include <nlohmann/detail/conversions/to_json.hpp>

namespace nlohmann
{

template<typename, typename>
struct adl_serializer
{
/*!
@brief convert a JSON value to any value type
This function is usually called by the `get()` function of the
@ref basic_json class (either explicit or via conversion operators).
@param[in] j JSON value to read from
@param[in,out] val value to write to
*/
template<typename BasicJsonType, typename ValueType>
static auto from_json(BasicJsonType&& j, ValueType& val) noexcept(
noexcept(::nlohmann::from_json(std::forward<BasicJsonType>(j), val)))
-> decltype(::nlohmann::from_json(std::forward<BasicJsonType>(j), val), void())
{
::nlohmann::from_json(std::forward<BasicJsonType>(j), val);
}

/*!
@brief convert any value type to a JSON value
This function is usually called by the constructors of the @ref basic_json
class.
@param[in,out] j JSON value to write to
@param[in] val value to read from
*/
template <typename BasicJsonType, typename ValueType>
static auto to_json(BasicJsonType& j, ValueType&& val) noexcept(
noexcept(::nlohmann::to_json(j, std::forward<ValueType>(val))))
-> decltype(::nlohmann::to_json(j, std::forward<ValueType>(val)), void())
{
::nlohmann::to_json(j, std::forward<ValueType>(val));
}
};

} // namespace nlohmann

0 comments on commit 9a612d4

Please sign in to comment.
You can’t perform that action at this time.