aboutsummaryrefslogtreecommitdiff
path: root/src/proj_json_streaming_writer.hpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2019-07-06 17:06:23 +0200
committerEven Rouault <even.rouault@spatialys.com>2019-07-08 00:05:00 +0200
commitece151aed1b4bf2634de5759f37fd7bc005e8313 (patch)
tree8e2e38daaffc878cc3ba673857e66274555e3dcc /src/proj_json_streaming_writer.hpp
parent17f0b0b3bc65ffba39bf6f22a12b2cc7fcb9bafd (diff)
downloadPROJ-ece151aed1b4bf2634de5759f37fd7bc005e8313.tar.gz
PROJ-ece151aed1b4bf2634de5759f37fd7bc005e8313.zip
CRS JSON: export GeographicCRS and Projected CRS
Diffstat (limited to 'src/proj_json_streaming_writer.hpp')
-rw-r--r--src/proj_json_streaming_writer.hpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/proj_json_streaming_writer.hpp b/src/proj_json_streaming_writer.hpp
index d1510449..62676842 100644
--- a/src/proj_json_streaming_writer.hpp
+++ b/src/proj_json_streaming_writer.hpp
@@ -36,8 +36,8 @@
#define CPL_DLL
-namespace PROJ
-{
+#include "proj/util.hpp"
+NS_PROJ_START
typedef std::int64_t GIntBig;
typedef std::uint64_t GUInt64;
@@ -102,10 +102,15 @@ public:
struct CPL_DLL ObjectContext
{
CPLJSonStreamingWriter& m_serializer;
- explicit ObjectContext(CPLJSonStreamingWriter& serializer):
+
+ ObjectContext(const ObjectContext &) = delete;
+ ObjectContext(ObjectContext&&) = default;
+
+ explicit inline ObjectContext(CPLJSonStreamingWriter& serializer):
m_serializer(serializer) { m_serializer.StartObj(); }
~ObjectContext() { m_serializer.EndObj(); }
};
+ inline ObjectContext MakeObjectContext() { return ObjectContext(*this); }
void StartArray();
void EndArray();
@@ -115,7 +120,10 @@ public:
bool m_bForceSingleLine;
bool m_bNewLineEnabledBackup;
- ArrayContext(CPLJSonStreamingWriter& serializer,
+ ArrayContext(const ArrayContext &) = delete;
+ ArrayContext(ArrayContext&&) = default;
+
+ inline explicit ArrayContext(CPLJSonStreamingWriter& serializer,
bool bForceSingleLine = false):
m_serializer(serializer),
m_bForceSingleLine(bForceSingleLine),
@@ -133,12 +141,14 @@ public:
m_serializer.SetNewline(m_bNewLineEnabledBackup);
}
};
+ inline ArrayContext MakeArrayContext(bool bForceSingleLine = false)
+ { return ArrayContext(*this, bForceSingleLine); }
bool GetNewLine() const { return m_bNewLineEnabled; }
void SetNewline(bool bEnabled) { m_bNewLineEnabled = bEnabled; }
};
-} // namespace PROJ
+NS_PROJ_END
/*! @endcond */