-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinterlinearitemtype.cpp
139 lines (129 loc) · 3.61 KB
/
interlinearitemtype.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#include "interlinearitemtype.h"
InterlinearItemType::InterlinearItemType()
{
mType = Null;
}
InterlinearItemType::InterlinearItemType(LineType type, const WritingSystem & ws)
{
mType = type;
mWritingSystem = ws;
}
InterlinearItemType::InterlinearItemType(const QString & type, const WritingSystem & ws)
{
QString string = type.toLower();
if( string == "text")
{
mType = InterlinearItemType::Text;
}
else if( string == "gloss" )
{
mType = InterlinearItemType::Gloss;
}
else if( string == "analysis" )
{
mType = InterlinearItemType::Analysis;
}
else if( string == "immutable-text" )
{
mType = InterlinearItemType::ImmutableText;
}
else if( string == "immutable-gloss" )
{
mType = InterlinearItemType::ImmutableGloss;
}
else if( string == "pos-tagging" )
{
mType = InterlinearItemType::PosTagging;
}
else
{
mType = InterlinearItemType::Null;
}
mWritingSystem = ws;
}
void InterlinearItemType::setType(LineType type)
{
mType = type;
}
void InterlinearItemType::setWritingSystem(const WritingSystem & ws)
{
mWritingSystem = ws;
}
InterlinearItemType::LineType InterlinearItemType::type() const
{
return mType;
}
QString InterlinearItemType::typeString() const
{
switch(mType)
{
case InterlinearItemType::ImmutableText:
return QObject::tr("Immutable Text");
case InterlinearItemType::ImmutableGloss:
return QObject::tr("Immutable Gloss");
case InterlinearItemType::Text:
return QObject::tr("Text Form");
case InterlinearItemType::Gloss:
return QObject::tr("Gloss");
case InterlinearItemType::Analysis:
return QObject::tr("Analysis");
case InterlinearItemType::PosTagging:
return QObject::tr("Part of Speech Tagging");
case InterlinearItemType::Null:
return QObject::tr("(Null)");
}
return QObject::tr("(Null)");
}
QString InterlinearItemType::typeXmlString() const
{
switch(mType)
{
case InterlinearItemType::ImmutableText:
return QObject::tr("immutable-text");
case InterlinearItemType::ImmutableGloss:
return QObject::tr("immutable-gloss");
case InterlinearItemType::Text:
return QObject::tr("text");
case InterlinearItemType::Gloss:
return QObject::tr("gloss");
case InterlinearItemType::Analysis:
return QObject::tr("analysis");
case InterlinearItemType::PosTagging:
return QObject::tr("pos-tagging");
case InterlinearItemType::Null:
return QObject::tr("(Null)");
}
return QObject::tr("(Null)");
}
WritingSystem InterlinearItemType::writingSystem() const
{
return mWritingSystem;
}
QDebug operator<<(QDebug dbg, const InterlinearItemType &type)
{
switch(type.type())
{
case InterlinearItemType::ImmutableText:
dbg.nospace() << "InterlinearItemType(ImmutableText)";
break;
case InterlinearItemType::ImmutableGloss:
dbg.nospace() << "InterlinearItemType(ImmutableGloss)";
break;
case InterlinearItemType::Text:
dbg.nospace() << "InterlinearItemType(Text)";
break;
case InterlinearItemType::Gloss:
dbg.nospace() << "InterlinearItemType(Gloss)";
break;
case InterlinearItemType::Analysis:
dbg.nospace() << "InterlinearItemType(Analysis)";
break;
case InterlinearItemType::PosTagging:
dbg.nospace() << "InterlinearItemType(PosTagging)";
break;
case InterlinearItemType::Null:
dbg.nospace() << "InterlinearItemType(Null)";
break;
};
return dbg.maybeSpace();
}