GenericDocument::ParseStream: make SourceEncoding optional

The ParseStream() function current requires explicitly passing
the SourceEncoding parameter as explicit template argument
while the other Parse*() functions provide overloads to omit
this parameter and use the document's own encoding by default.

This patch adds the corresponding overload for ParseStream(),
enabling the simple usage again:

  rapidjson::FileStream is(fp);
  rapidjson::Document   d;
  d.ParseStream<0>(is);
This commit is contained in:
Philipp A. Hartmann 2014-03-21 16:17:43 +01:00
parent 23056abad1
commit 7fb82c2528

View File

@ -734,6 +734,11 @@ public:
return *this; return *this;
} }
template <unsigned parseFlags, typename InputStream>
GenericDocument& ParseStream(InputStream& is) {
return ParseStream<parseFlags,Encoding,InputStream>(is);
}
//! Parse JSON text from a mutable string. //! Parse JSON text from a mutable string.
/*! \tparam parseFlags Combination of ParseFlag. /*! \tparam parseFlags Combination of ParseFlag.
\param str Mutable zero-terminated string to be parsed. \param str Mutable zero-terminated string to be parsed.