-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathextractorfactory.cpp
41 lines (34 loc) · 1 KB
/
extractorfactory.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
#include <memory>
#include <QUrl>
#include "extractors/baseextractor.hpp"
#include "extractors/dailymotionextractor.hpp"
#include "extractors/instagramextractor.hpp"
#include "extractors/tumblrextractor.hpp"
#include "extractors/youtubeextractor.hpp"
#include "extractorfactory.hpp"
namespace vfg {
namespace extractor {
std::unique_ptr<vfg::extractor::BaseExtractor> ExtractorFactory::getExtractor(const QUrl& url) const
{
std::unique_ptr<vfg::extractor::BaseExtractor> out;
out.reset(new vfg::extractor::DailyMotionExtractor);
if(out->isSame(url)) {
return out;
}
out.reset(new vfg::extractor::InstagramExtractor);
if(out->isSame(url)) {
return out;
}
out.reset(new vfg::extractor::TumblrExtractor);
if(out->isSame(url)) {
return out;
}
out.reset(new vfg::extractor::YoutubeExtractor);
if(out->isSame(url)) {
return out;
}
out.reset(new vfg::extractor::BaseExtractor);
return out;
}
} // namespace extractor
} // namespace vfg