MCPcopy Create free account
hub / github.com/AllentDan/LibtorchTutorials / file_input_adapter

Class file_input_adapter

lesson6-Segmentation/json.hpp:4754–4778  ·  view source on GitHub ↗

! Input adapter for stdio file access. This adapter read only 1 byte and do not use any buffer. This adapter is a very low level adapter. */

Source from the content-addressed store, hash-verified

4752 buffer. This adapter is a very low level adapter.
4753*/
4754class file_input_adapter
4755{
4756 public:
4757 using char_type = char;
4758
4759 JSON_HEDLEY_NON_NULL(2)
4760 explicit file_input_adapter(std::FILE* f) noexcept
4761 : m_file(f)
4762 {}
4763
4764 // make class move-only
4765 file_input_adapter(const file_input_adapter&) = delete;
4766 file_input_adapter(file_input_adapter&&) = default;
4767 file_input_adapter& operator=(const file_input_adapter&) = delete;
4768 file_input_adapter& operator=(file_input_adapter&&) = delete;
4769
4770 std::char_traits<char>::int_type get_character() noexcept
4771 {
4772 return std::fgetc(m_file);
4773 }
4774
4775 private:
4776 /// the file pointer to read from
4777 std::FILE* m_file;
4778};
4779
4780
4781/*!

Callers 1

input_adapterFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected