forked from Andersbakken/rtags
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FixIt.h
63 lines (52 loc) · 1.77 KB
/
FixIt.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/* This file is part of RTags (http://rtags.net).
RTags is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
RTags is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with RTags. If not, see <http://www.gnu.org/licenses/>. */
#ifndef FixIt_h
#define FixIt_h
#include <stdint.h>
#include "rct/Serializer.h"
#include "rct/String.h"
struct FixIt
{
inline FixIt(uint32_t l = 0, uint32_t c = 0, uint32_t len = 0, const String &t = String())
: line(l), column(c), length(len), text(t)
{
}
inline bool operator<(const FixIt &other) const
{
if (line < other.line)
return true;
if (line > other.line)
return false;
if (column < other.column)
return true;
if (column > other.column)
return false;
return length < other.length;
}
inline bool operator==(const FixIt &other) const
{
return (line == other.line && column == other.column && length == other.length && text == other.text);
}
uint32_t line, column, length;
String text;
};
template <> inline Serializer &operator<<(Serializer &s, const FixIt &f)
{
s << f.line << f.column << f.length << f.text;
return s;
}
template <> inline Deserializer &operator>>(Deserializer &s, FixIt &f)
{
s >> f.line >> f.column >> f.length >> f.text;
return s;
}
#endif