Blang/src/lib/src/SourceLocation.hpp

37 lines
595 B
C++
Raw Normal View History

2016-04-22 21:46:31 +02:00
#ifndef SOURCELOCATION_HPP
#define SOURCELOCATION_HPP
#include <string>
2016-11-24 12:15:08 +01:00
class SourceLocation
{
2016-04-22 21:46:31 +02:00
public:
2016-11-24 12:15:08 +01:00
SourceLocation();
2016-11-28 07:29:13 +01:00
SourceLocation(std::string file, int line, int column);
2016-04-22 21:46:31 +02:00
2016-11-24 12:15:08 +01:00
bool isValid() const;
2016-04-22 21:46:31 +02:00
2016-11-24 12:15:08 +01:00
void print() const;
std::string printToString() const;
2016-04-22 21:46:31 +02:00
2016-11-24 12:15:08 +01:00
std::string file() const;
void setFile(std::string);
2016-04-22 21:46:31 +02:00
2016-11-24 12:15:08 +01:00
int lineLocation() const;
void setLineLocation(int);
2016-04-22 21:46:31 +02:00
2016-11-24 12:15:08 +01:00
int columnLocation() const;
void setColumnLocation(int);
2016-04-22 21:46:31 +02:00
2016-11-24 12:15:08 +01:00
int offset() const;
void setOffset(int);
2016-04-22 21:46:31 +02:00
2016-11-24 12:15:08 +01:00
private:
std::string _file;
int _column;
int _line;
2016-04-22 21:46:31 +02:00
};
#endif