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>
42 typedef typename Encoding::Ch
Ch;
50 size_t Tell()
const {
return is_.Tell(); }
73 if (static_cast<unsigned char>(
is_.Peek()) == 0xEFu)
is_.Take();
74 if (static_cast<unsigned char>(
is_.Peek()) == 0xBBu)
is_.Take();
75 if (static_cast<unsigned char>(
is_.Peek()) == 0xBFu)
is_.Take();
79 size_t Tell()
const {
return is_.Tell(); }
99 template <
typename Encoding,
typename OutputByteStream>
103 typedef typename Encoding::Ch
Ch;
107 Encoding::PutBOM(
os_);
127 #define RAPIDJSON_ENCODINGS_FUNC(x) UTF8<Ch>::x, UTF16LE<Ch>::x, UTF16BE<Ch>::x, UTF32LE<Ch>::x, UTF32BE<Ch>::x
134 template <
typename CharType,
typename InputByteStream>
179 const unsigned char*
c =
reinterpret_cast<const unsigned char *
>(
is_->Peek4());
183 unsigned bom =
static_cast<unsigned>(c[0] | (c[1] << 8) | (c[2] << 16) | (c[3] << 24));
203 unsigned pattern = (c[0] ? 1 : 0) | (c[1] ? 2 : 0) | (c[2] ? 4 : 0) | (c[3] ? 8 : 0);
232 template <
typename CharType,
typename OutputByteStream>
275 typedef void (*PutBOMFunc)(OutputByteStream&);
287 #undef RAPIDJSON_ENCODINGS_FUNC
299 #endif // RAPIDJSON_FILESTREAM_H_