15 #ifndef RAPIDJSON_ENCODEDSTREAM_H_ 16 #define RAPIDJSON_ENCODEDSTREAM_H_ 23 RAPIDJSON_DIAG_OFF(effc++)
28 RAPIDJSON_DIAG_OFF(padded)
38 template <
typename Encoding,
typename InputByteStream>
44 typedef typename Encoding::Ch
Ch;
103 if (static_cast<unsigned char>(
is_.Peek()) == 0xEFu)
105 if (static_cast<unsigned char>(
is_.Peek()) == 0xBBu)
107 if (static_cast<unsigned char>(
is_.Peek()) == 0xBFu)
151 template <
typename Encoding,
typename OutputByteStream>
157 typedef typename Encoding::Ch
Ch;
162 Encoding::PutBOM(os_);
167 Encoding::Put(os_, c);
208 #define RAPIDJSON_ENCODINGS_FUNC(x) UTF8<Ch>::x, UTF16LE<Ch>::x, UTF16BE<Ch>::x, UTF32LE<Ch>::x, UTF32BE<Ch>::x 215 template <
typename CharType,
typename InputByteStream>
233 takeFunc_ = f[type_];
295 const unsigned char* c =
reinterpret_cast<const unsigned char*
>(
is_->Peek4());
299 unsigned bom =
static_cast<unsigned>(c[0] | (c[1] << 8) | (c[2] << 16) | (c[3] << 24));
301 if (bom == 0xFFFE0000)
310 else if (bom == 0x0000FEFF)
319 else if ((bom & 0xFFFF) == 0xFFFE)
326 else if ((bom & 0xFFFF) == 0xFEFF)
333 else if ((bom & 0xFFFFFF) == 0xBFBBEF)
355 int pattern = (c[0] ? 1 : 0) | (c[1] ? 2 : 0) | (c[2] ? 4 : 0) | (c[3] ? 8 : 0);
385 typedef Ch (*TakeFunc)(InputByteStream& is);
398 template <
typename CharType,
typename OutputByteStream>
476 typedef void (*PutBOMFunc)(OutputByteStream&);
481 typedef void (*PutFunc)(OutputByteStream&,
Ch);
488 #undef RAPIDJSON_ENCODINGS_FUNC 500 #endif // RAPIDJSON_FILESTREAM_H_ #define RAPIDJSON_ENCODINGS_FUNC(x)
UTFType
Runtime-specified UTF encoding type of a stream.
Represents an in-memory input byte stream.
#define RAPIDJSON_ASSERT(x)
Assertion.
#define RAPIDJSON_NAMESPACE_END
provide custom rapidjson namespace (closing expression)
Output byte stream wrapper with statically bound encoding.
AutoUTFOutputStream(OutputByteStream &os, UTFType type, bool putBOM)
Constructor.
EncodedOutputStream(OutputByteStream &os, bool putBOM=true)
Output stream wrapper with dynamically bound encoding and automatic encoding detection.
#define RAPIDJSON_NAMESPACE_BEGIN
provide custom rapidjson namespace (opening expression)