MCPcopy Create free account
hub / github.com/bytedance/Fastbot_Android / input_adapter

Class input_adapter

native/thirdpart/json/json.hpp:4197–4303  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4195};
4196
4197class input_adapter
4198{
4199 public:
4200 // native support
4201 JSON_HEDLEY_NON_NULL(2)
4202 input_adapter(std::FILE* file)
4203 : ia(std::make_shared<file_input_adapter>(file)) {}
4204 /// input adapter for input stream
4205 input_adapter(std::istream& i)
4206 : ia(std::make_shared<input_stream_adapter>(i)) {}
4207
4208 /// input adapter for input stream
4209 input_adapter(std::istream&& i)
4210 : ia(std::make_shared<input_stream_adapter>(i)) {}
4211
4212 input_adapter(const std::wstring& ws)
4213 : ia(std::make_shared<wide_string_input_adapter<std::wstring>>(ws)) {}
4214
4215 input_adapter(const std::u16string& ws)
4216 : ia(std::make_shared<wide_string_input_adapter<std::u16string>>(ws)) {}
4217
4218 input_adapter(const std::u32string& ws)
4219 : ia(std::make_shared<wide_string_input_adapter<std::u32string>>(ws)) {}
4220
4221 /// input adapter for buffer
4222 template<typename CharT,
4223 typename std::enable_if<
4224 std::is_pointer<CharT>::value and
4225 std::is_integral<typename std::remove_pointer<CharT>::type>::value and
4226 sizeof(typename std::remove_pointer<CharT>::type) == 1,
4227 int>::type = 0>
4228 input_adapter(CharT b, std::size_t l)
4229 : ia(std::make_shared<input_buffer_adapter>(reinterpret_cast<const char*>(b), l)) {}
4230
4231 // derived support
4232
4233 /// input adapter for string literal
4234 template<typename CharT,
4235 typename std::enable_if<
4236 std::is_pointer<CharT>::value and
4237 std::is_integral<typename std::remove_pointer<CharT>::type>::value and
4238 sizeof(typename std::remove_pointer<CharT>::type) == 1,
4239 int>::type = 0>
4240 input_adapter(CharT b)
4241 : input_adapter(reinterpret_cast<const char*>(b),
4242 std::strlen(reinterpret_cast<const char*>(b))) {}
4243
4244 /// input adapter for iterator range with contiguous storage
4245 template<class IteratorType,
4246 typename std::enable_if<
4247 std::is_same<typename iterator_traits<IteratorType>::iterator_category, std::random_access_iterator_tag>::value,
4248 int>::type = 0>
4249 input_adapter(IteratorType first, IteratorType last)
4250 {
4251#ifndef NDEBUG
4252 // assertion to check that the iterator range is indeed contiguous,
4253 // see http://stackoverflow.com/a/35008842/266378 for more discussion
4254 const auto is_contiguous = std::accumulate(

Callers 8

parseFunction · 0.85
acceptFunction · 0.85
sax_parseFunction · 0.85
json.hppFile · 0.85
basic_json from_cborFunction · 0.85
basic_json from_msgpackFunction · 0.85
basic_json from_ubjsonFunction · 0.85
basic_json from_bsonFunction · 0.85

Calls 1

beginFunction · 0.70

Tested by

no test coverage detected