Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
ostreamwrapper.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2// Tencent is pleased to support the open source community by making RapidJSON available.
3//
4// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved.
5//
6// Licensed under the MIT License (the "License"); you may not use this file except
7// in compliance with the License. You may obtain a copy of the License at
8//
9// http://opensource.org/licenses/MIT
10//
11// Unless required by applicable law or agreed to in writing, software distributed
12// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
13// CONDITIONS OF ANY KIND, either express or implied. See the License for the
14// specific language governing permissions and limitations under the License.
15
16#ifndef RAPIDJSON_OSTREAMWRAPPER_H_
17#define RAPIDJSON_OSTREAMWRAPPER_H_
18
19#include "stream.h"
20#include <iosfwd>
21
22#ifdef __clang__
23RAPIDJSON_DIAG_PUSH
24RAPIDJSON_DIAG_OFF(padded)
25#endif
26
28
30
45template <typename StreamType>
47public:
48 typedef typename StreamType::char_type Ch;
49 BasicOStreamWrapper(StreamType& stream) : stream_(stream) {}
50
51 void Put(Ch c) {
52 stream_.put(c);
53 }
54
55 void Flush() {
56 stream_.flush();
57 }
58
59 // Not implemented
60 char Peek() const { RAPIDJSON_ASSERT(false); return 0; }
61 char Take() { RAPIDJSON_ASSERT(false); return 0; }
62 size_t Tell() const { RAPIDJSON_ASSERT(false); return 0; }
63 char* PutBegin() { RAPIDJSON_ASSERT(false); return 0; }
64 size_t PutEnd(char*) { RAPIDJSON_ASSERT(false); return 0; }
65
66private:
69
70 StreamType& stream_;
71};
72
75
76#ifdef __clang__
77RAPIDJSON_DIAG_POP
78#endif
79
81
82#endif // RAPIDJSON_OSTREAMWRAPPER_H_
Wrapper of std::basic_ostream into RapidJSON's Stream concept.
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition rapidjson.h:407
#define RAPIDJSON_NAMESPACE_BEGIN
provide custom rapidjson namespace (opening expression)
Definition rapidjson.h:122
#define RAPIDJSON_NAMESPACE_END
provide custom rapidjson namespace (closing expression)
Definition rapidjson.h:125