------------------------------------------------------------------------------
| 226 | |
| 227 | //------------------------------------------------------------------------------ |
| 228 | std::unique_ptr<std::istream> vtkDelimitedTextReader::OpenStream() |
| 229 | { |
| 230 | if (!this->ReadFromInputString) |
| 231 | { |
| 232 | if (!this->FileName) |
| 233 | { |
| 234 | vtkErrorMacro("No Filename provided, aborting."); |
| 235 | return nullptr; |
| 236 | } |
| 237 | std::unique_ptr<std::istream> file_stream{ new vtksys::ifstream(this->FileName, ios::binary) }; |
| 238 | |
| 239 | if (!file_stream->good()) |
| 240 | { |
| 241 | vtkErrorMacro("Unable to open input file " + std::string(this->FileName)); |
| 242 | return nullptr; |
| 243 | } |
| 244 | |
| 245 | return file_stream; |
| 246 | } |
| 247 | else |
| 248 | { |
| 249 | if (!this->InputString) |
| 250 | { |
| 251 | vtkErrorMacro("Empty input string, aborting."); |
| 252 | return nullptr; |
| 253 | } |
| 254 | return std::unique_ptr<std::istream>{ new std::istringstream(this->InputString) }; |
| 255 | } |
| 256 | } |
| 257 | |
| 258 | //------------------------------------------------------------------------------ |
| 259 | vtkTextCodec* vtkDelimitedTextReader::CreateTextCodec(std::istream* input_stream) |
no test coverage detected