cphot
0.1
A C++ tool for computing photometry from spectra.
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
#ifdef __clang__
22
RAPIDJSON_DIAG_PUSH
23
RAPIDJSON_DIAG_OFF(padded)
24
#endif
25
26
RAPIDJSON_NAMESPACE_BEGIN
27
28
//! Wrapper of \c std::basic_ostream into RapidJSON's Stream concept.
29
/*!
30
The classes can be wrapped including but not limited to:
31
32
- \c std::ostringstream
33
- \c std::stringstream
34
- \c std::wpstringstream
35
- \c std::wstringstream
36
- \c std::ifstream
37
- \c std::fstream
38
- \c std::wofstream
39
- \c std::wfstream
40
41
\tparam StreamType Class derived from \c std::basic_ostream.
42
*/
43
44
template
<
typename
StreamType>
45
class
BasicOStreamWrapper
{
46
public
:
47
typedef
typename
StreamType::char_type
Ch
;
48
BasicOStreamWrapper
(StreamType& stream) : stream_(stream) {}
49
50
void
Put
(
Ch
c
) {
51
stream_.put(
c
);
52
}
53
54
void
Flush
() {
55
stream_.flush();
56
}
57
58
// Not implemented
59
char
Peek
()
const
{
RAPIDJSON_ASSERT
(
false
);
return
0; }
60
char
Take
() {
RAPIDJSON_ASSERT
(
false
);
return
0; }
61
size_t
Tell
()
const
{
RAPIDJSON_ASSERT
(
false
);
return
0; }
62
char
*
PutBegin
() {
RAPIDJSON_ASSERT
(
false
);
return
0; }
63
size_t
PutEnd
(
char
*) {
RAPIDJSON_ASSERT
(
false
);
return
0; }
64
65
private
:
66
BasicOStreamWrapper
(
const
BasicOStreamWrapper
&);
67
BasicOStreamWrapper
& operator=(
const
BasicOStreamWrapper
&);
68
69
StreamType& stream_;
70
};
71
72
typedef
BasicOStreamWrapper<std::ostream>
OStreamWrapper
;
73
typedef
BasicOStreamWrapper<std::wostream>
WOStreamWrapper
;
74
75
#ifdef __clang__
76
RAPIDJSON_DIAG_POP
77
#endif
78
79
RAPIDJSON_NAMESPACE_END
80
81
#endif // RAPIDJSON_OSTREAMWRAPPER_H_
RAPIDJSON_NAMESPACE_END
#define RAPIDJSON_NAMESPACE_END
provide custom rapidjson namespace (closing expression)
Definition:
rapidjson.h:119
RAPIDJSON_NAMESPACE_BEGIN
#define RAPIDJSON_NAMESPACE_BEGIN
provide custom rapidjson namespace (opening expression)
Definition:
rapidjson.h:116
BasicOStreamWrapper::Flush
void Flush()
Definition:
ostreamwrapper.h:54
BasicOStreamWrapper::PutBegin
char * PutBegin()
Definition:
ostreamwrapper.h:62
BasicOStreamWrapper::Take
char Take()
Definition:
ostreamwrapper.h:60
BasicOStreamWrapper::BasicOStreamWrapper
BasicOStreamWrapper(StreamType &stream)
Definition:
ostreamwrapper.h:48
BasicOStreamWrapper::PutEnd
size_t PutEnd(char *)
Definition:
ostreamwrapper.h:63
BasicOStreamWrapper::Ch
StreamType::char_type Ch
Definition:
ostreamwrapper.h:47
RAPIDJSON_ASSERT
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition:
rapidjson.h:402
WOStreamWrapper
BasicOStreamWrapper< std::wostream > WOStreamWrapper
Definition:
ostreamwrapper.h:73
c
constexpr QSpeed c
Definition:
rquantities.hpp:351
stream.h
BasicOStreamWrapper::Peek
char Peek() const
Definition:
ostreamwrapper.h:59
OStreamWrapper
BasicOStreamWrapper< std::ostream > OStreamWrapper
Definition:
ostreamwrapper.h:72
BasicOStreamWrapper
Wrapper of std::basic_ostream into RapidJSON's Stream concept.
Definition:
ostreamwrapper.h:45
BasicOStreamWrapper::Put
void Put(Ch c)
Definition:
ostreamwrapper.h:50
BasicOStreamWrapper::Tell
size_t Tell() const
Definition:
ostreamwrapper.h:61
include
rapidjson
ostreamwrapper.h
Generated on Thu Dec 16 2021 14:06:41 for cphot by
1.8.17