File indexing completed on 2025-01-18 10:10:03
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef RAPIDJSON_OSTREAMWRAPPER_H_
0016 #define RAPIDJSON_OSTREAMWRAPPER_H_
0017
0018 #include "stream.h"
0019 #include <iosfwd>
0020
0021 #ifdef __clang__
0022 RAPIDJSON_DIAG_PUSH
0023 RAPIDJSON_DIAG_OFF(padded)
0024 #endif
0025
0026 RAPIDJSON_NAMESPACE_BEGIN
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044 template <typename StreamType>
0045 class BasicOStreamWrapper {
0046 public:
0047 typedef typename StreamType::char_type Ch;
0048 BasicOStreamWrapper(StreamType& stream) : stream_(stream) {}
0049
0050 void Put(Ch c) {
0051 stream_.put(c);
0052 }
0053
0054 void Flush() {
0055 stream_.flush();
0056 }
0057
0058
0059 char Peek() const { RAPIDJSON_ASSERT(false); return 0; }
0060 char Take() { RAPIDJSON_ASSERT(false); return 0; }
0061 size_t Tell() const { RAPIDJSON_ASSERT(false); return 0; }
0062 char* PutBegin() { RAPIDJSON_ASSERT(false); return 0; }
0063 size_t PutEnd(char*) { RAPIDJSON_ASSERT(false); return 0; }
0064
0065 private:
0066 BasicOStreamWrapper(const BasicOStreamWrapper&);
0067 BasicOStreamWrapper& operator=(const BasicOStreamWrapper&);
0068
0069 StreamType& stream_;
0070 };
0071
0072 typedef BasicOStreamWrapper<std::ostream> OStreamWrapper;
0073 typedef BasicOStreamWrapper<std::wostream> WOStreamWrapper;
0074
0075 #ifdef __clang__
0076 RAPIDJSON_DIAG_POP
0077 #endif
0078
0079 RAPIDJSON_NAMESPACE_END
0080
0081 #endif