-
Notifications
You must be signed in to change notification settings - Fork 2
/
TextExport.cpp
75 lines (63 loc) · 1.98 KB
/
TextExport.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
#include "TextExport.h"
#include "Note.h"
#include "Article.h"
#include "ImageNote.h"
#include "AudioNote.h"
#include "VideoNote.h"
#include "Document.h"
//TextExport
QString TextExport::header() const
{
return "---------Début--------\n";
}
QString TextExport::footer() const
{
return "----------Fin---------\n";
}
QString TextExport::exportNote(const Article *note, unsigned int level) const
{
QString margin = "";
for(unsigned int i=0; i<level; i++){
margin += " ";
}
return margin+"[ART] Title: "+note->getTitle()+"\n"+margin+"Text: "+note->getText()+"\n";
}
QString TextExport::exportNote(const ImageNote *note, unsigned int level) const
{
QString margin = "";
for(unsigned int i=0; i<level; i++){
margin += " ";
}
return margin+"[IMG] Title: "+note->getTitle()+"\n"+margin+"ImagePath: "+note->getMediaPath()+"\n"+margin+"Description: "+note->getDescription()+"\n";
}
QString TextExport::exportNote(const Document *doc, unsigned int level) const
{
QString margin = "";
QString str;
for(unsigned int i=0; i<level; i++){
margin += " ";
}
str+=margin+"[DOC] Title: "+doc->getTitle()+"\n";
level++;
for(QList<Note *>::const_iterator it = doc->begin(); it!=doc->end(); it++)
{
str+=(*it)->exportNote(this, level);
}
return str;
}
QString TextExport::exportNote(const VideoNote *note, unsigned int level) const
{
QString margin = "";
for(unsigned int i=0; i<level; i++){
margin += " ";
}
return margin+"[VID] Title: "+note->getTitle()+"\n"+margin+"ImagePath: "+note->getMediaPath()+"\n"+margin+"Description: "+note->getDescription()+"\n";
}
QString TextExport::exportNote(const AudioNote *note, unsigned int level) const
{
QString margin = "";
for(unsigned int i=0; i<level; i++){
margin += " ";
}
return margin+"[AUD] Title: "+note->getTitle()+"\n"+margin+"ImagePath: "+note->getMediaPath()+"\n"+margin+"Description: "+note->getDescription()+"\n";
}