Files
Sourcetrail/src/lib/data/location/SourceLocation.h
T
Eberhard Graether 4e9ba897ac src: Refactored TokenLocation classes to SourceLocation classes
* Removed TokenLocationLine
* decoupled TokenLocationFile from TokenLocationCollection
* save vector of Token ids to SourceLocation
* refactored SourceLocationFile::getFilteredByLines()
* refactored snippet creation
2017-03-25 02:05:48 +01:00

67 lines
1.6 KiB
C++

#ifndef SOURCE_LOCATION_H
#define SOURCE_LOCATION_H
#include <ostream>
#include <string>
#include <vector>
#include "data/location/LocationType.h"
#include "utility/types.h"
class FilePath;
class SourceLocationFile;
class SourceLocation
{
public:
SourceLocation(SourceLocationFile* file, LocationType type, Id locationId, std::vector<Id> tokenIds,
size_t lineNumber, size_t columnNumber, bool isStart);
SourceLocation(SourceLocation* other, size_t lineNumber, size_t columnNumber);
SourceLocation(const SourceLocation* other, SourceLocationFile* file);
virtual ~SourceLocation();
bool operator==(const SourceLocation& rhs) const;
bool operator<(const SourceLocation& rhs) const;
bool operator>(const SourceLocation& rhs) const;
SourceLocationFile* getSourceLocationFile() const;
Id getLocationId() const;
const std::vector<Id>& getTokenIds() const;
LocationType getType() const;
size_t getColumnNumber() const;
size_t getLineNumber() const;
const FilePath& getFilePath() const;
const SourceLocation* getOtherLocation() const;
void setOtherLocation(SourceLocation* other);
const SourceLocation* getStartLocation() const;
const SourceLocation* getEndLocation() const;
bool isStartLocation() const;
bool isEndLocation() const;
bool isScopeLocation() const;
bool isFullTextSearchMatch() const;
private:
SourceLocationFile* m_file;
LocationType m_type;
const Id m_locationId;
const std::vector<Id> m_tokenIds;
const size_t m_lineNumber;
const size_t m_columnNumber;
SourceLocation* m_other;
const bool m_isStart;
};
std::ostream& operator<<(std::ostream& ostream, const SourceLocation& location);
#endif // SOURCE_LOCATION_H