mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-10 14:58:10 -05:00
Use shared ptr for line filenames to be able to still use filenames when original file has been closed
This commit is contained in:
@ -2,8 +2,6 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
const std::string MockParserLineStream::MOCK_FILENAME = "Mockfile";
|
||||
|
||||
MockParserLineStream::MockParserLineStream(const std::vector<std::string>& lines)
|
||||
{
|
||||
AddIncludeLines(MOCK_FILENAME, lines);
|
||||
@ -11,7 +9,7 @@ MockParserLineStream::MockParserLineStream(const std::vector<std::string>& lines
|
||||
}
|
||||
|
||||
MockParserLineStream::IncludePos::IncludePos(std::string filename, const std::vector<std::string>& lines)
|
||||
: m_filename(std::move(filename)),
|
||||
: m_filename(std::make_shared<std::string>(std::move(filename))),
|
||||
m_lines(lines),
|
||||
m_pos(0)
|
||||
{
|
||||
|
@ -8,13 +8,13 @@
|
||||
class MockParserLineStream final : public IParserLineStream
|
||||
{
|
||||
public:
|
||||
static const std::string MOCK_FILENAME;
|
||||
static constexpr const char* MOCK_FILENAME = "MockFile";
|
||||
|
||||
private:
|
||||
class IncludePos
|
||||
{
|
||||
public:
|
||||
std::string m_filename;
|
||||
std::shared_ptr<std::string> m_filename;
|
||||
const std::vector<std::string>& m_lines;
|
||||
unsigned m_pos;
|
||||
|
||||
|
Reference in New Issue
Block a user