ostreamwrapper.h
Go to the documentation of this file.
1 // Tencent is pleased to support the open source community by making RapidJSON available.
2 //
3 // Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved.
4 //
5 // Licensed under the MIT License (the "License"); you may not use this file except
6 // in compliance with the License. You may obtain a copy of the License at
7 //
8 // http://opensource.org/licenses/MIT
9 //
10 // Unless required by applicable law or agreed to in writing, software distributed
11 // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 // specific language governing permissions and limitations under the License.
14 
15 #ifndef RAPIDJSON_OSTREAMWRAPPER_H_
16 #define RAPIDJSON_OSTREAMWRAPPER_H_
17 
18 #include "stream.h"
19 #include <iosfwd>
20 
21 #if __clang__
22 RAPIDJSON_DIAG_PUSH
23 RAPIDJSON_DIAG_OFF(padded)
24 #endif
25 
27 
29 
44 template <typename StreamType>
46 {
47 public:
48  typedef typename StreamType::char_type Ch;
50  {
51  }
52 
53  void Put(Ch c)
54  {
55  stream_.put(c);
56  }
57 
58  void Flush()
59  {
60  stream_.flush();
61  }
62 
63  // Not implemented
64  char Peek() const
65  {
66  RAPIDJSON_ASSERT(false);
67  return 0;
68  }
69  char Take()
70  {
71  RAPIDJSON_ASSERT(false);
72  return 0;
73  }
74  size_t Tell() const
75  {
76  RAPIDJSON_ASSERT(false);
77  return 0;
78  }
79  char* PutBegin()
80  {
81  RAPIDJSON_ASSERT(false);
82  return 0;
83  }
84  size_t PutEnd(char*)
85  {
86  RAPIDJSON_ASSERT(false);
87  return 0;
88  }
89 
90 private:
93 
95 };
96 
99 
100 #if __clang__
101 RAPIDJSON_DIAG_POP
102 #endif
103 
105 
106 #endif // RAPIDJSON_OSTREAMWRAPPER_H_
Wrapper of std::basic_ostream into RapidJSON&#39;s Stream concept.
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:416
size_t Tell() const
BasicOStreamWrapper(StreamType &stream)
#define RAPIDJSON_NAMESPACE_END
provide custom rapidjson namespace (closing expression)
Definition: rapidjson.h:126
StreamType & stream_
BasicOStreamWrapper & operator=(const BasicOStreamWrapper &)
#define RAPIDJSON_NAMESPACE_BEGIN
provide custom rapidjson namespace (opening expression)
Definition: rapidjson.h:121
char Peek() const
BasicOStreamWrapper< std::ostream > OStreamWrapper
StreamType
BasicOStreamWrapper< std::wostream > WOStreamWrapper
StreamType::char_type Ch
size_t PutEnd(char *)


xbot_talker
Author(s): wangxiaoyun
autogenerated on Sat Oct 10 2020 03:27:53