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
// Copyright (c) 2012-2017 VideoStitch SAS
// Copyright (c) 2018 stitchEm
#pragma once
#include "libvideostitch-gui/common.hpp"
#include <QVector>
#include <QString>
#define FRAME_EXTENSION QString("-%frame%")
/**
* @brief The ExtensionHandler is a helper class to set and manage file format names.
*/
class VS_GUI_EXPORT ExtensionHandler {
public:
void init();
ExtensionHandler();
virtual ~ExtensionHandler();
/**
* @brief Returns a string with the filename and the extension.
* @param filename The output filename.
* @param format The output format.
* @return The filename containing the extension.
*/
virtual QString handle(const QString &filename, const QString &format) const;
/**
* @brief Given a full filename and a format, returns the file name without the associated extension.
* @param filename The filename with its extension.
* @param format The output format.
* @return Returns the filename without the formated extension.
*/
virtual QString stripBasename(const QString &inputText, const QString &format) const;
protected:
/**
* @brief Adds a specific handler.
* @param handler An extension handler.
*/
void addHandler(ExtensionHandler *handler);
QString extension;
QString format;
private:
QVector<ExtensionHandler *> handlers;
};