-
Notifications
You must be signed in to change notification settings - Fork 2
/
ExportStrategy.cpp
49 lines (41 loc) · 1.35 KB
/
ExportStrategy.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
#include "ExportStrategy.h"
#include "HtmlExport.h"
#include "TexExport.h"
#include "TextExport.h"
#include "SaveTextExport.h"
#include "TagManager.h"
#include "Tag.h"
#include <QMap>
//QMap<ExportType, ExportStrategy*> ExportStrategy::strategies = QMap<ExportType, ExportStrategy*>();
//ExportStrategy
ExportStrategy::ExportStrategy()
{
tm = &TagManager::getInstance();
}
/*!
* \brief ExportStrategy::TagsToString Convertir un QSet de tags en String, separer par |||
* \param set l'ensemble a convertir.
* \return
*/
QString ExportStrategy::TagsToString(const QSet<Tag*>& set){
QString str;
for(QSet<Tag*>::const_iterator it = set.begin(); it!=set.end(); ++it){
str += (*it)->getName() + "|||";
}
if(!str.isNull())
str.chop(3);
return str;
}
/*!
* \brief ExportStrategy::getStrategy retourner tous les \link<ExportStrategy> disponibles
* \return un QMap de <ExportType, ExportStrategy>.
*/
QMap<ExportType, ExportStrategy*>* ExportStrategy::getStrategies()
{
QMap<ExportType, ExportStrategy*> *strategies = new QMap<ExportType, ExportStrategy*>();
strategies->insert(html, new HtmlExport());
strategies->insert(tex, new TexExport());
strategies->insert(text, new TextExport());
strategies->insert(saveText, new SaveTextExport());
return strategies;
}