Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 3 : //* 4 : //* All rights reserved, see COPYRIGHT for full restrictions 5 : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT 6 : //* 7 : //* Licensed under LGPL 2.1, please see LICENSE for details 8 : //* https://www.gnu.org/licenses/lgpl-2.1.html 9 : 10 : #include "StringInputStream.h" 11 : 12 : #include "MooseError.h" 13 : 14 19982 : StringInputStream::StringInputStream(std::unique_ptr<std::stringstream> stream) 15 19982 : : InputStream(), _stream(std::move(stream)) 16 : { 17 19982 : } 18 : 19 : std::shared_ptr<std::istream> 20 440506 : StringInputStream::get() const 21 : { 22 : mooseAssert(_stream, "Not valid"); 23 : 24 440506 : std::shared_ptr<std::istream> stream = std::make_unique<std::istream>(_stream->rdbuf()); 25 440506 : addSharedStream(stream); 26 440506 : return stream; 27 0 : } 28 : 29 : std::unique_ptr<std::stringstream> 30 19974 : StringInputStream::release() 31 : { 32 19974 : if (inUse()) 33 2 : mooseError("StringInputStream::release(): Cannot release; still in use"); 34 19972 : return std::move(_stream); 35 : }