CCIMXDesktop
 
Loading...
Searching...
No Matches
ImageCore.h
1#ifndef IMAGECORE_H
2#define IMAGECORE_H
3#include <QMutex>
4#include <QObject>
10class ImageCore {
11public:
23 ImageCore() = default;
28 inline void enImages(const QStringList& l) {
29 QMutexLocker<QMutex> _locker(&lock);
30 for (const QString& p : l) {
31 if (!paths.contains(p)) {
32 paths << p;
33 }
34 }
35 }
36
41 void removeImages(const QStringList& what);
49 std::optional<QString> peek(const int index);
54 inline ErrorType errorType() const { return _errorType; }
59 inline int size() const { return paths.size(); }
64 inline bool empty() const { return paths.empty(); }
65
70 inline void clear() {
71 QMutexLocker<QMutex> _locker(&lock);
72 paths.clear();
73 }
74
81 inline int index(const QString& path) {
82 QMutexLocker<QMutex> _locker(&lock);
83 return paths.indexOf(path);
84 }
85
86private:
87 ErrorType _errorType;
88 QMutex lock;
89 QStringList paths;
90};
91
92#endif // IMAGECORE_H
ImageCore indicates the basic image core utils, by providing the loadable image path.
Definition ImageCore.h:10
void clear()
clear clears up the holdings
Definition ImageCore.h:70
ImageCore()=default
ImageCore.
void removeImages(const QStringList &what)
removeImages remove images
Definition ImageCore.cpp:13
ErrorType
The ErrorType enum.
Definition ImageCore.h:15
@ IMAGEREQ_UNDERFLOW
underflow request
@ IMAGEREQ_OVERFLOW
overflow request
bool empty() const
empty check if empty now
Definition ImageCore.h:64
std::optional< QString > peek(const int index)
peek get the index to and fetch result
Definition ImageCore.cpp:22
ErrorType errorType() const
errorType get the errorType
Definition ImageCore.h:54
int index(const QString &path)
fetch the index of holding path
Definition ImageCore.h:81
int size() const
size get the image size
Definition ImageCore.h:59
void enImages(const QStringList &l)
enImages input images
Definition ImageCore.h:28