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


livox_ros_driver
Author(s): Livox Dev Team
autogenerated on Mon Mar 15 2021 02:40:46