-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfocus.cpp
59 lines (50 loc) · 1.05 KB
/
focus.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include "focus.h"
#include <QString>
#include <QDebug>
Focus::Focus() : mType(Focus::Null), mIndex(-1)
{
}
Focus::Focus(Type t, qlonglong i) : mType(t), mIndex(i)
{
}
Focus::Focus(Focus::Type t, const QString &bit) : mType(t), mIndex(-1), mString(bit)
{
if( mType != Focus::WholeStringSearch && mType != Focus::SubStringSearch)
{
mType = Focus::Null;
}
}
Focus::Type Focus::type() const
{
return mType;
}
qlonglong Focus::index() const
{
return mIndex;
}
QString Focus::typeString() const
{
switch( mType )
{
case Focus::Interpretation:
return "Interpretation";
case Focus::TextForm:
return "TextForm";
case Focus::Gloss:
return "Gloss";
case Focus::GlossItem:
return "GlossItem";
case Focus::Null:
default:
return "Null";
}
}
QString Focus::searchString() const
{
return mString;
}
QDebug operator<<(QDebug dbg, const Focus & key)
{
dbg.nospace() << "Focus( " << key.typeString() << ", Index: " << key.index() << ")";
return dbg.maybeSpace();
}