Remove an invalid Document::ParseInsitu() API

This commit is contained in:
miloyip 2015-04-13 18:21:15 +08:00
parent 35d0577e80
commit e7f1c6dd08
3 changed files with 13 additions and 32 deletions

View File

@ -84,29 +84,25 @@ template <typename InputStream>
GenericDocument& GenericDocument::ParseStream(InputStream& is);
// (4) In situ parsing
template <unsigned parseFlags, typename SourceEncoding>
GenericDocument& GenericDocument::ParseInsitu(Ch* str);
// (5) In situ parsing, using same Encoding of Document
template <unsigned parseFlags>
GenericDocument& GenericDocument::ParseInsitu(Ch* str);
// (6) In situ parsing, using default parse flags
// (5) In situ parsing, using default parse flags
GenericDocument& GenericDocument::ParseInsitu(Ch* str);
// (7) Normal parsing of a string
// (6) Normal parsing of a string
template <unsigned parseFlags, typename SourceEncoding>
GenericDocument& GenericDocument::Parse(const Ch* str);
// (8) Normal parsing of a string, using same Encoding of Document
// (7) Normal parsing of a string, using same Encoding of Document
template <unsigned parseFlags>
GenericDocument& GenericDocument::Parse(const Ch* str);
// (9) Normal parsing of a string, using default parse flags
// (8) Normal parsing of a string, using default parse flags
GenericDocument& GenericDocument::Parse(const Ch* str);
~~~~~~~~~~
The examples of [tutorial](doc/tutorial.md) uses (9) for normal parsing of string. The examples of [stream](doc/stream.md) uses the first three. *In situ* parsing will be described soon.
The examples of [tutorial](doc/tutorial.md) uses (8) for normal parsing of string. The examples of [stream](doc/stream.md) uses the first three. *In situ* parsing will be described soon.
The `parseFlags` are combination of the following bit-flags:

View File

@ -84,29 +84,25 @@ template <typename InputStream>
GenericDocument& GenericDocument::ParseStream(InputStream& is);
// (4) 原位解析
template <unsigned parseFlags, typename SourceEncoding>
GenericDocument& GenericDocument::ParseInsitu(Ch* str);
// (5) 原位解析使用Document的编码
template <unsigned parseFlags>
GenericDocument& GenericDocument::ParseInsitu(Ch* str);
// (6) 原位解析,使用缺省标志
// (5) 原位解析,使用缺省标志
GenericDocument& GenericDocument::ParseInsitu(Ch* str);
// (7) 正常解析一个字符串
// (6) 正常解析一个字符串
template <unsigned parseFlags, typename SourceEncoding>
GenericDocument& GenericDocument::Parse(const Ch* str);
// (8) 正常解析一个字符串使用Document的编码
// (7) 正常解析一个字符串使用Document的编码
template <unsigned parseFlags>
GenericDocument& GenericDocument::Parse(const Ch* str);
// (9) 正常解析一个字符串,使用缺省标志
// (8) 正常解析一个字符串,使用缺省标志
GenericDocument& GenericDocument::Parse(const Ch* str);
~~~~~~~~~~
[教程](tutorial.md)中的例使用(9)去正常解析字符串。而[流](stream.md)的例子使用前3个函数。我们将稍后介绍原位*In situ* 解析。
[教程](tutorial.md)中的例使用(8)去正常解析字符串。而[流](stream.md)的例子使用前3个函数。我们将稍后介绍原位*In situ* 解析。
`parseFlags`是以下位标置的组合:

View File

@ -1770,18 +1770,6 @@ public:
//!@name Parse in-place from mutable string
//!@{
//! Parse JSON text from a mutable string (with Encoding conversion)
/*! \tparam parseFlags Combination of \ref ParseFlag.
\tparam SourceEncoding Transcoding from input Encoding
\param str Mutable zero-terminated string to be parsed.
\return The document itself for fluent API.
*/
template <unsigned parseFlags, typename SourceEncoding>
GenericDocument& ParseInsitu(Ch* str) {
GenericInsituStringStream<Encoding> s(str);
return ParseStream<parseFlags | kParseInsituFlag, SourceEncoding>(s);
}
//! Parse JSON text from a mutable string
/*! \tparam parseFlags Combination of \ref ParseFlag.
\param str Mutable zero-terminated string to be parsed.
@ -1789,7 +1777,8 @@ public:
*/
template <unsigned parseFlags>
GenericDocument& ParseInsitu(Ch* str) {
return ParseInsitu<parseFlags, Encoding>(str);
GenericInsituStringStream<Encoding> s(str);
return ParseStream<parseFlags | kParseInsituFlag, SourceEncoding>(s);
}
//! Parse JSON text from a mutable string (with \ref kParseDefaultFlags)
@ -1797,7 +1786,7 @@ public:
\return The document itself for fluent API.
*/
GenericDocument& ParseInsitu(Ch* str) {
return ParseInsitu<kParseDefaultFlags, Encoding>(str);
return ParseInsitu<kParseDefaultFlags>(str);
}
//!@}