forked from Andersbakken/rtags
-
Notifications
You must be signed in to change notification settings - Fork 0
/
QueryMessage.cpp
39 lines (33 loc) · 1.12 KB
/
QueryMessage.cpp
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
#include "QueryMessage.h"
#include "RTags.h"
#include <rct/Serializer.h>
QueryMessage::QueryMessage(Type type)
: ClientMessage(MessageId), mType(type), mFlags(0), mMax(-1), mMinOffset(-1), mMaxOffset(-1), mBuildIndex(0)
{
}
void QueryMessage::encode(Serializer &serializer) const
{
serializer << mRaw << mQuery << mContext << mType << mFlags << mMax
<< mMinOffset << mMaxOffset << mBuildIndex << mPathFilters << mProjects;
}
void QueryMessage::decode(Deserializer &deserializer)
{
deserializer >> mRaw >> mQuery >> mContext >> mType >> mFlags >> mMax
>> mMinOffset >> mMaxOffset >> mBuildIndex >> mPathFilters >> mProjects;
}
unsigned QueryMessage::keyFlags(unsigned queryFlags)
{
unsigned ret = Location::NoFlag;
if (!(queryFlags & QueryMessage::NoContext))
ret |= Location::ShowContext;
if (queryFlags & QueryMessage::LineNumbers)
ret |= Location::ShowLineNumbers;
return ret;
}
Match QueryMessage::match() const
{
unsigned flags = Match::Flag_StringMatch;
if (mFlags & MatchRegexp)
flags |= Match::Flag_RegExp;
return Match(mQuery, flags);
}