summaryrefslogtreecommitdiffstats
path: root/yql/essentials/sql/v1/ide/completion/core/position.h
blob: b7b7d3d2b888c50425b50b1491e5d6aa76b22b81 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#pragma once

#include <util/generic/hash.h>
#include <util/stream/output.h>

namespace NSQLComplete {

struct TPosition {
    ui32 Line = 0;
    ui32 Column = 0;

    friend bool operator==(const TPosition& lhs, const TPosition& rhs) = default;
    friend bool operator<(const TPosition& lhs, const TPosition& rhs);
};

} // namespace NSQLComplete

template <>
struct THash<NSQLComplete::TPosition> {
    size_t operator()(const NSQLComplete::TPosition& x) const {
        return THash<std::tuple<ui32, ui32>>()(std::tie(x.Line, x.Column));
    }
};