digiKam
versionnamingscheme.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2010-12-20
7  * Description : Interface for version file naming
8  *
9  * Copyright (C) 2010-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
10  * Copyright (C) 2010 by Martin Klapetek <martin dot klapetek at gmail dot com>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option)
16  * any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_VERSION_NAMING_SCHEME_H
26 #define DIGIKAM_VERSION_NAMING_SCHEME_H
27 
28 // Qt includes
29 
30 #include <QString>
31 #include <QVariant>
32 
33 // Local includes
34 
35 #include "digikam_export.h"
36 
37 namespace Digikam
38 {
39 
40 class DIGIKAM_EXPORT VersionNamingScheme
41 {
42 public:
43 
47  VersionNamingScheme() = default;
48  virtual ~VersionNamingScheme() = default;
49 
60  virtual QString baseName(const QString& path,
61  const QString& filename,
62  QVariant* counter = nullptr,
63  QVariant* intermediateCounter = nullptr) = 0;
64 
71  virtual QString versionFileName(const QString& path,
72  const QString& baseName,
73  const QVariant& counter) = 0;
74 
82  virtual QString intermediateFileName(const QString& path,
83  const QString& filename,
84  const QVariant& version,
85  const QVariant& counter) = 0;
86 
91  virtual QString directory(const QString& path,
92  const QString& filename) = 0;
93  virtual QString intermediateDirectory(const QString& currentPath,
94  const QString& fileName) = 0;
95 
103  virtual QVariant initialCounter() = 0;
104 
109  virtual QVariant incrementedCounter(const QVariant& counter) = 0;
110 
111 private:
112 
113  Q_DISABLE_COPY(VersionNamingScheme)
114 };
115 
116 // -----------------------------------------------------------------------------------------------------
117 
119 {
120 public:
121 
123  virtual ~DefaultVersionNamingScheme() = default;
124 
125  virtual QString baseName(const QString& currentPath, const QString& filename,
126  QVariant* counter, QVariant* intermediateCounter) override;
127  virtual QString versionFileName(const QString& currentPath, const QString& filename,
128  const QVariant& counter) override;
129  virtual QString intermediateFileName(const QString& currentPath, const QString& filename,
130  const QVariant& version, const QVariant& counter) override;
131  virtual QString directory(const QString& currentPath, const QString& filename) override;
132  virtual QString intermediateDirectory(const QString& currentPath, const QString& fileName) override;
133  virtual QVariant initialCounter() override;
134  virtual QVariant incrementedCounter(const QVariant& counter) override;
135 
136 private:
137 
138  Q_DISABLE_COPY(DefaultVersionNamingScheme)
139 };
140 
141 } // namespace Digikam
142 
143 #endif // DIGIKAM_VERSION_NAMING_SCHEME_H
Definition: versionnamingscheme.h:119
virtual ~DefaultVersionNamingScheme()=default
Definition: versionnamingscheme.h:41
virtual QString intermediateFileName(const QString &path, const QString &filename, const QVariant &version, const QVariant &counter)=0
virtual ~VersionNamingScheme()=default
virtual QString baseName(const QString &path, const QString &filename, QVariant *counter=nullptr, QVariant *intermediateCounter=nullptr)=0
virtual QString versionFileName(const QString &path, const QString &baseName, const QVariant &counter)=0
virtual QString directory(const QString &path, const QString &filename)=0
virtual QVariant initialCounter()=0
virtual QVariant incrementedCounter(const QVariant &counter)=0
virtual QString intermediateDirectory(const QString &currentPath, const QString &fileName)=0
Definition: datefolderview.cpp:43