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>
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>
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 int 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_ size_t Tell() const
Definition: encodedstream.h:266
#define RAPIDJSON_ENCODINGS_FUNC(x)
Definition: encodedstream.h:127
CharType Ch
Definition: encodedstream.h:236
UTFType
Runtime-specified UTF encoding type of a stream.
Definition: encodings.h:603
Represents an in-memory input byte stream.
Definition: memorystream.h:40
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:411
Ch * PutBegin()
Definition: encodedstream.h:117
#define RAPIDJSON_NAMESPACE_END
provide custom rapidjson namespace (closing expression)
Definition: rapidjson.h:124
void Flush()
Definition: encodedstream.h:111
#define Ch(x, y, z)
Definition: sha512-blocks.c:34
OutputByteStream * os_
Definition: encodedstream.h:282
CharType Ch
Definition: encodings.h:97
UTF-32 big endian.
Definition: encodings.h:608
Ch Take()
Definition: encodedstream.h:115
UTF-16 little endian.
Definition: encodings.h:605
void Put(Ch c)
Definition: encodedstream.h:110
Output byte stream wrapper with statically bound encoding.
Definition: encodedstream.h:100
UTF-8.
Definition: encodings.h:604
AutoUTFOutputStream(OutputByteStream &os, UTFType type, bool putBOM)
Constructor.
Definition: encodedstream.h:244
int type
Definition: superscalar.cpp:50
size_t Tell() const
Definition: encodedstream.h:116
size_t PutEnd(Ch *)
Definition: encodedstream.h:268
UTF-16 big endian.
Definition: encodings.h:606
EncodedOutputStream(OutputByteStream &os, bool putBOM=true)
Definition: encodedstream.h:105
PutFunc putFunc_
Definition: encodedstream.h:284
EncodedOutputStream & operator=(const EncodedOutputStream &)
Ch Peek() const
Definition: encodedstream.h:264
Output stream wrapper with dynamically bound encoding and automatic encoding detection.
Definition: encodedstream.h:233
#define RAPIDJSON_NAMESPACE_BEGIN
provide custom rapidjson namespace (opening expression)
Definition: rapidjson.h:121
AutoUTFOutputStream & operator=(const AutoUTFOutputStream &)
UTFType GetType() const
Definition: encodedstream.h:258
UTF-8 encoding.
Definition: encodings.h:96
void(* PutFunc)(OutputByteStream &, Ch)
Definition: encodedstream.h:280
Ch Peek() const
Definition: encodedstream.h:114
UTFType type_
Definition: encodedstream.h:283
#define false
Definition: stdbool.h:37
Encoding::Ch Ch
Definition: encodedstream.h:103
Ch * PutBegin()
Definition: encodedstream.h:267
void Flush()
Definition: encodedstream.h:261
void Put(Ch c)
Definition: encodedstream.h:260
RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch)==1)
UTF-32 little endian.
Definition: encodings.h:607
OutputByteStream & os_
Definition: encodedstream.h:124
void PutBOM()
Definition: encodedstream.h:274
size_t PutEnd(Ch *)
Definition: encodedstream.h:118
RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch)==1)
c
Definition: pymoduletest.py:79
Ch Take()
Definition: encodedstream.h:265