utility: added FilePath abstraction and rewrote data management to use it
The utility class FilePath wraps an instance of boost::filesystem::path. Using FilePath allows for easy comparision of file paths on different platforms using absolute or relative paths. Whereever file paths are compared, this wrapper should be used.
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
#include "data/location/TokenLocationFile.h"
|
||||
|
||||
#include "utility/logging/logging.h"
|
||||
|
||||
#include "data/location/TokenLocation.h"
|
||||
#include "data/location/TokenLocationLine.h"
|
||||
#include "utility/logging/logging.h"
|
||||
|
||||
TokenLocationFile::TokenLocationFile(const std::string& filePath)
|
||||
TokenLocationFile::TokenLocationFile(const FilePath& filePath)
|
||||
: m_filePath(filePath)
|
||||
{
|
||||
}
|
||||
@@ -23,7 +24,7 @@ size_t TokenLocationFile::getTokenLocationLineCount() const
|
||||
return m_lines.size();
|
||||
}
|
||||
|
||||
const std::string& TokenLocationFile::getFilePath() const
|
||||
const FilePath& TokenLocationFile::getFilePath() const
|
||||
{
|
||||
return m_filePath;
|
||||
}
|
||||
@@ -156,7 +157,7 @@ TokenLocationLine* TokenLocationFile::createTokenLocationLine(unsigned int lineN
|
||||
|
||||
std::ostream& operator<<(std::ostream& ostream, const TokenLocationFile& file)
|
||||
{
|
||||
ostream << "file \"" << file.getFilePath() << "\"\n";
|
||||
ostream << "file \"" << file.getFilePath().str() << "\"\n";
|
||||
file.forEachTokenLocationLine([&ostream](TokenLocationLine* l)
|
||||
{
|
||||
ostream << *l << '\n';
|
||||
|
||||
Reference in New Issue
Block a user