Files
ScriptPreprocessor/CLineTranslator.hpp
T
Phillip Stephens 4c93b47b2a Initial Commit
2015-05-07 18:10:22 -07:00

37 lines
825 B
C++

#ifndef CLINENUMBERTRANSLATOR_HPP
#define CLINENUMBERTRANSLATOR_HPP
#include <string>
#include <vector>
class CLineTranslator
{
public:
struct Table
{
struct Entry
{
std::string file;
unsigned int startLine;
unsigned int offset;
};
std::vector<Entry> lines;
Entry& search(unsigned int line);
void addLineRange(const std::string& file, unsigned int startLine, unsigned int offset);
};
CLineTranslator();
std::string resolveOriginalFile(unsigned int lineNumber);
unsigned int resolveOriginalLine(unsigned int lineNumber);
inline void setTable(Table table) { m_table = table; }
inline Table& table() { return m_table; }
void reset();
private:
Table m_table;
};
#endif // CLINENUMBERTRANSLATOR_HPP