libqasm
library for handling cQASM files
cqasm-annotations.hpp
Go to the documentation of this file.
1 
5 #pragma once
6 
7 #include <string>
8 
9 namespace cqasm {
10 
14 namespace annotations {
15 
20 public:
21 
25  std::string filename;
26 
30  uint32_t first_line;
31 
35  uint32_t first_column;
36 
40  uint32_t last_line;
41 
45  uint32_t last_column;
46 
51  const std::string &filename,
52  uint32_t first_line = 0,
53  uint32_t first_column = 0,
54  uint32_t last_line = 0,
55  uint32_t last_column = 0
56  );
57 
62  void expand_to_include(uint32_t line, uint32_t column = 1);
63 
64 };
65 
69 std::ostream &operator<<(std::ostream &os, const SourceLocation &object);
70 
71 } // namespace annotations
72 } // namespace cqasm
uint32_t last_line
The last line of the range, or 0 if unknown.
uint32_t first_column
The first column of the range, or 0 if unknown.
uint32_t last_column
The last column of the range, or 0 if unknown.
Toplevel namespace with entry points for the new API.
uint32_t first_line
The first line of the range, or 0 if unknown.
Source location annotation object, containing source file line numbers etc.
void expand_to_include(uint32_t line, uint32_t column=1)
Expands the location range to contain the given location in the source file.
SourceLocation(const std::string &filename, uint32_t first_line=0, uint32_t first_column=0, uint32_t last_line=0, uint32_t last_column=0)
Constructs a source location object.
std::ostream & operator<<(std::ostream &os, const SourceLocation &object)
Stream << overload for source location objects.
std::string filename
The name of the source file.