-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathflextextwriter.h
73 lines (52 loc) · 2.41 KB
/
flextextwriter.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
64
65
66
67
68
69
70
71
72
73
/*!
\class FlexTextWriter
\ingroup IO
\brief This object writes the data in a Text object to a .flextext file. Instantiated in Text.
*/
#ifndef FLEXTEXTWRITER_H
#define FLEXTEXTWRITER_H
#include <QtGlobal>
class Text;
class QString;
class QXmlStreamWriter;
class Allomorph;
class GlossItem;
class WritingSystem;
class SyntacticAnalysis;
class SyntacticAnalysisElement;
class Annotation;
class FlexTextWriter
{
public:
explicit FlexTextWriter(Text *text);
bool writeFile( const QString & filename );
void setVerboseOutput(bool value);
void setIncludeGlossNamespace(bool value);
private:
Text *mText;
bool mVerboseOutput;
bool mIncludeGlossNamespace;
QXmlStreamWriter * mStream;
//! \brief Serialize the interlinear text (i.e., <interlinear-text> to the XML stream
bool serializeInterlinearText() const;
bool serializeGlossItem(GlossItem *glossItem) const;
bool serializePunctuation(GlossItem *glossItem) const;
bool serializeGrammaticalAnalysis(const SyntacticAnalysis * analysis) const;
bool serializeGrammaticalElement(const SyntacticAnalysisElement * element) const;
//! \brief Serialize the interlinear text (i.e., <interlinear-text> to the XML stream)
bool serializeMorphemes(GlossItem *glossItem) const;
//! \brief Serialize the allomorph (i.e., <morph> in the XML stream)
bool serializeAllomorph(const Allomorph & allomorph) const;
//! \brief Serialize the allomorph (i.e., <morph> in the XML stream) without including all of the database information
bool serializeAllomorphNonverbose(const Allomorph & allomorph) const;
bool serializeAnnotation(const QString & key, const Annotation & annotation) const;
//! \brief Serialize the languages.
bool serializeLanguages() const;
//! \brief Write an <item> to the text stream, with specified attributes and text content
void serializeItem(const QString & type, const WritingSystem & ws, const QString & text , qlonglong id = -1) const;
//! \brief Write an <item> to the text stream, with specified attributes and text content
void serializeItemNonVerbose(const QString & type, const WritingSystem & ws, qlonglong id = -1) const;
//! \brief If the Gloss namespace is being included in the output, writes an attribute with name \a name and value \a value.
void writeNamespaceAttribute(const QString & name, const QString & value) const;
};
#endif // FLEXTEXTWRITER_H