| 36 | }; |
| 37 | |
| 38 | class Position : public Serializable { |
| 39 | public: |
| 40 | Position(std::size_t _line = 0, std::size_t _character = 0); |
| 41 | |
| 42 | std::size_t line; |
| 43 | std::size_t character; |
| 44 | |
| 45 | nlohmann::json Serialize() override; |
| 46 | void Deserialize(nlohmann::json json) override; |
| 47 | |
| 48 | bool operator==(const Position &p) const { |
| 49 | return line == p.line && character == p.character; |
| 50 | } |
| 51 | |
| 52 | bool operator<(const Position &p) const { |
| 53 | if (line != p.line) { |
| 54 | return line < p.line; |
| 55 | } else { |
| 56 | return character < p.character; |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | bool operator<=(const Position &p) const { |
| 61 | return *this == p || *this < p; |
| 62 | } |
| 63 | |
| 64 | bool operator>=(const Position &p) const { |
| 65 | return *this == p || !(*this < p); |
| 66 | } |
| 67 | }; |
| 68 | |
| 69 | class Range : public Serializable { |
| 70 | public: |
no outgoing calls
no test coverage detected