digiKam Developer Documentation
Professional Photo Management with the Power of Open Source
Loading...
Searching...
No Matches
Digikam::VersionNamingScheme Class Referenceabstract
+ Inheritance diagram for Digikam::VersionNamingScheme:

Public Member Functions

 VersionNamingScheme ()=default
 Creates and analyzes file names of versioned files.
 
virtual QString baseName (const QString &path, const QString &filename, QVariant *counter=nullptr, QVariant *intermediateCounter=nullptr)=0
 Analyzes the given file name.
 
virtual QString directory (const QString &path, const QString &filename)=0
 For a loaded file in directory path and with file name filename, returns the directory in which a new version (a new intermediate version, resp.) shall be stored.
 
virtual QVariant incrementedCounter (const QVariant &counter)=0
 Returns the given counter "incremented", that is, changed in a steady, repeatable fashion.
 
virtual QVariant initialCounter ()=0
 Returns an initial counter value for version and intermediate number counters.
 
virtual QString intermediateDirectory (const QString &currentPath, const QString &fileName)=0
 
virtual QString intermediateFileName (const QString &path, const QString &filename, const QVariant &version, const QVariant &counter)=0
 Creates a version file name for an intermediate file in given directory, as previously returned by directory(), given baseName, as previously returned by baseName, version and intermediate number counter.
 
virtual QString versionFileName (const QString &path, const QString &baseName, const QVariant &counter)=0
 Creates a version file name for a file in given directory, as previously returned by directory(), given baseName, as previously returned by baseName, and version counter.
 

Member Function Documentation

◆ baseName()

virtual QString Digikam::VersionNamingScheme::baseName ( const QString &  path,
const QString &  filename,
QVariant *  counter = nullptr,
QVariant *  intermediateCounter = nullptr 
)
pure virtual

Returns the basename in the sense of stripping the file name of all added version information: A scheme that appends a number, like "MyFile-1.jpg", shall return "MyFile". Path is the directory, filename the file name, so path + filename is the file path. If counter is given, and the given file name has a version number, write it to counter. If intermediateCounter is given, and the given file name has an intermediate counter number, write it to counter. If not available, do not touch the given counters. See initialCounter() for the valid counter formats.

Implemented in Digikam::DefaultVersionNamingScheme.

◆ directory()

virtual QString Digikam::VersionNamingScheme::directory ( const QString &  path,
const QString &  filename 
)
pure virtual

◆ incrementedCounter()

virtual QVariant Digikam::VersionNamingScheme::incrementedCounter ( const QVariant &  counter)
pure virtual

You shall never return the given counter.

Implemented in Digikam::DefaultVersionNamingScheme.

◆ initialCounter()

virtual QVariant Digikam::VersionNamingScheme::initialCounter ( )
pure virtual

There are two places where you shall generate counters You will receive the given QVariant in incrementedCounter(), versionFileName() and baseName(), and you shall read a counter value from a generated file name in baseName().

Implemented in Digikam::DefaultVersionNamingScheme.

◆ intermediateFileName()

virtual QString Digikam::VersionNamingScheme::intermediateFileName ( const QString &  path,
const QString &  filename,
const QVariant &  version,
const QVariant &  counter 
)
pure virtual

Do not append a file suffix. You do not need to check if the file exists.

Implemented in Digikam::DefaultVersionNamingScheme.

◆ versionFileName()

virtual QString Digikam::VersionNamingScheme::versionFileName ( const QString &  path,
const QString &  baseName,
const QVariant &  counter 
)
pure virtual

Do not append a file suffix. You do not need to check if the file exists.

Implemented in Digikam::DefaultVersionNamingScheme.